index.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  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. $cidReset = true;
  8. require_once '../../inc/global.inc.php';
  9. api_protect_admin_script();
  10. $interbreadcrumb[] = array('url' => '../index.php', 'name' => get_lang('PlatformAdmin'));
  11. $tool_name = get_lang('Statistics');
  12. Display::display_header($tool_name);
  13. echo Display::page_header($tool_name);
  14. $strCourse = get_lang('Courses');
  15. $strUsers = get_lang('Users');
  16. $strSystem = get_lang('System');
  17. $strSocial = get_lang('Social');
  18. $strSession = get_lang('Session');
  19. // courses ...
  20. $tools[$strCourse]['report=courses'] = get_lang('CountCours');
  21. $tools[$strCourse]['report=tools'] = get_lang('PlatformToolAccess');
  22. $tools[$strCourse]['report=courselastvisit'] = get_lang('LastAccess');
  23. $tools[$strCourse]['report=coursebylanguage'] = get_lang('CountCourseByLanguage');
  24. // users ...
  25. $tools[$strUsers]['report=users'] = get_lang('CountUsers');
  26. $tools[$strUsers]['report=recentlogins'] = get_lang('Logins');
  27. $tools[$strUsers]['report=logins&amp;type=month'] = get_lang('Logins') . ' (' . get_lang('PeriodMonth') . ')';
  28. $tools[$strUsers]['report=logins&amp;type=day'] = get_lang('Logins') . ' (' . get_lang('PeriodDay') . ')';
  29. $tools[$strUsers]['report=logins&amp;type=hour'] = get_lang('Logins') . ' (' . get_lang('PeriodHour') . ')';
  30. $tools[$strUsers]['report=pictures'] = get_lang('CountUsers') . ' (' . get_lang('UserPicture') . ')';
  31. $tools[$strUsers]['report=no_login_users'] = get_lang('StatsUsersDidNotLoginInLastPeriods');
  32. $tools[$strUsers]['report=zombies'] = get_lang('Zombies');
  33. // system ...
  34. $tools[$strSystem]['report=activities'] = get_lang('ImportantActivities');
  35. // social ...
  36. $tools[$strSocial]['report=messagesent'] = get_lang('MessagesSent');
  37. $tools[$strSocial]['report=messagereceived'] = get_lang('MessagesReceived');
  38. $tools[$strSocial]['report=friends'] = get_lang('CountFriends');
  39. echo '<table><tr>';
  40. foreach ($tools as $section => $items) {
  41. echo '<td style="vertical-align:top;">';
  42. echo '<h3>' . $section . '</h3>';
  43. echo '<ul>';
  44. foreach ($items as $key => $value) {
  45. echo '<li><a href="index.php?' . $key . '">' . $value . '</a></li>';
  46. }
  47. echo '</ul>';
  48. echo '</td>';
  49. }
  50. echo '</tr></table>';
  51. $course_categories = Statistics::getCourseCategories();
  52. echo '<br/><br/>';//@todo: spaces between elements should be handled in the css, br should be removed if only there for presentation
  53. $report = isset($_REQUEST['report']) ? $_REQUEST['report'] : '';
  54. switch ($report) {
  55. case 'courses':
  56. // total amount of courses
  57. foreach ($course_categories as $code => $name) {
  58. $courses[$name] = Statistics::countCourses($code);
  59. }
  60. // courses for each course category
  61. Statistics::printStats(get_lang('CountCours'), $courses);
  62. break;
  63. case 'tools':
  64. Statistics::printToolStats();
  65. break;
  66. case 'coursebylanguage':
  67. Statistics::printCourseByLanguageStats();
  68. break;
  69. case 'courselastvisit':
  70. Statistics::printCourseLastVisit();
  71. break;
  72. case 'users':
  73. // total amount of users
  74. $teachers = $students = array();
  75. $countInvisible = isset($_GET['count_invisible_courses']) ? intval($_GET['count_invisible_courses']) : null;
  76. Statistics::printStats(
  77. get_lang('NumberOfUsers'),
  78. array(
  79. get_lang('Teachers') => Statistics::countUsers(COURSEMANAGER, null, $countInvisible),
  80. get_lang('Students') => Statistics::countUsers(STUDENT, null, $countInvisible)
  81. )
  82. );
  83. foreach ($course_categories as $code => $name) {
  84. $name = str_replace(get_lang('Department'), "", $name);
  85. $teachers[$name] = Statistics::countUsers(COURSEMANAGER, $code, $countInvisible);
  86. $students[$name] = Statistics::countUsers(STUDENT, $code, $countInvisible);
  87. }
  88. // docents for each course category
  89. Statistics::printStats(get_lang('Teachers'), $teachers);
  90. // students for each course category
  91. Statistics::printStats(get_lang('Students'), $students);
  92. break;
  93. case 'recentlogins':
  94. Statistics::printRecentLoginStats();
  95. Statistics::printRecentLoginStats(true);
  96. break;
  97. case 'logins':
  98. Statistics::printLoginStats($_GET['type']);
  99. break;
  100. case 'pictures':
  101. Statistics::printUserPicturesStats();
  102. break;
  103. case 'no_login_users':
  104. Statistics::printUsersNotLoggedInStats();
  105. break;
  106. case 'zombies':
  107. ZombieReport::create(array('report' => 'zombies'))->display();
  108. break;
  109. case 'activities':
  110. Statistics::printActivitiesStats();
  111. break;
  112. case 'messagesent':
  113. $messages_sent = Statistics::getMessages('sent');
  114. Statistics::printStats(get_lang('MessagesSent'), $messages_sent);
  115. break;
  116. case 'messagereceived':
  117. $messages_received = Statistics::getMessages('received');
  118. Statistics::printStats(get_lang('MessagesReceived'), $messages_received);
  119. break;
  120. case 'friends':
  121. // total amount of friends
  122. $friends = Statistics::getFriends();
  123. Statistics::printStats(get_lang('CountFriends'), $friends);
  124. break;
  125. }
  126. Display::display_footer();