/** * Edits or adds a Procedure. * * @param bool|int $id * * @throws CHttpException */ public function actionEdit($id = false) { $admin = new Admin(Procedure::model(), $this); if ($id) { $admin->setModelId($id); } $admin->setEditFields(array('term' => 'text', 'short_format' => 'text', 'default_duration' => 'text', 'snomed_code' => 'text', 'snomed_term' => 'text', 'aliases' => 'text', 'unbooked' => 'checkbox', 'active' => 'checkbox', 'opcsCodes' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'OPCS Code', 'options' => CHtml::encodeArray(CHtml::listData(OPCSCode::model()->findAll(), 'id', function ($model) { return $model->name . ': ' . $model->description; }))), 'benefits' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'Benefit', 'options' => CHtml::encodeArray(CHtml::listData(Benefit::model()->findAll(), 'id', 'name'))), 'complications' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'Complication', 'options' => CHtml::encodeArray(CHtml::listData(Complication::model()->findAll(), 'id', 'name'))))); if (isset($admin->getModel()->operationNotes)) { $admin->setEditFields(array_merge($admin->getEditFields(), array('operationNotes' => array('widget' => 'MultiSelectList', 'relation_field_id' => 'id', 'label' => 'Operation Note Element', 'options' => CHtml::encodeArray(CHtml::listData(ElementType::model()->findAllByAttributes(array(), 'event_type_id in (select id from event_type where name = "Operation Note")'), 'id', 'name')))))); } $admin->editModel(); }
/** * @covers Complication::rules */ public function testRules() { $this->assertTrue($this->model->validate()); $this->assertEmpty($this->model->errors); }
/** * Deletes rows for the model */ public function actionDelete() { $admin = new Admin(Complication::model(), $this); $admin->deleteModel(); }