assign('xorg_title','Polytechnique.org - Administration - Distinctions'); $editor->describe('type', 'type', true, 'set'); $editor->describe('text', 'intitulé', true); $editor->describe('img', 'nom de l\'image', false); $editor->assign('title', 'Gestion des Distinctions'); if (Post::v('frm_id')) { $page->changeTpl('admin/gerer_decos.tpl'); $mid = Post::i('frm_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); } $editor->run(); ?>