Exemplo n.º 1
0
 public function actionPengalamanKerja($id)
 {
     $this->layout = '//layouts/column2';
     $this->setUserMenu();
     $indexTab = 1;
     $pengalaman = KPengalamankerjaR::model()->findByAttributes(array('karyawan_id' => $id));
     $this->render('_formPengalamanKerja', array('id' => $id, 'indexTab' => $indexTab, 'pengalaman' => $pengalaman));
 }
 public function actionPengalamanKerja($id)
 {
     if (Yii::app()->request->isAjaxRequest) {
         $this->layout = '//layouts/polos';
     }
     $model = KKaryawanM::model()->findByPk($id);
     $modelpk = new KPengalamankerjaR();
     $indexTab = 1;
     if (isset($_POST['KPengalamankerjaR'])) {
         $modelpk->attributes = $_POST['KPengalamankerjaR'];
         $modelpk->karyawan_id = $_POST['karyawan_id'];
         $nourut = count(KPengalamankerjaR::model()->findAllByAttributes(array('karyawan_id' => $modelpk->karyawan_id))) + 1;
         $modelpk->pengalamankerja_nourut = $nourut;
         if ($modelpk->validate()) {
             $modelpk->save() == true ? Yii::app()->user->setFlash('status', 'Berhasil disimpan !') : Yii::app()->user->setFlash('status', 'Gagal disimpan !');
         }
     }
     $this->render('_formPengalamanKerja', array('model' => $model, 'modelpk' => $modelpk, 'indexTab' => $indexTab));
 }