X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fplwizard.php;h=36672681177b0709faa0033849b18ed6c6fb8ef1;hb=e48f889b5491c7780ae20a0a0b83bf6f2ef1413c;hp=b5affd1936cecc487df3be5bcda1f7b32258ec07;hpb=93553cea371ce061dce9dfc34825b7b98a6ded34;p=platal.git diff --git a/classes/plwizard.php b/classes/plwizard.php index b5affd1..3667268 100644 --- a/classes/plwizard.php +++ b/classes/plwizard.php @@ -1,6 +1,6 @@ name = 'wiz_' . $name; $this->layout = $layout; @@ -81,6 +82,7 @@ class PlWizard $this->pages = array(); $this->lookup = array(); $this->titles = array(); + $this->ajax = $ajax; if (!isset($_SESSION[$this->name])) { $_SESSION[$this->name] = array(); $_SESSION[$this->name . '_page'] = null; @@ -136,7 +138,7 @@ class PlWizard return new $page($this); } - public function apply(PlatalPage &$smarty, $baseurl, $pgid = null) + public function apply(PlatalPage &$smarty, $baseurl, $pgid = null, $mode = 'normal') { if ($this->stateless && (isset($this->lookup[$pgid]) || isset($this->pages[$pgid]))) { $curpage = is_numeric($pgid) ? $pgid : $this->lookup[$pgid]; @@ -194,16 +196,22 @@ class PlWizard } else if (!isset($page)) { $page = $this->getPage($curpage); } - $smarty->changeTpl($this->layout); + if ($mode == 'ajax') { + header('Content-Type: text/html; charset=utf-8'); + $smarty->changeTpl($page->template(), NO_SKIN); + } else { + $smarty->changeTpl($this->layout); + } $smarty->assign('pages', $this->titles); $smarty->assign('current', $curpage); $smarty->assign('lookup', $this->inv_lookup); $smarty->assign('stateless', $this->stateless); $smarty->assign('wiz_baseurl', $baseurl); + $smarty->assign('wiz_ajax', $this->ajax); $smarty->assign('tab_width', (int)(99 / count($this->pages))); $smarty->assign('wiz_page', $page->template()); $smarty->assign('xorg_no_errors', true); - $page->prepare($smarty); + $page->prepare($smarty, isset($this->inv_lookup[$curpage]) ? $this->inv_lookup[$curpage] : $curpage); } }