online.ajax.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. $_dont_save_user_course_access = true;
  4. require_once __DIR__.'/../global.inc.php';
  5. $action = isset($_GET['a']) ? $_GET['a'] : '';
  6. switch ($action) {
  7. case 'get_users_online':
  8. echo returnNotificationMenu();
  9. break;
  10. case 'load_online_user':
  11. $access = accessToWhoIsOnline();
  12. if (!$access) {
  13. exit;
  14. }
  15. $images_to_show = MAX_ONLINE_USERS;
  16. $page = intval($_REQUEST['online_page_nr']);
  17. $max_page = ceil(who_is_online_count() / $images_to_show);
  18. $page_rows = ($page - 1) * MAX_ONLINE_USERS;
  19. if (!empty($max_page) && $page <= $max_page) {
  20. if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
  21. $user_list = who_is_online_in_this_course(
  22. $page_rows,
  23. $images_to_show,
  24. api_get_user_id(),
  25. api_get_setting('time_limit_whosonline'),
  26. $_GET['cidReq']
  27. );
  28. } else {
  29. $user_list = who_is_online($page_rows, $images_to_show);
  30. }
  31. if (!empty($user_list)) {
  32. echo SocialManager::display_user_list($user_list, false);
  33. exit;
  34. }
  35. }
  36. echo 'end';
  37. break;
  38. default:
  39. break;
  40. }