0 ? '+' : '-') . $str; return $str . ($delay > 0 ? ' te laat' : ' te vroeg'); } class StopInfoboard extends Infoboard { private $found = false; private $stop; private $numberOfLines; private $currentTime; private $lines; private $disturbed = false; private $allLinesDisturbed = false; private $disturbances = false; private $notServed = false; public function __construct ($stopRef, $numberOfLines=50) { global $timezone; $this->currentTime = new DateTime('now', $timezone); $this->stop = new PTStop(intval($stopRef)); $this->numberOfLines = $numberOfLines; $result = $this->stop->getImminentVehicles($numberOfLines); $this->detours = $result['halteOmleidingen']; $this->disturbed = $result['dienstRegelingVerstoord']; $this->allLinesDisturbed = $result['alleLijnenVerstoord']; $this->disturbances = $result['storingen']; $this->notServed = $result['nietBediend']; $this->lines = $result['lijnen']; } public function title() { $name = $this->stop->getFullName(); if ($name) return $name; return 'Halte'; } public function display() { global $timezone; parent::header(); if (!$this->stop->getExists()) { echo '
De halte met haltenummer ' . HTMLTools::makeSafe($this->stop->getRef()) . ' werd niet gevonden.
'; parent::footer(); return; } echo '

' . HTMLTools::makeSafe($this->stop->getFullName()) . '

'; echo '
'; echo '
Haltenummer ' . HTMLTools::makeSafe($this->stop->getRef()) . '
'; echo '
Info van ' . $this->currentTime->format('H:i') . ':' . $this->currentTime->format('s') . '
'; echo '
'; if (!empty($this->disturbances)) { echo '

Storingen en mededelingen

'; } if (!empty($this->detours)) { echo '

Omleidingen

'; } if ($this->notServed) { echo '
Deze halte wordt momenteel niet bediend.
'; } elseif ($this->allLinesDisturbed) { echo '
De dienstregeling van alle lijnen aan deze halte is verstoord.
'; } elseif ($this->disturbed) { echo '
De dienstregeling van sommige lijnen aan deze halte is verstoord.
'; } if (empty($this->lines)) { echo '
Geen doorkomsten in de nabije toekomst
'; } else { $anyNotRealtime = false; echo ''; $evenrow = true; usort($this->lines, compareDoorkomsten); foreach ($this->lines as $line) { $scheduledTime = intdiv($line['vertrekTheoretischeTijdstip'], 1000); $realtimeTime = intdiv($line['vertrekRealtimeTijdstip'], 1000); if ($realtimeTime == 0) $realtimeTime = null; $realtime = !is_null($realtimeTime); if (!$realtime) $anyNotRealtime = true; $timeDT = new DateTime('now', $timezone); if ($realtime) { $timeDT->setTimestamp($realtimeTime); } else { $timeDT->setTimestamp($scheduledTime); } $delay = $realtime ? $realtimeTime - $scheduledTime : 0; $canceled = in_array('DELETED', $line['predictionStatussen']) || in_array('CANCELLED', $line['predictionStatussen']); echo ''; // Line number echo ' '; // Destination echo ''; // Delay $class = "delay" . ($canceled ? ' canceled' : ($delay < 0 ? ' early' : '')); echo ''; // Departure time echo ''; echo ''; echo ''; echo ''; $evenrow = !$evenrow; } echo '
' . PTLine::htmlElement( $line['kleurAchterGrond'], $line['kleurAchterGrondRand'], $line['kleurVoorGrond'], $line['lijnNummerPubliek']) . ''; if ($canceled) echo ''; echo HTMLTools::makeSafeAndWrapBetter($line['bestemming']); if ($canceled) echo ''; echo ''; if ($canceled) { echo 'Rijdt niet'; } elseif (abs($delay) >= 60) { echo formatDelay($delay) . ':'; } echo ''; if ($canceled) echo ''; elseif (!$realtime) { echo static::$theoreticalBefore; } echo $timeDT->format("H"); if ($canceled) echo ''; echo ''; if ($canceled) echo ''; echo ':'; if ($canceled) echo ''; echo ''; if ($canceled) echo ''; echo $timeDT->format("i"); if ($realtime && intval($timeDT->format('s')) !== 0) { echo ':' . $timeDT->format('s') . ''; } if ($canceled) echo ''; elseif (!$realtime) { echo static::$theoreticalAfter; } echo '
'; if ($anyNotRealtime) { echo '
' . static::$theoreticalBefore . 'Theoretische vertrektijd' . static::$theoreticalAfter . '
'; } } $coords = $this->stop->getLocation(); echo 'Locatie van halte'; parent::footer(); } } ?>