public function __construct() { $mdlPage = new Model_Page(); $mdlContentNode = new Model_ContentNode(); $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(Digitalus_Toolbox_String::addHyphens($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); } } } }
/** * render a module page like news_showNewPosts */ public function ListMostPopular() { $popular = $this->view->pageObj->getPopularStories(); if ($popular) { foreach ($popular as $story) { $link = Digitalus_Toolbox_String::addHyphens($this->view->RealPath($story->id)); $data[] = "<a href='{$link}'>" . $this->view->pageObj->getLabel($story) . "</a>"; } if (is_array($data)) { return $this->view->htmlList($data); } } }
/** * removes any params from the uri */ public function CleanUri($uri = null, $absolute = false, $stripUnderscores = false) { if ($uri == null) { $uri = $this->view->pageObj->getCleanUri(); } if ($absolute && !empty($uri)) { $uri = '/' . $uri; } if ($stripUnderscores) { $uri = Digitalus_Toolbox_String::stripUnderscores($uri, true); } return Digitalus_Toolbox_String::addHyphens($uri); }
/** * render a module page like news_showNewPosts */ public function listWhatsNew() { $newStories = $this->view->pageObj->getNewStories(); if ($newStories) { foreach ($newStories as $story) { $link = Digitalus_Toolbox_String::addHyphens($this->view->realPath($story->id)); $data[] = '<a href="' . $link . '">' . $this->view->pageObj->getLabel($story) . '</a>'; } if (is_array($data)) { return $this->view->htmlList($data); } } }
public function RenderBreadcrumbs($separator = ' > ', $siteRoot = 'Home') { $parents = $this->view->pageObj->getParents(); if (is_array($parents) && count($parents) > 0) { $path = null; foreach ($parents as $parent) { $label = $this->view->pageObj->getLabel($parent); $link = '/' . Digitalus_Toolbox_String::addHyphens($label); $path .= $link; $arrLinks[] = "<a href='{$path}' class='breadcrumb'>{$parent->title}</a>"; } } $arrLinks[] = "<a href='' class='breadcrumb last'>{$this->view->page->title}</a>"; return implode($separator, $arrLinks); }
/** * Return the current menu item as hyperlink * * @param string $id The CSS id for the <a> tag * @param string $class The CSS class for the <a> tag * @param string $currentId The CSS id for the <a> tag of the current link * @param string $currentClass The CSS class for the <a> tag of the current link * @param string $ignoreParents Ignore the parent navigation items when setting CSS class or id * @return string The string of the hyperlink <a> tag */ public function asHyperlink($id = null, $class = null, $currentId = null, $currentClass = null, $ignoreParents = false) { if (isset($id) && !empty($id)) { $id = 'id="' . $id . '"'; } if (isset($class) && !empty($class)) { $class = 'class="' . $class . '"'; } $cleanLink = Digitalus_Toolbox_String::addHyphens($this->link); $front = Zend_Controller_Front::getInstance(); $baseUrl = $front->getBaseUrl(); if (isset($currentId) && !empty($currentId) && $this->isSelected($ignoreParents)) { $id[] = $currentId; $id = implode(' ', $id); } if (isset($currentClass) && !empty($currentClass) && $this->isSelected($ignoreParents)) { $class[] = $currentClass; $class = implode(' ', $class); } $class = isset($class) && !empty($class) ? ' class="' . $class . '"' : null; return '<a href="' . $baseUrl . '/' . $cleanLink . '"' . $id . $class . '>' . $this->label . '</a>' . PHP_EOL; }