<?php
/**
* 47_CustomModule for Contao Open Source CMS
*
* Copyright (C) 2016 Studienkreis Tourismus
* @author Holger Neuner <neuner@47gradnord.de>
* @project 47_CustomModule
* @license commercial
*/
namespace CustomModule\Frontend\Modules;
use Contao\FilesModel;
use Contao\Module;
use CustomModule\AffilliatePartner\SessionService;
class NavBar extends Module
{
/**
* Template
* @var string
*/
protected $strTemplate = 'mod_NavBar';
/**
* Display a wildcard in the back end
*
* @return string
*/
public function generate()
{
if (TL_MODE == 'BE')
{
/** @var \BackendTemplate|object $objTemplate */
$objTemplate = new \BackendTemplate('be_wildcard');
$objTemplate->wildcard = '### ' . utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['47_ModNavBar'][0]) . ' ###';
$objTemplate->title = $this->headline;
$objTemplate->id = $this->id;
$objTemplate->link = $this->name;
$objTemplate->href = 'contao/main.php?do=themes&table=tl_module&act=edit&id=' . $this->id;
return $objTemplate->parse();
}
return parent::generate();
}
/**
* Generate the module
*/
protected function compile()
{
/** @var \PageModel $objPage */
global $objPage;
// Set all Vars to Template by default
$this->Template->setData($this->arrData);
$this->Template->modNavBarLogo = FilesModel::findByUuid($this->modNavBarLogo)->path;
$affilliateSession = new SessionService();
if ( $affilliateSession->getAffilliateId() )
{
$this->Template->modNavBarLogoAffilliate = FilesModel::findByUuid($affilliateSession->getAffilliatePartner()->logo)->path;
}
}
}