public function actionUploadSignatureFile() { $model = new FileManage(); if ($model->load(Yii::$app->request->post())) { //if($model->validate()){ $model->USER_ID = Yii::$app->user->identity->username; $model->FILE_PATH = 'signature'; $exportFile = $model->uploadFile(); //$base64File = \yii\web\UploadedFile::getInstance($model, 'uploadDataFile'); // $dateFile=\yii\web\UploadedFile::getInstanceByName($fileName); $exportFile64 = $this->saveimage(file_get_contents($exportFile->tempName)); $exportFile64Image = 'data:image/jpg;charset=utf-8;base64,' . $exportFile64; $model->FILE_NM64 = $exportFile64Image; //print_r($exportFile64); //die(); if ($model->save()) { //upload only if valid uploaded file instance found if ($exportFile !== false) { $path = $model->getImageFile(); $exportFile->saveAs($path); $employeUpdate = Employe::find()->where(['EMP_ID' => Yii::$app->user->identity->EMP_ID])->one(); $employeUpdate->SIGSVGBASE64 = $exportFile64Image; $employeUpdate->save(); return $this->redirect(['index']); } } //} } }
public function cari($params) { $empId = Yii::$app->user->identity->EMP_ID; $dt = Employe::find()->where(['EMP_ID' => $empId])->all(); $crp = $dt[0]['EMP_CORP_ID']; if ($dt[0]['JAB_ID'] == 'MGR') { $query = Requesttermheader::find()->where("t0001header.STATUS <> 3 and t0001header.STATUS <> 0 and t0001header.KD_CORP = '{$crp}' "); } else { $query = Requesttermheader::find()->where("t0001header.STATUS <> 3 and t0001header.STATUS <> 0 and t0001header.KD_CORP = '{$crp}' and t0001header.ID_USER = '******' "); } $query->joinWith(['employe' => function ($q) { $q->where('a0001.EMP_NM LIKE "%' . $this->nmemp . '%"'); }]); $dataProvider = new ActiveDataProvider(['query' => $query]); $dataProvider->setSort(['attributes' => ['KD_RIB', 'KD_CORP', 'nmemp' => ['asc' => ['a0001.EMP_NM' => SORT_ASC], 'desc' => ['a0001.EMP_NM' => SORT_DESC], 'label' => 'Pembuat']]]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['like', 'a0001.EMP_NM', $this->EMP_NM])->andFilterWhere(['like', 'KD_RIB', $this->KD_RIB])->andFilterWhere(['like', 'KD_CORP', $this->KD_CORP]); return $dataProvider; }