src/Gh/FrontBundle/Controller/ComponentController.php line 39

Open in your IDE?
  1. <?php
  2. namespace Gh\FrontBundle\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\Controller,
  4.     Sensio\Bundle\FrameworkExtraBundle\Configuration\Template,
  5.     Symfony\Component\Routing\Annotation\Route,
  6.     Gh\CommonBundle\Classes\Meta\MetaClass,
  7.     Gh\FrontBundle\Classes\BreadcrumbClass,
  8.     Gh\FrontBundle\Classes\JsIncludesClass,
  9.     Gh\FrontBundle\Classes\TitleClass,
  10.     Gh\FrontBundle\Classes\MenuActiveClass;
  11. /**
  12.  * In this controller, a method is created for each component, excepted Sidebar (see SidebarController).
  13.  * 
  14.  * @author jmboyer
  15.  */
  16. class ComponentController extends Controller
  17. {
  18.     /**
  19.      * This component generates the meta tags in the HTML page. 
  20.      * See Design Dossier for further details.
  21.      * 
  22.      * @Template()
  23.      */
  24.     public function metaAction() {
  25.         $metaList MetaClass::getInstance()->getListMeta();
  26.         
  27.         return array('metaList' => $metaList);
  28.     }
  29.     
  30.     /**
  31.      * This component generates the breadcrumb in the HTML page.
  32.      * 
  33.      * @Template()
  34.      */
  35.     public function breadcrumbAction() {
  36.         $breadcrumb BreadcrumbClass::getInstance()->getFullBreadcrumb();
  37.         
  38.         return array('breadcrumb' => $breadcrumb);
  39.     }
  40.     
  41.     /**
  42.      * This component generates the title in the HTML page.
  43.      * 
  44.      * @Template()
  45.      */
  46.     public function titleAction() {
  47.         $title TitleClass::getInstance()->getTitle();
  48.         
  49.         return array('title' => $title);
  50.     }
  51.     /**
  52.      * This component generates the message located on the right of the megaban in the header.
  53.      * 
  54.      * @param $message \Gh\DatabaseBundle\Entity\GhMessages Message (null if not found)
  55.      * @Template()
  56.      */
  57.     public function messageAction($message) {
  58.         return array('message' => $message);
  59.     }
  60.     
  61.     /**
  62.      * This component displays a gallery block in News/Dossiers.
  63.      * 
  64.      * @param \Gh\DatabaseBundle\Entity\GhCard $card The card linked to the pictures
  65.      * @param array(\Gh\DatabaseBundle\Entity\GhGallery or \Gh\DatabaseBundle\Entity\GhDossierGallery) $pictures Array of the pictures to display
  66.      * @Template()
  67.      */
  68.     public function galleryEmbeddedAction($card$pictures) {
  69.         // If it is dossier, we need to look for the gallerySessionId
  70.         if ($pictures instanceof \Gh\DatabaseBundle\Entity\GhDossierGallery) {
  71.             $em $this->getDoctrine()->getManager();
  72.             $pictures $em->getRepository('GhDatabaseBundle:GhGallery')->getGalleriesBySessionId($pictures->getGallerysession());
  73.         }
  74.         
  75.         return array('card' => $card'pictures' => $pictures);
  76.     }
  77.     /**
  78.      * This component displays Disqus comments block.
  79.      *
  80.      * @param string $canonicalUrl Canonical URL related to the comments.
  81.      * @param string $identifier Article identifier.
  82.      * @Route(
  83.      *      "/comments/",
  84.      *      name="GhFrontBundle_Component_commentsEmbed"
  85.      * )
  86.      * @return array
  87.      * @Template()
  88.      */
  89.     public function commentsEmbeddedAction(string $canonicalUrlstring $identifier): array {
  90.         return array(
  91.             'canonicalUrl' => $canonicalUrl,
  92.             'identifier' => $identifier
  93.         );
  94.     }
  95.     /**
  96.      * This component generates the list of js files to be included at the end of page. 
  97.      * 
  98.      * @Template()
  99.      */
  100.     public function jsIncludesAction() {
  101.         $jsUrls JsIncludesClass::getInstance()->getListFiles();
  102.         
  103.         return array('jsUrls' => $jsUrls);
  104.     }
  105. }