public function actionUploadFile() { $model = new monitoringkacamata(); if ($model->load(Yii::$app->request->post())) { if ($model->validate()) { // form inputs are valid, do something here return; } } return $this->render('upload-file', ['model' => $model]); }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = monitoringkacamata::find()->orderBy("tgl_ambil DESC"); $query->joinWith(['nikkes0']); $dataProvider = new ActiveDataProvider(['query' => $query]); $dataProvider->sort->attributes['nikkes0'] = ['asc' => ['peserta.nama' => SORT_ASC], 'desc' => ['peserta.nama' => SORT_DESC]]; $this->load($params); if (!$this->validate()) { $query->where('1=0'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'hak_kacamata_id' => $this->hak_kacamata_id, 'tgl_ambil' => $this->tgl_ambil]); $query->andFilterWhere(['like', 'monitoring_kacamata.nikkes', $this->nikkes])->andFilterWhere(['like', 'peserta.nama', $this->nikkes0]); return $dataProvider; }
/** * Finds the monitoringkacamata model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return monitoringkacamata the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = monitoringkacamata::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }