protected function startWizard($step = 1) { $this->template = 'admin/create_page_wizard.tpl'; $this->smarty->assign('step', $step); switch ($step) { case 1: $page = new CMSPage(); $form = $page->getForm(); $form->addRule('urlkey', 'Key already used', new validCKey(), null); $form->removeElement('section'); $form->removeElement('action'); $form->_constantValues = array(); $form->addElement('hidden', 'section'); $defaultValues['section'] = 'wizard'; $form->addElement('hidden', 'wizardStep'); $defaultValues['wizardStep'] = $step; $form->setDefaults($defaultValues); $this->smarty->assign('form', $form); break; case 2: $page = new CMSPage(); $page->setStatus(true); $page->setAccess('public'); $form = $page->getForm(); $_SESSION['wizard_page_id'] = $page->getId(); $this->addJS('/modules/Content/js/admin.js'); require_once 'include/ContentTemplate.php'; $templates = ContentTemplate::getAllContentTemplates(); $this->smarty->assign('templates', $templates); $this->template = 'admin/content_templates.tpl'; //return $this->smarty->fetch('admin/content_templates.tpl'); break; case 3: require_once 'include/ContentTemplate.php'; $layer = new CMSPageRevision(); $template = new ContentTemplate($_REQUEST['template_id']); $layer->setContent($template->getContent()); $layer->setParentId($_SESSION['wizard_page_id']); $form = $layer->getAddEditForm(); $form->removeElement('section'); $form->removeElement('action'); $form->_constantValues = array(); $form->addElement('hidden', 'section'); $defaultValues['section'] = 'wizard'; $form->addElement('hidden', 'parent_id'); $defaultValues['parent_id'] = $_SESSION['wizard_page_id']; $form->addElement('hidden', 'wizardStep'); $defaultValues['wizardStep'] = $step; $form->setConstants(array('wizardStep' => $step)); $defaultValues['language'] = 1; $form->setDefaults($defaultValues); $this->smarty->assign('form', $form); break; case 4: $layer = new CMSPageRevision(); $layer->setParentId($_REQUEST['parent_id']); $form = $layer->getAddEditForm(); $this->topLevelInterface(); } }