X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fplwizard.php;h=6e452267e718226c58d590bb146be8c76330e6db;hb=501a6db205b3355bd9e15de6eac20ca033835201;hp=06e6914406eaf7acab410d30aa18c13bd1facb74;hpb=1ec4547fd552aac8b7ec8720893c2c03a808ff61;p=platal.git diff --git a/classes/plwizard.php b/classes/plwizard.php index 06e6914..6e45226 100644 --- a/classes/plwizard.php +++ b/classes/plwizard.php @@ -1,6 +1,6 @@ name = 'wiz_' . $name; $this->layout = $layout; @@ -85,6 +90,7 @@ class PlWizard $this->lookup = array(); $this->titles = array(); $this->ajax = $ajax; + $this->ajax_animated = $ajax_animated; if (!isset($_SESSION[$this->name])) { $_SESSION[$this->name] = array(); $_SESSION[$this->name . '_page'] = null; @@ -167,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: @@ -206,13 +213,18 @@ 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'); - $smarty->changeTpl($page->template(), NO_SKIN); + pl_content_headers("text/html"); + $smarty->changeTpl($this->layout, NO_SKIN); + $smarty->assign('wiz_run_ajax', true); } else { $smarty->changeTpl($this->layout); } @@ -222,10 +234,14 @@ class PlWizard $smarty->assign('stateless', $this->stateless); $smarty->assign('wiz_baseurl', $baseurl); $smarty->assign('wiz_ajax', $this->ajax); + $smarty->assign('wiz_animated', $this->ajax_animated); $smarty->assign('tab_width', (int)(99 / count($this->pages))); $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()); + } } }