/** * 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"); } }
/** * Checks to see if the current value for this is set and valid. * @return boolean */ public function isValid() { if (!$this->issetValue()) { return false; } $value = $this->getValue(); $allow_blank_date = 1; if ($this->hasOption('allow_blank_date') && !$this->getOption('allow_blank_date')) { $allow_blank_date = 0; } if ($allow_blank_date && $value->isBlank()) { return true; } return I2CE_Validate::checkDate($this->getValue()); }
/** * 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'); } } }
/** * Perform any extra validation for the disciplinary action. * @param I2CE_From $form */ public function validate_form_disciplinary_action($form) { if (I2CE_Validate::checkDate($form->reinstate_date) && I2CE_Validate::checkDate($form->action_date)) { if ($form->reinstate_date->before($form->action_date)) { $form->setInvalidMessage("reinstate_date", 'bad_date_action'); } } }
/** * Perform any extra validation for the license. * @param I2CE_Form $form */ public function validate_form_scheduled_training_course($form) { if (I2CE_Validate::checkDate($form->end_date) && I2CE_Validate::checkDate($form->start_date)) { $compare = $form->end_date->compare($form->start_date); if ($compare > 0) { $form->setInvalidMessage("end_date", 'bad_date'); } } }
/** * Checks to see if the current value for this is set and valid. * @return boolean */ public function isValid() { if (!$this->issetValue()) { return false; } $value = $this->getValue(); if ($value->isBlank()) { return true; } return I2CE_Validate::checkDate($this->getValue()); }
/** * Perform the main actions of the page. */ protected function action() { parent::action(); $this->template->addHeaderLink("view.js"); $this->template->appendFileById("menu_view.html", "li", "navBarUL", true); $this->template->appendFileById("menu_view_training.html", "ul", "menuView"); $factory = I2CE_FormFactory::instance(); $training = $factory->createContainer("training" . '|' . $this->get('id')); $training->populate(); $person = $factory->createContainer($training->getParent()); $person->populate(); $training->populateChildren(array("training_disrupt", "exam", "registration", "private_practice", "disciplinary_action", "continuing_education")); $training->populateLast(array("license" => "end_date")); //$training->setDisplayData( $this->template ); $this->template->setForm($training); $this->template->setForm($person); $has_disrupt = false; $has_suspension = false; $all_resume = true; if (count($training->children) > 0) { foreach ($training->children as $form => $list) { foreach ($list as $obj) { $node = $this->template->appendFileById("view_tr_" . $form . ".html", "div", $form); if ($form == "license" || $form == "exam") { // Since there's only one license on a page set it for the whole page // instead of just the node so other links can work with it. $this->template->setForm($obj); } else { $this->template->setForm($obj, $node); } if ($form == "training_disrupt") { $has_disrupt = true; if (!I2CE_Validate::checkDate($obj->resumption_date)) { $all_resume = false; } } if ($form == "disciplinary_action") { if ($obj->suspend) { $has_suspension = true; } } } } } if ($has_disrupt && !$all_resume) { $this->template->appendFileById("view_tr_resume_link.html", "span", "training_links"); } elseif (($has_disrupt ? $all_resume : true) && !I2CE_Validate::checkDate($training->graduation)) { $this->template->appendFileById("view_tr_disrupt_link.html", "span", "training_links"); } if (!array_key_exists("exam", $training->children)) { $this->template->addFile("view_tr_exam_link.html", "tbody"); } if (!array_key_exists("registration", $training->children) && I2CE_Validate::checkDate($training->graduation)) { $this->template->appendFileById("view_tr_registration_link.html", "span", "registration_links"); } if (!array_key_exists("license", $training->children) && array_key_exists("registration", $training->children)) { $this->template->appendFileById("view_tr_license_link.html", "span", "license_links"); } if (array_key_exists("license", $training->children)) { if ($has_suspension) { $this->template->appendFileById("view_tr_reinstate_link.html", "span", "disciplinary_links"); } else { $this->template->appendFileById("view_tr_renew_link.html", "span", "license_links"); $this->template->appendFileById("view_tr_disciplinary_action_link.html", "span", "disciplinary_links"); } } }