/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function searchAluno($params) { $query = Monitoria::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; } //Pega o ID do aluno baseando-se no CPF do usuário logado $aluno = Aluno::findOne(['CPF' => Yii::$app->user->identity->login]); $query->joinWith(['aluno']); $query->joinWith(['disciplinaperiodo']); $query->joinWith(['periodoinscricao']); $query->leftJoin('disciplina', 'disciplina.id = disciplina_periodo.idDisciplina'); $query->leftJoin('curso', 'curso.ID = disciplina_periodo.idCurso'); $query->andFilterWhere(['ID' => $this->ID, 'IDAluno' => $aluno->ID]); $query->andFilterWhere(['like', 'numProcs', $this->numProcs]); $query->andFilterWhere(['like', 'aluno.nome', $this->IDAluno]); $query->andFilterWhere(['like', 'disciplina.nomeDisciplina', $this->IDDisc]); $query->andFilterWhere(['like', 'curso.nome', $this->nomeCurso]); $query->andFilterWhere(['like', 'periodoinscricao.ano', $this->IDperiodoinscr]); $query->orderBy(['ID' => SORT_DESC]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Aluno::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(['codigo' => $this->codigo, 'habilitado' => $this->habilitado]); $query->andFilterWhere(['like', 'nome', $this->nome])->andFilterWhere(['like', 'matricula', $this->matricula])->andFilterWhere(['like', 'email', $this->email]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Aluno::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, 'matricula' => $this->matricula, 'RG' => $this->RG, 'CPF' => $this->CPF, 'IDCurso' => $this->IDCurso, 'IDDisc' => $this->IDDisc, 'monitor' => $this->monitor]); $query->andFilterWhere(['like', 'nome', $this->nome])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'endereco', $this->endereco])->andFilterWhere(['like', 'bairro', $this->bairro])->andFilterWhere(['like', 'telResid', $this->telResid])->andFilterWhere(['like', 'telCel', $this->telCel])->andFilterWhere(['like', 'telComerc', $this->telComerc])->andFilterWhere(['like', 'banco', $this->banco])->andFilterWhere(['like', 'agencia', $this->agencia])->andFilterWhere(['like', 'conta', $this->conta]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Aluno::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(['alun_codigo' => $this->alun_codigo, 'alun_data_nascimento' => $this->alun_data_nascimento, 'alun_habilitado' => $this->alun_habilitado, 'muni_codigo' => $this->muni_codigo, 'alun_data_criacao' => $this->alun_data_criacao, 'alun_data_alteracao' => $this->alun_data_alteracao]); $query->andFilterWhere(['like', 'alun_nome', $this->alun_nome])->andFilterWhere(['like', 'alun_matricula', $this->alun_matricula])->andFilterWhere(['like', 'alun_observacao', $this->alun_observacao]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Aluno::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, 'matricula' => $this->matricula, 'id_curso' => $this->id_curso, 'ano_ingresso' => $this->ano_ingresso]); $query->andFilterWhere(['like', 'nome', $this->nome])->andFilterWhere(['like', 'sexo', $this->sexo]); return $dataProvider; }
/** * Creates a new Frequencia model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate($date) { $model = new Frequencia(); $aluno = Aluno::find()->where(['CPF' => Yii::$app->user->identity->login])->one(); // pesquisa para pegar o id do aluno $moni = Monitoria::find()->where(['IDAluno' => $aluno->ID])->one(); // pesquisa para pegar o id de monitoria do aluno $model->dmy = $date; $model->IDMonitoria = $moni->ID; if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['index']); } else { return $this->renderAjax('create', ['model' => $model]); } }
public function searchMinhasFrequencias($params) { $query = Frequencia::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; } $aluno = Aluno::findOne(['CPF' => Yii::$app->user->identity->login]); $monitoria = Monitoria::findOne(['IDAluno' => $aluno->ID]); $query->andFilterWhere(['ID' => $this->ID, 'IDMonitoria' => $monitoria->ID, 'dmy' => $this->dmy, 'ch' => $this->ch, 'atividade' => $this->atividade]); $query->orderBy(['ID' => SORT_DESC]); return $dataProvider; }
/** * Finds the Aluno model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Aluno the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Aluno::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getAlunos() { return $this->hasMany(Aluno::className(), ['IDCurso' => 'ID']); }
/** *Lista os alunos de um determinado ano *@param integer $ano */ public function actionTurma($ano) { $searchModel = new AlunoSearch(); $alunos = new ActiveDataProvider(['query' => Aluno::find()->where(['ano_ingresso' => $ano]), 'pagination' => ['pageSize' => 30]]); return $this->render('turma', ['alunos' => $alunos, 'searchModel' => $searchModel, 'ano' => $ano]); }
/** * @return \yii\db\ActiveQuery */ public function getAlunos() { return $this->hasMany(Aluno::className(), ['muni_codigo' => 'muni_codigo']); }
/** * Updates an existing Monitoria model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id * @return mixed */ public function actionUpdate($id) { if (Yii::$app->request->referrer != '/monitoria/minhasinscricoes') { $model = $this->findModel($id); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->ID]); } else { //Aluno - Pega aluno baseando-se no CPF do usuário logado $aluno = Aluno::findOne(['CPF' => Yii::$app->user->identity->login]); //Seleciona o último período de inscrição $periodoInscricao = PeriodoInscricaoMonitoria::find()->orderBy(['ID' => SORT_DESC])->one(); $periodo = $periodoInscricao->ano . '/' . $periodoInscricao->periodo; return $this->render('update', ['model' => $model, 'periodo' => $periodo, 'matricula' => $aluno->matricula, 'banco' => $aluno->banco, 'agencia' => $aluno->agencia, 'conta' => $aluno->conta]); } } return $this->redirect(Yii::$app->request->referrer); }
/** * @return \yii\db\ActiveQuery */ public function getAluno() { return $this->hasOne(Aluno::className(), ['ID' => 'IDAluno']); }
public function actionEditardados() { //verifica se o aluno já está cadastrado com o cpf informado... if (!Yii::$app->request->post()) { return $this->render('editardados'); } else { $cpf = Yii::$app->request->post('cpf'); $aluno = Aluno::find()->where(['cpf' => $cpf])->one(); if ($aluno != null) { if ($aluno->CPF === Yii::$app->user->identity->login) { $arrayDeCurso = ArrayHelper::map(CursoSearch::find()->all(), 'ID', 'nome'); $dados_aluno = Aluno::findOne(['CPF' => $cpf]); return $this->redirect(['view', 'id' => $dados_aluno->ID]); } else { return $this->render('editardados', ['erro' => 'O CPF informado não é seu.']); } } else { return $this->render('editardados', ['erro' => 'Você não tem cadastro prévio no sistema. Entre em contato com a secretaria para resolver o problema.']); } } }