public function addAction(Request $request, Application $app)
 {
     $param = $request->request->all();
     $id_examen = $request->request->get('id_examen');
     $judgment = $request->request->get('judgment');
     $notes = $request->request->get('note_student');
     $ids_student = $request->request->get('id_student');
     $nbr_etud = $param['note_student'];
     $nombreNoteEtudiant = sizeof($nbr_etud);
     for ($i = 0; $i < $nombreNoteEtudiant; $i++) {
         $newEvaluation = new Evaluation();
         $newEvaluation->setGradeStudent($notes[$i]);
         $newEvaluation->setJudgement($judgment[$i]);
         $newEvaluation->setDtCreate(date('Y-m-d H:i:s'));
         $newEvaluation->setDtUpdate(date('Y-m-d H:i:s'));
         $newEvaluation->setIdExamen($id_examen);
         $newEvaluation->setIdStudent($ids_student[$i]);
         $app['dao.evaluation']->saveGrade($newEvaluation);
     }
     //On charge les dao nécessaires
     $examens = $app['dao.examen']->findAll();
     $classnames = $app['dao.className']->findAll();
     $date = date("d-m-Y");
     $app['session']->getFlashBag()->add('success', 'Les notes ont bien été enregistrées !');
     return $app['twig']->render('ListTemplate/examlist.html.twig', array('classname' => $classnames, 'examens' => $examens, 'date' => $date));
 }
示例#2
0
 /**
  * @param $row
  * @return Evaluation
  * création de l'objet evaluation représentant la note et l'appréciation de l'élève
  */
 protected function buildDomainObject($row)
 {
     $evaluation = new Evaluation();
     $evaluation->setIdEvaluation($row['id_evaluation']);
     $evaluation->setGradeStudent($row['grade_student']);
     $evaluation->setJudgement($row['judgement']);
     $evaluation->setDtCreate($row['dt_create']);
     $evaluation->setDtUpdate($row['dt_update']);
     if (array_key_exists('id_student', $row)) {
         $studentID = $row['id_student'];
         if (isset($row['id_student'])) {
             $student = $this->studentDAO->findStudent($studentID);
             $evaluation->setIdStudent($student);
         }
     }
     if (array_key_exists('id_examen', $row)) {
         $examenID = $row['id_examen'];
         if (isset($row['id_examen'])) {
             $examen = $this->examenDAO->findExamen($examenID);
             $evaluation->setIdExamen($examen);
         }
     }
     return $evaluation;
 }