From 630ced4d72115417d9fae67b37989d77e049d481 Mon Sep 17 00:00:00 2001 From: Arni Loftsson Date: Tue, 20 Sep 2011 13:01:25 +0200 Subject: [PATCH] Added method to search directly in DDELibra --- lib/AlmaClient/AlmaClient.class.php | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/lib/AlmaClient/AlmaClient.class.php b/lib/AlmaClient/AlmaClient.class.php index 4035fdf..f2f6eef 100644 --- a/lib/AlmaClient/AlmaClient.class.php +++ b/lib/AlmaClient/AlmaClient.class.php @@ -952,6 +952,40 @@ public function remove_message_service($borr_card, $pin_code, $method, $type) { return TRUE; } + /** + * Searches in the DDELibra LMS. Returnes ids from the search result + * + * @param string $search_text + * Search string in CCL + * @param string $search_type + * One of native | fullText | namedList. Native is the DDLibra's native search language (CCL) + * @param $start_no + * Where in the search result to start returning the asked for number of records. + * @param $number_of_records + * Number of returned records + */ + public function run_lms_search($search_text, $search_type = 'native', $start_no = 1, $number_of_records = 30) { + $params = array( + 'searchText' => $search_text, + 'searchType' => $search_type, + 'startNo' => $start_no, + 'nofRecords' => $number_of_records + ); + $doc = $this->request('catalogue/fulltextsearch', $params, FALSE); + $data = array( + 'request_status' => $doc->getElementsByTagName('status')->item(0)->getAttribute('value'), + 'number_of_records' => $doc->getElementsByTagName('nofRecords')->item(0)->nodeValue, + 'number_of_records_total' => $doc->getElementsByTagName('nofRecordsTotal')->item(0)->nodeValue, + 'start_number' => $doc->getElementsByTagName('startNo')->item(0)->nodeValue, + 'stop_number' => $doc->getElementsByTagName('stopNo')->item(0)->nodeValue, + 'alma_ids' => array(), + ); + foreach ($doc->getElementsByTagName('catalogueRecord') as $elem) { + $data['alma_ids'][] = $elem->getAttribute('id'); + } + + return $data; + } } /**