From: Pierre Habouzit (MadCoder Date: Sat, 15 Jan 2005 22:42:11 +0000 (+0000) Subject: you can now add decorations, medals and stuff in the profile X-Git-Tag: xorg/old~409 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=f3cef4ca66a6bf8389296340626dade9133ed9ae;p=platal.git you can now add decorations, medals and stuff in the profile git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-348 --- diff --git a/htdocs/images/medals/croix_cc.jpg b/htdocs/images/medals/croix_cc.jpg new file mode 100644 index 0000000..3d16ef2 Binary files /dev/null and b/htdocs/images/medals/croix_cc.jpg differ diff --git a/include/profil/assign_deco.inc.php b/include/profil/assign_deco.inc.php new file mode 100644 index 0000000..fc1cdc2 --- /dev/null +++ b/include/profil/assign_deco.inc.php @@ -0,0 +1,43 @@ +xdb->iterator("SELECT * FROM profile_medals_grades ORDER BY mid, pos"); +$grades = Array(); +while ($tmp = $res->next()) { + $grades[$tmp['mid']][] = $tmp; +} + +$res = $globals->xdb->iterator("SELECT * FROM profile_medals ORDER BY type, text"); +$mlist = Array(); +while ($tmp = $res->next()) { + $mlist[$tmp['type']][] = $tmp; +} + +$trad = Array('ordre' => 'Ordres ...', 'croix' => 'Croix ...', 'militaire' => 'Médailles militaires ...', + 'honneur' => 'Médailles d\'honneur', 'resistance' => 'Médailles de la résistance ...'); + +$page->gassign('grades'); +$page->gassign('medals'); +$page->gassign('trad'); +$page->assign('medal_list', $mlist); + +?> diff --git a/include/profil/get_deco.inc.php b/include/profil/get_deco.inc.php new file mode 100644 index 0000000..01853a2 --- /dev/null +++ b/include/profil/get_deco.inc.php @@ -0,0 +1,45 @@ +xdb->execute("DELETE FROM profile_medals_sub WHERE uid = {?} AND mid = {?}", Session::getInt('uid', -1), Env::getInt('medal_id', -1)); + } + + if (Env::get('medal_op')=='ajouter' && Env::getInt('medal_id')) { + $globals->xdb->execute("INSERT INTO profile_medals_sub (uid,mid) VALUES ({?}, {?})", Session::getInt('uid', -1), Env::getInt('medal_id')); + } +} + +foreach (Post::getMixed('grade') as $mid=>$gid) { + $globals->xdb->execute('UPDATE profile_medals_sub SET gid={?} WHERE uid={?} AND mid={?}', $gid, Session::getInt('uid'), $mid); +} + + +$res = $globals->xdb->query( + "SELECT m.id, m.text AS medal, m.type, m.img, s.gid + FROM profile_medals_sub AS s + INNER JOIN profile_medals AS m ON ( s.mid = m.id ) + WHERE s.uid = {?}", Session::getInt('uid', -1)); + +$medals = $res->fetchAllAssoc(); + +?> diff --git a/include/profil/update_deco.inc.php b/include/profil/update_deco.inc.php new file mode 100644 index 0000000..330b130 --- /dev/null +++ b/include/profil/update_deco.inc.php @@ -0,0 +1,22 @@ + diff --git a/include/profil/verif_deco.inc.php b/include/profil/verif_deco.inc.php new file mode 100644 index 0000000..85452e9 --- /dev/null +++ b/include/profil/verif_deco.inc.php @@ -0,0 +1,21 @@ + diff --git a/include/tabs.inc.php b/include/tabs.inc.php index 81f2a58..559179f 100644 --- a/include/tabs.inc.php +++ b/include/tabs.inc.php @@ -24,6 +24,7 @@ $tabname_array = Array( "general" => "Informations\ngénérales", "adresses" => "Adresses\npersonnelles", "poly" => "Informations\npolytechniciennes", + "deco" => "Décorations\nMédailles", "emploi" => "Informations\nprofessionnelles", "skill" => "Compétences\ndiverses", "mentor" => "Mentoring" diff --git a/templates/profil.tpl b/templates/profil.tpl index 538bdd4..5f30478 100644 --- a/templates/profil.tpl +++ b/templates/profil.tpl @@ -43,10 +43,6 @@ tel qu'elle appara {/if} {/foreach} - - - - diff --git a/templates/profil/deco.tpl b/templates/profil/deco.tpl new file mode 100644 index 0000000..aa575d9 --- /dev/null +++ b/templates/profil/deco.tpl @@ -0,0 +1,115 @@ +{*************************************************************************** + * 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 * + ***************************************************************************} + + +{literal} + +{/literal} + +
+ + + + + + + + + + {foreach from=$medals item=m} + + + + + + {/foreach} + + + + + +
+ Médailles, Décorations, Prix, ... +
+ + + + + +
+ + + ne peut être ni public ni transmis à l'AX +
+
+ {$m.medal} + + {$m.medal}
+ {if $grades[$m.id]|@count} + + {else} + -- non précisé -- + {/if} +
+ + retirer + +
+   + + + + + ajouter + +
+
+ +{* vim:set et sw=2 sts=2 sws=2: *} diff --git a/templates/profil/poly.tpl b/templates/profil/poly.tpl index 9d9ba73..d7aebc5 100644 --- a/templates/profil/poly.tpl +++ b/templates/profil/poly.tpl @@ -81,6 +81,10 @@ {/literal}
+ + + + diff --git a/upgrade/0.9.4/80_medals.sql b/upgrade/0.9.4/80_medals.sql index 8e36a07..d48ccbe 100644 --- a/upgrade/0.9.4/80_medals.sql +++ b/upgrade/0.9.4/80_medals.sql @@ -20,6 +20,14 @@ create table profile_medals_grades ( primary key (mid, gid) ); +drop table if exists profile_medals_sub; +create table profile_medals_sub ( + uid int not null, + mid int not null, + gid int not null, + primary key (uid,mid) +); + insert into profile_medals (type, text, img) values ('ordre', 'Ordre Nationnal de la Legion d\'Honneur', 'ordre_onlh.jpg'), ('ordre', 'Ordre de la libération', 'ordre_lib.jpg'),