online.ajax.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. $images_to_show = 9;
  16. $page = intval($_REQUEST['online_page_nr']);
  17. $max_page = round(Online::who_is_online_count()/$images_to_show);
  18. $page_rows = ($page-1)*9 + 1;
  19. if (!empty($max_page) && $page <= $max_page) {
  20. if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
  21. $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']);
  22. } else {
  23. $user_list = Online::who_is_online($page_rows, $images_to_show);
  24. }
  25. if (!empty($user_list)) {
  26. echo SocialManager::display_user_list($user_list);
  27. exit;
  28. }
  29. }
  30. echo 'end';
  31. break;
  32. default:
  33. break;
  34. }