Exemplo n.º 1
0
 protected function configureFormFields(FormMapper $formMapper)
 {
     $year = $this->date_day_service->getDate()->format('Y');
     $years = range(2015, \intval($year) + 10);
     $years = array_combine($years, $years);
     $formMapper->add('annee', 'choice', array('choices' => $years))->add('paques', 'sonata_type_date_picker', array('label' => 'Lundi Pâques', 'format' => 'dd-MM-y'))->add('ascension', 'sonata_type_date_picker', array('label' => 'Ascension', 'format' => 'dd-MM-y'))->add('vendredi_ascension', 'sonata_type_date_picker', array('label' => 'Vendredi Ascension', 'format' => 'dd-MM-y'))->add('pentecote', 'sonata_type_date_picker', array('label' => 'Lundi Pentecôte', 'format' => 'dd-MM-y'));
 }
 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     // Totals stats
     $tots = array('users' => $this->em->getRepository('ApplicationSonataUserBundle:User')->count(), 'children' => $this->em->getRepository('WCSCantineBundle:Eleve')->count(), 'meals' => $this->em->getRepository('WCSCantineBundle:Lunch')->count(), 'schools' => $this->em->getRepository('WCSCantineBundle:School')->count());
     $options['date_day'] = $this->date_now_service->getDate();
     $repoLunch = $this->em->getRepository('WCSCantineBundle:Lunch');
     // stats lunch : current week
     $options['enable_next_week'] = false;
     $options['without_pork'] = true;
     $currentWeekMealsNoPork = $repoLunch->getWeekMeals($options);
     $options['without_pork'] = false;
     $currentWeekMeals = $repoLunch->getWeekMeals($options);
     // stats lunch : next week
     $options['enable_next_week'] = true;
     $options['without_pork'] = true;
     $nextWeekMealsNoPork = $repoLunch->getWeekMeals($options);
     $options['without_pork'] = false;
     $nextWeekMeals = $repoLunch->getWeekMeals($options);
     return $this->renderResponse($blockContext->getTemplate(), array('block' => $blockContext->getBlock(), 'base_template' => $this->pool->getTemplate('WCSCantineBundle:Block:stateleves.html.twig'), 'settings' => $blockContext->getSettings(), 'currentWeekMeals' => $currentWeekMeals, 'currentWeekMealsNoPork' => $currentWeekMealsNoPork, 'nextWeekMeals' => $nextWeekMeals, 'nextWeekMealsNoPork' => $nextWeekMealsNoPork, 'tots' => $tots), $response);
 }
Exemplo n.º 3
0
 /**
  * @covers ::__construct
  * @covers ::getDate
  */
 public function testShouldReturnTheDateDefinedInInstanciation()
 {
     $expectedDate = '2016-01-01';
     $dateNow = new DateNow($expectedDate);
     $this->assertEquals($expectedDate, $dateNow->getDate()->format('Y-m-d'), 'Date object must be the same as the string date passed as argument');
 }
Exemplo n.º 4
0
 protected function configureShowFields(ShowMapper $datagridMapper)
 {
     $year = $this->date_now_service->getDate()->format('Y');
     $datagridMapper->add('user', null, array('label' => 'Email des parents'))->add('nom', 'text')->add('prenom', 'text')->add('dateDeNaissance', 'date', array('format' => 'd-M-Y', 'years' => range($year - 11, $year - 2)))->add('regimeSansPorc', null, array('required' => false))->add('allergie', null, array('required' => false))->add('division', 'entity', array('class' => 'WCSCantineBundle:Division', 'required' => true, 'label' => 'classe'));
 }