CoreController.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /*
  3. * This file is part of the Sonata package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Sonata\AdminBundle\Controller;
  11. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  12. use Symfony\Component\HttpFoundation\Response;
  13. class CoreController extends Controller
  14. {
  15. /**
  16. * @return string
  17. */
  18. public function getBaseTemplate()
  19. {
  20. if ($this->getRequest()->isXmlHttpRequest()) {
  21. return $this->container->get('sonata.admin.pool')->getTemplate('ajax');
  22. }
  23. return $this->container->get('sonata.admin.pool')->getTemplate('layout');
  24. }
  25. /**
  26. * @return Response
  27. */
  28. public function dashboardAction()
  29. {
  30. return $this->render($this->container->get('sonata.admin.pool')->getTemplate('dashboard'), array(
  31. 'base_template' => $this->getBaseTemplate(),
  32. 'admin_pool' => $this->container->get('sonata.admin.pool'),
  33. 'blocks' => $this->container->getParameter('sonata.admin.configuration.dashboard_blocks')
  34. ));
  35. }
  36. }