Fixing PHP warnings.

1.9.x
Julio Montoya 11 years ago
parent 016a924bcf
commit 771becc37e
  1. 65
      main/chat/chat.php
  2. 93
      main/chat/chat_chat.php
  3. 66
      main/chat/chat_functions.lib.php
  4. 88
      main/chat/chat_message.php
  5. 101
      main/chat/chat_whoisonline.php
  6. 2
      main/chat/header_frame.inc.php

@ -16,13 +16,16 @@ require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
$this_section = SECTION_COURSES;
$nameTools = get_lang('ToolChat');
if ($_GET["origin"] != 'whoisonline') {
api_protect_course_script(true);
$origin = isset($_GET["origin"]) ? Security::remove_XSS($_GET["origin"]) : null;
$target = isset($_GET["target"]) ? Security::remove_XSS($_GET["target"]) : null;
if ($origin != 'whoisonline') {
api_protect_course_script(true);
} else {
$origin = $_SESSION['origin'];
$target = $_SESSION['target'];
$_SESSION['origin']= Security::remove_XSS($_GET["origin"]);
$_SESSION['target']= Security::remove_XSS($_GET["target"]);
$origin = $_SESSION['origin'];
$target = $_SESSION['target'];
$_SESSION['origin']= $origin;
$_SESSION['target']= $target;
}
/* TRACKING */
@ -43,67 +46,43 @@ if (!empty($mycourseid) && $mycourseid != -1) {
$cidreq = Security::remove_XSS($_GET['cidReq']);
$toolgroup = Security::remove_XSS($_GET['toolgroup']); //fix when change by vertical or horizontal menu from a chat group to chat course.
if (empty($toolgroup) && empty($open_chat_window)){
unset($_SESSION['_gid']);
}
?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo api_get_language_isocode(); ?>" lang="<?php echo api_get_language_isocode(); ?>">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo api_get_system_encoding(); ?>" />
<?php
echo'<title>'.get_lang('Chat').' - '.$mycourseid.' - '.api_get_setting('siteName').'</title>';
// If it is a group chat then the breadcrumbs.
if ($_SESSION['_gid'] OR $_GET['group_id']) {
if (isset($_SESSION['_gid'])) {
$_clean['group_id'] = (int)$_SESSION['_gid'];
}
if (isset($_GET['group_id'])) {
$_clean['group_id'] = (int)Database::escape_string($_GET['group_id']);
}
$groupId = api_get_group_id();
$group_properties = GroupManager :: get_group_properties($_clean['group_id']);
// If it is a group chat then the breadcrumbs.
if (!empty($groupId)) {
$group_properties = GroupManager :: get_group_properties($groupId);
$interbreadcrumb[] = array('url' => '../group/group.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq='.api_get_group_id(), 'name' => get_lang('GroupSpace').' '.$group_properties['name']);
$interbreadcrumb[] = array(
'url' => '../group/group_space.php?gidReq='.api_get_group_id(),
'name' => get_lang('GroupSpace').' '.$group_properties['name']
);
$noPHP_SELF = true;
$shortBanner = false;
$add_group_to_title = ' ('.$group_properties['name'].')';
$groupfilter = 'group_id="'.$_clean['group_id'].'"';
// Ensure this tool in groups whe it's private or deactivated
/*if ($group_properties['chat_state'] == 0) {
echo api_not_allowed();
} elseif ($group_properties['chat_state'] == 2) {
if (!api_is_allowed_to_edit(false,true) and !GroupManager :: is_user_in_group($_user['user_id'], $_SESSION['_gid'])) {
echo api_not_allowed();
}
}*/
$groupfilter = 'group_id="'.$groupId.'"';
} else {
$groupfilter = 'group_id=0';
}
//$is_allowed_to_edit = api_is_allowed_to_edit(false, true);
if (empty($open_chat_window)) {
Display::display_header($tool_name, 'Chat');
Display::display_header($tool_name, 'Chat');
}
echo '<iframe src="chat_whoisonline.php?cidReq='.$cidreq.'" name="chat_whoisonline" scrolling="auto" style="height:320px; width:19%; border: 0px none; float:left"></iframe>';
echo '<iframe src="chat_chat.php?origin='.Security::remove_XSS($_GET['origin']).'&target='.Security::remove_XSS($_GET['target']).'&amp;cidReq='.$cidreq.'" name="chat_chat" scrolling="auto" height="240" style="width:80%; border: 0px none; float:right"></iframe>';
echo '<iframe src="chat_chat.php?origin='.$origin.'&target='.$target.'&amp;cidReq='.$cidreq.'" name="chat_chat" scrolling="auto" height="240" style="width:80%; border: 0px none; float:right"></iframe>';
echo '<iframe src="chat_message.php?cidReq='.$cidreq.'" name="chat_message" scrolling="no" height="80" style="width:80%; border: 0px none; float:right"></iframe>';
echo '<iframe src="chat_hidden.php?cidReq='.$cidreq.'" name="chat_hidden" height="0" style="border: 0px none"></iframe>';
if (empty($open_chat_window)) {
Display::display_footer();
Display::display_footer();
}
echo '</html>';

@ -20,52 +20,52 @@ require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
$course = $_GET['cidReq'];
$session_id = intval($_SESSION['id_session']);
$group_id = intval($_SESSION['_gid']);
$session_id = api_get_session_id();
$group_id = api_get_group_id();
// if we have the session set up
if (!empty($course)) {
$reset = (bool)$_GET['reset'];
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$query = "SELECT username FROM $tbl_user WHERE user_id='".intval($_user['user_id'])."'";
$result = Database::query($query);
list($pseudo_user) = Database::fetch_row($result);
$isAllowed = !(empty($pseudo_user) || !$_cid);
$isMaster = (bool)$is_courseAdmin;
$date_now = date('Y-m-d');
$basepath_chat = '';
$document_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
if (!empty($group_id)) {
$group_info = GroupManager :: get_group_properties($group_id);
$basepath_chat = $group_info['directory'].'/chat_files';
} else {
$basepath_chat = '/chat_files';
}
$chat_path = $document_path.$basepath_chat.'/';
$TABLEITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$course_id = api_get_course_int_id();
if (!is_dir($chat_path)) {
if (is_file($chat_path)) {
@unlink($chat_path);
}
if (!api_is_anonymous()) {
@mkdir($chat_path, api_get_permissions_for_new_directories());
// Save chat files document for group into item property
if (!empty($group_id)) {
$doc_id = add_document($_course, $basepath_chat, 'folder', 0, 'chat_files');
$sql = "INSERT INTO $TABLEITEMPROPERTY (c_id, tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility)
VALUES ($course_id, 'document',1,NOW(),NOW(),$doc_id,'FolderCreated',1,$group_id,NULL,0)";
Database::query($sql);
}
}
}
$reset = isset($_GET['reset']) ? (bool)$_GET['reset'] : null;
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$query = "SELECT username FROM $tbl_user WHERE user_id='".intval($_user['user_id'])."'";
$result = Database::query($query);
list($pseudo_user) = Database::fetch_row($result);
$isAllowed = !(empty($pseudo_user) || !$_cid);
$isMaster = (bool)$is_courseAdmin;
$date_now = date('Y-m-d');
$basepath_chat = '';
$document_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
if (!empty($group_id)) {
$group_info = GroupManager :: get_group_properties($group_id);
$basepath_chat = $group_info['directory'].'/chat_files';
} else {
$basepath_chat = '/chat_files';
}
$chat_path = $document_path.$basepath_chat.'/';
$TABLEITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$course_id = api_get_course_int_id();
if (!is_dir($chat_path)) {
if (is_file($chat_path)) {
@unlink($chat_path);
}
if (!api_is_anonymous()) {
@mkdir($chat_path, api_get_permissions_for_new_directories());
// Save chat files document for group into item property
if (!empty($group_id)) {
$doc_id = add_document($_course, $basepath_chat, 'folder', 0, 'chat_files');
$sql = "INSERT INTO $TABLEITEMPROPERTY (c_id, tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility)
VALUES ($course_id, 'document',1,NOW(),NOW(),$doc_id,'FolderCreated',1,$group_id,NULL,0)";
Database::query($sql);
}
}
}
$filename_chat = '';
if (!empty($group_id)) {
@ -146,12 +146,7 @@ if (!empty($course)) {
echo strip_tags(api_html_entity_decode($this_line), '<br> <span> <b> <i> <img> <font>');
}
echo '</div>';
?>
<a name="bottom" style="text-decoration:none;">&nbsp;</a>
<?php
echo '<a name="bottom" style="text-decoration:none;">&nbsp;</a>';
if ($isMaster || $is_courseCoach) {
$rand = mt_rand(1, 1000);
echo '<div style="margin-left: 5px;">';

@ -3,24 +3,24 @@
/**
* @package chamilo.chat
*/
/**
* @author isaac flores paz
* @param integer the user id
* @param string the database name
* @return boolean
* @todo this function need more parameters seems not to be use anymore
* @deprecated fix this function or create another
*/
function user_connected_in_chat ($user_id) {
function user_connected_in_chat ($user_id)
{
$tbl_chat_connected = Database::get_course_table(TABLE_CHAT_CONNECTED);
$user_id = intval($user_id);
$session_id = api_get_session_id();
$group_id = api_get_group_id();
$course_id = api_get_course_int_id();
$group_id = api_get_group_id();
$course_id = api_get_course_int_id();
$extra_condition = '';
if (!empty($group_id)) {
$extra_condition = " AND to_group_id = '$group_id'";
} else {
@ -37,13 +37,14 @@ function user_connected_in_chat ($user_id) {
* @param integer
* @return void
*/
function exit_of_chat($user_id) {
$user_id = intval($user_id);
$list_course = CourseManager::get_courses_list_by_user_id($user_id);
function exit_of_chat($user_id)
{
$user_id = intval($user_id);
$list_course = CourseManager::get_courses_list_by_user_id($user_id);
/*$session_id = api_get_session_id();
$group_id = api_get_group_id();
$group_id = api_get_group_id();
$extra_condition = '';
if (!empty($group_id)) {
$extra_condition = " AND to_group_id = '$group_id'";
@ -51,28 +52,28 @@ function exit_of_chat($user_id) {
$extra_condition = api_get_session_condition($session_id);
}
$extra_condition.= " AND course_id = $course_id";*/
$tbl_chat_connected = Database::get_course_table(TABLE_CHAT_CONNECTED);
foreach ($list_course as $course) {
$response = user_connected_in_chat($user_id);
//if ($response === true) {
$sql = 'DELETE FROM '.$tbl_chat_connected.' WHERE c_id = '.$course['real_id'].' AND user_id = '.$user_id;
Database::query($sql);
//}
}
foreach ($list_course as $course) {
$response = user_connected_in_chat($user_id);
//if ($response === true) {
$sql = 'DELETE FROM '.$tbl_chat_connected.' WHERE c_id = '.$course['real_id'].' AND user_id = '.$user_id;
Database::query($sql);
//}
}
}
/**
* @param string $database_name (optional)
* @return void
*/
function disconnect_user_of_chat() {
function disconnect_user_of_chat()
{
$list_info_user_in_chat = array();
$course_id = api_get_course_int_id();
$list_info_user_in_chat = users_list_in_chat();
$course_id = api_get_course_int_id();
$cd_date = date('Y-m-d',time());
$cdate_h = date('H',time());
$cdate_m = date('i',time());
@ -87,9 +88,10 @@ function disconnect_user_of_chat() {
$date_db_s = date('s', strtotime($list_info_user['last_connection']));
$date_count_time_seconds=$date_db_h*3600 + $date_db_m*60 + $date_db_s;
if ($cd_date == $date_db_date) {
if (($cd_count_time_seconds - $date_count_time_seconds) > 5) {
$tbl_chat_connected = Database::get_course_table(TABLE_CHAT_CONNECTED);
$sql = 'DELETE FROM '.$tbl_chat_connected.' WHERE c_id = '.$course_id.' AND user_id ='.$list_info_user['user_id'];
if (($cd_count_time_seconds - $date_count_time_seconds) > 5) {
$tbl_chat_connected = Database::get_course_table(TABLE_CHAT_CONNECTED);
$sql = 'DELETE FROM '.$tbl_chat_connected.'
WHERE c_id = '.$course_id.' AND user_id ='.$list_info_user['user_id'];
Database::query($sql);
}
}
@ -98,17 +100,17 @@ function disconnect_user_of_chat() {
}
/**
* @param string $database_name (optional)
* @return array user list in chat
*/
function users_list_in_chat() {
function users_list_in_chat()
{
$list_users_in_chat = array();
$tbl_chat_connected = Database::get_course_table(TABLE_CHAT_CONNECTED);
$course_id = api_get_course_int_id();
$session_id = api_get_session_id();
$group_id = api_get_group_id();
$extra_condition = '';
if (!empty($group_id)) {
$extra_condition = " WHERE to_group_id = '$group_id'";
@ -122,4 +124,4 @@ function users_list_in_chat() {
$list_users_in_chat[] = $row;
}
return $list_users_in_chat;
}
}

@ -66,60 +66,60 @@ if (!empty($course) && !empty($_user['user_id'])) {
/* Constants and variables */
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$sent = $_REQUEST['sent'];
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$sent = isset($_REQUEST['sent']) ? $_REQUEST['sent'] : null;
/* MAIN CODE */
/* MAIN CODE */
$query = "SELECT lastname, firstname, username FROM $tbl_user WHERE user_id='".intval($_user['user_id'])."'";
$result = Database::query($query);
$query = "SELECT lastname, firstname, username FROM $tbl_user WHERE user_id='".intval($_user['user_id'])."'";
$result = Database::query($query);
list($pseudo_user) = Database::fetch_row($result);
list($pseudo_user) = Database::fetch_row($result);
$isAllowed = !(empty($pseudo_user) || !$_cid);
$isMaster = (bool)$is_courseAdmin;
$isAllowed = !(empty($pseudo_user) || !$_cid);
$isMaster = (bool)$is_courseAdmin;
$firstname = Database::result($result, 0, 'firstname');
$lastname = Database::result($result, 0, 'lastname');
$firstname = Database::result($result, 0, 'firstname');
$lastname = Database::result($result, 0, 'lastname');
$date_now = date('Y-m-d');
$date_now = date('Y-m-d');
$basepath_chat = '';
$document_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
if (!empty($group_id)) {
$group_info = GroupManager :: get_group_properties($group_id);
$basepath_chat = $group_info['directory'].'/chat_files';
} else {
$basepath_chat = '/chat_files';
}
$chat_path = $document_path.$basepath_chat.'/';
$basepath_chat = '';
$document_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
if (!empty($group_id)) {
$group_info = GroupManager :: get_group_properties($group_id);
$basepath_chat = $group_info['directory'].'/chat_files';
} else {
$basepath_chat = '/chat_files';
}
$chat_path = $document_path.$basepath_chat.'/';
if (!is_dir($chat_path)) {
if (is_file($chat_path)) {
@unlink($chat_path);
}
}
if (!is_dir($chat_path)) {
if (is_file($chat_path)) {
@unlink($chat_path);
}
}
require 'header_frame.inc.php';
$chat_size = 0;
require 'header_frame.inc.php';
$chat_size = 0;
// Define emoticons
$emoticon_text1 = ':-)';
$emoticon_img1 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_smile.gif" alt="'.get_lang('Smile').'" title="'.get_lang('Smile').'" />';
$emoticon_text2 = ':-D';
$emoticon_img2 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_biggrin.gif" alt="'.get_lang('BigGrin').'" title="'.get_lang('BigGrin').'" />';
$emoticon_text3 = ';-)';
$emoticon_img3 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_wink.gif" alt="'.get_lang('Wink').'" title="'.get_lang('Wink').'" />';
$emoticon_text4 = ':-P';
$emoticon_img4 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_razz.gif" alt="'.get_lang('Avid').'" title="'.get_lang('Avid').'" />';
$emoticon_text5 = '8-)';
$emoticon_img5 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_cool.gif" alt="'.get_lang('Cool').'" title="'.get_lang('Cool').'" />';
$emoticon_text6 = ':-o)';
$emoticon_img6 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_surprised.gif" alt="'.get_lang('Surprised').'" title="'.get_lang('Surprised').'" />';
$emoticon_text7 = '=;';
$emoticon_img7 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_hand.gif" alt="'.get_lang('Hand').'" title="'.get_lang('Hand').'" />';
$emoticon_text8 = '=8-o';
$emoticon_img8 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_eek.gif" alt="'.get_lang('Amazing').'" title="'.get_lang('Amazing').'" />';
$emoticon_text1 = ':-)';
$emoticon_img1 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_smile.gif" alt="'.get_lang('Smile').'" title="'.get_lang('Smile').'" />';
$emoticon_text2 = ':-D';
$emoticon_img2 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_biggrin.gif" alt="'.get_lang('BigGrin').'" title="'.get_lang('BigGrin').'" />';
$emoticon_text3 = ';-)';
$emoticon_img3 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_wink.gif" alt="'.get_lang('Wink').'" title="'.get_lang('Wink').'" />';
$emoticon_text4 = ':-P';
$emoticon_img4 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_razz.gif" alt="'.get_lang('Avid').'" title="'.get_lang('Avid').'" />';
$emoticon_text5 = '8-)';
$emoticon_img5 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_cool.gif" alt="'.get_lang('Cool').'" title="'.get_lang('Cool').'" />';
$emoticon_text6 = ':-o)';
$emoticon_img6 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_surprised.gif" alt="'.get_lang('Surprised').'" title="'.get_lang('Surprised').'" />';
$emoticon_text7 = '=;';
$emoticon_img7 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_hand.gif" alt="'.get_lang('Hand').'" title="'.get_lang('Hand').'" />';
$emoticon_text8 = '=8-o';
$emoticon_img8 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_eek.gif" alt="'.get_lang('Amazing').'" title="'.get_lang('Amazing').'" />';
$emoticon_text9 = ':-|)';
$emoticon_img9 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/icon_neutral.gif" alt="'.get_lang('Neutral').'" title="'.get_lang('Neutral').'" />';
$emoticon_text8 = ':-k';
@ -276,4 +276,4 @@ if (!empty($course) && !empty($_user['user_id'])) {
</form>
<?php
}
require 'footer_frame.inc.php';
require 'footer_frame.inc.php';

@ -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';

@ -36,8 +36,6 @@ if (empty($mycourseid)) {
*/
$my_style = api_get_visual_theme();
?><!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Loading…
Cancel
Save