/** * @see Page::readData() */ public function readData() { parent::readData(); // set default values if (!count($_POST)) { $this->title = $this->rule->title; $this->logicalOperator = $this->rule->logicalOperator; $this->enabled = intval(!$this->rule->disabled); $this->ruleAction = $this->rule->ruleAction; $this->ruleDestination = $this->rule->ruleDestination; // conditions foreach ($this->rule->getConditions() as $condition) { $this->ruleConditions[] = array('type' => $condition->ruleConditionType, 'condition' => $condition->ruleCondition, 'value' => $condition->ruleConditionValue); } } }
/** * @see Form::save() */ public function save() { parent::save(); // save rule PMRuleEditor::create(WCF::getUser()->userID, $this->title, $this->logicalOperator, $this->ruleConditions, $this->ruleAction, $this->ruleDestination, intval(!$this->enabled)); $this->saved(); // reset values $this->title = $this->logicalOperator = $this->ruleAction = $this->ruleDestination = ''; $this->ruleConditions = array(); $this->enabled = 1; // show success message WCF::getTPL()->assign('success', true); }