triggerID = intval($_REQUEST['id']); $this->trigger = new CommandTrigger($this->triggerID); if (!$this->trigger) { throw new IllegalLinkException(); } parent::readParameters(); } /** * @inheritDoc */ public function readData() { parent::readData(); if (empty($_POST)) { $commandList = new \chat\data\command\CommandList(); $commandList->getConditionBuilder()->add('command.commandID = ?', [ $this->trigger->commandID ]); $commandList->readObjects(); $commands = $commandList->getObjects(); if (!count($commands)) { throw new IllegalLinkException(); } $this->commandTrigger = $this->trigger->commandTrigger; $this->className = $commands[$this->trigger->commandID]->className; } } /** * @inheritDoc */ public function save() { \wcf\form\AbstractForm::save(); $fields = [ 'commandTrigger' => $this->commandTrigger , 'commandID' => $this->command->commandID ]; // update trigger $this->objectAction = new CommandTriggerAction([ $this->trigger ], 'update', [ 'data' => array_merge($this->additionalFields, $fields) ]); $this->objectAction->executeAction(); $this->saved(); // show success message WCF::getTPL()->assign('success', true); } /** * @inheritDoc */ public function assignVariables() { parent::assignVariables(); WCF::getTPL()->assign([ 'action' => 'edit' , 'triggerID' => $this->trigger->triggerID ]); } }