Beispiel #1
0
 /**
  * displays the page content in edition mode
  */
 public function editAction()
 {
     // [AS] add CKEditor (moved from the global as it was using a lot of ressource)
     $this->view->headScript()->appendFile(Sydney_Tools::getRootUrlCdn() . '/sydneyassets/jslibs/ckeditor/ckeditor.js', 'text/javascript');
     $this->view->headScript()->appendFile(Sydney_Tools::getRootUrlCdn() . '/sydneyassets/jslibs/ckeditor/adapters/jquery.js', 'text/javascript');
     $r = $this->getRequest();
     $elid = isset($r->id) && preg_match('/^[0-9]{1,50}$/', $r->id) ? $r->id : 0;
     $emodule = isset($r->emodule) ? $r->emodule : 'pages';
     $this->view->emodule = $emodule;
     $this->view->pagstructure_id = $elid;
     $this->view->customHelpers = $this->_registry->get('customhelpers');
     switch ($emodule) {
         case 'pages':
             $nodes = new Pagstructure();
             $where = 'id = ' . $elid . ' AND safinstances_id = ' . $this->safinstancesId;
             $this->view->node = $nodes->fetchRow($where);
             $this->view->pagid = $elid;
             $this->view->moduleName = 'adminpages';
             // set layout and titles properties
             $this->setSubtitle2($this->view->node->label);
             $this->setSubtitle('Edit page');
             $this->setSideBar('edit', 'pages');
             $this->layout->langswitch = true;
             $this->layout->search = true;
             // get the div content
             $cnt = new Pagdivspage();
             $this->view->contentDivs = $cnt->getDivs($this->view->node->id, false);
             // Affichage d'un design spécifique
             $layout = new Sydney_Layout_Layout();
             /* If layout if empty we will take the one in the config */
             if (!$this->view->node->layout) {
                 $this->view->node->layout = $this->_config->general->layout;
             }
             $layout->setName($this->view->node->layout);
             if ($layout->loadZones()->hasZones()) {
                 $this->view->layout = $layout;
                 $this->view->preview = $layout->calculatePreview()->getPreview();
                 $this->view->zones = $layout->getZones();
                 $this->render('editzones');
             }
             break;
     }
 }
Beispiel #2
0
 private function _duplicateNode($id, $newParentId = null)
 {
     // Load the node data
     $node = new Pagstructure($id);
     // Duplicate node
     $duplicateNode = $node->createRow($node->__toArray());
     $duplicateNode->id = 0;
     $duplicateNode->ishome = 0;
     // avoid two homepage
     $duplicateNode->status = 'draft';
     // unpublish the copy
     if ($newParentId !== null) {
         $duplicateNode->parent_id = $newParentId;
     }
     $duplicateNode->datecreated = new Zend_Db_Expr("NOW()");
     $duplicateNode->datemodified = new Zend_Db_Expr("NOW()");
     $duplicateNode->who_modified = Sydney_Tools::who();
     $duplicateNode->save();
     // Duplicate node content
     $page = new Pagdivspage();
     $pageDivs = $page->getDivs($id, false);
     PagdivspageOp::resetFictivePagDivsOrder();
     foreach ($pageDivs as $pageDiv) {
         Pagdivspage::duplicate($pageDiv['pagdivs_id'], $duplicateNode->id, $pageDiv['order_pagstructure_pagdiv']);
     }
     // Access right to duplicate?
     // Menu presence to duplicate?
     // Duplicate child, if any
     $kids = $node->getKids($id);
     if (count($kids) > 0) {
         foreach ($kids as $kid) {
             $this->_duplicateNode($kid->id, $duplicateNode->id);
         }
     }
     return $duplicateNode->id;
 }
 /**
  *
  * Enter description here ...
  */
 public function getlistpagdivsAction()
 {
     $r = $this->getRequest();
     if (isset($r->dbid)) {
         $node = new Pagdivspage();
         $this->view->listContents = $node->getDivs($r->dbid);
     }
 }
