|
|
@ -10,9 +10,6 @@ use ChamiloSession as Session; |
|
|
|
* @author Denes Nagy, principal author |
|
|
|
* @author Denes Nagy, principal author |
|
|
|
* @author Bart Mollet |
|
|
|
* @author Bart Mollet |
|
|
|
* @author Roan Embrechts, cleaning and bugfixing |
|
|
|
* @author Roan Embrechts, cleaning and bugfixing |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Insert a login reference for the current user into the track_e_online stats |
|
|
|
* Insert a login reference for the current user into the track_e_online stats |
|
|
|
* table. This table keeps trace of the last login. Nothing else matters (we |
|
|
|
* table. This table keeps trace of the last login. Nothing else matters (we |
|
|
|
* don't keep traces of anything older). |
|
|
|
* don't keep traces of anything older). |
|
|
@ -287,12 +284,11 @@ function who_is_online( |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$direction = strtolower($direction); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (empty($direction)) { |
|
|
|
if (empty($direction)) { |
|
|
|
$direction = 'DESC'; |
|
|
|
$direction = 'DESC'; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (!in_array($direction, ['asc', 'desc'])) { |
|
|
|
if (!in_array(strtolower($direction), ['asc', 'desc'])) { |
|
|
|
$direction = 'DESC'; |
|
|
|
$direction = 'DESC'; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -313,14 +309,14 @@ function who_is_online( |
|
|
|
friend_user_id <> '".api_get_user_id()."' AND |
|
|
|
friend_user_id <> '".api_get_user_id()."' AND |
|
|
|
relation_type='".USER_RELATION_TYPE_FRIEND."' AND |
|
|
|
relation_type='".USER_RELATION_TYPE_FRIEND."' AND |
|
|
|
user_id = '".api_get_user_id()."' |
|
|
|
user_id = '".api_get_user_id()."' |
|
|
|
ORDER BY $column $direction |
|
|
|
ORDER BY `$column` $direction |
|
|
|
LIMIT $from, $number_of_items"; |
|
|
|
LIMIT $from, $number_of_items"; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
$query = "SELECT DISTINCT login_user_id, login_date |
|
|
|
$query = "SELECT DISTINCT login_user_id, login_date |
|
|
|
FROM ".$track_online_table." e |
|
|
|
FROM ".$track_online_table." e |
|
|
|
INNER JOIN ".$table_user." u ON (u.id = e.login_user_id) |
|
|
|
INNER JOIN ".$table_user." u ON (u.id = e.login_user_id) |
|
|
|
WHERE u.status != ".ANONYMOUS." AND login_date >= '".$current_date."' |
|
|
|
WHERE u.status != ".ANONYMOUS." AND login_date >= '".$current_date."' |
|
|
|
ORDER BY $column $direction |
|
|
|
ORDER BY `$column` $direction |
|
|
|
LIMIT $from, $number_of_items"; |
|
|
|
LIMIT $from, $number_of_items"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -336,7 +332,7 @@ function who_is_online( |
|
|
|
login_date >= '".$current_date."' AND |
|
|
|
login_date >= '".$current_date."' AND |
|
|
|
friend_user_id <> '".api_get_user_id()."' AND |
|
|
|
friend_user_id <> '".api_get_user_id()."' AND |
|
|
|
relation_type='".USER_RELATION_TYPE_FRIEND."' |
|
|
|
relation_type='".USER_RELATION_TYPE_FRIEND."' |
|
|
|
ORDER BY $column $direction |
|
|
|
ORDER BY `$column` $direction |
|
|
|
LIMIT $from, $number_of_items"; |
|
|
|
LIMIT $from, $number_of_items"; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// all users online |
|
|
|
// all users online |
|
|
@ -346,7 +342,7 @@ function who_is_online( |
|
|
|
ON (u.id=track.login_user_id) |
|
|
|
ON (u.id=track.login_user_id) |
|
|
|
WHERE u.status != ".ANONYMOUS." AND track.access_url_id = $access_url_id AND |
|
|
|
WHERE u.status != ".ANONYMOUS." AND track.access_url_id = $access_url_id AND |
|
|
|
login_date >= '".$current_date."' |
|
|
|
login_date >= '".$current_date."' |
|
|
|
ORDER BY $column $direction |
|
|
|
ORDER BY `$column` $direction |
|
|
|
LIMIT $from, $number_of_items"; |
|
|
|
LIMIT $from, $number_of_items"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|