<?php
namespace Gh\FrontBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller,
Sensio\Bundle\FrameworkExtraBundle\Configuration\Template,
Symfony\Component\Routing\Annotation\Route,
Gh\CommonBundle\Classes\Meta\MetaClass,
Gh\FrontBundle\Classes\BreadcrumbClass,
Gh\FrontBundle\Classes\JsIncludesClass,
Gh\FrontBundle\Classes\TitleClass,
Gh\FrontBundle\Classes\MenuActiveClass;
/**
* In this controller, a method is created for each component, excepted Sidebar (see SidebarController).
*
* @author jmboyer
*/
class ComponentController extends Controller
{
/**
* This component generates the meta tags in the HTML page.
* See Design Dossier for further details.
*
* @Template()
*/
public function metaAction() {
$metaList = MetaClass::getInstance()->getListMeta();
return array('metaList' => $metaList);
}
/**
* This component generates the breadcrumb in the HTML page.
*
* @Template()
*/
public function breadcrumbAction() {
$breadcrumb = BreadcrumbClass::getInstance()->getFullBreadcrumb();
return array('breadcrumb' => $breadcrumb);
}
/**
* This component generates the title in the HTML page.
*
* @Template()
*/
public function titleAction() {
$title = TitleClass::getInstance()->getTitle();
return array('title' => $title);
}
/**
* This component generates the message located on the right of the megaban in the header.
*
* @param $message \Gh\DatabaseBundle\Entity\GhMessages Message (null if not found)
* @Template()
*/
public function messageAction($message) {
return array('message' => $message);
}
/**
* This component displays a gallery block in News/Dossiers.
*
* @param \Gh\DatabaseBundle\Entity\GhCard $card The card linked to the pictures
* @param array(\Gh\DatabaseBundle\Entity\GhGallery or \Gh\DatabaseBundle\Entity\GhDossierGallery) $pictures Array of the pictures to display
* @Template()
*/
public function galleryEmbeddedAction($card, $pictures) {
// If it is dossier, we need to look for the gallerySessionId
if ($pictures instanceof \Gh\DatabaseBundle\Entity\GhDossierGallery) {
$em = $this->getDoctrine()->getManager();
$pictures = $em->getRepository('GhDatabaseBundle:GhGallery')->getGalleriesBySessionId($pictures->getGallerysession());
}
return array('card' => $card, 'pictures' => $pictures);
}
/**
* This component displays Disqus comments block.
*
* @param string $canonicalUrl Canonical URL related to the comments.
* @param string $identifier Article identifier.
* @Route(
* "/comments/",
* name="GhFrontBundle_Component_commentsEmbed"
* )
* @return array
* @Template()
*/
public function commentsEmbeddedAction(string $canonicalUrl, string $identifier): array {
return array(
'canonicalUrl' => $canonicalUrl,
'identifier' => $identifier
);
}
/**
* This component generates the list of js files to be included at the end of page.
*
* @Template()
*/
public function jsIncludesAction() {
$jsUrls = JsIncludesClass::getInstance()->getListFiles();
return array('jsUrls' => $jsUrls);
}
}