/** * @EXT\Route( * "/admin/period_supprimer/period/{period}", * name="formalibre_period_supprimer", * options={"expose"=true} * ) * * @EXT\ParamConverter("user", options={"authenticatedUser" = true}) * * @param User $user */ public function adminPeriodSupprimerAction(Period $period) { $startHour = $period->getBeginHour(); $endHour = $period->getEndHour(); $dayName = $period->getDayName(); $PeriodToModif = $this->periodRepo->findBy(array('beginHour' => $startHour, 'endHour' => $endHour, 'dayName' => $dayName)); foreach ($PeriodToModif as $OnePeriodToModif) { $this->em->remove($OnePeriodToModif); } $this->em->flush(); return new RedirectResponse($this->router->generate('formalibre_presence_horaire')); }
/** * @EXT\Route( * "/presence/choix_classe/period/{period}/date/{date}", * name="formalibre_choix_classe", * options={"expose"=true} * ) * * @EXT\ParamConverter("user", options={"authenticatedUser" = true}) * * @param User $user * @EXT\Template() */ public function ChoixClasseAction(User $user, Period $period, Request $request, $date) { $sessionsByUser = $this->cursusManager->getSessionsByUserAndType($user, 1); //throw new \Exception(count($test)); $form = $this->createFormBuilder()->add('selection', 'entity', array('label' => 'Classe:', 'class' => 'Claroline\\CursusBundle\\Entity\\CourseSession', 'choices' => $sessionsByUser, 'property' => 'getShortNameWithCourse', 'empty_value' => 'Choisissez un groupe'))->add('valider', 'submit', array('label' => 'Relever les présences'))->getForm(); $request = $this->getRequest(); if ($request->getMethod() == 'POST') { $form->handleRequest($request); $session = $form->get('selection')->getData(); return $this->redirect($this->generateUrl('formalibre_presence_releve', array('period' => $period->getId(), 'date' => $date, 'session' => $session->getId()))); } return array('form' => $form->createView(), 'user' => $user, 'period' => $period, 'date' => $date); }