From: Florent Bruneau Date: Mon, 21 Jan 2008 21:03:33 +0000 (+0100) Subject: A bit of code factorization. X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=9fcbfd24f4f8b81be91522026c2d0691c5eaaa1f;p=platal.git A bit of code factorization. Signed-off-by: Florent Bruneau --- diff --git a/modules/xnetevents.php b/modules/xnetevents.php index e84fffc..76871c1 100644 --- a/modules/xnetevents.php +++ b/modules/xnetevents.php @@ -62,7 +62,7 @@ class XnetEventsModule extends PLModule global $globals; $wiz = new PlWizard('XNetEvent_' . $globals->asso('diminutif'), 'core/plwizard.tpl', false, false); $wiz->addPage('XNetEventEditStart', 'Nouvel événement', 'start'); - $wiz->apply($page, 'events/edit/' . $eid, $tab) + $wiz->apply($page, 'events/edit/' . $eid, $tab); } function handler_admin(&$page, $eid = null, $item_id = null) diff --git a/modules/xnetevents/xnetevents.editionsteps.inc.php b/modules/xnetevents/xnetevents.editionsteps.inc.php index f093327..498f5d7 100644 --- a/modules/xnetevents/xnetevents.editionsteps.inc.php +++ b/modules/xnetevents/xnetevents.editionsteps.inc.php @@ -20,23 +20,50 @@ ***************************************************************************/ __autoload('PlWizard'); +require_once dirname(__FILE__) . '/xnetevents.inc.php'; -// Welcome page {{{1 +// Generic page template {{{1 -class XNetEventEditStart implements PlWizardPage +abstract class XNetEventEditPage implements PlWizardPage { + protected $pg_template; + public $event; + public function __construct(PlWizard &$wiz) { + if (!isset($_SESSION['new_xnetevent'])) { + $_SESSION['new_xnetevent'] = new XNetEvent(); + } + $this->event =& $_SESSION['new_xnetevent']; } public function template() { - return 'xnetevents/edit-start.tpl'; + return 'xnetevents/edit.tpl'; } public function prepare(PlatalPage &$page, $id) { + $this->_prepare($page, $id); + $page->assign('edit_event_page', $this->pg_template); + } + + protected function _prepare(PlatalPage &$page, $id) + { + } +} + + +// Welcome page {{{1 + +class XNetEventEditStart extends XNetEventEditPage +{ + protected $pg_template = 'xnetevents/edit-start.tpl'; + + public function __construct(PlWizard &$wiz) + { + parent::__construct($wiz); } public function process() diff --git a/templates/xnetevents/edit.tpl b/templates/xnetevents/edit.tpl new file mode 100644 index 0000000..1308b6b --- /dev/null +++ b/templates/xnetevents/edit.tpl @@ -0,0 +1,32 @@ +{**************************************************************************} +{* *} +{* Copyright (C) 2003-2008 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 *} +{* *} +{**************************************************************************} + +
+ +
+{include file=$edit_event_page} +
+ +
+ + +{* vim:set et sw=2 sts=2 sws=2 enc=utf-8: *}