remove old readme
[atutor.git] / docs / mods / _standard / reading_list / index.php
1 <?php\r
2 /****************************************************************/\r
3 /* ATutor                                                                                                               */\r
4 /****************************************************************/\r
5 /* Copyright (c) 2002-2008                                      */\r
6 /* Written by Greg Gay & Joel Kronenberg & Chris Ridpath        */\r
7 /* Inclusive Design Institute                                   */\r
8 /* http://atutor.ca                                                                                             */\r
9 /*                                                              */\r
10 /* This program is free software. You can redistribute it and/or*/\r
11 /* modify it under the terms of the GNU General Public License  */\r
12 /* as published by the Free Software Foundation.                                */\r
13 /****************************************************************/\r
14 // $Id$\r
15 define('AT_INCLUDE_PATH', '../../../include/');\r
16 require (AT_INCLUDE_PATH.'vitals.inc.php');\r
17 \r
18 require (AT_INCLUDE_PATH.'header.inc.php');\r
19 \r
20 $sql = "SELECT * FROM ".TABLE_PREFIX."reading_list WHERE course_id=$_SESSION[course_id] ORDER BY date_start";\r
21 $result = mysql_query($sql, $db);\r
22 ?>\r
23 \r
24 <table class="data" style="width: 95%;">\r
25 <thead>\r
26 <tr>\r
27         <th><?php echo _AT('rl_start');    ?></th>\r
28         <th><?php echo _AT('rl_end');      ?></th>\r
29         <th><?php echo _AT('title');       ?></th>\r
30         <th><?php echo _AT('required'); ?></th>\r
31         <th><?php echo _AT('comment');  ?></th>\r
32 </tr>\r
33 </thead>\r
34 <tbody>\r
35 <?php if ($row = mysql_fetch_assoc($result)): ?>\r
36 \r
37         <?php do { ?>\r
38                         <?php // get the external resource using the resource ID from the reading\r
39                         $id = $row['resource_id'];\r
40                         $row['date_start'] = htmlentities_utf8($row['date_start']);\r
41                         $row['date_end'] = htmlentities_utf8($row['date_end']);\r
42                         $row['comment'] = AT_print($row['comment'], 'reading_list.comment');\r
43 \r
44                         $sql = "SELECT title, type, url FROM ".TABLE_PREFIX."external_resources WHERE course_id=$_SESSION[course_id] AND resource_id=$id";\r
45                         $resource_result = mysql_query($sql, $db);\r
46                         if ($resource_row = mysql_fetch_assoc($resource_result)){ \r
47                         ?>\r
48                         <tr onclick="document.location='mods/_standard/reading_list/display_resource.php?id=<?php echo $id ?>'">\r
49                                 <td>\r
50                                 <?php  if ($row['date_start'] == '0000-00-00'){\r
51                                         echo _AT ('none');\r
52                                 } else {\r
53                                         echo AT_Date(_AT('rl_date_format'), $row['date_start'], AT_DATE_MYSQL_DATETIME);\r
54                                 }?>\r
55                                 </td>\r
56 \r
57                                 <td>\r
58                                 <?php  if ($row['date_end'] == '0000-00-00'){\r
59                                         echo _AT ('none');\r
60                                 } else {\r
61                                         echo AT_Date(_AT('rl_date_format'), $row['date_end'], AT_DATE_MYSQL_DATETIME);\r
62                                 }?>\r
63                                 </td>\r
64 \r
65                                 <td><a href="<?php echo url_rewrite('mods/_standard/reading_list/display_resource.php?id='.$id); ?>" title="<?php echo _AT('rl_view_resource_details')?>" ><?php echo AT_print($resource_row['title'], 'reading_list.title'); ?></a>            \r
66                                 </td>\r
67                                 <td><?php echo _AT ($row['required']); ?></td>\r
68                                 <td><?php echo $row['comment']; ?></td>\r
69                                 </tr>\r
70 \r
71                         <?php } ?>\r
72         <?php } while($row = mysql_fetch_assoc($result)); ?>\r
73 <?php else: ?>\r
74         <tr>\r
75                 <td colspan="3"><strong><?php echo _AT('none_found'); ?></strong></td>\r
76         </tr>\r
77 <?php endif; ?>\r
78 </tbody>\r
79 </table>\r
80 \r
81 <?php require (AT_INCLUDE_PATH.'footer.inc.php'); ?>