chat.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. define('CHAMILO_LOAD_WYSIWYG', false);
  4. require_once __DIR__.'/../inc/global.inc.php';
  5. api_protect_course_script(true);
  6. Event::event_access_tool(TOOL_CHAT);
  7. // View
  8. $externalCSS = [
  9. 'jquery-emojiarea/jquery.emojiarea.css',
  10. 'jquery-textcomplete/jquery.textcomplete.css',
  11. 'emojione/css/emojione.min.css',
  12. 'emojione/css/autocomplete.css',
  13. 'highlight/styles/github.css'
  14. ];
  15. foreach ($externalCSS as $css) {
  16. $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH).$css);
  17. }
  18. $htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'chat.css');
  19. $htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'markdown.css');
  20. $externalJS = [
  21. 'highlight/highlight.pack.js',
  22. 'jquery-textcomplete/jquery.textcomplete.js',
  23. 'emojione/js/emojione.min.js',
  24. 'jquery-emojiarea/jquery.emojiarea.js'
  25. ];
  26. foreach ($externalJS as $js) {
  27. $htmlHeadXtra[] = api_get_js($js);
  28. }
  29. $iconList = [];
  30. foreach (Emojione\Emojione::$shortcode_replace as $key => $icon) {
  31. if (!in_array($key, CourseChatUtils::getEmojisToInclude())) {
  32. continue;
  33. }
  34. $iconList[$key] = strtoupper($icon).'.png';
  35. }
  36. $view = new Template(get_lang('Chat'), false, false, false, true, false);
  37. $view->assign('icons', $iconList);
  38. $view->assign('emoji_strategy', CourseChatUtils::getEmojiStrategry());
  39. $view->assign('emoji_smile', \Emojione\Emojione::toImage(':smile:'));
  40. $template = $view->get_template('chat/chat.tpl');
  41. $content = $view->fetch($template);
  42. $view->assign('content', $content);
  43. $view->display_no_layout_template();