From: Florent Bruneau Date: Tue, 11 Jan 2011 20:35:04 +0000 (+0100) Subject: Improves index page. X-Git-Tag: xorg/1.1.0~193 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=22264cd483d16ea6c5096786132cdf9c165bfd07;p=platal.git Improves index page. Signed-off-by: Florent Bruneau --- diff --git a/modules/survey.php b/modules/survey.php index d730af5..832d3a4 100644 --- a/modules/survey.php +++ b/modules/survey.php @@ -37,9 +37,20 @@ class SurveyModule extends PLModule */ ); } - function handler_index(&$page, $action = null) + private function setup_page(PlPage $page) { $this->load('survey.inc.php'); + $page->addJsLink('jquery.ui.core.js'); + $page->addJsLink('jquery.ui.widget.js'); + $page->addJsLink('jquery.ui.datepicker.js'); + $page->addJsLink('jquery.ui.datepicker-fr.js'); + $page->addJsLink('jquery.tmpl.js'); + $page->addJsLink('survey.js'); + } + + function handler_index(&$page, $action = null) + { + $this->setup_page($page); $page->changeTpl('survey/index.tpl'); $page->assign('active', Survey::iterActive()); @@ -47,10 +58,9 @@ class SurveyModule extends PLModule function handler_vote(PlPage $page, $name) { - $this->load('survey.inc.php'); - $page->addJsLink('jquery.tmpl.js'); - $page->addJsLink('survey.js'); + $this->setup_page($page); $page->changeTpl('survey/vote.tpl'); + $survey = Survey::get($name); if (is_null($survey)) { return PL_NOT_FOUND; @@ -75,13 +85,7 @@ class SurveyModule extends PLModule function handler_edit(PlPage $page, $name = null) { - $this->load('survey.inc.php'); - $page->addJsLink('jquery.ui.core.js'); - $page->addJsLink('jquery.ui.widget.js'); - $page->addJsLink('jquery.ui.datepicker.js'); - $page->addJsLink('jquery.ui.datepicker-fr.js'); - $page->addJsLink('jquery.tmpl.js'); - $page->addJsLink('survey.js'); + $this->setup_page($page); $page->changeTpl('survey/edit.tpl'); if (!is_null($name)) { @@ -98,9 +102,7 @@ class SurveyModule extends PLModule $survey->begin = Post::t('begin'); $survey->end = Post::t('end'); $survey->flags = 'validated'; - if (Post::b('anonymous')) { - $survey->flags->addFlag('anonymous'); - } + $survey->flags->addFlag('anonymous', Post::b('anonymous')); $q_edit = Post::v('q_edit'); $qs = array(); diff --git a/templates/survey/index.tpl b/templates/survey/index.tpl index 0291a3a..c0ade2f 100644 --- a/templates/survey/index.tpl +++ b/templates/survey/index.tpl @@ -28,15 +28,27 @@ Sondages en cours + {if hasPerm('admin')} + + {/if} {iterate from=$active item=survey} - + {$survey->title} + {if hasPerm('admin')} + + {icon name=page_edit} + + {/if} {/iterate} {/if} + + {* vim:set et sw=2 sts=2 ts=8 enc=utf-8: *}