Example #1
0
 public function RenderFileBrowser($parentId, $link, $basePath = null, $level = 0, $id = 'fileTree', $withRoot = false)
 {
     $links = array();
     $tree = new Model_Page();
     $children = $tree->getChildren($parentId, null, 'name');
     // add a link for site root
     if (isset($withRoot) && $withRoot == true) {
         $links[] = $this->_getSiteRootElement();
     }
     foreach ($children as $child) {
         if ($tree->hasChildren($child)) {
             $newLevel = $level + 1;
             $submenu = $this->view->RenderFileBrowser($child->id, $link, $basePath, $newLevel);
             $icon = 'folder.png';
         } else {
             $icon = 'page_white_text.png';
             $submenu = false;
         }
         if (isset($child->label) && !empty($child->label)) {
             $label = $child->label;
         } else {
             $label = $child->name;
         }
         $links[] = '<li class="menuItem">' . $this->view->link($label, $link . $child->id, $icon) . $submenu . '</li>';
     }
     if (is_array($links)) {
         if ($level == 0) {
             $strId = "id='{$id}'";
         } else {
             $strId = null;
         }
         $filetree = "<ul {$strId}>" . implode(null, $links) . '</ul>';
         return $filetree;
     }
 }
 public function renderFileChecklist($values = array(), $parentId, $level = 0, $class = 'fileChecklist', $icon = null)
 {
     $links = array();
     $page = new Model_Page();
     $children = $page->getChildren($parentId);
     foreach ($children as $child) {
         $submenu = false;
         if ($page->hasChildren($child)) {
             $newLevel = $level + 1;
             $submenu = $this->view->renderFileChecklist($values, $child->id, $newLevel, $class, $icon);
         }
         // TODO: refactor into Toolbox String - replace empty spaces with underscores for element names only
         $childName = strtolower(str_replace(' ', '_', $child->name));
         $checked = 0;
         if (in_array($childName, $values)) {
             $checked = 1;
         }
         $form = new Digitalus_Form();
         $checkbox = $form->createElement('checkbox', $childName, array('value' => $checked, 'decorators' => array('ViewHelper'), 'belongsTo' => $class));
         $links[] = '<li>' . $checkbox . $this->getIcon($icon, $child->name) . $child->name . $submenu . '</li>';
     }
     $strClass = null;
     if (is_array($links)) {
         if ($level == 0) {
             $strClass = 'class="' . $class . '"';
         }
         $fileChecklist = '<ul ' . $strClass . 'class="treeview">' . implode(null, $links) . '</ul>';
         return $fileChecklist;
     }
 }
Example #3
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);
             }
         }
     }
 }
Example #4
0
File: News.php Project: ssrsfs/blg
 public static function GetCategoryUri($categoryid)
 {
     static $categories = null;
     if (is_null($categories)) {
         // Get all URIs and associated categories
         $categories = array();
         $pages = new Model_Page();
         $pages->where('application = ?', 'News');
         foreach ($pages->getAll() as $page) {
             $settings = $page->get('settings');
             $uri = $page->get('uri');
             // This news page only includes certain categories
             if (isset($settings['categoryid']) && !in_array(0, $settings['categoryid'])) {
                 foreach ($settings['categoryid'] as $cid) {
                     $categories[$cid] = $uri;
                 }
             } else {
                 $categories[0] = $uri;
             }
         }
     }
     // There is a page that explicitly includes this category
     if (isset($categories[$categoryid])) {
         return $categories[$categoryid];
     }
     // There is a page that includes all categories
     if (isset($categories[0])) {
         return $categories[0];
     }
     // There is no page for this category
     return null;
 }
 public function RenderFileChecklist($values = array(), $parentId, $level = 0, $id = 'fileChecklist')
 {
     $links = array();
     $page = new Model_Page();
     $children = $page->getChildren($parentId);
     foreach ($children as $child) {
         if ($page->hasChildren($child)) {
             $newLevel = $level + 1;
             $submenu = $this->view->RenderFileChecklist($values, $child->id, $newLevel);
         } else {
             $submenu = false;
         }
         if (in_array($child->id, $values)) {
             $checked = 1;
         } else {
             $checked = 0;
         }
         $checkbox = $this->view->formCheckbox('file_' . $child->id, $checked);
         $links[] = '<li class="page">' . $checkbox . $child->name . $submenu . '</li>';
     }
     if (is_array($links)) {
         if ($level == 0) {
             $strId = "id='{$id}'";
         } else {
             $strId = null;
         }
         $fileChecklist = "<ul {$strId}>" . implode(null, $links) . '</ul>';
         return $fileChecklist;
     }
 }
