From f68a235e71400e883b43feb8ab7cf8c58bda99de Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Sun, 16 Jan 2005 14:09:49 +0000 Subject: [PATCH] closes FS#210 git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-354 --- ChangeLog | 1 + htdocs/admin/gerer_decos.php | 51 ++++++++++++++++++++++++ templates/admin/gerer_decos.tpl | 88 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 htdocs/admin/gerer_decos.php create mode 100644 templates/admin/gerer_decos.tpl diff --git a/ChangeLog b/ChangeLog index 769a1ea..b43e46b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -73,6 +73,7 @@ Bug/Wish : - #65 : Add professionnal cellphone. -Car - #170 : Remove region display for french departments. -Car - #204 : Add nicknames (searchable too). -MC + - #210 : Add medals and orders. -MC * Search : - #249, #251, #253 : Some tweaks to be more accurate. -MC diff --git a/htdocs/admin/gerer_decos.php b/htdocs/admin/gerer_decos.php new file mode 100644 index 0000000..6c1a5b4 --- /dev/null +++ b/htdocs/admin/gerer_decos.php @@ -0,0 +1,51 @@ +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::get('frm_id')) { + $page->changeTpl('admin/gerer_decos.tpl'); + + $mid = Post::getInt('frm_id'); + + if (Post::get('act') == 'del') { + $globals->xdb->execute('DELETE FROM profile_medals_grades WHERE mid={?} AND gid={?}', $mid, Post::getInt('gid')); + } elseif (Post::get('act') == 'new') { + $globals->xdb->execute('INSERT INTO profile_medals_grades (mid,gid) VALUES({?},{?})', + $mid, max(array_keys(Post::getMixed('grades', Array(0))))+1); + } else { + foreach (Post::getMixed('grades', Array()) as $gid=>$text) { + $globals->xdb->execute('UPDATE profile_medals_grades SET pos={?}, text={?} WHERE gid={?}', $_POST['pos'][$gid], $text, $gid); + } + } + $res = $globals->xdb->iterator('SELECT gid, text, pos FROM profile_medals_grades WHERE mid={?} ORDER BY pos', $mid); + $page->assign('grades', $res); +} + +$editor->run(); +?> diff --git a/templates/admin/gerer_decos.tpl b/templates/admin/gerer_decos.tpl new file mode 100644 index 0000000..28eefcb --- /dev/null +++ b/templates/admin/gerer_decos.tpl @@ -0,0 +1,88 @@ +{*************************************************************************** + * Copyright (C) 2003-2004 Polytechnique.org * + * http://opensource.polytechnique.org/ * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program; if not, write to the Free Software * + * Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * + ***************************************************************************} + +{include file=table-editor.tpl} + +

Administration Polytechnique.org

+ +{literal} + +{/literal} + +
+ + + + + + + + + + + + {iterate from=$grades item=g} + + + + + + + {/iterate} + + + +
idintituléordre 
+ Nouveau ... + + nouveau +
{$g.gid} + + + + + suppr. +
+ + + + + +
+
+ +{* vim:set et sw=2 sts=2 sws=2: *} -- 2.1.4