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', 'Source' => 'Journal Title/Source', 'Abstract' => 'Abstract', 'ISBN' => 'ISBN', 'ISSN' => 'ISSN' ); private $local_ips = ""; /** * 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'), 'local_ip_address' => variable_get('ebsco_local_ips'), '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; $this->amount = variable_get('ebsco_default_amount') ? variable_get('ebsco_default_amount') : $this->amount; } /** * 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'] : 'brief'; // $mode = isset($this->params['mode']) ? $this->params['mode'] : 'all'; //check if research starters , EMP are active $info = $this->info(); $rs=false; $emp=false; if ($info["relatedContent"]){ foreach ($info["relatedContent"] as $related) { if ( ($related["Type"] == "rs") and ($related["DefaultOn"] == "y")) { $rs=true; } if ( ($related["Type"] == "emp") and ($related["DefaultOn"] == "y")) { $emp=true; } } } $autosug=false; if ($info["didYouMean"]){ if ( $info["didYouMean"][0]["DefaultOn"] == "y") { $autosug=true; } } $this->results = $this->eds->apiSearch($search, $filter, $page, $limit, $sort, $amount, $mode,$rs,$emp,$autosug); 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 ($this->record instanceof EBSCOException ) { return null; } if ($this->results instanceof EBSCOException ) { return null; } if (empty($this->records) && !(empty($this->results))) { foreach($this->results['documents'] as $result) { $this->records[] = new EBSCORecord($result); } } return $this->records; } public function relatedContent() { if ($this->results instanceof EBSCOException ) { return null; } $this->relatedContent = isset($this->results['relatedContent']) ? $this->results['relatedContent'] : array(); return $this->relatedContent; } public function autoSuggestTerms() { $this->autoSuggestTerms = isset($this->results['autoSuggestTerms']) ? $this->results['autoSuggestTerms'] : null; return $this->autoSuggestTerms; } /** * Get the pagination HTML string * ** @return HTML string */ public function pager() { $pager = null; try { 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('/