X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile%2Fdecos.inc.php;h=5c413163a9ba2a32def95bd854f04fa39df39e72;hb=53595c2a9d1df6993dd69217c4bd1a6a9d51bff7;hp=6dfc8e6fa47315825dd0ba954b93d8e912583abb;hpb=024ec1e521fb7b16c72602dc0a85ef60c01bbdf7;p=platal.git diff --git a/modules/profile/decos.inc.php b/modules/profile/decos.inc.php index 6dfc8e6..5c41316 100644 --- a/modules/profile/decos.inc.php +++ b/modules/profile/decos.inc.php @@ -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 @@ -82,9 +79,18 @@ class ProfileSettingDeco implements ProfileSetting } } } + + public function getText($value) { + $medalsList = DirEnum::getOptions(DirEnum::MEDALS); + $medals = array(); + foreach ($value as $id => $medal) { + $medals[] = $medalsList[$id]; + } + return implode(', ', $medals); + } } -class ProfileSettingDecos extends ProfilePage +class ProfilePageDecos extends ProfilePage { protected $pg_template = 'profile/deco.tpl'; @@ -117,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); } }