/**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $user_current = $this->securityContext->getToken()->getUser();
     $info = $this->em->getRepository("ApplicationSonataUserBundle:Matching")->lastMatchingFromUser($user_current);
     // merge settings
     $settings = array_merge($this->getDefaultSettings(), $blockContext->getSettings());
     return $this->renderResponse($blockContext->getTemplate(), array('block' => $blockContext->getBlock(), 'base_template' => $this->pool->getTemplate('layout'), 'info' => $info, 'settings' => $blockContext->getSettings()), $response);
 }
 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     $user_current = $this->securityContext->getToken()->getUser();
     $info['count_base'] = $this->em->getRepository("ApplicationSonataUserBundle:Base")->countConsumerBases($user_current);
     $info['count_campaign'] = $this->em->getRepository("ApplicationSonataUserBundle:Campaign")->countActiveCampaign();
     $info['count_md5'] = $this->em->getRepository("ApplicationSonataUserBundle:BaseDetail")->countBaseDetailByUser($user_current);
     $info['count_match'] = $this->em->getRepository("ApplicationSonataUserBundle:MatchingDetail")->countMatchingDetailByUser($user_current);
     // merge settings
     $settings = array_merge($this->getDefaultSettings(), $blockContext->getSettings());
     return $this->renderResponse($blockContext->getTemplate(), array('block' => $blockContext->getBlock(), 'base_template' => $this->pool->getTemplate('layout'), 'info' => $info, 'settings' => $blockContext->getSettings()), $response);
 }
 public function testTemplates()
 {
     $this->assertInternalType('array', $this->pool->getTemplates());
     $this->pool->setTemplates(array('ajax' => 'Foo.html.twig'));
     $this->assertNull($this->pool->getTemplate('bar'));
     $this->assertEquals('Foo.html.twig', $this->pool->getTemplate('ajax'));
 }
 /**
  * {@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);
 }
 /**
  * {@inheritdoc}
  */
 public function execute(BlockContextInterface $blockContext, Response $response = null)
 {
     // merge settings
     $settings = array_merge($this->getDefaultSettings(), $blockContext->getSettings());
     return $this->renderResponse($blockContext->getTemplate(), array('block' => $blockContext->getBlock(), 'base_template' => $this->pool->getTemplate('layout'), 'settings' => $blockContext->getSettings()), $response);
 }