2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2010 */
6 /* Inclusive Design Institute */
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 /****************************************************************/
15 define('AT_INCLUDE_PATH', '../../../include/');
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
17 require_once('classes/ResultParser.class.php');
19 //$default_results_per_page = 25;
20 $default_results_per_page = 20;
22 $browse = intval($browse);
24 if (!isset($_REQUEST["results_per_page"])) $_REQUEST["results_per_page"] = $default_results_per_page;
26 if ($_REQUEST['submit'] || isset($_REQUEST['p']))
28 $keywords = trim($_REQUEST['keywords']);
29 //$title = trim($_REQUEST['title']);
30 //$description = trim($_REQUEST['description']);
31 //$author = trim($_REQUEST['author']);
32 $results_per_page = intval(trim($_REQUEST['results_per_page']));
35 // || $title <> "" || $description <> "" || $author <> "" || $_REQUEST["creativeCommons"] == "true"
37 $page = intval($_REQUEST['p']);
42 if ($results_per_page > $default_results_per_page || $results_per_page == 0)
43 $results_per_page = $default_results_per_page;
45 $startRecNumber = $results_per_page*($page - 1);
47 $page_str = "results_per_page=".$results_per_page;
48 $url_search = "&maxResults=".$results_per_page."&start=".$results_per_page*($page - 1);
52 $page_str .= SEP."keywords=".urlencode($keywords);
53 $url_search .= "&keywords=".urlencode($keywords);
57 // $page_str .= SEP."title=".urlencode($title);
58 // $url_search .= "&title=".urlencode($title);
60 // if ($description <> "")
62 // $page_str .= SEP. "description=".urlencode($description);
63 // $url_search .= "&description=".urlencode($description);
67 // $page_str .= SEP. "author=".urlencode($author);
68 // $url_search .= "&author=".urlencode($author);
71 // if (isset($_REQUEST["search_type"]))
72 // $page_str .= SEP."search_type=".$_REQUEST["search_type"];
74 // if ($_REQUEST["search_type"] == 0) $url_search .= "&allKeyWords=true";
75 // if ($_REQUEST["search_type"] == 1) $url_search .= "&anyKeyWords=true";
76 // if ($_REQUEST["search_type"] == 2) $url_search .= "&exactPhraseKeyWords=true";
77 // if ($_REQUEST["creativeCommons"] == "true")
79 // $page_str .= SEP. "creativeCommons=true";
80 // $url_search .= "&creativeCommons=true";
83 $url = AT_TILE_SEARCH_URL."?id=".$_config['transformable_web_service_id'].$url_search;
85 $xml_results = file_get_contents($url);
89 $infos = array('CANNOT_CONNECT_SERVER', AT_TILE_SEARCH_URL);
90 $msg->addError($infos);
94 $resultParser = new ResultParser();
95 $resultParser->parse($xml_results);
96 $result_list = $resultParser->getParsedArray();
98 $savant->assign('result_list', $result_list);
99 $savant->assign('startRecNumber', $startRecNumber+1);
100 $savant->assign('results_per_page', $results_per_page);
101 $savant->assign('page_str', $page_str);
102 $savant->assign('instructor_role', 1);
107 global $_custom_css, $onload;
108 $_custom_css = $_base_path . 'mods/_standard/tile_search/module.css'; // use a custom stylesheet
109 $onload = "document.form.keywords.focus();";
111 require (AT_INCLUDE_PATH.'header.inc.php');
113 $savant->display('tile_search/index.tmpl.php');
115 require(AT_INCLUDE_PATH.'footer.inc.php');