git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-348
--- /dev/null
+<?php
+/***************************************************************************
+ * 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 *
+ ***************************************************************************/
+
+
+$res = $globals->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);
+
+?>
--- /dev/null
+<?php
+/***************************************************************************
+ * 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 *
+ ***************************************************************************/
+
+if (Env::has('medal_op')) {
+ if (Env::get('medal_op')=='retirer' && Env::getInt('medal_id')) {
+ $globals->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();
+
+?>
--- /dev/null
+<?php
+/***************************************************************************
+ * 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 *
+ ***************************************************************************/
+
+?>
--- /dev/null
+<?php
+/***************************************************************************
+ * 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 *
+ ***************************************************************************/
+?>
"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"
{/if}
{/foreach}
</ul>
- <input type="hidden" value="" name="binet_op" />
- <input type="hidden" value="" name="binet_id" />
- <input type="hidden" value="" name="groupex_op" />
- <input type="hidden" value="" name="groupex_id" />
<input type="hidden" value="{$onglet}" name="old_tab" />
<input type="hidden" value="" name="adresse_flag" />
</td>
--- /dev/null
+{***************************************************************************
+ * 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}
+<script type="text/javascript">//<![CDATA[
+ function medal_add()
+ {
+ var selid = document.forms.prof_annu.medal_sel.selectedIndex;
+ document.forms.prof_annu.medal_id.value = document.forms.prof_annu.medal_sel.options[selid].value;
+ document.forms.prof_annu.medal_op.value = "ajouter";
+ document.forms.prof_annu.submit();
+ }
+
+ function medal_del( id )
+ {
+ document.forms.prof_annu.medal_id.value = id;
+ document.forms.prof_annu.medal_op.value = "retirer";
+ document.forms.prof_annu.submit();
+ }
+ //]]>
+</script>
+{/literal}
+
+<div class="blocunite_tab">
+ <input type="hidden" value="" name="medal_op" />
+ <input type="hidden" value="" name="medal_id" />
+ <table class="bicol" cellspacing="0" cellpadding="0">
+ <tr>
+ <th colspan="3">
+ Médailles, Décorations, Prix, ...
+ </th>
+ </tr>
+ <tr>
+ <td colspan="3" class="pflags">
+ <table class="flags" summary="Flags" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="rouge">
+ <input type="checkbox" name="accesX" checked="checked" disabled="disabled" />
+ </td>
+ <td class="texte">
+ ne peut être ni public ni transmis à l'AX
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ {foreach from=$medals item=m}
+ <tr>
+ <td class="colg">
+ <img src='{rel}/images/medals/{$m.img}' width="32" alt="{$m.medal}" title="{$m.medal}" />
+ </td>
+ <td class="colm">
+ <span class="valeur">{$m.medal}</span><br />
+ {if $grades[$m.id]|@count}
+ <select name="grade[{$m.id}]">
+ <option value='0'>-- non précisé --</option>
+ {foreach from=$grades[$m.id] item=g}
+ <option value='{$g.gid}' {if $g.gid eq $m.gid}selected='selected'{/if}>{$g.text}</option>
+ {/foreach}
+ </select>
+ {else}
+ -- non précisé --
+ {/if}
+ </td>
+ <td class="cold">
+ <span class="lien">
+ <a href="javascript:medal_del({$m.id});">retirer</a>
+ </span>
+ </td>
+ </tr>
+ {/foreach}
+ <tr>
+ <td class="colg">
+
+ </td>
+ <td class="colm">
+ <select name="medal_sel">
+ <option value=''></option>
+ {foreach from=$medal_list key=type item=list}
+ <optgroup label="{$trad[$type]}">
+ {foreach from=$list item=m}
+ <option value="{$m.id}">{$m.text}</option>
+ {/foreach}
+ </optgroup>
+ {/foreach}
+ </select>
+ </td>
+ <td class="cold">
+ <span class="lien">
+ <a href="javascript:medal_add();">ajouter</a>
+ </span>
+ </td>
+ </tr>
+ </table>
+</div>
+
+{* vim:set et sw=2 sts=2 sws=2: *}
</script>
{/literal}
<div class="blocunite_tab">
+ <input type="hidden" value="" name="binet_op" />
+ <input type="hidden" value="" name="binet_id" />
+ <input type="hidden" value="" name="groupex_op" />
+ <input type="hidden" value="" name="groupex_id" />
<table class="bicol" cellspacing="0" cellpadding="0"
summary="Profil: Informations Polytechniciennes">
<tr>
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'),