online.ajax.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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($page_rows, $images_to_show, api_get_user_id(), api_get_setting('time_limit_whosonline'), $_GET['cidReq']);
  19. } else {
  20. $user_list = who_is_online($page_rows, $images_to_show);
  21. }
  22. if (!empty($user_list)) {
  23. echo SocialManager::display_user_list($user_list, false);
  24. exit;
  25. }
  26. }
  27. echo 'end';
  28. break;
  29. default:
  30. break;
  31. }