/** * @see Page::readData() */ public function readData() { parent::readData(); // get categories $this->classes = ContestClass::getClasses(); }
/** * @see Form::validate() */ public function validate() { parent::validate(); $this->availableClasses = ContestClass::getClasses(); // validate class ids foreach ($this->classIDArray as $key => $classID) { if (!isset($this->availableClasses[$classID])) { unset($this->classIDArray[$key]); } } if (count($this->classIDArray) == 0) { throw new UserInputException('classes'); } if ($this->ownerID != 0) { $this->availableGroups = ContestUtil::readAvailableGroups(); // validate group ids if (!array_key_exists($this->ownerID, $this->availableGroups)) { throw new UserInputException('ownerID'); } } else { if ($this->userID == 0) { throw new UserInputException('ownerID'); } } if (!array_key_exists($this->state, $this->getStates())) { throw new UserInputException('state'); } }