From: x2003bruneau Date: Wed, 27 Sep 2006 20:35:44 +0000 (+0000) Subject: Do not show edition form if we do not need it X-Git-Tag: xorg/0.9.12~239 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=ed5b9703b11935c123dae6eed496223591e1e7ed;p=platal.git Do not show edition form if we do not need it git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@925 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/include/validations.inc.php b/include/validations.inc.php index 4415ebc..a49edce 100644 --- a/include/validations.inc.php +++ b/include/validations.inc.php @@ -331,6 +331,14 @@ class Validate } // }}} + // {{{ function id() + + function id() + { + return $this->uid . '_' . $this->type . '_' . $this->stamp; + } + + // }}} } foreach (glob(dirname(__FILE__).'/validations/*.inc.php') as $file) { diff --git a/modules/admin.php b/modules/admin.php index 8d59296..0191b80 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -688,11 +688,15 @@ class AdminModule extends PLModule } } - function handler_validate(&$page) { + function handler_validate(&$page, $action = 'list', $id = null) { $page->changeTpl('admin/valider.tpl'); $page->assign('xorg_title','Polytechnique.org - Administration - Valider une demande'); require_once("validations.inc.php"); + if ($action == 'edit' and !is_null($id)) { + $page->assign('preview_id', $id); + } + if(Env::has('uid') && Env::has('type') && Env::has('stamp')) { $req = Validate::get_request(Env::v('uid'), Env::v('type'), Env::v('stamp')); if($req) { $req->handle_formu(); } diff --git a/templates/admin/valider.tpl b/templates/admin/valider.tpl index 5a56ea1..282eb9b 100644 --- a/templates/admin/valider.tpl +++ b/templates/admin/valider.tpl @@ -53,7 +53,8 @@ {if $valid->editor()} -
+ {if $preview_id == $valid->id()} +
{include file=$valid->editor()} @@ -63,6 +64,11 @@
+ {else} + + Editer cette demande avant validation + + {/if} {/if}