Example #1
0
 /** 
  * function prepareDisplayData
  *
  * Provided function to allow an object to prepare it's data for 
  * displaying (actually done in the Page Object).
  */
 function prepareDisplayData()
 {
     $cmsPage = new CMSPage($this->viewer);
     $cmsPage->loadPage($this->pageKey);
     $pageTitle = $cmsPage->getPageTitle($this->labels);
     $this->setPageTitle($pageTitle);
     $template =& new Template($this->moduleRootPath . 'templates/');
     $template->setXML('CMSPage', $cmsPage->getXML());
     $template->set('desiredZone', 'main');
     $templateName = $cmsPage->getPageTemplateName();
     if ($templateName != '') {
         $content = $template->fetch($templateName);
     } else {
         $content = '';
     }
     // Finally store HTML content as this page's content Item
     $this->addContent($content);
     $template->set('desiredZone', 'side');
     if ($templateName != '') {
         $content = $template->fetch($templateName);
     } else {
         $content = '';
     }
     $this->addSideBarContent($content);
     $this->pageMenu->addLink('LinkName', 'LinkHREF');
 }
Example #2
0
 private function getChildren($id, &$root, $depth = 0, $onlyactive = false, $pubOnly = false)
 {
     if ($onlyactive) {
         $where = ' AND status="active" ';
     }
     $sql = 'select * from menu where parent_id=' . $id . @$where . ' ORDER BY sort asc';
     $roots = Database::singleton()->query_fetch_all($sql);
     $first = true;
     foreach ($roots as &$item) {
         if ($this->getModInfo($item['module_id']) == 'Content' && $pubOnly == true) {
             include_once '../modules/Content/include/CMSPage.php';
             $data = new CMSPage($item['link']);
             if ($data->getAccess() == 'public') {
                 $cur =& $root[];
                 $cur = new MenuItem($item['id']);
                 $cur->depth = $depth;
                 $this->getChildren($item['id'], $cur->children, $depth + 1, $onlyactive, $pubOnly);
                 if ($first) {
                     $cur->top = true;
                     $first = false;
                 }
             }
         } else {
             $cur =& $root[];
             $cur = new MenuItem($item['id']);
             $cur->depth = $depth;
             $this->getChildren($item['id'], $cur->children, $depth + 1, $onlyactive, $pubOnly);
             if ($first) {
                 $cur->top = true;
                 $first = false;
             }
         }
     }
     $cur->bottom = true;
 }
Example #3
0
 public function resolve($url)
 {
     $site = $this->pagesys->getSite();
     $cl = strlen(self::$ConnectorUrl);
     if (strlen($url) > $cl && substr($url, 0, $cl) == self::$ConnectorUrl) {
         $page = CMSConnector::resolve($site, substr($url, $cl));
         if (isset($page)) {
             return $page;
         } else {
             return PageProvider::DECLINE;
         }
     } else {
         $cpage = CMSPage::loadPath($url);
         if (!isset($cpage)) {
             return PageProvider::DECLINE;
         }
         $type = $cpage->getType();
         if ($type == 'text/html') {
             $spage = new HTMLPage($site);
             $this->populateHTMLPage($cpage, $spage);
         } else {
             $spage = new Page($site, $type);
             $spage->setDataArray($cpage->data->serialize());
         }
         $tsys = null;
         foreach ($cpage->getNodeAreas() as $area) {
             $nodes = $cpage->getNodes($area);
             foreach ($nodes as $node) {
                 if (!isset($tsys)) {
                     $tsys = $site->modules->get('TemplateSystem');
                 }
                 $tmpl = $tsys->load('CMSNode://' . $node->id);
                 $spage->addToBuffer($area, $tmpl);
             }
         }
         return $spage;
     }
 }
Example #4
0
 public static function use_component()
 {
     return array_merge(parent::use_component());
 }
