index.php 5.2 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/>';//@todo: spaces between elements should be handled in the css, br should be removed if only there for presentation
  55. switch ($_GET['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'), array(
  77. get_lang('Teachers') => Statistics::count_users(1, null, $_GET['count_invisible_courses']),
  78. get_lang('Students') => Statistics::count_users(5, null, $_GET['count_invisible_courses'])
  79. )
  80. );
  81. $teachers = $students = array();
  82. foreach ($course_categories as $code => $name) {
  83. $name = str_replace(get_lang('Department'), "", $name);
  84. $teachers[$name] = Statistics::count_users(1, $code, $_GET['count_invisible_courses']);
  85. $students[$name] = Statistics::count_users(5, $code, $_GET['count_invisible_courses']);
  86. }
  87. // docents for each course category
  88. Statistics::print_stats(get_lang('Teachers'), $teachers);
  89. // students for each course category
  90. Statistics::print_stats(get_lang('Students'), $students);
  91. break;
  92. case 'recentlogins':
  93. Statistics::print_recent_login_stats();
  94. break;
  95. case 'logins':
  96. Statistics::print_login_stats($_GET['type']);
  97. break;
  98. case 'pictures':
  99. Statistics::print_user_pictures_stats();
  100. break;
  101. case 'no_login_users':
  102. Statistics::print_users_not_logged_in_stats();
  103. break;
  104. case 'zombies':
  105. ZombieReport::create(array('report' => 'zombies'))->display();
  106. break;
  107. case 'activities':
  108. Statistics::print_activities_stats();
  109. break;
  110. case 'messagesent':
  111. $messages_sent = Statistics::get_messages('sent');
  112. Statistics::print_stats(get_lang('MessagesSent'), $messages_sent);
  113. break;
  114. case 'messagereceived':
  115. $messages_received = Statistics::get_messages('received');
  116. Statistics::print_stats(get_lang('MessagesReceived'), $messages_received);
  117. break;
  118. case 'friends':
  119. // total amount of friends
  120. $friends = Statistics::get_friends();
  121. Statistics::print_stats(get_lang('CountFriends'), $friends);
  122. break;
  123. }
  124. Display::display_footer();