The followings are the available columns in table:
public function actionDeleteTreatmentDrugs() { $result = 1; foreach (OphTrIntravitrealinjection_Treatment_Drug::model()->findAllByPk($_POST['treatment_drugs']) as $drug) { if (!$drug->delete()) { $result = 0; } } echo $result; }
<div class="large-4 column end"> <?php echo CHtml::dropDownList('given_by_id', '', CHtml::listData(User::model()->findAll(array('order' => 'first_name asc,last_name asc')), 'id', 'fullName'), array('empty' => '- Please select -')); ?> </div> </div> <div class="row field-row"> <div class="large-2 column"> <?php echo CHtml::label('Drugs', 'drug_id'); ?> </div> <div class="large-4 column end"> <?php echo CHtml::dropDownList('drug_id', '', CHtml::listData(OphTrIntravitrealinjection_Treatment_Drug::model()->findAll(array('order' => 'name asc')), 'id', 'name'), array('empty' => '- Please select -')); ?> </div> </div> <div class="row field-row"> <div class="large-2 column"> <?php echo CHtml::label('Pre Injection Antiseptic', 'pre_antisept_drug_id'); ?> </div> <div class="large-4 column end"> <?php echo CHtml::dropDownList('pre_antisept_drug_id', '', CHtml::listData(OphTrIntravitrealinjection_AntiSepticDrug::model()->findAll(array('order' => 'name asc')), 'id', 'name'), array('empty' => '- Please select -')); ?> </div>
/** * return a list of treatment drugs for use in admin. * * @return OphTrIntravitrealinjection_Treatment_Drug[] */ public function getTreatmentDrugs() { $drugs = OphTrIntravitrealinjection_Treatment_Drug::model()->findAll(); if ($this->drug_id) { $drug_array = array(); foreach ($drugs as $drug) { if ($drug->id == $this->drug_id) { return $drugs; } $drug_array[] = $drug; } $drugs[] = $this->drug; } return $drugs; }
/** * simple cache for drug objects. * * @param $drug_id * * @return OphTrIntravitrealinjection_Treatment_Drug|null */ protected function getDrugById($drug_id) { if (!@$this->_drug_cache[$drug_id]) { $this->_drug_cache[$drug_id] = OphTrIntravitrealinjection_Treatment_Drug::model()->findByPk($drug_id); } return $this->_drug_cache[$drug_id]; }
/** * return the treatment drug for the right side if defined * * defines relation to external model, hence not using the yii magic relations definition * * @return OphTrIntravitrealinjection_Treatment_Drug|null */ public function getright_treatment() { if ($this->injectionInstalled()) { if ($this->hasRight() && $this->right_treatment_id) { return \OphTrIntravitrealinjection_Treatment_Drug::model()->findByPk($this->right_treatment_id); } } }
} ?> <?php $div_class = 'eventDetail'; if (!$show) { $div_class .= ' hidden'; } $html_options = array('options' => array(), 'empty' => '- Please select -', 'div_id' => 'div_' . get_class($element) . '_' . $side . '_pre_ioploweringdrugs', 'label' => $element->getAttributeLabel($side . '_pre_ioploweringdrugs'), 'div_class' => $div_class); $ioplowering_drugs = OphTrIntravitrealinjection_IOPLoweringDrug::model()->activeOrPk($element->iopLoweringDrugValues)->findAll(array('order' => 'display_order asc')); foreach ($ioplowering_drugs as $drug) { $html_options['options'][(string) $drug->id] = array('data-order' => $drug->display_order); } echo $form->multiSelectList($element, get_class($element) . '[' . $side . '_pre_ioploweringdrugs]', $side . '_pre_ioploweringdrugs', 'id', CHtml::listData($ioplowering_drugs, 'id', 'name'), array(), $html_options, false, false, null, false, false, array('field' => 6)); $drugs = OphTrIntravitrealinjection_Treatment_Drug::model()->activeOrPk($element->{$side . '_drug_id'})->findAll(); $html_options = array('empty' => '- Please select -', 'options' => array()); // get the previous injection counts for each of the drug options for this eye $drug_history = array(); foreach ($drugs as $drug) { if ($element->event_id) { $previous = $injection_api->previousInjectionsByEvent($element->event_id, $side, $drug); } else { $previous = $injection_api->previousInjections($this->patient, $episode, $side, $drug); } $count = 0; if (sizeof($previous)) { $count = $previous[0][$side . '_number']; } $drug_history[$drug->id] = array_reverse($previous); $html_options['options'][$drug->id] = array('data-previous' => $count);