/** * Chatroom and Chatuser get prepared before $this->showRoom method * is called. If custom usernames are allowed, $this->showNameSelection * method is called if user isn't already registered in the Chatroom. * @param string $method */ public function executeDefault($method) { /** * @var $ilUser ilObjUser * @var $lng ilLanguage * @var $ilCtrl ilCtrl */ global $ilUser, $lng, $ilCtrl; include_once 'Modules/Chatroom/classes/class.ilChatroom.php'; ilChatroom::checkUserPermissions('read', $this->gui->ref_id); $this->gui->switchToVisibleMode(); $this->setupTemplate(); $chatSettings = new ilSetting('chatroom'); if (!$chatSettings->get('chat_enabled')) { $ilCtrl->redirect($this->gui, 'settings-general'); exit; } $room = ilChatroom::byObjectId($this->gui->object->getId()); if (!$room->getSetting('allow_anonymous') && $ilUser->isAnonymous()) { $this->cancelJoin($lng->txt('anonymous_not_allowed')); return; } $chat_user = new ilChatroomUser($ilUser, $room); if ($room->getSetting('allow_custom_usernames')) { if ($room->isSubscribed($chat_user->getUserId())) { $chat_user->setUsername($chat_user->getUsername()); $this->showRoom($room, $chat_user); } else { $this->showNameSelection($chat_user); } } else { $chat_user->setUsername($ilUser->getLogin()); $this->showRoom($room, $chat_user); } }