Beispiel #4
0
 /**
  * Shows the content of a page
  *
  * @tood: add a param in the config to force the load of the next child or not react this way (dispay the empty node)
  *
  * Example with params:
  * /publicms/index/view/page/2831,4681,9121,9131,9141,9151,9161,9171,9181,9271,9221,9231,9241,9251,9261,9191,9201,9211,4311,9011/notthisdivs/66401,66431,66311,66271,66881/showtitles/Y/layout/antidotcaprint/
  *
  * Request Params:
  *        $r->format            The format we need the data to be returned
  *        $r->layout            If 'no' we do not use a layout; or if defined we use the layout name passed as val
  *        $r->heading            ???
  *        $r->notthisdivs        IDs of divs we don't want to show up (separated by a comma)
  *        $r->showtitles        Should we add the page title in case of multiple page ids
  *
  */
 public function viewAction()
 {
     $r = $this->getRequest();
     $this->view->requestParams = $r->getParams();
     if (!empty($r->format)) {
         $this->_helper->contextSwitch()->initContext($r->format);
     }
     $heading = 0;
     $dontRetreiveIds = array();
     $showtitles = false;
     $layout = '';
     if ($r->layout == 'no') {
         $this->_helper->layout->disableLayout();
     }
     if ($r->layout) {
         $layout = $r->layout;
     }
     if ($r->heading) {
         $heading = $r->heading;
     }
     if ($r->notthisdivs) {
         $dontRetreiveIds = explode(',', $r->notthisdivs);
     }
     if ($r->showtitles == 'Y') {
         $showtitles = true;
     }
     $this->view->heading = $heading;
     $currentPage = $this->_getPageId();
     $nodes = $this->structure;
     if (isset($this->structure->stringNodes[$currentPage])) {
         $thisnode =& $this->structure->stringNodes[$currentPage];
     }
     // push the current node in the view to access params in the layout
     $this->view->thisnode = $thisnode;
     $this->_checkUrlLabel();
     if (isset($thisnode['htmltitle']) && !empty($thisnode['htmltitle'])) {
         $this->view->headTitle($this->view->escape($thisnode['htmltitle']), Zend_View_Helper_Placeholder_Container_Abstract::SET);
     } else {
         $this->view->headTitle($thisnode['label']);
     }
     $this->_manageMetaTags();
     if ($r->layout == 'no') {
         if (isset($this->getRequest()->page)) {
             $cnt = new Pagdivspage();
             $cntDivs = $cnt->getDivs($this->getRequest()->page);
             $this->view->contentDivs = $cntDivs;
         }
     } elseif (!isset($thisnode) || $thisnode['status'] != 'published') {
         $this->forward('index', 'index', 'error');
     } else {
         $this->view->rootid = $currentPage;
         // Si la page est une redirection
         if (isset($thisnode) && $thisnode['redirecttoid'] > 0) {
             $currentPage = $thisnode['redirecttoid'];
         }
         $this->view->pagid = $currentPage;
         $where = 'safinstances_id = ' . $this->safinstancesId . ' AND id = ' . $currentPage;
         $this->view->nodes = $nodes->fetchAll($where);
         $this->view->customHelpers = $this->_registry->get('customhelpers');
         $this->view->contentDivs = array();
         if (count($this->view->nodes) > 0) {
             foreach ($this->view->nodes as $node) {
                 $cnt = new Pagdivspage();
                 $cntDivs = $cnt->getDivs($node->id, false, $dontRetreiveIds, $showtitles, array('<h1>', '</h1>'), $this->structure);
                 $this->view->contentDivs = array_merge($this->view->contentDivs, $cntDivs);
             }
         }
     }
     $this->manageLayoutZones();
     // set a custom layout if any
     $this->_setCustomLayout($currentPage, $layout);
 }