/**
  * @param int $invited_id
  */
 private function inviteById($invited_id)
 {
     /**
      * @var $ilUser ilObjUser
      * @var $ilCtrl ilCtrl
      */
     global $ilUser, $ilCtrl;
     if (!ilChatroom::checkUserPermissions('read', $this->gui->ref_id)) {
         $ilCtrl->setParameterByClass('ilrepositorygui', 'ref_id', ROOT_FOLDER_ID);
         $ilCtrl->redirectByClass('ilrepositorygui', '');
     }
     $room = ilChatroom::byObjectId($this->gui->object->getId());
     $chat_user = new ilChatroomUser($ilUser, $room);
     $user_id = $chat_user->getUserId();
     if (!$room) {
         $response = json_encode(array('success' => false, 'reason' => 'unkown room'));
         echo json_encode($response);
         exit;
     } else {
         if ($_REQUEST['sub'] && !$room->isOwnerOfPrivateRoom($user_id, $_REQUEST['sub'])) {
             $response = json_encode(array('success' => false, 'reason' => 'not owner of private room'));
             echo json_encode($response);
             exit;
         }
     }
     $connector = $this->gui->getConnector();
     $result = $connector->inviteToPrivateRoom($room, $_REQUEST['sub'], $ilUser, $invited_id);
     $room->sendInvitationNotification($this->gui, $chat_user, $invited_id, (int) $_REQUEST['sub']);
     echo json_encode($result);
     exit;
 }
 /**
  * Performs logout.
  */
 public function logout()
 {
     /**
      * @var $tree   ilTree
      * @var $ilCtrl ilCtrl
      */
     global $tree, $ilCtrl;
     /**
      * @todo logout user from room
      */
     $pid = $tree->getParentId($this->gui->getRefId());
     $ilCtrl->setParameterByClass('ilrepositorygui', 'ref_id', $pid);
     $ilCtrl->redirectByClass('ilrepositorygui', '');
 }
 /**
  * Constructor
  * @param array   $a_data
  * @param int     $a_id
  * @param boolean $a_call_by_reference
  */
 public function __construct($a_data = null, $a_id = null, $a_call_by_reference = true)
 {
     /**
      * @var $lng ilLanguage
      */
     global $lng;
     $lng->loadLanguageModule('chatroom_adm');
     if ($a_data == null) {
         if ($_GET['serverInquiry']) {
             require_once dirname(__FILE__) . '/class.ilChatroomServerHandler.php';
             new ilChatroomServerHandler();
             return;
         }
     }
     $this->type = 'chta';
     parent::__construct($a_data, $a_id, $a_call_by_reference, false);
 }
 /**
  * @param string $a_new_type
  * @return array
  */
 protected function initCreationForms($a_new_type)
 {
     $forms = parent::initCreationForms($a_new_type);
     unset($forms[self::CFORM_IMPORT]);
     $forms[self::CFORM_NEW]->clearCommandButtons();
     $forms[self::CFORM_NEW]->addCommandButton('create-save', $this->lng->txt($a_new_type . '_add'));
     $forms[self::CFORM_NEW]->addCommandButton('cancel', $this->lng->txt('cancel'));
     return $forms;
 }