Example #6
0
 public function rssAction()
 {
     // build the feed array
     $feedArray = array();
     // the title and link are required
     $feedArray['title'] = 'Recent Pages';
     $feedArray['link'] = 'http://localhost';
     // the published timestamp is optional
     $feedArray['published'] = Zend_Date::now()->toString(Zend_Date::TIMESTAMP);
     // the charset is required
     $feedArray['charset'] = 'UTF8';
     // first get the most recent pages
     $mdlPage = new Model_Page();
     $recentPages = $mdlPage->getRecentPages();
     //add the entries
     if (is_array($recentPages) && count($recentPages) > 0) {
         foreach ($recentPages as $page) {
             // create the entry
             $entry = array();
             $entry['guid'] = $page->id;
             $entry['title'] = $page->headline;
             $entry['link'] = 'http://localhost/page/open/title/' . $page->name;
             $entry['description'] = $page->description;
             $entry['content'] = $page->content;
             // add it to the feed
             $feedArray['entries'][] = $entry;
         }
     }
     // create an RSS feed from the array
     $feed = Zend_Feed::importArray($feedArray, 'rss');
     // now send the feed
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout->disableLayout();
     $feed->send();
 }
Example #7
0
 public function action_create()
 {
     $this->template->page_title = 'Create Page';
     $user = new Model_User();
     $session = Session::instance()->get('user');
     $view = View::factory('cp/pages/create');
     $view->author = $user->get_user_by_session_id($session);
     if ($this->request->method() === Request::POST) {
         if (!Security::check($this->request->post('csrf_token'))) {
             throw new HTTP_Exception_401("Bad token!");
         }
         $post_title = $this->request->post('title');
         $post_content = $this->request->post('content');
         $post_author = $this->request->post('author');
         $post_date = time();
         if (empty($post_title) && empty($post_content) && empty($post_author) && empty($post_date)) {
             throw new Exception('Please don`t make empty fields!');
         }
         $page = new Model_Page();
         $data = array('title' => $post_title, 'content' => $post_content, 'author' => $post_author, 'date' => $date);
         $insert_page = $page->insert_page($data);
         if (!$insert_page) {
             throw new Exception('Check if you are connected to database!');
         }
         $this->request->redirect('cp/pages');
     }
     $this->template->content = $view->render();
 }
Example #8
0
 public function buildAction()
 {
     // create the index
     $index = Zend_Search_Lucene::create(APPLICATION_PATH . '/indexes');
     // fetch all of the current pages
     $mdlPage = new Model_Page();
     $currentPages = $mdlPage->fetchAll();
     if ($currentPages->count() > 0) {
         // create a new search document for each page
         foreach ($currentPages as $p) {
             $page = new CMS_Content_Item_Page($p->id);
             $doc = new Zend_Search_Lucene_Document();
             // you use an unindexed field for the id because you want the id to be
             // included in the search results but not searchable
             $doc->addField(Zend_Search_Lucene_Field::unIndexed('page_id', $page->id));
             // you use text fields here because you want the content to be searchable
             // and to be returned in search results
             $doc->addField(Zend_Search_Lucene_Field::text('page_name', $page->name));
             $doc->addField(Zend_Search_Lucene_Field::text('page_headline', $page->headline));
             $doc->addField(Zend_Search_Lucene_Field::text('page_description', $page->description));
             $doc->addField(Zend_Search_Lucene_Field::text('page_content', $page->content));
             // add the document to the index
             $index->addDocument($doc);
         }
     }
     // optimize the index
     $index->optimize();
     // pass the view data for reporting
     $this->view->indexSize = $index->numDocs();
 }
Example #9
0
 public function RenderBlock($path)
 {
     $mdlPage = new Model_Page();
     $uriObj = new Digitalus_Uri($path);
     $pointer = $mdlPage->fetchPointer($uriObj->toArray());
     $pageObj = $mdlPage->open($pointer, $mdlPage->getDefaultVersion());
     $namespace = $pageObj->page->namespace . '_' . $pointer;
     return $this->view->RenderContentTemplate($pageObj->page->content_template, $pageObj->content, $namespace);
 }
