Exemplo n.º 1
0
 public function searchDataWargaRW($params, $id)
 {
     $query = Warga_data::find()->where('STATUS<>3 AND RW=' . $id)->orderBy(['RT' => 'SORT_ASC', 'RUMAH_NO' => 'SORT_ASC']);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 200]]);
     $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, 'RUMAH_NO' => $this->RUMAH_NO, 'RUMAH_STT' => $this->RUMAH_STT, 'JUMLAH_ANGOTA' => $this->JUMLAH_ANGOTA]);
     $query->andFilterWhere(['like', 'RT', $this->RT])->andFilterWhere(['like', 'KK_NM', $this->KK_NM])->andFilterWhere(['like', 'RUMAH_BLOCK', $this->RUMAH_BLOCK])->andFilterWhere(['like', 'TLP_RUMAH', $this->TLP_RUMAH])->andFilterWhere(['like', 'TLP_KANTOR', $this->TLP_KANTOR])->andFilterWhere(['like', 'TLP_HP', $this->TLP_HP]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 public function actionIndex($id)
 {
     $searchModel = new Warga_dataSearch();
     if ($id == 11) {
         //RW
         $modelRslt = Warga_data::find()->where('STATUS<>3 AND RW=' . $id)->one();
         $model = $modelRslt != '' ? $modelRslt : '0';
         $dpDataProvider = $searchModel->searchDataWargaRW(Yii::$app->request->queryParams, $id);
     } else {
         //RT
         $modelRslt = Warga_data::find()->where('STATUS<>3 AND RT=' . $id)->one();
         $model = $modelRslt != '' ? $modelRslt : '0';
         $dpDataProvider = $searchModel->searchDataWargaRT(Yii::$app->request->queryParams, $id);
     }
     if ($id == 1 or $id == 2 or $id == 3 or $id == 4 or $id == 11) {
         return $this->render('index', ['id' => $id, 'model' => $model, 'searchModel' => $searchModel, 'dpDataProvider' => $dpDataProvider]);
     } else {
         /*NO DATA*/
         return $this->render('indexNoData');
     }
 }
Exemplo n.º 3
0
 /**
  * Finds the Warga_data model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Warga_data the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Warga_data::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }