4 require_once
'Services/Block/classes/class.ilBlockGUI.php';
5 require_once
'Modules/Chatroom/classes/class.ilChatroomServerConnector.php';
6 require_once
'Modules/Chatroom/classes/class.ilChatroomServerSettings.php';
7 require_once
'Services/JSON/classes/class.ilJsonUtil.php';
8 require_once
'Modules/Chatroom/classes/class.ilChatroomBlock.php';
9 require_once
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
34 $lng->loadLanguageModule(
'chatroom');
37 $this->
setTitle($lng->txt(
'chat_chatviewer'));
39 $this->allow_moving =
true;
77 public function executeCommand()
84 $cmd = $ilCtrl->getCmd(
'getHTML');
120 if($ilCtrl->isAsynch() && isset(
$_GET[
'chatBlockCmd']))
125 $tpl->addJavascript(
'./Modules/Chatroom/js/chatviewer.js');
126 $tpl->addCss(
'./Modules/Chatroom/templates/default/style.css');
128 $body_tpl =
new ilTemplate(
'tpl.chatroom_block_message_body.html',
true,
true,
'Modules/Chatroom');
130 $body_tpl->setVariable(
'TXT_ENABLE_AUTOSCROLL', $lng->txt(
'chat_enable_autoscroll'));
133 $ilCtrl->setParameterByClass(
'ilcolumngui',
'block_id',
'block_' . $this->
getBlockType() .
'_' . (
int)$this->
getBlockId());
134 $ilCtrl->setParameterByClass(
'ilcolumngui',
'ref_id',
'#__ref_id');
135 $body_tpl->setVariable(
'CHATBLOCK_BASE_URL', $ilCtrl->getLinkTargetByClass(
'ilcolumngui',
'updateBlock',
'',
true));
136 $ilCtrl->setParameterByClass(
'ilcolumngui',
'block_id',
'');
137 $ilCtrl->setParameterByClass(
'ilcolumngui',
'ref_id',
'');
141 if($settings->getSmiliesEnabled())
144 foreach($smilies_array as $smiley_array)
146 foreach($smiley_array as $key => $value)
148 if($key ==
'smiley_keywords')
150 $new_keys = explode(
"\n", $value);
153 if($key ==
'smiley_fullpath')
159 foreach($new_keys as $new_key)
161 $smilieys[$new_key] = $new_val;
167 $smilieys =
new stdClass();
169 $body_tpl->setVariable(
'SMILIES', json_encode($smilieys));
171 $js_translations = array(
172 'LBL_CONNECT' =>
'chat_connection_established',
173 'LBL_DISCONNECT' =>
'chat_connection_disconnected',
174 'LBL_TIMEFORMAT' =>
'lang_timeformat_no_sec',
175 'LBL_DATEFORMAT' =>
'lang_dateformat'
177 foreach($js_translations as $placeholder => $lng_variable)
179 $body_tpl->setVariable($placeholder, json_encode($lng->txt($lng_variable)));
182 $content = $body_tpl->get();
193 case 'getChatroomSelectionList':
199 return $this->getMessages();
210 $result->html = $chatblock->getRoomSelect();
212 include_once
'Services/JSON/classes/class.ilJsonUtil.php';
220 protected function getMessages()
242 if(!$object || !$rbacsystem->checkAccess(
'read', (
int)$_REQUEST[
'ref_id']))
246 $ilUser->getId(),
'chatviewer_last_selected_room',
250 $result->errormsg = $lng->txt(
'msg_no_perm_read');
255 require_once
'Modules/Chatroom/classes/class.ilChatroom.php';
259 $msg = $block->getMessages($room);
263 'chatviewer_last_selected_room',
268 $ilUser->getId(),
'chatviewer_last_selected_room',
272 $result->messages = array_reverse($msg);
275 include_once
'Services/JSON/classes/class.ilJsonUtil.php';