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';
32 parent::__construct();
34 $lng->loadLanguageModule(
'chatroom');
37 $this->
setTitle($lng->txt(
'chat_chatviewer'));
39 $this->allow_moving =
true;
68 public function executeCommand()
75 $cmd = $ilCtrl->getCmd(
'getHTML');
94 return parent::getHTML();
111 if($ilCtrl->isAsynch() && isset(
$_GET[
'chatBlockCmd']))
116 $tpl->addJavascript(
'./Modules/Chatroom/js/chatviewer.js');
117 $tpl->addCss(
'./Modules/Chatroom/templates/default/style.css');
119 $body_tpl =
new ilTemplate(
'tpl.chatroom_block_message_body.html',
true,
true,
'Modules/Chatroom');
121 $body_tpl->setVariable(
'TXT_ENABLE_AUTOSCROLL', $lng->txt(
'chat_enable_autoscroll'));
124 $ilCtrl->setParameterByClass(
'ilcolumngui',
'block_id',
'block_' . $this->
getBlockType() .
'_' . (
int)$this->
getBlockId());
125 $ilCtrl->setParameterByClass(
'ilcolumngui',
'ref_id',
'#__ref_id');
126 $body_tpl->setVariable(
'CHATBLOCK_BASE_URL', $ilCtrl->getLinkTargetByClass(
'ilcolumngui',
'updateBlock',
'',
true));
127 $ilCtrl->setParameterByClass(
'ilcolumngui',
'block_id',
'');
128 $ilCtrl->setParameterByClass(
'ilcolumngui',
'ref_id',
'');
131 $settings = ilChatroomServerSettings::loadDefault();
132 if($settings->getSmiliesEnabled())
134 $smilies_array = ilChatroomSmilies::_getSmilies();
135 foreach($smilies_array as $smiley_array)
137 foreach($smiley_array as $key => $value)
139 if($key ==
'smiley_keywords')
141 $new_keys = explode(
"\n", $value);
144 if($key ==
'smiley_fullpath')
150 foreach($new_keys as $new_key)
152 $smilieys[$new_key] = $new_val;
158 $smilieys =
new stdClass();
160 $body_tpl->setVariable(
'SMILIES', json_encode($smilieys));
162 $js_translations =
array(
163 'LBL_CONNECT' =>
'chat_connection_established',
164 'LBL_DISCONNECT' =>
'chat_connection_disconnected',
165 'LBL_TIMEFORMAT' =>
'lang_timeformat_no_sec',
166 'LBL_DATEFORMAT' =>
'lang_dateformat' 168 foreach($js_translations as $placeholder => $lng_variable)
170 $body_tpl->setVariable($placeholder, json_encode($lng->txt($lng_variable)));
173 $content = $body_tpl->get();
184 case 'getChatroomSelectionList':
190 return $this->getMessages();
201 $result->html = $chatblock->getRoomSelect();
203 include_once
'Services/JSON/classes/class.ilJsonUtil.php';
210 protected function getMessages()
222 if(!(
int)$_REQUEST[
'ref_id'])
232 if(!$object || !$rbacsystem->checkAccess(
'read', (
int)$_REQUEST[
'ref_id']))
236 $ilUser->getId(),
'chatviewer_last_selected_room',
240 $result->errormsg = $lng->txt(
'msg_no_perm_read');
245 require_once
'Modules/Chatroom/classes/class.ilChatroom.php';
249 $msg = $block->getMessages($room);
253 'chatviewer_last_selected_room',
258 $ilUser->getId(),
'chatviewer_last_selected_room',
262 $result->messages = array_reverse($msg);
265 include_once
'Services/JSON/classes/class.ilJsonUtil.php';
276 return self::$block_type;
__construct()
Constructor.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
static _writePref($a_usr_id, $a_keyword, $a_value)
static initJson()
Init YUI JSON component.
dispatchAsyncCommand($cmd)
static isRepositoryObject()
getChatroomSelectionList()
setImage($a_image)
Set Image.
static encode($mixed, $suppress_native=false)
setTitle($a_title)
Set Title.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static checkServerConnection($use_cache=true)
special template class to simplify handling of ITX/PEAR
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
Class ilChatroomBlockGUI.
Create styles array
The data for the language used.
getBlockId()
Get Block Id.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
This class represents a block method of a block.
fillDataSection()
Standard implementation for row based data.
getCurrentDetailLevel()
Get Current Detail Level.