/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Karyawan the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Karyawan::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<div class="form"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'perbaikan-form', 'enableAjaxValidation' => false)); ?> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo $form->labelEx($model, 'Pilih PJ Mekanik'); ?> <?php $data = CHtml::listData(Karyawan::model()->findAllByAttributes(array('ID_PRIVILEGE' => 3)), 'ID_KARYAWAN', 'NAMA'); echo $form->dropDownList($model, 'PJ_MEKANIK', $data); ?> <?php echo $form->error($model, 'PJ_MEKANIK'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?> </div> <?php $this->endWidget();