Esempio n. 1
0
 public function __construct()
 {
     $mdlPage = new Model_Page();
     $mdlContentNode = new Model_PageNode();
     $select = $mdlPage->select();
     $select->where("namespace = 'content'");
     $pages = $mdlPage->fetchAll($select);
     if ($pages->count() > 0) {
         foreach ($pages as $page) {
             $contentNodes = $mdlContentNode->fetchContentObject($page->id);
             if (isset($contentNodes->content)) {
                 //if the page does not have content it doesnt belong in the index (eg blocks)
                 $title = $mdlPage->getPageTitle($page->id);
                 $link = Digitalus_Toolbox_Page::getUrl($page);
                 $link = strtolower($link);
                 $contentNodes = $mdlContentNode->fetchContentObject($page->id);
                 if (isset($contentNodes->teaser)) {
                     $teaser = $contentNodes->teaser;
                 } else {
                     $teaser = Digitalus_Toolbox_String::truncateText($contentNodes->content);
                 }
                 $content = $contentNodes->content;
                 $this->_addPage($link, $title, $teaser, $content);
             }
         }
     }
 }
Esempio n. 2
0
 private static function _GetCategoryBases()
 {
     static $categoryids = null;
     static $categoryBases = null;
     if (is_null($categoryBases)) {
         $categoryids = array();
         $categoryBases = array();
         $categories = new Model_News_Category();
         foreach ($categories->select() as $category) {
             $categoryids[] = $category['id'];
         }
         $pages = new Model_Page();
         $pages->where('application = ?', 'News');
         foreach ($pages->select() as $page) {
             if (isset($page['settings']['categoryid']) && is_array($page['settings']['categoryid']) && !in_array(0, $page['settings']['categoryid'])) {
                 foreach ($page['settings']['categoryid'] as $id) {
                     if (!isset($categoryBases[$id])) {
                         $categoryBases[$id] = array();
                     }
                     $categoryBases[$id][] = TYPEF_WEB_DIR . $page['uri'];
                 }
             } else {
                 if (!isset($categoryBases[0])) {
                     $categoryBases[0] = array();
                 }
                 $categoryBases[0][] = TYPEF_WEB_DIR . $page['uri'];
                 foreach ($categoryids as $id) {
                     if (!isset($categoryBases[$id])) {
                         $categoryBases[$id] = array();
                     }
                     $categoryBases[$id][] = TYPEF_WEB_DIR . $page['uri'];
                 }
             }
         }
     }
     return $categoryBases;
 }
Esempio n. 3
0
 public function openAction()
 {
     $title = $this->_request->getParam('title');
     $mdlPage = new Model_Page();
     $row = null;
     if (null !== $title) {
         $select = $mdlPage->select();
         $select->where('name = ?', $title);
         $row = $mdlPage->fetchRow($select);
         $id = $row->id;
     } else {
         $id = $this->_request->getParam('id');
     }
     // first confirm the page exists
     $bootstrap = $this->getInvokeArg('bootstrap');
     $cache = $bootstrap->getResource('cache');
     $cacheKey = 'content_page_' . $id;
     $page = $cache->load($cacheKey);
     if (!$page) {
         if ($row instanceof Zend_Db_Table_Row) {
             $page = new CMS_Content_Item_Page($row);
         } else {
             $page = new CMS_Content_Item_Page($id);
         }
         // add a cache tag to this menu so you can update the cached menu
         // when you update the page
         $tags[] = 'page_' . $page->id;
         $cache->save($page, $cacheKey, $tags);
     }
     $this->view->page = $page;
 }
Esempio n. 4
0
<?php

if ($page->exists() && $_POST['uri'] != $page['uri']) {
    $realPages = new Model_Page();
    $realPages->where('site.masterid = ?', $page['masterid']);
    $realPages->where('uri = ?', $page['uri']);
    //$realPages->updateQuery(array('uri' => $_POST['uri']));
    foreach ($realPages->select() as $rp) {
        $tmp = Model_Page::Get($rp['pageid']);
        $tmp['uri'] = $_POST['uri'];
        $tmp->save();
    }
}
$page->setArray($_POST, false);
$page->save();
$sites = new Model_Site();
$sites->where('masterid = ?', $master['id']);
foreach ($sites->select() as $site) {
    $realPages = new Model_Page();
    $realPages->where('siteid = ?', $site['id']);
    $realPages->where('uri = ?', $page['uri']);
    $realPage = $realPages->getFirst();
    if (!$realPage->exists()) {
        $realPage = Model_Page::Create();
        $realPage['siteid'] = $site['id'];
    }
    $realPage->setArray($page->getArray(), false);
    $realPage->save();
}
Typeframe::Registry()->purgeRegistryCache();
Esempio n. 5
0
 private function _loadUserPages()
 {
     $pages = new Model_Page();
     foreach ($pages->select() as $page) {
         $application = $this->application($page['application']);
         if ($application) {
             $settings = (array) $page['settings'];
             $settings['pageid'] = $page['pageid'];
             $settings['siteid'] = $page['siteid'] ? $page['siteid'] : 0;
             $settings['nickname'] = $page['nickname'];
             $settings['skin'] = $page['skin'];
             $site = $page['site']['domain'];
             // Make sure the page does not belong to a deleted site
             if ($settings['siteid'] == 0 || ($page['site']['domain'] || $page['site']['directory'])) {
                 if (!$site) {
                     $site = defined('TYPEF_HOST') ? TYPEF_HOST : (isset($SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '');
                 }
                 $directory = '/' . $page['site']['directory'];
                 if ($directory == '/') {
                     $directory = '';
                 }
                 $fullPath = TYPEF_WEB_DIR . $directory . ($page['uri'] != '/' ? $page['uri'] : '');
                 $this->_pages[$site . $fullPath] = new Typeframe_Page($application, $fullPath, $settings);
                 //$this->_pages[TYPEF_WEB_DIR . $page['uri']] = new Typeframe_Page($application, TYPEF_WEB_DIR . $page['uri'], $settings);
             }
         } else {
             trigger_error("Application '{$page['application']}' is not registered");
         }
     }
 }