public function filter($content) { $this->page = Digitalus_Builder::getPage(); $pattern = '(\\<' . $this->tag . '(/?[^\\>]+)\\>)'; $content = preg_replace_callback($pattern, array($this, '_callback'), $content); return $content; }
/** * */ public function listLanguageLinks() { $page = Digitalus_Builder::getPage(); $currentLanguage = $page->getLanguage(); $availableLanguages = $page->getAvailableLanguages(); $xhtml = $this->view->getTranslation('You are reading this page in') . ' ' . $this->view->getTranslation(Digitalus_Language::getFullName($currentLanguage)) . '.'; if (is_array($availableLanguages)) { $languageLinks = array(); $uri = new Digitalus_Uri(); $base = $uri->toString(); foreach ($availableLanguages as $locale => $name) { if (!empty($locale) && $locale != $currentLanguage) { $url = $base . '/p/language/' . $locale; $languageLinks[] = '<a href="' . $url . '">' . $this->view->getTranslation($name) . '</a>'; } } if (is_array($languageLinks) && count($languageLinks) > 0) { foreach ($languageLinks as $language) { $languageLinksTranslated[] = $this->view->getTranslation($language); } $xhtml .= ' ' . $this->view->getTranslation('This page is also translated into') . ' ' . implode(', ', $languageLinks); } } return '<p>' . $xhtml . '</p>'; }
public function showAction() { $show = $this->moduleData->show; $page = Digitalus_Builder::getPage(); $params = $page->getParams(); if (!isset($params['slide']) || $params['slide'] == null) { $index = 1; } else { $index = $params['slide']; } $mdlSlide = new Slideshow_Slide(); $slide = $mdlSlide->getSlideByShow($show, $index); $count = $mdlSlide->countSlidesInShow($show); $pageLinks = new stdClass(); if ($index == 1) { $pageLinks->first = null; $pageLinks->previous = null; } else { $pageLinks->first = Digitalus_Uri::get(false, false, array('slide' => 1)); $pageLinks->previous = Digitalus_Uri::get(false, false, array('slide' => $index - 1)); } if ($index < $count && $count > 1) { $pageLinks->next = Digitalus_Uri::get(false, false, array('slide' => $index + 1)); $pageLinks->last = Digitalus_Uri::get(false, false, array('slide' => $count)); } else { $pageLinks->next = null; $pageLinks->last = null; } $this->view->pageLinks = $pageLinks; $this->view->slide = $slide; $this->view->index = $index; $this->view->count = $count; $this->view->slides = $mdlSlide->getSlides($show); }
public function renderSubMenu($levels = 2, $id = 'subnav') { $page = Digitalus_Builder::getPage(); $parents = $page->getParents(); if (is_array($parents) && count($parents) > 0) { // parents is returned as an ascending array, we need it to descend $parents = array_reverse($parents); $rootParent = array_shift($parents); $rootParentId = $rootParent->id; } else { //this page is a root level page. $rootParentId = $page->getId(); } if ($rootParentId > 0) { return $this->view->RenderMenu($rootParentId, $levels, null, $id); } }
public function blogAction() { if ($this->moduleData->blog > 0) { $mdlBlog = new Blog_Blog(); $mdlPost = new Blog_Post(); $page = Digitalus_Builder::getPage(); $params = $page->getParams(); if (isset($params['openPost']) && $params['openPost'] > 0) { $openPost = $mdlPost->openPost($params['openPost']); $this->view->openPost = $openPost; $this->view->blog = $mdlBlog->find($openPost->blogId)->current(); } else { $this->view->blog = $mdlBlog->find($this->moduleData->blog)->current(); $this->view->posts = $mdlPost->getPosts($this->moduleData->blog); } } }
/** * Check whether navigation item is the currently selected * * @param string $ignoreParents Ignore the parent navigation items when setting CSS class or id * @return bool Returns true when the item is the currently selected, otherwise false */ public function isSelected($ignoreParents = false) { $currentPage = Digitalus_Builder::getPage(); $currentPageId = $currentPage->getId(); if ($this->id == $currentPageId) { return true; } elseif ($ignoreParents == false) { $page = new Model_Page(); $parents = $page->getParents($currentPageId); if (is_array($parents)) { if (isset($parents[$this->id])) { return true; } } } return false; }
/** * Constructor * * @return void */ public function __construct($moduleKey = null) { $this->_setModuleKey($moduleKey); $this->_page = Digitalus_Builder::getPage(); }
/** * Constructor * * @return void */ public function __construct() { $this->_page = Digitalus_Builder::getPage(); }