10, 20 => 20, 30 => 30, 40 => 40, 50 => 50 ); /** * Sort options * global array */ private static $sort_options = array( 'relevance' => 'Relevance', 'date_desc' => 'Date Descending', 'date_asc' => 'Date Ascending' ); /** * Amount options * global array */ private static $amount_options = array( 'detailed' => 'Detailed', 'brief' => 'Brief', 'title' => 'Title Only' ); /** * Bool options * global array */ private static $bool_options = array( 'AND' => 'All terms', 'OR' => 'Any terms', 'NOT' => 'No terms' ); /** * Search mode options * global array */ private static $mode_options = array( 'all' => 'All search terms', 'bool' => 'Boolean / Phrase', 'any' => 'Any search terms', 'smart' => 'SmartText Searching' ); /** * Basic search type options * global array */ private static $basic_search_type_options = array( 'AllFields' => 'All Text', 'Title' => 'Title', 'Author' => 'Author', 'Subject' => 'Subject terms', 'Source' => 'Source', 'Abstract' => 'Abstract' ); /** * Advanced search type options * global array */ private static $advanced_search_type_options = array( 'AllFields' => 'All Text', 'Title' => 'Title', 'Author' => 'Author', 'Subject' => 'Subject terms' ); /** * Constructor. * * @param array $data Raw data from the EBSCO search representing the record. */ public function __construct($params = null) { $this->eds = new EBSCOAPI(array( 'password' => variable_get('ebsco_password'), 'user' => variable_get('ebsco_user'), 'profile' => variable_get('ebsco_profile'), 'interface' => variable_get('ebsco_interface'), 'organization' => variable_get('ebsco_organization'), 'guest' => variable_get('ebsco_guest'), 'log' => variable_get('ebsco_log') )); $this->params = $params ? $params : $_REQUEST; $this->limit = variable_get('ebsco_default_limit') ? variable_get('ebsco_default_limit') : $this->limit; } /** * Perform the API Info call * * @return array */ public function info() { $this->info = $this->eds->apiInfo(); return $this->info; } /** * Perform the API Retrieve call * * @return array */ public function retrieve() { list($an, $db) = isset($this->params['id']) ? explode('|', $this->params['id'], 2) : array(null, null); $this->result = $this->eds->apiRetrieve($an, $db); return $this->result; } /** * Perform the API Search call * * @return array */ public function search() { $search = array(); if (isset($this->params['lookfor']) && isset($this->params['type'])) { $search = array( 'lookfor' => $this->params['lookfor'], 'index' => $this->params['type'] ); } else if (isset($this->params['group'])) { $search = $this->params; } else { return array(); } $filter = isset($this->params['filter']) ? $this->params['filter'] : array(); $page = isset($this->params['page']) ? $this->params['page'] + 1 : 1; $limit = $this->limit; $sort = isset($this->params['sort']) ? $this->params['sort'] : 'relevance'; $amount = isset($this->params['amount']) ? $this->params['amount'] : 'detailed'; $mode = isset($this->params['mode']) ? $this->params['mode'] : 'all'; $this->results = $this->eds->apiSearch($search, $filter, $page, $limit, $sort, $amount, $mode); if (isset($this->results['start'])) { $this->results['start'] = $limit * ($page - 1); } return $this->results; } /** * Get the EBSCORecord model for the result * ** @return array */ public function record() { if (empty($this->record) && !(empty($this->result))) { $this->record = new EBSCORecord($this->result); } return $this->record; } /** * Get the EBSCORecord models array from results array * ** @return array */ public function records() { if (empty($this->records) && !(empty($this->results))) { foreach($this->results['documents'] as $result) { $this->records[] = new EBSCORecord($result); } } return $this->records; } /** * Get the pagination HTML string * ** @return HTML string */ public function pager() { $pager = null; if ($this->has_records()) { pager_default_initialize($this->record_count() / $this->limit, 1); $pager = theme('pager', array('tags' => null, 'quantity' => self::$page_links)); $pager = preg_replace('/