<?php
namespace Gh\FrontBundle\Controller;
use Gh\FrontBundle\Classes\Sidebar\SidebarClass,
Gh\FrontBundle\Classes\MenuActiveClass,
Gh\DatabaseBundle\Entity\GhMessages,
Symfony\Bundle\FrameworkBundle\Controller\Controller,
Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
/**
* In this controller, methods are created for the header and the footer.
*
* @author jmboyer
*/
class GuiController extends Controller
{
/**
* @param boolean $ad If true, the megaban is displayed.
* @param $targetPath string|null (for headerEmbeddedAction)
* @Template()
*/
public function headerAction($ad, $targetPath = null) {
$search = '';
if (array_key_exists('queljeu', $_GET)) {
$search = $_GET['queljeu'];
}
$em = $this->getDoctrine()->getManager();
// Retrieve moment message (header and sidebar)
$momentMessage = $em->getRepository('GhDatabaseBundle:GhMessages')->getMessage(GhMessages::MESSAGE_TYPE_HEADER, true);
// Retrieve message to be displayed in the nav
$navMessage = $em->getRepository('GhDatabaseBundle:GhMessageNav')->getMessage();
return array(
'search' => $search,
'ad' => $ad,
'targetPath' => $targetPath,
'momentMessage' => $momentMessage,
'navMessage' => $navMessage
);
}
/**
* @param boolean $ad If true, the div are managed with megaban enabled.
* @Template()
*/
public function footerAction($ad) {
return array(
'ad' => $ad,
'isHomepage' => (MenuActiveClass::getInstance()->getMenuActive() == 'homepage')
);
}
/**
* @Template()
*/
public function sidebarAction() {
return array('sidebarList' => SidebarClass::getInstance()->getList());
}
}