/** * Sets the value of this field from the posted form. * @param array $post The $_POST array holding the values for this form. */ public function setFromPost($post) { if (is_array($post)) { if (array_key_exists('month', $post)) { $this->setValue(I2CE_Date::getDate($post['day'], $post['month'], $post['year'])); return; } } elseif (is_string($post)) { $this->setFromDB($post); return; } $this->setValue(I2CE_Date::getDate()); }
public function validate_form_resume_semester($form) { $ff = I2CE_FormFactory::instance(); $academic_year = implode("|", $form->academic_year); if ($academic_year == "|") { return; } $acadYrObj = $ff->createContainer($academic_year); $acadYrObj->populate(); $academic_year = $acadYrObj->getField("name")->getDBValue(); $academic_year = explode("/", $academic_year); $start_dateObj = I2CE_Date::getDate(01, 07, $academic_year[0]); $end_dateObj = I2CE_Date::getDate(30, 05, $academic_year[1]); $start_date = $start_dateObj->displayDate(); $end_date = $end_dateObj->displayDate(); if ($start_dateObj->compare($form->resume_date) == -1) { $form->setInvalidMessage("resume_date", "Resume Date Should Be After {$start_date}"); } if ($end_dateObj->compare($form->resume_date) != -1) { $form->setInvalidMessage("resume_date", "Resume Date Should Be Before {$end_date}"); } }