+ function handler_admin_formations(&$page, $action = 'list', $id = null) {
+ $page->assign('xorg_title','Polytechnique.org - Administration - Formations');
+ $page->assign('title', 'Gestion des formations');
+ $table_editor = new PLTableEditor('admin/formations','applis_def','id');
+ $table_editor->add_join_table('applis_ins','aid',true);
+ $table_editor->describe('text','intitulé',true);
+ $table_editor->describe('url','site web',false);
+ $table_editor->apply($page, $action, $id);
+ }
+ function handler_admin_groupesx(&$page, $action = 'list', $id = null) {
+ $page->assign('xorg_title','Polytechnique.org - Administration - Groupes X');
+ $page->assign('title', 'Gestion des Groupes X');
+ $table_editor = new PLTableEditor('admin/groupes-x','groupesx_def','id');
+ $table_editor->add_join_table('groupesx_ins','gid',true);
+ $table_editor->describe('text','intitulé',true);
+ $table_editor->describe('url','site web',false);
+ $table_editor->apply($page, $action, $id);
+ }
+ function handler_admin_medals(&$page, $action = 'list', $id = null) {
+ $page->assign('xorg_title','Polytechnique.org - Administration - Distinctions');
+ $page->assign('title', 'Gestion des Distinctions');
+ $table_editor = new PLTableEditor('admin/medals','profile_medals','id');
+ $table_editor->describe('text', 'intitulé', true);
+ $table_editor->describe('img', 'nom de l\'image', false);
+ $table_editor->describe('flags', 'valider', true);
+ $table_editor->apply($page, $action, $id);
+ if ($id && $action == 'edit') {
+ $page->changeTpl('profile/admin_decos.tpl');
+
+ $mid = $id;
+
+ if (Post::v('act') == 'del') {
+ XDB::execute('DELETE FROM profile_medals_grades WHERE mid={?} AND gid={?}', $mid, Post::i('gid'));
+ } elseif (Post::v('act') == 'new') {
+ XDB::execute('INSERT INTO profile_medals_grades (mid,gid) VALUES({?},{?})',
+ $mid, max(array_keys(Post::v('grades', array(0))))+1);
+ } else {
+ foreach (Post::v('grades', array()) as $gid=>$text) {
+ XDB::execute('UPDATE profile_medals_grades SET pos={?}, text={?} WHERE gid={?}', $_POST['pos'][$gid], $text, $gid);
+ }
+ }
+ $res = XDB::iterator('SELECT gid, text, pos FROM profile_medals_grades WHERE mid={?} ORDER BY pos', $mid);
+ $page->assign('grades', $res);
+ }
+ }