-
-
- Kulturreisen -
- Usedom Ferienwohnungen + +
- Kulturreisen +
- + + Usedom Ferienwohnungen + + +
-
-
-
- Ägypten Rundreisen -
- Nilkreuzfahrten -
- Ägypten Badeurlaub -
- Individuelle Ägyptenreisen -
- Ägypten Gruppenreisen -
- Ägypten Lastminute -
- Nasserseekreuzfahrt -
- Ägypten Klassenfahrt -
- Info Ägypten Spezialis -
- Ägypten Landesinformationen -
- Ägypten Erfahrungen -
- Ägypten Reiseführer -
- Ägypten Reisemagazin + + {# + {% for nav_page in nav_pages if nav_page.country is empty %} +
- + + {{ nav_page.title }} + + + {% endfor %} + #} +
- + + Gruppenreisen + + +
- + + Jugendreisen + + +
- + + Reiseversicherung + + +
- + + Reiseführer + + +
- + + Reiseführer + + +
- + + Reisemagazin + +
-
- {% for nav_page in nav_pages %}
+ {% for nav_page in nav_pages if nav_page.country is not empty %}
{# @var nav_page \AppBundle\Entity\Page #}
-
+ +++++++ {% if child_page.boxStar is not empty %} ++ {% if child_page.travelProgram is not empty and child_page.travelProgram.previewImage is not empty %} +{{ child_page.boxStar|raw }}+ {% endif %} + {% if child_page.travelProgram is not empty %} +ab {{ child_page.travelProgram.lowestPrice|number_format }} € p.P.+ {% endif %} + {% if child_page.boxDiscount is not empty %} +{{ child_page.boxDiscount|raw }}+ {% endif %} +
+ {% else %} +
+ {% endif %}
+ ++ + {{ child_page.title }} + +{{ child_page.title }}+{{ child_page.description }}
+
+ {% if show_nav_sidebar_widget ?? true and page is defined %} {# TODO #}
+ {% if nav_sidebar_widget_block is empty %}
+ {{ render(controller('AppBundle:Default:navSidebarWidget', {page: page})) }}
+ {% else %}
+ {{ nav_sidebar_widget_block|raw }}
+ {% endif %}
+ {% endif %}
+
TOP bewertet
diff --git a/trunk/app/Resources/views/default/components/sidebar/navSidebarWidget.html.twig b/trunk/app/Resources/views/default/components/sidebar/navSidebarWidget.html.twig
new file mode 100644
index 00000000..48cc3480
--- /dev/null
+++ b/trunk/app/Resources/views/default/components/sidebar/navSidebarWidget.html.twig
@@ -0,0 +1,36 @@
+
diff --git a/trunk/app/Resources/views/default/pages/travelProgramOverview.html.twig b/trunk/app/Resources/views/default/pages/travelProgramOverview.html.twig
index af5a4262..30e6842a 100644
--- a/trunk/app/Resources/views/default/pages/travelProgramOverview.html.twig
+++ b/trunk/app/Resources/views/default/pages/travelProgramOverview.html.twig
@@ -7,34 +7,9 @@
{#{% for i in 0..page.children|length//3 %}#}
+
+
\ No newline at end of file
diff --git a/trunk/app/Resources/views/default/pages/overview.html.twig b/trunk/app/Resources/views/default/pages/overview.html.twig
index dffe68cf..71e9addb 100644
--- a/trunk/app/Resources/views/default/pages/overview.html.twig
+++ b/trunk/app/Resources/views/default/pages/overview.html.twig
@@ -1,5 +1,9 @@
{% extends 'base.html.twig' %}
+{% block nav_sidebar_widget %}
+ {% include 'default/components/sidebar/navSidebarWidget.html.twig' %}
+{% endblock %}
+
{% block body %}
+ Reiseziele
+
+
+
+
+{{ page.pagetitle ?? page.title }}
@@ -7,22 +11,9 @@
{#{% for i in 0..page.children|length//3 %}#}
{% for child_page in page.children if child_page.status == 1 %}
-
-
+
+ {% include 'default/components/pageBox.html.twig' %}
+
{% endfor %}
-
-
-
{% for child_page in child_pages if child_page.status == 1 and child_page.travelProgram is defined %}
- {# @var child_page \AppBundle\Entity\Page #}
-
diff --git a/trunk/src/AppBundle/Controller/BookingController.php b/trunk/src/AppBundle/Controller/BookingController.php
index f01c557c..92d2d979 100644
--- a/trunk/src/AppBundle/Controller/BookingController.php
+++ b/trunk/src/AppBundle/Controller/BookingController.php
@@ -80,7 +80,7 @@ class BookingController extends Controller
$bookingPriceInfo = [];
$totalPrice = $this->calculatePrice($travelDate, $bookingRequest, $htmlSummary, $bookingPriceInfo);
- if ($action == 'buchen')
+ if ($action == '/buchen')
{
$breadcrumbEntries = Util::createBreadcrumb($travelProgramPage);
$breadcrumbEntries[] = new BreadcrumbEntry('Buchen', $travelProgramPage->getUrlPath() .'/buchen');
@@ -119,8 +119,7 @@ class BookingController extends Controller
$this->renderView('default/email/bookingServiceEmail.txt.twig', [
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
'crm_url' => $crmBookingUrl .'/edit',
- 'travel_program_url' => 'http' . (($_SERVER['SERVER_PORT'] == 443) ? 's://' : '://') .
- $_SERVER['HTTP_HOST'] . $travelProgramPage->getUrlPath(),
+ 'travel_program_url' => Util::getBaseUrl() . $travelProgramPage->getUrlPath(),
'booking_request' => $bookingRequest,
'booking_price_info' => $bookingPriceInfo,
'travel_date' => $travelDate,
@@ -150,7 +149,7 @@ class BookingController extends Controller
'total_price' => $totalPrice
]);
}
- elseif ($action == 'berechne-gesamtpreis')
+ elseif ($action == '/berechne-gesamtpreis')
{
return $this->render('default/components/booking/summary.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
diff --git a/trunk/src/AppBundle/Controller/DefaultController.php b/trunk/src/AppBundle/Controller/DefaultController.php
index d8ebd932..a75f1042 100644
--- a/trunk/src/AppBundle/Controller/DefaultController.php
+++ b/trunk/src/AppBundle/Controller/DefaultController.php
@@ -56,8 +56,14 @@ class DefaultController extends Controller
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
+ 'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
+ 'page' => $page,
+
+ // #WORKAROUND Special navigation logic here adapted from the old website: Don't show child entries
+ // #TODO Only applies at level 0
+ 'nav_pages' => $page->getChildren(),
+ 'nav_child_pages' => [],
+ 'nav_open_node' => null
]);
}
@@ -126,7 +132,7 @@ class DefaultController extends Controller
->where('page.status > 0')
->andWhere('page.template = \'overview\'')
->andWhere('page.lvl = 0')
- ->orderBy('page.title,childPage.title')
+ ->orderBy('page.lft,page.title,childPage.lft,childPage.title')
->getQuery()
->execute()
;
@@ -144,6 +150,39 @@ class DefaultController extends Controller
]);
}
+ 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())
+ {
+ $view['nav_pages'] = $pageRepo->getSiblings($page);
+ $view['nav_child_pages'] = $pageRepo->getChildren($page);
+ $view['nav_open_node'] = $page;
+ }
+ else
+ {
+ $parent = $page->getParent();
+ if ($parent)
+ {
+ $view['nav_pages'] = $pageRepo->getSiblings($parent);
+ $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);
+ }
+
/*
Suche Kindknoten
Für jeden Kindknoten
@@ -178,11 +217,23 @@ class DefaultController extends Controller
}
$em->beginTransaction();
+
+ // Add missing owner relation for catalog root pages (e.g. children of 'aegypten-reisen')
+ $em->getConnection()->executeUpdate('UPDATE page SET owner = 47 WHERE catalog_id = 3 AND owner = 0');
+ $em->getConnection()->executeUpdate('UPDATE page SET owner = 66 WHERE catalog_id = 6 AND owner = 0');
+ $em->getConnection()->executeUpdate('UPDATE page SET owner = 2803 WHERE catalog_id = 14 AND owner = 0');
+
$lft = 0;
$this->createTree(0, $lft, 0);
- $em->commit();
$em->flush();
+ // Reset the owner field to avoid problems in the old website
+ $em->getConnection()->executeUpdate('UPDATE page SET owner = 0 WHERE parent_id = 47 AND catalog_id = 3');
+ $em->getConnection()->executeUpdate('UPDATE page SET owner = 0 WHERE parent_id = 66 AND catalog_id = 6');
+ $em->getConnection()->executeUpdate('UPDATE page SET owner = 0 WHERE parent_id = 2803 AND catalog_id = 14');
+
+ $em->commit();
+
die("DONE.");
}
@@ -196,7 +247,8 @@ class DefaultController extends Controller
{
$qb->orWhere('p.owner IS NULL');
}
- $qb->orderBy('p.title');
+ $qb->orderBy('p.order');
+ $qb->addOrderBy('p.title');
$pages = $qb->getQuery()->execute();
foreach ($pages as $page)
{
diff --git a/trunk/src/AppBundle/Entity/Page.php b/trunk/src/AppBundle/Entity/Page.php
index c23dae26..c49f70fa 100644
--- a/trunk/src/AppBundle/Entity/Page.php
+++ b/trunk/src/AppBundle/Entity/Page.php
@@ -160,6 +160,13 @@ class Page
*/
private $content;
+ /**
+ * @ORM\Column(type="text", length=65535, nullable=true)
+ *
+ * @todo Remove this field as soon as the new page is launched and instead use "content" again
+ */
+ protected $contentNew;
+
/**
* @var string
*
@@ -238,10 +245,30 @@ class Page
*/
protected $template;
+ /**
+ * @ORM\Column(type="string", length=200, nullable=true, unique=true)
+ */
+ protected $realUrlPath;
+
+ /**
+ * @ORM\Column(type="string", length=65535, nullable=true)
+ */
+ protected $boxBody;
+
+ /**
+ * @ORM\Column(type="string", length=200, nullable=true)
+ */
+ protected $boxImageUrl;
+
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
- protected $previewImageUrl;
+ protected $boxStar;
+
+ /**
+ * @ORM\Column(type="string", length=255, nullable=true)
+ */
+ protected $boxDiscount;
/**
@@ -553,7 +580,31 @@ class Page
*/
public function getContent()
{
- return $this->content;
+ return $this->contentNew ?? $this->content;
+ }
+
+ /**
+ * Set contentNew
+ *
+ * @param string $contentNew
+ *
+ * @return Page
+ */
+ public function setContentNew($contentNew)
+ {
+ $this->contentNew = $contentNew;
+
+ return $this;
+ }
+
+ /**
+ * Get contentNew
+ *
+ * @return string
+ */
+ public function getContentNew()
+ {
+ return $this->contentNew;
}
/**
@@ -991,30 +1042,6 @@ class Page
return $this->template;
}
- /**
- * Set previewImageUrl
- *
- * @param string $previewImageUrl
- *
- * @return Page
- */
- public function setPreviewImageUrl($previewImageUrl)
- {
- $this->previewImageUrl = $previewImageUrl;
-
- return $this;
- }
-
- /**
- * Get previewImageUrl
- *
- * @return string
- */
- public function getPreviewImageUrl()
- {
- return $this->previewImageUrl;
- }
-
/**
* Set travelProgram
*
@@ -1039,8 +1066,29 @@ class Page
return $this->travelProgram;
}
+ /**
+ * @param string|null $realUrlPath
+ *
+ * @return Page
+ */
+ public function setRealUrlPath($realUrlPath)
+ {
+ $this->realUrlPath = $realUrlPath;
+ return $this;
+ }
+
+ public function getRealUrlPath()
+ {
+ return $this->realUrlPath;
+ }
+
public function getUrlPath()
{
+ if ($this->realUrlPath !== null)
+ {
+ return $this->realUrlPath;
+ }
+
$urlParts = [];
$page = $this;
do
@@ -1050,4 +1098,105 @@ class Page
} while ($page !== null);
return '/'. implode('/', array_reverse($urlParts));
}
+
+ /**
+ * Set boxBody
+ *
+ * @param string $boxBody
+ *
+ * @return Page
+ */
+ public function setBoxBody($boxBody)
+ {
+ $this->boxBody = $boxBody;
+
+ return $this;
+ }
+
+ /**
+ * Get boxBody
+ *
+ * @return string
+ */
+ public function getBoxBody()
+ {
+ return $this->boxBody;
+ }
+
+ /**
+ * Set boxImageUrl
+ *
+ * @param string $boxImageUrl
+ *
+ * @return Page
+ */
+ public function setBoxImageUrl($boxImageUrl)
+ {
+ $this->boxImageUrl = $boxImageUrl;
+
+ return $this;
+ }
+
+ /**
+ * Get boxImageUrl
+ *
+ * @return string
+ */
+ public function getBoxImageUrl()
+ {
+ return $this->boxImageUrl;
+ }
+
+ /**
+ * Set boxStar
+ *
+ * @param string $boxStar
+ *
+ * @return Page
+ */
+ public function setBoxStar($boxStar)
+ {
+ $this->boxStar = $boxStar;
+
+ return $this;
+ }
+
+ /**
+ * Get boxStar
+ *
+ * @return string
+ */
+ public function getBoxStar()
+ {
+ return $this->boxStar;
+ }
+
+ /**
+ * Set boxDiscount
+ *
+ * @param string $boxDiscount
+ *
+ * @return Page
+ */
+ public function setBoxDiscount($boxDiscount)
+ {
+ $this->boxDiscount = $boxDiscount;
+
+ return $this;
+ }
+
+ /**
+ * Get boxDiscount
+ *
+ * @return string
+ */
+ public function getBoxDiscount()
+ {
+ return $this->boxDiscount;
+ }
+
+ public function getHasChildren()
+ {
+ return $this->lft != null && $this->rgt != null && $this->rgt - $this->lft > 1;
+ }
}
diff --git a/trunk/src/AppBundle/Entity/PageRepository.php b/trunk/src/AppBundle/Entity/PageRepository.php
index ca67c344..33e0c315 100644
--- a/trunk/src/AppBundle/Entity/PageRepository.php
+++ b/trunk/src/AppBundle/Entity/PageRepository.php
@@ -40,4 +40,25 @@ class PageRepository extends NestedTreeRepository
}
return $pages;
}
+
+ /**
+ * @param Page $page
+ *
+ * @return Page[]|\Doctrine\Common\Collections\Collection
+ */
+ public function getSiblings(Page $page)
+ {
+ $parent = $page->getParent();
+ if (!$parent)
+ {
+ // #TODO Return all root pages
+ return [];
+ }
+ $siblings = $parent->getChildren();
+ foreach ($siblings as &$sibling)
+ {
+ $sibling->setParent($parent);
+ }
+ return $siblings;
+ }
}
diff --git a/trunk/src/AppBundle/Entity/Redirect.php b/trunk/src/AppBundle/Entity/Redirect.php
new file mode 100644
index 00000000..77265bfe
--- /dev/null
+++ b/trunk/src/AppBundle/Entity/Redirect.php
@@ -0,0 +1,96 @@
+
+ * @date 02/15/2017
+ */
+
+namespace AppBundle\Entity;
+
+use Doctrine\ORM\Mapping as ORM;
+
+/**
+ * Redirect
+ *
+ * @ORM\Table(name="redirect")
+ * @ORM\Entity(repositoryClass="AppBundle\Entity\RedirectRepository")
+ */
+class Redirect
+{
+ /**
+ * @var integer
+ *
+ * @ORM\Column(name="id", type="integer")
+ * @ORM\Id
+ * @ORM\GeneratedValue(strategy="IDENTITY")
+ */
+ private $id;
+
+ /**
+ * @ORM\Column(type="string", length=200, nullable=false, unique=true)
+ */
+ private $sourceUrlPath;
+
+ /**
+ * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Page")
+ * @ORM\JoinColumn(name="page_id", referencedColumnName="id", nullable=false)
+ */
+ protected $page;
+
+ /**
+ * Get id
+ *
+ * @return integer
+ */
+ public function getId()
+ {
+ return $this->id;
+ }
+
+ /**
+ * Set sourceUrlPath
+ *
+ * @param string $sourceUrlPath
+ *
+ * @return Redirect
+ */
+ public function setSourceUrlPath($sourceUrlPath)
+ {
+ $this->sourceUrlPath = $sourceUrlPath;
+
+ return $this;
+ }
+
+ /**
+ * Get sourceUrlPath
+ *
+ * @return string
+ */
+ public function getSourceUrlPath()
+ {
+ return $this->sourceUrlPath;
+ }
+
+ /**
+ * Set page
+ *
+ * @param \AppBundle\Entity\Page $page
+ *
+ * @return Redirect
+ */
+ public function setPage(\AppBundle\Entity\Page $page = null)
+ {
+ $this->page = $page;
+
+ return $this;
+ }
+
+ /**
+ * Get page
+ *
+ * @return \AppBundle\Entity\Page
+ */
+ public function getPage()
+ {
+ return $this->page;
+ }
+}
diff --git a/trunk/src/AppBundle/Entity/RedirectRepository.php b/trunk/src/AppBundle/Entity/RedirectRepository.php
new file mode 100644
index 00000000..88b75e19
--- /dev/null
+++ b/trunk/src/AppBundle/Entity/RedirectRepository.php
@@ -0,0 +1,13 @@
+em = $entityManager;
$this->controllerResolver = $controllerResolver;
+ $this->router = $router;
}
public function onKernelController(FilterControllerEvent $event)
@@ -32,36 +38,89 @@ class KernelControllerListener
{
$repo = $this->em->getRepository('AppBundle:Page');
$path = preg_replace('/^\/?(.*?)\/?$/', '$1', $request->getPathInfo());
- $pathArray = explode('/', $path);
/** @var Page $node */
$node = null;
- for ($i = 0; $i < count($pathArray); ++$i)
+
+ // Try to find by url path. It's possible that the path consists of two parts:
+ // - the beginning part represents a node
+ // - the ending part represents a handler
+ // e.g. /path/to/travel/program/buchen ("buchen" is the handler part)
+ $pathArray = explode('/', $path);
+ $restOfPath = '';
+ $curPath = $path;
+ while (!empty($pathArray))
{
- $qb = $repo->createQueryBuilder('p');
- $qb->where($qb->expr()->eq('p.lvl', $i));
- $qb->andWhere($qb->expr()->eq('p.slug', ':slug'));
- $qb->setParameter('slug', $pathArray[$i]);
- if ($node != null)
- {
- $qb->andWhere($qb->expr()->between('p.lft', $node->getLft(), $node->getRgt()));
- }
- $qb->setMaxResults(1);
- $node = $qb->getQuery()->getOneOrNullResult();
- if (!$node)
+ $node = $repo->findOneBy(['realUrlPath' => '/'. $curPath]);
+ if ($node)
{
break;
}
- if (isset($parentNode))
- {
- // Avoid database calls to parent later
- $node->setParent($parentNode);
- }
- $parentNode = $node;
+ $restOfPath = '/'. array_pop($pathArray) . $restOfPath;
+ $curPath = implode('/', $pathArray);
}
+
+ if (!$node)
+ {
+ // Now try to find a page by tracing a page node path using the page nodes' slugs
+
+ $pathArray = explode('/', $path);
+ $i = 0;
+ while (!empty($pathArray))
+ {
+ $slug = array_shift($pathArray);
+ $restOfPath = '/'. implode('/', $pathArray);
+
+ $qb = $repo->createQueryBuilder('p');
+ $qb->where($qb->expr()->eq('p.lvl', $i));
+ $qb->andWhere($qb->expr()->eq('p.slug', ':slug'));
+ $qb->setParameter('slug', $slug);
+ if ($node != null)
+ {
+ $qb->andWhere($qb->expr()->between('p.lft', $node->getLft(), $node->getRgt()));
+ }
+ $qb->setMaxResults(1);
+ $childNode = $qb->getQuery()->getOneOrNullResult();
+ if (!$childNode)
+ {
+ break;
+ }
+ if ($node)
+ {
+ // Avoid database calls to parent later
+ $childNode->setParent($node);
+ }
+ $node = $childNode;
+ ++$i;
+ }
+ }
+
+ if (!$node)
+ {
+ // Search for a redirect entry
+ $redirect = $this->em->getRepository('AppBundle:Redirect')->findOneBy(['sourceUrlPath' => '/'. $path]);
+ if ($redirect)
+ {
+ $redirectUrl = $redirect->getPage()->getUrlPath();
+ $event->setController(function() use ($redirectUrl) {
+ return new RedirectResponse($redirectUrl, 301);
+ });
+ return;
+ }
+ }
+
if ($node)
{
$request->attributes->set('page', $node);
- if ($node->getTravelProgram() != null)
+
+ if ($restOfPath && $node->getTravelProgram() != null && (
+ $restOfPath == '/buchen' || $restOfPath == '/berechne-gesamtpreis'))
+ {
+ // Special case: Booking actions
+ $request->attributes->set('travelProgramPage', $node);
+ $request->attributes->set('action', $restOfPath);
+ $request->attributes->set('_controller', 'AppBundle:Booking:index');
+ }
+ elseif ($node->getTravelProgram() != null)
{
$request->attributes->set('_controller', 'AppBundle:Default:cmsTravelProgram');
}
@@ -71,13 +130,6 @@ class KernelControllerListener
$request->attributes->set('_controller', 'AppBundle:Default:'. $handler);
}
}
- elseif (isset($parentNode) && $parentNode->getTravelProgram() != null && (
- $pathArray[$i] == 'buchen' || $pathArray[$i] == 'berechne-gesamtpreis'))
- {
- $request->attributes->set('travelProgramPage', $parentNode);
- $request->attributes->set('action', $pathArray[$i]);
- $request->attributes->set('_controller', 'AppBundle:Booking:index');
- }
else
{
return;
diff --git a/trunk/src/AppBundle/Util.php b/trunk/src/AppBundle/Util.php
index 2bf09dd5..95dc3ede 100644
--- a/trunk/src/AppBundle/Util.php
+++ b/trunk/src/AppBundle/Util.php
@@ -35,6 +35,11 @@ class Util
$prop->setValue($entity, $collection);
}
+ public static function getBaseUrl()
+ {
+ return 'http' . (($_SERVER['SERVER_PORT'] == 443) ? 's://' : '://') .$_SERVER['HTTP_HOST'];
+ }
+
public static function formatPrice($value)
{
return number_format($value, 2, ',', '.') .' €';
@@ -46,7 +51,6 @@ class Util
global $kernel;
$ch = curl_init();
- $headerList = array();
//self::buildHttpQueryForCurl($headers, $headerList); //?
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_URL, $url);
-
+
+ {% include 'default/components/pageBox.html.twig' %}
+
{% endfor %}
-
-
-
-
-
- {% endif %}
-
-
- {% if child_page.travelProgram.id > 0 and child_page.travelProgram.id <= 10 %}
-
- {% if child_page.travelProgram.previewImage is defined %}
- {{ child_page.travelProgram.id }}
- {% endif %}
- ab {{ child_page.travelProgram.lowestPrice|number_format }} € p.P.
- Frühbucherrabatt
-
-
-
- {{ child_page.title }}
-
- {{ child_page.title }}
- {{ child_page.description }}
-
-