online.ajax.php 1.2 KB

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