chat.php 3.0 KB

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