public function editAction() { if ($this->getRequest()->getMethod() == 'POST') { $page = new Knowledgeroot_Page($this->_getParam('id')); // acl checks // check for new root page if ($this->_getParam('page_parent') == 0 && !Knowledgeroot_Acl::iAmAllowed('manageRootPages', 'new')) { $this->_redirect(''); } // check for non root page if ($this->_getParam('page_parent') != 0 && !Knowledgeroot_Acl::iAmAllowed('page_' . $this->_getParam('page_parent'), 'new')) { $this->_redirect('page/' . $this->_getParam('page_parent')); } if ($this->_getParam('button') == 'close') { $this->_redirect('page/' . $page->getId()); } $page->setParent($this->_getParam('page_parent')); $page->setName($this->_getParam('page_title')); $page->setSubtitle($this->_getParam('page_subtitle')); $page->setAlias($this->_getParam('alias')); $page->setTooltip($this->_getParam('tooltip')); $page->setDescription($this->_getParam('page_description')); $page->setIcon($this->_getParam('icon')); $page->setAcl(json_decode($this->_getParam('acl'))); if ($this->_getParam('contentcollapse') == 1) { $page->setContentCollapse(true); } else { $page->setContentCollapse(false); } if ($this->_getParam('showpagedescription') == 1) { $page->setShowContentDescription(true); } else { $page->setShowContentDescription(false); } if ($this->_getParam('showtableofcontent') == 1) { $page->setShowTableOfContent(true); } else { $page->setShowTableOfContent(false); } $page->setContentPosition($this->_getParam('contentposition')); $page->save(); if ($this->_getParam('button') == 'save') { $this->_redirect('page/edit/' . $page->getId()); } else { $this->_redirect('page/' . $page->getId()); } } else { $id = $this->_getParam('id'); $page = new Knowledgeroot_Page($id); $this->view->action = 'edit'; $this->view->id = $id; $this->view->parent = $page->getParent(); $parent = new Knowledgeroot_Page($page->getParent()); $this->view->parentname = $parent->getName(); $this->view->title = $page->getName(); $this->view->subtitle = $page->getSubtitle(); $this->view->alias = $page->getAlias(); $this->view->tooltip = $page->getTooltip(); $this->view->icon = $page->getIcon(); $this->view->contentcollapse = $page->getContentCollapse(); $this->view->showpagedescription = $page->getShowContentDescription(); $this->view->showtableofcontent = $page->getShowTableOfContent(); $this->view->contentposition = $page->getContentPosition(); $this->view->created_by = $page->getCreatedBy()->getLogin(); $this->view->create_date = $page->getCreateDate()->getUserDate(); $rte = Knowledgeroot_Registry::get('rte'); $rte->setName('page_description'); $rte->setContent($page->getDescription(true)); $this->view->editor = $rte; $this->view->versions = $page->getVersions(); // action body $this->renderScript("page/page.phtml"); } }
/** * restore page version */ public function restore() { if ($this->version === null) { return; } $page = new Knowledgeroot_Page($this->getId()); // restore page $page->setName($this->getName()); $page->setDescription($this->getDescription()); $page->setAlias($this->getAlias()); $page->setIcon($this->getIcon()); $page->setSubtitle($this->getSubtitle()); $page->setTooltip($this->getTooltip()); $page->setShowContentDescription($this->getShowContentDescription()); $page->setShowTableOfContent($this->getShowTableOfContent()); $page->setContentCollapse($this->getContentCollapse()); // save $page->save(); }