Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Userprofile::find();
     $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, 'JOIN_DATE' => $this->JOIN_DATE, 'RESIGN_DATE' => $this->RESIGN_DATE, 'STS' => $this->STS, 'KD_OUTSRC' => $this->KD_OUTSRC, 'TGL_LAHIR' => $this->TGL_LAHIR, 'CREATED_AT' => $this->CREATED_AT, 'UPDATED_TIME' => $this->UPDATED_TIME, 'STATUS' => $this->STATUS]);
     $query->andFilterWhere(['like', 'NM_FIRST', $this->NM_FIRST])->andFilterWhere(['like', 'NM_MIDDLE', $this->NM_MIDDLE])->andFilterWhere(['like', 'NM_END', $this->NM_END])->andFilterWhere(['like', 'EMP_IMG', $this->EMP_IMG])->andFilterWhere(['like', 'KD_DISTRIBUTOR', $this->KD_DISTRIBUTOR])->andFilterWhere(['like', 'KD_SUBDIST', $this->KD_SUBDIST])->andFilterWhere(['like', 'KTP', $this->KTP])->andFilterWhere(['like', 'ALAMAT', $this->ALAMAT])->andFilterWhere(['like', 'ZIP', $this->ZIP])->andFilterWhere(['like', 'GENDER', $this->GENDER])->andFilterWhere(['like', 'EMAIL', $this->EMAIL])->andFilterWhere(['like', 'TLP_HOME', $this->TLP_HOME])->andFilterWhere(['like', 'HP', $this->HP])->andFilterWhere(['like', 'CORP_ID', $this->CORP_ID])->andFilterWhere(['like', 'CREATED_BY', $this->CREATED_BY])->andFilterWhere(['like', 'UPDATED_BY', $this->UPDATED_BY]);
     return $dataProvider;
 }
 public function actionSettingProfile($id)
 {
     $model = Userprofile::find()->where(['ID' => $id])->one();
     $distributor = ArrayHelper::map(Distributor::find()->where('STATUS <>3')->all(), 'KD_DISTRIBUTOR', 'NM_DISTRIBUTOR');
     $username = Yii::$app->getUserOptcrm->Profile_user()->username;
     //component Crm
     if ($model->load(Yii::$app->request->post())) {
         $model->CREATED_BY = $username;
         $model->UPDATED_TIME = date('Y-m-d h:i:s');
         $base64File = \yii\web\UploadedFile::getInstance($model, 'image');
         $File64 = $this->saveimage(file_get_contents($base64File->tempName));
         $model->IMG_BASE64 = 'data:' . $base64File->type . ';charset=utf-8;base64,' . $File64;
         $model->save();
         return $this->redirect('index');
     } else {
         return $this->renderAjax('set_profile', ['model' => $model, 'distributor' => $distributor]);
     }
 }
 public function actionViewUserCrm($id)
 {
     $model = Userlogin::find()->where(['id' => $id])->one();
     $user_profile_crm = Userprofile::find()->where(['ID' => $id])->one();
     if ($model->load(Yii::$app->request->post()) || $user_profile_crm->load(Yii::$app->request->post())) {
         $model->email = $user_profile_crm->EMAIL;
         if ($user_profile_crm->STATUS == 0) {
             $model->status = 1;
         } elseif ($user_profile_crm->STATUS != 0) {
             $model->status = 10;
         } else {
             $model->status;
         }
         if ($model->save()) {
             $user_profile_crm->save();
             return $this->redirect(['/master/schedule-header/index']);
         }
     } else {
         return $this->renderAjax('view_user_crm', ['model' => $model, 'user_profile_crm' => $user_profile_crm]);
     }
 }
Пример #4
0
 public function actionEditUser($id)
 {
     $model_userlogin = $this->findModelUserLogin($id);
     #model userlogin
     $model_userprofile = Userprofile::find()->where(['ID_USER' => $id])->one();
     #model userprofile
     if ($model_userlogin->load(Yii::$app->request->post()) || $model_userprofile->load(Yii::$app->request->post())) {
         $kode = Yii::$app->ambilkonci->SetKodeAliasUser();
         if (!$model_userlogin->USER_ALIAS) {
             $model_userlogin->USER_ALIAS = $kode;
         }
         $model_userlogin->save();
         $model_userprofile->save();
         return $this->redirect(['index?tab=4']);
     } else {
         return $this->renderAjax('update_user', ['model_userlogin' => $model_userlogin, 'model_userprofile' => $model_userprofile, 'ary_status' => self::ary_status()]);
     }
 }