vendor/alnv/catalog-manager/library/alnv/Modules/ModuleMasterView.php line 14

Open in your IDE?
  1. <?php
  2. namespace CatalogManager;
  3. class ModuleMasterView extends \Module
  4. {
  5.     protected $strAct null;
  6.     protected $strMasterAlias null;
  7.     protected $strTemplate 'mod_catalog_master';
  8.     public function generate()
  9.     {
  10.         if (TL_MODE == 'BE') {
  11.             $objTemplate = new \BackendTemplate('be_wildcard');
  12.             $objTemplate->id $this->id;
  13.             $objTemplate->link $this->name;
  14.             $objTemplate->title $this->headline;
  15.             $objTemplate->href 'contao/main.php?do=themes&amp;table=tl_module&amp;act=edit&amp;id=' $this->id;
  16.             $objTemplate->wildcard '### ' utf8_strtoupper($GLOBALS['TL_LANG']['FMD']['catalogMasterView'][0]) . ' ###';
  17.             return $objTemplate->parse();
  18.         }
  19.         if (TL_MODE == 'FE' && $this->catalogCustomTemplate$this->strTemplate $this->catalogCustomTemplate;
  20.         if (!\Input::get('auto_item')) {
  21.             return '';
  22.         }
  23.         \System::loadLanguageFile('tl_module');
  24.         $this->strMasterAlias \Input::get('auto_item');
  25.         if (\Input::get('pdf' $this->id)) {
  26.             $this->strAct 'pdf';
  27.         }
  28.         return parent::generate();
  29.     }
  30.     protected function compile()
  31.     {
  32.         global $objPage;
  33.         if ($this->strAct && $this->strAct == 'pdf') {
  34.             $objEntity = new Entity(\Input::get('pdf' $this->id), $this->catalogTablename);
  35.             $objEntity->getPdf($this->id$this->catalogPdfTemplate);
  36.         }
  37.         $this->import('CatalogView');
  38.         $arrQuery = [
  39.             'where' => [
  40.                 [
  41.                     [
  42.                         'field' => 'alias',
  43.                         'operator' => 'equal',
  44.                         'value' => $this->strMasterAlias
  45.                     ]
  46.                 ]
  47.             ]
  48.         ];
  49.         if (is_numeric($this->strMasterAlias)) {
  50.             $arrQuery['where'][0][] = [
  51.                 'field' => 'id',
  52.                 'operator' => 'equal',
  53.                 'value' => $this->strMasterAlias
  54.             ];
  55.         }
  56.         $this->CatalogView->strMode 'master';
  57.         $this->CatalogView->arrOptions $this->arrData;
  58.         $this->CatalogView->objMainTemplate $this->Template;
  59.         $this->CatalogView->strTemplate $this->catalogMasterTemplate $this->catalogMasterTemplate 'catalog_master';
  60.         $this->CatalogView->initialize();
  61.         $strOutput $this->CatalogView->getCatalogView($arrQuery);
  62.         $this->Template->data is_array($strOutput) ? $strOutput : [];
  63.         $this->Template->output is_string($strOutput) ? $strOutput '';
  64.         $this->CatalogView->getCommentForm($this->CatalogView->strMasterID);
  65.         if (empty($strOutput)) {
  66.             if ($this->catalogAutoRedirect && $this->catalogViewPage && $this->catalogViewPage != $objPage->id) {
  67.                 if ($objRedirect \PageModel::findByPk($this->catalogViewPage)) {
  68.                     \Controller::redirect($objRedirect->getFrontendUrl());
  69.                 }
  70.                 return null;
  71.             }
  72.             $objCatalogException = new CatalogException();
  73.             $objCatalogException->set404();
  74.         }
  75.         if ($this->catalogSendJsonHeader) {
  76.             $this->import('CatalogAjaxController');
  77.             $this->CatalogAjaxController->setData([
  78.                 'data' => $this->Template->data,
  79.                 'output' => $this->Template->output,
  80.                 'showAsGroup' => $this->Template->showAsGroup,
  81.             ]);
  82.             $this->CatalogAjaxController->setType($this->catalogSendJsonHeader);
  83.             $this->CatalogAjaxController->setModuleID($this->id);
  84.             $this->CatalogAjaxController->sendJsonData();
  85.         }
  86.     }
  87. }