Update core
[platal.git] / modules / profile / decos.inc.php
index a6cfabc..e96e519 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   *
@@ -21,7 +21,7 @@
 
 class ProfileSettingDeco implements ProfileSetting
 {
-    public function value(ProfilePage &$page, $field, $value, &$success)
+    public function value(ProfilePage $page, $field, $value, &$success)
     {
         $success = true;
         if (is_null($value)) {
@@ -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,
@@ -51,10 +50,8 @@ class ProfileSettingDeco implements ProfileSetting
         return $value;
     }
 
-    public function save(ProfilePage &$page, $field, $value)
+    public function save(ProfilePage $page, $field, $value)
     {
-        require_once 'validations.inc.php';
-
         $orig =& $page->orig[$field];
 
         // Remove old ones
@@ -93,11 +90,11 @@ class ProfileSettingDeco implements ProfileSetting
     }
 }
 
-class ProfileSettingDecos extends ProfilePage
+class ProfilePageDecos extends ProfilePage
 {
     protected $pg_template = 'profile/deco.tpl';
 
-    public function __construct(PlWizard &$wiz)
+    public function __construct(PlWizard $wiz)
     {
         parent::__construct($wiz);
         $this->settings['medals'] = new ProfileSettingDeco();
@@ -124,23 +121,26 @@ class ProfileSettingDecos extends ProfilePage
         }
     }
 
-    public function _prepare(PlPage &$page, $id)
+    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);
     }
 }