model() public static method

Returns the static model of the specified AR class.
public static model ( $className = __CLASS__ ) : DrugFrequency
return DrugFrequency the static model class
 /**
  * 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();
 }
Example #2
0
 /**
  * @covers DrugForm::model
  */
 public function testModel()
 {
     $this->assertEquals('DrugFrequency', get_class(DrugFrequency::model()), 'Class name should match model.');
 }
        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;
}