online.ajax.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /*
  4. * To change this template, choose Tools | Templates
  5. * and open the template in the editor.
  6. */
  7. require_once '../global.inc.php';
  8. $action = $_GET['a'];
  9. switch($action) {
  10. case 'load_online_user':
  11. if (isset($_SESSION['who_is_online_counter'])) {
  12. $_SESSION['who_is_online_counter']++;
  13. } else {
  14. $_SESSION['who_is_online_counter'] = 2;
  15. }
  16. $images_to_show = 9;
  17. $page = intval($_REQUEST['online_page_nr']);
  18. $max_page = round(Online::who_is_online_count()/$images_to_show);
  19. $page_rows = ($page-1)*9 + 1;
  20. if (!empty($max_page) && $page <= $max_page) {
  21. if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
  22. $user_list = Online::who_is_online_in_this_course($page_rows, $images_to_show, api_get_user_id(), api_get_setting('time_limit_whosonline'), $_GET['cidReq']);
  23. } else {
  24. $user_list = Online::who_is_online($page_rows, $images_to_show);
  25. }
  26. if (!empty($user_list)) {
  27. echo SocialManager::display_user_list($user_list);
  28. exit;
  29. }
  30. }
  31. echo 'end';
  32. break;
  33. default:
  34. break;
  35. }
  36. exit;