Beispiel #1
0
 public function actionIndex()
 {
     /* Author: -ptr.nov- : Split Index Before/After Login */
     if (\Yii::$app->user->isGuest) {
         $model = new LoginForm();
         return $this->render('index_nologin', ['model' => $model]);
     } else {
         $ModelUser = UserloginSearch::findUserAttr(Yii::$app->user->id)->one();
         $model = $this->findModel1($ModelUser->emp->EMP_ID);
         $searchModel1 = new EmployeSearch();
         $dataProvider = $searchModel1->search_empid($ModelUser->emp->EMP_ID);
         // echo  \yii\helpers\Json::encode($dataProvider);
         //print_r($dataProvider->getModels());
         return $this->render('index', ['model' => $model, 'dataProvider' => $dataProvider->getModels()]);
     }
 }
Beispiel #2
0
 public function actionIndex()
 {
     /*	variable content View Side Menu Author: -Eka- */
     //set menu side menu index - Array Jeson Decode
     // $side_menu=M1000::find()->findMenu('sss_berita_acara')->one()->jval;
     //$side_menu=json_decode($side_menu,true);
     /*	variable content View Employe Author: -ptr.nov- */
     $searchModel = new EmployeSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     /*	variable content View Additional Author: -ptr.nov- */
     //$searchFilter = $searchModel->searchALL(Yii::$app->request->queryParams);
     $searchModel1 = new EmployeSearch();
     $dataProvider1 = $searchModel->search_resign(Yii::$app->request->queryParams);
     /*SHOW ARRAY YII Author: -Devandro-*/
     //print_r($dataProvider->getModels());
     /*SHOW ARRAY JESON Author: -ptr.nov-*/
     //echo  \yii\helpers\Json::encode($dataProvider->getModels());
     if (Yii::$app->request->post('hasEditable')) {
         // instantiate your book model for saving
         $EMP_ID = Yii::$app->request->post('editableKey');
         $model = Employe::findOne($EMP_ID);
         // store a default json response as desired by editable
         $out = Json::encode(['output' => '', 'message' => '']);
         // fetch the first entry in posted data (there should
         // only be one entry anyway in this array for an
         // editable submission)
         // - $posted is the posted data for Book without any indexes
         // - $post is the converted array for single model validation
         $post = [];
         $posted = current($_POST['Employe']);
         $post['Employe'] = $posted;
         // load model like any single model validation
         if ($model->load($post)) {
             // can save model or do something before saving model
             $model->save();
             // custom output to return to be displayed as the editable grid cell
             // data. Normally this is empty - whereby whatever value is edited by
             // in the input by user is updated automatically.
             $output = '';
             // specific use case where you need to validate a specific
             // editable column posted when you have more than one
             // EditableColumn in the grid view. We evaluate here a
             // check to see if buy_amount was posted for the Book model
             if (isset($posted['EMP_NM'])) {
                 // $output =  Yii::$app->formatter->asDecimal($model->EMP_NM, 2);
                 $output = $model->EMP_NM;
             }
             // similarly you can check if the name attribute was posted as well
             // if (isset($posted['name'])) {
             //   $output =  ''; // process as you need
             // }
             $out = Json::encode(['output' => $output, 'message' => '']);
         }
         // return ajax json encoded response and exit
         echo $out;
         return;
     }
     //$generate_key_emp= Yii::$app->ambilkonci->getKey_Employe('GSN');
     //print_r($generate_key_emp);
     $model = $this->findModel('ALG.2015.000056');
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'searchModel1' => $searchModel1, 'dataProvider1' => $dataProvider1, 'model' => $model]);
 }