示例#1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Alumnos::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' => $this->id]);
     $query->andFilterWhere(['like', 'p_nombre', $this->p_nombre])->andFilterWhere(['like', 's_nombre', $this->s_nombre])->andFilterWhere(['like', 'p_apellido', $this->p_apellido])->andFilterWhere(['like', 's_apellido', $this->s_apellido])->andFilterWhere(['like', 'nacimiento', $this->nacimiento])->andFilterWhere(['like', 'rut', $this->rut])->andFilterWhere(['like', 'mail', $this->mail])->andFilterWhere(['like', 't_fijo', $this->t_fijo])->andFilterWhere(['like', 't_celular', $this->t_celular])->andFilterWhere(['like', 'direccion', $this->direccion])->andFilterWhere(['like', 'comuna', $this->comuna])->andFilterWhere(['like', 'servicio', $this->servicio])->andFilterWhere(['like', 'funcion', $this->funcion])->andFilterWhere(['like', 'horario', $this->horario]);
     return $dataProvider;
 }
示例#2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Alumnos::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_alumno' => $this->id_alumno, 'clase' => $this->clase, 'nota_final' => $this->nota_final]);
     $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'apellidos', $this->apellidos]);
     return $dataProvider;
 }
示例#3
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Alumnos::find();
     $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(['idalumno' => $this->idalumno, 'apellido', $this->apellido, 'nombre', $this->nombre, 'cuil' => $this->cuil, 'fechanac' => $this->fechanac, 'idsexo' => $this->idsexo, 'idsalud' => $this->idsalud, 'nacion', $this->nacion, 'observaciones', $this->observaciones, 'discapacidad' => $this->discapacidad, 'originario' => $this->originario, 'grufam' => $this->grufam, 'idpropietario' => $this->idpropietario, 'idinstruccion' => $this->idinstruccion, 'idocupacion' => $this->idocupacion, 'montotal' => $this->montotal, 'becario' => $this->becario, 'idcarrera' => $this->idcarrera, 'anioingreso' => $this->anioingreso, 'anioingresou' => $this->anioingresou, 'asistencia' => $this->asistencia, 'promedio' => $this->promedio, 'idconvocatoria' => $this->idconvocatoria]);
     $query->andFilterWhere(['=', 'dni', $this->dni]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if ($this->dni != '') {
         return $dataProvider;
     } else {
         return true;
     }
 }
示例#4
0
 public function actionView()
 {
     $form = new FormSearch();
     $search = null;
     if ($form->load(Yii::$app->request->get())) {
         if ($form->validate()) {
             $search = Html::encode($form->q);
             $table = Alumnos::find()->where(["like", "id_alumno", $search])->orWhere(["like", "nombre", $search])->orWhere(["like", "apellidos", $search]);
             $count = clone $table;
             $pages = new Pagination(["pageSize" => 5, "totalCount" => $count->count()]);
             $model = $table->offset($pages->offset)->limit($pages->limit)->all();
         } else {
             $form->getErrors();
         }
     } else {
         $table = Alumnos::find();
         $count = clone $table;
         $pages = new Pagination(["pageSize" => 5, "totalCount" => $count->count()]);
         $model = $table->offset($pages->offset)->limit($pages->limit)->all();
     }
     return $this->render("view", ["model" => $model, "form" => $form, "search" => $search, "pages" => $pages]);
 }
 public function actionViewViejo()
 {
     $table = new Alumnos();
     /* Metodo que me trae todos los registro de la tabla */
     $model = $table->find()->all();
     $form = new FormSearch();
     /* Variable que contendra la busqueda */
     $search = null;
     /* Si el formulario es envio por get*/
     if ($form->load(Yii::$app->request->get())) {
         if ($form->validate()) {
             /* Metodo encode para evitar ataques del tipo xss */
             $search = Html::encode($form->q);
             /* Consulta sql */
             $query = "SELECT * FROM alumnos WHERE id_alumno LIKE '%{$search}%' OR ";
             $query .= "nombre LIKE '%{$search}%' OR apellidos LIKE '%{$search}%'";
             /* Guardamos en la variable model los datos que nos traera la consulta */
             $model = $table->findBySql($query)->all();
         } else {
             $form->getErros();
         }
     }
     return $this->render("view", ['model' => $model, "form" => $form, "search" => $search]);
 }
 public function actionView()
 {
     $table = new Alumnos();
     $model = $table->find()->orderBy('clase, note_final')->all();
     $form = new FormSearch();
     $search = null;
     if ($form->load(Yii::$app->request->get())) {
         if ($form->validate()) {
             $search = Html::encode($form->q);
             #$model = $table->find()->where('id_alumno LIKE :data OR nombre LIKE :data OR apellidos LIKE :data')->addParams([":data"=>"%".$search."%"])->all();
             $table = Alumnos::find()->where(["like", "id_alumno", $search])->orWhere(["like", "nombre", $search])->orWhere(["like", "apellidos", $search]);
             // clonar el objeto $table una vez hecha la consulta
             // se crea la instancia para la paginacion
             $count = clone $table;
             $pages = new Pagination(["pageSize" => 2, "totalCount" => $count->count()]);
             $model = $table->offset($pages->offset)->limit($pages->limit)->all();
         } else {
             $form->getErrors;
         }
     } else {
         $table = Alumnos::find();
         $count = clone $table;
         $pages = new Pagination(["pageSize" => 2, "totalCount" => $count->count()]);
         $model = $table->offset($pages->offset)->limit($pages->limit)->all();
     }
     return $this->render("view", ["model" => $model, "form" => $form, "search" => $search, "pages" => $pages]);
 }