(C) Moorfields Eye Hospital NHS Foundation Trust, 2008-2011
(C) OpenEyes Foundation, 2011-2013
This file is part of OpenEyes.
OpenEyes is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
OpenEyes is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with OpenEyes in a file titled COPYING. If not, see .
public function afterValidate() { switch ($this->application_type_id) { case OphTrOperationnote_Antimetabolite_Application_Type::SPONGE: if (is_null($this->duration)) { $this->addError('duration', '{attribute} cannot be blank'); } if (is_null($this->number)) { $this->addError('number', '{attribute} cannot be blank'); } if (is_null($this->washed)) { $this->addError('washed', '{attribute} cannot be blank'); } $this->volume_id = null; break; case OphTrOperationnote_Antimetabolite_Application_Type::INJECTION: if (is_null($this->volume_id)) { $this->addError('volume_id', '{attribute} cannot be blank'); } $this->duration = null; $this->number = null; $this->washed = null; break; } parent::afterValidate(); }
public function afterValidate() { if ($this->hasMultiSelectValue('difficulties', 'Other')) { if (!$this->difficulty_other) { $this->addError('difficulty_other', $this->getAttributeLabel('difficulty_other') . ' cannot be blank.'); } } if ($this->hasMultiSelectValue('complications', 'Other')) { if (!$this->complication_other) { $this->addError('complication_other', $this->getAttributeLabel('complication_other') . ' cannot be blank.'); } } return parent::afterValidate(); }
protected function afterConstruct() { if ($this->isNewRecord && isset(Yii::app()->session['selected_firm_id'])) { $defaultLengthRecord = OphTrOperationnote_CataractIncisionLengthDefault::model()->findByAttributes(array('firm_id' => (int) Yii::app()->session['selected_firm_id'])); if ($defaultLengthRecord) { $this->length = $defaultLengthRecord->value; } elseif (isset(Yii::app()->params['default_incision_length']) && Yii::app()->params['default_incision_length'] !== '') { $this->length = Yii::app()->params['default_incision_length']; } } parent::afterConstruct(); }
/** * Returns the static model of the specified AR class. * * @return ElementOperation the static model class */ public static function model($className = __CLASS__) { return parent::model($className); }
public function beforeDelete() { OphTrOperationnote_Trabectome_ComplicationAssignment::model()->deleteAll('element_id = ?', array($this->id)); return parent::beforeDelete(); }
public function beforeSave() { if (!$this->gas_volume_id) { $this->gas_volume_id = null; } return parent::beforeSave(); }