tagging as ATutor 1.5.4-release
[atutor.git] / tools / tracker / page_student_stats.php
1 <?php\r
2 /************************************************************************/\r
3 /* ATutor                                                                                                                               */\r
4 /************************************************************************/\r
5 /* Copyright (c) 2002-2004 by Greg Gay, Joel Kronenberg & Heidi Hazelton*/\r
6 /* Adaptive Technology Resource Centre / University of Toronto                  */\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 \r
18 authenticate(AT_PRIV_CONTENT);\r
19 \r
20 /* Getting content id from page that reffered */\r
21 $content_id = intval($_GET['content_id']);\r
22 \r
23 $_pages['tools/tracker/page_student_stats.php']['title'] = $contentManager->_menu_info[$content_id]['title'];\r
24 $_pages['tools/tracker/page_student_stats.php']['parent'] = 'tools/tracker/index.php';\r
25 \r
26 require(AT_INCLUDE_PATH.'header.inc.php');\r
27 \r
28 $sql = "SELECT counter, content_id, member_id, SEC_TO_TIME(duration) AS total, SEC_TO_TIME(duration/counter) AS average FROM ".TABLE_PREFIX."member_track WHERE course_id=$_SESSION[course_id] AND content_id=$content_id ORDER BY total DESC";\r
29 $result = mysql_query($sql, $db);\r
30 \r
31 ?>\r
32 <table class="data" rules="cols" summary="">\r
33 <thead>\r
34 <tr>\r
35         <th scope="col"><?php echo _AT('login_name'); ?></th>\r
36         <th scope="col"><?php echo _AT('visits'); ?></th>\r
37         <th scope="col"><?php echo _AT('avg_duration'); ?></th>\r
38         <th scope="col"><?php echo _AT('duration'); ?></th>\r
39 </tr>\r
40 </thead>\r
41 <tbody>\r
42 <?php if ($row = mysql_fetch_assoc($result)) : ?>\r
43         <?php do { ?>\r
44         <tr onmousedown="document.location='<?php echo AT_BASE_HREF; ?>tools/tracker/student_usage.php?id=<?php echo $row['member_id']; ?>'" title="<?php echo _AT('member_stats'); ?>">\r
45                 <td><a href="<?php echo AT_BASE_HREF; ?>tools/tracker/student_usage.php?id=<?php echo $row['member_id']; ?>"><?php echo get_display_name($row['member_id']); ?></a></td>\r
46                 <td><?php echo $row['counter']; ?></td>\r
47                 <td><?php echo $row['average']; ?></td>\r
48                 <td><?php echo $row['total']; ?></td>\r
49         </tr>\r
50         <?php } while ($row = mysql_fetch_assoc($result)); ?>\r
51 <?php else: ?>\r
52         <tr>\r
53                 <td colspan="4"><?php echo _AT('none_found'); ?></td>\r
54         </tr>\r
55 <?php endif; ?>\r
56 </tbody>\r
57 </table>\r
58 \r
59 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>