* rel="nofollow" und target="_blank" für verschiedene externe Links

* Mindestpreis im Slider oben im Reiseprogramm nicht anzeigen, wenn keine Termine vorhanden sind
* Tripodo-Export

git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3315 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
uli 2017-03-14 08:01:57 +00:00
parent 42c55d44a1
commit b8ec81329a
17 changed files with 380 additions and 18 deletions

View file

@ -16,8 +16,8 @@
<div class="col-md-3 col-sm-12 col-xs-12">
<div class="social-footer text-right">
<a href="/ueber-uns" title="Über uns"><i class="fa fa-users"></i></a>
<a href="https://de-de.facebook.com/sterntours/" title="Facebook"><i class="fa fa-facebook"></i></a>
<a href="https://plus.google.com/+sterntours" title="Google"><i class="fa fa-google-plus"></i></a>
<a href="https://de-de.facebook.com/sterntours/" title="Facebook" target="_blank" rel="nofollow"><i class="fa fa-facebook"></i></a>
<a href="https://plus.google.com/+sterntours" title="Google" target="_blank" rel="nofollow"><i class="fa fa-google-plus"></i></a>
</div>
</div>
</div>

View file

@ -35,7 +35,7 @@
<li itemprop="name"><a href="#" title="" itemprop="">Kulturreisen</a></li>
<li itemprop="name">
<a href="https://www.stern-usedom.de" title="Usedom Ferienwohnungen" itemprop="url"
target="_blank"
target="_blank" rel="nofollow"
>
Usedom Ferienwohnungen
</a>

View file

@ -8,7 +8,7 @@
<div class="home-message text-center">
<div class="home-info-box">
<div id="eKomiSeal_default" class="eKomi-header">
<a id="eKomiSeal_BBBA4ECJTK29MA5_eKomiSeal_default" href="https://www.ekomi.de/bewertungen-stern-tours.html" title="eKomi - The Feedback Company: "><img border="0" src="https://connect.ekomi.de/seal/BBBA4ECJTK29MA5-70x70.png" alt="eKomi - The Feedback Company: "></a>
<a id="eKomiSeal_BBBA4ECJTK29MA5_eKomiSeal_default" href="https://www.ekomi.de/bewertungen-stern-tours.html" title="eKomi - The Feedback Company: " target="_blank" rel="nofollow"><img border="0" src="https://connect.ekomi.de/seal/BBBA4ECJTK29MA5-70x70.png" alt="eKomi - The Feedback Company: "></a>
</div>
<ul class="c4">
<li>Spezialist für Kulturreisen </li>

View file

@ -8,4 +8,4 @@
{% set image_url = '/bundles/app/images/no-picture.png' %}
{% set image_alt = 'Kein Vorschaubild vorhanden' %}
{% endif %}
<div class="img-background" alt="{{ image_alt }}" style="background-image: url({{ image_url }})"></div>
<div class="img-background" style="background-image: url({{ image_url }})"></div>

File diff suppressed because one or more lines are too long

View file

@ -19,10 +19,11 @@
********* SLIDER *********
#}
<div class="price-over-slider">
<div class="cprice">ab {{ travel_program.lowestPrice|number_format }} € p.P.</div>
</div>
{% if travel_program.lowestPrice > 0 %}
<div class="price-over-slider">
<div class="cprice">ab {{ travel_program.lowestPrice|number_format }} € p.P.</div>
</div>
{% endif %}
<div class="pull-right btn-over-slider">
<button type="button"

View file

