src/Controller/ContentController.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Pimcore\Model\DataObject\News;
  4. use Pimcore\Model\DataObject\Blog;
  5. use Pimcore\Model\DataObject\Event;
  6. use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  7. use Symfony\Component\HttpFoundation\Request;
  8. use Symfony\Component\HttpFoundation\Response;
  9. class ContentController extends BaseController
  10. {
  11.     /**
  12.      * @Template
  13.      *
  14.      * @param Request $request
  15.      * @return array
  16.      */
  17.     public function defaultAction(Request $request)
  18.     {
  19.         $document \Pimcore\Model\Document::getByPath($request->getPathInfo());
  20.         $list News::getByRelated_pages($document);
  21.         return $this->render('content/default.html.twig', [
  22.             'newslist' => $list
  23.         ]);
  24.         //  return [];
  25.     }
  26.     /**
  27.      * @return Response
  28.      */
  29.     public function frontpageAction()
  30.     {
  31.         $newsList = new News\Listing();
  32.         $newsList->setOrderKey('publish_date');
  33.         $newsList->setOrder('DESC');
  34.         $newsList->setLimit(2);
  35.         $eventList = new Event\Listing();
  36.         $eventList->setOrderKey('from_time');
  37.         $eventList->setOrder('ASC');
  38.         $eventList->setLimit(3);
  39.         $eventList->setCondition("to_time > ?", [time()]);
  40.         $blogList = new Blog\Listing();
  41.         $blogList->setOrderKey('pubDate');
  42.         $blogList->setOrder('DESC');
  43.         $blogList->setLimit(2);
  44.         return $this->render('content/frontpage.html.twig', [
  45.             'hideBreadcrumbs' => true,
  46.             'news' => $newsList,
  47.             'events' => $eventList,
  48.             'blogs' => $blogList
  49.         ]);
  50.     }
  51.     /**
  52.      * @Template
  53.      *
  54.      * @param Request $request
  55.      * @return array
  56.      */
  57.     public function sectionAction(Request $request)
  58.     {
  59.         return $this->render('content/section.html.twig', [
  60.             'hideBreadcrumbs' => true
  61.         ]);
  62.     }
  63.     /**
  64.      * @Template
  65.      *
  66.      * @param Request $request
  67.      * @return array
  68.      */
  69.     public function sitemapAction(Request $request)
  70.     {
  71.         return $this->render('content/sitemap.html.twig', []);
  72.     }
  73.     /**
  74.      * @Template
  75.      *
  76.      * @param Request $request
  77.      * @return array
  78.      */
  79.     public function designAction(Request $request)
  80.     {
  81.         return $this->render('designguide/design.html.twig', []);
  82.     }
  83.     /**
  84.      * @Template
  85.      *
  86.      * @param Request $request
  87.      * @return array
  88.      */
  89.     public function trainingAction(Request $request)
  90.     {
  91.         $eventList = new Event\Listing();
  92.         $eventList->setOrderKey('from_time');
  93.         $eventList->setOrder('ASC');
  94.         $eventList->setLimit(2);
  95.         $eventList->setCondition("to_time > ?", [time()]);
  96.         $eventList->addConditionParam("is_training = ?"1"AND");
  97.         return $this->render('content/training.html.twig', [
  98.             'hideBreadcrumbs' => true,
  99.             'events' => $eventList,
  100.         ]);
  101.     }
  102. }