87 lines
1.9 KiB
PHP
87 lines
1.9 KiB
PHP
|
<?php
|
||
|
|
||
|
class ResultsInterface extends UI {
|
||
|
|
||
|
private $query;
|
||
|
private $stops;
|
||
|
|
||
|
public function __construct($searchQuery, $searchResults) {
|
||
|
|
||
|
$this->query = $searchQuery;
|
||
|
$this->stops = $searchResults['haltes'];
|
||
|
|
||
|
}
|
||
|
|
||
|
public function title () {
|
||
|
|
||
|
return 'Zoekresultaten';
|
||
|
|
||
|
}
|
||
|
|
||
|
public function display() {
|
||
|
|
||
|
parent::header();
|
||
|
|
||
|
echo '<form class="titlesearch">';
|
||
|
|
||
|
echo '<h2>Zoeken naar halte <input type="text" name="h" value="' .
|
||
|
HTMLTools::makeSafe($this->query) .
|
||
|
'" id="stop-searchfield"></input><input type="submit" value="Zoek"></input></h2>';
|
||
|
|
||
|
echo '</form>';
|
||
|
|
||
|
if (isset($this->stops[0])) {
|
||
|
|
||
|
echo '<div class="search-results">';
|
||
|
|
||
|
foreach ($this->stops as $stop) {
|
||
|
|
||
|
echo '<a href="?h=' . rawurlencode($stop['halteNummer']) . '" class="result stop">';
|
||
|
|
||
|
echo '<span class="name">' . $stop['omschrijvingLang'] . '</span> ';
|
||
|
echo '<span class="ref">(' . $stop['halteNummer'] . ')</span>';
|
||
|
if (isset($stop['bestemmingen'][0])) {
|
||
|
echo '<span class="dest"><span class="deemphasize">richting</span> ' . parent::listify($stop['bestemmingen']) . '</span>';
|
||
|
} else {
|
||
|
echo '<span class="dest deemphasize">richting onbekend</span>';
|
||
|
}
|
||
|
echo '<span class="lines">';
|
||
|
|
||
|
if (isset($stop['lijnen'][0])) {
|
||
|
|
||
|
foreach ($stop['lijnen'] as $line) {
|
||
|
echo PTLine::htmlElement(
|
||
|
$line['kleurAchterGrond'],
|
||
|
$line['kleurAchterGrondRand'],
|
||
|
$line['kleurVoorGrond'],
|
||
|
$line['lijnNummerPubliek'],
|
||
|
'small');
|
||
|
echo ' ';
|
||
|
}
|
||
|
|
||
|
} else {
|
||
|
echo '<span class="not-served-msg">niet bediend</span>';
|
||
|
}
|
||
|
|
||
|
echo '</span>';
|
||
|
|
||
|
echo '</a>';
|
||
|
|
||
|
}
|
||
|
|
||
|
echo '</div>';
|
||
|
|
||
|
} else {
|
||
|
|
||
|
echo '<div class="user-error">Geen resultaten</div>';
|
||
|
|
||
|
}
|
||
|
|
||
|
parent::footer();
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
?>
|