public function executeCreateRootPage() { if (!$this->getRequestParameter('slug')) { throw new Exception('Attempting to create a page with no slug. Please make sure you enter a slug in the form before submitting it.'); } $page = new sfSimpleCMSPage(); $page->makeRoot(); $page->setSlug($this->getRequestParameter('slug')); $page->setTemplate($this->getRequestParameter('template')); $page->save(); $this->redirect('sfSimpleCMSAdmin/list?page=' . $this->getRequestParameter('page', 1)); }
public function executeCreate() { $this->forward404Unless($this->getRequest()->getMethod() == sfRequest::POST); $this->checkEditorCredential(); $culture = $this->getCulture(); $page = new sfSimpleCMSPage(); if ($this->positionType == 'under') { $page->insertAsFirstChildOf($this->relative_page); } else { $page->insertAsNextSiblingOf($this->relative_page); } $page->setSlug($this->getRequestParameter('create_slug')); $page->setTemplate($this->getRequestParameter('template')); $page->save(); $this->redirect(sfSimpleCMSTools::urlForPage($page->getSlug(), 'edit=true', $culture)); }