From 3f4285762f6fa1566aac2a17a6dd04105e9d8623 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Tue, 19 Dec 2006 19:59:04 +0000 Subject: [PATCH] User can see the medals he has requested in his profile edition form git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1295 839d8a87-29fc-0310-9880-83ba4fa771e5 --- include/profil/assign_deco.inc.php | 1 + include/profil/get_deco.inc.php | 24 ++++++++++++++--------- templates/profile/deco.tpl | 40 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+), 9 deletions(-) diff --git a/include/profil/assign_deco.inc.php b/include/profil/assign_deco.inc.php index 2b485a4..9eaf230 100644 --- a/include/profil/assign_deco.inc.php +++ b/include/profil/assign_deco.inc.php @@ -40,5 +40,6 @@ $page->assign('medals', $medals); $page->assign('trad', $trad); $page->assign('medals_pub', $medals_pub); $page->assign('medal_list', $mlist); +$page->assign('medals_valid', $medals_valid); ?> diff --git a/include/profil/get_deco.inc.php b/include/profil/get_deco.inc.php index b36c878..859e17e 100644 --- a/include/profil/get_deco.inc.php +++ b/include/profil/get_deco.inc.php @@ -19,23 +19,26 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ +require_once('validations.inc.php'); + if (Env::has('medal_op')) { if (Env::v('medal_op')=='retirer' && Env::i('medal_id')) { XDB::execute("DELETE FROM profile_medals_sub WHERE uid = {?} AND mid = {?}", S::v('uid', -1), Env::i('medal_id', -1)); } if (Env::v('medal_op')=='ajouter' && Env::i('medal_id')) { - require_once('validations.inc.php'); $req = new MedalReq(S::v('uid',-1),Env::i('medal_id'), Env::i('grade_id')); - if ($req->mid == 20) // defnat - { - $req->commit(); - unset($_REQUEST['medal_op']); // pour ne pas avoir le message d'attente de validation - } - else - { +// if ($req->mid == 20) { // defnat +// $req->commit(); +// unset($_REQUEST['medal_op']); // pour ne pas avoir le message d'attente de validation +// } else { $req->submit(); - } +// } + } + + if (Env::v('medal_op')=='annuler' && Env::i('medal_id')) { + $req = Validate::get_typed_request(S::i('uid'), 'medal', Env::v('medal_id')); + $req->clean(); } } if (Post::has('grade')) { @@ -55,8 +58,11 @@ $medals = $res->fetchAllAssoc(); $res = XDB::query("SELECT profile_medals_pub FROM auth_user_quick WHERE user_id = {?}", S::v('uid', -1)); $medals_pub = $res->fetchOneCell(); +$medals_valid = Validate::get_typed_requests(S::i('uid'), 'medal'); + if(Env::has('modifier') || Env::has('suivant')) { $medals_pub = Env::has('medals_pub')?'public':'private'; } + // vim:set et sws=4 sw=4 sts=4: ?> diff --git a/templates/profile/deco.tpl b/templates/profile/deco.tpl index 1b94bb9..de73a9b 100644 --- a/templates/profile/deco.tpl +++ b/templates/profile/deco.tpl @@ -38,6 +38,13 @@ document.forms.prof_annu.medal_op.value = "retirer"; document.forms.prof_annu.submit(); } + + function medal_cancel(stamp) + { + document.forms.prof_annu.medal_id.value = stamp; + document.forms.prof_annu.medal_op.value = "annuler"; + document.forms.prof_annu.submit(); + } var subgrades = new array(); function getoption( select_input, j) { @@ -138,6 +145,39 @@ {/foreach} + {foreach from=$medals_valid item=v} + + + mid}src="images/medals/{$m.img}"{/if} + {/foreach} + {/foreach} + title="Validation" alt="Validation" width="32" /> + + + {foreach from=$medal_list item=list} + {foreach from=$list item=m} + {if $m.id eq $v->mid}{$m.text} (en attente de validation){/if} + {/foreach} + {/foreach} +
+ {foreach from=$grades key=mid item=grd} + {if $mid eq $v->mid} + {foreach from=$grd item=g} + {if $g.gid eq $v->gid}{$g.text}{/if} + {/foreach} + {/if} + {/foreach} + + + + annuler + + + + {/foreach}   -- 2.1.4