Inheritance: extends BaseActiveRecordVersioned
Example #1
0
 public function actionGetScaleForInstrument()
 {
     if ($instrument = models\OphCiExamination_Instrument::model()->findByPk(@$_GET['instrument_id'])) {
         if ($scale = $instrument->scale) {
             $value = new models\OphCiExamination_IntraocularPressure_Value();
             $this->renderPartial('_qualitative_scale', array('value' => $value, 'scale' => $scale, 'side' => @$_GET['side'], 'index' => @$_GET['index']));
         }
     }
 }
Example #2
0
 /**
  * @param $eyeIds
  * @param $eye
  * @param $iop
  * @param $eyeLabel
  * @throws \CDbException
  * @throws \Exception
  */
 protected function addIop($eyeIds, $eye, $iop, $eyeLabel)
 {
     $iopReading = $eye['reading'][0]['iop'];
     $iopValue = new \OEModule\OphCiExamination\models\OphCiExamination_IntraocularPressure_Value();
     $iopValue->element_id = $iop->id;
     $iopValue->eye_id = $eyeIds[$eyeLabel];
     $iopReadingValue = \OEModule\OphCiExamination\models\OphCiExamination_IntraocularPressure_Reading::model()->find('value = ?', array($iopReading['mm_hg']));
     $instrument = \OEModule\OphCiExamination\models\OphCiExamination_Instrument::model()->find('LOWER(name) = ?', array(strtolower($iopReading['instrument'])));
     $iopValue->reading_id = $iopReadingValue['id'];
     $iopValue->instrument_id = $instrument['id'];
     if (!$iopValue->save(true, null, true)) {
         throw new \CDbException('iop value failed: ' . print_r($iop->getErrors(), true));
     }
 }