EU Reiserecht - Booking

git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3419 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
adametz 2018-06-30 12:44:31 +00:00
parent 8fd6f63403
commit 2360290f06
25 changed files with 1089 additions and 229 deletions

View file

@ -771,6 +771,57 @@ class TravelProgram
return $this->htmlDescription;
}
/**
* @param \DateTime $startDate
* @return array
*/
// '<h2> X Tag / Anreise ... : Programm </h2>';
public function getTravelProgramDates(\DateTime $startDate)
{
$lines = array();
$count = 0;
if($this->htmlDescription){
$text = $this->htmlDescription;
$regex = '#<h2>(.*?)</h2>#';
preg_match_all($regex, $text, $matches);
foreach ($matches[1] as $val){
if(strpos($val, ':')){
$v = explode(':', $val);
$int = (int) filter_var($v[0], FILTER_SANITIZE_NUMBER_INT);
if($int) {
$lines[$int] = array('count'=> $count, 'day' => trim($v[1]), 'date' => $startDate->format('d.m.Y'));
$startDate->modify('+1 day');
$count++;
}
}
}
}
if($this->classDescription){
$text = $this->classDescription;
//standard //komfort
$regex = "'<ul class=\"standard\">(.*?)</ul>'si";
preg_match_all($regex, $text, $matches);
if(isset($matches[1][0]) && strpos($matches[1][0], '</li>')){
$text = $matches[1][0];
$regex = '#<li>(.*?)</li>#';
preg_match_all($regex, $text, $matches);
foreach ($matches[1] as $val){
if(strpos($val, ':')){
$v = explode(':', $val);
$int = (int) filter_var($v[0], FILTER_SANITIZE_NUMBER_INT);
if($int && isset($lines[$int])) {
$lines[$int]['night'] = trim($v[1]);
}
}
}
}
}
return $lines;
}
/**
* Set inSlider
*