<?php
namespace App\Controller\Module;
use App\AppBundle;
use SaintElmos\BaseBundle\Templating\Helper\FrontendHelper;
use SaintElmos\BaseBundle\Utils\SETConf;
use SaintElmos\BaseBundle\Controller\BaseController;
use Symfony\Component\HttpFoundation\Request;
use Pimcore\Controller\FrontendController;
class StartseiteController extends FrontendController
{
public function introAction(Request $request,\Pimcore\Config\Config $websiteConfig)
{
$template = $this->document->getTemplate() ? $this->document->getTemplate() : 'module/Startseite/__startseite.html.twig';
$frontendhelper = new FrontendHelper();
$konfiguration_projekt_obj = \Pimcore\Config::getWebsiteConfig()->get('konfiguration_projekt');
$bugfiximageurl = AppBundle::getBugfiximageurl();
function getMainImageSrc($assetPath):string
{
if ($assetPath != '') {
$asset = \Pimcore\Model\Asset::getByPath($assetPath);
if ($asset) {
$tumb = $asset->getThumbnail('intro-large');
return (string) $tumb->getPath();
}
return '';
}
return '';
}
$saison = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getSaison');
if(trim($saison) != 'winter')
{
$saison = 'sommer';
$img_rent = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getImg_rent_so');
$img_homes = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getImg_homes_so');
$img_shopping = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getImg_shopping_so');
$img_shopping_logo = getMainImageSrc(AppBundle::getValue($konfiguration_projekt_obj, 'getLogo_shopping_2023'));
$img_shopping_logo_mobile = getMainImageSrc(AppBundle::getValue($konfiguration_projekt_obj, 'getLogo_shopping_2023_mobile'));
$img_bike_logo = getMainImageSrc(AppBundle::getValue($konfiguration_projekt_obj, 'getLogo_bike_2023'));
$img_bike_logo_mobile = getMainImageSrc(AppBundle::getValue($konfiguration_projekt_obj, 'getLogo_bike_2023_mobile'));
$img_apartments_logo = getMainImageSrc(AppBundle::getValue($konfiguration_projekt_obj, 'getLogo_apartments_2023'));
$img_apartments_logo_mobile = getMainImageSrc(AppBundle::getValue($konfiguration_projekt_obj, 'getLogo_apartments_2023_mobile'));
}
else
{
$saison = 'winter';
$img_rent = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getImg_rent_wi');
$img_homes = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getImg_homes_wi');
$img_shopping = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getImg_shopping_wi');
$img_shopping_logo = getMainImageSrc(AppBundle::getValue($konfiguration_projekt_obj, 'getLogo_shopping_2023'));
$img_shopping_logo_mobile = getMainImageSrc(AppBundle::getValue($konfiguration_projekt_obj, 'getLogo_shopping_2023_mobile'));
$img_bike_logo = getMainImageSrc(AppBundle::getValue($konfiguration_projekt_obj, 'getLogo_bike_2023'));
$img_bike_logo_mobile = getMainImageSrc(AppBundle::getValue($konfiguration_projekt_obj, 'getLogo_bike_2023_mobile'));
$img_apartments_logo = getMainImageSrc(AppBundle::getValue($konfiguration_projekt_obj, 'getLogo_apartments_2023'));
$img_apartments_logo_mobile = getMainImageSrc(AppBundle::getValue($konfiguration_projekt_obj, 'getLogo_apartments_2023_mobile'));
}
$img_rent_thumb_large = '';
if($img_rent != '')
{
$img_srent_obj = \Pimcore\Model\Asset::getByPath($img_rent);
if(is_object($img_srent_obj))
{
$img_rent_thumb_large = (string)$img_srent_obj->getThumbnail('intro-large');
$img_rent_thumb_medium = (string)$img_srent_obj->getThumbnail('intro-medium');
$img_rent_thumb_small = AppBundle::getValue($konfiguration_projekt_obj, 'getLogodomain');
}
}
$img_homes_thumb_medium = '';
if($img_homes != '')
{
$img_homes_obj = \Pimcore\Model\Asset::getByPath($img_homes);
if(is_object($img_homes_obj))
{
$img_homes_thumb_large = (string)$img_homes_obj->getThumbnail('intro-large');
$img_homes_thumb_medium = (string)$img_homes_obj->getThumbnail('intro-medium');
$img_homes_thumb_small = (string)$img_homes_obj->getThumbnail('intro-small');
}
}
$img_hopping_thumb_large = '';
if($img_shopping != '')
{
$img_shopping_obj = \Pimcore\Model\Asset::getByPath($img_shopping);
if(is_object($img_shopping_obj))
{
$img_shopping_thumb_large = (string)$img_shopping_obj->getThumbnail('intro-large');
$img_shopping_thumb_medium = (string)$img_shopping_obj->getThumbnail('intro-medium');
$img_shopping_thumb_small = (string)$img_shopping_obj->getThumbnail('intro-small');
}
}
$img_homes_thumb_medium = '';
if($img_homes != '')
{
$img_homes_obj = \Pimcore\Model\Asset::getByPath($img_homes);
if(is_object($img_homes_obj))
{
$img_homes_thumb_large = (string)$img_homes_obj->getThumbnail('intro-large');
$img_homes_thumb_medium = (string)$img_homes_obj->getThumbnail('intro-medium');
$img_homes_thumb_small = (string)$img_homes_obj->getThumbnail('intro-small');
}
}
$title_rent = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getTitle_rent');
$title_rent = $frontendhelper->changeTextarea($title_rent);
$title_homes = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getTitle_homes');
$title_homes = $frontendhelper->changeTextarea($title_homes);
$title_shopping = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getTitle_shopping');
$title_shopping = $frontendhelper->changeTextarea($title_shopping);
$subhl_rent = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getSubhl_rent');
$subhl_homes = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getSubhl_homes');
$subhl_shopping = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getSubhl_shopping');
$url_rent = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getUrl_rent');
$url_homes = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getUrl_homes');
$url_shops = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getUrl_shopping');
$url_glory = (string)AppBundle::getValue($konfiguration_projekt_obj, 'getUrl_glanz');
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
$intro = array(
'saison' => $saison,
'title_rent' => $title_rent,
'title_homes' => $title_homes,
'title_shopping' => $title_shopping,
'subhl_rent' => $subhl_rent,
'subhl_homes' => $subhl_homes,
'subhl_shopping' => $subhl_shopping,
'img_rent_thumb_large' => $img_rent_thumb_large,
'img_rent_thumb_medium' => $img_rent_thumb_medium,
'img_rent_thumb_small' => $img_rent_thumb_small,
'img_homes_thumb_large' => $img_homes_thumb_large,
'img_homes_thumb_medium' => $img_homes_thumb_medium,
'img_homes_thumb_small' => $img_homes_thumb_small,
'img_shopping_thumb_large' => $img_shopping_thumb_large,
'img_shopping_thumb_medium' => $img_shopping_thumb_medium,
'img_shopping_thumb_small' => $img_shopping_thumb_small,
'glanzerLogo' => $img_shopping_logo,
'intersportlogo' => $img_bike_logo,
'glanzGlory' => $img_apartments_logo,
'glanzerMain' => $img_shopping_thumb_large,
'intersportMain' => $img_rent_thumb_large,
'gloryGlanzMain' => $img_homes_thumb_large,
'glanzerMobileLogo' => $img_shopping_logo_mobile,
'intersportMobilelogo' => $img_bike_logo_mobile,
'gloryGlanzMobileLogo' => $img_apartments_logo_mobile,
'url_rent' => $url_rent,
'url_homes' => $url_homes,
'url_shops' => $url_shops
);
// $this->view->intro = $intro;
return $this->render('module/Startseite/__startseite.html.twig', ['intro' => $intro]);
}
}