2 /************************************************************************/
\r
4 /************************************************************************/
\r
5 /* Copyright (c) 2002-2010 */
\r
6 /* Inclusive Design Institute */
\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="toolcontainer">
\r
65 <div class="paging">
\r
67 <?php for ($i=1; $i<=$num_pages; $i++): ?>
\r
69 <?php if ($i == $page) : ?>
\r
70 <a class="current" href="<?php echo $_SERVER['PHP_SELF']; ?>?p=<?php echo $i.$page_string; ?>"><strong><?php echo $i; ?></strong></a>
\r
72 <a href="<?php echo $_SERVER['PHP_SELF']; ?>?p=<?php echo $i.$page_string; ?>"><?php echo $i; ?></a>
\r
79 <table class="data" rules="cols" summary="">
\r
81 <?php if ($col == 'total_hits'): ?>
\r
83 <col class="sort" />
\r
85 <?php elseif($col == 'unique_hits'): ?>
\r
87 <col class="sort" />
\r
89 <?php elseif($col == 'average_duration'): ?>
\r
91 <col class="sort" />
\r
93 <?php elseif($col == 'total_duration'): ?>
\r
95 <col class="sort" />
\r
101 <th scope="col"><?php echo _AT('page'); ?></th>
\r
102 <th scope="col"><a href="mods/_standard/tracker/tools/index.php?<?php echo $orders[$order]; ?>=total_hits"><?php echo _AT('visits'); ?></a></th>
\r
103 <th scope="col"><a href="mods/_standard/tracker/tools/index.php?<?php echo $orders[$order]; ?>=unique_hits"><?php echo _AT('unique_visits'); ?></a></th>
\r
104 <th scope="col"><a href="mods/_standard/tracker/tools/index.php?<?php echo $orders[$order]; ?>=average_duration"><?php echo _AT('avg_duration'); ?></a></th>
\r
105 <th scope="col"><a href="mods/_standard/tracker/tools/index.php?<?php echo $orders[$order]; ?>=total_duration"><?php echo _AT('duration'); ?></a></th>
\r
106 <th scope="col"><?php echo _AT('details'); ?></th>
\r
110 <?php if ($row = mysql_fetch_assoc($result)): ?>
\r
112 <tr onmousedown="document.location='<?php echo AT_BASE_HREF; ?>mods/_standard/tracker/tools/page_student_stats.php?content_id=<?php echo $row['content_id']; ?>'" title="<?php echo _AT('details'); ?>">
\r
113 <td><?php echo $contentManager->_menu_info[$row['content_id']]['title']; ?></td>
\r
114 <td><?php echo $row['total_hits']; ?></td>
\r
115 <td><?php echo $row['unique_hits']; ?></td>
\r
116 <td><?php echo $row['average_duration']; ?></td>
\r
117 <td><?php echo $row['total_duration']; ?></td>
\r
118 <td><a href="mods/_standard/tracker/tools/page_student_stats.php?content_id=<?php echo $row['content_id']; ?>"><?php echo _AT('details'); ?></a></td>
\r
120 <?php } while ($row = mysql_fetch_assoc($result)); ?>
\r
123 <td colspan="6"><?php echo _AT('none_found'); ?></td>
\r
129 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>