index.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <?php
  2. // $Id: index.php 8216 2006-11-3 18:03:15 NushiFirefox $
  3. /*
  4. ==============================================================================
  5. Dokeos - elearning and course management software
  6. Copyright (c) 2006 Bart Mollet <bart.mollet@hogent.be>
  7. For a full list of contributors, see "credits.txt".
  8. The full license can be read in "license.txt".
  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; either version 2
  12. of the License, or (at your option) any later version.
  13. See the GNU General Public License for more details.
  14. Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  15. ==============================================================================
  16. */
  17. /**
  18. ==============================================================================
  19. * This tool allows the use statistics
  20. * @package dokeos.statistics
  21. ==============================================================================
  22. */
  23. // name of the language file that needs to be included
  24. $language_file=array('admin','tracking');
  25. $cidReset = true;
  26. include('../../inc/global.inc.php');
  27. api_protect_admin_script();
  28. $interbreadcrumb[] = array ("url" => "../index.php", "name" => get_lang('PlatformAdmin'));
  29. $tool_name = get_lang('Statistics');
  30. Display::display_header($tool_name);
  31. api_display_tool_title($tool_name);
  32. if(!$_configuration['tracking_enabled'])
  33. {
  34. Display::display_warning_message(get_lang('TrackingDisabled'));
  35. Display::display_footer();
  36. exit;
  37. }
  38. require_once ('statistics.lib.php');
  39. $strCourse = get_lang('Courses');
  40. $strUsers = get_lang('Users');
  41. $strSystem = get_lang('System');
  42. $strSocial = get_lang('Social');
  43. // courses ...
  44. $tools[$strCourse]['action=courses'] = get_lang('CountCours');
  45. $tools[$strCourse]['action=tools'] = get_lang('PlatformToolAccess');
  46. $tools[$strCourse]['action=courselastvisit'] = get_lang('LastAccess');
  47. $tools[$strCourse]['action=coursebylanguage'] = get_lang('CountCourseByLanguage');
  48. // users ...
  49. $tools[$strUsers]['action=users'] = get_lang('CountUsers');
  50. $tools[$strUsers]['action=recentlogins'] = get_lang('Logins');
  51. $tools[$strUsers]['action=logins&amp;type=month'] = get_lang('Logins').' ('.get_lang('PeriodMonth').')';
  52. $tools[$strUsers]['action=logins&amp;type=day'] = get_lang('Logins').' ('.get_lang('PeriodDay').')';
  53. $tools[$strUsers]['action=logins&amp;type=hour'] = get_lang('Logins').' ('.get_lang('PeriodHour').')';
  54. $tools[$strUsers]['action=pictures'] = get_lang('CountUsers').' ('.get_lang('UserPicture').')';
  55. // system ...
  56. $tools[$strSystem]['action=activities'] = get_lang('ImportantActivities');
  57. // social ...
  58. $tools[$strSocial]['action=messagesent'] = get_lang('MessagesSent');
  59. $tools[$strSocial]['action=messagereceived'] = get_lang('MessagesReceived');
  60. $tools[$strSocial]['action=friends'] = get_lang('CountFriends');
  61. echo '<table><tr>';
  62. foreach($tools as $section => $items)
  63. {
  64. echo '<td valign="top">';
  65. echo '<b>'.$section.'</b>';
  66. echo '<ul>';
  67. foreach($items as $key => $value)
  68. {
  69. echo '<li><a href="index.php?'.$key.'">'.$value.'</a></li>';
  70. }
  71. echo '</ul>';
  72. echo '</td>';
  73. }
  74. echo '</tr></table>';
  75. $course_categories = statistics::get_course_categories();
  76. echo '<br/><br/>';
  77. switch($_GET['action'])
  78. {
  79. case 'courses':
  80. // total amount of courses
  81. foreach($course_categories as $code => $name)
  82. {
  83. $courses[$name] = statistics::count_courses($code);
  84. }
  85. // courses for each course category
  86. statistics::print_stats(get_lang('CountCours'),$courses);
  87. break;
  88. case 'users':
  89. // total amount of users
  90. statistics::print_stats(
  91. get_lang('NumberOfUsers'),
  92. array(
  93. get_lang('Teachers') => statistics::count_users(1,null,$_GET['count_invisible_courses']),
  94. get_lang('Students') => statistics::count_users(5,null,$_GET['count_invisible_courses'])
  95. )
  96. );
  97. foreach($course_categories as $code => $name)
  98. {
  99. $name = str_replace(get_lang('Department'),"",$name);
  100. $teachers[$name] = statistics::count_users(1,$code,$_GET['count_invisible_courses']);
  101. $students[$name] = statistics::count_users(5,$code,$_GET['count_invisible_courses']);
  102. }
  103. // docents for each course category
  104. statistics::print_stats(get_lang('Teachers'),$teachers);
  105. // students for each course category
  106. statistics::print_stats(get_lang('Students'),$students);
  107. break;
  108. case 'coursebylanguage':
  109. statistics::print_course_by_language_stats();
  110. break;
  111. case 'logins':
  112. statistics::print_login_stats($_GET['type']);
  113. break;
  114. case 'tools':
  115. statistics::print_tool_stats();
  116. break;
  117. case 'courselastvisit':
  118. statistics::print_course_last_visit();
  119. break;
  120. case 'recentlogins':
  121. statistics::print_recent_login_stats();
  122. break;
  123. case 'pictures':
  124. statistics::print_user_pictures_stats();
  125. break;
  126. case 'activities':
  127. statistics::print_activities_stats();
  128. break;
  129. case 'messagesent':
  130. $messages_sent = statistics::get_messages('sent');
  131. statistics::print_stats(get_lang('MessagesSent'), $messages_sent);
  132. break;
  133. case 'messagereceived':
  134. $messages_received = statistics::get_messages('received');
  135. statistics::print_stats(get_lang('MessagesReceived'), $messages_received);
  136. break;
  137. case 'friends':
  138. // total amount of friends
  139. $friends = statistics::get_friends();
  140. statistics::print_stats(get_lang('CountFriends'), $friends);
  141. break;
  142. }
  143. Display::display_footer();
  144. ?>