Esempio n. 1
0
 /**
  * Initialise the object from the global
  *  search parameters in $_REQUEST.
  *
  * @return boolean
  * @access public
  */
 public function init()
 {
     global $module;
     global $action;
     $searchSettings = getExtraConfigArray('searches');
     // Get collection specific sort options
     if (isset($searchSettings['CollectionModuleSort'])) {
         $this->sortOptions = $searchSettings['CollectionModuleSort'];
     } else {
         $this->sortOptions = array('title' => 'sort_title', 'year' => 'sort_year', 'year asc' => 'sort_year asc', 'callnumber' => 'sort_callnumber', 'author' => 'sort_author');
     }
     $this->defaultSort = key($this->sortOptions);
     //array_slice($this->sortOptions, 0, 1);
     // Call the standard initialization routine in the parent:
     parent::init();
     // Log a special type of search
     $this->searchType = 'collection';
     // We don't spellcheck this screen
     // it's not for free user intput anyway
     $this->spellcheck = false;
     //$collectionField = "hierarchy_top_id";//hierarchy_parent_id
     // Prepare the search
     if ($this->_collectionField == null) {
         $this->setCollectionField();
     }
     $this->addFilter($this->_collectionField . ":" . $this->collectionID);
     $this->addHiddenFilter('!id:' . $this->collectionID);
     // Sorting - defaults to off with unlimited facets, so let's
     // be explicit here for simplicity.
     if (isset($_REQUEST['sort']) && $_REQUEST['sort'] == $this->_collectionField) {
         $this->setFacetSortOrder('index');
     } else {
         $this->setFacetSortOrder('count');
     }
     return true;
 }