The followings are the available columns in table 'drug_duration':
Inheritance: extends BaseActiveRecordVersioned
Exemplo n.º 1
0
 /**
  * @covers DrugDuration::search
  */
 public function testSearch()
 {
     $this->model->setAttributes($this->drugduration('drugduration1')->getAttributes());
     $results = $this->model->search();
     $data = $results->getData();
     $expectedKeys = array('drugduration1');
     $expectedResults = array();
     if (!empty($expectedKeys)) {
         foreach ($expectedKeys as $key) {
             $expectedResults[] = $this->drugduration($key);
         }
     }
     $this->assertEquals(1, $results->getItemCount());
     $this->assertEquals($expectedResults, $data);
 }
 /**
  * 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();
 }
        echo $taper->id;
        ?>
" />
		<?php 
    }
    ?>
	</td>
	<td>
		<?php 
    echo CHtml::textField('prescription_item[' . $key . '][taper][' . $count . '][dose]', $taper->dose, array('autocomplete' => Yii::app()->params['html_autocomplete']));
    ?>
	</td>
	<td></td>
	<td></td>
	<td>
		<?php 
    echo CHtml::dropDownList('prescription_item[' . $key . '][taper][' . $count . '][frequency_id]', $taper->frequency_id, CHtml::listData(DrugFrequency::model()->activeOrPk($taper->frequency_id)->findAll(array('order' => 'display_order asc')), 'id', 'name'), array('empty' => '-- Select --'));
    ?>
	</td>
	<td>
		<?php 
    echo CHtml::dropDownList('prescription_item[' . $key . '][taper][' . $count . '][duration_id]', $taper->duration_id, CHtml::listData(DrugDuration::model()->activeOrPk($taper->duration_id)->findAll(array('order' => 'display_order asc')), 'id', 'name'), array('empty' => '-- Select --'));
    ?>
	</td>
	<td class="prescription-actions">
		<a class="removeTaper"	href="#">Remove</a>
	</td>
</tr>
<?php 
    ++$count;
}