move code up one directory
[atutor.git] / themes / default / tile_search / index.tmpl.php
1 <?php\r
2 /****************************************************************/\r
3 /* ATutor                                                                                                               */\r
4 /****************************************************************/\r
5 /* Copyright (c) 2002-2010                                      */\r
6 /* Inclusive Design Institute                                   */\r
7 /* http://atutor.ca                                                                                             */\r
8 /*                                                              */\r
9 /* This program is free software. You can redistribute it and/or*/\r
10 /* modify it under the terms of the GNU General Public License  */\r
11 /* as published by the Free Software Foundation.                                */\r
12 /****************************************************************/\r
13 // $Id: index.tmpl.php 6614 2006-09-27 19:32:29Z greg $\r
14 \r
15 ?>\r
16 <form action="<?php echo $_SERVER['PHP_SELF']; ?>#search_results" method="post" name="form">\r
17         <div class="input-form">\r
18 \r
19                 <div style="padding:1em;">\r
20                 <?php  echo _AT('tile_howto'); ?>\r
21                 </div>\r
22                 <table width="100%">\r
23                         <tr>\r
24                                 <td width="20%"><label for="words2"><?php echo _AT('keywords'); ?></label></td>\r
25                                 <td><input type="text" name="keywords" size="100" id="words2" value="<?php echo $_REQUEST['keywords']; ?>" /></td>\r
26                         </tr>\r
27 <!--\r
28                         <tr>\r
29                                 <td colspan="2">\r
30                                         <label for="results_per_page"><?php echo _AT('merlot_results_per_page'); ?></label>\r
31                                         <select name="results_per_page">\r
32                                                 <option value="5" <?php if ($_REQUEST["results_per_page"] == 5) echo 'selected="selected"' ?>>5</option>\r
33                                                 <option value="10" <?php if ($_REQUEST["results_per_page"] == 10) echo 'selected="selected"' ?>>10</option>\r
34                                                 <option value="15" <?php if ($_REQUEST["results_per_page"] == 15) echo 'selected="selected"' ?>>15</option>\r
35                                                 <option value="20" <?php if ($_REQUEST["results_per_page"] == 20) echo 'selected="selected"' ?>>20</option>\r
36                                                 <option value="25" <?php if ($_REQUEST["results_per_page"] == 25) echo 'selected="selected"' ?>>25</option>\r
37                                         </select>\r
38                                 </td>\r
39                         </tr>\r
40 //-->\r
41                 </table>\r
42                 \r
43                 <div class="row buttons">\r
44                                 <input type="submit" name="submit" value="<?php echo _AT('search'); ?>" />\r
45                 </div>\r
46         </div>\r
47 </form>\r
48 \r
49 <?php\r
50 if (isset($this->result_list))\r
51 {\r
52         if ($this->result_list['status'] == 'fail')  // failed, display error\r
53         {\r
54                 echo '  <div id="search_results"><span style="color:red">'._AT('error').': <br /></div>';\r
55                 if (is_array($this->result_list['error']))\r
56                 {\r
57                         foreach ($this->result_list['error'] as $error)\r
58                                 echo $error."<br />";\r
59                 }\r
60                 echo "</span>";\r
61         }\r
62         else  // success, display results\r
63         {\r
64                 if (is_array($this->result_list))\r
65                 {\r
66                         $num_results = $this->result_list["summary"]["numOfTotalResults"];\r
67                         $num_pages = max(ceil($num_results / $this->results_per_page), 1);\r
68                         \r
69                         echo '  <div id="search_results">';\r
70                         echo "          <h2>". _AT('results')." <small>(".$this->startRecNumber. " - " .$this->result_list["summary"]["lastResultNumber"]." out of ".$num_results.")</small></h2>";\r
71         \r
72                         print_paginator($page, $num_results, htmlspecialchars($this-> page_str), $this->results_per_page);\r
73         \r
74                         foreach ($this->result_list as $key=>$result)\r
75                         {\r
76                                 if (is_int($key))\r
77                                 {\r
78         ?>\r
79         \r
80         <dl class="browse-result">\r
81 <?php if (isset($this->instructor_role)) { ?>\r
82                 <dt class="tr_results_tools">\r
83           <a href="<?php echo AT_TILE_EXPORT_CP_URL.$result['courseID']; ?>">\r
84             <img src="<?php echo AT_BASE_HREF. 'images/download.png'?>" alt="<?php echo _AT('download_content_package'); ?>" title="<?php echo _AT("download_content_package").' '.$result['title']; ?>" border="0">\r
85           </a>&nbsp;\r
86           <a href="mods/_standard/tile_search/import.php?tile_course_id=<?php echo $result['courseID']; ?>&title=<?php echo urlencode($result['title']); ?>">\r
87             <img src="<?php echo AT_BASE_HREF. 'images/archive.gif'?>" alt="<?php echo _AT('import'); ?>" title="<?php echo _AT("import").' '.$result['title']; ?>" border="0">\r
88           </a>\r
89         </dt>\r
90 <?php }?>\r
91                 <dd>\r
92                   <h3 style="margin-left:-2.5em;">\r
93                     <a href="<?php echo AT_TILE_VIEW_COURSE_URL.$result['courseID']; ?>" target="_new" ><?php echo htmlspecialchars($result['title']); ?></a>\r
94                   </h3>\r
95                 </dd> \r
96                 <dt><?php echo _AT("author"); ?></dt>\r
97                 <dd><?php if ($result['authorName']=='') echo _AT('unknown'); else echo htmlspecialchars($result['authorName']); ?></dd>\r
98 \r
99                 <dt><?php echo _AT("creation_date"); ?></dt>\r
100                 <dd><?php echo $result['creationDate']; ?></dd>\r
101         \r
102                 <dt><?php echo _AT("description"); ?></dt>\r
103                 <dd><?php if ($result['description']=='') echo _AT('na'); else if (strlen($result['description']) > 120) echo substr(htmlspecialchars($result['description']), 0, 120). "..."; else echo htmlspecialchars($result['description']); ?></dd>\r
104 \r
105                 <dt><?php echo _AT("creative_commons"); ?></dt>\r
106                 <dd><?php if ($result['creativeCommons'] == "true") echo _AT('yes'); else echo _AT('no'); ?></dd>\r
107 \r
108         </dl>\r
109         <br />\r
110         <?php\r
111                                 }\r
112                         }\r
113                         echo '</div>';\r
114                 }\r
115         }\r
116 }\r
117 \r
118 ?>\r