/** * Does this form hold valid data for this picture? * @param ALBUM_ENTRY $obj * @access private */ protected function _post_validate($obj) { parent::_post_validate($obj); if (!$this->_folder->is_valid_date($this->value_for('day'))) { $fd_fmt = $this->_folder->format_date($this->_folder->first_day); $ld_fmt = $this->_folder->format_date($this->_folder->last_day); $this->record_error('day', "Please make sure that the day is between {$fd_fmt} and {$ld_fmt}."); } }
/** * Does this form hold valid data for this project entry? * Applies additional check to ensure that at least one branch is selected. * @param PROJECT_ENTRY $obj * @access private */ protected function _post_validate($obj) { parent::_post_validate($obj); $count = sizeof($this->branches); $index = 0; $selected = false; while (!$selected && $index < $count) { $branch = $this->branches[$index]; $selected = $this->value_for("branch_{$branch->id}_enabled") > 0; $index += 1; } if (!$selected) { $this->record_error('main_branch_id', 'Please select at least one branch.'); } $main_branch_id = $this->value_for('main_branch_id'); if (!$main_branch_id) { $this->record_error('main_branch_id', 'Please select a branch for use in non-branch-specific lists.'); } else { if (!$this->value_for("branch_{$main_branch_id}_enabled")) { $this->record_error('main_branch_id', 'Please select an enabled branch for use in non-branch-specific lists.'); } } }