/**
  * @Route("/teacher/report/grades")
  */
 public function displayGrades()
 {
     $gradeService = $this->get('GradeService');
     $query = new GradeQuery();
     $query->setTeacherId($this->get('security.context')->getToken()->getUser()->getId());
     return $this->render('report/teacher/grades.html.twig', array('gradeResult' => $gradeService->obtainGrades($query)));
 }
 private function sendEmail($user)
 {
     $gradeService = $this->get('GradeService');
     $query = new GradeQuery();
     $query->setParentId($user->getId());
     $message = \Swift_Message::newInstance()->setSubject('St. Sergius School. Grades.')->setFrom('*****@*****.**')->setTo($user->getEmail())->setBody($this->renderView('mail/gradesReport.html.twig', array('gradeResult' => $gradeService->obtainGrades($query), 'user' => $user)), 'text/html');
     $this->get('mailer')->send($message);
     return;
 }
예제 #3
0
 private function applyQuery(GradeQuery $query = null, $q)
 {
     if ($query !== null) {
         $teacherId = $query->getTeacherId();
         if (isset($teacherId)) {
             $q->andWhere('g.teacher = :teacherId');
             $q->setParameter('teacherId', $query->getTeacherId());
         }
         $studentId = $query->getStudentId();
         if (isset($studentId)) {
             $q->andWhere('g.student = :studentId');
             $q->setParameter('studentId', $query->getStudentId());
         }
         $parentId = $query->getParentId();
         if (isset($parentId)) {
             $q->join('s.parents', 'p');
             $q->andWhere('p.id = :parentId');
             $q->andWhere('p.email is not NULL');
             $q->setParameter('parentId', $query->getParentId());
         }
     }
 }
 /**
  * @Route("/admin/student/grade/{id}/print")
  * @ParamConverter("user", class="AppBundle:User")
  */
 public function displayPrint($user)
 {
     $gradeService = $this->get('GradeService');
     $query = new GradeQuery();
     $query->setStudentId($user->getId());
     return $this->render('report/gradesPrint.html.twig', array('gradeResult' => $gradeService->obtainGrades($query)));
 }