Moves description list of profile items to Profile class.
authorStéphane Jacob <sj@m4x.org>
Sun, 5 Dec 2010 22:24:15 +0000 (23:24 +0100)
committerStéphane Jacob <sj@m4x.org>
Mon, 6 Dec 2010 15:49:52 +0000 (16:49 +0100)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
bin/cron/profile_modification.php
classes/profile.php
include/notifs.inc.php

index 3de42e9..ef7cbdf 100755 (executable)
@@ -24,36 +24,6 @@ require_once 'connect.db.inc.php';
 require_once 'plmailer.php';
 global $globals;
 
-$translations = array(
-    'search_names'    => 'Noms',
-    'nationality1'    => 'Nationalité',
-    'nationality2'    => '2e nationalité',
-    'nationality3'    => '3e nationalité',
-    'promo_display'   => 'Promotion affichée',
-    'email_directory' => 'Email annuaire papier',
-    'networking'      => 'Messageries…',
-    'tels'            => 'Téléphones',
-    'edus'            => 'Formations',
-    'promo'           => 'Promotion de sortie',
-    'birthdate'       => 'Date de naissance',
-    'yourself'        => 'Nom affiché',
-    'freetext'        => 'Commentaire',
-    'freetext_pub'    => 'Affichage de ton commentaire',
-    'photo_pub'       => 'Affichage de ta photo',
-    'addresses'       => 'Adresses',
-    'corps'           => 'Corps',
-    'cv'              => 'CV',
-    'jobs'            => 'Emplois',
-    'section'         => 'Section',
-    'binets'          => 'Binets',
-    'medals'          => 'Décorations',
-    'medals_pub'      => 'Affichage de tes décorations',
-    'competences'     => 'Compétences',
-    'langues'         => 'Langues',
-    'expertise'       => 'Expertises (mentoring)',
-    'terms'           => 'Compétences (mentoring)',
-    'countries'       => 'Pays (mentoring)'
-);
 $res = XDB::iterator('SELECT  p.hrpid, pm.pid, a.full_name, pm.field, pm.oldText, pm.newText, p.sex, pd.yourself, al.alias
                         FROM  profile_modifications AS pm
                   INNER JOIN  accounts              AS a  ON (pm.uid = a.uid)
@@ -76,7 +46,7 @@ if ($res->total() > 0) {
     $modifications = array();
     $modifications[] = array(
         'full_name' => $values['full_name'],
-        'field'     => $translations[$values['field']],
+        'field'     => $values['field'],
         'oldText'   => $values['oldText'],
         'newText'   => $values['newText'],
     );
@@ -100,7 +70,7 @@ if ($res->total() > 0) {
         $hrpid = $values['hrpid'];
         $modifications[] = array(
             'full_name' => $values['full_name'],
-            'field'     => $translations[$values['field']],
+            'field'     => $values['field'],
             'oldText'   => $values['oldText'],
             'newText'   => $values['newText'],
         );
index bb948e0..df2771e 100644 (file)
@@ -103,6 +103,38 @@ class Profile
 
     const FETCH_ALL          = 0x0007FF; // OR of FETCH_*
 
+    static public $descriptions = array(
+        'search_names'    => 'Noms',
+        'nationality1'    => 'Nationalité',
+        'nationality2'    => '2e nationalité',
+        'nationality3'    => '3e nationalité',
+        'promo_display'   => 'Promotion affichée',
+        'email_directory' => 'Email annuaire papier',
+        'networking'      => 'Messageries…',
+        'tels'            => 'Téléphones',
+        'edus'            => 'Formations',
+        'promo'           => 'Promotion de sortie',
+        'birthdate'       => 'Date de naissance',
+        'yourself'        => 'Nom affiché',
+        'freetext'        => 'Commentaire',
+        'freetext_pub'    => 'Affichage du commentaire',
+        'photo'           => 'Photographie',
+        'photo_pub'       => 'Affichage de la photographie',
+        'addresses'       => 'Adresses',
+        'corps'           => 'Corps',
+        'cv'              => 'CV',
+        'jobs'            => 'Emplois',
+        'section'         => 'Section',
+        'binets'          => 'Binets',
+        'medals'          => 'Décorations',
+        'medals_pub'      => 'Affichage des décorations',
+        'competences'     => 'Compétences',
+        'langues'         => 'Langues',
+        'expertise'       => 'Expertises (mentoring)',
+        'terms'           => 'Compétences (mentoring)',
+        'countries'       => 'Pays (mentoring)'
+    );
+
     private $fetched_fields  = 0x000000;
 
     private $pid;
index 0d2c5e2..b114ae5 100644 (file)
@@ -100,23 +100,6 @@ class WatchProfileUpdate extends WatchOperation
         return $user->profile()->last_change;
     }
 
-    static private $descriptions = array('search_names' => 'L\'un de ses noms',
-                                         'freetext'     => 'Le texte libre',
-                                         'mobile'       => 'Son numéro de téléphone portable',
-                                         'nationalite'  => 'Sa nationalité',
-                                         'nationalite2' => 'Sa seconde nationalité',
-                                         'nationalite3' => 'Sa troisième nationalité',
-                                         'nick'         => 'Son surnom',
-                                         'networking'   => 'La liste de ses adresses de networking',
-                                         'edus'         => 'Ses formations',
-                                         'addresses'    => 'Ses adresses',
-                                         'section'      => 'Sa section sportive',
-                                         'binets'       => 'La liste de ses binets',
-                                         'medals'       => 'Ses décorations',
-                                         'cv'           => 'Son Curriculum Vitae',
-                                         'corps'        => 'Son Corps d\'État',
-                                         'jobs'         => 'Ses informations professionnelles',
-                                         'photo'        => 'Sa photographie');
     public function getData(PlUser &$user)
     {
         $data = XDB::fetchColumn("SELECT  field
@@ -129,7 +112,7 @@ class WatchProfileUpdate extends WatchOperation
         } else {
             $text = array();
             foreach ($data as $f) {
-                $text[] = self::$descriptions[$f];
+                $text[] = Profile::$descriptions[$f];
             }
             return $text;
         }