index.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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('ToolName');
  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. $tools[$strCourse]['action=courses'] = get_lang('CountCours');
  43. $tools[$strCourse]['action=tools'] = get_lang('PlatformToolAccess');
  44. $tools[$strCourse]['action=courselastvisit'] = get_lang('LastAccess');
  45. $tools[$strCourse]['action=coursebylanguage'] = get_lang('CountCourseByLanguage');
  46. $tools[$strUsers]['action=users'] = get_lang('CountUsers');
  47. $tools[$strUsers]['action=recentlogins'] = get_lang('Logins');
  48. $tools[$strUsers]['action=logins&amp;type=month'] = get_lang('Logins').' ('.get_lang('PeriodMonth').')';
  49. $tools[$strUsers]['action=logins&amp;type=day'] = get_lang('Logins').' ('.get_lang('PeriodDay').')';
  50. $tools[$strUsers]['action=logins&amp;type=hour'] = get_lang('Logins').' ('.get_lang('PeriodHour').')';
  51. $tools[$strUsers]['action=pictures'] = get_lang('CountUsers').' ('.get_lang('UserPicture').')';
  52. $tools[$strSystem]['action=activities'] = get_lang('ImportantActivities');
  53. echo '<table><tr>';
  54. foreach($tools as $section => $items)
  55. {
  56. echo '<td valign="top">';
  57. echo '<b>'.$section.'</b>';
  58. echo '<ul>';
  59. foreach($items as $key => $value)
  60. {
  61. echo '<li><a href="index.php?'.$key.'">'.$value.'</a></li>';
  62. }
  63. echo '</ul>';
  64. echo '</td>';
  65. }
  66. echo '</tr></table>';
  67. $course_categories = statistics::get_course_categories();
  68. echo '<br/><br/>';
  69. switch($_GET['action'])
  70. {
  71. case 'courses':
  72. // total amount of courses
  73. foreach($course_categories as $code => $name)
  74. {
  75. $courses[$name] = statistics::count_courses($code);
  76. }
  77. // courses for each course category
  78. statistics::print_stats(get_lang('CountCours'),$courses);
  79. break;
  80. case 'users':
  81. // total amount of users
  82. statistics::print_stats(
  83. get_lang('NumberOfUsers'),
  84. array(
  85. get_lang('Teachers') => statistics::count_users(1,null,$_GET['count_invisible_courses']),
  86. get_lang('Students') => statistics::count_users(5,null,$_GET['count_invisible_courses'])
  87. )
  88. );
  89. foreach($course_categories as $code => $name)
  90. {
  91. $name = str_replace(get_lang('Department'),"",$name);
  92. $teachers[$name] = statistics::count_users(1,$code,$_GET['count_invisible_courses']);
  93. $students[$name] = statistics::count_users(5,$code,$_GET['count_invisible_courses']);
  94. }
  95. // docents for each course category
  96. statistics::print_stats(get_lang('Teachers'),$teachers);
  97. // students for each course category
  98. statistics::print_stats(get_lang('Students'),$students);
  99. break;
  100. case 'coursebylanguage':
  101. statistics::print_course_by_language_stats();
  102. break;
  103. case 'logins':
  104. statistics::print_login_stats($_GET['type']);
  105. break;
  106. case 'tools':
  107. statistics::print_tool_stats();
  108. break;
  109. case 'courselastvisit':
  110. statistics::print_course_last_visit();
  111. break;
  112. case 'recentlogins':
  113. statistics::print_recent_login_stats();
  114. break;
  115. case 'pictures':
  116. statistics::print_user_pictures_stats();
  117. break;
  118. case 'activities':
  119. statistics::print_activities_stats();
  120. break;
  121. }
  122. Display::display_footer();
  123. ?>