/mods/_standard/tracker/lib/tracker_stats2.inc.php

https://github.com/harriswong/ATutor · PHP · 87 lines · 56 code · 16 blank · 15 comment · 6 complexity · 95b99fececdd12cc18df75ad5f9451df MD5 · raw file

  1. <?php
  2. /****************************************************************/
  3. /* ATutor */
  4. /****************************************************************/
  5. /* Copyright (c) 2002-2010 */
  6. /* Inclusive Design Institute */
  7. /* http://atutor.ca */
  8. /* */
  9. /* This program is free software. You can redistribute it and/or*/
  10. /* modify it under the terms of the GNU General Public License */
  11. /* as published by the Free Software Foundation. */
  12. /****************************************************************/
  13. // $Id$
  14. // NOTE: this script should not be altered. its use will soon be deprecated.
  15. if (!defined('AT_INCLUDE_PATH')) { exit; }
  16. //how many content pages are in this course
  17. $sql25 = "SELECT content_id from ".TABLE_PREFIX."content where course_id = $_SESSION[course_id]";
  18. $result29 = mysql_query($sql25, $db);
  19. $num_rows_total = @mysql_num_rows($result29);
  20. //get the title for each content_id
  21. $sql7 = "select
  22. C.title,
  23. C.content_id
  24. from
  25. ".TABLE_PREFIX."content C
  26. where
  27. course_id='$_SESSION[course_id]'";
  28. if(!$result7 = mysql_query($sql7, $db)){
  29. echo "query failed";
  30. require(AT_INCLUDE_PATH.'footer.inc.php');
  31. exit;
  32. }
  33. $title_refs = array();
  34. while ($row= mysql_fetch_array($result7)) {
  35. $title_refs[$row['content_id']] = $row['title'];
  36. }
  37. $sql2 = "SELECT * FROM ".TABLE_PREFIX."g_click_data WHERE member_id = $_GET[member_id] AND course_id = $_SESSION[course_id]";
  38. $result28 = mysql_query($sql2, $db);
  39. echo '<br /><h3>'._AT('tracker_summary_read', $this_user[$_GET['member_id']]).'</h3>';
  40. echo '<table class="data static" rules="cols" summary="">';
  41. echo '<thead>';
  42. echo '<tr>';
  43. echo '<th>' . _AT('page') . '</th>';
  44. echo '<th>' . _AT('visits') . '</th>';
  45. echo '<th>' . _AT('duration_sec') . '</th>';
  46. echo '</tr>';
  47. echo '</thead>';
  48. while ($row2= @mysql_fetch_assoc($result28)){
  49. $duration[$row2['to_cid']] = ($duration[$row2['to_cid']] + $row2['duration']);
  50. $visits[$row2['to_cid']] = ($visits[$row2['to_cid']] +1);
  51. }
  52. $sql= "SELECT DISTINCT to_cid FROM ".TABLE_PREFIX."g_click_data WHERE member_id = $_GET[member_id] AND course_id = $_SESSION[course_id]";
  53. $result27 = mysql_query($sql, $db);
  54. echo '<tbody>';
  55. while ($row= @mysql_fetch_array($result27)) {
  56. if($row['to_cid']){
  57. $num_rows_read = ($num_rows_read +1);
  58. echo '<tr>';
  59. echo '<td>' . $title_refs[$row['to_cid']] . '</td>';
  60. echo '<td>' . $visits[$row['to_cid']] . '</td>';
  61. echo '<td>' . number_format($duration[$row['to_cid']]) . '</td>';
  62. echo '</tr>';
  63. }
  64. }
  65. echo '<tr>';
  66. echo '<td>' . _AT('tracker_pages_total', $num_rows_total, $num_rows_read).'</td>';
  67. echo '<td>' . _AT('tracker_percent_read',@number_format((($num_rows_read/$num_rows_total)*100),1)) . '%</td>';
  68. echo '</tr>';
  69. echo '<tbody>';
  70. echo '</table>';
  71. ?>