Ejemplo n.º 1
0
 public function actionUploadJoin($KD_BERITA)
 {
     $fileName = 'file';
     $model = new beritaimage();
     $cariemp_inberita = Berita::find()->where(['KD_BERITA' => $KD_BERITA])->asArray()->one();
     if (isset($_FILES[$fileName])) {
         $file = \yii\web\UploadedFile::getInstanceByName($fileName);
         //componen
         $profile = Yii::$app->getUserOpt->profile_user()->emp;
         $id = $profile->EMP_ID;
         $data = $this->saveimage(file_get_contents($file->tempName));
         //call function saveimage using base64
         $model->KD_BERITA = $KD_BERITA;
         $model->ID_USER = $id;
         $model->CREATED_BY = $cariemp_inberita['CREATED_BY'];
         $model->CREATED_AT = date("Y-m-d H:i:s");
         $model->ATTACH64 = $data;
         $model->TYPE = 0;
         if ($model->save()) {
             //Now save file data to database
             echo \yii\helpers\Json::encode($file);
         }
     }
     return false;
 }
Ejemplo n.º 2
0
 public function searchBeritaClose($params)
 {
     $query = Berita::find()->where('STATUS<>1');
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['ID' => $this->ID, 'STATUS' => $this->STATUS, 'CREATED_ATCREATED_BY' => $this->CREATE_AT, 'UPDATE_AT' => $this->UPDATE_AT]);
     $query->andFilterWhere(['like', 'KD_BERITA', $this->KD_BERITA])->andFilterWhere(['like', 'JUDUL', $this->JUDUL])->andFilterWhere(['like', 'ISI', $this->ISI])->andFilterWhere(['like', 'KD_CORP', $this->corphistory])->andFilterWhere(['like', 'KD_CAB', $this->KD_CAB])->andFilterWhere(['like', 'KD_DEP', $this->depthistory])->andFilterWhere(['like', 'DATA_PICT', $this->DATA_PICT])->andFilterWhere(['like', 'DATA_FILE', $this->DATA_FILE])->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY])->andFilterWhere(['like', 'DATA_ALL', $this->DATA_ALL]);
     return $dataProvider;
 }