User can see the medals he has requested in his profile edition form
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Tue, 19 Dec 2006 19:59:04 +0000 (19:59 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Tue, 19 Dec 2006 19:59:04 +0000 (19:59 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@1295 839d8a87-29fc-0310-9880-83ba4fa771e5

include/profil/assign_deco.inc.php
include/profil/get_deco.inc.php
templates/profile/deco.tpl

index 2b485a4..9eaf230 100644 (file)
@@ -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);
 
 ?>
index b36c878..859e17e 100644 (file)
  *  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:
 ?>
index 1b94bb9..de73a9b 100644 (file)
     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)
   {
       </td>
     </tr>
     {/foreach}
+    {foreach from=$medals_valid item=v}
+    <tr>
+      <td class="colg">
+        <img
+          {foreach from=$medal_list item=list}
+            {foreach from=$list item=m}
+            {if $m.id eq $v->mid}src="images/medals/{$m.img}"{/if}
+            {/foreach}
+          {/foreach}
+        title="Validation" alt="Validation" width="32" />
+      <td class="colm">
+        <span class="valeur">
+          {foreach from=$medal_list item=list}
+            {foreach from=$list item=m}
+            {if $m.id eq $v->mid}{$m.text}&nbsp;<em>(en attente de validation)</em>{/if}
+            {/foreach}
+          {/foreach}
+        </span><br />
+        {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}
+      </td>
+      <td class="cold">
+        <span class="lien">
+          <a href="javascript:medal_cancel({$v->stamp});">annuler</a>
+        </span>
+      </tr>
+    </tr>
+    {/foreach}
     <tr>
       <td class="colg">
         &nbsp;