Example #10
0
 public function getPageMenu(\AbstractView $view, Model_Page $page)
 {
     if ($view->template->hasTag('SubMenu') && ($siblings = $page->getSiblings())) {
         $menu = $view->add('Menu_Vertical', null, 'SubMenu');
         foreach ($siblings as $page) {
             $page->page_translation = $page->getTranslation(true);
             $url = $page['hash_url'] ?: $page['url_first_child'];
             $this->app->addMenuItem($menu, $page->page_translation['meta_title'], 'home-1', 'atk-swatch-beigeDarken', $url);
         }
     }
 }
Example #11
0
 /**
  * this function loads the current menu and is run automatically by the constructor
  *
  */
 protected function _load()
 {
     $page = new Model_Page();
     $children = $page->getChildren($this->_parentId);
     if ($children != null && $children->count() > 0) {
         foreach ($children as $child) {
             if ($child->show_on_menu == 1) {
                 $this->items[] = new Digitalus_Menu_Item($child);
             }
         }
     }
 }
Example #12
0
 public function testContentPageAdmin()
 {
     $this->logIn();
     $this->get(TYPEF_WEB_DIR . '/admin/content');
     $this->getAssets();
     $pages = new Model_Page();
     $pages->where('application = ?', 'Content');
     foreach ($pages->getAll() as $page) {
         $this->get(TYPEF_WEB_DIR . '/admin/content/page?pageid=' . $page['pageid']);
         $this->getAssets();
     }
 }
