git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3283 f459cee4-fb09-11de-96c3-f9c5f16c3c76

This commit is contained in:
uli 2016-12-17 10:11:28 +00:00
parent 75a065758f
commit 7422f06e90
261 changed files with 83347 additions and 0 deletions

View file

@ -0,0 +1,71 @@
<?php
/**
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
* @date 12/08/2016
*/
namespace AppBundle\Controller;
use AppBundle\Entity\BookingRequest;
use AppBundle\Entity\BreadcrumbEntry;
use AppBundle\Entity\Page;
use AppBundle\Form\BookingRequestType;
use AppBundle\Util;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class BookingController extends Controller
{
public function indexAction(Page $travelProgramPage, Request $request)
{
$travelProgram = $travelProgramPage->getTravelProgram();
if (!$request->query->has('nr'))
{
return $this->redirect($travelProgramPage->getUrlPath());
}
$this->getDoctrine()->getRepository('AppBundle:TravelPeriod')->getTrueTravelPeriods($travelProgram);
// #TODO Consider changing key of travel dates
foreach ($travelProgram->getTravelDates() as $curTravelDate)
{
if ($curTravelDate->getName() == $request->query->get('nr'))
{
$travelDate = $curTravelDate;
break;
}
}
if (!isset($travelDate))
{
throw $this->createNotFoundException();
}
$form = $this->createForm(BookingRequestType::class, null, [
'travel_date' => $travelDate,
'travel_program' => $travelProgram
]);
//$form->submit([]);
$priceTypeById = $this->getDoctrine()->getRepository('AppBundle:TravelPeriodPriceType')->findAllIndexedById();
$breadcrumbEntries = Util::createBreadcrumb($travelProgramPage);
$breadcrumbEntries[] = new BreadcrumbEntry('Buchen', $travelProgramPage->getUrlPath() .'/buchen');
return $this->render('default/pages/booking.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
'page' => $travelProgramPage,
'travel_program' => $travelProgram,
'travel_date' => $travelDate,
'form' => $form->createView(),
'price_type_by_id' => $priceTypeById,
'breadcrumb_entries' => $breadcrumbEntries,
]);
}
public function calculatePrice()
{
}
}