vendor/memo_development/contao-team-bundle/src/Module/ModuleTeamListing.php line 87

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 Memo\FoundationBundle\Module\FoundationModule;
  10. use Memo\TeamBundle\Model\TeamModel;
  11. use Terminal42\ChangeLanguage\PageFinder;
  12. class ModuleTeamListing extends FoundationModule
  13. {
  14.     /**
  15.     * Template
  16.     * @var string
  17.     */
  18.     protected $strTemplate 'mod_team_listing';
  19.     protected function compile()
  20.     {
  21.         if (TL_MODE == 'FE')
  22.         {
  23.             // Get all selected Archives
  24.             $arrArchives unserialize$this->foundation_archives );
  25.             // Get override detail-page
  26.             $objDetailPage false;
  27.             if($this->jumpTo)
  28.             {
  29.                 // Get translated Detailpage if not in main-language
  30.                 $objPageFinder = new PageFinder();
  31.                 $objDetailPage $objPageFinder->findAssociatedForLanguage(\PageModel::findByPk($this->jumpTo), $GLOBALS['TL_LANGUAGE']);
  32.             }
  33.             // Get category filters
  34.             $arrCategoryFilters = array();
  35.             if($this->categories_filter){
  36.                 $arrCategoryFilters unserialize$this->categories_filter );
  37.             }
  38.             // Get the category filter type
  39.             $strCategoryFilterTyp $this->categories_filter_type;
  40.             // Define default filters
  41.             $arrColumns = array();
  42.             $arrValues = array();
  43.             if(count($arrCategoryFilters) > ) {
  44.                 if($strCategoryFilterTyp == 'and'){
  45.                     foreach($arrCategoryFilters as $intCategoryFilter){
  46.                         $arrColumns[] = 'categories LIKE ?';
  47.                         $arrValues[] = '%"' $intCategoryFilter '"%';
  48.                     }
  49.                 } else {
  50.                     $strColumns '(';
  51.                     foreach($arrCategoryFilters as $intCategoryFilter){
  52.                         $strColumns .= 'categories LIKE ? OR ';
  53.                         $arrValues[] = '%"' $intCategoryFilter '"%';
  54.                     }
  55.                     $strColumns substr($strColumns,0,-3);
  56.                     $strColumns .= ')';
  57.                     $arrColumns[] = $strColumns;
  58.                 }
  59.             }
  60.             // Respect the sql_filter
  61.             if($this->sql_filter){
  62.                 $arrColumns[] = $this->sql_filter;
  63.             }
  64.             // Define the findByOptions
  65.             $strTable TeamModel::getTable();
  66.             $arrFindByOptions $this->getFindByOptions($strTable);
  67.             // Retrieve Team-Members
  68.             $colItems TeamModel::findPublishedByPids($arrArchives$arrFindByOptions$arrColumns$arrValues);
  69.             if( is_object($colItems) )
  70.             {
  71.                 $arrCategories = (!is_null($this->categories)) ? unserialize($this->categories) : array();
  72.                 $arrItems $this->parseItems($colItems$objDetailPagetrue$arrCategories);
  73.                 $this->Template->items $arrItems;
  74.             }
  75.             // Get custom Template
  76.             if( $this->customTpl )
  77.             {
  78.                 $this->Template->strTemplate $this->customTpl;
  79.             }
  80.             // Template CSS ID
  81.             if( gettype($this->Template->cssID) === 'array' ) {
  82.                 if(array_key_exists(0$this->Template->cssID)){
  83.                     $this->Template->cssID $this->Template->cssID[0];
  84.                 } else {
  85.                     $this->Template->cssID '';
  86.                 }
  87.             }
  88.             // Parse Template
  89.             $this->Template->parse();
  90.         }
  91.         else
  92.         {
  93.             // Parse BackendTemplate
  94.             $this->parseBackendTemplate();
  95.         }
  96.     }
  97. }