/** * Extra validation for training disruptions to make sure the disruption date * is after the intake date of the training being disrupted. * */ protected function validate() { parent::validate(); if (I2CE_Validate::checkDate($this->getPrimary()->disruption_date) && $this->getPrimary()->disruption_date->before($this->getParent()->intake_date)) { $this->getPrimary()->setInvalidMessage("disruption_date", "bad_date"); } }
/** * Create and load data for the objects used for this form. * * Set the default license number to be the same as the registration for this * training. */ protected function loadObjects() { parent::loadObjects(); if (!$this->isPost() && !$this->getPrimary()->license_number) { $parent = $this->getParent(); $parent->populateChildren("registration"); $reg = current($parent->children['registration']); $this->getPrimary()->license_number = $reg->registration_number; } }
/** * Create and load data for the objects used for this form. */ protected function loadObjects() { parent::loadObjects(); if (!$this->isPost()) { $parent = $this->getParent(); $parent->populateLast(array("license" => "end_date")); $last = current($parent->children['license']); if ($last) { $this->getPrimary()->license_number = $last->license_number; } } }
/** * Save the objects to the database. * * Save the default object being edited and return to the view page. If the action needs to be * logged then the {@link log} method is also called. Any pages overriding this default save method * will need to include any logging necessary. */ protected function save() { parent::save(); if ($this->getPrimary()->suspend) { $parent = $this->getParent(); $parent->populateLast(array("license" => "end_date")); $license = current($parent->children['license']); if ($license) { $license->suspend = true; $license->save($this->user); } } }
/** * Extra validation for training disruptions to make sure the disruption date * is after the intake date of the training being disrupted. * */ protected function validate() { parent::validate(); if ($this->isPost()) { if (!I2CE_Validate::checkDate($this->getPrimary()->resumption_date)) { $this->getPrimary()->setInvalidMessage("resumption_date", 'required'); } } }