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
|
|
@ -11,7 +11,6 @@ use AppBundle\Form\SearchRequestType;
|
|||
use AppBundle\Form\TtSearchRequestType;
|
||||
use AppBundle\Util;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\Query\Expr;
|
||||
use Gedmo\Tree\TreeListener;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
|
@ -29,7 +28,7 @@ class DefaultController extends Controller
|
|||
|
||||
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")
|
||||
*/
|
||||
|
|
@ -213,10 +136,6 @@ class DefaultController extends Controller
|
|||
if ($data['wellness'] ?? false) $ttUrl .= '&wellness=0';
|
||||
if ($data['typ'] ?? false) $ttUrl .= '&typ=0';
|
||||
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', [
|
||||
|
|
@ -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
|
||||
Für jeden Kindknoten
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue