示例#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);
 }
示例#3
0
 /**
  * Establishes base settings for making recommendations.
  *
  * @param string                            $settings Settings from config.ini
  * @param \VuFind\RecordDriver\AbstractBase $driver   Record driver object
  *
  * @return void
  */
 public function init($settings, $driver)
 {
     $this->recordId = $driver->getUniqueID();
 }
示例#4
0
 /**
  * Given a record driver, generate a URL to fetch all child records for it.
  *
  * @param \VuFind\RecordDriver\AbstractBase $driver Host Record.
  *
  * @return string
  */
 public function getChildRecordSearchUrl($driver)
 {
     $urlHelper = $this->getView()->plugin('url');
     $url = $urlHelper('search-results') . '?lookfor=' . urlencode(addcslashes($driver->getUniqueID(), '"')) . '&type=ParentID';
     // Make sure everything is properly HTML encoded:
     $escaper = $this->getView()->plugin('escapehtml');
     return $escaper($url);
 }