Moved scripts in "docs" one level up into root folder. In addition, removed "docs...
[atutor.git] / mods / _standard / tracker / tools / student_usage.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: student_usage.php 10142 2010-08-17 19:17:26Z hwong $\r
14 \r
15 define('AT_INCLUDE_PATH', '../../../../include/');\r
16 require(AT_INCLUDE_PATH.'vitals.inc.php');\r
17 authenticate(AT_PRIV_CONTENT);\r
18 \r
19 require(AT_INCLUDE_PATH.'header.inc.php');\r
20 \r
21 $sql    = "SELECT M.member_id, M.login, CONCAT(M.first_name, ' ', M.second_name, ' ', M.last_name) AS full_name\r
22                         FROM ".TABLE_PREFIX."members M, ".TABLE_PREFIX."course_enrollment C \r
23                         WHERE M.member_id=C.member_id AND C.course_id=$_SESSION[course_id]";\r
24 $result = mysql_query($sql, $db);\r
25 \r
26 $_GET['id'] = intval($_GET['id']);\r
27 \r
28 ?>\r
29 <form name="form" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get">\r
30 <div class="input-form">\r
31         <div class="row">\r
32                 <label for="id"><?php echo _AT('select_member'); ?></label><br />\r
33                 <select name="id" id="id">\r
34                         <?php\r
35                                 while ($row = mysql_fetch_assoc($result)) {\r
36                                         $sender = get_display_name($row['member_id']);\r
37                                         echo '<option value="'.$row['member_id'].'"';\r
38                                         if ($row['member_id'] == $_GET['id']) {\r
39                                                 echo ' selected="selected"';\r
40                                         }\r
41                                         echo '>'.$sender.'</option>';\r
42                                 }\r
43                         ?>\r
44                 </select>\r
45         </div>\r
46 \r
47         <div class="row buttons">\r
48                 <input type="submit" name="submit" value="<?php echo _AT('view'); ?>" />\r
49         </div>\r
50 </div>\r
51 </form>\r
52 \r
53 <?php if ($_GET['id']) : ?>\r
54 <?php\r
55         $sql = "SELECT counter, content_id, SEC_TO_TIME(duration) AS total FROM ".TABLE_PREFIX."member_track WHERE member_id=$_GET[id] AND course_id=$_SESSION[course_id] ORDER BY counter DESC";\r
56         $result = mysql_query($sql, $db);\r
57 ?>\r
58         <table class="data static" rules="cols" summary="">\r
59         <thead>\r
60         <tr>\r
61                 <th scope="col"><?php echo _AT('page'); ?></th>\r
62                 <th scope="col"><?php echo _AT('visits'); ?></th>\r
63                 <th scope="col"><?php echo _AT('duration'); ?></th>\r
64         </tr>\r
65         </thead>\r
66         <tbody>\r
67         <?php if ($row = mysql_fetch_assoc($result)): ?>\r
68                 <?php do { ?>\r
69                         <tr>\r
70                                 <td><?php echo $contentManager->_menu_info[$row['content_id']]['title']; ?></td>\r
71                                 <td><?php echo $row['counter']; ?></td>\r
72                                 <td><?php echo $row['total']; ?></td>\r
73                         </tr>\r
74                 <?php } while ($row = mysql_fetch_assoc($result)); ?>\r
75         <?php else: ?>\r
76                 <tr>\r
77                         <td colspan="3"><?php echo _AT('none_found'); ?></td>\r
78                 </tr>\r
79         <?php endif; ?>\r
80 </tbody>\r
81 </table>\r
82 <?php endif; ?>\r
83 \r
84 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>