2 /************************************************************************/
\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
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
15 define('AT_INCLUDE_PATH', '../../include/');
\r
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
\r
17 authenticate(AT_PRIV_CONTENT);
\r
19 require(AT_INCLUDE_PATH.'header.inc.php');
\r
22 $orders = array('asc' => 'desc', 'desc' => 'asc');
\r
23 $cols = array('total_hits' => 1, 'unique_hits' => 1, 'average_duration' => 1, 'total_duration' => 1);
\r
25 if (isset($_GET['asc'])) {
\r
27 $col = isset($cols[$_GET['asc']]) ? $_GET['asc'] : 'total_hits';
\r
28 } else if (isset($_GET['desc'])) {
\r
30 $col = isset($cols[$_GET['desc']]) ? $_GET['desc'] : 'total_hits';
\r
34 $col = 'total_hits';
\r
37 $page_string = SEP.$order.'='.$col;
\r
39 if (!isset($_GET['cnt'])) {
\r
40 $sql = "SELECT COUNT(DISTINCT content_id) AS cnt FROM ".TABLE_PREFIX."member_track WHERE course_id=$_SESSION[course_id]";
\r
41 $result = mysql_query($sql, $db);
\r
42 $row = mysql_fetch_assoc($result);
\r
45 $cnt = intval($_GET['cnt']);
\r
48 $num_results = $cnt;
\r
49 $results_per_page = 15;
\r
50 $num_pages = max(ceil($num_results / $results_per_page), 1);
\r
51 $page = intval($_GET['p']);
\r
55 $count = (($page-1) * $results_per_page) + 1;
\r
57 $offset = ($page-1)*$results_per_page;
\r
59 /*create a table that lists all the content pages and the number of time they were viewed*/
\r
60 $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 FROM ".TABLE_PREFIX."member_track WHERE course_id=$_SESSION[course_id] GROUP BY content_id ORDER BY $col $order LIMIT $offset, $results_per_page";
\r
61 $result = mysql_query($sql, $db);
\r
64 <div class="paging">
\r
66 <?php for ($i=1; $i<=$num_pages; $i++): ?>
\r
68 <?php if ($i == $page) : ?>
\r
69 <a class="current" href="<?php echo $_SERVER['PHP_SELF']; ?>?p=<?php echo $i.$page_string; ?>"><em><?php echo $i; ?></em></a>
\r
71 <a href="<?php echo $_SERVER['PHP_SELF']; ?>?p=<?php echo $i.$page_string; ?>"><?php echo $i; ?></a>
\r
78 <table class="data" rules="cols" summary="">
\r
80 <?php if ($col == 'total_hits'): ?>
\r
82 <col class="sort" />
\r
84 <?php elseif($col == 'unique_hits'): ?>
\r
86 <col class="sort" />
\r
88 <?php elseif($col == 'average_duration'): ?>
\r
90 <col class="sort" />
\r
92 <?php elseif($col == 'total_duration'): ?>
\r
94 <col class="sort" />
\r
100 <th scope="col"><?php echo _AT('page'); ?></th>
\r
101 <th scope="col"><a href="tools/tracker/index.php?<?php echo $orders[$order]; ?>=total_hits"><?php echo _AT('visits'); ?></a></th>
\r
102 <th scope="col"><a href="tools/tracker/index.php?<?php echo $orders[$order]; ?>=unique_hits"><?php echo _AT('unique_visits'); ?></a></th>
\r
103 <th scope="col"><a href="tools/tracker/index.php?<?php echo $orders[$order]; ?>=average_duration"><?php echo _AT('avg_duration'); ?></a></th>
\r
104 <th scope="col"><a href="tools/tracker/index.php?<?php echo $orders[$order]; ?>=total_duration"><?php echo _AT('duration'); ?></a></th>
\r
105 <th scope="col"><?php echo _AT('details'); ?></th>
\r
109 <?php if ($row = mysql_fetch_assoc($result)): ?>
\r
111 <tr onmousedown="document.location='<?php echo AT_BASE_HREF; ?>tools/tracker/page_student_stats.php?content_id=<?php echo $row['content_id']; ?>'" title="<?php echo _AT('details'); ?>">
\r
112 <td><?php echo $contentManager->_menu_info[$row['content_id']]['title']; ?></td>
\r
113 <td><?php echo $row['total_hits']; ?></td>
\r
114 <td><?php echo $row['unique_hits']; ?></td>
\r
115 <td><?php echo $row['average_duration']; ?></td>
\r
116 <td><?php echo $row['total_duration']; ?></td>
\r
117 <td><a href="tools/tracker/page_student_stats.php?content_id=<?php echo $row['content_id']; ?>"><?php echo _AT('details'); ?></a></td>
\r
119 <?php } while ($row = mysql_fetch_assoc($result)); ?>
\r
122 <td colspan="6"><?php echo _AT('none_found'); ?></td>
\r
128 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>