CoreController.php 1.1 KB

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