From: Stéphane Jacob Date: Sat, 27 Jun 2009 15:22:15 +0000 (+0200) Subject: Modifies plwizzard for showing a confirmation message when the profile is modified. X-Git-Tag: core/1.0.1~10 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=5e68c6818d87bbc1b9229433c7c8949d626fa85c;p=platal.git Modifies plwizzard for showing a confirmation message when the profile is modified. --- diff --git a/classes/plwizard.php b/classes/plwizard.php index 678ab4c..f630020 100644 --- a/classes/plwizard.php +++ b/classes/plwizard.php @@ -45,7 +45,11 @@ interface PlWizardPage * id (PlWizard::FIRST_PAGE, PlWizard::NEXT_PAGE, PlWizard::CURRENT_PAGE * PlWizard::PREVIOUS_PAGE, PlWizard::LAST_PAGE). */ - public function process(); + public function process(&$success); + + /** Displays the success message. + */ + public function success(); } /** A PlWizard is a set of pages through which the user can navigate, @@ -169,7 +173,8 @@ class PlWizard $page = $this->getPage(Post::i('valid_page')); $curpage = Post::i('valid_page'); - $next = $page->process(); + $success = false; + $next = $page->process(&$success); $last = $curpage; switch ($next) { case PlWizard::FIRST_PAGE: @@ -208,7 +213,11 @@ class PlWizard // Prepare the page $_SESSION[$this->name . '_page'] = $curpage; if ($curpage != $oldpage) { - pl_redirect($baseurl . '/' . $this->inv_lookup[$curpage]); + if (isset($success) && $success) { + pl_redirect($baseurl . '/' . $this->inv_lookup[$curpage] . '/null/' . $success); + } else { + pl_redirect($baseurl . '/' . $this->inv_lookup[$curpage]); + } } else if (!isset($page)) { $page = $this->getPage($curpage); } @@ -230,6 +239,9 @@ class PlWizard $smarty->assign('wiz_page', $page->template()); $smarty->assign('pl_no_errors', true); $page->prepare($smarty, isset($this->inv_lookup[$curpage]) ? $this->inv_lookup[$curpage] : $curpage); + if (isset($success) && $success) { + $smarty->trigSuccess($page->success()); + } } }