* Import von Jugendreisen (www.jugendreisen-spezialist.de)
* CMS-template "sunstar" als Destinationsübersicht für importierte Jugendreisen * Weitere "rel=nofollow target=_blank * target="_blank" beachten, wenn Boxen per JS click-Event verlinkt werden * https://schema.org statt http * meta itemprop=url auf https://www.sterntours.de geändert * Startseiten-Content geändert * "Rote" (nicht verfügbare) Termine auf Suchergebnisseite und Reiseprogrammseiten ausblenden * Behoben: Fehlermeldung, wenn Start- und Enddatum im Suchfilter nicht eingetragen werden git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3320 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
parent
1ef1f765f6
commit
077163634e
15 changed files with 510 additions and 18 deletions
69
trunk/src/AppBundle/Command/SunstarImportCommand.php
Normal file
69
trunk/src/AppBundle/Command/SunstarImportCommand.php
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
||||
* @date 03/24/2017
|
||||
*/
|
||||
|
||||
namespace AppBundle\Command;
|
||||
|
||||
use AppBundle\Entity\SunstarTravelProgram;
|
||||
use AppBundle\Util;
|
||||
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
class SunstarImportCommand extends ContainerAwareCommand
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
$this->setName('sterntours:import-sunstar');
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
/** @var \Doctrine\ORM\EntityManager $em */
|
||||
$em = $this->getContainer()->get('doctrine')->getManager();
|
||||
$conn = $em->getConnection();
|
||||
|
||||
$r = Util::httpGet('https://www.jugendreisen-spezialist.de/sterntours-export/index.php', [
|
||||
'Authorization: Basic c3Rlcm50b3VyczpvbW1DVm5OY2lXTDRSMUhw'
|
||||
]);
|
||||
$tpDataEntries = json_decode($r['content'], true);
|
||||
$conn->beginTransaction();
|
||||
try
|
||||
{
|
||||
$metadata = $em->getClassMetaData('AppBundle:SunstarTravelProgram');
|
||||
$metadata->setIdGeneratorType(\Doctrine\ORM\Mapping\ClassMetadata::GENERATOR_TYPE_NONE);
|
||||
$metadata->setIdGenerator(new \Doctrine\ORM\Id\AssignedGenerator());
|
||||
|
||||
$conn->query('SET FOREIGN_KEY_CHECKS=0');
|
||||
$conn->query('DELETE FROM '. $metadata->getTableName());
|
||||
$conn->query('SET FOREIGN_KEY_CHECKS=1');
|
||||
$i = 0;
|
||||
foreach ($tpDataEntries as $tpData)
|
||||
{
|
||||
++$i;
|
||||
$sunTp = new SunstarTravelProgram();
|
||||
$sunTp->setId($i);
|
||||
$sunTp->setTitle($tpData['title']);
|
||||
$sunTp->setDescription($tpData['description']);
|
||||
$sunTp->setDestination($tpData['destination_name']);
|
||||
$sunTp->setUrl($tpData['url']);
|
||||
$sunTp->setImageUrl('https://www.jugendreisen-spezialist.de'. $tpData['image_url']);
|
||||
$sunTp->setDuration($tpData['duration']);
|
||||
$sunTp->setMinimumPrice($tpData['minimum_price']);
|
||||
$sunTp->setMinimumAge($tpData['minimum_age']);
|
||||
$sunTp->setMaximumAge($tpData['maximum_age']);
|
||||
|
||||
$em->persist($sunTp);
|
||||
$em->flush();
|
||||
}
|
||||
$conn->commit();
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$conn->rollBack();
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -8,6 +8,7 @@ namespace AppBundle\Controller;
|
|||
|
||||
|
||||
use AppBundle\Entity\Page;
|
||||
use AppBundle\Entity\SunstarTravelProgram;
|
||||
use AppBundle\Form\TtSearchRequestType;
|
||||
use AppBundle\Listener\KernelControllerListener;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
|
|
@ -121,4 +122,16 @@ class CmsController extends Controller
|
|||
'travel_program' => $page->getTravelProgram(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function sunstarAction(Page $page)
|
||||
{
|
||||
/** @var SunstarTravelProgram[] $sunstarTravelPrograms */
|
||||
$sunstarTravelPrograms = $this->getDoctrine()->getRepository('AppBundle:SunstarTravelProgram')
|
||||
->findBy(['destination' => $page->getCmsSettings()]);
|
||||
|
||||
return $this->render('default/pages/cms/sunstar.html.twig', [
|
||||
'page' => $page,
|
||||
'sunstar_travel_programs' => $sunstarTravelPrograms
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
@ -52,6 +52,14 @@ class DefaultController extends Controller
|
|||
public function searchAction(Request $request)
|
||||
{
|
||||
$form = $this->createForm(SearchRequestType::class);
|
||||
if (empty($request->query->get('b')))
|
||||
{
|
||||
$request->query->set('b', (new \DateTime('+5 day'))->format('d.m.Y'));
|
||||
}
|
||||
if (empty($request->query->get('e')))
|
||||
{
|
||||
$request->query->set('e', (new \DateTime('+19 day'))->format('d.m.Y'));
|
||||
}
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid())
|
||||
|
|
|
|||
|
|
@ -270,6 +270,10 @@ class Page
|
|||
*/
|
||||
protected $boxDiscount;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=true)
|
||||
*/
|
||||
protected $cmsSettings;
|
||||
|
||||
/**
|
||||
* Set owner
|
||||
|
|
@ -1215,4 +1219,28 @@ class Page
|
|||
} while ($node = $node->getParent());
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set cmsSettings
|
||||
*
|
||||
* @param string $cmsSettings
|
||||
*
|
||||
* @return Page
|
||||
*/
|
||||
public function setCmsSettings($cmsSettings)
|
||||
{
|
||||
$this->cmsSettings = $cmsSettings;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cmsSettings
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCmsSettings()
|
||||
{
|
||||
return $this->cmsSettings;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
306
trunk/src/AppBundle/Entity/SunstarTravelProgram.php
Normal file
306
trunk/src/AppBundle/Entity/SunstarTravelProgram.php
Normal file
|
|
@ -0,0 +1,306 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Ulrich Hecht <ulrich.hecht@hecht-software.de>
|
||||
* @date 03/24/2017
|
||||
*/
|
||||
|
||||
namespace AppBundle\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* Redirect
|
||||
*
|
||||
* @ORM\Table
|
||||
* @ORM\Entity
|
||||
*/
|
||||
class SunstarTravelProgram
|
||||
{
|
||||
/**
|
||||
* @var integer
|
||||
*
|
||||
* @ORM\Column(name="id", type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue(strategy="IDENTITY")
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=true)
|
||||
*/
|
||||
protected $description;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=255, nullable=true)
|
||||
*/
|
||||
protected $destination;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=200, nullable=true)
|
||||
*/
|
||||
protected $url;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=200, nullable=true)
|
||||
*/
|
||||
protected $imageUrl;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="string", length=20, nullable=true)
|
||||
*/
|
||||
protected $duration;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="float", nullable=true)
|
||||
*/
|
||||
protected $minimumPrice;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", nullable=true)
|
||||
*/
|
||||
protected $minimumAge;
|
||||
|
||||
/**
|
||||
* @ORM\Column(type="integer", nullable=true)
|
||||
*/
|
||||
protected $maximumAge;
|
||||
|
||||
/**
|
||||
* Get id
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
*/
|
||||
public function setId(int $id)
|
||||
{
|
||||
$this->id = $id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set title
|
||||
*
|
||||
* @param string $title
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set description
|
||||
*
|
||||
* @param string $description
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set destination
|
||||
*
|
||||
* @param string $destination
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setDestination($destination)
|
||||
{
|
||||
$this->destination = $destination;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get destination
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDestination()
|
||||
{
|
||||
return $this->destination;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set url
|
||||
*
|
||||
* @param string $url
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setUrl($url)
|
||||
{
|
||||
$this->url = $url;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set imageUrl
|
||||
*
|
||||
* @param string $imageUrl
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setImageUrl($imageUrl)
|
||||
{
|
||||
$this->imageUrl = $imageUrl;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get imageUrl
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getImageUrl()
|
||||
{
|
||||
return $this->imageUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set duration
|
||||
*
|
||||
* @param integer $duration
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setDuration($duration)
|
||||
{
|
||||
$this->duration = $duration;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get duration
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getDuration()
|
||||
{
|
||||
return $this->duration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set minimumPrice
|
||||
*
|
||||
* @param float $minimumPrice
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setMinimumPrice($minimumPrice)
|
||||
{
|
||||
$this->minimumPrice = $minimumPrice;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get minimumPrice
|
||||
*
|
||||
* @return float
|
||||
*/
|
||||
public function getMinimumPrice()
|
||||
{
|
||||
return $this->minimumPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set minimumAge
|
||||
*
|
||||
* @param integer $minimumAge
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setMinimumAge($minimumAge)
|
||||
{
|
||||
$this->minimumAge = $minimumAge;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get minimumAge
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getMinimumAge()
|
||||
{
|
||||
return $this->minimumAge;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set maximumAge
|
||||
*
|
||||
* @param integer $maximumAge
|
||||
*
|
||||
* @return SunstarTravelProgram
|
||||
*/
|
||||
public function setMaximumAge($maximumAge)
|
||||
{
|
||||
$this->maximumAge = $maximumAge;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get maximumAge
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getMaximumAge()
|
||||
{
|
||||
return $this->maximumAge;
|
||||
}
|
||||
}
|
||||
|
|
@ -141,7 +141,7 @@ class TravelPeriod
|
|||
/**
|
||||
* Set status
|
||||
*
|
||||
* @param boolean $status
|
||||
* @param integer $status
|
||||
*
|
||||
* @return TravelPeriod
|
||||
*/
|
||||
|
|
@ -155,7 +155,7 @@ class TravelPeriod
|
|||
/**
|
||||
* Get status
|
||||
*
|
||||
* @return boolean
|
||||
* @return integer
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -428,7 +428,16 @@ jQuery(document).ready(function($) {
|
|||
=============================================== */
|
||||
|
||||
$('.get-box-link').click(function(){
|
||||
location.href = $(this).find('.is-box-link').attr('href');
|
||||
var url = $(this).find('.is-box-link').attr('href');
|
||||
if (el$.attr('target') === '_blank')
|
||||
{
|
||||
window.open(url);
|
||||
}
|
||||
else
|
||||
{
|
||||
location.href = url;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
/* function resize_box (){
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ class Util
|
|||
$ret['success'] = false;
|
||||
}
|
||||
|
||||
if (isset($kernel))
|
||||
if (isset($kernel) && $ret['status_code'] >= 300)
|
||||
{
|
||||
$logger = $kernel->getContainer()->get('logger');
|
||||
$logger->warn('HTTP request to \''. $url .'\' with server response code '. $ret['status_code']);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue