2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2006 by Greg Gay & Joel Kronenberg */
6 /* Adaptive Technology Resource Centre / University of Toronto */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License */
11 /* as published by the Free Software Foundation. */
12 /****************************************************************/
13 // $Id: merlot.php 6614 2006-09-27 19:32:29Z greg $
15 // Check if links is turned on for this course.
16 $sql ="SELECT home_links, main_links from ".TABLE_PREFIX."courses WHERE course_id=".$_SESSION[course_id];
17 $result = mysql_query($sql, $db);
18 while($row = mysql_fetch_assoc($result)){
19 if(ereg('links/index.php', $row['home_links']) || ereg('links/index.php', $row['main_links'])){
23 If(isset($_REQUEST['query'])){
24 $search = stripslashes($_REQUEST['query']);
25 }else if(isset($_REQUEST['advsearch'])){
27 if($_REQUEST['keywords'] != ''){
28 $keywords = stripslashes($_REQUEST['keywords']);
29 $search .= '<keyword>'.$keywords.'</keyword>';
32 if($_REQUEST['title'] != ''){
33 $title = stripslashes($_REQUEST['title']);
34 $search .= '<title>'.$title.'</title>';
37 if($_REQUEST['contributorName'] != ''){
38 $author = stripslashes($_REQUEST['contributorName']);
39 $search .= '<authorname>'.$author.'</authorname>';
42 if($_REQUEST['url'] != ''){
43 $url = stripslashes($_REQUEST['url']);
44 $search .= '<location>'.$url.'</location>';
47 if($_REQUEST['description'] != ''){
48 $description = stripslashes($_REQUEST['description']);
49 $search .= '<description>'.$description.'</description>';
52 if($_REQUEST['category'] != ''){
53 $category = intval($_REQUEST['category']);
54 $search .= '<category>'.$category.'</category>';
57 if($_REQUEST['language'] != ''){
58 $language = stripslashes($_REQUEST['language']);
59 $search .= '<language>'.$language.'</language>';
62 if($_REQUEST['materialType'] != ''){
63 $type = stripslashes($_REQUEST['materialType']);
64 $search .= '<learningresourcetype>'.$type.'</learningresourcetype>';
67 if($_REQUEST['audience'] != ''){
68 $context = stripslashes($_REQUEST['audience']);
69 $search .= '<context>'.$context.'</context>';
72 $search .= '</search>';
75 $search_input = array($merlot_key, $search,'0','25');
76 $client = new SoapClient($merlot_location);
78 if($search && $search != '<search></search>' && $search != ''){
79 $results = $client->__soapCall('doSearch', $search_input);
80 $results = get_object_vars($results);
82 $result_count = count($results['resultElements']);
83 echo '<div style="background-color:#eeeeee;width:95%;"><h3>'. _AT('merlot_results_found') .' - '.$results['totalResultsCount'].' -- '._AT('merlot_results_displayed').' '. $result_count.'</h3></div>';
85 for($i = 0; $i < $result_count; $i++){
86 $this_result = get_object_vars($results['resultElements'][$i]);
93 echo '<div style="background-color:'.$bgstyle.';width:90%; margin: 10px; padding:3px;">';
94 echo '<a href="'.$this_result['URL'].'" target="merlot">'.$this_result['title'].'</a> [ <a href="'.$this_result['detailURL'].'" target="merlot">'._AT('merlot_full_record').'</a> ] ';
96 // if links db is enabled for this course allow results to be added to it.
97 if($this_result['numAssignments']){
98 echo '[ <a href="'.$this_result['assignmentsURL'].'" target="merlot">'._AT('merlot_view_assignments').'</a> ]';
101 echo '[ <a href="'.$_base_href.'mods/merlot/add_to_links.php?title='.urlencode($this_result['title']).SEP.'desc='.urlencode(substr($this_result['description'], 0,100)).SEP.'url='.urlencode($this_result['URL']).'">'._AT('merlot_add_to_link').'</a> ]';
104 echo '<br/>'._AT('merlot_author').": ".$this_result['authorName'].'<br/>';
105 echo _AT('merlot_description').": ".substr($this_result['description'], 0,200).'...<br/>';
106 echo _AT('merlot_type').": ".$this_result['itemType'].'<br/>';
107 echo _AT('merlot_creation_date').": ".date("F j, Y",strtotime($this_result['creationDate'])).'<br/>';
111 }else if($results['totalResultsCount'] < 1){
112 echo '<div style="background-color:#eeeeee;width:95%;"><h3>'. _AT('merlot_results_found', $result_count).' 0 </h3></div>';