示例#1
0
 /**
  * A helper function that retrieves UB request details for ILL and caches them
  * for a short while for faster access.
  *
  * @param string $id     BIB id
  * @param array  $patron Patron
  *
  * @return bool|array False if UB request is not available or an array
  * of details on success
  */
 protected function getUBRequestDetails($id, $patron)
 {
     $result = parent::getUBRequestDetails($id, $patron);
     if (is_array($result)) {
         $result['libraries'] = $this->filterAllowedUBPickupLibraries($result['libraries'], $patron);
     }
     return $result;
 }
示例#2
0
 /**
  * Factory for VoyagerRestful driver.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return VoyagerRestful
  */
 public static function getVoyagerRestful(ServiceManager $sm)
 {
     $ils = $sm->getServiceLocator()->get('VuFind\\ILSHoldSettings');
     $vr = new VoyagerRestful($sm->getServiceLocator()->get('VuFind\\DateConverter'), $ils->getHoldsMode(), $ils->getTitleHoldsMode());
     $vr->setCacheStorage($sm->getServiceLocator()->get('VuFind\\CacheManager')->getCache('object'));
     return $vr;
 }
示例#3
0
 /**
  * Make Request
  *
  * Makes a request to the Voyager Restful API
  *
  * @param array  $hierarchy Array of key-value pairs to embed in the URL path of
  * the request (set value to false to inject a non-paired value).
  * @param array  $params    A keyed array of query data
  * @param string $mode      The http request method to use (Default of GET)
  * @param string $xml       An optional XML string to send to the API
  *
  * @throws ILSException
  * @return obj  A Simple XML Object loaded with the xml data returned by the API
  */
 protected function makeRequest($hierarchy, $params = false, $mode = "GET", $xml = false)
 {
     $startTime = microtime(true);
     $result = parent::makeRequest($hierarchy, $params, $mode, $xml);
     if (!empty($this->config['Debug']['durationLogPrefix'])) {
         list(, $caller) = debug_backtrace(false);
         file_put_contents($this->config['Debug']['durationLogPrefix'] . '_' . $caller['function'] . '_ws.log', date('Y-m-d H:i:s ') . round(microtime(true) - $startTime, 4) . "\n", FILE_APPEND);
     }
     return $result;
 }