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(
'chat');
35 $lng->loadLanguageModule(
'chatroom');
38 $this->
setTitle($lng->txt(
'chat_chatviewer'));
40 $this->allow_moving =
true;
78 public function executeCommand()
85 $cmd = $ilCtrl->getCmd(
'getHTML');
121 if($ilCtrl->isAsynch())
123 return $this->getMessages();
126 $tpl->addJavascript(
'./Modules/Chatroom/js/chatviewer.js');
127 $tpl->addCss(
'./Modules/Chatroom/templates/default/style.css');
130 $body_tpl =
new ilTemplate(
'tpl.chatroom_block_message_body.html',
true,
true,
'Modules/Chatroom');
137 $body_tpl->setVariable(
'BLOCK_HEIGHT', $height);
138 $body_tpl->setVariable(
'TXT_ENABLE_AUTOSCROLL', $lng->txt(
'chat_enable_autoscroll'));
140 $ilCtrl->setParameterByClass(
'ilcolumngui',
'block_id',
'block_' . $this->
getBlockType() .
'_' . (
int)$this->
getBlockId());
141 $ilCtrl->setParameterByClass(
'ilcolumngui',
'ref_id',
'#__ref_id');
142 $body_tpl->setVariable(
'CHATBLOCK_BASE_URL', $ilCtrl->getLinkTargetByClass(
'ilcolumngui',
'updateBlock',
'',
true));
143 $ilCtrl->setParameterByClass(
'ilcolumngui',
'block_id',
'');
144 $ilCtrl->setParameterByClass(
'ilcolumngui',
'ref_id',
'');
148 if($settings->getSmiliesEnabled())
151 foreach($smilies_array as $smiley_array)
153 foreach($smiley_array as $key => $value)
155 if($key ==
'smiley_keywords')
157 $new_keys = explode(
"\n", $value);
160 if($key ==
'smiley_fullpath')
166 foreach($new_keys as $new_key)
168 $smilieys[$new_key] = $new_val;
174 $smilieys =
new stdClass();
176 $body_tpl->setVariable(
'SMILIES', json_encode($smilieys));
178 $body_tpl->setVariable(
'LBL_MAINROOM', $lng->txt(
'chat_mainroom'));
179 $body_tpl->setVariable(
'LBL_LEAVE_PRIVATE_ROOM', $lng->txt(
'leave_private_room'));
180 $body_tpl->setVariable(
'LBL_JOIN', $lng->txt(
'chat_join'));
181 $body_tpl->setVariable(
'LBL_DELETE_PRIVATE_ROOM', $lng->txt(
'delete_private_room'));
182 $body_tpl->setVariable(
'LBL_INVITE_TO_PRIVATE_ROOM', $lng->txt(
'invite_to_private_room'));
183 $body_tpl->setVariable(
'LBL_KICK', $lng->txt(
'chat_kick'));
184 $body_tpl->setVariable(
'LBL_BAN', $lng->txt(
'chat_ban'));
185 $body_tpl->setVariable(
'LBL_KICK_QUESTION', $lng->txt(
'kick_question'));
186 $body_tpl->setVariable(
'LBL_BAN_QUESTION', $lng->txt(
'ban_question'));
187 $body_tpl->setVariable(
'LBL_ADDRESS', $lng->txt(
'chat_address'));
188 $body_tpl->setVariable(
'LBL_WHISPER', $lng->txt(
'chat_whisper'));
189 $body_tpl->setVariable(
'LBL_CONNECT', $lng->txt(
'chat_connection_established'));
190 $body_tpl->setVariable(
'LBL_DISCONNECT', $lng->txt(
'chat_connection_disconnected'));
191 $body_tpl->setVariable(
'LBL_INVITE_USERS', $lng->txt(
'chat_invite_users'));
192 $body_tpl->setVariable(
'LBL_USER_TAB', $lng->txt(
'chat_right_box_user'));
193 $body_tpl->setVariable(
'LBL_PRIVATE_ROOM', $lng->txt(
'chat_private_room'));
194 $body_tpl->setVariable(
'LBL_CREATE_NEW_PRIVATE_ROOM', $lng->txt(
'chat_create_new_private_room'));
195 $body_tpl->setVariable(
'LBL_TO_MAINROOM', $lng->txt(
'chat_to_mainroom'));
196 $body_tpl->setVariable(
'LBL_CREATE_PRIVATE_ROOM', $lng->txt(
'chat_create_private_room_button'));
197 $body_tpl->setVariable(
'LBL_CREATE_PRIVATE_ROOM_TEXT', $lng->txt(
'create_private_room_text'));
199 $body_tpl->setVariable(
'LBL_WELCOME_TO_CHAT', $lng->txt(
'welcome_to_chat'));
200 $body_tpl->setVariable(
'LBL_USER_INVITED', $lng->txt(
'user_invited'));
201 $body_tpl->setVariable(
'LBL_USER_KICKED', $lng->txt(
'user_kicked'));
202 $body_tpl->setVariable(
'LBL_USER_INVITED_SELF', $lng->txt(
'user_invited_self'));
203 $body_tpl->setVariable(
'LBL_PRIVATE_ROOM_CLOSED', $lng->txt(
'private_room_closed'));
204 $body_tpl->setVariable(
'LBL_PRIVATE_ROOM_ENTERED', $lng->txt(
'private_room_entered'));
205 $body_tpl->setVariable(
'LBL_PRIVATE_ROOM_LEFT', $lng->txt(
'private_room_left'));
206 $body_tpl->setVariable(
'LBL_PRIVATE_ROOM_ENTERED_USER', $lng->txt(
'private_room_entered_user'));
207 $body_tpl->setVariable(
'LBL_KICKED_FROM_PRIVATE_ROOM', $lng->txt(
'kicked_from_private_room'));
208 $body_tpl->setVariable(
'LBL_OK', $lng->txt(
'ok'));
209 $body_tpl->setVariable(
'LBL_CANCEL', $lng->txt(
'cancel'));
210 $body_tpl->setVariable(
'LBL_WHISPER_TO', $lng->txt(
'whisper_to'));
211 $body_tpl->setVariable(
'LBL_SPEAK_TO', $lng->txt(
'speak_to'));
213 $body_tpl->setVariable(
'LBL_USER_IN_ROOM', $lng->txt(
'user_in_room'));
214 $body_tpl->setVariable(
'LBL_USER_IN_ILIAS', $lng->txt(
'user_in_ilias'));
216 $body_tpl->setVariable(
'LBL_HISTORY_CLEARED', $lng->txt(
'history_cleared'));
217 $body_tpl->setVariable(
'LBL_CLEAR_ROOM_HISTORY', $lng->txt(
'clear_room_history'));
218 $body_tpl->setVariable(
'LBL_CLEAR_ROOM_HISTORY_QUESTION', $lng->txt(
'clear_room_history_question'));
220 $body_tpl->setVariable(
'LBL_LAYOUT', $lng->txt(
'layout'));
221 $body_tpl->setVariable(
'LBL_SHOW_SETTINGS', $lng->txt(
'show_settings'));
222 $body_tpl->setVariable(
'LBL_HIDE_SETTINGS', $lng->txt(
'hide_settings'));
223 $body_tpl->setVariable(
'LBL_NO_FURTHER_USERS', $lng->txt(
'no_further_users'));
224 $body_tpl->setVariable(
'LBL_USERS', $lng->txt(
'users'));
225 $body_tpl->setVariable(
'LBL_END_WHISPER', $lng->txt(
'end_whisper'));
227 $content = $body_tpl->get() . $chatblock->getRoomSelect();
234 protected function getMessages()
241 global $ilAccess, $ilUser,
$lng;
249 if(!$object || !$ilAccess->checkAccess(
'read',
'',
$_REQUEST[
'ref_id']))
253 $ilUser->getId(),
'chatviewer_last_selected_room',
258 $result->errormsg = $lng->txt(
'msg_no_perm_read');
263 require_once
'Modules/Chatroom/classes/class.ilChatroom.php';
267 $msg = $block->getMessages($room);
271 'chatviewer_last_selected_room',
276 $ilUser->getId(),
'chatviewer_last_selected_room',
280 $result->messages = array_reverse($msg);
283 include_once
'Services/JSON/classes/class.ilJsonUtil.php';