model() public static method

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : OphCiExamination_Comorbidities_Item
return OphCiExamination_Comorbidities_Item the static model class
 public function down()
 {
     $subspecialty = \Subspecialty::model()->findByAttributes(array('name' => 'Cataract'));
     foreach ($this->defaultCataractComplications as $defaultCataractComplication) {
         $complication = \OEModule\OphCiExamination\models\OphCiExamination_PostOpComplications::model()->findByAttributes(array('code' => $defaultCataractComplication['code']));
         $where = "complication_id = '" . $complication->id . "' AND subspecialty_id = '" . $subspecialty->id . "'";
         $this->delete('ophciexamination_postop_complications_subspecialty', $where);
     }
 }
示例#2
0
 public function actionGetPostOpComplicationAutocopleteList()
 {
     $isAjax = \Yii::app()->request->getParam('ajax', false);
     if (\Yii::app()->request->isAjaxRequest || $isAjax) {
         $term = \Yii::app()->request->getParam('term', false);
         $element_id = \Yii::app()->request->getParam('element_id', null);
         $operation_note_id = \Yii::app()->request->getParam('operation_note_id', null);
         $eye_id = \Yii::app()->request->getParam('eye_id', null);
         $firm = \Firm::model()->findByPk(Yii::app()->session['selected_firm_id']);
         $subspecialty_id = $firm->serviceSubspecialtyAssignment ? $firm->serviceSubspecialtyAssignment->subspecialty_id : null;
         if (isset($_GET['term']) && strlen($term = $_GET['term']) > 0) {
             $select_values = models\OphCiExamination_PostOpComplications::model()->getPostOpComplicationsList($element_id, $operation_note_id, $subspecialty_id, $eye_id, $term);
             $select = array();
             foreach ($select_values as $select_value) {
                 $select[] = array('value' => $select_value->id, 'label' => $select_value->name);
             }
         }
         echo \CJSON::encode($select);
     }
 }
示例#3
0
 public function actionUpdatePostOpComplications()
 {
     $item_ids = Yii::app()->request->getParam('item_ids', array());
     $subspecialty_id = Yii::app()->request->getParam('subspecialty_id', null);
     $tx = Yii::app()->db->beginTransaction();
     models\OphCiExamination_PostOpComplications::model()->assign($item_ids, $subspecialty_id);
     $tx->commit();
     $this->redirect(array('/OphCiExamination/admin/postOpComplications', 'subspecialty_id' => $subspecialty_id));
 }
示例#4
0
 /**
  * @param $userId
  * @param $eyeIds
  * @param $opNoteEventId
  * @param $eye
  * @param $complications
  * @param $eyeLabel
  * @throws \Exception
  */
 protected function addComplication($userId, $eyeIds, $opNoteEventId, $eye, $complications, $eyeLabel)
 {
     if (array_key_exists('complications', $eye)) {
         if (count($eye['complications'])) {
             foreach ($eye['complications'] as $complicationArray) {
                 $eyeComplication = new \OEModule\OphCiExamination\models\OphCiExamination_Et_PostOpComplications();
                 $eyeComplication->element_id = $complications->id;
                 $complicationToAdd = \OEModule\OphCiExamination\models\OphCiExamination_PostOpComplications::model()->find('name = "' . $complicationArray['complication'] . '"');
                 $eyeComplication->complication_id = $complicationToAdd->id;
                 $eyeComplication->operation_note_id = $opNoteEventId;
                 $eyeComplication->eye_id = $eyeIds[$eyeLabel];
                 $eyeComplication->created_user_id = $eyeComplication->last_modified_user_id = $userId;
                 $eyeComplication->save(true, null, true);
             }
         } else {
             $eyeComplication = new \OEModule\OphCiExamination\models\OphCiExamination_Et_PostOpComplications();
             $eyeComplication->element_id = $complications->id;
             $complicationToAdd = \OEModule\OphCiExamination\models\OphCiExamination_PostOpComplications::model()->find('name = "none"');
             $eyeComplication->complication_id = $complicationToAdd->id;
             $eyeComplication->operation_note_id = $opNoteEventId;
             $eyeComplication->eye_id = $eyeIds[$eyeLabel];
             $eyeComplication->created_user_id = $eyeComplication->last_modified_user_id = $userId;
             $eyeComplication->save(true, null, true);
         }
     }
 }
		</div>

		<div class="inactive-form">
			<div class="add-side">
				<a href="#">
					Add right side <span class="icon-add-side"></span>
				</a>
			</div>
		</div>
	</div>
	<div class="element-eye left-eye column right side" data-side="left">
		<div class="active-form">
			<a href="#" class="icon-remove-side remove-side">Remove side</a>
			<?php 
    echo $form->dropDownList(OphCiExamination_PostOpComplications::model(), 'name', $left_eye_data, array('empty' => array('-1' => '-- Select --'), 'id' => 'left-complication-select'), false, array('label' => 4, 'field' => 6));
    $this->widget('zii.widgets.jui.CJuiAutoComplete', array('name' => 'left_complication_autocomplete_id', 'id' => 'left_complication_autocomplete_id', 'source' => "js:function(request, response) {\n                                                        \$.getJSON('" . $defaultURL . "/getPostOpComplicationAutocopleteList', {\n                                                                term : request.term,\n                                                                eye_id: '" . \Eye::LEFT . "',\n                                                                element_id: '" . $this->id . "',\n                                                                operation_note_id: '" . $operation_note_id . "',\n                                                                ajax: 'ajax',\n                                                        }, response);\n\n                                                }", 'options' => array('select' => "js:function(event, ui) {\n                                                                                console.log(ui);\n\t\t\t\t\t\t\t\t\t\taddPostOpComplicationTr(ui.item.label, 'left-complication-list', ui.item.value, 0  );\n\t\t\t\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t\t\t\t}"), 'htmlOptions' => array('placeholder' => 'search for complications')));
    ?>
                        <hr>
                </div>

                <div class="active-form">

                    <h5 class="left-recorded-complication-text recorded <?php 
    echo $left_values ? '' : 'hide';
    ?>
">Recorded Complications</h5>
                    <h5 class="left-no-recorded-complication-text no-recorded <?php 
    echo $left_values ? 'hide' : '';
    ?>
">No Recorded Complications</h5>