/** * Get the list of user_ids of users who are online. */ public static function users_connected_by_id() { $count = who_is_online_count(); $user_connect = 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; }
<?php /* For licensing terms, see /license.txt */ 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 = ceil(who_is_online_count() / $images_to_show); $page_rows = ($page - 1) * 9; if (!empty($max_page) && $page <= $max_page) { if (isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0) { $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']); } else { $user_list = who_is_online($page_rows, $images_to_show); } if (!empty($user_list)) { echo SocialManager::display_user_list($user_list, false); exit; } } echo 'end'; break; default: break;
function return_notification_menu() { $_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 = who_is_online_count(api_get_setting('time_limit_whosonline')); $number_online_in_course = 0; if (!empty($_course['id'])) { $number_online_in_course = 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="' . api_get_path(WEB_PATH) . 'whoisonline.php" 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="' . api_get_path(WEB_PATH) . 'whoisonline.php?cidReq=' . $_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>'; } } //if (api_get_setting('showonline', 'session') == 'true') { // Display the who's online for the session if (isset($user_id) && api_get_session_id() != 0) { $html .= '<li><a href="' . api_get_path(WEB_PATH) . 'whoisonlinesession.php?id_coach=' . $user_id . '&referer=' . urlencode($_SERVER['REQUEST_URI']) . '" target="_top">' . 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; }
function return_notification_menu() { $_course = api_get_course_info(); $course_id = 0; if (!empty($_course)) { $course_id = $_course['code']; } $user_id = api_get_user_id(); $html = ''; if (api_get_setting('showonline', 'world') == 'true' && !$user_id || api_get_setting('showonline', 'users') == 'true' && $user_id || api_get_setting('showonline', 'course') == 'true' && $user_id && $course_id) { $number = who_is_online_count(api_get_setting('time_limit_whosonline')); $number_online_in_course = 0; if (!empty($_course['id'])) { $number_online_in_course = 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' && !$user_id || api_get_setting('showonline', 'users') == 'true' && $user_id) { $html .= '<li><a href="' . api_get_path(WEB_PATH) . 'whoisonline.php" target="_self" 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) && api_get_setting('showonline', 'course') == 'true' && isset($_course['sysCode'])) { $html .= '<li><a href="' . api_get_path(WEB_PATH) . 'whoisonline.php?cidReq=' . $_course['sysCode'] . '" target="_self">' . Display::return_icon('course.png', get_lang('UsersOnline') . ' ' . get_lang('InThisCourse'), array(), ICON_SIZE_TINY) . ' ' . $number_online_in_course . ' </a></li>'; } } //if (api_get_setting('showonline', 'session') == 'true') { // Display the who's online for the session if (isset($user_id) && api_get_session_id() != 0) { $html .= '<li><a href="' . api_get_path(WEB_PATH) . 'whoisonlinesession.php?id_coach=' . $user_id . '&referer=' . urlencode($_SERVER['REQUEST_URI']) . '" target="_self">' . Display::return_icon('session.png', get_lang('UsersConnectedToMySessions'), array(), ICON_SIZE_TINY) . ' </a></li>'; } //} } return $html; }