Feature #272 - Chat tool: Applying coding conventions and cleaning before making essential changes.

skala
Ivan Tcholakov 15 years ago
parent 91f2c0ab11
commit faa33a435e
  1. 72
      main/chat/chat.php
  2. 56
      main/chat/chat_banner.php
  3. 115
      main/chat/chat_chat.php
  4. 32
      main/chat/chat_footer.php
  5. 60
      main/chat/chat_functions.lib.php
  6. 78
      main/chat/chat_hidden.php
  7. 143
      main/chat/chat_message.php
  8. 100
      main/chat/chat_whoisonline.php
  9. 28
      main/chat/footer_frame.inc.php
  10. 68
      main/chat/header_frame.inc.php

@ -1,33 +1,11 @@
<?php // $Id: chat.php 22201 2009-07-17 19:57:03Z cfasanando $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Olivier Brouckaert
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
<?php
/* For licensing terms, see /license.txt */
See the GNU General Public License for more details.
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/**
==============================================================================
* Frameset of the Chat tool
*
* @author Olivier Brouckaert
* @package dokeos.chat
==============================================================================
* @package chamilo.chat
*/
$language_file = array('chat');
@ -35,53 +13,44 @@ $language_file = array ('chat');
require_once '../inc/global.inc.php';
$nameTools = get_lang('ToolChat');
if ($_GET["origin"] != 'whoisonline') {
api_protect_course_script(true);
}
else
{
} else {
$origin = $_SESSION['origin'];
$target = $_SESSION['target'];
$_SESSION['origin']=$_GET["origin"];
$_SESSION['target']=$_GET["target"];
}
/* ==============================================================================
TRACKING
============================================================================== */
event_access_tool(TOOL_CHAT);
/* TRACKING */
header('Content-Type: text/html; charset='. $charset);
event_access_tool(TOOL_CHAT);
header('Content-Type: text/html; charset='.api_get_system_encoding());
/*
* Choose CSS style (platform's, user's, or course's)
*/
$platform_theme = api_get_setting('stylesheets'); // plataform's css
$my_style = $platform_theme;
if(api_get_setting('user_selected_theme') == 'true')
{
if (api_get_setting('user_selected_theme') == 'true') {
$useri = api_get_user_info();
$user_theme = $useri['theme'];
if(!empty($user_theme) && $user_theme != $my_style)
{
if (!empty($user_theme) && $user_theme != $my_style) {
$my_style = $user_theme; // user's css
}
}
$mycourseid = api_get_course_id();
if (!empty($mycourseid) && $mycourseid != -1)
{
if (api_get_setting('allow_course_theme') == 'true')
{
if (!empty($mycourseid) && $mycourseid != -1) {
if (api_get_setting('allow_course_theme') == 'true') {
$mycoursetheme = api_get_course_setting('course_theme');
if (!empty($mycoursetheme) && $mycoursetheme!=-1)
{
if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
{
if (!empty($mycoursetheme) && $mycoursetheme != -1) {
if (!empty($mycoursetheme) && $mycoursetheme != $my_style) {
$my_style = $mycoursetheme; // course's css
}
}
}
$open_chat_window = api_get_course_setting('allow_open_chat_window');
}
@ -90,6 +59,7 @@ if (api_get_setting('show_navigation_menu')!='false') {
} else {
switch($my_style) {
case 'dokeos_classic' :
case 'chamilo_classic' :
$footer_size = 48;
break;
case 'academica' :
@ -112,11 +82,10 @@ if (api_get_setting('show_navigation_menu')!='false') {
$cidreq = $_GET['cidReq'];
echo '<html><head>';
echo '<meta http-equiv="Content-Type" content="text/html; charset='.$charset.'" />';
echo '<meta http-equiv="Content-Type" content="text/html; charset='.api_get_system_encoding().'" />';
echo'<title>'.get_lang('Chat').' - '.$mycourseid.' - '.api_get_setting('siteName').'</title>';
if (empty($open_chat_window))
{
if (empty($open_chat_window)) {
echo'<frameset rows="135,*,'.$footer_size.'" border="0" frameborder="0" framespacing="1">';
echo '<frame src="chat_banner.php?cidReq='.$cidreq.'" name="chat_banner" scrolling="no">';
}
@ -135,13 +104,10 @@ echo '<frame src="chat_hidden.php?cidReq='.$cidreq.'" name="chat_hidden" >';
echo'</frameset>';
if (api_get_setting('show_navigation_menu') == 'false') {
if (empty($open_chat_window))
{
if (empty($open_chat_window)) {
echo '<frame src="chat_footer.php?cidReq='.$cidreq.'" name="chat_footer" scrolling="no">';
echo '</frameset>';
}
}
echo'<noframes></noframes>';
echo '</html>';
?>

@ -1,44 +1,22 @@
<?php // $Id: chat_banner.php,v 1.3 2005/06/06 13:01:23 olivierb78 Exp $
/*
==============================================================================
Dokeos - elearning and course management software
<?php
/* For licensing terms, see /license.txt */
Copyright (c) 2004 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Olivier Brouckaert
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/**
==============================================================================
* Dokeos banner
* Chamilo banner
*
* @author Olivier Brouckaert
* @package dokeos.chat
==============================================================================
* @chamilo chamilo.chat
*/
$language_file = array ('chat');
require_once '../inc/global.inc.php';
$this_section=SECTION_COURSES;
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
$this_section = SECTION_COURSES;
//$interbreadcrumb[] = array ("url" => "chat.php", "name" => get_lang("Chat"));
//$interbreadcrumb[] = array ('url' => 'chat.php', 'name' => get_lang('Chat'));
//$noPHP_SELF = true;
//$shortBanner = false;
//Display::display_header(null,"Chat");
//Display::display_header(null, 'Chat');
$tool_name = get_lang('ToolChat');
@ -53,29 +31,23 @@ if ($_SESSION['_gid'] OR $_GET['group_id']) {
}
$group_properties = GroupManager :: get_group_properties($_clean['group_id']);
$interbreadcrumb[] = array ("url" => "../group/group.php", "name" => get_lang('Groups'));
$interbreadcrumb[] = array ("url"=>"../group/group_space.php?gidReq=".$_SESSION['_gid'], "name"=> get_lang('GroupSpace').' ('.$group_properties['name'].')');
$interbreadcrumb[] = array('url' => '../group/group.php', 'name' => get_lang('Groups'));
$interbreadcrumb[] = array('url' => '../group/group_space.php?gidReq='.$_SESSION['_gid'], '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)
{
// 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']))
{
} 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();
}
}*/
}
else
{
} else {
$groupfilter = 'group_id=0';
}
Display::display_header($tool_name, 'Chat');

@ -1,33 +1,11 @@
<?php // $Id: chat_chat.php,v 1.10 2005/05/18 13:58:10 bvanderkimpen Exp $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Olivier Brouckaert
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
<?php
/* For licensing terms, see /license.txt */
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/**
==============================================================================
* Chat frame that shows the message list
*
* @author Olivier Brouckaert
* @package dokeos.chat
==============================================================================
* @package chamilo.chat
*/
define('FRAME', 'chat');
@ -44,41 +22,37 @@ $session_id = intval($_SESSION['id_session']);
$group_id = intval($_SESSION['_gid']);
// if we have the session set up
if (!empty($course))
{
$reset=$_GET['reset']?true:false;
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='".$_user['user_id']."'";
$result = Database::query($query);
list($pseudoUser)=Database::fetch_row($result);
$isAllowed=(empty($pseudoUser) || !$_cid)?false:true;
$isMaster=$is_courseAdmin?true:false;
list($pseudo_user) = Database::fetch_row($result);
$isAllowed = !(empty($pseudo_user) || !$_cid);
$isMaster = (bool)$is_courseAdmin;
$dateNow=date('Y-m-d');
$date_now = date('Y-m-d');
$basepath_chat = '';
$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$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';
}
$chatPath=$documentPath.$basepath_chat.'/';
$chat_path = $document_path.$basepath_chat.'/';
$TABLEITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
if(!is_dir($chatPath))
{
if(is_file($chatPath))
{
@unlink($chatPath);
if (!is_dir($chat_path)) {
if (is_file($chat_path)) {
@unlink($chat_path);
}
if (!api_is_anonymous()) {
@mkdir($chatPath, api_get_permissions_for_new_directories());
@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');
@ -91,16 +65,15 @@ if (!empty($course))
$filename_chat = '';
if (!empty($group_id)) {
$filename_chat = 'messages-'.$dateNow.'_gid-'.$group_id.'.log.html';
$filename_chat = 'messages-'.$date_now.'_gid-'.$group_id.'.log.html';
} else if (!empty($session_id)) {
$filename_chat = 'messages-'.$dateNow.'_sid-'.$session_id.'.log.html';
$filename_chat = 'messages-'.$date_now.'_sid-'.$session_id.'.log.html';
} else {
$filename_chat = 'messages-'.$dateNow.'.log.html';
$filename_chat = 'messages-'.$date_now.'.log.html';
}
if(!file_exists($chatPath.$filename_chat))
{
@fclose(fopen($chatPath.$filename_chat,'w'));
if (!file_exists($chat_path.$filename_chat)) {
@fclose(fopen($chat_path.$filename_chat, 'w'));
if (!api_is_anonymous()) {
$doc_id = add_document($_course, $basepath_chat.'/'.$filename_chat, 'file', 0, $filename_chat);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $group_id, null, null, null, $session_id);
@ -111,27 +84,25 @@ if (!empty($course))
$basename_chat = '';
if (!empty($group_id)) {
$basename_chat = 'messages-'.$dateNow.'_gid-'.$group_id;
$basename_chat = 'messages-'.$date_now.'_gid-'.$group_id;
} else if (!empty($session_id)) {
$basename_chat = 'messages-'.$dateNow.'_sid-'.$session_id;
$basename_chat = 'messages-'.$date_now.'_sid-'.$session_id;
} else {
$basename_chat = 'messages-'.$dateNow;
$basename_chat = 'messages-'.$date_now;
}
if($reset && $isMaster)
{
if ($reset && $isMaster) {
$i = 1;
while(file_exists($chatPath.$basename_chat.'-'.$i.'.log.html'))
{
while (file_exists($chat_path.$basename_chat.'-'.$i.'.log.html')) {
$i++;
}
@rename($chatPath.$basename_chat.'.log.html',$chatPath.$basename_chat.'-'.$i.'.log.html');
@rename($chat_path.$basename_chat.'.log.html', $chat_path.$basename_chat.'-'.$i.'.log.html');
@fclose(fopen($chatPath.$basename_chat.'.log.html','w'));
@fclose(fopen($chat_path.$basename_chat.'.log.html', 'w'));
$doc_id=add_document($_course,$basepath_chat.'/'.$basename_chat.'-'.$i.'.log.html','file',filesize($chatPath.$basename_chat.'-'.$i.'.log.html'),$basename_chat.'-'.$i.'.log.html');
$doc_id = add_document($_course, $basepath_chat.'/'.$basename_chat.'-'.$i.'.log.html', 'file', filesize($chat_path.$basename_chat.'-'.$i.'.log.html'), $basename_chat.'-'.$i.'.log.html');
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $group_id, null, null, null, $session_id);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', $_user['user_id'], $group_id, null, null, null, $session_id);
@ -142,30 +113,28 @@ if (!empty($course))
update_existing_document($_course, $doc_id, 0);
}
$content=file($chatPath.$basename_chat.'.log.html');
$content = file($chat_path.$basename_chat.'.log.html');
$nbr_lines = sizeof($content);
$remove = $nbr_lines - 100;
if($remove < 0)
{
if ($remove < 0) {
$remove = 0;
}
array_splice($content, 0, $remove);
include('header_frame.inc.php');
require 'header_frame.inc.php';
if ($_GET["origin"]=='whoisonline') { //the caller
$content[0]=get_lang('CallSent').'<br>'.$content[0];
if ($_GET['origin'] == 'whoisonline') { //the caller
$content[0] = get_lang('CallSent').'<br />'.$content[0];
}
if ($_GET["origin"]=='whoisonlinejoin') { //the joiner (we have to delete the chat request to him when he joins the chat)
if ($_GET['origin'] == 'whoisonlinejoin') { //the joiner (we have to delete the chat request to him when he joins the chat)
$track_user_table = Database::get_main_table(TABLE_MAIN_USER);
$sql = "update $track_user_table set chatcall_user_id = '', chatcall_date = '', chatcall_text='' where (user_id = ".$_user['user_id'].")";
$result = Database::query($sql);
}
echo '<div style="margin-left: 5px;">';
foreach($content as $thisLine)
{
foreach ($content as & $thisLine) {
echo strip_tags(api_html_entity_decode($thisLine), '<br> <span> <b> <i> <img> <font>');
}
echo '</div>';
@ -175,19 +144,15 @@ if (!empty($course))
<a name="bottom" style="text-decoration:none;">&nbsp;</a>
<?php
if($isMaster || $is_courseCoach)
{
if ($isMaster || $is_courseCoach) {
$rand = mt_rand(1, 1000);
echo '<div style="margin-left: 5px;">';
echo '<a href="'.api_get_self().'?rand='.$rand.'&reset=1&cidReq='.$_GET['cidReq'].'#bottom" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmReset'),ENT_QUOTES,$charset)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('ClearList')).' '.get_lang('ClearList').'</a>';
echo '<a href="'.api_get_self().'?rand='.$rand.'&reset=1&cidReq='.$_GET['cidReq'].'#bottom" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmReset'), ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('ClearList')).' '.get_lang('ClearList').'</a>';
echo '</div>';
}
}
else
{
include('header_frame.inc.php');
} else {
require 'header_frame.inc.php';
$message = get_lang('CloseOtherSession');
Display :: display_error_message($message);
}
include('footer_frame.inc.php');
?>
require 'footer_frame.inc.php';

@ -1,4 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
require_once '../inc/global.inc.php';
@ -12,43 +13,28 @@ echo '<html><head><style>';
$platform_theme = api_get_setting('stylesheets'); // plataform's css
$my_style = $platform_theme;
if(api_get_setting('user_selected_theme') == 'true')
{
if (api_get_setting('user_selected_theme') == 'true') {
$useri = api_get_user_info();
$user_theme = $useri['theme'];
if(!empty($user_theme) && $user_theme != $my_style)
{
if (!empty($user_theme) && $user_theme != $my_style) {
$my_style = $user_theme; // user's css
}
}
$mycourseid = api_get_course_id();
if (!empty($mycourseid) && $mycourseid != -1)
{
if (api_get_setting('allow_course_theme') == 'true')
{
if (!empty($mycourseid) && $mycourseid != -1) {
if (api_get_setting('allow_course_theme') == 'true') {
$mycoursetheme = api_get_course_setting('course_theme');
if (!empty($mycoursetheme) && $mycoursetheme!=-1)
{
if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
{
if (!empty($mycoursetheme) && $mycoursetheme != -1) {
if (!empty($mycoursetheme) && $mycoursetheme != $my_style) {
$my_style = $mycoursetheme; // course's css
}
}
}
}
echo '@import "'.api_get_path(WEB_CODE_PATH).'css/'.$my_style.'/default.css'.'";';
echo '@import "'.api_get_path(WEB_CSS_PATH).$my_style.'/default.css'.'";';
echo '</style></head><body><br>';
/*
==============================================================================
FOOTER
==============================================================================
*/
echo '</style></head><body><br />';
Display::display_footer();
?>

@ -1,27 +1,6 @@
<?php
/*
==============================================================================
Dokeos - elearning and course management software
/* For licensing terms, see /license.txt */
Copyright (c) 2004-2008 Dokeos SPRL
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) various contributors
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
Mail: info@dokeos.com
==============================================================================
*/
/**
* @author isaac flores paz
* @param integer
@ -34,8 +13,11 @@ function exit_of_chat ($user_id) {
$group_id = intval($_SESSION['id_group']);
$session_id = intval($_SESSION['id_session']);
$extra_condition = '';
if (!empty($group_id)) $extra_condition = " AND to_group_id = '$group_id'";
else $extra_condition = api_get_session_condition($session_id);
if (!empty($group_id)) {
$extra_condition = " AND to_group_id = '$group_id'";
} else {
$extra_condition = api_get_session_condition($session_id);
}
foreach ($list_course as $courses) {
$response = user_connected_in_chat($user_id,$courses['db_name']);
@ -45,8 +27,8 @@ function exit_of_chat ($user_id) {
Database::query($sql);
}
}
}
/**
* @author isaac flores paz
* @param integer the user id
@ -59,20 +41,20 @@ function user_connected_in_chat ($user_id,$database_name) {
$group_id = intval($_SESSION['id_group']);
$session_id = intval($_SESSION['id_session']);
$extra_condition = '';
if (!empty($group_id)) $extra_condition = " AND to_group_id = '$group_id'";
else $extra_condition = api_get_session_condition($session_id);
if (!empty($group_id)) {
$extra_condition = " AND to_group_id = '$group_id'";
} else {
$extra_condition = api_get_session_condition($session_id);
}
$sql = 'SELECT COUNT(*) AS count FROM '.$tbl_chat_connected .' c WHERE user_id='.$user_id.$extra_condition;
$result = Database::query($sql);
$count = Database::fetch_array($result,'ASSOC');
if (1==$count['count']) {
return true;
} else {
return false;
}
return $count['count'] == 1;
}
/**
* @param void
* @param string $database_name (optional)
* @return void
*/
function disconnect_user_of_chat($database_name = '') {
@ -91,7 +73,6 @@ function disconnect_user_of_chat($database_name='') {
$cdate_s = date('s',time());
$cd_count_time_seconds = $cdate_h*3600 + $cdate_m*60 + $cdate_s;
if (is_array($list_info_user_in_chat) && count($list_info_user_in_chat) > 0 ) {
foreach ($list_info_user_in_chat as $list_info_user) {
$date_db_date = date('Y-m-d', strtotime($list_info_user['last_connection']));
@ -108,7 +89,6 @@ function disconnect_user_of_chat($database_name='') {
}
$sql = 'DELETE FROM '.$tbl_chat_connected.' WHERE user_id='.$list_info_user['user_id'];
//return $sql;
Database::query($sql);
}
}
@ -117,7 +97,7 @@ function disconnect_user_of_chat($database_name='') {
}
/**
* @param void
* @param string $database_name (optional)
* @return array user list in chat
*/
function users_list_in_chat ($database_name = '') {
@ -126,8 +106,11 @@ function users_list_in_chat ($database_name = '') {
$group_id = intval($_SESSION['id_group']);
$session_id = intval($_SESSION['id_session']);
$extra_condition = '';
if (!empty($group_id)) $extra_condition = " WHERE to_group_id = '$group_id'";
else $extra_condition = api_get_session_condition($session_id,false);
if (!empty($group_id)) {
$extra_condition = " WHERE to_group_id = '$group_id'";
} else{
$extra_condition = api_get_session_condition($session_id, false);
}
$sql = 'SELECT user_id,last_connection FROM '.$tbl_chat_connected.$extra_condition;
$result = Database::query($sql);
while ($row = Database::fetch_array($result, 'ASSOC')) {
@ -135,4 +118,3 @@ function users_list_in_chat ($database_name = '') {
}
return $list_users_in_chat;
}
?>

@ -1,33 +1,11 @@
<?php // $Id: chat_hidden.php,v 1.8 2005/05/01 11:49:16 darkden81 Exp $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Olivier Brouckaert
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
<?php
/* For licensing terms, see /license.txt */
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/**
==============================================================================
* Hidden frame that refreshes the visible frames when a modification occurs
*
* @author Olivier Brouckaert
* @package dokeos.chat
==============================================================================
* @package chamilo.chat
*/
define('FRAME', 'hidden');
@ -38,25 +16,23 @@ require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'course.lib.php';
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
require_once 'chat_functions.lib.php';
//$tbl_user=$mainDbName."`.`user";
//$tbl_chat_connected=$_course['dbNameGlu'].'chat_connected';
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$tbl_chat_connected = Database::get_course_chat_connected_table();
$query = "SELECT username FROM $tbl_user WHERE user_id='".$_user['user_id']."'";
$result = Database::query($query);
list($pseudoUser)=Database::fetch_row($result);
list($pseudo_user) = Database::fetch_row($result);
$isAllowed=(empty($pseudoUser) || !$_cid)?false:true;
$isMaster=$is_courseAdmin?true:false;
$isAllowed = !(empty($pseudo_user) || !$_cid);
$isMaster = (bool)$is_courseAdmin;
/*if(!$isAllowed)
{
/*if(!$isAllowed) {
exit();
}*/
$dateNow=date('Y-m-d');
$date_now = date('Y-m-d');
$group_id = intval($_SESSION['_gid']);
$session_id = intval($_SESSION['id_session']);
@ -71,27 +47,27 @@ if (!empty($group_id)) {
}
// get chat path
$chatPath = '';
$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$chat_path = '';
$document_path = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
if (!empty($group_id)) {
$group_info = GroupManager :: get_group_properties($group_id);
$chatPath=$documentPath.$group_info['directory'].'/chat_files/';
$chat_path = $document_path.$group_info['directory'].'/chat_files/';
} else {
$chatPath=$documentPath.'/chat_files/';
$chat_path = $document_path.'/chat_files/';
}
// get chat file
$basename_chat = '';
if (!empty($group_id)) {
$basename_chat = 'messages-'.$dateNow.'_gid-'.$group_id;
$basename_chat = 'messages-'.$date_now.'_gid-'.$group_id;
} elseif (!empty($session_id)) {
$basename_chat = 'messages-'.$dateNow.'_sid-'.$session_id;
$basename_chat = 'messages-'.$date_now.'_sid-'.$session_id;
} else {
$basename_chat = 'messages-'.$dateNow;
$basename_chat = 'messages-'.$date_now;
}
$chat_size_old = intval($_POST['chat_size_old']);
$chat_size_new=filesize($chatPath.$basename_chat.'.log.html');
$chat_size_new = filesize($chat_path.$basename_chat.'.log.html');
$sql = "SELECT user_id FROM $tbl_chat_connected WHERE user_id='".$_user['user_id']."' $extra_condition";
$result = Database::query($sql);
@ -113,20 +89,17 @@ $connected_old=intval($_POST['connected_old']);
list($connected_new) = Database::fetch_row($result);
/*disconnected user of chat*/
disconnect_user_of_chat ();
include("header_frame.inc.php");
require 'header_frame.inc.php';
//navigation menu
if(api_get_setting('show_navigation_menu') != 'false')
{
// Navigation menu
if (api_get_setting('show_navigation_menu') != 'false') {
$course_id = api_get_course_id();
if ( !empty($course_id) && ($course_id != -1) )
{
if( api_get_setting('show_navigation_menu') != 'icons')
{
if (!empty($course_id) && ($course_id != -1)) {
if (api_get_setting('show_navigation_menu') != 'icons') {
echo '</div> <!-- end #center -->';
echo '</div> <!-- end #centerwrap -->';
}
require_once(api_get_path(INCLUDE_PATH).'tool_navigation_menu.inc.php');
require_once api_get_path(INCLUDE_PATH).'tool_navigation_menu.inc.php';
show_navigation_menu();
}
}
@ -146,11 +119,10 @@ if ($_SESSION["origin"] == 'whoisonline') { //check if our target has denied ou
$result = Database::query($sql);
$row = Database::fetch_array($result);
if ($row['chatcall_text'] == 'DENIED') {
echo "<script language=javascript> alert('".get_lang('ChatDenied')."'); </script>";
echo "<script language=\"javascript\" type=\"text/javascript\"> alert('".get_lang('ChatDenied')."'); </script>";
$sql = "update $track_user_table set chatcall_user_id = '', chatcall_date = '', chatcall_text='' where (user_id = $talk_to)";
$result = Database::query($sql);
}
}
include('footer_frame.inc.php');
?>
require 'footer_frame.inc.php';

@ -1,40 +1,14 @@
<?php // $Id: chat_message.php,v 1.11 2005/05/18 13:58:20 bvanderkimpen Exp $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Olivier Brouckaert
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
<?php
/* For licensing terms, see /license.txt */
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/**
==============================================================================
* Allows to type the messages that will be displayed on chat_chat.php
*
* @author Olivier Brouckaert
* @package dokeos.chat
==============================================================================
* @package chamilo.chat
*/
/*
==============================================================================
INIT SECTION
==============================================================================
*/
/* INIT SECTION */
define('FRAME', 'message');
@ -46,9 +20,8 @@ $course=api_get_course_id();
$session_id = intval($_SESSION['id_session']);
$group_id = intval($_SESSION['_gid']);
/////
// Juan Carlos Raña insert smileys and self-closing window
////
// Juan Carlos Raña inserted smileys and self-closing window.
?>
<script language="javascript" type="text/javascript">
function insert_smile(text) {
@ -72,74 +45,62 @@ function close_chat_window() {
chat_window.opener = top.window.self;
chat_window.top.close();
}
</script>
<?php
// mode open in a new window: close the window when there isn't an user login
// Mode open in a new window: close the window when there isn't an user login
if(empty($_user['user_id']))
{
echo '<script languaje="javascript"> close_chat_window() </script>';
}
else
{
if (empty($_user['user_id'])) {
echo '<script languaje="javascript" type="text/javascript"> close_chat_window(); </script>';
} else {
api_protect_course_script();
}
// if we have the session set up
if (!empty($course) && !empty($_user['user_id']))
{
include_once(api_get_path(LIBRARY_PATH).'document.lib.php');
include_once(api_get_path(LIBRARY_PATH).'text.lib.php');
include_once (api_get_path(LIBRARY_PATH).'fileUpload.lib.php');
/*
-----------------------------------------------------------
Constants and variables
-----------------------------------------------------------
*/
if (!empty($course) && !empty($_user['user_id'])) {
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
require_once api_get_path(LIBRARY_PATH).'text.lib.php';
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
/* Constants and variables */
$tbl_user = Database::get_main_table(TABLE_MAIN_USER);
$sent = $_REQUEST['sent'];
/*
==============================================================================
MAIN CODE
==============================================================================
*/
/* MAIN CODE */
$query = "SELECT lastname, firstname, username FROM $tbl_user WHERE user_id='".$_user['user_id']."'";
$result = Database::query($query);
list($pseudoUser)=Database::fetch_row($result);
list($pseudo_user) = Database::fetch_row($result);
$isAllowed=(empty($pseudoUser) || !$_cid)?false:true;
$isMaster=$is_courseAdmin?true:false;
$isAllowed = !(empty($pseudo_user) || !$_cid);
$isMaster = (bool)$is_courseAdmin;
$firstname = Database::result($result, 0, 'firstname');
$lastname = Database::result($result, 0, 'lastname');
$dateNow=date('Y-m-d');
$date_now = date('Y-m-d');
$basepath_chat = '';
$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
$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';
}
$chatPath=$documentPath.$basepath_chat.'/';
$chat_path = $document_path.$basepath_chat.'/';
$TABLEITEMPROPERTY= Database::get_course_table(TABLE_ITEM_PROPERTY);
if(!is_dir($chatPath)) {
if(is_file($chatPath)) {
@unlink($chatPath);
if (!is_dir($chat_path)) {
if (is_file($chat_path)) {
@unlink($chat_path);
}
if (!api_is_anonymous()) {
@mkdir($chatPath, api_get_permissions_for_new_directories());
@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');
@ -150,10 +111,10 @@ if (!empty($course) && !empty($_user['user_id']))
}
}
include('header_frame.inc.php');
require 'header_frame.inc.php';
$chat_size = 0;
//define emoticons
// 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';
@ -204,8 +165,7 @@ if (!empty($course) && !empty($_user['user_id']))
$emoticon_text204 = ':stop:';
$emoticon_img204 = '<img src="'.api_get_path(WEB_IMG_PATH).'smileys/flag_red_small.gif" alt="'.get_lang('Stop').'" title="'.get_lang('Stop').'" />';
if($sent)
{
if ($sent) {
$message = trim(htmlspecialchars(stripslashes($_POST['message']), ENT_QUOTES, $charset));
$message = str_replace($emoticon_text1, $emoticon_img1, $message);
$message = str_replace($emoticon_text2, $emoticon_img2, $message);
@ -237,48 +197,40 @@ if (!empty($course) && !empty($_user['user_id']))
$basename_chat = '';
if (!empty($group_id)) {
$basename_chat = 'messages-'.$dateNow.'_gid-'.$group_id;
$basename_chat = 'messages-'.$date_now.'_gid-'.$group_id;
} elseif (!empty($session_id)) {
$basename_chat = 'messages-'.$dateNow.'_sid-'.$session_id;
$basename_chat = 'messages-'.$date_now.'_sid-'.$session_id;
} else {
$basename_chat = 'messages-'.$dateNow;
$basename_chat = 'messages-'.$date_now;
}
if (!api_is_anonymous()) {
if(!empty($message))
{
if (!empty($message)) {
$message = make_clickable($message);
if(!file_exists($chatPath.$basename_chat.'.log.html'))
{
if (!file_exists($chat_path.$basename_chat.'.log.html')) {
$doc_id = add_document($_course, $basepath_chat.'/'.$basename_chat.'.log.html', 'file', 0, $basename_chat.'.log.html');
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $group_id, null, null, null, $session_id);
api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'invisible', $_user['user_id'], $group_id, null, null, null, $session_id);
item_property_update_on_folder($_course, $basepath_chat, $_user['user_id']);
}
else
{
} else {
$doc_id = DocumentManager::get_document_id($_course, $basepath_chat.'/'.$basename_chat.'.log.html');
}
$fp=fopen($chatPath.$basename_chat.'.log.html','a');
$fp = fopen($chat_path.$basename_chat.'.log.html', 'a');
if($isMaster)
{
if ($isMaster) {
$photo = '<img src="'.api_get_path(WEB_IMG_PATH).'teachers.gif" alt="'.get_lang('Teacher').'" width="11" height="11" align="top" title="'.get_lang('Teacher').'" />';
fputs($fp,'<span style="color:#999; font-size: smaller;">['.$timeNow.']</span>'.$photo.' <span id="chat_login_name"><b>'.api_get_person_name($firstname, $lastname).'</b></span> : <i>'.$message.'</i><br>'."\n");
}
else
{
fputs($fp, '<span style="color:#999; font-size: smaller;">['.$timeNow.']</span>'.$photo.' <span id="chat_login_name"><b>'.api_get_person_name($firstname, $lastname).'</b></span> : <i>'.$message.'</i><br />'."\n");
} else {
$photo = '<img src="'.api_get_path(WEB_IMG_PATH).'students.gif" alt="'.get_lang('Student').'" width="11" height="11" align="top" title="'.get_lang('Student').'" />';
fputs($fp,'<span style="color:#999; font-size: smaller;">['.$timeNow.']</span>'.$photo.' <b>'.api_get_person_name($firstname, $lastname).'</b> : <i>'.$message.'</i><br>'."\n");
fputs($fp, '<span style="color:#999; font-size: smaller;">['.$timeNow.']</span>'.$photo.' <b>'.api_get_person_name($firstname, $lastname).'</b> : <i>'.$message.'</i><br />'."\n");
}
fclose($fp);
$chat_size=filesize($chatPath.$basename_chat.'.log.html');
$chat_size = filesize($chat_path.$basename_chat.'.log.html');
update_existing_document($_course, $doc_id,$chat_size);
item_property_update_on_folder($_course,$basepath_chat, $_user['user_id']);
@ -286,7 +238,7 @@ if (!empty($course) && !empty($_user['user_id']))
}
}
?>
<form name="formMessage" method="post" action="<?php echo api_get_self().'?'.api_get_cidreq(); ?>" onsubmit="javascript:if(document.formMessage.message.value == '') { alert('<?php echo addslashes(api_htmlentities(get_lang('TypeMessage'),ENT_QUOTES,$charset)); ?>'); document.formMessage.message.focus(); return false; }" autocomplete="off">
<form name="formMessage" method="post" action="<?php echo api_get_self().'?'.api_get_cidreq(); ?>" onsubmit="javascript: if(document.formMessage.message.value == '') { alert('<?php echo addslashes(api_htmlentities(get_lang('TypeMessage'), ENT_QUOTES)); ?>'); document.formMessage.message.focus(); return false; }" autocomplete="off">
<input type="hidden" name="sent" value="1">
<table border="0" cellpadding="5" cellspacing="0" width="100%">
<tr>
@ -334,7 +286,6 @@ if (!empty($course) && !empty($_user['user_id']))
</table>
</form>
<?php
}
include('footer_frame.inc.php');
?>
require 'footer_frame.inc.php';

@ -1,32 +1,11 @@
<?php // $Id: chat_whoisonline.php,v 1.12.2.1 2005/09/02 08:18:31 pcool Exp $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004-2008 Dokeos SPRL
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Olivier Brouckaert
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt"
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
<?php
/* For licensing terms, see /license.txt */
/**
==============================================================================
* Shows the list of connected users
*
* @author Olivier Brouckaert
* @package dokeos.chat
==============================================================================
* @package chamilo.chat
*/
define('FRAME', 'online');
@ -49,8 +28,7 @@ if (!empty($group_id)) {
$extra_condition = $session_condition;
}
if (!empty($course))
{
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);
@ -62,36 +40,33 @@ if (!empty($course))
$query = "SELECT username FROM $tbl_user WHERE user_id='".$_user['user_id']."'";
$result = Database::query($query);
list($pseudoUser)=Database::fetch_array($result);
list($pseudo_user) = Database::fetch_array($result);
$isAllowed=(empty($pseudoUser) || !$_cid)?false:true;
$isMaster=$is_courseAdmin?true:false;
$isAllowed = !(empty($pseudo_user) || !$_cid);
$isMaster = (bool)$is_courseAdmin;
$date_inter = date('Y-m-d H:i:s', time()-120);
$Users = array();
$users = array();
if(empty($session_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 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
{
$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 WHERE 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;
while ($learner = Database::fetch_array($result)) {
$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 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))
$Users[$coach['user_id']] = $coach;
if ($coach = Database::fetch_array($result)) {
$users[$coach['user_id']] = $coach;
}
// select session course coach
$query = "SELECT DISTINCT t1.user_id,username,firstname,lastname,picture_uri
@ -103,55 +78,50 @@ if (!empty($course))
AND t2.last_connection>'".$date_inter."' $extra_condition ORDER BY username";
$result = Database::query($query);
$course_coachs = array();
while ($coachs = Database::fetch_array($result)) {
//$course_coachs[] = $coachs['user_id'];
$Users[$coachs['user_id']] = $coachs;
$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;
//$users[$coach['user_id']] = $coach;
}
$user_id = $enreg['user_id'];
include('header_frame.inc.php');
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>
<?php
foreach($Users as $enreg)
{
if(empty($session_id))
{
$status=$enreg['status'];
}
else
{
if(CourseManager::is_course_teacher($enreg['user_id'],$_SESSION['_course']['id'])) $status=1; else $status=5;
foreach ($users as & $user) {
if (empty($session_id)) {
$status = $user['status'];
} else {
$status = CourseManager::is_course_teacher($user['user_id'], $_SESSION['_course']['id']) ? 1 : 5;
}
$user_image=UserManager::get_user_picture_path_by_id($enreg['user_id'],'web',false,true);
$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>
<td width="99%"><?php if($status == 1) echo Display::return_icon('teachers.gif', get_lang('Teacher'),array('height' => '11')).' '; else echo Display::return_icon('students.gif', get_lang('Student'), array('height' => '11'));?><a <?php if($status == 1) echo 'class="master"';// ?> name="user_<?php echo $enreg['user_id']; ?>" href="<?php echo api_get_self(); ?>?<?php echo api_get_cidreq();?>&showPic=<?php if($showPic == $enreg['user_id']) echo '0'; else echo $enreg['user_id']; ?>#user_<?php echo $enreg['user_id']; ?>"><?php echo api_get_person_name($enreg['firstname'], $enreg['lastname']); ?></a></td>
<td width="99%"><?php if ($status == 1) echo Display::return_icon('teachers.gif', get_lang('Teacher'), array('height' => '11')).' '; else echo Display::return_icon('students.gif', get_lang('Student'), array('height' => '11')); ?><a <?php if ($status == 1) echo 'class="master"'; ?> name="user_<?php echo $user['user_id']; ?>" href="<?php echo api_get_self(); ?>?<?php echo api_get_cidreq(); ?>&showPic=<?php if ($showPic == $user['user_id']) echo '0'; else echo $user['user_id']; ?>#user_<?php echo $user['user_id']; ?>"><?php echo api_get_person_name($user['firstname'], $user['lastname']); ?></a></td>
</tr>
<?php
if($showPic == $enreg['user_id']): ?>
if ($showPic == $user['user_id']) { ?>
<tr>
<td colspan="2" align="center"><img src="<?php echo $file_url; ?>" border="0" width="100" alt="" /></td>
</tr>
<?php endif; ?>
<?php
}
unset($Users);
}
unset($users);
?>
</table>
<?php
}
include('footer_frame.inc.php');
?>
require 'footer_frame.inc.php';

@ -1,33 +1,11 @@
<?php // $Id: footer_frame.inc.php,v 1.1 2005/03/03 10:15:20 olivierb78 Exp $
/*
==============================================================================
Dokeos - elearning and course management software
<?php
/* For licensing terms, see /license.txt */
Copyright (c) 2004 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Olivier Brouckaert
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/**
==============================================================================
* Footer of each frame of the Chat tool
*
* @author Olivier Brouckaert
* @package dokeos.chat
==============================================================================
* @package chamilo.chat
*/
?>

@ -1,92 +1,56 @@
<?php // $Id: header_frame.inc.php,v 1.2 2005/05/01 11:49:16 darkden81 Exp $
/*
==============================================================================
Dokeos - elearning and course management software
Copyright (c) 2004 Dokeos S.A.
Copyright (c) 2003 Ghent University (UGent)
Copyright (c) 2001 Universite catholique de Louvain (UCL)
Copyright (c) Olivier Brouckaert
For a full list of contributors, see "credits.txt".
The full license can be read in "license.txt".
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See the GNU General Public License for more details.
<?php
/* For licensing terms, see /license.txt */
Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
==============================================================================
*/
/**
==============================================================================
* Header of each frame of the Chat tool
*
* @author Olivier Brouckaert
* @modified by Denes Nagy
* @package dokeos.chat
==============================================================================
* @package chamilo.chat
*/
if(!defined('FRAME'))
{
if (!defined('FRAME')) {
exit();
}
$bodyXtra='';
if(FRAME == 'hidden')
{
if (FRAME == 'hidden') {
$bodyXtra = 'onload="javascript: updateChat(); updateConnected(); setTimeout(\'submitHiddenForm();\',5000);"';
// change timeout to change refresh time of the chat window
}
elseif(FRAME == 'message')
{
// Change timeout to change refresh time of the chat window
} elseif (FRAME == 'message') {
$bodyXtra = 'onload="javascript: eventMessage();"';
}
/*
* Choose CSS style (platform's, user's, or course's)
*/
$platform_theme = api_get_setting('stylesheets'); // plataform's css
$my_style = $platform_theme;
if(api_get_setting('user_selected_theme') == 'true')
{
if (api_get_setting('user_selected_theme') == 'true') {
$useri = api_get_user_info();
$user_theme = $useri['theme'];
if(!empty($user_theme) && $user_theme != $my_style)
{
if (!empty($user_theme) && $user_theme != $my_style) {
$my_style = $user_theme; // user's css
}
}
$mycourseid = api_get_course_id();
if (!empty($mycourseid) && $mycourseid != -1)
{
if (api_get_setting('allow_course_theme') == 'true')
{
if (!empty($mycourseid) && $mycourseid != -1) {
if (api_get_setting('allow_course_theme') == 'true') {
$mycoursetheme = api_get_course_setting('course_theme');
if (!empty($mycoursetheme) && $mycoursetheme!=-1)
{
if(!empty($mycoursetheme) && $mycoursetheme != $my_style)
{
if (!empty($mycoursetheme) && $mycoursetheme != -1) {
if (!empty($mycoursetheme) && $mycoursetheme != $my_style) {
$my_style = $mycoursetheme; // course's css
}
}
}
}
if (empty($mycourseid))
{
// if it is not set $mycourse id we reload the chat_message window in order to hide the
// textarea to submit a message
if (empty($mycourseid)) {
// If it is not set $mycourse id we reload the chat_message window in order to hide the textarea to submit a message.
echo '<script type="text/javascript" language="javascript">';
echo "parent.chat_message.location.href='chat_whoisonline.php?".api_get_cidreq()."';";
echo '</script>';
@ -94,7 +58,7 @@ if (empty($mycourseid))
?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset;?>">
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo api_get_system_encoding(); ?>">
<title>Chat</title>
<link rel="stylesheet" type="text/css" href="../css/<?php echo $my_style; ?>/default.css">
<style>

Loading…
Cancel
Save