X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile.php;h=b75fbe0a9f09fa64dadd0497fb3604e6c4b60b7b;hb=a5878ac19cc6ea75a753470cf68b7d2180d6cd51;hp=c72a9c0ef4ee278646dd457773df1c01c4625413;hpb=afada5eb6cf23005f775fbab0d421c27393172f1;p=platal.git diff --git a/modules/profile.php b/modules/profile.php index c72a9c0..b75fbe0 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -59,6 +59,8 @@ class ProfileModule extends PLModule 'admin/sections' => $this->make_hook('admin_sections', AUTH_MDP, 'admin'), 'admin/secteurs' => $this->make_hook('admin_secteurs', AUTH_MDP, 'admin'), 'admin/trombino' => $this->make_hook('admin_trombino', AUTH_MDP, 'admin'), + 'admin/ss_secteurs' => $this->make_hook('admin_ss_secteurs', AUTH_MDP, 'admin'), + 'admin/fonctions' => $this->make_hook('admin_fonctions', AUTH_MDP, 'admin'), ); } @@ -302,9 +304,9 @@ class ProfileModule extends PLModule // Build the page $page->addJsLink('ajax.js'); - $page->addJsLink('profile.js'); $page->addJsLink('applis.js'); $page->addJsLink('grades.js'); + $page->addJsLink('profile.js'); $wiz = new PlWizard('Profil', 'core/plwizard.tpl', true, true); require_once dirname(__FILE__) . '/profile/page.inc.php'; $wiz->addPage('ProfileGeneral', 'Général', 'general'); @@ -763,16 +765,32 @@ class ProfileModule extends PLModule } function handler_admin_sections(&$page, $action = 'list', $id = null) { $page->assign('xorg_title','Polytechnique.org - Administration - Sections'); - $page->assign('title', 'Gestion des Sections'); + $page->assign('title', 'Gestion des sections'); $table_editor = new PLTableEditor('admin/sections','sections','id'); $table_editor->describe('text','intitulé',true); $table_editor->apply($page, $action, $id); } + function handler_admin_ss_secteurs(&$page, $action = 'list', $id = null) { + $page->assign('xorg_title', 'Polytechnique.org - Administration - Sous-secteurs'); + $page->assign('title', 'Gestion des sous-secteurs'); + $table_editor = new PLTableEditor('admin/ss_secteurs', 'emploi_ss_secteur', 'id', true); + $table_editor->describe('label', 'intitulé', true); + $table_editor->apply($page, $action, $id); + } + function handler_admin_fonctions(&$page, $action = 'list', $id = null) { + $page->assign('xorg_title', 'Polytechnique.org - Administration - Fonctions'); + $page->assign('title', 'Gestion des fonctions'); + $table_editor = new PLTableEditor('admin/fonctions', 'fonctions_def', 'id', true); + $table_editor->describe('fonction_fr', 'intitulé', true); + $table_editor->describe('fonction_en', 'intitulé (ang)', true); + $table_editor->describe('flags', 'titre', true); + $table_editor->apply($page, $action, $id); + } function handler_admin_secteurs(&$page, $action = 'list', $id = null) { - $page->assign('xorg_title','Polytechnique.org - Administration - Secteurs'); - $page->assign('title', 'Gestion des Secteurs'); - $table_editor = new PLTableEditor('admin/secteurs','emploi_secteur','id'); - $table_editor->describe('label','intitulé',true); + $page->assign('xorg_title', 'Polytechnique.org - Administration - Secteurs'); + $page->assign('title', 'Gestion des secteurs'); + $table_editor = new PLTableEditor('admin/secteurs', 'emploi_secteur', 'id', true); + $table_editor->describe('label', 'intitulé', true); $table_editor->apply($page, $action, $id); } function handler_admin_medals(&$page, $action = 'list', $id = null) { @@ -791,15 +809,24 @@ class ProfileModule extends PLModule 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={?} AND mid={?}', $_POST['pos'][$gid], $text, $gid, $mid); + if ($gid === 0) { + if (!empty($text)) { + $res = XDB::query('SELECT MAX(gid) + FROM profile_medals_grades + WHERE mid = {?}', $mid); + $gid = $res->fetchOneCell() + 1; + + XDB::execute('INSERT INTO profile_medals_grades (mid, gid, text, pos) + VALUES ({?}, {?}, {?}, {?})', + $mid, $gid, $text, $_POST['pos']['0']); + } + } else { + XDB::execute('UPDATE profile_medals_grades + SET pos={?}, text={?} + WHERE gid={?} AND mid={?}', $_POST['pos'][$gid], $text, $gid, $mid); + } } } $res = XDB::iterator('SELECT gid, text, pos FROM profile_medals_grades WHERE mid={?} ORDER BY pos', $mid);