/** * Get the main navigation for the public site. * * @package Omeka\Function\View\Navigation * @return Zend_View_Helper_Navigation_Menu Can be echoed like a string or * manipulated by the theme. */ function public_nav_main() { $view = get_view(); $nav = new Omeka_Navigation(); $nav->loadAsOption(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME); $nav->addPagesFromFilter(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_FILTER_NAME); return $view->navigation()->menu($nav); }
/** * Returns the option value associated with the default navigation during installation * * @return String The option value associated with the default navigation during installation. * If no option is found for the option name, then it returns an empty string. */ public static function getNavigationOptionValueForInstall() { $value = ''; $nav = new Omeka_Navigation(); $nav->addPagesFromFilter(self::PUBLIC_NAVIGATION_MAIN_FILTER_NAME); if ($nav->count()) { $value = json_encode($nav->toArray()); } return $value; }
/** * Returns the option value associated with the default navigation during installation * * @param String $optionName The option name for a stored navigation object. * @return String The option value associated with the default navigation during installation. * If no option is found for the option name, then it returns an empty string. */ public static function getNavigationOptionValueForInstall($optionName) { $value = ''; $nav = new Omeka_Navigation(); switch ($optionName) { case self::PUBLIC_NAVIGATION_MAIN_OPTION_NAME: $nav->addPagesFromFilter(self::PUBLIC_NAVIGATION_MAIN_FILTER_NAME); break; } if ($nav->count()) { $value = json_encode($nav->toArray()); } return $value; }
<?php //$this->navigation() // ->sitemap() // ->setFormatOutput(true); // default is false // other possible methods: // ->setUseXmlDeclaration(false); // default is true // ->setServerUrl('http://my.otherhost.com'); // default is to detect automatically $nav = new Omeka_Navigation(); $nav->loadAsOption(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME); $nav->addPagesFromFilter(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_FILTER_NAME); $collections = get_db()->getTable('Collection')->findAll(); foreach ($collections as $collection) { $page = new Omeka_Navigation_Page_Mvc(array('label' => metadata($collection, array('Dublin Core', 'Title')), 'route' => 'id', 'action' => 'show', 'controller' => 'collections', 'params' => array('id' => $collection->id))); // print_r($page); $nav->addPage($page); } if (plugin_is_active('ExhibitBuilder')) { $exhibits = get_db()->getTable('Exhibit')->findAll(); foreach ($exhibits as $exhibit) { $page = new Omeka_Navigation_Page_Mvc(array('route' => 'id', 'action' => 'show', 'controller' => 'exhibit', 'params' => array('id' => $exhibit->id))); $nav->addPage($page); } } echo $this->navigation()->sitemap($nav);