Exemplo n.º 1
0
 public function resetNavigationAction()
 {
     if (!$this->getRequest()->isPost()) {
         $this->_forward('method-not-allowed', 'error', 'default');
         return;
     }
     $form = $this->_getResetForm();
     if ($form->isValid($_POST)) {
         $nav = array_reverse(Omeka_Navigation::getNavigationOptionValueForInstall(), true);
         set_option(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME, $nav);
         $this->_helper->flashMessenger(__('The navigation settings have been reset.'), 'success');
         $this->_helper->redirector('edit-navigation');
     } else {
         throw new Omeka_Controller_Exception_404();
     }
 }
Exemplo n.º 2
0
/**
 * 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);
}
Exemplo n.º 3
0
 /**
  * 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;
 }
Exemplo n.º 4
0
 private function _addOptions()
 {
     $task = new Installer_Task_Options();
     $task->setOptions(array('administrator_email' => $this->_getValue('administrator_email'), 'copyright' => $this->_getValue('copyright'), 'site_title' => $this->_getValue('site_title'), 'author' => $this->_getValue('author'), 'description' => $this->_getValue('description'), 'thumbnail_constraint' => $this->_getValue('thumbnail_constraint'), 'square_thumbnail_constraint' => $this->_getValue('square_thumbnail_constraint'), 'fullsize_constraint' => $this->_getValue('fullsize_constraint'), 'per_page_admin' => $this->_getValue('per_page_admin'), 'per_page_public' => $this->_getValue('per_page_public'), 'show_empty_elements' => $this->_getValue('show_empty_elements'), 'path_to_convert' => $this->_getValue('path_to_convert'), Theme::ADMIN_THEME_OPTION => Installer_Default::DEFAULT_ADMIN_THEME, Theme::PUBLIC_THEME_OPTION => Installer_Default::DEFAULT_PUBLIC_THEME, Omeka_Validate_File_Extension::WHITELIST_OPTION => Omeka_Validate_File_Extension::DEFAULT_WHITELIST, Omeka_Validate_File_MimeType::WHITELIST_OPTION => Omeka_Validate_File_MimeType::DEFAULT_WHITELIST, File::DISABLE_DEFAULT_VALIDATION_OPTION => (string) (!extension_loaded('fileinfo')), Omeka_Db_Migration_Manager::VERSION_OPTION_NAME => OMEKA_VERSION, 'display_system_info' => true, 'html_purifier_is_enabled' => 1, 'html_purifier_allowed_html_elements' => implode(',', Omeka_Filter_HtmlPurifier::getDefaultAllowedHtmlElements()), 'html_purifier_allowed_html_attributes' => implode(',', Omeka_Filter_HtmlPurifier::getDefaultAllowedHtmlAttributes()), 'tag_delimiter' => ',', Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME => Omeka_Navigation::getNavigationOptionValueForInstall(Omeka_Navigation::PUBLIC_NAVIGATION_MAIN_OPTION_NAME), 'search_record_types' => serialize(get_search_record_types()), 'api_enable' => false, 'api_per_page' => 50, 'show_element_set_headings' => 1));
     $task->install($this->_db);
 }
Exemplo n.º 5
0
 /**
  * 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;
 }
Exemplo n.º 6
0
<?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);
Exemplo n.º 7
0
 /**
  * Returns whether the post is attempting to delete an undeletable page
  *
  * @return boolean
  */
 protected function _postHasDeletedUndeletablePage()
 {
     // get undeleteable page uids from new navigation
     $nav = $this->_getNavigationFromPost();
     $iterator = new RecursiveIteratorIterator($nav, RecursiveIteratorIterator::SELF_FIRST);
     $newUndeleteableUids = array();
     foreach ($iterator as $page) {
         if ($page->can_delete == false) {
             $newUndeleteableUids[] = $page->uid;
         }
     }
     // make sure every undeleteable page uid from old navigation is in the list of new undeleteable page uids
     $nav = Omeka_Navigation::createNavigationFromFilter('public_navigation_main');
     $iterator = new RecursiveIteratorIterator($nav, RecursiveIteratorIterator::SELF_FIRST);
     foreach ($iterator as $page) {
         if ($page->can_delete == false) {
             if (!in_array($page->uid, $newUndeleteableUids)) {
                 $this->addError(__('Navigation links that have undeleteable sublinks cannot be deleted.'));
                 return true;
             }
         }
     }
     return false;
 }