online.ajax.php 1.1 KB

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