@ -15,70 +15,72 @@ $language_file = array('chat');
require_once '../inc/global.inc.php';
$course = api_get_course_id();
$group_id = intval($_SESSION['_gid'] );
$session_id = intval($_SESSION['id_session'] );
$group_id = api_get_group_id( );
$session_id = api_get_session_id( );
$session_condition = api_get_session_condition($session_id);
$group_condition = " AND to_group_id = '$group_id'";
$extra_condition = '';
if (!empty($group_id)) {
$extra_condition = $group_condition;
$extra_condition = $group_condition;
} else {
$extra_condition = $session_condition;
$extra_condition = $session_condition;
}
$user_id = api_get_user_id();
if (!empty($course)) {
$showPic = intval($_GET['showPic']) ;
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_chat_connected = Database::get_course_table(TABLE_CHAT_CONNECTED);
$query = "SELECT username FROM $tbl_user WHERE user_id='".$user_id."'";
$result = Database::query($query);
list($pseudo_user) = Database::fetch_array($result);
$isAllowed = !(empty($pseudo_user) || !$_cid);
$isMaster = (bool)$is_courseAdmin;
$date_inter = date('Y-m-d H:i:s', time() - 120);
$users = array();
$course_id = api_get_course_int_id();
if (empty($session_id)) {
$query = "SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri,t3.status
FROM $tbl_user t1, $tbl_chat_connected t2, $tbl_course_user t3
$showPic = isset($_GET['showPic']) ? intval($_GET['showPic']) : null ;
$tbl_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_chat_connected = Database::get_course_table(TABLE_CHAT_CONNECTED);
$query = "SELECT username FROM $tbl_user WHERE user_id='".$user_id."'";
$result = Database::query($query);
list($pseudo_user) = Database::fetch_array($result);
$isAllowed = !(empty($pseudo_user) || !$_cid);
$isMaster = (bool)$is_courseAdmin;
$date_inter = date('Y-m-d H:i:s', time() - 120);
$users = array();
$course_id = api_get_course_int_id();
if (empty($session_id)) {
$query = "SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri,t3.status
FROM $tbl_user t1, $tbl_chat_connected t2, $tbl_course_user t3
WHERE t2.c_id = $course_id AND
t1.user_id=t2.user_id AND
t3.user_id=t2.user_id AND
t3.relation_type< >".COURSE_RELATION_TYPE_RRHH." AND
t3.course_code = '".$_course['sysCode']."' AND
t2.last_connection>'".$date_inter."' $extra_condition
ORDER BY username";
$result = Database::query($query);
$users = Database::store_result($result);
t1.user_id=t2.user_id AND
t3.user_id=t2.user_id AND
t3.relation_type< >".COURSE_RELATION_TYPE_RRHH." AND
t3.course_code = '".$_course['sysCode']."' AND
t2.last_connection>'".$date_inter."' $extra_condition
ORDER BY username";
$result = Database::query($query);
$users = Database::store_result($result);
} else {
// select learners
$query = "SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri FROM $tbl_user t1, $tbl_chat_connected t2, $tbl_session_course_user t3
$query = "SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri
FROM $tbl_user t1, $tbl_chat_connected t2, $tbl_session_course_user t3
WHERE
t2.c_id = $course_id AND
t1.user_id=t2.user_id AND t3.id_user=t2.user_id AND
t3.id_session = '".$session_id."' AND
t2.c_id = $course_id AND
t1.user_id=t2.user_id AND t3.id_user=t2.user_id AND
t3.id_session = '".$session_id."' AND
t3.course_code = '".$_course['sysCode']."' AND t2.last_connection>'".$date_inter."' $extra_condition ORDER BY username";
$result = Database::query($query);
while ($learner = Database::fetch_array($result)) {
$users[$learner['user_id']] = $learner;
$users[$learner['user_id']] = $learner;
}
// select session coach
$query = "SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri FROM $tbl_user t1,$tbl_chat_connected t2,$tbl_session t3
WHERE t2.c_id = $course_id AND
$query = "SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri
FROM $tbl_user t1,$tbl_chat_connected t2,$tbl_session t3
WHERE t2.c_id = $course_id AND
t1.user_id=t2.user_id AND t3.id_coach=t2.user_id AND t3.id = '".$session_id."' AND t2.last_connection>'".$date_inter."' $extra_condition ORDER BY username";
$result = Database::query($query);
if ($coach = Database::fetch_array($result)) {
@ -89,7 +91,7 @@ if (!empty($course)) {
$query = "SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri
FROM $tbl_user t1,$tbl_chat_connected t2,$tbl_session_course_user t3
WHERE
t2.c_id = $course_id AND
t2.c_id = $course_id AND
t1.user_id=t2.user_id
AND t3.id_user=t2.user_id AND t3.status=2
AND t3.id_session = '".$session_id."'
@ -99,17 +101,11 @@ if (!empty($course)) {
$result = Database::query($query);
$course_coaches = array();
while ($coaches = Database::fetch_array($result)) {
//$course_coaches[] = $coaches['user_id'];
$users[$coaches['user_id']] = $coaches;
}
//if ($coach = Database::fetch_array($result))
// $users[$coach['user_id']] = $coach;
}
$user_id = $enreg['user_id'];
require 'header_frame.inc.php';
?>
< table border = "0" cellpadding = "0" cellspacing = "0" width = "100%" class = "data_table" >
< tr >< th colspan = "2" > <?php echo get_lang ( 'Connected' ); ?> </ th ></ tr >
@ -122,7 +118,6 @@ if (!empty($course)) {
}
$user_image = UserManager::get_user_picture_path_by_id($user['user_id'], 'web', false, true);
$file_url = $user_image['dir'].$user_image['file'];
?>
< tr >
< td width = "1%" valign = "top" >< img src = " <?php echo $file_url ; ?> " border = "0" width = "22" alt = "" /></ td >
@ -142,4 +137,4 @@ if (!empty($course)) {
< / table >
<?php
}
require 'footer_frame.inc.php';
require 'footer_frame.inc.php';