/**
  * Get the current active record.  Returns record driver if found, false
  * if no record requested, null if ID invalid.
  *
  * @return mixed
  */
 public function getActiveRecord()
 {
     $id = $this->getRequest()->getQuery('recordID', false);
     if ($id === false) {
         return $id;
     }
     try {
         return $this->loader->load($id);
     } catch (\VuFind\Exception\RecordMissing $e) {
         return null;
     }
 }
Example #2
0
 /**
  * Get routing details to display a particular tab.
  *
  * @param \VuFind\RecordDriver\AbstractBase|string $driver Record driver
  * representing record to link to, or source|id pipe-delimited string
  * @param string                                   $tab    Action to access
  *
  * @return array
  */
 public function getTabRouteDetails($driver, $tab = null)
 {
     $route = $this->getRouteDetails($driver, '', empty($tab) ? [] : ['tab' => $tab]);
     // If collections are active and the record route was selected, we need
     // to check if the driver is actually a collection; if so, we should switch
     // routes.
     if ('record' == $route['route']) {
         if (isset($this->config->Collections->collections) && $this->config->Collections->collections) {
             if (!is_object($driver)) {
                 list($source, $id) = $this->extractSourceAndId($driver);
                 $driver = $this->loader->load($id, $source);
             }
             if (true === $driver->tryMethod('isCollection')) {
                 $route['route'] = 'collection';
             }
         }
     }
     return $route;
 }
Example #3
0
 /**
  * Load a specific record from the index.
  *
  * @param string $id The record ID to load
  *
  * @return mixed     The record array (if successful) or false
  */
 protected function loadRecord($id)
 {
     // Strip the ID prefix, if necessary:
     $id = $this->stripID($id);
     if ($id !== false) {
         try {
             return $this->recordLoader->load($id, $this->searchClassId);
         } catch (RecordMissingException $e) {
             return false;
         }
     }
     return false;
 }
Example #4
0
 /**
  * Get a Solr record.
  *
  * @param string $id ID of record to retrieve
  *
  * @return \VuFind\RecordDriver\AbstractBase
  */
 protected function getSolrRecord($id)
 {
     return $this->recordLoader->load($id);
 }
Example #5
0
 /**
  * Get a Solr record.
  *
  * @param string $id ID of record to retrieve
  *
  * @return \VuFind\RecordDriver\AbstractBase
  */
 protected function getSolrRecord($id)
 {
     // Add idPrefix condition
     $idPrefix = $this->getIdPrefix();
     return $this->recordLoader->load(strlen($idPrefix) ? $idPrefix . $id : $id);
 }