/** * @Route("/placements-{year}/{id}-{auth}", requirements={"year" = "\d+", "id" = "\d+"}, name="public_placements") * @Template() */ public function listAction(Year $year, Student $student, $auth) { if (strtolower($student->getAuth()) != strtolower($auth)) { return $this->redirect($this->generateUrl('student_loginreset')); } if (!$year->getPlacementsPublic()) { return $this->redirect($this->generateUrl('main_index')); } $repo = $this->getDoctrine()->getManager()->getRepository('MobilityPlacementBundle:Placement'); $placements = $repo->getPlacements($year->getYear()); return array('year' => $year->getYear(), 'placements' => $placements); }
private function sendPlacementsPublicMail(Student $student) { $message = \Swift_Message::newInstance()->setSubject('Mobilité à l\'étranger : Les affectations ont été mises à jour')->setFrom($this->container->getParameter('admin_email'))->setTo($student->getEmail())->setBody($this->renderView('MobilityPlacementBundle:Admin:placementsPublic.html.twig', array('student' => $student)), 'text/html'); $this->get('mailer')->send($message); }
private function sendStudentCreatedMail(Student $student) { $message = \Swift_Message::newInstance()->setSubject('Mobilité à l\'étranger : Accès à votre compte et voeux de mobilité')->setFrom($this->container->getParameter('admin_email'))->setTo($student->getEmail())->setBody($this->renderView('MobilityStudentBundle:Admin:studentCreated.html.twig', array('student' => $student)), 'text/html'); $this->get('mailer')->send($message); }
/** * @Route("/student-{id}-{auth}/remove-wish-{wish}", requirements={"id" = "\d+", "wish" = "\d+"}, name="student_removewish") */ public function removeWishAction(Student $student, $auth, $wish) { if (strtolower($student->getAuth()) != strtolower($auth)) { return $this->redirect($this->generateUrl('student_loginreset')); } else { if ($student->getState() != 0) { return $this->redirect($this->generateUrl('student_login', array('id' => $student->getId(), 'auth' => $auth))); } } $em = $this->getDoctrine()->getManager(); foreach ($student->getWishes() as $w) { $p = $w->getPriority(); if ($p == $wish) { $em->remove($w); } else { if ($p > $wish) { $w->setPriority($p - 1); } } } $em->flush(); return $this->redirect($this->generateUrl('student_wishes', array('id' => $student->getId(), 'auth' => $auth))); }