/** * Does this form hold valid data for this album? * @param ALBUM $obj * @access private */ protected function _post_validate($obj) { parent::_post_validate($obj); /** @var DATE_TIME $first_day_value */ $first_day_value = $this->value_for('first_day'); /** @var DATE_TIME $last_day_value */ $last_day_value = $this->value_for('last_day'); switch ($this->value_for('date_style')) { case Album_is_journal: $now = new DATE_TIME(); if ($now->less_than($first_day_value)) { $this->record_error('first_day', 'First day of a journal cannot be in the future.'); } break; case Album_is_span: if ($last_day_value->less_than($first_day_value)) { $this->record_error('last_day', 'First day must come before the last day.'); } break; } if ($this->value_for('constrain_picture_size') && ($this->value_for('max_picture_width') == 0 || $this->value_for('max_picture_width') == 0)) { $this->record_error('picture', 'Please make sure that both picture width and height are greater than 0.'); } }