index.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. switch ($_REQUEST['report']) {
  54. case 'courses':
  55. // total amount of courses
  56. foreach ($course_categories as $code => $name) {
  57. $courses[$name] = Statistics::countCourses($code);
  58. }
  59. // courses for each course category
  60. Statistics::printStats(get_lang('CountCours'), $courses);
  61. break;
  62. case 'tools':
  63. Statistics::printToolStats();
  64. break;
  65. case 'coursebylanguage':
  66. Statistics::printCourseByLanguageStats();
  67. break;
  68. case 'courselastvisit':
  69. Statistics::printCourseLastVisit();
  70. break;
  71. case 'users':
  72. // total amount of users
  73. $teachers = $students = array();
  74. $countInvisible = isset($_GET['count_invisible_courses']) ? intval($_GET['count_invisible_courses']) : null;
  75. Statistics::printStats(
  76. get_lang('NumberOfUsers'),
  77. array(
  78. get_lang('Teachers') => Statistics::countUsers(COURSEMANAGER, null, $countInvisible),
  79. get_lang('Students') => Statistics::countUsers(STUDENT, null, $countInvisible)
  80. )
  81. );
  82. foreach ($course_categories as $code => $name) {
  83. $name = str_replace(get_lang('Department'), "", $name);
  84. $teachers[$name] = Statistics::countUsers(COURSEMANAGER, $code, $countInvisible);
  85. $students[$name] = Statistics::countUsers(STUDENT, $code, $countInvisible);
  86. }
  87. // docents for each course category
  88. Statistics::printStats(get_lang('Teachers'), $teachers);
  89. // students for each course category
  90. Statistics::printStats(get_lang('Students'), $students);
  91. break;
  92. case 'recentlogins':
  93. Statistics::printRecentLoginStats();
  94. break;
  95. case 'logins':
  96. Statistics::printLoginStats($_GET['type']);
  97. break;
  98. case 'pictures':
  99. Statistics::printUserPicturesStats();
  100. break;
  101. case 'no_login_users':
  102. Statistics::printUsersNotLoggedInStats();
  103. break;
  104. case 'zombies':
  105. ZombieReport::create(array('report' => 'zombies'))->display();
  106. break;
  107. case 'activities':
  108. Statistics::printActivitiesStats();
  109. break;
  110. case 'messagesent':
  111. $messages_sent = Statistics::getMessages('sent');
  112. Statistics::printStats(get_lang('MessagesSent'), $messages_sent);
  113. break;
  114. case 'messagereceived':
  115. $messages_received = Statistics::getMessages('received');
  116. Statistics::printStats(get_lang('MessagesReceived'), $messages_received);
  117. break;
  118. case 'friends':
  119. // total amount of friends
  120. $friends = Statistics::getFriends();
  121. Statistics::printStats(get_lang('CountFriends'), $friends);
  122. break;
  123. }
  124. Display::display_footer();