2ea4d527caaa2a95e30e2fca7f50b21446bf1742
[atutor.git] / mods / merlot / index.php
1 <?php
2 /****************************************************************/
3 /* ATutor                                                                                                               */
4 /****************************************************************/
5 /* Copyright (c) 2002-2006 by Greg Gay & Joel Kronenberg        */
6 /* Adaptive Technology Resource Centre / University of Toronto  */
7 /* http://atutor.ca                                                                                             */
8 /*                                                              */
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 $
14
15 define('AT_INCLUDE_PATH', '../../include/');
16 require (AT_INCLUDE_PATH.'vitals.inc.php');
17 $_custom_css = $_base_path . 'mods/merlot/module.css'; // use a custom stylesheet
18 //$default_results_per_page = 25;
19 $default_results_per_page = 10;
20
21 $advanced = intval($advanced);
22 $browse =  intval($browse);
23
24 if (!isset($_REQUEST["search_type"])) $_REQUEST["search_type"] = 0;
25 if (!isset($_REQUEST["results_per_page"])) $_REQUEST["results_per_page"] = $default_results_per_page;
26
27 // check if merlot is configured
28 if(!isset($_config['merlot_key']) || !isset($_config['merlot_location']))
29 {
30         $msg->addError('MERLOT_NOT_CONFIG');
31
32         require (AT_INCLUDE_PATH.'header.inc.php');
33         $msg->printAll();
34         require(AT_INCLUDE_PATH.'footer.inc.php');
35         exit;
36 }
37 else
38 {
39 // If Merlot is configured, display the simple search form, and results
40 require (AT_INCLUDE_PATH.'header.inc.php');
41 ?>
42 <script type="text/javascript" language="JavaScript" src="<?php echo $_base_path; ?>mods/merlot/merlot.js"></script>
43
44 <?php
45
46 if($_REQUEST['advanced']){
47                 require (AT_INCLUDE_PATH.'../mods/merlot/merlot_adv.php');
48
49 }else{?>
50         <form action="<?php echo $_SERVER['PHP_SELF']; ?>#search_results" method="post" name="form">
51                 <div class="input-form">
52
53                         <div style="padding:1em;">
54                         <a href="http://www.merlot.org">
55                                 <img src="<?php echo $_base_path; ?>mods/merlot/merlotlogo.gif" height="53" width="187" style="float:right;text-align:right;border:0;" alt="<?php  echo _AT('merlot'); ?>" />
56                         </a>
57                         <?php  echo _AT('merlot_howto'); ?>
58                         </div>
59                         <table width="100%">
60                                 <tr>
61                                         <td colspan="2">
62                                                 <input type="radio" name="search_type" value="0" id="allKeyWords" <?php if ($_REQUEST["search_type"] == 0) echo 'checked="checked"'; ?> /><label for="allKeyWords">All Words</label>
63                                                 <input type="radio" name="search_type" value="1" id="anyKeyWords" <?php if ($_REQUEST["search_type"] == 1) echo 'checked="checked"'; ?> /><label for="anyKeyWords">Any Word</label>
64                                                 <input type="radio" name="search_type" value="2"  id="exactPhraseKeyWords" <?php if ($_REQUEST["search_type"] == 2) echo 'checked="checked"'; ?> /><label for="exactPhraseKeyWords">Exact Phrase</label>
65                                         </td>
66                                 </tr>
67                                         
68                                 <tr>
69                                         <td width="20%"><label for="words2"><?php echo _AT('keywords'); ?></label></td>
70                                         <td><input type="text" name="keywords" size="100" id="words2" value="<?php echo $_REQUEST['keywords']; ?>" /></td>
71                                 </tr>
72
73                                 <tr>
74                                         <td><label for="title"><?php echo _AT('title'); ?></label></td>
75                                         <td><input type="text" name="title" size="100" id="title" value="<?php echo $_REQUEST['title']; ?>" /></td>
76                                 </tr>
77
78                                 <tr>
79                                         <td><label for="description"><?php echo _AT('description'); ?></label></td>
80                                         <td><input type="text" name="description" size="100" id="description" value="<?php echo $_REQUEST['description']; ?>" /></td>
81                                 </tr>
82
83                                 <tr>
84                                         <td><label for="author"><?php echo _AT('author'); ?></label></td>
85                                         <td><input type="text" name="author" size="100" id="author" value="<?php echo $_REQUEST['author']; ?>" /></td>
86                                 </tr>
87
88                                 <tr>
89                                         <td colspan="2">
90                                                 <input type="checkbox" name="creativeCommons" value="true" id="creativeCommons" <?php if ($_REQUEST["creativeCommons"] == "true") echo 'checked="checked"'; ?> /><label for="creativeCommons"><?php echo _AT("merlot_creative_commons"); ?></label>
91                                         </td>
92                                 </tr>
93 <!--
94                                 <tr>
95                                         <td colspan="2">
96                                                 <label for="results_per_page"><?php echo _AT('merlot_results_per_page'); ?></label>
97                                                 <select name="results_per_page">
98                                                         <option value="5" <?php if ($_REQUEST["results_per_page"] == 5) echo 'selected="selected"' ?>>5</option>
99                                                         <option value="10" <?php if ($_REQUEST["results_per_page"] == 10) echo 'selected="selected"' ?>>10</option>
100                                                         <option value="15" <?php if ($_REQUEST["results_per_page"] == 15) echo 'selected="selected"' ?>>15</option>
101                                                         <option value="20" <?php if ($_REQUEST["results_per_page"] == 20) echo 'selected="selected"' ?>>20</option>
102                                                         <option value="25" <?php if ($_REQUEST["results_per_page"] == 25) echo 'selected="selected"' ?>>25</option>
103                                                 </select>
104                                         </td>
105                                 </tr>
106 //-->
107                         </table>
108                         
109                         <div class="row buttons">
110                                         <input type="submit" name="submit" value="<?php echo _AT('merlot_search'); ?>" />
111                         </div>
112                 </div>
113         </form>
114 <?php } ?>
115
116 <div align="center">
117         <small>
118                 <a href="http://about.merlot.org/wsrs.html"><?php echo _AT('merlot_web_service_agreement'); ?></a>&nbsp;
119                 <a href="http://taste.merlot.org/acceptableuserpolicy.html"><?php echo _AT('merlot_user_agreement'); ?></a>
120         </small>
121 </div>
122
123 <br /> 
124
125 <?php
126         if ($_REQUEST['submit'] || isset($_REQUEST['p']))
127         {
128                 require(AT_INCLUDE_PATH.'../mods/merlot/merlot_rest.php');
129         }
130
131 }
132
133 require(AT_INCLUDE_PATH.'footer.inc.php');
134 ?>