index.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. switch ($_REQUEST['report']) {
  56. case 'courses':
  57. // total amount of courses
  58. foreach ($course_categories as $code => $name) {
  59. $courses[$name] = Statistics::count_courses($code);
  60. }
  61. // courses for each course category
  62. Statistics::print_stats(get_lang('CountCours'), $courses);
  63. break;
  64. case 'tools':
  65. Statistics::print_tool_stats();
  66. break;
  67. case 'coursebylanguage':
  68. Statistics::print_course_by_language_stats();
  69. break;
  70. case 'courselastvisit':
  71. Statistics::print_course_last_visit();
  72. break;
  73. case 'users':
  74. // total amount of users
  75. Statistics::print_stats(
  76. get_lang('NumberOfUsers'),
  77. array(
  78. get_lang('Teachers') => Statistics::count_users(1, null, $_GET['count_invisible_courses']),
  79. get_lang('Students') => Statistics::count_users(5, null, $_GET['count_invisible_courses'])
  80. )
  81. );
  82. $teachers = $students = array();
  83. foreach ($course_categories as $code => $name) {
  84. $name = str_replace(get_lang('Department'), "", $name);
  85. $teachers[$name] = Statistics::count_users(1, $code, $_GET['count_invisible_courses']);
  86. $students[$name] = Statistics::count_users(5, $code, $_GET['count_invisible_courses']);
  87. }
  88. // docents for each course category
  89. Statistics::print_stats(get_lang('Teachers'), $teachers);
  90. // students for each course category
  91. Statistics::print_stats(get_lang('Students'), $students);
  92. break;
  93. case 'recentlogins':
  94. Statistics::print_recent_login_stats();
  95. break;
  96. case 'logins':
  97. Statistics::print_login_stats($_GET['type']);
  98. break;
  99. case 'pictures':
  100. Statistics::print_user_pictures_stats();
  101. break;
  102. case 'no_login_users':
  103. Statistics::print_users_not_logged_in_stats();
  104. break;
  105. case 'zombies':
  106. ZombieReport::create(array('report' => 'zombies'))->display();
  107. break;
  108. case 'activities':
  109. Statistics::print_activities_stats();
  110. break;
  111. case 'messagesent':
  112. $messages_sent = Statistics::get_messages('sent');
  113. Statistics::print_stats(get_lang('MessagesSent'), $messages_sent);
  114. break;
  115. case 'messagereceived':
  116. $messages_received = Statistics::get_messages('received');
  117. Statistics::print_stats(get_lang('MessagesReceived'), $messages_received);
  118. break;
  119. case 'friends':
  120. // total amount of friends
  121. $friends = Statistics::get_friends();
  122. Statistics::print_stats(get_lang('CountFriends'), $friends);
  123. break;
  124. }
  125. Display::display_footer();