Example #13
0
 /**
  * Initialize the form
  *
  * @return void
  */
 public function init()
 {
     parent::init();
     $view = $this->getView();
     // create new element
     $id = $this->createElement('hidden', 'id', array('decorators' => array('ViewHelper')));
     $this->addElement($id);
     // create new element
     $name = $this->createElement('text', 'page_name', array('label' => $view->getTranslation('Page Name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array(array('NotEmpty', true), array('StringLength', true, array(4, Model_Page::PAGE_NAME_LENGTH)), array('Regex', true, array('pattern' => Model_Page::PAGE_NAME_REGEX, 'messages' => array('regexNotMatch' => Model_Page::PAGE_NAME_REGEX_NOTMATCH)))), 'attribs' => array('size' => 50), 'order' => 0));
     $this->addElement($name);
     // add options for parent page
     $multiOptions = array(0 => $view->getTranslation('Site Root'));
     $mdlIndex = new Model_Page();
     $index = $mdlIndex->getIndex(0, 'name');
     if (is_array($index)) {
         foreach ($index as $id => $page) {
             $multiOptions[$id] = $page;
         }
     }
     // create new element
     $parentId = $this->createElement('select', 'parent_id', array('label' => $view->getTranslation('Parent page') . ':', 'required' => true, 'multiOptions' => $multiOptions, 'order' => 1));
     $this->addElement($parentId);
     // add options for template
     $multiOptions = array();
     $templateConfig = Zend_Registry::get('config')->template;
     $templates = Digitalus_Filesystem_Dir::getDirectories(BASE_PATH . '/' . $templateConfig->pathToTemplates . '/public');
     foreach ($templates as $template) {
         $designs = Digitalus_Filesystem_File::getFilesByType(BASE_PATH . '/' . $templateConfig->pathToTemplates . '/public/' . $template . '/pages', 'xml');
         if (is_array($designs)) {
             foreach ($designs as $design) {
                 $design = Digitalus_Toolbox_Regex::stripFileExtension($design);
                 $multiOptions[$template . '_' . $design] = $view->getTranslation($template) . ' / ' . $view->getTranslation($design);
             }
         }
     }
     // create new element
     $contentTemplate = $this->createElement('select', 'content_template', array('label' => $view->getTranslation('Template') . ':', 'required' => true, 'multiOptions' => $multiOptions, 'order' => 2));
     $this->addElement($contentTemplate);
     // create new element
     $continue = $this->createElement('checkbox', 'continue_adding_pages', array('label' => $view->getTranslation('Continue adding pages') . '?', 'order' => 3));
     $this->addElement($continue);
     // create new element
     $showOnMenu = $this->createElement('checkbox', 'show_on_menu', array('label' => $view->getTranslation('Show Page on menu') . '?', 'order' => 4));
     $this->addElement($showOnMenu);
     // create new element
     $publish = $this->createElement('checkbox', 'publish_pages', array('label' => $view->getTranslation('Publish page instantly') . '?', 'order' => 5));
     $this->addElement($publish);
     // create new element
     $submit = $this->createElement('submit', 'submitPageForm', array('label' => $view->getTranslation('Submit'), 'attribs' => array('class' => 'submit'), 'order' => 1000));
     $this->addElement($submit);
     $this->addDisplayGroup(array('form_instance', 'id', 'page_name', 'parent_id', 'content_template', 'continue_adding_pages', 'show_on_menu', 'publish_pages', 'submitPageForm'), 'createPageGroup');
 }
Example #14
0
File: Feed.php Project: ssrsfs/blg
 public function admin(Pagemill_Data $data, Pagemill_Stream $stream)
 {
     $this->adminTemplate = '/admin/news/feed.plug.html';
     $data = $data->fork();
     $categories = new Model_News_Category();
     $categories->order('categoryname');
     $data['categories'] = $categories;
     $pages = new Model_Page();
     $pages->where('application = ?', 'News');
     $data['pages'] = $pages;
     $data->setArray($this->attributes());
     parent::admin($data, $stream);
 }
Example #15
0
 public function SelectPage($name, $value = null, $attribs = null)
 {
     $mdlIndex = new Model_Page();
     $index = $mdlIndex->getIndex(0, 'name');
     $pages = array();
     $pages[0] = $this->view->getTranslation('Site Root');
     if (is_array($index)) {
         foreach ($index as $id => $page) {
             $pages[$id] = $page;
         }
     }
     return $this->view->formSelect($name, $value, $attribs, $pages);
 }
Example #16
0
 public function admin(Pagemill_Data $data, Pagemill_Stream $stream)
 {
     // TODO: Implement
     $data = $data->fork();
     $data->setArray($this->attributes());
     $pages = new Model_Page();
     $pages->where('application = ?', 'News');
     $data->set('pages', $pages);
     $categories = new Model_News_Category();
     $categories->order('categoryname');
     $data->set('categories', $categories);
     $this->adminTemplate = '/admin/news/archive.plug.html';
     parent::admin($data, $stream);
 }
Example #17
0
 public function init()
 {
     $this->setMethod('post');
     // create new element
     $id = $this->createElement('hidden', 'id');
     // element options
     $id->setDecorators(array('ViewHelper'));
     // add the element to the form
     $this->addElement($id);
     // create new element
     $menuId = $this->createElement('hidden', 'menu_id');
     // element options
     $menuId->setDecorators(array('ViewHelper'));
     // add the element to the form
     $this->addElement($menuId);
     // create new element
     $label = $this->createElement('text', 'label');
     // element options
     $label->setLabel('Label: ');
     $label->setRequired(TRUE);
     $label->addFilter('StripTags');
     $label->setAttrib('size', 40);
     // add the element to the form
     $this->addElement($label);
     // create new element
     $pageId = $this->createElement('select', 'page_id');
     // element options
     $pageId->setLabel('Select a page to link to: ');
     $pageId->setRequired(true);
     // populate this with the pages
     $mdlPage = new Model_Page();
     $pages = $mdlPage->fetchAll(null, 'name');
     $pageId->addMultiOption(0, 'None');
     if ($pages->count() > 0) {
         foreach ($pages as $page) {
             $pageId->addMultiOption($page->id, $page->name);
         }
     }
     // add the element to the form
     $this->addElement($pageId);
     // create new element
     $link = $this->createElement('text', 'link');
     // element options
     $link->setLabel('or specify a link: ');
     $link->setRequired(false);
     $link->setAttrib('size', 50);
     // add the element to the form
     $this->addElement($link);
     $submit = $this->addElement('submit', 'submit', array('label' => 'Submit'));
 }
Example #18
0
 public static function getUrl(Zend_Db_Table_Row $page, $separator = '/')
 {
     $labels[] = self::getLabel($page);
     $mdlPage = new Model_Page();
     $parents = $mdlPage->getParents($page);
     if (is_array($parents)) {
         foreach ($parents as $parent) {
             $labels[] = self::getLabel($parent);
         }
     }
     if (is_array($labels)) {
         $labels = array_reverse($labels);
         return implode($separator, $labels);
     }
 }
Example #19
0
File: Page.php Project: Gorp/pr
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
 public function renderPublishedPagesList($publishLevel = null, $id = 'pagesList', $order = null, $limit = null, $offset = null)
 {
     $mdlPage = new Model_Page();
     $pages = $mdlPage->getPagesByPublishState($publishLevel, $order, $limit, $offset);
     if (is_array($pages)) {
         $xhtml = '<ul id="' . $id . '">';
         foreach ($pages as $pageId) {
             $page = new Model_Page();
             $title = $page->getPageTitle($pageId);
             $xhtml .= '<li class="page">' . $this->view->link($title, '/admin/page/edit/id/' . $pageId, 'page.png') . '</li>' . PHP_EOL;
         }
         $xhtml .= '</ul>' . PHP_EOL;
         return $xhtml;
     }
     return null;
 }
Example #21
0
 public function init()
 {
     $id = $this->createElement('hidden', 'id');
     $id->setDecorators(array('ViewHelper'));
     $this->addElement($id);
     $name = $this->createElement('text', 'page_name');
     $name->addFilter('StripTags');
     $name->setRequired(true);
     $name->setLabel('Page Name: ');
     $name->setAttrib('size', 50);
     $name->setOrder(0);
     $this->addElement($name);
     $parentId = $this->createElement('select', 'parent_id');
     $parentId->setLabel($this->getView()->getTranslation('Parent page') . ':');
     $mdlIndex = new Model_Page();
     $index = $mdlIndex->getIndex(0, 'name');
     $parentId->addMultiOption(0, $this->getView()->getTranslation('Site Root'));
     if (is_array($index)) {
         foreach ($index as $id => $page) {
             $parentId->addMultiOption($id, $page);
         }
     }
     $parentId->setOrder(1);
     $this->addElement($parentId);
     $contentTemplate = $this->createElement('select', 'content_template');
     $contentTemplate->setLabel($this->getView()->getTranslation('Template') . ':');
     $templateConfig = Zend_Registry::get('config')->template;
     $templates = Digitalus_Filesystem_Dir::getDirectories(BASE_PATH . '/' . $templateConfig->pathToTemplates . '/public');
     foreach ($templates as $template) {
         $designs = Digitalus_Filesystem_File::getFilesByType(BASE_PATH . '/' . $templateConfig->pathToTemplates . '/public/' . $template . '/pages', 'xml');
         if (is_array($designs)) {
             foreach ($designs as $design) {
                 $design = Digitalus_Toolbox_Regex::stripFileExtension($design);
                 $contentTemplate->addMultiOption($template . '_' . $design, $template . ' / ' . $design);
             }
         }
     }
     $contentTemplate->setOrder(2);
     $this->addElement($contentTemplate);
     $continue = $this->createElement('checkbox', 'continue_adding_pages');
     $continue->setLabel($this->getView()->getTranslation('Continue adding pages') . '?');
     $continue->setOrder(3);
     $this->addElement($continue);
     $submit = $this->createElement('submit', $this->getView()->getTranslation('Submit'));
     $submit->setOrder(1000);
     $this->addElement($submit);
 }
Example #22
0
File: Menu.php Project: Gorp/pr
 function getPageByMenu($lang)
 {
     //@TODO обработать ситуацию когда получаем пустой объект
     if (empty($this->idpage)) {
         return "no title";
     }
     return Local_Base::translit(Model_Page::getById($this->idpage, $lang)->title);
 }
Example #23
0
 public function selectPage($name, $value = null, $attribs = null)
 {
     $mdlIndex = new Model_Page();
     $index = $mdlIndex->getIndex(0, 'name');
     $options = array();
     $options[0] = $this->view->getTranslation('Site Root');
     if (is_array($index)) {
         foreach ($index as $id => $page) {
             $options[$id] = $page;
         }
     }
     $form = new Digitalus_Form();
     $select = $form->createElement('select', $name, array('multiOptions' => $options));
     if (is_array($attribs)) {
         $select->setAttribs($attribs);
     }
     return $select;
 }
Example #24
0
 public function action_index($id)
 {
     $page = Model_Page::getBySlug($id, false);
     if (!$page || !$page->isPublished() && !Helper_Account::is_admin(Auth::instance()->get_user())) {
         $this->template->content = View::factory("errors/index");
         return;
     }
     $this->template->content = View::factory("page/index")->set("page", $page);
     $this->template->sidebar = Widget::factory()->add(Helper_Default::sidebar());
 }
 public function renderFileBrowser($parentId, $link, $basePath = null, $level = 0, $id = 'fileTree', $withRoot = false, $current = null, $exclude = null, $translate = true)
 {
     $links = array();
     $tree = new Model_Page();
     $children = $tree->getChildren($parentId);
     // add a link for site root
     if (isset($withRoot) && $withRoot == true) {
         $links[] = $this->_getSiteRootElement();
     }
     foreach ($children as $child) {
         if ($tree->hasChildren($child)) {
             $newLevel = $level + 1;
             $submenu = $this->view->renderFileBrowser($child->id, $link, $basePath, $newLevel, null, null, $current, $exclude);
             $icon = 'folder.png';
             if ($child->id == $current) {
                 $icon = 'folder_wrench.png';
             }
         } else {
             $icon = 'page_white_text.png';
             if ($child->id == $current) {
                 $icon = 'page_white_wrench.png';
             }
             $submenu = false;
         }
         $label = $child->name;
         if ($child->id == $exclude) {
             $links[] = $this->_getExcludeElement($label, $submenu, $icon);
         } else {
             $links[] = '<li class="menuItem">' . $this->view->link($label, $link . $child->id, $icon, null, null, null, $translate) . $submenu . '</li>';
         }
     }
     if (is_array($links)) {
         if ($level == 0) {
             $strId = 'id="' . $id . '"';
         } else {
             $strId = null;
         }
         $filetree = "<ul {$strId}>" . implode(null, $links) . '</ul>';
         return $filetree;
     }
 }
Example #26
0
 public function action_page($slug)
 {
     $page = Model_Page::getBySlug($slug, false);
     if ($page) {
         $this->template->content = View::factory("myshot/index");
         $this->template->content->page = $page;
         $this->template->sidebar = Widget::factory()->add(Helper_Default::sidebar());
     } else {
         $this->template->content = "No page available";
         //redirect instead?
     }
 }
Example #27
0
 public function action_save()
 {
     if (!Can::show()) {
         exit;
     }
     $page_id = $this->request->post('page_id');
     $blocks = $this->request->post('blocks');
     $actived = $this->request->post('draft') === 'false';
     $result = Model_Page::draft($page_id, $blocks, $actived);
     $image = $this->save_image($page_id, $this->request->post('image'));
     $this->response->json($result);
 }
Example #28
0
 public function action_save()
 {
     $block = new stdClass();
     $block->data = $this->request->post();
     $block->page_id = $this->request->query('page_id');
     $block->page_block_template_id = $this->request->query('page_block_template_id');
     View::set_global('preview', TRUE);
     $page = Model_Page::factory('Page', $block->page_id);
     View::bind_global('page', $page);
     $result = Model_Page::instance()->render_block($block);
     $this->response->body($result);
 }
Example #29
0
 public function clearItemCache($code, $id)
 {
     if (!$this->_cache) {
         return;
     }
     $model = Model::factory('Page');
     $this->_cache->remove($model->getCacheKey(array('item', 'code', $code)));
     $this->_cache->remove(Model_Page::getCodeHash($id));
     $this->_cache->remove(Model_Page::getCodeHash($code));
     $bm = new Blockmanager();
     $bm->invalidatePageMap($id);
     $this->_cache->remove(Frontend_Router::CACHE_KEY_ROUTES);
 }
Example #30
0
 public function admin(Pagemill_Data $data, Pagemill_Stream $stream)
 {
     $this->adminTemplate = '/admin/news/newsfeed.adminplug.html';
     $data = $data->fork();
     $this->attributes = array_merge(array('news_page_base' => '', 'limit' => ''), $this->attributes);
     $data->setArray($this->attributes);
     // get pages; add to template
     $pages = new Model_Page();
     $pages->where('application = ?', 'News');
     $data->set('pages', $pages);
     // get categories; add to template
     //$categories = new News_Category_Factory();
     $categories = new Model_News_Category();
     $categories->order('categoryname');
     foreach ($categories->getAll() as $category) {
         if (isset($this->attributes['categoryid']) && in_array($row['categoryid'], $this->attributes['categoryid'])) {
             $category->set('selected', true, true);
         }
     }
     $data->set('categories', $categories);
     parent::output($data, $stream);
 }