roomID = \intval($_REQUEST['id']); } $this->room = new Room($this->roomID); if (!$this->room) { throw new IllegalLinkException(); } parent::readParameters(); } /** * @inheritDoc */ public function readData() { parent::readData(); if (empty($_POST)) { $packageID = PackageCache::getInstance()->getPackageID('be.bastelstu.chat'); I18nHandler::getInstance()->setOptions( 'title', $packageID, $this->room->title, 'chat.room.room\d+.title' ); I18nHandler::getInstance()->setOptions( 'topic', $packageID, $this->room->topic, 'chat.room.room\d+.topic' ); $this->userLimit = $this->room->userLimit; $this->topicUseHtml = $this->room->topicUseHtml; } } /** * @inheritDoc */ public function save() { AbstractForm::save(); $fields = [ 'title' => $this->title, 'topic' => $this->topic, 'topicUseHtml' => (int)$this->topicUseHtml, 'userLimit' => $this->userLimit, 'position' => 0, // TODO ]; // update room $this->objectAction = new RoomAction( [ $this->room ], 'update', [ 'data' => \array_merge( $this->additionalFields, $fields ), ] ); $returnValues = $this->objectAction->executeAction(); // save i18n values $this->saveI18nValue( $this->room, [ 'title', 'topic', ] ); // save ACL ACLHandler::getInstance()->save( $this->room->roomID, $this->aclObjectTypeID ); $this->saved(); // show success message WCF::getTPL()->assign('success', true); } /** * @inheritDoc */ public function assignVariables() { parent::assignVariables(); I18nHandler::getInstance()->assignVariables(!empty($_POST)); WCF::getTPL()->assign([ 'action' => 'edit', 'roomID' => $this->room->roomID, 'room' => $this->room, ]); } }