OEModule\OphCoCvi\controllers\DefaultController::setValidationScenarioForElement PHP Method

setValidationScenarioForElement() protected method

We set the validation scenario for the models based on whether the user is saving as draft or performing a full save
protected setValidationScenarioForElement ( $element )
$element
    protected function setValidationScenarioForElement($element)
    {
        if ($this->request->getPost('save', null)) {
            // form has been submitted using the save button, so full validation rules should be applied to the elements
            // TODO: validation for signature(s)
            switch (get_class($element)) {
                case 'OEModule\\OphCoCvi\\models\\Element_OphCoCvi_ClinicalInfo':
                    if ($this->checkClinicalEditAccess()) {
                        $element->setScenario('finalise');
                    }
                    break;
                case 'OEModule\\OphCoCvi\\models\\Element_OphCoCvi_ClericalInfo':
                    if ($this->checkClericalEditAccess()) {
                        $element->setScenario('finalise');
                    }
                    break;
                case 'OEModule\\OphCoCvi\\models\\Element_OphCoCvi_Demographics':
                    $element->setScenario('finalise');
                    break;
            }
        }
    }