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 loginAction() { $form = new Admin_Form_Login(); $form->setAction($this->baseUrl . '/public/index/login'); if ($this->_request->isPost() && $form->isValid($_POST)) { $uri = Digitalus_Filter_Post::get('uri'); $username = Digitalus_Filter_Post::get('adminUsername'); $password = Digitalus_Filter_Post::get('adminPassword'); $auth = new Digitalus_Auth($username, $password); $result = $auth->authenticate(); if (!$result) { $e = new Digitalus_View_Error(); $e->add($this->view->getTranslation('The username or password you entered was not correct.')); } else { $uri = Digitalus_Toolbox_Page::getHomePageName(); $this->_redirect($uri); } } # ---------------------------------------------------------------------------- # $this->page->content = array('label' => 'Auth', 'headline' => $this->view->getTranslation('Authorisation required'), 'content' => $this->view->partial('partials/login.phtml', array('form' => $form))); $this->page->defaultContent = $this->page->content; // load the view Digitalus_Builder::loadPage(null, 'load_view.xml', $this->page, $this->view); // render the page $this->view->page = $this->page; $this->view->layout()->page = $this->page->getParam('xhtml'); $this->renderScript('index/index.phtml'); }
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 indexAction() { // create the new page object $this->page = Digitalus_Builder::loadPage(null, 'initialize.xml'); // load the data Digitalus_Builder::loadPage(null, 'load_data.xml', $this->page); // load the view Digitalus_Builder::loadPage(null, 'load_view.xml', $this->page, $this->view); // render the page $this->view->page = $this->page; $this->view->layout()->page = $this->page->getParam('xhtml'); }
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(); }