chat.php 3.2 KB

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