online.ajax.php 1.2 KB

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