CoreController.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  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\HttpKernel\Exception\NotFoundHttpException;
  13. use Symfony\Component\HttpFoundation\Response;
  14. class CoreController extends Controller
  15. {
  16. public function getBaseTemplate()
  17. {
  18. if ($this->get('request')->isXmlHttpRequest()) {
  19. return $this->container->getParameter('sonata.admin.templates.ajax');
  20. }
  21. return $this->container->getParameter('sonata.admin.templates.layout');
  22. }
  23. public function dashboardAction()
  24. {
  25. return $this->render('SonataAdminBundle:Core:dashboard.html.twig', array(
  26. 'groups' => $this->get('sonata.admin.pool')->getDashboardGroups(),
  27. 'base_template' => $this->getBaseTemplate(),
  28. ));
  29. }
  30. }