/** * Init the edit admin page, because we have a custom save URL, so we need to use * Admin in more then 1 function. * * @param bool $id * * @return Admin */ protected function initAdmin($id = false) { $admin = new Admin(DrugSet::model(), $this); if ($id) { $admin->setModelId($id); } $element = Element_OphDrPrescription_Details::model(); $admin->setCustomSaveURL('/OphDrPrescription/DrugSetAdmin/SaveDrugSet'); $admin->setCustomCancelURL('/OphDrPrescription/DrugSetAdmin/DrugSets'); $admin->setEditFields(array('active' => 'checkbox', 'name' => 'text', 'subspecialty' => array('widget' => 'DropDownList', 'options' => CHtml::listData(Subspecialty::model()->findAll(), 'id', 'name'), 'htmlOptions' => null, 'hidden' => false, 'layoutColumns' => null), 'setItems' => array('widget' => 'CustomView', 'viewName' => '/default/form_Element_OphDrPrescription_Details', 'viewArguments' => array('element' => $element)))); return $admin; }