online.ajax.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. if (isset($_SESSION['who_is_online_counter'])) {
  8. $_SESSION['who_is_online_counter']++;
  9. } else {
  10. $_SESSION['who_is_online_counter'] = 2;
  11. }
  12. $images_to_show = 9;
  13. $page = intval($_REQUEST['online_page_nr']);
  14. $max_page = ceil(who_is_online_count()/$images_to_show);
  15. $page_rows = ($page-1)*9;
  16. if (!empty($max_page) && $page <= $max_page) {
  17. if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
  18. $user_list = who_is_online_in_this_course(
  19. $page_rows,
  20. $images_to_show,
  21. api_get_user_id(),
  22. api_get_setting('time_limit_whosonline'),
  23. $_GET['cidReq']
  24. );
  25. } else {
  26. $user_list = who_is_online($page_rows, $images_to_show);
  27. }
  28. if (!empty($user_list)) {
  29. echo SocialManager::display_user_list($user_list, false);
  30. exit;
  31. }
  32. }
  33. echo 'end';
  34. break;
  35. default:
  36. break;
  37. }