chat.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Chat tool
  5. * @package chamilo.chat
  6. */
  7. /**
  8. * Code
  9. */
  10. $language_file = array('chat');
  11. //require_once '../inc/global.inc.php';
  12. $current_course_tool = TOOL_CHAT;
  13. require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
  14. $this_section = SECTION_COURSES;
  15. $nameTools = get_lang('ToolChat');
  16. $origin = isset($_GET["origin"]) ? Security::remove_XSS($_GET["origin"]) : null;
  17. $target = isset($_GET["target"]) ? Security::remove_XSS($_GET["target"]) : null;
  18. if ($origin != 'whoisonline') {
  19. api_protect_course_script(true);
  20. } else {
  21. $origin = $_SESSION['origin'];
  22. $target = $_SESSION['target'];
  23. $_SESSION['origin']= $origin;
  24. $_SESSION['target']= $target;
  25. }
  26. /* TRACKING */
  27. Event::event_access_tool(TOOL_CHAT);
  28. header('Content-Type: text/html; charset='.api_get_system_encoding());
  29. /*
  30. * Choose CSS style (platform's, user's, or course's)
  31. */
  32. $my_style = api_get_visual_theme();
  33. $mycourseid = api_get_course_id();
  34. if (!empty($mycourseid) && $mycourseid != -1) {
  35. $open_chat_window = api_get_course_setting('allow_open_chat_window');
  36. }
  37. $cidreq = Security::remove_XSS($_GET['cidReq']);
  38. ?>
  39. <!DOCTYPE html>
  40. <html>
  41. <head>
  42. <meta charset="<?php echo api_get_system_encoding(); ?>" />
  43. <link rel="stylesheet" type="text/css" href="<?php echo api_get_path(WEB_CSS_PATH); ?>chat.css">
  44. <?php
  45. echo'<title>'.get_lang('Chat').' - '.$mycourseid.' - '.api_get_setting('platform.site_name').'</title>';
  46. $groupId = api_get_group_id();
  47. // If it is a group chat then the breadcrumbs.
  48. if (!empty($groupId)) {
  49. $group_properties = GroupManager :: get_group_properties($groupId);
  50. $interbreadcrumb[] = array('url' => '../group/group.php', 'name' => get_lang('Groups'));
  51. $interbreadcrumb[] = array(
  52. 'url' => '../group/group_space.php?gidReq='.api_get_group_id(),
  53. 'name' => get_lang('GroupSpace').' '.$group_properties['name']
  54. );
  55. $noPHP_SELF = true;
  56. $shortBanner = false;
  57. $add_group_to_title = ' ('.$group_properties['name'].')';
  58. $groupfilter = 'group_id="'.$groupId.'"';
  59. } else {
  60. $groupfilter = 'group_id=0';
  61. }
  62. if (empty($open_chat_window)) {
  63. Display::display_header($tool_name, 'Chat');
  64. }
  65. echo '<div class="page-chat">';
  66. echo '<iframe src="chat_whoisonline.php?cidReq='.$cidreq.'" name="chat_whoisonline" scrolling="no" style="height:500px; width:35%; border: 0px none; float:left"></iframe>';
  67. echo '<iframe src="chat_chat.php?origin='.$origin.'&target='.$target.'&amp;cidReq='.$cidreq.'" name="chat_chat" id="chat_chat" scrolling="auto" height="380" style="width:65%; border: 0px none; float:right"></iframe>';
  68. echo '<iframe src="chat_message.php?cidReq='.$cidreq.'" name="chat_message" scrolling="no" height="180" style="width:65%; border: 0px none; float:right"></iframe>';
  69. echo '<iframe src="chat_hidden.php?cidReq='.$cidreq.'" name="chat_hidden" height="0" style="border: 0px none"></iframe>';
  70. echo '</div>';
  71. if (empty($open_chat_window)) {
  72. Display::display_footer();
  73. }
  74. echo '</html>';