Fixing whoisonline due recent changes in templates

skala
Julio Montoya 12 years ago
parent a19561bfd1
commit 4bc0525d3e
  1. 66
      whoisonline.php
  2. 42
      whoisonlinesession.php

@ -29,7 +29,7 @@ $this_section = SECTION_SOCIAL;
// table definitions
$track_user_table = Database::get_main_table(TABLE_MAIN_USER);
$htmlHeadXtra[] = '<script>
function show_image(image,width,height) {
width = parseInt(width) + 20;
height = parseInt(height) + 20;
@ -56,16 +56,16 @@ function hide_display_message () {
$("#txt_area_invite").val("");
}
}
function show_icon_edit(element_html) {
function show_icon_edit(element_html) {
ident="#edit_image";
$(ident).show();
}
}
function hide_icon_edit(element_html) {
ident="#edit_image";
$(ident).hide();
}
}
$(document).ready(function() {
@ -73,12 +73,12 @@ $(document).ready(function() {
page = $("#link_load_more_items").attr("data_link");
$.ajax({
beforeSend: function(objeto) {
$("#display_response_id").html("'.addslashes(get_lang('Loading')).'");
$("#display_response_id").html("'.addslashes(get_lang('Loading')).'");
},
type: "GET",
url: "main/inc/ajax/online.ajax.php?a=load_online_user",
data: "online_page_nr="+page,
success: function(data) {
success: function(data) {
$("#display_response_id").html("");
if (data != "end") {
$("#link_load_more_items").remove();
@ -88,9 +88,9 @@ $(document).ready(function() {
$("#link_load_more_items").remove();
}
}
});
});
});
});
});
</script>';
@ -102,7 +102,7 @@ if ($_GET['chatid'] != '') {
if ($_GET['chatid'] == strval(intval($_GET['chatid']))) {
$sql = "UPDATE $track_user_table SET chatcall_user_id = '".Database::escape_string($_user['user_id'])."', chatcall_date = '".Database::escape_string($time)."', chatcall_text = '' where (user_id = ".(int)Database::escape_string($chatid).")";
$result = Database::query($sql);
//redirect caller to chat
//redirect caller to chat
header("Location: ".api_get_path(WEB_CODE_PATH)."chat/chat.php?".api_get_cidreq()."&origin=whoisonline&target=".Security::remove_XSS($chatid));
exit;
}
@ -114,39 +114,39 @@ if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) ||
if(isset($_GET['cidReq']) && strlen($_GET['cidReq']) > 0 ) {
$user_list = who_is_online_in_this_course(0, 9, api_get_user_id(), api_get_setting('time_limit_whosonline'), $_GET['cidReq']);
} else {
$user_list = who_is_online(0, 9);
$user_list = who_is_online(0, 9);
}
if (!isset($_GET['id'])) {
if (!isset($_GET['id'])) {
if (api_get_setting('allow_social_tool') == 'true') {
if (!api_is_anonymous()) {
if (!api_is_anonymous()) {
//this include the social menu div
$social_left_content = SocialManager::show_social_menu('whoisonline');
}
$social_left_content = SocialManager::show_social_menu('whoisonline');
}
}
}
if ($user_list) {
if (!isset($_GET['id'])) {
if (api_get_setting('allow_social_tool') == 'true') {
if (api_get_setting('allow_social_tool') == 'true') {
if (!api_is_anonymous()) {
$query = isset($_GET['q']) ? $_GET['q']: null;
$query = isset($_GET['q']) ? $_GET['q']: null;
$social_right_content .= '<div class="span9">'.UserManager::get_search_form($query).'</div>';
}
}
$social_right_content .= SocialManager::display_user_list($user_list);
}
$social_right_content .= SocialManager::display_user_list($user_list);
}
}
if (isset($_GET['id'])) {
if (api_get_setting('allow_social_tool') == 'true') {
if (isset($_GET['id'])) {
if (api_get_setting('allow_social_tool') == 'true') {
header("Location: ".api_get_path(WEB_CODE_PATH)."social/profile.php?u=".intval($_GET['id']));
exit;
} else {
SocialManager::display_individual_user($_GET['id']);
SocialManager::display_individual_user($_GET['id']);
}
}
} else {
} else {
api_not_allowed();
exit;
}
@ -154,17 +154,13 @@ if ((api_get_setting('showonline', 'world') == 'true' && !$_user['user_id']) ||
$tpl = new Template(get_lang('UsersOnLineList'));
if (api_get_setting('allow_social_tool') == 'true' && !api_is_anonymous()) {
$tpl->set_help('Groups');
$tpl->assign('social_left_content', $social_left_content);
//$tpl->assign('social_left_menu', $social_left_menu);
$tpl->assign('social_right_content', $social_right_content);
$social_layout = $tpl->get_template('layout/social_layout.tpl');
$content = $tpl->fetch($social_layout);
$tpl->display($social_layout);
} else {
$content = $social_right_content;
}
$tpl->assign('actions', $actions);
$tpl->assign('message', $show_message);
$tpl->assign('header', get_lang('UsersOnLineList'));
$tpl->assign('content', $content);
$tpl->display_one_col_template();
$tpl->assign('header', get_lang('UsersOnLineList'));
$tpl->assign('content', $social_right_content);
$tpl->display_one_col_template();
}

@ -1,5 +1,5 @@
<?php
/* For licensing terms, see /dokeos_license.txt */
/* For licensing terms, see /license.txt */
/**
* Shows who is online in a specific session
* @package chamilo.main
@ -32,7 +32,7 @@ echo Display::page_header(get_lang('UserOnlineListSession'));
?>
<br /><br />
<table class="data_table">
<table class="data_table">
<tr>
<th>
<?php echo get_lang('Name'); ?>
@ -50,43 +50,15 @@ echo Display::page_header(get_lang('UserOnlineListSession'));
<?php
$session_is_coach = array();
if (isset($_user['user_id']) && $_user['user_id'] != '') {
/*$_user['user_id'] = intval($_user['user_id']);
$result = Database::query("SELECT DISTINCT id,
name,
date_start,
date_end
FROM $tbl_session as session
INNER JOIN $tbl_session_course_user as srcru
ON srcru.id_user = ".$_user['user_id']." AND srcru.status=2
AND session.id = srcru.id_session
ORDER BY date_start, date_end, name");
while ($session = Database:: fetch_array($result)) {
$session_is_coach[$session['id']] = $session;
}
$result = Database::query("SELECT DISTINCT id,
name,
date_start,
date_end
FROM $tbl_session as session
WHERE session.id_coach = ".$_user['user_id']."
ORDER BY date_start, date_end, name");
while ($session = Database:: fetch_array($result)) {
$session_is_coach[$session['id']] = $session;
}*/
$session_is_coach = SessionManager::get_sessions_coached_by_user(api_get_user_id());
$students_online = array();
$now = api_get_utc_datetime();
$time_limit = api_get_setting('time_limit_whosonline');
$online_time = time() - $time_limit*60;
$current_date = api_get_utc_datetime($online_time);
foreach ($session_is_coach as $session) {
$current_date = api_get_utc_datetime($online_time);
foreach ($session_is_coach as $session) {
$sql = "SELECT DISTINCT last_access.access_user_id,
last_access.access_date,
last_access.access_cours_code,
@ -123,7 +95,7 @@ echo Display::page_header(get_lang('UserOnlineListSession'));
echo " </td>
<td align='center'>
";
echo '<a target="_blank" class="btn" href="main/chat/chat.php?cidReq='.$student_online['access_cours_code'].'&id_session='.$student_online['access_session_id'].'">
echo '<a target="_blank" class="btn" href="main/chat/chat.php?cidReq='.$student_online['access_cours_code'].'&id_session='.$student_online['access_session_id'].'">
'.get_lang('Chat').'
</a>';
echo " </td>

Loading…
Cancel
Save