4require_once 
'Services/Block/classes/class.ilBlockGUI.php';
 
    5require_once 
'Modules/Chatroom/classes/class.ilChatroomServerConnector.php';
 
    6require_once 
'Modules/Chatroom/classes/class.ilChatroomServerSettings.php';
 
    7require_once 
'Services/JSON/classes/class.ilJsonUtil.php';
 
    8require_once 
'Modules/Chatroom/classes/class.ilChatroomBlock.php';
 
    9require_once 
'Modules/Chatroom/classes/class.ilChatroomSmilies.php';
 
   30        parent::__construct();
 
   32        $this->lng->loadLanguageModule(
'chatroom');
 
   35        $this->
setTitle($this->lng->txt(
'chat_chatviewer'));
 
   37        $this->allow_moving = 
true;
 
   55        switch (
$_GET[
'cmd']) {
 
   67        $cmd = $this->ctrl->getCmd(
'getHTML');
 
   83            return parent::getHTML();
 
   92        if ($this->ctrl->isAsynch() && isset(
$_GET[
'chatBlockCmd'])) {
 
   96        $this->main_tpl->addJavascript(
'./Modules/Chatroom/js/chatviewer.js');
 
   97        $this->main_tpl->addCss(
'./Modules/Chatroom/templates/default/style.css');
 
   99        $body_tpl = 
new ilTemplate(
'tpl.chatroom_block_message_body.html', 
true, 
true, 
'Modules/Chatroom');
 
  101        $body_tpl->setVariable(
'TXT_ENABLE_AUTOSCROLL', $this->lng->txt(
'chat_enable_autoscroll'));
 
  104        $this->ctrl->setParameterByClass(
'ilcolumngui', 
'block_id', 
'block_' . $this->
getBlockType() . 
'_' . (
int) $this->
getBlockId());
 
  105        $this->ctrl->setParameterByClass(
'ilcolumngui', 
'ref_id', 
'#__ref_id');
 
  106        $body_tpl->setVariable(
'CHATBLOCK_BASE_URL', $this->ctrl->getLinkTargetByClass(
'ilcolumngui', 
'updateBlock', 
'', 
true));
 
  107        $this->ctrl->setParameterByClass(
'ilcolumngui', 
'block_id', 
'');
 
  108        $this->ctrl->setParameterByClass(
'ilcolumngui', 
'ref_id', 
'');
 
  112        if ($settings->getSmiliesEnabled()) {
 
  113            $smilies_array = ilChatroomSmilies::_getSmilies();
 
  114            foreach ($smilies_array as $smiley_array) {
 
  115                foreach ($smiley_array as 
$key => $value) {
 
  116                    if (
$key == 
'smiley_keywords') {
 
  117                        $new_keys = explode(
"\n", $value);
 
  120                    if (
$key == 
'smiley_fullpath') {
 
  125                foreach ($new_keys as $new_key) {
 
  126                    $smilieys[$new_key] = $new_val;
 
  130            $smilieys = 
new stdClass();
 
  132        $body_tpl->setVariable(
'SMILIES', json_encode($smilieys));
 
  134        $js_translations = array(
 
  135            'LBL_CONNECT'    => 
'chat_connection_established',
 
  136            'LBL_DISCONNECT' => 
'chat_connection_disconnected',
 
  137            'LBL_TIMEFORMAT' => 
'lang_timeformat_no_sec',
 
  138            'LBL_DATEFORMAT' => 
'lang_dateformat' 
  140        foreach ($js_translations as $placeholder => $lng_variable) {
 
  141            $body_tpl->setVariable($placeholder, json_encode($this->lng->txt($lng_variable)));
 
  144        $content = $body_tpl->get();
 
  154            case 'getChatroomSelectionList':
 
  160                return $this->getMessages();
 
  171        $result->html = $chatblock->getRoomSelect();
 
  173        include_once 
'Services/JSON/classes/class.ilJsonUtil.php';
 
  180    protected function getMessages()
 
  187        if (!(
int) $_REQUEST[
'ref_id']) {
 
  198                $DIC->user()->getId(),
 
  199                'chatviewer_last_selected_room',
 
  203            $result->errormsg = 
$DIC->language()->txt(
'msg_no_perm_read');
 
  208        require_once 
'Modules/Chatroom/classes/class.ilChatroom.php';
 
  212        $msg   = $block->getMessages($room);
 
  214        $DIC->user()->setPref(
 
  215            'chatviewer_last_selected_room',
 
  219            $DIC->user()->getId(),
 
  220            'chatviewer_last_selected_room',
 
  224        $result->messages = array_reverse($msg);
 
  227        include_once 
'Services/JSON/classes/class.ilJsonUtil.php';
 
An exception for terminatinating execution or to throw for unit testing.
This class represents a block method of a block.
setImage($a_image)
Set Image.
getCurrentDetailLevel()
Get Current Detail Level.
getBlockId()
Get Block Id.
setAvailableDetailLevels($a_max, $a_min=0)
Set Available Detail Levels.
setDataSection($a_content)
Call this from overwritten fillDataSection(), if standard row based data is not used.
setTitle($a_title)
Set Title.
Class ilChatroomBlockGUI.
dispatchAsyncCommand($cmd)
__construct()
Constructor.
getChatroomSelectionList()
static isRepositoryObject()
fillDataSection()
Fill data section.
static checkServerConnection($use_cache=true)
static byObjectId($object_id)
Returns ilChatroom object by given $object_id.
static checkUserPermissions($permissions, $ref_id, $send_info=true)
Checks user permissions by given array and ref_id.
static encode($mixed, $suppress_native=false)
static _writePref($a_usr_id, $a_keyword, $a_value)
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static initJson()
Init YUI JSON component.