public function actionPendidikanKaryawan($id) { if (Yii::app()->request->isAjaxRequest) { $this->layout = '//layouts/polos'; } $model = KKaryawanM::model()->findByPk($id); $modelp = new KPendidikankaryawanR(); $modelpro = KKaryawanM::model()->findAll(); $modelkab = KKabupatenkotaM::model()->findAll(); $indexTab = 0; if (isset($_POST['KPendidikankaryawanR'])) { $modelp->attributes = $_POST['KPendidikankaryawanR']; $modelp->karyawan_id = $_POST['karyawan_id']; $nourutpendidikan = count(KPendidikankaryawanR::model()->findAllByAttributes(array('karyawan_id' => $modelp->karyawan_id))) + 1; $modelp->pendidikankaryawan_nourut = $nourutpendidikan; if ($modelp->validate()) { $modelp->save() == true ? Yii::app()->user->setFlash('status', 'Berhasil disimpan !') : Yii::app()->user->setFlash('status', 'Gagal disimpan !'); } else { CActiveForm::validate($modelp); } } $this->render('_formPendidikan', array('model' => $model, 'modelp' => $modelp, 'modelpro' => $modelpro, 'modelkab' => $modelkab, 'indexTab' => $indexTab)); }
<?php echo $form->labelEx($model, 'propinsi_id'); ?> <div class="mws-form-item "> <?php echo $form->dropDownList($model, 'propinsi_id', CHtml::listData(KPropinsiM::model()->findAll(), 'propinsi_id', 'propinsi_nama'), array('empty' => '', 'style' => 'width:200px;')); ?> </div> </div> <div class="mws-form-row"> <?php echo $form->labelEx($model, 'kabupatenkota_id'); ?> <div class="mws-form-item "> <?php echo $form->dropDownList($model, 'kabupatenkota_id', CHtml::listData(KKabupatenkotaM::model()->findAll(), 'kabupatenkota_id', 'kabupatenkota_nama'), array('empty' => '', 'style' => 'width:200px;')); ?> </div> </div> <div class="mws-form-row"> <?php echo $form->labelEx($model, 'departement_id'); ?> <div class="mws-form-item "> <?php echo $form->dropDownList($model, 'departement_id', CHtml::listData(KDepartementM::model()->findAll(), 'departement_id', 'departement_nama'), array('empty' => '', 'style' => 'width:120px;')); ?> </div> </div> <div class="mws-form-row"> <?php