44 $this->ui =
$DIC->ui();
54 require_once
'Modules/Chatroom/classes/class.ilObjChatroom.php';
57 if(!
$DIC->user() ||
$DIC->user()->isAnonymous())
59 $this->accessible =
false;
63 $chatSettings =
new ilSetting(
'chatroom');
65 $this->publicChatRoomAccess =
$DIC->rbac()->system()->checkAccessOfUser(
$DIC->user()->getId(),
'read', $this->pub_ref_id);
66 $this->oscAccess = $chatSettings->get(
'enable_osc');
78 if(!$this->accessible)
83 require_once
'Services/Link/classes/class.ilLinkifyUtil.php';
86 require_once
'Services/JSON/classes/class.ilJsonUtil.php';
87 $DIC->language()->loadLanguageModule(
'chatroom');
90 'conversationTemplate' => (
new ilTemplate(
'tpl.chat-menu-item.html',
false,
false,
'Services/OnScreenChat'))->
get(),
91 'roomTemplate' => (
new ilTemplate(
'tpl.chat-menu-item-room.html',
false,
false,
'Services/OnScreenChat'))->
get(),
92 'infoTemplate' => (
new ilTemplate(
'tpl.chat-menu-item-info.html',
false,
false,
'Services/OnScreenChat'))->
get(),
93 'userId' =>
$DIC->user()->getId()
98 if($this->publicChatRoomAccess)
101 'name' =>
$DIC[
'ilObjDataCache']->lookupTitle(
$DIC[
'ilObjDataCache']->lookupObjId($this->pub_ref_id)),
102 'url' =>
'./ilias.php?baseClass=ilRepositoryGUI&cmd=view&ref_id=' . $this->pub_ref_id,
107 $config[
'showAcceptMessageChange'] = (
109 !(bool)
$DIC[
'ilSetting']->
get(
'usr_settings_hide_chat_osc_accept_msg',
false) &&
110 !(bool)
$DIC[
'ilSetting']->
get(
'usr_settings_disable_chat_osc_accept_msg',
false)
114 $DIC->language()->loadLanguageModule(
'chatroom');
115 $DIC->language()->toJS(array(
116 'chat_osc_conversations',
'chat_osc_section_head_other_rooms',
117 'chat_osc_sure_to_leave_grp_conv',
'chat_osc_user_left_grp_conv',
118 'confirm',
'cancel',
'chat_osc_leave_grp_conv',
'chat_osc_no_conv'
120 $DIC->language()->toJSMap(array(
121 'chat_osc_dont_accept_msg' =>
sprintf(
122 $DIC->language()->txt(
'chat_osc_dont_accept_msg'),
123 $DIC->ctrl()->getLinkTargetByClass(array(
'ilPersonalDesktopGUI',
'ilPersonalSettingsGUI',
'ilPersonalChatSettingsFormGUI'),
'showChatOptions')
127 $DIC[
'tpl']->addJavascript(
'./Services/OnScreenChat/js/onscreenchat-menu.js');
128 $DIC[
'tpl']->addJavascript(
'./Services/UIComponent/Modal/js/Modal.js');
130 $tpl =
new ilTemplate(
'tpl.chat-menu.html',
true,
true,
'Services/OnScreenChat');
132 $f = $this->ui->factory();
133 $renderer = $this->ui->renderer();
135 $glyph = $f->glyph()->comment();
136 $glyph = $glyph->withCounter($f->counter()->status(0))->withCounter($f->counter()->novelty(0))->withOnLoadCode(
function($id) use (&$glyph_id) {
140 $glyph_html = $renderer->render($glyph);
142 $config[
'triggerId'] = $glyph_id;
143 $config[
'conversationNoveltyCounter'] = $renderer->render($f->counter()->novelty(0));
146 $DIC[
'tpl']->addOnLoadCode(
"il.OnScreenChatMenu.init();");
148 $tpl->setVariable(
'GLYPH', $glyph_html);
sprintf('%.4f', $callTime)
An exception for terminatinating execution or to throw for unit testing.
static encode($mixed, $suppress_native=false)
static initLinkify($a_tpl=null)
Init Linkify.
static _getIcon($a_obj_id="", $a_size="big", $a_type="", $a_offline=false)
Get icon for repository item.
special template class to simplify handling of ITX/PEAR
static yn2tf($a_yn)
convert "y"/"n" to true/false
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)