Adding latest page

remotes/angel/1.11.x
jmontoyaa 9 years ago
parent 81d50d2728
commit 2367f6a5a8
  1. 3
      app/config/routing.yml
  2. 4
      app/config/sonata/sonata_page.yml
  3. 36
      src/Chamilo/PageBundle/Controller/PageController.php
  4. 3
      src/Chamilo/PageBundle/Resources/config/routing.yml
  5. 9
      src/Chamilo/PageBundle/Resources/views/latest.html.twig

@ -80,6 +80,9 @@ elfinder:
core_bundle:
resource: "@ChamiloCoreBundle/Resources/config/routing.yml"
page_bundle:
resource: "@ChamiloPageBundle/Resources/config/routing.yml"
#liip_theme:
# resource: "@LiipThemeBundle/Resources/config/routing.xml"
# prefix: /theme

@ -45,6 +45,8 @@ sonata_page:
- ^/courses/(.*)
- ^/front/editor
- ^/contact(.*) # sonata admin
- ^/cms/pages/latest
- ^/cms/pages/latest/(.*)
ignore_route_patterns:
- (.*)administration(.*) # ignore admin route, ie route containing 'admin' # sonata admin
@ -52,7 +54,6 @@ sonata_page:
- fos_user(.*)
- sylius_flow(.*)
ignore_routes:
- home
- elfinder
@ -75,6 +76,7 @@ sonata_page:
- sylius_flow_display
- sylius_flow_forward
- chamilo_core_user_user_mycourses
- chamilo_page_page_getlatestpages
cache_invalidation:
service: sonata.page.cache.invalidation.simple

@ -0,0 +1,36 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\PageBundle\Controller;
use Doctrine\DBAL\Connection;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
/**
* Class PageController
* @package Chamilo\PageBundle\Controller
*/
class PageController extends Controller
{
/**
* @Route("/cms/page/latest/{number}")
* @param int $number
*/
public function getLatestPages($number)
{
$site = $this->container->get('sonata.page.site.selector')->retrieve();
$criteria = ['enabled' => 1, 'site' => $site, 'decorate' => 1];
$order = ['publicationDateStart' => 'desc'];
$order = [];
$pages = $this->container->get('sonata.page.manager.page')->findBy($criteria, $order, $number);
//$pages = $this->container->get('sonata.page.manager.snapshot')->findBy($criteria, $order, $number);
//$site = $this->container->get('sonata.page.site.selector.host')->retrieve();
return $this->render('@ChamiloPage/latest.html.twig', ['pages' => $pages]);
}
}

@ -0,0 +1,3 @@
page:
resource: '@ChamiloPageBundle/Controller/PageController.php'
type: annotation

@ -0,0 +1,9 @@
{% for page in pages %}
{#{{ page.content.name }}#}
{#{{ page.content.blocks | var_dump }}#}
{{ page.name }}
{{ sonata_page_render_container('content', page) }}
{% endfor %}
Loading…
Cancel
Save