@ -0,0 +1,119 @@
{# @var travel_program \AppBundle\Entity\TravelProgram #}
<travel>
<title>{{ travel_program.title }}</title>
<url>{{ base_url }}{{ travel_program.page.urlPath }}</url>
<locations>
{% for country in travel_program.countries %}
{% if country.destinations is empty %}
<location>
<country>{{ country.name }}</country>
</location>
{% else %}
{% for destination in country.destinations %}
<location>
<country>{{ country.name }}</country>
<region>{{ destination.name }}</region>
{# Actually <city> instead of <region>, but combination of city + country is not allowed #}
</location>
{% endfor %}
{% endif %}
{% endfor %}
</locations>
<types>
<type>Rundreisen</type>
<type>Kulturreisen</type>
<type>Tagesprogramm</type>
{% if travel_program.programCode in ['AEGYST001', 'AEGYST002', 'AEGYST003', 'AEGYST004', 'AEGYST005',
'AEGYST006', 'AEGYST008']
%}
<type>Kreuzfahrten</type>
{% endif %}
</types>
<accommodation>Hotel</accommodation>
<transport>Flugzeug</transport>
<duration>{{ travel_program.programDuration }}</duration>
<price_from>{{ travel_program.lowestPrice }}</price_from>
<description_short>{{ subtitle }}</description_short>
<min_traveler_count>{{ 5 in travel_program.countries.keys ? 2 : 1 }}</min_traveler_count>
<max_traveler_count>{{ 6 in travel_program.countries.keys ? 26 : 12 }}</max_traveler_count>
<description_long>
{% filter escape('html') %}
{{ html_description|raw }}
{% if included is not empty %}
<p><b>Leistungen inklusive</b></p>
<ul>
{% for travel_program_service in included|split('\n') %}
<li>{{ travel_program_service|raw }}</li>
{% endfor %}
</ul>
{% endif %}
{% if travel_program.excluded is not empty %}
<p><b>Nicht eingeschlossene / zubuchbare Leistungen</b></p>
<ul>
{% for option in travel_program.options %}
<li>
{{ option.name }}<br/>
<small>{{ option.description|raw }}</small>
</li>
{% endfor %}
</ul>
{% endif %}
{% if advices is not empty %}
<p><b>Hinweise</b></p>
<ul>
{% for travel_program_advice in advices|trim|split('\n') %}
<li>{{ travel_program_advice|raw }}</li>
{% endfor %}
</ul>
{% endif %}
{% endfilter %}
</description_long>
<images>
{% for image in travel_program.images %}
<image>{{ base_url }}/uploads/travel_program/{{ image.fileNameWithExtension }}</image>
{% endfor %}
</images>
<price_list>
{% for travel_date in travel_program.travelDates if 3 in travel_date.prices|keys %}
<row>
<start_date>{{ travel_date.start|date('Y-m-d') }}</start_date>
<end_date>{{ travel_date.end|date('Y-m-d') }}</end_date>
<status>{{ travel_date.status }}</status>
{% for price in travel_date.prices %}
{% if price.priceTypeId == 1 %}
<pricePerPerson>{{ price.effectiveDiscountPrice ?? price.effectivePrice }}</pricePerPerson>
{% elseif price.priceTypeId == 3 %}
<singleRoomPricePerPerson>{{ price.effectiveDiscountPrice ?? price.effectivePrice }}</singleRoomPricePerPerson>
{% endif %}
{% endfor %}
<excluded_services>
{% for departure in travel_date.departures %}
<service>
<name>
{{ departure.name|lower == 'eigenanreise' ? 'Eigenanreise' : ('Kosten Abflug ' ~ departure.name) }}
</name>
<price_single>{{ departure.extraCharge }}</price_single>
<type>departure</type>
<group>departure</group>
</service>
{% endfor %}
</excluded_services>
</row>
{% endfor %}
</price_list>
<included_services>
{% for travel_program_service in travel_program.included|split('\n') %}
<service>{{ travel_program_service }}</service>
{% endfor %}
</included_services>
<excluded_services>
{% for option in travel_program.options %}
<service>
<name>{{ option.name }}</name>
<description>{{ option.description }}</description>
<price_single>{{ option.price }}</price_single>
<price_children>{{ option.priceChildren }}</price_children>
</service>
{% endfor %}
</excluded_services>
</travel>

View file

@ -20,3 +20,9 @@ parameters:
st_cache_driver: array
locale: de_DE
base_url: https://www.sterntours.de
# Tripodo export
tripodo_host: ~
tripodo_user: ~
tripodo_pass: ~

28
trunk/composer.lock generated
View file

@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "2fbdc6452eb1c28efea2c75275631b11",
"content-hash": "8b127c12f0c4410e2d460ec2047f9b28",
"hash": "cafcb1290bf2f23646f9d7c96c217f14",
"content-hash": "602fab2a074b1ea2fe86866aa42ba50f",
"packages": [
{
"name": "behat/transliterator",
@ -1447,6 +1447,30 @@
],
"time": "2016-11-07 23:38:38"
},
{
"name": "pguardiario/phpuri",
"version": "1.0",
"source": {
"type": "git",
"url": "https://github.com/monkeysuffrage/phpuri.git",
"reference": "ad0a5ec033fe616cfef55578b9c7f2458be8fbfc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/monkeysuffrage/phpuri/zipball/ad0a5ec033fe616cfef55578b9c7f2458be8fbfc",
"reference": "ad0a5ec033fe616cfef55578b9c7f2458be8fbfc",
"shasum": ""
},
"type": "project",
"autoload": {
"files": [
"phpuri.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"description": "A php library for converting relative urls to absolute.",
"time": "2015-05-24 09:13:17"
},
{
"name": "psr/cache",
"version": "1.0.1",

View file

@ -0,0 +1,78 @@
<?php
/**
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
* @date 03/10/2017
*/
namespace AppBundle\Command;
use AppBundle\Util;
use Doctrine\ORM\EntityManager;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class TripodoExportCommand extends ContainerAwareCommand
{
protected function configure()
{
$this->setName('sterntours:export-tripodo');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var EntityManager $em */
$em = $this->getContainer()->get('doctrine')->getManager();
$regex = '/(\(\s*)?(((https?:\/\/)?www\.stern-?tours\.de[^\s\)]*)|([^\s]+@stern-?tours\.de)|(030\s*(-\s*)?700\s*94\s*100))(\s*\))?/';
$baseUrl = 'https://www.sterntours.de';
$xml = '<?xml version="1.0" encoding="UTF-8"?>' ."\n<travels>\n";
$travelPrograms = $em->getRepository('AppBundle:TravelProgram')->getProgramsToExport();
foreach ($travelPrograms as $travelProgram)
{
$em->getRepository('AppBundle:TravelPeriod')->getTrueTravelPeriods($travelProgram);
$vars = [
'travel_program' => $travelProgram,
'base_url' => $this->getContainer()->getParameter('base_url'),
];
// Link / E-Mail / Tel. zu Stern Tours entfernen
$vars['html_description'] = preg_replace($regex, '', $travelProgram->getHtmlDescription());
$vars['included'] = preg_replace($regex, '', $travelProgram->getIncluded());
$vars['advices'] = preg_replace($regex, '', $travelProgram->getAdvices());
$vars['included'] = Util::convertUrisInHtmlToAbsolute($vars['included'], $baseUrl);
$vars['advices'] = Util::convertUrisInHtmlToAbsolute($vars['advices'], $baseUrl);
$vars['subtitle'] = Util::convertUrisInHtmlToAbsolute($travelProgram->getSubtitle(), $baseUrl);
// Video-Link entfernen
$vars['html_description'] = preg_replace('/<p>\s*<a.*?href\s*="#".*?<\/a>\s*<\/p>/', '', $vars['html_description']);
// Überschriften hervorheben
$vars['html_description'] = preg_replace('/<h2>(.*?)<\/h2>/', '<p><b>\1</b></p>', $vars['html_description']);
$vars['html_description'] = preg_replace('/<h3>(.*?)<\/h3>/', '<p><b>\1</b></p>', $vars['html_description']);
$vars['html_description'] = Util::convertUrisInHtmlToAbsolute(
html_entity_decode($vars['html_description'], ENT_COMPAT, 'UTF-8'), $baseUrl);
$xml .= $this->getContainer()->get('templating')->render('default/tripodo.xml.twig', $vars);
}
$xml .= '</travels>';
file_put_contents('travels.xml', $xml);
return;
$conn = ftp_connect($this->getContainer()->getParameter('tripodo_host'));
if(ftp_login($conn, $this->getContainer()->getParameter('tripodo_user'),
$this->getContainer()->getParameter('tripodo_pass')))
{
$stream = fopen('travels.xml', 'r');
ftp_fput($conn, 'travels.xml', $stream, FTP_BINARY);
fclose($stream);
}
ftp_close($conn);
}
}

View file

@ -50,6 +50,11 @@ class TravelCountry
*/
private $programs;
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\TravelDestination", mappedBy="country")
*/
private $destinations;
/**
@ -181,4 +186,38 @@ class TravelCountry
}
/**
* Add destination
*
* @param \AppBundle\Entity\TravelDestination $destination
*
* @return TravelCountry
*/
public function addDestination(\AppBundle\Entity\TravelDestination $destination)
{
$this->destinations[] = $destination;
return $this;
}
/**
* Remove destination
*
* @param \AppBundle\Entity\TravelDestination $destination
*/
public function removeDestination(\AppBundle\Entity\TravelDestination $destination)
{
$this->destinations->removeElement($destination);
}
/**
* Get destinations
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getDestinations()
{
return $this->destinations;
}
}

View file

@ -6,6 +6,7 @@
namespace AppBundle\Entity;
use AppBundle\Util\DepartureUtil;
use Doctrine\Common\Collections\ArrayCollection;
/**
* TravelDate is a wrapper for TravelPeriod + start date and end date. This entity doesn't represent a database
@ -89,10 +90,16 @@ final class TravelDate
}
$this->start = $start;
$this->index = $index;
$this->prices = [];
foreach ($travelPeriod->getPrices() as $price)
{
$this->prices[$price->getPriceTypeId()] = clone $price;
}
}
else
{
$this->start = $travelPeriod->getStartDate();
$this->prices = $travelPeriod->getPrices();
}
$this->flightPeriod = $flightPeriod;
$this->travelProgram = $travelPeriod->getProgram();
@ -223,14 +230,14 @@ final class TravelDate
$profitMargin = $this->travelProgram->getProfitMargin() / 100 + 1;
}
$currencyFactor = $this->travelProgram->getNettoPricesInEuro() ? 1 : $this->currencyFactor;
foreach ($this->travelPeriod->getPrices() as $price)
foreach ($this->prices as &$price)
{
$price->setEffectivePrice(round(($flightPrice + $price->getPrice() * $currencyFactor) * $profitMargin));
$price->setEffectiveComfortPrice(round($price->getPriceComfort() * $currencyFactor * $profitMargin));
$price->setEffectiveChildPrice(round($price->getPriceChildren() * $currencyFactor * $profitMargin));
}
}
return $this->travelPeriod->getPrices();
return $this->prices;
}
public function getLowestPrice()

View file

@ -31,7 +31,7 @@ class TravelDestination
/**
* @var \AppBundle\Entity\TravelCountry
*
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelCountry")
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelCountry", inversedBy="destinations")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="country_id", referencedColumnName="id")
* })
@ -39,7 +39,6 @@ class TravelDestination
private $country;
/**
* Set name
*

View file

@ -317,6 +317,15 @@ class TravelProgram
*/
private $countries;
/**
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\TravelDestination")
* @ORM\JoinTable(name="travel_program_destination",
* joinColumns={@ORM\JoinColumn(name="program_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="destination_id", referencedColumnName="id")}
* )
*/
private $destinations;
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\TravelProgramImage", mappedBy="program")
*/
@ -1509,7 +1518,7 @@ class TravelProgram
/**
* Get options
*
* @return \Doctrine\Common\Collections\Collection
* @return TravelOption[]|\Doctrine\Common\Collections\Collection
*/
public function getOptions()
{
@ -1556,4 +1565,38 @@ class TravelProgram
{
return ($this->showMap ?? 0) > 0 && ($this->mapHtml or $this->mapHtml);
}
/**
* Add destination
*
* @param \AppBundle\Entity\TravelDestination $destination
*
* @return TravelProgram
*/
public function addDestination(\AppBundle\Entity\TravelDestination $destination)
{
$this->destinations[] = $destination;
return $this;
}
/**
* Remove destination
*
* @param \AppBundle\Entity\TravelDestination $destination
*/
public function removeDestination(\AppBundle\Entity\TravelDestination $destination)
{
$this->destinations->removeElement($destination);
}
/**
* Get destinations
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getDestinations()
{
return $this->destinations;
}
}

View file

@ -2,6 +2,8 @@
namespace AppBundle\Entity;
use Doctrine\ORM\Query\Expr;
/**
* TravelProgramRepository
*
@ -10,4 +12,26 @@ namespace AppBundle\Entity;
*/
class TravelProgramRepository extends \Doctrine\ORM\EntityRepository
{
/**
* @return TravelProgram[]
*/
public function getProgramsToExport()
{
return $this->createQueryBuilder('tp')
->innerJoin('tp.page', 'page')
->addSelect('page')
->leftJoin('tp.countries', 'country')
->addSelect('country')
->leftJoin('country.destinations', 'destination')
->addSelect('destination')
->leftJoin('tp.options', 'option')
->addSelect('option')
->leftJoin('tp.images', 'image', Expr\Join::WITH, 'image.type = 1')
->addSelect('image')
->where('tp.status = 1')
->andWhere('tp.programType = '. TravelProgram::ORGANIZED_PROGRAM_TYPE)
->getQuery()
->execute()
;
}
}

View file

@ -117,6 +117,11 @@ class KernelControllerListener
if ($node)
{
if ($node->getStatus() == 0)
{
throw new NotFoundHttpException('Inactive page');
}
$request->attributes->set('page', $node);
if ($restOfPath && $node->getTravelProgram() != null && (
@ -129,6 +134,10 @@ class KernelControllerListener
}
elseif ($node->getTravelProgram() != null)
{
if ($node->getTravelProgram()->getStatus() == 0)
{
throw new NotFoundHttpException('Inactive travel program');
}
$request->attributes->set('_controller', 'AppBundle:Cms:travelProgram');
}
else

View file

@ -40,6 +40,19 @@ class Util
return 'http' . (($_SERVER['SERVER_PORT'] == 443) ? 's://' : '://') .$_SERVER['HTTP_HOST'];
}
public static function convertUrisInHtmlToAbsolute($html, $baseUrl = null)
{
if ($baseUrl === null)
{
$baseUrl = self::getBaseUrl();
}
$phpUri = \phpUri::parse($baseUrl);
return preg_replace_callback('/(href|src)="((\\\\.|[^"\\\\])*)"/', function($matches) use ($phpUri) {
return $matches[1] .'="'. $phpUri->join($matches[2]) .'"';
}, $html);
}
public static function formatPrice($value)
{
return number_format($value, 2, ',', '.') .' €';