new chat css iframe

1.9.x
aragonc 11 years ago
parent 9791b6df43
commit 7f5f75a9f6
  1. 7
      main/chat/chat.php
  2. 7
      main/chat/chat_chat.php
  3. 20
      main/chat/chat_message.php
  4. 55
      main/chat/chat_whoisonline.php
  5. 2
      main/chat/header_frame.inc.php

@ -74,10 +74,9 @@ if (!empty($groupId)) {
if (empty($open_chat_window)) {
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='.$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_whoisonline.php?cidReq='.$cidreq.'" name="chat_whoisonline" scrolling="auto" style="height:320px; width:20%; border: 0px none; float:left"></iframe>';
echo '<iframe src="chat_chat.php?origin='.$origin.'&target='.$target.'&amp;cidReq='.$cidreq.'" name="chat_chat" scrolling="auto" height="300" style="width:80%; border: 0px none; float:right"></iframe>';
echo '<iframe src="chat_message.php?cidReq='.$cidreq.'" name="chat_message" scrolling="no" height="100" 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)) {

@ -141,19 +141,22 @@ if (!empty($course)) {
$result = Database::query($sql);
}
echo '<div style="margin-left: 5px;">';
echo '<div class="content-chat">';
foreach ($content as & $this_line) {
echo strip_tags(api_html_entity_decode($this_line), '<br> <span> <b> <i> <img> <font>');
echo strip_tags(api_html_entity_decode($this_line), '<div> <br> <span> <b> <i> <img> <font>');
}
echo '</div>';
echo '<div class="delete-chat">';
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;">';
echo '<a href="'.api_get_self().'?rand='.$rand.'&reset=1&'.api_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>';
echo '</div>';
}
} else {
echo '</div>';
require 'header_frame.inc.php';
$message = get_lang('CloseOtherSession');
Display :: display_error_message($message);

@ -5,6 +5,7 @@
* Allows to type the messages that will be displayed on chat_chat.php
*
* @author Olivier Brouckaert
* Modified by Alex Aragón (BeezNest)
* @package chamilo.chat
*/
/**
@ -71,7 +72,7 @@ if (!empty($course) && !empty($_user['user_id'])) {
/* MAIN CODE */
$query = "SELECT lastname, firstname, username FROM $tbl_user WHERE user_id='".intval($_user['user_id'])."'";
$query = "SELECT user_id, lastname, firstname, username, picture_uri FROM $tbl_user WHERE user_id='".intval($_user['user_id'])."'";
$result = Database::query($query);
list($pseudo_user) = Database::fetch_row($result);
@ -79,8 +80,10 @@ if (!empty($course) && !empty($_user['user_id'])) {
$isAllowed = !(empty($pseudo_user) || !$_cid);
$isMaster = (bool)$is_courseAdmin;
$user_id = Database::result($result, 0, 'user_id');
$firstname = Database::result($result, 0, 'firstname');
$lastname = Database::result($result, 0, 'lastname');
$picture = Database::result($result, 0, 'picture_uri');
$date_now = date('Y-m-d');
@ -207,13 +210,20 @@ if (!empty($course) && !empty($_user['user_id'])) {
}
$fp = fopen($chat_path.$basename_chat.'.log.html', 'a');
// view user picture
$user_image = UserManager::get_user_picture_path_by_id($user_id, 'web', false, true);
$user_photo = $user_image['dir'].$user_image['file'];
$file_photo = '<img class="chat-image" src="'.$user_photo.'"/>';
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");
// $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, '<div class="message-teacher"><div class="content-message"><div>'.$message.'</div><div class="message-date">'.$timeNow.'</div></div><div class="icon-message"></div>'.$file_photo.'</div>'."\n");
//fputs($fp, '<span style="color:#999; font-size: smaller;">['.$timeNow.']</span>'.$file_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");
// $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>'.$file_photo.' <b>'.api_get_person_name($firstname, $lastname).'</b> : <i>'.$message.'</i><br />'."\n");
fputs($fp, '<div class="message-student">'.$file_photo.'<div class="icon-message"></div><div class="content-message"><div>'.$message.'</div><div class="message-date">'.$timeNow.'</div></div></div>'."\n");
}
fclose($fp);

@ -107,34 +107,31 @@ if (!empty($course)) {
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 & $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($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 $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 == $user['user_id']) { ?>
<tr>
<td colspan="2" align="center"><img src="<?php echo $file_url; ?>" border="0" width="100" alt="" /></td>
</tr>
<?php
}
}
unset($users);
?>
</table>
<div class="user-online">
<div class="title"><?php echo get_lang('Connected'); ?></div>
<ul class="perfil">
<?php
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($user['user_id'], 'web', false, true);
$file_url = $user_image['dir'].$user_image['file'];
?>
<li>
<!-- <img src="<?php echo $file_url;?>" border="0" width="22" alt="" /> -->
<?php if ($status == 1) echo Display::return_icon('teachers.gif', get_lang('Teacher'), array('height' => '18')).' '; else echo Display::return_icon('students.gif', get_lang('Student'), array('height' => '18')); ?>
<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>
<?php if ($showPic == $user['user_id']) { ?>
<div>
<img src="<?php echo $file_url; ?>" border="0" width="100" alt="" />
</div>
</li>
<?php } } unset($users); ?>
</ul>
</div>
<?php
}
require 'footer_frame.inc.php';
require 'footer_frame.inc.php';

@ -47,7 +47,7 @@ header('Content-Type: text/html; charset='.api_get_system_encoding());
<head>
<meta charset="<?php echo api_get_system_encoding(); ?>" />
<title>Chat</title>
<link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CSS_PATH).$my_style; ?>/default.css">
<link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CSS_PATH); ?>chat.css">
<style>
a {
font-size: 12px;

Loading…
Cancel
Save