示例#1
0
 /**
  * Pull the search parameters from the query and set up additional options using
  * a record driver representing a collection.
  *
  * @param \VuFind\RecordDriver\AbstractBase $driver Record driver
  *
  * @return void
  */
 public function initFromRecordDriver($driver)
 {
     $this->collectionID = $driver->getUniqueID();
     if ($hierarchyDriver = $driver->getHierarchyDriver()) {
         switch ($hierarchyDriver->getCollectionLinkType()) {
             case 'All':
                 $this->collectionField = 'hierarchy_parent_id';
                 break;
             case 'Top':
                 $this->collectionField = 'hierarchy_top_id';
                 break;
         }
     }
     if (null === $this->collectionID) {
         throw new \Exception('Collection ID missing');
     }
     if (null === $this->collectionField) {
         throw new \Exception('Collection field missing');
     }
     // We don't spellcheck this screen; it's not for free user input anyway
     $options = $this->getOptions();
     $options->spellcheckEnabled(false);
     // Prepare the search
     $safeId = addcslashes($this->collectionID, '"');
     $options->addHiddenFilter($this->collectionField . ':"' . $safeId . '"');
     $options->addHiddenFilter('!id:"' . $safeId . '"');
 }
示例#2
0
文件: Params.php 项目: tillk/vufind
 /**
  * Pull the search parameters from the query and set up additional options using
  * a record driver representing a collection.
  *
  * @param \VuFind\RecordDriver\AbstractBase $driver  Record driver
  * @param \Zend\StdLib\Parameters           $request Parameter object
  * representing user request.
  *
  * @return void
  */
 public function initFromRecordDriver($driver, $request)
 {
     $this->collectionID = $driver->getUniqueID();
     if ($hierarchyDriver = $driver->getHierarchyDriver()) {
         switch ($hierarchyDriver->getCollectionLinkType()) {
             case 'All':
                 $this->collectionField = 'hierarchy_parent_id';
                 break;
             case 'Top':
                 $this->collectionField = 'hierarchy_top_id';
                 break;
         }
     }
     $this->initFromRequest($request);
 }