*/
class Toolkit_Template_BreadCrumbs
{
- // {{{ properties
+ // {{{ properties
/**
* Description for $pageGateway
* @var Toolkit_Toolbox_PageGatewayAbstract $gateway
* @access protected
*/
- protected $pageGateway;
+ protected $pageGateway;
- // }}}
- // {{{ __construct()
+ // }}}
+ // {{{ __construct()
/**
* Class constructor
* @param Toolkit_Toolbox_PageGatewayAbstract $gateway Gateway
* @access public
*/
- public function __construct(Toolkit_Toolbox_PageGatewayAbstract $gateway)
- {
- $this->pageGateway = $gateway;
- }
+ public function __construct(Toolkit_Toolbox_PageGatewayAbstract $gateway)
+ {
+ $this->pageGateway = $gateway;
+ }
- // }}}
- // {{{ getBreadCrumbsArray()
+ // }}}
+ // {{{ getBreadCrumbsArray()
/**
* Gets bread crumbs array
* @throws RuntimeException
* @access protected
*/
- protected function getBreadCrumbsArray($id)
- {
- $stack = array();
-
- $hasPhotoGalleriesOnThisPage
- = ( defined('PHOTO_GALLERY')
- && PHOTO_GALLERY
- && filter_var($_GET['photo_catid'], FILTER_VALIDATE_INT)
- );
-
- if ($hasPhotoGalleriesOnThisPage) {
- if (!$catid = filter_var($_GET['catid'], FILTER_VALIDATE_INT)) {
- throw new RuntimeException('Invalid catid');
- }
- if (!$photoCatid = filter_var($_GET['photo_catid'], FILTER_VALIDATE_INT)) {
- throw new RuntimeException('Invalid photo_catid');
- }
- $page = $this->pageGateway->findNavItem($catid);
- array_unshift($stack, $page['photo_galleries'][$_GET['photo_catid']]);
- $seoUrl = Toolkit_Template_Page::getSeoUrl(
- $this->pageGateway,
- $_GET['catid']
- );
- $anchor = '<a href="'.$seoUrl.'">'.$page['navigation_name'].'</a>';
- array_unshift($stack, $anchor);
- }
+ protected function getBreadCrumbsArray($id)
+ {
+ $stack = array();
+
+ $hasPhotoGalleriesOnThisPage
+ = ( defined('PHOTO_GALLERY')
+ && PHOTO_GALLERY
+ && filter_var($_GET['photo_catid'], FILTER_VALIDATE_INT)
+ );
+
+ if ($hasPhotoGalleriesOnThisPage) {
+ if (!$catid = filter_var($_GET['catid'], FILTER_VALIDATE_INT)) {
+ throw new RuntimeException('Invalid catid');
+ }
+ if (!$photoCatid = filter_var($_GET['photo_catid'], FILTER_VALIDATE_INT)) {
+ throw new RuntimeException('Invalid photo_catid');
+ }
+ $page = $this->pageGateway->findNavItem($catid);
+ array_unshift($stack, $page['photo_galleries'][$_GET['photo_catid']]);
+ $seoUrl = Toolkit_Template_Page::getSeoUrl(
+ $this->pageGateway,
+ $_GET['catid']
+ );
+ $anchor = '<a href="'.$seoUrl.'">'.$page['navigation_name'].'</a>';
+ array_unshift($stack, $anchor);
+ }
$hasCommonEvents = (defined('COMMON_EVENTS') && COMMON_EVENTS);
- if ($id != HOME_ID) {
+ if ($id != HOME_ID) {
if ( defined('EVENT_DB')
&& EVENT_DB && !$hasCommonEvents
&& $eventId = filter_var($_REQUEST['eventid'], FILTER_VALIDATE_INT)
Toolkit_Common::handleError($e);
}
}
+ if ( $package_id = filter_var( $_REQUEST['package_id'], FILTER_VALIDATE_INT ) ) {
+ $package = Toolkit_Packages_Package::fetchById(
+ Toolkit_Database::getInstance(),
+ $package_id
+ );
+ array_unshift($stack, $package->getTitle());
+ }
if ( defined('EVENT_DB')
&& EVENT_DB && !$hasCommonEvents
&& $categoryId = filter_var($_REQUEST['category'], FILTER_VALIDATE_INT)
Toolkit_Common::handleError($e);
}
}
- $page = $this->pageGateway->findNavItem($id);
- $isSearch = filter_var($_REQUEST['search'], FILTER_VALIDATE_INT);
- if ($isSearch && !$eventHeader && !$topicHeader && !$hasCommonEvents) {
- array_unshift($stack, 'Events Search');
- }
- $isShortcut = filter_var($_REQUEST['t'], FILTER_SANITIZE_STRING);
- if ($isShortcut && !$eventHeader && !$topicHeader && !$hasCommonEvents) {
- if ($isShortcut == "today") {
- array_unshift($stack, 'Today');
- } else if ($isShortcut == "tomorrow") {
- array_unshift($stack, 'Tomorrow');
- } else if ($isShortcut == "next") {
- array_unshift($stack, 'Next 7 Days');
- }
- }
- if ($hasPhotoGalleriesOnThisPage) {
- // Do Nothing
- } else if (($eventHeader || $topicHeader || $isSearch || $isShortcut)
+ $page = $this->pageGateway->findNavItem($id);
+ $isSearch = filter_var($_REQUEST['search'], FILTER_VALIDATE_INT);
+ if ($isSearch && !$eventHeader && !$topicHeader && !$hasCommonEvents) {
+ array_unshift($stack, 'Events Search');
+ }
+ $isShortcut = filter_var($_REQUEST['t'], FILTER_SANITIZE_STRING);
+ if ($isShortcut && !$eventHeader && !$topicHeader && !$hasCommonEvents) {
+ if ($isShortcut == "today") {
+ array_unshift($stack, 'Today');
+ } else if ($isShortcut == "tomorrow") {
+ array_unshift($stack, 'Tomorrow');
+ } else if ($isShortcut == "next") {
+ array_unshift($stack, 'Next 7 Days');
+ }
+ }
+ if ($hasPhotoGalleriesOnThisPage) {
+ // Do Nothing
+ } else if (($eventHeader || $topicHeader || $isSearch || $isShortcut || $package_id)
&& !$hasCommonEvents
) {
$seoUrl = Toolkit_Template_Page::getSeoUrl(
- $this->pageGateway,
- $id
- );
- $anchor = '<a href="'.$seoUrl.'">'.$page['navigation_name'].'</a>';
- array_unshift($stack, $anchor);
- } else {
- array_unshift($stack, $page['navigation_name']);
- }
- $parent = $page['parent'];
- while ($parent != 0) {
- $page = $this->pageGateway->findNavItem($parent);
- $seoUrl = Toolkit_Template_Page::getSeoUrl(
- $this->pageGateway,
- $parent
- );
- $anchor = '<a href="'.$seoUrl.'">'.$page['navigation_name'].'</a>';
- array_unshift($stack, $anchor);
- $parent = $page['parent'];
- }
-
- $anchor = '<a href="' . BASE_URL . 'index.php">Home</a>';
- array_unshift($stack, $anchor);
- }
-
- return $stack;
- }
-
- // }}}
- // {{{ toHtml()
+ $this->pageGateway,
+ $id
+ );
+ $anchor = '<a href="'.$seoUrl.'">'.$page['navigation_name'].'</a>';
+ array_unshift($stack, $anchor);
+ } else {
+ array_unshift($stack, $page['navigation_name']);
+ }
+ $parent = $page['parent'];
+ while ($parent != 0) {
+ $page = $this->pageGateway->findNavItem($parent);
+ $seoUrl = Toolkit_Template_Page::getSeoUrl(
+ $this->pageGateway,
+ $parent
+ );
+ $anchor = '<a href="'.$seoUrl.'">'.$page['navigation_name'].'</a>';
+ array_unshift($stack, $anchor);
+ $parent = $page['parent'];
+ }
+
+ $anchor = '<a href="' . BASE_URL . 'index.php">Home</a>';
+ array_unshift($stack, $anchor);
+ }
+
+ return $stack;
+ }
+
+ // }}}
+ // {{{ toHtml()
/**
* to html
* @return string
* @access public
*/
- public function toHtml($id)
- {
- $breadCrumbsArray = $this->getBreadCrumbsArray($id);
- $breadCrumbs = implode(' > ', $breadCrumbsArray);
+ public function toHtml($id)
+ {
+ $breadCrumbsArray = $this->getBreadCrumbsArray($id);
+ $breadCrumbs = implode(' > ', $breadCrumbsArray);
- return !empty($breadCrumbsArray)
- ? '<div id="breadcrumbs" class="opensearchserver.ignore">' . $breadCrumbs . '</div>'
- : '';
- }
+ return !empty($breadCrumbsArray)
+ ? '<div id="breadcrumbs" class="opensearchserver.ignore">' . $breadCrumbs . '</div>'
+ : '';
+ }
- // }}}
+ // }}}
}
?>