remove old readme
[atutor.git] / docs / mods / _standard / tracker / my_stats.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$\r
14 \r
15 define('AT_INCLUDE_PATH', '../../../include/');\r
16 require(AT_INCLUDE_PATH.'vitals.inc.php');\r
17 require(AT_INCLUDE_PATH.'header.inc.php');\r
18 ?>\r
19 <table class="data static" rules="cols" summary="">\r
20 <thead>\r
21 <tr>\r
22         <th scope="col"><?php echo _AT('page'); ?></th>\r
23         <th scope="col"><?php echo _AT('visits'); ?></th>\r
24         <th scope="col"><?php echo _AT('duration'); ?></th>\r
25         <th scope="col"><?php echo _AT('last_accessed'); ?></th>\r
26 </tr>\r
27 </thead>\r
28 <tbody>\r
29 <?php\r
30         $sql = "SELECT content_id, COUNT(*) AS unique_hits, SUM(counter) AS total_hits, SEC_TO_TIME(SUM(duration)/SUM(counter)) AS average_duration, SEC_TO_TIME(SUM(duration)) AS total_duration, last_accessed FROM ".TABLE_PREFIX."member_track WHERE course_id=$_SESSION[course_id] AND member_id=$_SESSION[member_id] GROUP BY content_id ORDER BY total_hits DESC";\r
31 \r
32         $result = mysql_query($sql, $db);\r
33 \r
34         if (mysql_num_rows($result) > 0) {\r
35                 while ($row = mysql_fetch_assoc($result)) {\r
36                         if ($row['total'] == '') {\r
37                                 $row['total'] = _AT('na');\r
38                         }\r
39 \r
40                         echo '<tr>';\r
41                         echo '<td><a href='.AT_BASE_HREF.url_rewrite('content.php?cid='.$row['content_id']). '>' . $contentManager->_menu_info[$row['content_id']]['title'] . '</a></td>';\r
42                         echo '<td>' . $row['total_hits'] . '</td>';\r
43                         echo '<td>' . $row['total_duration'] . '</td>';\r
44                         if ($row['last_accessed'] == '') {\r
45                                 echo '<td>' . _AT('na') . '</td>';\r
46                         } else {\r
47                                 echo '<td>' . AT_date(_AT('forum_date_format'), $row['last_accessed'], AT_DATE_MYSQL_DATETIME) . '</td>';\r
48                         }\r
49                         echo '</tr>';\r
50                 } //end while\r
51 \r
52                 echo '</tbody>';\r
53 \r
54         } else {\r
55                 echo '<tr><td colspan="4">' . _AT('none_found') . '</td></tr>';\r
56                 echo '</tbody>';\r
57         }\r
58         ?>\r
59 </tbody>\r
60 </table>\r
61 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>