예제 #1
0
 /**
  * Get the list of user_ids of users who are online.
  */
 public static function users_connected_by_id()
 {
     $count = Online::who_is_online_count();
     $user_connect = Online::who_is_online(0, $count, null, null, 30, true);
     $user_id_list = array();
     for ($i = 0; $i < count($user_connect); $i++) {
         $user_id_list[$i] = $user_connect[$i][0];
     }
     return $user_id_list;
 }
예제 #2
0
 /**
  * @return string
  */
 public function returnNotificationMenu()
 {
     $_course = api_get_course_info();
     $course_id = api_get_course_id();
     $user_id = api_get_user_id();
     $html = '';
     if (api_get_setting('showonline', 'world') == 'true' and !$user_id or api_get_setting('showonline', 'users') == 'true' and $user_id or api_get_setting('showonline', 'course') == 'true' and $user_id and $course_id) {
         $number = Online::who_is_online_count(api_get_setting('time_limit_whosonline'));
         $number_online_in_course = 0;
         if (!empty($_course['id'])) {
             $number_online_in_course = Online::who_is_online_in_this_course_count($user_id, api_get_setting('time_limit_whosonline'), $_course['id']);
         }
         // Display the who's online of the platform
         if ($number) {
             if (api_get_setting('showonline', 'world') == 'true' and !$user_id or api_get_setting('showonline', 'users') == 'true' and $user_id) {
                 $html .= '<li><a href="' . SocialManager::getUserOnlineLink() . '" target="_top" title="' . get_lang('UsersOnline') . '" >' . Display::return_icon('user.png', get_lang('UsersOnline'), array(), ICON_SIZE_TINY) . ' ' . $number . '</a></li>';
             }
         }
         // Display the who's online for the course
         if ($number_online_in_course) {
             if (is_array($_course) and api_get_setting('showonline', 'course') == 'true' and isset($_course['sysCode'])) {
                 $html .= '<li><a href="' . SocialManager::getUserOnlineLink($_course['sysCode']) . '" target="_top">' . Display::return_icon('course.png', get_lang('UsersOnline') . ' ' . get_lang('InThisCourse'), array(), ICON_SIZE_TINY) . ' ' . $number_online_in_course . ' </a></li>';
             }
         }
         // Display the who's online for the session
         if (api_get_setting('showonline', 'session') == 'true') {
             if (isset($user_id) && api_get_session_id() != 0) {
                 if (api_is_allowed_to_edit()) {
                     $html .= '<li><a href="' . SocialManager::getUserOnlineLink(null, api_get_session_id()) . '&id_coach=' . $user_id . '" >' . Display::return_icon('session.png', get_lang('UsersConnectedToMySessions'), array(), ICON_SIZE_TINY) . ' </a></li>';
                 }
             }
         }
     }
     if (api_get_setting('accessibility_font_resize') == 'true') {
         $html .= '<li class="resize_font">';
         $html .= '<span class="decrease_font" title="' . get_lang('DecreaseFontSize') . '">A</span> <span class="reset_font" title="' . get_lang('ResetFontSize') . '">A</span> <span class="increase_font" title="' . get_lang('IncreaseFontSize') . '">A</span>';
         $html .= '</li>';
     }
     return $html;
 }
예제 #3
0
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
require_once '../global.inc.php';
$action = $_GET['a'];
switch ($action) {
    case 'load_online_user':
        if (isset($_SESSION['who_is_online_counter'])) {
            $_SESSION['who_is_online_counter']++;
        } else {
            $_SESSION['who_is_online_counter'] = 2;
        }
        $images_to_show = 9;
        $page = intval($_REQUEST['online_page_nr']);
        $max_page = round(Online::who_is_online_count() / $images_to_show);
        $page_rows = ($page - 1) * 9 + 1;
        if (!empty($max_page) && $page <= $max_page) {
            if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) {
                $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']);
            } else {
                $user_list = Online::who_is_online($page_rows, $images_to_show);
            }
            if (!empty($user_list)) {
                echo SocialManager::display_user_list($user_list);
                exit;
            }
        }
        echo 'end';
        break;
    default: