system/modules/47_CustomModule/library/CustomModule/Frontend/Modules/NavBar.php line 47

Open in your IDE?
  1. <?php
  2. /**
  3.  * 47_CustomModule for Contao Open Source CMS
  4.  *
  5.  * Copyright (C) 2016 Studienkreis Tourismus
  6.  * @author     Holger Neuner <neuner@47gradnord.de>
  7.  * @project    47_CustomModule
  8.  * @license    commercial
  9.  */
  10. namespace CustomModule\Frontend\Modules;
  11. use Contao\FilesModel;
  12. use Contao\Module;
  13. use CustomModule\AffilliatePartner\SessionService;
  14. class NavBar extends Module
  15. {
  16.     /**
  17.      * Template
  18.      * @var string
  19.      */
  20.     protected $strTemplate 'mod_NavBar';
  21.     /**
  22.      * Display a wildcard in the back end
  23.      *
  24.      * @return string
  25.      */
  26.     public function generate()
  27.     {
  28.         if (TL_MODE == 'BE')
  29.         {
  30.             /** @var \BackendTemplate|object $objTemplate */
  31.             $objTemplate = new \BackendTemplate('be_wildcard');
  32.             $objTemplate->wildcard '### ' utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['47_ModNavBar'][0]) . ' ###';
  33.             $objTemplate->title $this->headline;
  34.             $objTemplate->id $this->id;
  35.             $objTemplate->link $this->name;
  36.             $objTemplate->href 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' $this->id;
  37.             return $objTemplate->parse();
  38.         }
  39.         return parent::generate();
  40.     }
  41.     /**
  42.      * Generate the module
  43.      */
  44.     protected function compile()
  45.     {
  46.         /** @var \PageModel $objPage */
  47.         global $objPage;
  48.         // Set all Vars to Template by default
  49.         $this->Template->setData($this->arrData);
  50.         $this->Template->modNavBarLogo FilesModel::findByUuid($this->modNavBarLogo)->path;
  51.         $affilliateSession = new SessionService();
  52.         if ( $affilliateSession->getAffilliateId() )
  53.         {
  54.             $this->Template->modNavBarLogoAffilliate FilesModel::findByUuid($affilliateSession->getAffilliatePartner()->logo)->path;
  55.         }
  56.     }
  57. }