/** * Edits or adds a Procedure. * * @param bool|int $id * * @throws CHttpException */ public function actionEdit($id = false) { $admin = new Admin(FormularyDrugs::model(), $this); if ($id) { $admin->setModelId($id); } $admin->setModelDisplayName('Formulary Drugs'); $criteria = new CDbCriteria(); $admin->setEditFields(array('id' => 'label', 'name' => 'text', 'type_id' => array('widget' => 'DropDownList', 'options' => CHtml::listData(DrugType::model()->findAll(), 'id', 'name'), 'htmlOptions' => null, 'hidden' => false, 'layoutColumns' => null), 'aliases' => 'text', 'tallman' => 'text', 'form_id' => array('widget' => 'DropDownList', 'options' => CHtml::listData(DrugForm::model()->findAll(), 'id', 'name'), 'htmlOptions' => null, 'hidden' => false, 'layoutColumns' => null), 'dose_unit' => 'text', 'default_dose' => 'text', 'default_route_id' => array('widget' => 'DropDownList', 'options' => CHtml::listData(DrugRoute::model()->findAll(), 'id', 'name'), 'htmlOptions' => array('empty' => '-- Please select --'), 'hidden' => false, 'layoutColumns' => null), 'default_frequency_id' => array('widget' => 'DropDownList', 'options' => CHtml::listData(DrugFrequency::model()->findAll(), 'id', 'name'), 'htmlOptions' => array('empty' => '-- Please select --'), 'hidden' => false, 'layoutColumns' => null), 'default_duration_id' => array('widget' => 'DropDownList', 'options' => CHtml::listData(DrugDuration::model()->findAll(), 'id', 'name'), 'htmlOptions' => array('empty' => '-- Please select --'), 'hidden' => false, 'layoutColumns' => null), 'preservative_free' => 'checkbox', 'active' => 'checkbox', 'allergy_warnings' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'Allergy Warnings', 'options' => CHtml::encodeArray(CHtml::listData(Allergy::model()->findAll($criteria->condition = "name != 'Other'"), 'id', 'name'))))); $admin->editModel(); }
<input type="hidden" name="prescription_item[<?php echo $key; ?> ][drug_id]" value="<?php echo $item->drug_id; ?> " /> </td> <td class="prescriptionItemDose"> <?php echo CHtml::textField('prescription_item[' . $key . '][dose]', $item->dose, array('autocomplete' => Yii::app()->params['html_autocomplete'])); ?> </td> <td> <?php echo CHtml::dropDownList('prescription_item[' . $key . '][route_id]', $item->route_id, CHtml::listData(DrugRoute::model()->activeOrPk($item->route_id)->findAll(array('order' => 'display_order asc')), 'id', 'name'), array('empty' => '-- Select --', 'class' => 'drugRoute')); ?> </td> <td> <?php if ($item->route && ($options = $item->route->options)) { echo CHtml::dropDownList('prescription_item[' . $key . '][route_option_id]', $item->route_option_id, CHtml::listData($options, 'id', 'name'), array('empty' => '-- Select --')); } else { echo '-'; } ?> </td> <td class="prescriptionItemFrequencyId"> <?php echo CHtml::dropDownList('prescription_item[' . $key . '][frequency_id]', $item->frequency_id, CHtml::listData(DrugFrequency::model()->activeOrPk($item->frequency_id)->findAll(array('order' => 'display_order asc')), 'id', 'name'), array('empty' => '-- Select --')); ?>
/** * @covers DrugForm::tableName */ public function testTableName() { $this->assertEquals('drug_route', $this->model->tableName()); }