예제 #1
0
 /**
  * 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;
 }
예제 #2
0
 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;
 }
예제 #3
0
 public function searchPendencias($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;
     }
     $query->joinWith(['usuario']);
     $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, 'status' => '0']);
     $query->andFilterWhere(['like', 'usuario.name', $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;
 }
예제 #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getMonitorias()
 {
     return $this->hasMany(Monitoria::className(), ['IDCurso' => 'ID']);
 }
예제 #5
0
 /**
  * Finds the Monitoria model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Monitoria the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Monitoria::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('A página requisitada não existe.');
     }
 }
예제 #6
0
 /**
  * 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]);
     }
 }
예제 #7
0
 public function actionGerarrelatoriosemestral($id)
 {
     $model = new Monitoria();
     $modelInfo = new ProfessorMonitoria();
     if ($model->load(Yii::$app->request->post())) {
         //Usuario - Pega professor baseando-se no CPF do usuário logado
         $professor = Usuario::findOne(['CPF' => Yii::$app->user->identity->cpf]);
         //Habilitar "extension=php_fileinfo.dll" em C:\xampp\php\php.ini
         $model->fileRelatorioSemestral = UploadedFile::getInstance($model, 'fileRelatorioSemestral');
         $arrayUpdate = ['pathArqRelatorioSemestral' => 'uploads/relatorio-semestral/' . $professor->cpf . '_' . date('Ydm_His') . '.' . $model->fileRelatorioSemestral->extension];
         Yii::$app->db->createCommand()->update('monitoria', $arrayUpdate, 'id=' . $id)->execute();
         $model->fileRelatorioSemestral->saveAs('uploads/relatorio-semestral/' . $professor->cpf . '_' . date('Ydm_His') . '.' . $model->fileRelatorioSemestral->extension);
         return $this->redirect(['professor']);
     } else {
         $model = $this->findModel($id);
         $modelInfo = ProfessorMonitoria::findOne(['id' => $id]);
         return $this->render('_form4', ['model' => $model, 'modelInfo' => $modelInfo]);
     }
 }
예제 #8
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getMonitorias()
 {
     return $this->hasMany(Monitoria::className(), ['IDAluno' => 'matricula']);
 }