コード例 #1
0
ファイル: EmployeController.php プロジェクト: C12D/advanced
 /**
  * ACTION CREATE note | $id=PrimaryKey -> TRIGER FROM VIEW  -ptr.nov-
  */
 public function actionCreate()
 {
     $model = new Employe();
     if ($model->load(Yii::$app->request->post())) {
         $upload_file = $model->uploadFile();
         var_dump($model->validate());
         if ($model->validate()) {
             if ($model->save()) {
                 $model->CREATED_BY = Yii::$app->user->identity->username;
                 $model->save();
                 if ($upload_file !== false) {
                     $path = $model->getUploadedFile();
                     $upload_file->saveAs($path);
                 }
                 //return $this->redirect(['view', 'id' => $model->EMP_ID]);
                 return $this->redirect(['index']);
             }
         }
     } else {
         //$js='$("#create-emp").modal("show")';
         //$this->getView()->registerJs($js);
         //return $this->render('create', [
         //return $this->renderAjax('create', [
         return $this->renderAjax('_form', ['model' => $model]);
     }
 }