示例#1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Predio::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(['idpredio' => $this->idpredio, 'unidade' => $this->unidade, 'ativo' => $this->ativo]);
     $query->andFilterWhere(['like', 'nome', $this->nome])->andFilterWhere(['like', 'endereco', $this->endereco])->andFilterWhere(['like', 'bairro', $this->bairro])->andFilterWhere(['like', 'cep', $this->cep])->andFilterWhere(['like', 'telefone', $this->telefone]);
     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 getPredio()
 {
     return $this->hasOne(Predio::className(), ['idpredio' => 'predio_idpredio']);
 }
示例#4
0
 public function getArrayPredio()
 {
     return ArrayHelper::map(Predio::find()->all(), 'idpredio', 'nome');
 }
 /**
  * Finds the Predio model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Predio the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Predio::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
示例#6
0
<div class="prova-form">

    <?php 
$form = ActiveForm::begin();
?>
    
    <?php 
$horarioArray = ArrayHelper::map(\backend\models\Horario::find()->orderBy('descricao')->where(['exame_idexame' => $model->calendario->exame_idexame])->all(), 'idhorario', 'descricao');
?>
    <?php 
echo $form->field($model, 'horario_idhorario')->dropDownList($horarioArray, ['prompt' => '---- Selecione um Horário ----'])->label('Horário');
?>
    
    <?php 
$predioArray = ArrayHelper::map(\backend\models\Predio::find()->orderBy('nome')->where(['unidade' => 1])->all(), 'idpredio', 'nome');
?>
    <?php 
echo $form->field($model, 'predio_idpredio')->dropDownList($predioArray, ['prompt' => '---- Selecione uma Unidade ----'])->label('Unidade');
?>
    
    <?php 
$disciplinaArray = ArrayHelper::map(\backend\models\Disciplina::find()->orderBy('nome')->all(), 'iddisciplina', 'nome');
?>
    <?php 
echo $form->field($model, 'disciplina_iddisciplina')->dropDownList($disciplinaArray, ['prompt' => '---- Selecione uma Disciplina ----'])->label('Disciplina');
?>

    <?php 
echo $form->field($model, 'segunda_chamada')->textInput(['maxlength' => true]);
?>