index.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * This tool show global Statistics on general platform events
  5. * @package chamilo.Statistics
  6. */
  7. // Language files that need to be included
  8. $language_file = array('admin', 'tracking');
  9. $cidReset = true;
  10. // require_once '../../inc/global.inc.php';
  11. api_protect_admin_script();
  12. $interbreadcrumb[] = array('url' => '../index.php', 'name' => get_lang('PlatformAdmin'));
  13. $tool_name = get_lang('Statistics');
  14. Display::display_header($tool_name);
  15. echo Display::page_header($tool_name);
  16. $strCourse = get_lang('Courses');
  17. $strUsers = get_lang('Users');
  18. $strSystem = get_lang('System');
  19. $strSocial = get_lang('Social');
  20. $strSession = get_lang('Session');
  21. // courses ...
  22. $tools[$strCourse]['report=courses'] = get_lang('CountCours');
  23. $tools[$strCourse]['report=tools'] = get_lang('PlatformToolAccess');
  24. $tools[$strCourse]['report=courselastvisit'] = get_lang('LastAccess');
  25. $tools[$strCourse]['report=coursebylanguage'] = get_lang('CountCourseByLanguage');
  26. // users ...
  27. $tools[$strUsers]['report=users'] = get_lang('CountUsers');
  28. $tools[$strUsers]['report=recentlogins'] = get_lang('Logins');
  29. $tools[$strUsers]['report=logins&amp;type=month'] = get_lang('Logins') . ' (' . get_lang('PeriodMonth') . ')';
  30. $tools[$strUsers]['report=logins&amp;type=day'] = get_lang('Logins') . ' (' . get_lang('PeriodDay') . ')';
  31. $tools[$strUsers]['report=logins&amp;type=hour'] = get_lang('Logins') . ' (' . get_lang('PeriodHour') . ')';
  32. $tools[$strUsers]['report=pictures'] = get_lang('CountUsers') . ' (' . get_lang('UserPicture') . ')';
  33. $tools[$strUsers]['report=no_login_users'] = get_lang('StatsUsersDidNotLoginInLastPeriods');
  34. $tools[$strUsers]['report=zombies'] = get_lang('Zombies');
  35. // system ...
  36. $tools[$strSystem]['report=activities'] = get_lang('ImportantActivities');
  37. // social ...
  38. $tools[$strSocial]['report=messagesent'] = get_lang('MessagesSent');
  39. $tools[$strSocial]['report=messagereceived'] = get_lang('MessagesReceived');
  40. $tools[$strSocial]['report=friends'] = get_lang('CountFriends');
  41. echo '<table><tr>';
  42. foreach ($tools as $section => $items) {
  43. echo '<td style="vertical-align:top;">';
  44. echo '<h3>' . $section . '</h3>';
  45. echo '<ul>';
  46. foreach ($items as $key => $value) {
  47. echo '<li><a href="index.php?' . $key . '">' . $value . '</a></li>';
  48. }
  49. echo '</ul>';
  50. echo '</td>';
  51. }
  52. echo '</tr></table>';
  53. $course_categories = Statistics::get_course_categories();
  54. echo '<br/><br/>';
  55. //@todo: spaces between elements should be handled in the css, br should be removed if only there for presentation
  56. $report = isset($_GET['report']) ? $_GET['report'] : null;
  57. switch ($report) {
  58. case 'courses':
  59. // total amount of courses
  60. foreach ($course_categories as $code => $name) {
  61. $courses[$name] = Statistics::count_courses($code);
  62. }
  63. // courses for each course category
  64. Statistics::print_stats(get_lang('CountCours'), $courses);
  65. break;
  66. case 'tools':
  67. Statistics::print_tool_stats();
  68. break;
  69. case 'coursebylanguage':
  70. Statistics::print_course_by_language_stats();
  71. break;
  72. case 'courselastvisit':
  73. Statistics::print_course_last_visit();
  74. break;
  75. case 'users':
  76. // total amount of users
  77. Statistics::print_stats(
  78. get_lang('NumberOfUsers'), array(
  79. get_lang('Teachers') => Statistics::count_users(1, null, $_GET['count_invisible_courses']),
  80. get_lang('Students') => Statistics::count_users(5, null, $_GET['count_invisible_courses'])
  81. )
  82. );
  83. $teachers = $students = array();
  84. foreach ($course_categories as $code => $name) {
  85. $name = str_replace(get_lang('Department'), "", $name);
  86. $teachers[$name] = Statistics::count_users(1, $code, $_GET['count_invisible_courses']);
  87. $students[$name] = Statistics::count_users(5, $code, $_GET['count_invisible_courses']);
  88. }
  89. // docents for each course category
  90. Statistics::print_stats(get_lang('Teachers'), $teachers);
  91. // students for each course category
  92. Statistics::print_stats(get_lang('Students'), $students);
  93. break;
  94. case 'recentlogins':
  95. Statistics::print_recent_login_stats();
  96. break;
  97. case 'logins':
  98. Statistics::print_login_stats($_GET['type']);
  99. break;
  100. case 'pictures':
  101. Statistics::print_user_pictures_stats();
  102. break;
  103. case 'no_login_users':
  104. Statistics::print_users_not_logged_in_stats();
  105. break;
  106. case 'zombies':
  107. ZombieReport::create(array('report' => 'zombies'))->display();
  108. break;
  109. case 'activities':
  110. Statistics::print_activities_stats();
  111. break;
  112. case 'messagesent':
  113. $messages_sent = Statistics::get_messages('sent');
  114. Statistics::print_stats(get_lang('MessagesSent'), $messages_sent);
  115. break;
  116. case 'messagereceived':
  117. $messages_received = Statistics::get_messages('received');
  118. Statistics::print_stats(get_lang('MessagesReceived'), $messages_received);
  119. break;
  120. case 'friends':
  121. // total amount of friends
  122. $friends = Statistics::get_friends();
  123. Statistics::print_stats(get_lang('CountFriends'), $friends);
  124. break;
  125. }
  126. Display::display_footer();