public function executeTogglePublish()
 {
     $page = sfSimpleCMSPagePeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($page);
     $this->checkPublisherCredential();
     $page->setIsPublished(!$page->getIsPublished());
     $page->save();
     $this->redirect('sfSimpleCMSAdmin/list?page=' . $this->getRequestParameter('page', 1));
 }
 public function validateUpdate()
 {
     $validate = true;
     $this->page = sfSimpleCMSPagePeer::retrieveByPk($this->getRequestParameter('page_id'));
     $newSlugPage = sfSimpleCMSPagePeer::retrieveBySlug($this->getRequestParameter('new_slug'));
     if ($newSlugPage && $newSlugPage->getId() != $this->page->getId()) {
         $validate = false;
         $this->getRequest()->setError('new_slug', 'A page with this path already exits');
     }
     $this->relative_page = sfSimpleCMSPagePeer::retrieveBySlug($this->getRequestParameter('position'));
     $this->positionType = $this->getRequestParameter('position_type');
     if ($this->positionType && $this->relative_page && $this->relative_page->isRoot() && $this->positionType != 'under') {
         $validate = false;
         $this->getRequest()->setError('position', 'Attempting to move a page at the same level as the home page. Please make sure to select a position under the root node.');
     }
     return $validate;
 }