Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = UserProfil::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'user_id' => $this->user_id, 'agama_id' => $this->agama_id, 'tinggi_badan' => $this->tinggi_badan, 'berat_badan' => $this->berat_badan, 'tgl_lahir' => $this->tgl_lahir, 'updated_by' => $this->updated_by, 'updated_date' => $this->updated_date]);
     $query->andFilterWhere(['like', 'nama', $this->nama])->andFilterWhere(['like', 'jenkel', $this->jenkel])->andFilterWhere(['like', 'tempat_lahir', $this->tempat_lahir])->andFilterWhere(['like', 'alamat', $this->alamat])->andFilterWhere(['like', 'no_telp', $this->no_telp]);
     return $dataProvider;
 }
Пример #2
0
 public function search($params)
 {
     $query = UserProfil::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => 'DESC']], 'pagination' => ['defaultPageSize' => 10]]);
     $this->load($params);
     if (!$this->validate()) {
         $query->where('1=0');
         return $dataProvider;
     }
     $dataProvider->query->joinWith(['agama' => function ($q) {
         $q->from('user_agama a');
         // join with tabel alias
     }]);
     $dataProvider->query->joinWith(['user' => function ($q) {
         $q->from('user u');
         // join with tabel alias
     }]);
     $query->orFilterWhere(['like', 'a.name', $this->srch_all])->orFilterWhere(['like', 'u.username', $this->srch_all])->orFilterWhere(['like', 'nama', $this->srch_all])->orFilterWhere(['like', 'jenkel', $this->srch_all])->orFilterWhere(['like', 'tempat_lahir', $this->srch_all])->orFilterWhere(['like', 'alamat', $this->srch_all])->orFilterWhere(['like', 'no_telp', $this->srch_all])->orFilterWhere(['like', 'tinggi_badan', $this->srch_all])->orFilterWhere(['like', 'berat_badan', $this->srch_all])->orFilterWhere(['like', 'tgl_lahir', $this->srch_all]);
     $query->andFilterWhere(['user_id' => $this->user_id, 'u.status' => $this->status, 'agama_id' => $this->agama_id]);
     return $dataProvider;
 }
Пример #3
0
 protected function findProfil($id)
 {
     if (($model = UserProfil::find()->where(['user_id' => $id])->one()) !== null) {
         return $model;
     } else {
         return null;
     }
 }
Пример #4
0
    </div>
    <div class="col-sm-2">
    <?php 
echo Html::textInput("srch_all", "", ['placeholder' => "Cari...", 'onkeyup' => '
                                                            $.pjax.reload({
                                                                url: "' . Url::to(['index']) . '?UserProfilSearch[srch_all]="+$(this).val(),
                                                                container: "#user-profil-gridview",
                                                                timeout: 1000,
                                                            });
                                                            ', 'class' => 'form-control']);
?>
    </div>        
    <div class="col-sm-2">
        
    <?php 
echo Html::dropDownList('status', null, \common\models\UserProfil::listAgama(), ['prompt' => '- Cari Agama', 'onchange' => '
                                                            $.pjax.reload({
                                                                url: "' . Url::to(['index']) . '?UserProfilSearch[agama_id]="+$(this).val(),
                                                                container: "#user-profil-gridview",
                                                                timeout: 1000,
                                                            });
                                                            ', 'class' => 'form-control']);
?>
    </div>
    <div class="col-sm-2">
        
    <?php 
$data = array(10 => 'Aktif', 0 => 'Tidak Aktif');
?>

    <?php 
Пример #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUserProfils()
 {
     return $this->hasOne(\common\models\UserProfil::className(), ['user_id' => 'id']);
 }
Пример #6
0
 protected function findModel($id)
 {
     $model = UserProfil::find()->where(['user_id' => $id])->one();
     return $model;
 }