vendor/memo_development/contao-team-bundle/src/Module/ModuleTeamReader.php line 50

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. /**
  3.  * @package   Memo\MemoTeamBundle
  4.  * @author    Media Motion AG
  5.  * @license   LGPL-3.0+
  6.  * @copyright Media Motion AG
  7.  */
  8. namespace Memo\TeamBundle\Module;
  9. use Contao\CoreBundle\Exception\PageNotFoundException;
  10. use http\Env;
  11. use Memo\FoundationBundle\Module\FoundationModule;
  12. use Memo\TeamBundle\Model\TeamModel;
  13. class ModuleTeamReader extends FoundationModule
  14. {
  15.     /**
  16.      * Template
  17.      * @var string
  18.      */
  19.     protected $strTemplate 'mod_team_reader';
  20.     /**
  21.      * Generate module
  22.      */
  23.     protected function compile()
  24.     {
  25.         if (TL_MODE === 'FE')
  26.         {
  27.             global $objPage;
  28.             // Get auto_item (GET Parameter)
  29.             $strAlias \Input::get('auto_item');
  30.             // Check if there is an Alias in the URL
  31.             if($strAlias != '')
  32.             {
  33.                 // Get the item by alias (this also filters by start/stop, looks for alias_en etc.)
  34.                 $colItem TeamModel::getItemByTranslatedAlias($strAlias);
  35.                 // Set the MetaData for the detailpage
  36.                 if ($colItem) {
  37.                     $this->setMetaData($colItem);
  38.                     // Parse the item into an array (this also generates images, html-template etc.)
  39.                     $arrItems $this->parseItems($colItemnullfalse);
  40.                     // Define the data "raw" for custom template use
  41.                     $this->Template->setData($colItem->row());
  42.                     // Set the custom template, if defined
  43.                     if ($this->customTpl) {
  44.                         $this->Template->strTemplate $this->customTpl;
  45.                     }
  46.                     // Pass the items to the template
  47.                     $this->Template->items $arrItems;
  48.                     
  49.                     // Template CSS ID
  50.                     $this->Template->class trim('mod_' $this->type ' ' . ($this->cssID[1] ?? ''));
  51.                     $this->Template->cssID = !empty($this->cssID[0]) ? ' id="' $this->cssID[0] . '"' '';
  52.                     
  53.                     // Parse the Template
  54.                     $this->Template->parse();
  55.                 } else {
  56.                     throw new PageNotFoundException('Page not found: ' $this->Environment::get('uri'));
  57.                 }
  58.             }
  59.         }
  60.         else
  61.         {
  62.             // Get the automatic Backend-view
  63.             $this->parseBackendTemplate();
  64.         }
  65.     }
  66. }