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 = 20;
21 if (!isset($_REQUEST["results_per_page"])) $_REQUEST["results_per_page"] = $default_results_per_page;
23 if ($_REQUEST['submit'] || isset($_REQUEST['p']))
25 $keywords = trim($_REQUEST['keywords']);
26 //$title = trim($_REQUEST['title']);
27 //$description = trim($_REQUEST['description']);
28 //$author = trim($_REQUEST['author']);
29 $results_per_page = intval(trim($_REQUEST['results_per_page']));
32 // || $title <> "" || $description <> "" || $author <> "" || $_REQUEST["creativeCommons"] == "true"
34 $page = intval($_REQUEST['p']);
39 if ($results_per_page > $default_results_per_page || $results_per_page == 0)
40 $results_per_page = $default_results_per_page;
42 $startRecNumber = $results_per_page*($page - 1);
44 $page_str = "results_per_page=".$results_per_page;
45 $url_search = "&maxResults=".$results_per_page."&start=".$results_per_page*($page - 1);
49 $page_str .= SEP."keywords=".urlencode($keywords);
50 $url_search .= "&keywords=".urlencode($keywords);
54 // $page_str .= SEP."title=".urlencode($title);
55 // $url_search .= "&title=".urlencode($title);
57 // if ($description <> "")
59 // $page_str .= SEP. "description=".urlencode($description);
60 // $url_search .= "&description=".urlencode($description);
64 // $page_str .= SEP. "author=".urlencode($author);
65 // $url_search .= "&author=".urlencode($author);
68 // if (isset($_REQUEST["search_type"]))
69 // $page_str .= SEP."search_type=".$_REQUEST["search_type"];
71 // if ($_REQUEST["search_type"] == 0) $url_search .= "&allKeyWords=true";
72 // if ($_REQUEST["search_type"] == 1) $url_search .= "&anyKeyWords=true";
73 // if ($_REQUEST["search_type"] == 2) $url_search .= "&exactPhraseKeyWords=true";
74 // if ($_REQUEST["creativeCommons"] == "true")
76 // $page_str .= SEP. "creativeCommons=true";
77 // $url_search .= "&creativeCommons=true";
80 $url = AT_TILE_SEARCH_URL."?id=".$_config['transformable_web_service_id'].$url_search;
82 $xml_results = file_get_contents($url);
86 $infos = array('CANNOT_CONNECT_SERVER', AT_TILE_SEARCH_URL);
87 $msg->addError($infos);
91 $resultParser = new ResultParser();
92 $resultParser->parse($xml_results);
93 $result_list = $resultParser->getParsedArray();
95 $savant->assign('result_list', $result_list);
96 $savant->assign('startRecNumber', $startRecNumber+1);
97 $savant->assign('results_per_page', $results_per_page);
98 $savant->assign('page_str', $page_str);
103 global $_custom_css, $onload;
104 $_custom_css = $_base_path . 'mods/_standard/tile_search/module.css'; // use a custom stylesheet
105 $onload = "document.form.keywords.focus();";
107 require (AT_INCLUDE_PATH.'header.inc.php');
109 $savant->display('tile_search/index.tmpl.php');
111 require(AT_INCLUDE_PATH.'footer.inc.php');