src/Controller/PagecontentController.php line 138

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\AppBundle;
  4. use App\Controller\Traits\IconTrait;
  5. use Pimcore\Config\Config;
  6. use Pimcore\Model\DataObject\Configset;
  7. use SaintElmos\BaseBundle\Services\RemoteData;
  8. use App\Controller\PageBaseController as BasePagecontentController;
  9. use Psr\Container\ContainerInterface;
  10. use Symfony\Component\HttpFoundation\Request;
  11. use Symfony\Component\HttpFoundation\RequestStack;
  12. use \Pimcore\Model\WebsiteSetting;
  13. use Pimcore\Controller\FrontendController;
  14. //class PagecontentController extends BasePagecontentController
  15. class PagecontentController extends FrontendController
  16. {
  17.     use IconTrait;
  18.     public $baseParam = [];
  19.     public $region_homes_doc;
  20.     public function __construct(ContainerInterface $containerRequestStack $requestStack)
  21.     {
  22.         //echo "<pre>"; print_r($this->baseparams); die;
  23.         //parent::__construct($container, $requestStack);
  24.         
  25.         
  26.         $konfiguration_set_obj WebsiteSetting::getByName('konfiguration_set')->getData(); 
  27.         $this->baseParam['konfiguration_set_obj'] = $konfiguration_set_obj;
  28.         $this->baseParam['startseite'] = AppBundle::getValue($konfiguration_set_obj'getStartseite');
  29.         // $konfiguration_projekt_obj = \Pimcore\Config::getWebsiteConfig()->get('konfiguration_projekt');
  30.         $konfiguration_projekt_obj WebsiteSetting::getByName('konfiguration_projekt')->getData(); 
  31.         $this->baseParam['konfiguration_projekt_obj'] = $konfiguration_projekt_obj;
  32.         $server_protocol 'http' . ($_SERVER['REQUEST_SCHEME'] == 'https' 's' '');
  33.         //$canonical_base = $server_protocol . '://' . $_SERVER['HTTP_HOST'] . $this->document->getFullpath();
  34.         //$this->baseParam['path_info'] = $server_protocol . '://' . $_SERVER['HTTP_HOST'] . $this->document->getRealFullpath();
  35.         //$this->baseParam['canonical_base'] = $canonical_base;
  36.         $this->baseParam['kundenLogoUrl'] = AppBundle::getValue($konfiguration_projekt_obj'getLogodomain');
  37.         $this->baseParam['domain'] = $server_protocol '://' $_SERVER['HTTP_HOST'];
  38.         if( method_exists($konfiguration_set_obj,'getStartseite' ) )
  39.         {
  40.             $startseiteEN $server_protocol '://' $_SERVER['HTTP_HOST'] . $konfiguration_set_obj->getStartseite('en');
  41.         }
  42.         $this->baseParam['startseiteEN'] = $startseiteEN;
  43.         $this->baseParam['sprachweiche_title'] = AppBundle::getValue($konfiguration_projekt_obj'getSprachweiche_title');
  44.         $this->baseParam['sprachweiche_text'] = AppBundle::getValue($konfiguration_projekt_obj'getSprachweiche_text');
  45.         $this->baseParam['sprachweiche_button_yes'] = AppBundle::getValue($konfiguration_projekt_obj'getSprachweiche_button_yes');
  46.         $this->baseParam['sprachweiche_button_no'] = AppBundle::getValue($konfiguration_projekt_obj'getSprachweiche_button_no');
  47.         
  48.         
  49.         /* ********************************************************************************************************************* */
  50.         /*
  51.          * S P R A C H A U S W A H L
  52.          */
  53.         $SprachauswahlArray = array();
  54.        // $SprachauswahlBlock = \Pimcore\Config::getWebsiteConfig()->get('konfiguration_projekt')->getSprachauswahl_block();
  55.         $SprachauswahlBlock WebsiteSetting::getByName('konfiguration_projekt')->getData()->getSprachauswahl_block();
  56.         
  57.         $att_text 'en';
  58.         /* $lg = $this->document->getProperty('language');
  59.         switch ($lg) {
  60.             case 'de':
  61.                 $att_text = 'en';
  62.                 break;
  63.             case 'en':
  64.                 $att_text = 'de';
  65.                 break;
  66.         } */
  67.         if (count($SprachauswahlBlock) > 0) {
  68.             foreach ($SprachauswahlBlock as $key => $element) {
  69.                 $languageurlArr $element['languageurl'];
  70.                 $languageurlObj $languageurlArr->getData();
  71.                 $url $languageurlObj->getHref();
  72.                 $SprachauswahlArray[$key] = array(
  73.                     'languagetitle' => $element['languagetitle']->getData(),
  74.                     'languageurl' => $url,
  75.                     'att_text' => $att_text
  76.                 );
  77.             }
  78.             $this->baseParam['sprachauswahl'] = $SprachauswahlArray;
  79.             $this->baseParam['show_sprachauswahl'] = true;
  80.         } else {
  81.             $this->baseParam['sprachauswahl'] = array();
  82.             $this->baseParam['show_sprachauswahl'] = false;
  83.         }
  84.          
  85.         /* ********************************************************************************************************************* */
  86.         /*
  87.          * L O C A T I O N
  88.          */
  89.          $this->baseParam['server_protocol'] = $server_protocol;
  90.          $this->baseParam['startseite'] = $konfiguration_set_obj->getStartseite();
  91.         /* ********************************************************************************************************************* */
  92.         /*
  93.          * T H E M E
  94.          */
  95.         /* $theme = AppBundle::getTheme($this->document, 'theme_doc');
  96.         $this->baseParam['theme'] = $theme;  */
  97.        
  98.         /* ********************************************************************************************************************* */
  99.         /*
  100.          * N A V I G A T I O N
  101.          */
  102.          $this->baseParam['url_rent'] = AppBundle::getValue($konfiguration_projekt_obj'getUrl_rent');
  103.          $this->baseParam['text_rent'] = AppBundle::getValue($konfiguration_projekt_obj'getText_rent');
  104.          $this->baseParam['url_homes'] = AppBundle::getValue($konfiguration_projekt_obj'getUrl_homes');
  105.          $this->baseParam['text_homes'] = AppBundle::getValue($konfiguration_projekt_obj'getText_homes');
  106.          $this->baseParam['url_shops'] = AppBundle::getValue($konfiguration_projekt_obj'getUrl_shopping');
  107.          $this->baseParam['text_shops'] = AppBundle::getValue($konfiguration_projekt_obj'getText_shopping');
  108.         
  109.        
  110.     }
  111.     public function __init(){
  112.         $theme AppBundle::getTheme($this->document'theme_doc');
  113.         $region_homes_doc AppBundle::getTheme($this->document'region_homes_doc');
  114.         $this->baseParam['theme'] = $theme;
  115.         $this->baseParam['page'] = $region_homes_doc;
  116.         $bugfiximageurl AppBundle::getBugfiximageurl();
  117.         /* ********************************************************************************************************************* */
  118.         /*
  119.          * G L A N Z E R L O G O
  120.          */
  121.         $server_protocol 'http' . ($_SERVER['REQUEST_SCHEME'] == 'https' 's' '');
  122.          $logo_link AppBundle::getValue($this->baseParam['konfiguration_projekt_obj'], 'getLogodomain');
  123.         $canonical_base $server_protocol '://' $_SERVER['HTTP_HOST'] . $this->document->getFullpath();
  124.         $this->baseParam['path_info'] = $server_protocol '://' $_SERVER['HTTP_HOST'] . $this->document->getRealFullpath();
  125.         $this->baseParam['canonical_base'] = $canonical_base;
  126.         
  127.         if ($region_homes_doc === 'hochsoelden')
  128.         {
  129.             $theme "hochsoelden";
  130.         }
  131.          switch ($theme) {
  132.              case 'homes':
  133.                  $glanzerLogo AppBundle::getValue($this->baseParam['konfiguration_projekt_obj'], 'getLogo_homes');
  134.                  break;
  135.              case 'rent':
  136.                  $glanzerLogo AppBundle::getValue($this->baseParam['konfiguration_projekt_obj'], 'getLogo_rent');
  137.                  break;
  138.              case 'hochsoelden':
  139.                  $glanzerLogo AppBundle::getValue($this->baseParam['konfiguration_projekt_obj'], 'getLogo_hochsoelden');
  140.                  break;     
  141.              default:
  142.                  $glanzerLogo AppBundle::getValue($this->baseParam['konfiguration_projekt_obj'], 'getLogo_default');
  143.          }
  144.         
  145.         $glanzerLogoAlt ""
  146.         if (is_file($_SERVER["DOCUMENT_ROOT"] . '/var/assets' $glanzerLogo) != '')
  147.         {
  148.             $glanzer_logo_asset_obj \Pimcore\Model\Asset::getByPath($glanzerLogo);
  149.             $glanzerLogoAlt $glanzer_logo_asset_obj->getMetadata("alt");
  150.         }
  151.         $this->baseParam['frontendParam'] = isset($_GET['load']) ? $_GET['load'] : "";
  152.         $this->baseParam['logo_link']       = $logo_link;
  153.         $this->baseParam['glanzerLogo']     = $bugfiximageurl.$glanzerLogo;
  154.         $this->baseParam['glanzerLogoAlt']  = $glanzerLogoAlt;
  155.         $this->baseParam['contacts'] = $this->getContactLinks();
  156.     }
  157.     public function contentAction(Request $request)
  158.     {
  159.         $locale $request->getLocale();
  160.         $this->baseParam['wetterLink'] = $this->getWetter($locale)['link'];
  161.         $this->baseParam['wetterIcon'] = $this->getWetter($locale)['icon'];
  162.         $this->__init();
  163.         $param = (count($_GET) > 0) ? '?' '';
  164.         $param .= http_build_query($_GET'''&amp;');
  165.         
  166.         //echo "<pre>"; print_r($this->baseParam); die;
  167.        // $this->view->canonical = $this->view->canonical_base . $param;
  168.       //  $this->view->remotedata = $this->get(RemoteData::class);
  169.         //return $this->render('pagecontent/sample.html.twig', $params);
  170.         return $this->render('pagecontent/pagecontent.html.twig'$this->baseParam);
  171.     }
  172.     public function packageDetailAction(Request $request)
  173.     {
  174.         $region $request->get('region');
  175.         $GLOBALS['region_param'] = $region;
  176.         $urlaubsangebot $request->get('nameangebot');
  177.         $this->__init();
  178.         /* ********************************************************************************************************************* */
  179.         $canonical  $this->baseParam['canonical_base'] . '/' $urlaubsangebot;
  180.        // $this->view->canonical = $canonical;
  181.         /* ********************************************************************************************************************* */
  182.         $items = new \Pimcore\Model\DataObject\Packages\Listing();
  183.         foreach ($items as $item) {
  184.             if ((string)$item->getPrettyurl() == $urlaubsangebot) {
  185.                 $special_description AppBundle::getValue($item'getMetabeschreibung');
  186.                 $special_title AppBundle::getValue($item'getMetatitel');
  187.                 $package_objekt_id $item->getId();
  188.                 break;
  189.             }
  190.         }
  191.         $GLOBALS['packageObjectId'] = $package_objekt_id;
  192.         //$this->view->special_title = $special_title;
  193.         //$this->view->special_description = $special_description;
  194.         /* ********************************************************************************************************************* */
  195.         $vars = array(
  196.             'region' => $region,
  197.             'urlaubsangebot' => $urlaubsangebot,
  198.             'special_title' => $special_title,
  199.             'canonical' => $canonical,
  200.             'special_description' => $special_description
  201.         );
  202.         //return $this->renderTemplate('AppBundle::Pagecontent/content.html.php', $vars);
  203.         return $this->render('pagecontent/pagecontent.html.twig'$vars);
  204.     }
  205.     public function jobDetailAction(Request $request)
  206.     {
  207.         $jobangebot $request->get('jobangebot');
  208.         /* ********************************************************************************************************************* */
  209.         $canonical  $this->view->canonical_base '/' .  $jobangebot ;
  210.         $this->view->canonical $canonical;
  211.         /* ********************************************************************************************************************* */
  212.         $items = new \Pimcore\Model\DataObject\Jobs\Listing();
  213.         foreach ($items as $item) {
  214.             if ((string)$item->getPrettyurl() == $jobangebot) {
  215.                 $special_description AppBundle::getValue($item'getMetabeschreibung');
  216.                 $special_title AppBundle::getValue($item'getMetatitel');
  217.                 $jobs_objekt_id $item->getId();
  218.                 break;
  219.             }
  220.         }
  221.         $GLOBALS['jobsObjectId'] = $jobs_objekt_id;
  222.         $this->view->special_title $special_title;
  223.         $this->view->special_description $special_description;
  224.         /* ********************************************************************************************************************* */
  225.         $vars = array();
  226.         return $this->renderTemplate('AppBundle::Pagecontent/content.html.php'$vars);
  227.     }
  228. }