X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fplwizard.php;h=ec9f7d2fa89ad485a68e90092230b0176c34024f;hb=88541046480799a8d92eba186f22e22c0c64efb0;hp=678ab4c120c86985cb56996dcbff7af608bd326e;hpb=31ac496f284cd21164e05d1472ad1ceca9fe1095;p=platal.git diff --git a/classes/plwizard.php b/classes/plwizard.php index 678ab4c..ec9f7d2 100644 --- a/classes/plwizard.php +++ b/classes/plwizard.php @@ -1,6 +1,6 @@ stateless && (isset($this->lookup[$pgid]) || isset($this->pages[$pgid]))) { - $curpage = is_numeric($pgid) ? $pgid : $this->lookup[$pgid]; + if ($this->stateless && (isset($this->lookup[$pgid]) || isset($this->pages[$pgid]))) { + $curpage = is_numeric($pgid) ? $pgid : $this->lookup[$pgid]; } else if ($this->stateless && is_null($pgid)) { $curpage = 0; } else { @@ -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,12 +213,16 @@ 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); } if ($mode == 'ajax') { - header('Content-Type: text/html; charset=utf-8'); + pl_content_headers("text/html"); $smarty->changeTpl($this->layout, NO_SKIN); $smarty->assign('wiz_run_ajax', true); } else { @@ -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()); + } } }