Umstrukturierung:
* CMS-Action-Methoden (also Seiten, die durch page-Eintrag repräsentiert werden) von DefaultController nach CmsController verschoben * Action-Methoden für Wiederverwendbare View-Komponenten (die Controller-Logik benötigen) von DefaultController nach ComponentController verschoben * CMS-Seiten-Templates in den Unterordner "cms" verschoben git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3302 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
parent
4278e110fc
commit
bf69f20a50
12 changed files with 287 additions and 223 deletions
|
|
@ -62,7 +62,7 @@
|
||||||
<body>
|
<body>
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
|
|
||||||
{{ render(controller('AppBundle:Default:header')) }}
|
{{ render(controller('AppBundle:Component:header')) }}
|
||||||
|
|
||||||
{% block header2 %}
|
{% block header2 %}
|
||||||
<section class="section fullscreen background parallax" style="background-image:url('/bundles/app/images/travel/header-top-image3.jpg');" data-img-width="1920" data-img-height="820" data-diff="480">
|
<section class="section fullscreen background parallax" style="background-image:url('/bundles/app/images/travel/header-top-image3.jpg');" data-img-width="1920" data-img-height="820" data-diff="480">
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
|
|
||||||
{% block breadcrumb %}
|
{% block breadcrumb %}
|
||||||
{% if page is defined %}
|
{% if page is defined %}
|
||||||
{{ render(controller('AppBundle:Default:breadcrumb', {'page': page})) }}
|
{{ render(controller('AppBundle:Component:breadcrumb', {'page': page})) }}
|
||||||
{% elseif breadcrumb_entries is defined %}
|
{% elseif breadcrumb_entries is defined %}
|
||||||
{{ include('default/components/breadcrumb.html.twig') }}
|
{{ include('default/components/breadcrumb.html.twig') }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
{% if search_form is defined %}
|
{% if search_form is defined %}
|
||||||
{{ include('default/components/sidebar/searchSidebarWidget.html.twig') }}
|
{{ include('default/components/sidebar/searchSidebarWidget.html.twig') }}
|
||||||
{% elseif page is defined %}
|
{% elseif page is defined %}
|
||||||
{{ render(controller('AppBundle:Default:searchSidebarWidget', {page: page})) }}
|
{{ render(controller('AppBundle:Component:searchSidebarWidget', {page: page})) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ search_sidebar_widget_block|raw }}
|
{{ search_sidebar_widget_block|raw }}
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
{% if show_nav_sidebar_widget ?? true and page is defined %}
|
{% if show_nav_sidebar_widget ?? true and page is defined %}
|
||||||
{% if nav_sidebar_widget_block is empty %}
|
{% if nav_sidebar_widget_block is empty %}
|
||||||
{{ render(controller('AppBundle:Default:navSidebarWidget', {page: page})) }}
|
{{ render(controller('AppBundle:Component:navSidebarWidget', {page: page})) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ nav_sidebar_widget_block|raw }}
|
{{ nav_sidebar_widget_block|raw }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
@ -48,15 +48,15 @@
|
||||||
</div><!-- end widget -->
|
</div><!-- end widget -->
|
||||||
|
|
||||||
{% if (show_travel_guide_sidebar_widget ?? true) and page is defined and page.country is not empty %}
|
{% if (show_travel_guide_sidebar_widget ?? true) and page is defined and page.country is not empty %}
|
||||||
{{ render(controller('AppBundle:Default:travelGuideSidebarWidget', {country: page.country})) }}
|
{{ render(controller('AppBundle:Component:travelGuideSidebarWidget', {country: page.country})) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if (show_travel_magazine_sidebar_widget ?? true) and page is defined and page.country is not empty %}
|
{% if (show_travel_magazine_sidebar_widget ?? true) and page is defined and page.country is not empty %}
|
||||||
{{ render(controller('AppBundle:Default:travelMagazineSidebarWidget', {country: page.country})) }}
|
{{ render(controller('AppBundle:Component:travelMagazineSidebarWidget', {country: page.country})) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if (show_offers_sidebar_widget ?? true) and page is defined and page.country is not empty %}
|
{% if (show_offers_sidebar_widget ?? true) and page is defined and page.country is not empty %}
|
||||||
{{ render(controller('AppBundle:Default:offersSidebarWidget', {country: page.country})) }}
|
{{ render(controller('AppBundle:Component:offersSidebarWidget', {country: page.country})) }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div><!-- end col -->
|
</div><!-- end col -->
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
{% if page.travelProgram is not empty and page.travelProgram.lowestPrice > 0 %}
|
{% if page.travelProgram is not empty and page.travelProgram.lowestPrice > 0 %}
|
||||||
<div class="price">
|
<div class="price">
|
||||||
Für {{ child_page.travelProgram.lowestPrice|number_format }},- € p.P.
|
Für {{ page.travelProgram.lowestPrice|number_format }},- € p.P.
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
112
trunk/src/AppBundle/Controller/CmsController.php
Normal file
112
trunk/src/AppBundle/Controller/CmsController.php
Normal file
|
|
@ -0,0 +1,112 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
||||||
|
* @date 02/22/2017
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace AppBundle\Controller;
|
||||||
|
|
||||||
|
|
||||||
|
use AppBundle\Entity\Page;
|
||||||
|
use AppBundle\Form\TtSearchRequestType;
|
||||||
|
use AppBundle\Listener\KernelControllerListener;
|
||||||
|
use Doctrine\ORM\EntityManager;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller for CMS pages. CMS pages are represented by Page instances (i.e. entries of the page database table).
|
||||||
|
* The template property of a Page object defines the action method below. If a travel program is assigned then the
|
||||||
|
* travelProgramAction is used. If no template is specified, then the defaultAction is used.
|
||||||
|
*
|
||||||
|
* The view templates can be found pages/cms.
|
||||||
|
*
|
||||||
|
* Also see {@link KernelControllerListener}, which handles routing.
|
||||||
|
*
|
||||||
|
* @package AppBundle\Controller
|
||||||
|
*/
|
||||||
|
class CmsController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return EntityManager
|
||||||
|
*/
|
||||||
|
private function getEntityManager()
|
||||||
|
{
|
||||||
|
return $this->getDoctrine()->getManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function defaultAction(Page $page)
|
||||||
|
{
|
||||||
|
return $this->render('default/pages/cms/default.html.twig', [
|
||||||
|
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
||||||
|
'page' => $page,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function overviewAction(Page $page)
|
||||||
|
{
|
||||||
|
return $this->render('default/pages/cms/overview.html.twig', [
|
||||||
|
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
||||||
|
'page' => $page,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function travelProgramOverviewAction(Page $page)
|
||||||
|
{
|
||||||
|
$childPages =
|
||||||
|
$this->getEntityManager()->getRepository('AppBundle:Page')->getChildrenWithTravelProgramsAndDates($page);
|
||||||
|
|
||||||
|
$nonMediated = [];
|
||||||
|
$mediated = [];
|
||||||
|
foreach ($childPages as $childPage)
|
||||||
|
{
|
||||||
|
if ($childPage->getStatus() == 1 && $childPage->getTravelProgram() &&
|
||||||
|
$childPage->getTravelProgram()->getIsMediated())
|
||||||
|
{
|
||||||
|
$mediated[] = $childPage;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$nonMediated[] = $childPage;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// We only need a separation if there are mediated AND non mediated travel programs
|
||||||
|
if (empty($nonMediated) && !empty($mediated))
|
||||||
|
{
|
||||||
|
$childPages = $mediated;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$childPages = $nonMediated;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->render('default/pages/cms/travelProgramOverview.html.twig', [
|
||||||
|
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
||||||
|
'page' => $page,
|
||||||
|
'child_pages' => $childPages,
|
||||||
|
'mediated_child_pages' => $mediated,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function traveltainmentAction(Page $page)
|
||||||
|
{
|
||||||
|
$form = $this->createForm(TtSearchRequestType::class);
|
||||||
|
|
||||||
|
return $this->render('default/pages/cms/traveltainment.html.twig', [
|
||||||
|
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
||||||
|
'page' => $page,
|
||||||
|
'tt_search_form' => $form->createView(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function travelProgramAction(Page $page)
|
||||||
|
{
|
||||||
|
$this->getDoctrine()->getRepository('AppBundle:TravelPeriod')->getTrueTravelPeriods($page->getTravelProgram());
|
||||||
|
|
||||||
|
// replace this example code with whatever you need
|
||||||
|
return $this->render('default/pages/cms/travelProgram.html.twig', [
|
||||||
|
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
||||||
|
'page' => $page,
|
||||||
|
'travel_program' => $page->getTravelProgram()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
163
trunk/src/AppBundle/Controller/ComponentController.php
Normal file
163
trunk/src/AppBundle/Controller/ComponentController.php
Normal file
|
|
@ -0,0 +1,163 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace AppBundle\Controller;
|
||||||
|
|
||||||
|
use AppBundle\Entity\BreadcrumbEntry;
|
||||||
|
use AppBundle\Entity\ContactRequest;
|
||||||
|
use AppBundle\Entity\Page;
|
||||||
|
use AppBundle\Entity\TravelCountry;
|
||||||
|
use AppBundle\Form\ContactRequestType;
|
||||||
|
use AppBundle\Form\SearchRequestType;
|
||||||
|
use AppBundle\Form\TtSearchRequestType;
|
||||||
|
use AppBundle\Util;
|
||||||
|
use Doctrine\ORM\EntityManager;
|
||||||
|
use Gedmo\Tree\TreeListener;
|
||||||
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
use Symfony\Component\Routing\Annotation\Route;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Controller for re-usable view components. They are normally included by a render twig-expression. Example:
|
||||||
|
*
|
||||||
|
* <code>{{ render(controller('AppBundle:Component:travelGuideSidebarWidget', {country: page.country})) }}</code>
|
||||||
|
*/
|
||||||
|
class ComponentController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return EntityManager
|
||||||
|
*/
|
||||||
|
public function getEntityManager()
|
||||||
|
{
|
||||||
|
return $this->getDoctrine()->getManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function headerAction()
|
||||||
|
{
|
||||||
|
$navPages = $this->getEntityManager()->getRepository('AppBundle:Page')->findTopCountryNavPages();
|
||||||
|
return $this->render('default/components/header.html.twig', [
|
||||||
|
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
||||||
|
'nav_pages' => $navPages,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function breadcrumbAction(Page $page)
|
||||||
|
{
|
||||||
|
return $this->render('default/components/breadcrumb.html.twig', [
|
||||||
|
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
||||||
|
'breadcrumb_entries' => Util::createBreadcrumb($page),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function navSidebarWidgetAction(Page $page)
|
||||||
|
{
|
||||||
|
$pageRepo = $this->getEntityManager()->getRepository('AppBundle:Page');
|
||||||
|
$view = [
|
||||||
|
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
||||||
|
'page' => $page,
|
||||||
|
];
|
||||||
|
|
||||||
|
if ($page->getHasChildren())
|
||||||
|
{
|
||||||
|
if ($page->getLvl() == 0)
|
||||||
|
{
|
||||||
|
$view['nav_pages'] = $page->getChildren();
|
||||||
|
$view['nav_child_pages'] = [];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$view['nav_pages'] = $pageRepo->getSiblings($page);
|
||||||
|
$view['nav_child_pages'] = $page->getChildren();
|
||||||
|
}
|
||||||
|
$view['nav_open_node'] = $page;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$parent = $page->getParent();
|
||||||
|
if ($parent)
|
||||||
|
{
|
||||||
|
$view['nav_pages'] = $pageRepo->getSiblings($parent);
|
||||||
|
if (empty($view['nav_pages']))
|
||||||
|
{
|
||||||
|
$view['nav_pages'] = $pageRepo->getSiblings($page);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$view['nav_child_pages'] = $pageRepo->getSiblings($page);
|
||||||
|
}
|
||||||
|
$view['nav_open_node'] = $parent;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$view['nav_pages'] = $pageRepo->getSiblings($page);
|
||||||
|
$view['nav_child_pages'] = [];
|
||||||
|
$view['nav_open_node'] = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->render('default/components/sidebar/navSidebarWidget.html.twig', $view);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function searchSidebarWidgetAction(Page $page)
|
||||||
|
{
|
||||||
|
$combinedDestination = null;
|
||||||
|
if ($page->getTravelProgram())
|
||||||
|
{
|
||||||
|
$countries = $page->getTravelProgram()->getCountries();
|
||||||
|
$destination = $countries->first();
|
||||||
|
if (count($countries) > 1)
|
||||||
|
{
|
||||||
|
$combinedDestination = $countries[1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$destination = $page->getCountry();
|
||||||
|
}
|
||||||
|
return $this->render('default/components/sidebar/searchSidebarWidget.html.twig', [
|
||||||
|
'search_form' => $this->createForm(SearchRequestType::class, [
|
||||||
|
'c' => $destination,
|
||||||
|
'c2' => $combinedDestination,
|
||||||
|
])->createView()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function travelGuideSidebarWidgetAction(TravelCountry $country)
|
||||||
|
{
|
||||||
|
$repo = $this->getEntityManager()->getRepository('AppBundle:Page');
|
||||||
|
$rootPage = $repo->find(13);
|
||||||
|
$pages = $repo->getChildrenQueryBuilder($rootPage)
|
||||||
|
->andWhere('IDENTITY(node.country) = '. $country->getId())
|
||||||
|
->setMaxResults(3)
|
||||||
|
->getQuery()
|
||||||
|
->execute()
|
||||||
|
;
|
||||||
|
return $this->render('default/components/sidebar/textSliderSidebarWidget.html.twig', [
|
||||||
|
'slider_title' => 'Reiseführer',
|
||||||
|
'slides' => $pages
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function travelMagazineSidebarWidgetAction(TravelCountry $country)
|
||||||
|
{
|
||||||
|
$repo = $this->getEntityManager()->getRepository('AppBundle:Page');
|
||||||
|
$rootPage = $repo->find(2803);
|
||||||
|
$pages = $repo->getChildrenQueryBuilder($rootPage)
|
||||||
|
->andWhere('IDENTITY(node.country) = '. $country->getId())
|
||||||
|
->setMaxResults(3)
|
||||||
|
->getQuery()
|
||||||
|
->execute()
|
||||||
|
;
|
||||||
|
return $this->render('default/components/sidebar/textSliderSidebarWidget.html.twig', [
|
||||||
|
'slider_title' => 'Reisemagazin',
|
||||||
|
'slides' => $pages
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function offersSidebarWidgetAction(TravelCountry $country)
|
||||||
|
{
|
||||||
|
$pages = $this->getEntityManager()->getRepository('AppBundle:Page')->findWithTravelProgramsOfCountry($country);
|
||||||
|
return $this->render('default/components/sidebar/pageSliderSidebarWidget.html.twig', [
|
||||||
|
'slider_title' => 'Angebote',
|
||||||
|
'pages' => $pages
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -11,7 +11,6 @@ use AppBundle\Form\SearchRequestType;
|
||||||
use AppBundle\Form\TtSearchRequestType;
|
use AppBundle\Form\TtSearchRequestType;
|
||||||
use AppBundle\Util;
|
use AppBundle\Util;
|
||||||
use Doctrine\ORM\EntityManager;
|
use Doctrine\ORM\EntityManager;
|
||||||
use Doctrine\ORM\Query\Expr;
|
|
||||||
use Gedmo\Tree\TreeListener;
|
use Gedmo\Tree\TreeListener;
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
@ -29,7 +28,7 @@ class DefaultController extends Controller
|
||||||
|
|
||||||
public function defaultAction(Request $request)
|
public function defaultAction(Request $request)
|
||||||
{
|
{
|
||||||
throw new $this->createNotFoundException();
|
throw $this->createNotFoundException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -48,82 +47,6 @@ class DefaultController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cmsDefaultAction(Page $page)
|
|
||||||
{
|
|
||||||
return $this->render('default/pages/default.html.twig', [
|
|
||||||
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
|
||||||
'page' => $page,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function cmsOverviewAction(Page $page)
|
|
||||||
{
|
|
||||||
return $this->render('default/pages/overview.html.twig', [
|
|
||||||
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
|
||||||
'page' => $page,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function cmsTravelProgramOverviewAction(Page $page)
|
|
||||||
{
|
|
||||||
$childPages =
|
|
||||||
$this->getEntityManager()->getRepository('AppBundle:Page')->getChildrenWithTravelProgramsAndDates($page);
|
|
||||||
|
|
||||||
$nonMediated = [];
|
|
||||||
$mediated = [];
|
|
||||||
foreach ($childPages as $childPage)
|
|
||||||
{
|
|
||||||
if ($childPage->getStatus() == 1 && $childPage->getTravelProgram() &&
|
|
||||||
$childPage->getTravelProgram()->getIsMediated())
|
|
||||||
{
|
|
||||||
$mediated[] = $childPage;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$nonMediated[] = $childPage;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// We only need a separation if there are mediated AND non mediated travel programs
|
|
||||||
if (empty($nonMediated) && !empty($mediated))
|
|
||||||
{
|
|
||||||
$childPages = $mediated;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$childPages = $nonMediated;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->render('default/pages/travelProgramOverview.html.twig', [
|
|
||||||
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
|
||||||
'page' => $page,
|
|
||||||
'child_pages' => $childPages,
|
|
||||||
'mediated_child_pages' => $mediated,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function cmsTraveltainmentAction(Page $page)
|
|
||||||
{
|
|
||||||
$form = $this->createForm(TtSearchRequestType::class);
|
|
||||||
|
|
||||||
return $this->render('default/pages/traveltainment.html.twig', [
|
|
||||||
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
|
||||||
'page' => $page,
|
|
||||||
'tt_search_form' => $form->createView(),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function cmsTravelProgramAction(Page $page)
|
|
||||||
{
|
|
||||||
$this->getDoctrine()->getRepository('AppBundle:TravelPeriod')->getTrueTravelPeriods($page->getTravelProgram());
|
|
||||||
|
|
||||||
// replace this example code with whatever you need
|
|
||||||
return $this->render('default/pages/travelProgram.html.twig', [
|
|
||||||
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
|
||||||
'page' => $page,
|
|
||||||
'travel_program' => $page->getTravelProgram()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Route("/suche")
|
* @Route("/suche")
|
||||||
*/
|
*/
|
||||||
|
|
@ -213,10 +136,6 @@ class DefaultController extends Controller
|
||||||
if ($data['wellness'] ?? false) $ttUrl .= '&wellness=0';
|
if ($data['wellness'] ?? false) $ttUrl .= '&wellness=0';
|
||||||
if ($data['typ'] ?? false) $ttUrl .= '&typ=0';
|
if ($data['typ'] ?? false) $ttUrl .= '&typ=0';
|
||||||
if (!empty($data['sportangebot'])) $ttUrl .= '&sportangebot='. $data['sportangebot'];
|
if (!empty($data['sportangebot'])) $ttUrl .= '&sportangebot='. $data['sportangebot'];
|
||||||
|
|
||||||
//die($ttUrl);
|
|
||||||
//http://www.vidado.com/booking/ibe_bp2/index.php?CID=8ce65750ce5af9d9a6b22c9b04772ea7&formular=4&engine=pauschal&detail=hotel&showresult=1&termin=26.02.2017&ruecktermin=12.03.2017&dauer=6_14&personen=25;25&abflughafen=-1&topRegion=727
|
|
||||||
//http://www.vidado.com/booking/ibe_bp2/index.php?CID=8ce65750ce5af9d9a6b22c9b04772ea7&formular=4&engine=pauschal&detail=zielgebiet&showresult=1&termin=26.02.2017&ruecktermin=12.03.2017&dauer=6_14&personen=25;25&abflughafen=-1&topRegion=
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('default/pages/ttSearch.html.twig', [
|
return $this->render('default/pages/ttSearch.html.twig', [
|
||||||
|
|
@ -283,136 +202,6 @@ class DefaultController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function headerAction()
|
|
||||||
{
|
|
||||||
$navPages = $this->getEntityManager()->getRepository('AppBundle:Page')->findTopCountryNavPages();
|
|
||||||
return $this->render('default/components/header.html.twig', [
|
|
||||||
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
|
||||||
'nav_pages' => $navPages,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function breadcrumbAction(Page $page)
|
|
||||||
{
|
|
||||||
return $this->render('default/components/breadcrumb.html.twig', [
|
|
||||||
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
|
||||||
'breadcrumb_entries' => Util::createBreadcrumb($page),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function navSidebarWidgetAction(Page $page)
|
|
||||||
{
|
|
||||||
$pageRepo = $this->getEntityManager()->getRepository('AppBundle:Page');
|
|
||||||
$view = [
|
|
||||||
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
|
|
||||||
'page' => $page,
|
|
||||||
];
|
|
||||||
|
|
||||||
if ($page->getHasChildren())
|
|
||||||
{
|
|
||||||
if ($page->getLvl() == 0)
|
|
||||||
{
|
|
||||||
$view['nav_pages'] = $page->getChildren();
|
|
||||||
$view['nav_child_pages'] = [];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$view['nav_pages'] = $pageRepo->getSiblings($page);
|
|
||||||
$view['nav_child_pages'] = $page->getChildren();
|
|
||||||
}
|
|
||||||
$view['nav_open_node'] = $page;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$parent = $page->getParent();
|
|
||||||
if ($parent)
|
|
||||||
{
|
|
||||||
$view['nav_pages'] = $pageRepo->getSiblings($parent);
|
|
||||||
if (empty($view['nav_pages']))
|
|
||||||
{
|
|
||||||
$view['nav_pages'] = $pageRepo->getSiblings($page);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$view['nav_child_pages'] = $pageRepo->getSiblings($page);
|
|
||||||
}
|
|
||||||
$view['nav_open_node'] = $parent;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$view['nav_pages'] = $pageRepo->getSiblings($page);
|
|
||||||
$view['nav_child_pages'] = [];
|
|
||||||
$view['nav_open_node'] = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $this->render('default/components/sidebar/navSidebarWidget.html.twig', $view);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function searchSidebarWidgetAction(Page $page)
|
|
||||||
{
|
|
||||||
$combinedDestination = null;
|
|
||||||
if ($page->getTravelProgram())
|
|
||||||
{
|
|
||||||
$countries = $page->getTravelProgram()->getCountries();
|
|
||||||
$destination = $countries->first();
|
|
||||||
if (count($countries) > 1)
|
|
||||||
{
|
|
||||||
$combinedDestination = $countries[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$destination = $page->getCountry();
|
|
||||||
}
|
|
||||||
return $this->render('default/components/sidebar/searchSidebarWidget.html.twig', [
|
|
||||||
'search_form' => $this->createForm(SearchRequestType::class, [
|
|
||||||
'c' => $destination,
|
|
||||||
'c2' => $combinedDestination,
|
|
||||||
])->createView()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function travelGuideSidebarWidgetAction(TravelCountry $country)
|
|
||||||
{
|
|
||||||
$repo = $this->getEntityManager()->getRepository('AppBundle:Page');
|
|
||||||
$rootPage = $repo->find(13);
|
|
||||||
$pages = $repo->getChildrenQueryBuilder($rootPage)
|
|
||||||
->andWhere('IDENTITY(node.country) = '. $country->getId())
|
|
||||||
->setMaxResults(3)
|
|
||||||
->getQuery()
|
|
||||||
->execute()
|
|
||||||
;
|
|
||||||
return $this->render('default/components/sidebar/textSliderSidebarWidget.html.twig', [
|
|
||||||
'slider_title' => 'Reiseführer',
|
|
||||||
'slides' => $pages
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function travelMagazineSidebarWidgetAction(TravelCountry $country)
|
|
||||||
{
|
|
||||||
$repo = $this->getEntityManager()->getRepository('AppBundle:Page');
|
|
||||||
$rootPage = $repo->find(2803);
|
|
||||||
$pages = $repo->getChildrenQueryBuilder($rootPage)
|
|
||||||
->andWhere('IDENTITY(node.country) = '. $country->getId())
|
|
||||||
->setMaxResults(3)
|
|
||||||
->getQuery()
|
|
||||||
->execute()
|
|
||||||
;
|
|
||||||
return $this->render('default/components/sidebar/textSliderSidebarWidget.html.twig', [
|
|
||||||
'slider_title' => 'Reisemagazin',
|
|
||||||
'slides' => $pages
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function offersSidebarWidgetAction(TravelCountry $country)
|
|
||||||
{
|
|
||||||
$pages = $this->getEntityManager()->getRepository('AppBundle:Page')->findWithTravelProgramsOfCountry($country);
|
|
||||||
return $this->render('default/components/sidebar/pageSliderSidebarWidget.html.twig', [
|
|
||||||
'slider_title' => 'Angebote',
|
|
||||||
'pages' => $pages
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Suche Kindknoten
|
Suche Kindknoten
|
||||||
Für jeden Kindknoten
|
Für jeden Kindknoten
|
||||||
|
|
|
||||||
|
|
@ -129,12 +129,12 @@ class KernelControllerListener
|
||||||
}
|
}
|
||||||
elseif ($node->getTravelProgram() != null)
|
elseif ($node->getTravelProgram() != null)
|
||||||
{
|
{
|
||||||
$request->attributes->set('_controller', 'AppBundle:Default:cmsTravelProgram');
|
$request->attributes->set('_controller', 'AppBundle:Cms:travelProgram');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$handler = 'cms'. ($node->getTemplate() ? ucfirst($node->getTemplate()) : 'Default');
|
$handler = $node->getTemplate() ? ucfirst($node->getTemplate()) : 'Default';
|
||||||
$request->attributes->set('_controller', 'AppBundle:Default:'. $handler);
|
$request->attributes->set('_controller', 'AppBundle:Cms:'. $handler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue