Пример #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Sala::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(['idsala' => $this->idsala, 'capacidade' => $this->capacidade, 'predio_idpredio' => $this->predio_idpredio]);
     $query->andFilterWhere(['like', 'nome', $this->nome]);
     return $dataProvider;
 }
 public function actionFiltro($tipo)
 {
     $provaModel = new ProvaSearch();
     $provaProvider = $provaModel->search(Yii::$app->request->queryParams);
     $ditems = ArrayHelper::map(Disciplina::find()->all(), 'nome', 'nome');
     $citems = ArrayHelper::map(Curso::find()->all(), 'idcurso', 'nome');
     $pitems = ArrayHelper::map(Predio::find()->where(['unidade' => '1'])->all(), 'idpredio', 'nome');
     $sitems = ArrayHelper::map(Sala::find()->all(), 'idsala', 'nome');
     $eitems = ArrayHelper::map(Exame::find()->all(), 'idexame', 'nome');
     if ($provaModel->load(Yii::$app->request->get())) {
         return $this->render('frequencia', ['dataProvider' => $provaProvider, 'searchModel' => $provaModel]);
     } else {
         return $this->render('filtro', ['provaModel' => $provaModel, 'provaProvider' => $provaProvider, 'ditems' => $ditems, 'citems' => $citems, 'pitems' => $pitems, 'sitems' => $sitems, 'eitems' => $eitems, 'tipo' => $tipo]);
     }
 }
Пример #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSala()
 {
     return $this->hasOne(Sala::className(), ['idsala' => 'sala_idsala']);
 }
Пример #4
0
 public function getSala()
 {
     return $this->hasOne(Sala::className(), ['idsala' => 'sala_idsala'])->viaTable('inscricao_prova_sala', ['prova_idprova' => 'idprova']);
 }
Пример #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSalas()
 {
     return $this->hasMany(Sala::className(), ['predio_idpredio' => 'idpredio']);
 }
Пример #6
0
 /**
  * Finds the Sala model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Sala the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Sala::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }