Improves registration's first part to properly take into account master and doctorate...
[platal.git] / classes / profile.php
index 73a9fff..249de86 100644 (file)
@@ -48,6 +48,17 @@ class Profile implements PlExportable
     const DEGREE_M = 'Master';
     const DEGREE_D = 'Doctorat';
 
+    static public $cycles = array(
+        self::DEGREE_X => 'polytechnicien',
+        self::DEGREE_M => 'master',
+        self::DEGREE_D => 'docteur'
+    );
+    static public $cycle_prefixes = array(
+        self::DEGREE_X => 'X',
+        self::DEGREE_M => 'M',
+        self::DEGREE_D => 'D'
+    );
+
     static public $name_variants = array(
             self::LASTNAME => array(self::VN_MARITAL, self::VN_ORDINARY),
             self::FIRSTNAME => array(self::VN_ORDINARY, self::VN_INI, self::VN_OTHER)
@@ -113,6 +124,7 @@ class Profile implements PlExportable
         'networking'      => 'Messageries…',
         'tels'            => 'Téléphones',
         'edus'            => 'Formations',
+        'main_edus'       => 'Formations à l\'X',
         'promo'           => 'Promotion de sortie',
         'birthdate'       => 'Date de naissance',
         'yourself'        => 'Nom affiché',
@@ -181,14 +193,26 @@ class Profile implements PlExportable
         return false;
     }
 
-    public function promo()
+    public function promo($details = false)
     {
+        if ($details && ($this->program || $this->fieldid)) {
+            $text = array();
+            if ($this->program) {
+                $text[] = $this->program;
+            }
+            if ($this->fieldid) {
+                $fieldsList = DirEnum::getOptions(DirEnum::EDUFIELDS);
+                $text[] = $fieldsList[$this->fieldid];
+            }
+            return $this->promo . ' (' . implode(', ', $text) . ')';
+        }
+
         return $this->promo;
     }
 
     public function yearpromo()
     {
-        return intval(substr($this->promo, 1, 4));
+        return $this->promo_year;
     }
 
     /** Check if user is an orange (associated with several promos)
@@ -880,7 +904,7 @@ class Profile implements PlExportable
                                      IF ({?}, p.cv, NULL) AS cv, p.medals_pub, p.alias_pub, p.email_directory,
                                      p.last_change, p.nationality1, p.nationality2, p.nationality3,
                                      IF (p.freetext_pub IN {?}, p.freetext, NULL) AS freetext,
-                                     pe.entry_year, pe.grad_year,
+                                     pe.entry_year, pe.grad_year, pe.promo_year, pe.program, pe.fieldid,
                                      IF ({?}, pse.text, NULL) AS section,
                                      pn_f.name AS firstname, pn_l.name AS lastname,
                                      IF( {?}, pn_n.name, NULL) AS nickname,