/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Acdfrequenceenroll::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => '1']]); $query->joinWith('enroll'); $query->where(['acdenroll.groupid' => (int) Yii::$app->session['groupid']]); $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(['datetime' => $this->datetime, 'enrollid' => $this->enrollid, 'scheduleid' => $this->scheduleid, 'frequencydate' => $this->frequencydate, 'frequency' => $this->frequency, 'iscancellation' => $this->iscancellation, 'justifiedabsence' => $this->justifiedabsence, 'cancelledabsence' => $this->cancelledabsence, 'timeid' => $this->timeid, 'justifiedabsense' => $this->justifiedabsense, 'centerid' => $this->centerid]); $query->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'ipaddress', $this->ipaddress])->andFilterWhere(['like', 'reasoncancellation', $this->reasoncancellation])->andFilterWhere(['like', 'justification', $this->justification]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getAcdfrequenceenrolls() { return $this->hasMany(Acdfrequenceenroll::className(), ['enrollid' => 'enrollid']); }
/** * Finds the Acdfrequenceenroll model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $enrollid * @param integer $scheduleid * @param string $frequencydate * @param integer $timeid * @return Acdfrequenceenroll the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($enrollid, $scheduleid, $frequencydate, $timeid) { if (($model = Acdfrequenceenroll::findOne(['enrollid' => $enrollid, 'scheduleid' => $scheduleid, 'frequencydate' => $frequencydate, 'timeid' => $timeid])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }