Fixing whoisonline queries

skala
Julio Montoya 13 years ago
parent 9f01919d6c
commit c03a32fa08
  1. 8
      main/inc/ajax/online.ajax.php
  2. 8
      main/inc/lib/online.inc.php

@ -17,13 +17,13 @@ switch($action) {
}
$page = intval($_REQUEST['online_page_nr']);
$max_page = round(who_is_online_count()/10);
$page_rows = $page*10;
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, $page_rows + 10, api_get_user_id(), api_get_setting('time_limit_whosonline'), $_GET['cidReq']);
} else {
$page_rows = $page*10;
$user_list = who_is_online($page_rows, $page_rows + 10);
$user_list = who_is_online_in_this_course($page_rows, 10, api_get_user_id(), api_get_setting('time_limit_whosonline'), $_GET['cidReq']);
} else {
$user_list = who_is_online($page_rows, 10);
}
if (!empty($user_list)) {
echo SocialManager::display_user_list($user_list);

@ -210,11 +210,11 @@ function who_is_online($from, $number_of_items, $column = null, $direction = nul
}
//This query will show all registered users. Only for dev purposes.
$query = "SELECT DISTINCT u.user_id as login_user_id, login_date FROM ".$track_online_table ." e , $table_user u
/*$query = "SELECT DISTINCT u.user_id as login_user_id, login_date FROM ".$track_online_table ." e , $table_user u
GROUP by u.user_id
ORDER BY $column $direction
LIMIT $from, $number_of_items";
*/
$result = Database::query($query);
if ($result) {
$validtime = mktime(date("H"),date("i")-$time_limit,date("s"),date("m"),date("d"),date("Y"));
@ -284,8 +284,8 @@ function who_is_online_count($valid = null, $friends = false) {
//dev purposes show all users online
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$query = "SELECT count(*) as count FROM ".$table_user ." ";
/*$table_user = Database::get_main_table(TABLE_MAIN_USER);
$query = "SELECT count(*) as count FROM ".$table_user ." ";*/
$result = Database::query($query);
if (Database::num_rows($result) > 0) {

Loading…
Cancel
Save