/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = SimpelLog::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_log' => $this->id_log, 'user_id' => $this->user_id, 'waktu' => $this->waktu, 'simpel_user_user_id' => $this->simpel_user_user_id]); $query->andFilterWhere(['like', 'nama_proses', $this->nama_proses]); return $dataProvider; }
/** * Lists all SimpelKeg models. * @return mixed */ public function actionIndex() { if ($_POST) { // membuat aritmatika if jika mendapatkan $_Post //mengambil data post checkbox bendahara if (isset($_POST['arsip'])) { $jumlah = count($_POST['selection']); for ($i = 0; $i < $jumlah; $i++) { echo $_POST['selection'][$i] . '<br/>'; Yii::$app->db->createCommand()->update('simpel_keg', ['status' => '4', 'status_edit' => '0'], ['id_kegiatan' => $_POST['selection'][$i]])->execute(); return $this->redirect(['daftar-keg/tabarsip']); } } //jika semua proses sudah dilakukan maka halaman akan di edirect } $dataLog = new ActiveDataProvider(['query' => \backend\models\SimpelLog::find()->where('user_id=' . Yii::$app->user->id)->orderBy('id_log desc'), 'pagination' => ['pageSize' => 10]]); return $this->render('index', ['dataLog' => $dataLog]); }
/** * Finds the SimpelLog model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return SimpelLog the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = SimpelLog::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }