Merge remote branch 'origin/xorg/maint' into xorg/master
[platal.git] / modules / profile / decos.inc.php
index a6cfabc..1c914b5 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2011 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -38,7 +38,6 @@ class ProfileSettingDeco implements ProfileSetting
             }
 
             // Fetch not yet validated medals
-            require_once 'validations.inc.php';
             $medals = ProfileValidate::get_typed_requests($page->pid(), 'medal');
             foreach ($medals as &$medal) {
                 $value[$medal->mid] = array('grade' => $medal->gid,
@@ -53,8 +52,6 @@ class ProfileSettingDeco implements ProfileSetting
 
     public function save(ProfilePage &$page, $field, $value)
     {
-        require_once 'validations.inc.php';
-
         $orig =& $page->orig[$field];
 
         // Remove old ones
@@ -93,7 +90,7 @@ class ProfileSettingDeco implements ProfileSetting
     }
 }
 
-class ProfileSettingDecos extends ProfilePage
+class ProfilePageDecos extends ProfilePage
 {
     protected $pg_template = 'profile/deco.tpl';
 
@@ -126,21 +123,24 @@ class ProfileSettingDecos extends ProfilePage
 
     public function _prepare(PlPage &$page, $id)
     {
-        $res    = XDB::iterator("SELECT  *, FIND_IN_SET('validation', flags) AS validate
-                                   FROM  profile_medal_enum
-                               ORDER BY  type, text");
-        $mlist  = array();
+        $res = XDB::iterator('SELECT  *, FIND_IN_SET(\'validation\', flags) AS validate
+                                FROM  profile_medal_enum
+                            ORDER BY  type, text');
+        $mlist = array();
         while ($tmp = $res->next()) {
             $mlist[$tmp['type']][] = $tmp;
         }
         $page->assign('medal_list', $mlist);
-        $trad = Array('ordre'      => 'Ordres',
-                      'croix'      => 'Croix',
-                      'militaire'  => 'Médailles militaires',
-                      'honneur'    => 'Médailles d\'honneur',
-                      'resistance' => 'Médailles de la résistance',
-                      'prix'       => 'Prix');
-        $page->assign('trad', $trad);
+        $fullType = array(
+            'ordre'      => 'Ordres',
+            'croix'      => 'Croix',
+            'militaire'  => 'Médailles militaires',
+            'honneur'    => 'Médailles d\'honneur',
+            'resistance' => 'Médailles de la résistance',
+            'prix'       => 'Prix',
+            'sport'      => 'Médailles sportives'
+        );
+        $page->assign('fullType', $fullType);
     }
 }