コード例 #1
0
 public function wizardNotesAction()
 {
     $wizard = new Zend_Session_Namespace('Cms_PageWizard');
     $this->view->page = $wizard->page;
     $notes = '';
     $revision = new SxCms_Page_Revision();
     if ($wizard->page->getId() === false) {
         $notes = $this->admin_tmx->_('newpagecreated');
         $revision->setApproved(true);
     }
     $revision->setNotes($notes);
     if ($this->getRequest()->isPost() or isset($wizard->settings)) {
         $lng = $wizard->page->getLanguage();
         $wizard->page->save();
         if (isset($wizard->settings)) {
             $wizard->unsetAll();
             $this->_helper->redirector->gotoSimple('wizard-done', 'page');
         }
         if ($wizard->page->getId() === false) {
             $config = Zend_Registry::get('config');
             foreach ($config->system->language as $lng => $slng) {
                 $revision->setNotes($this->_getParam('notes'))->setLanguage($lng)->setTitle($wizard->page->getTitle())->setTitleFallback($wizard->page->hasTitleFallback())->setSummary($wizard->page->getSummary())->setSummaryFallback($wizard->page->hasSummaryFallback())->setContent($wizard->page->getContent())->setContentFallback($wizard->page->hasContentFallback())->setSource($wizard->page->getSource())->setSourceFallback($wizard->page->hasSourceFallback())->setLink($wizard->page->getLink())->setLinkFallback($wizard->page->hasLinkFallback())->setPageId($wizard->page->getId())->setInvisible($wizard->page->getInvisible())->setSeoTitle($wizard->page->getSeoTitle())->setSeoTags($wizard->page->getSeoTags())->setSeoDescription($wizard->page->getSeoDescription())->save();
                 if (!$this->_getParam('revision')) {
                     $revision->setApproved(true);
                 }
                 if (!$revision->isApproved()) {
                     $revision->warnLiveVersion();
                 } else {
                     $revision->approve();
                 }
             }
         } else {
             $revision->setNotes($this->_getParam('notes'))->setLanguage($lng)->setTitle($wizard->page->getTitle())->setTitleFallback($wizard->page->hasTitleFallback())->setSummary($wizard->page->getSummary())->setSummaryFallback($wizard->page->hasSummaryFallback())->setContent($wizard->page->getContent())->setContentFallback($wizard->page->hasContentFallback())->setSource($wizard->page->getSource())->setSourceFallback($wizard->page->hasSourceFallback())->setLink($wizard->page->getLink())->setLinkFallback($wizard->page->hasLinkFallback())->setPageId($wizard->page->getId())->setInvisible($wizard->page->getInvisible())->setSeoTitle($wizard->page->getSeoTitle())->setSeoTags($wizard->page->getSeoTags())->setSeoDescription($wizard->page->getSeoDescription())->save();
             if (!$this->_getParam('revision')) {
                 $revision->setApproved(true);
             }
             if (!$revision->isApproved()) {
                 $revision->warnLiveVersion();
             } else {
                 $revision->approve();
             }
         }
         $wizard->unsetAll();
         $this->_helper->redirector->gotoSimple('wizard-done', 'page');
     }
     $this->view->revision = $revision;
     $this->view->messages = Sanmax_MessageStack::getInstance('SxCms_Page');
 }