chat.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once __DIR__.'/../inc/global.inc.php';
  4. api_protect_course_script(true);
  5. Event::event_access_tool(TOOL_CHAT);
  6. $htmlHeadXtra[] = api_get_css_asset('emojione/assets/css/emojione.min.css');
  7. $htmlHeadXtra[] = api_get_css_asset('emojionearea/dist/emojionearea.css');
  8. $htmlHeadXtra[] = api_get_css_asset('highlight.js.origin/src/styles/github.css');
  9. $htmlHeadXtra[] = api_get_css('css/chat.css');
  10. $htmlHeadXtra[] = api_get_css('css/markdown.css');
  11. $htmlHeadXtra[] = api_get_asset('highlight.js.origin/src/highlight.js');
  12. $htmlHeadXtra[] = api_get_asset('jquery-textcomplete/dist/jquery.textcomplete.js');
  13. $htmlHeadXtra[] = api_get_asset('emojionearea/dist/emojionearea.js');
  14. $htmlHeadXtra[] = api_get_asset('emojione/lib/js/emojione.min.js');
  15. $iconList = [];
  16. $client = new \Emojione\Client();
  17. //foreach (Emojione\Emojione::$shortcode_replace as $key => $icon) {
  18. foreach ($client->getRuleset()->getShortcodeReplace() as $key => $icon) {
  19. if (!in_array($key, CourseChatUtils::getEmojisToInclude())) {
  20. continue;
  21. }
  22. $iconList[$key] = strtoupper($icon[0]).'.png';
  23. }
  24. $view = new Template(get_lang('Chat'), false, false, false, true, false);
  25. $view->assign('icons', $iconList);
  26. $view->assign('emoji_strategy', CourseChatUtils::getEmojiStrategry());
  27. $view->assign('emoji_smile', $client->toImage(':smile:'));
  28. $template = $view->get_template('chat/chat.tpl');
  29. $content = $view->fetch($template);
  30. $view->assign('content', $content);
  31. $view->display_no_layout_template();