Example #5
0
 public static function use_boundable_javascripts()
 {
     $path = apf_classname_to_path(__CLASS__);
     return array_merge(parent::use_boundable_javascripts(), array());
 }
Example #6
0
 public function getAttachedParent($presenter, $parentTreeNodeId)
 {
     $pageManager = $presenter->pageManagerService;
     if ($parentTreeNodeId === 0) {
         return $presenter['pages'];
     } else {
         if ($pageManager->pageExists($parentTreeNodeId)) {
             // !! searching without ghosts and without timeZones
             $params = array('treeNodeId' => $parentTreeNodeId, 'lang' => $this->_lang);
             return $pageManager->getPage($params);
         } else {
             // parent is not connected and parent is not root
             // connected parent is needed
             $row = $presenter->pageModel->loadParent($parentTreeNodeId);
             //            dump($row);
             //            die();
             $parent = new CMSPage($this->context, $parentTreeNodeId);
             $parent->setAsBubbleLoaded();
             $superParent = $this->getAttachedParent($presenter, $row['parent']);
             $superParent->addComponent($parent, 'page' . $parent->treeNodeId);
             $pageManager->indexPage($parent);
             return $parent;
         }
     }
 }
Example #7
0
 public function doPageUpdate(CMSPage $page, $extra)
 {
     $data = $this->getJSON();
     if (!array_key_exists($data['id']) || $data['id'] != $page->id) {
         throw new InvalidArgumentException('page id mismatch');
     }
     $page->unserialize($data);
     $this->response = $page->serialize();
 }
Example #8
0
 public function getMetaEditor($id)
 {
     $pageR = new CMSPageRevision($id);
     $page = new CMSPage($pageR->getParentId());
     $form = $page->getForm();
     $form->removeElement('section');
     $form->removeElement('action');
     $form->removeElement('id');
     $form->_constantValues = array();
     $form->addElement('hidden', 'section');
     $defaultValues['section'] = 'addEdit';
     $form->addElement('hidden', 'action');
     $defaultValues['action'] = 'editMeta';
     $form->addElement('hidden', 'id');
     $defaultValues['id'] = $pageR->getId();
     $metadata = $pageR->getMetaData();
     $defaultValues['metatitle'] = $metadata['title'];
     $defaultValues['metadesc'] = $metadata['description'];
     $defaultValues['metakeywords'] = $metadata['keywords'];
     $defaultValues['urlkey'] = $page->getPageName();
     $form->setDefaults($defaultValues);
     $this->smarty->assign('form', $form);
     if ($form->validate() && isset($_REQUEST['submit'])) {
         $metadata = array('title' => $form->exportValue('metatitle'), 'description' => $form->exportValue('metadesc'), 'keywords' => $form->exportValue('metakeywords'));
         $pageR->setMetaData($metadata);
         $pageR->save();
         $this->topLevelInterface();
     }
 }
Example #9
0
$tableDefCMSPage->dropTable($db);
$tableDefCMSPage->createTable($db);
/*
*XMLObject_CMSPageApp
*
*
*/
$tableDefCMSPageApp = new XMLObject_CMSPageApp('');
$tableDefCMSPageApp->dropTable($db);
$tableDefCMSPageApp->createTable($db);
/*
*CMSPages
*
*
*/
$tableDefCMSPages = new CMSPage('');
$tableDefCMSPages->dropTable($db);
$tableDefCMSPages->createTable($db);
/*
 * HTMLBlock
 *
 * The SQL definition of the CMS application HTMLBlock.
 */
$tableDefHTMLBlock = new HTMLBlock(null, '');
$tableDefHTMLBlock->dropTable($db);
$tableDefHTMLBlock->createTable($db);
/*
 * XMLObject_MultilingualManager
 *
 * The SQL definition of the Multilingual Tables.
 */
Example #10
0
 public static function use_boundable_styles()
 {
     $path = apf_classname_to_path(__CLASS__);
     return array_merge(parent::use_boundable_styles(), array($path . "User.css"));
 }