dl/includes/UI.php
2020-06-17 20:49:28 +02:00

57 lines
1.5 KiB
PHP

<?php
abstract class UI {
abstract public function title();
abstract public function display();
protected function header() {
echo '<div class="header">';
echo '<h1><a href="?">De Lijn Reisinformatie lite</a></h1> ';
echo '<div class="subtitle">(niet-officieel)</div>';
echo '</div>';
}
protected function footer() {
echo '<div class="bottom-search">';
echo '<h2>Zoek iets anders</h2>';
echo '<div><form>';
echo '<label for="stop-searchfield">Zoek halte:</label> <input type="text" name="h" id="stop-searchfield"></input><input type="submit" value="Zoek"></input>';
// echo '</form></div><div><form>';
// echo '<label for="line-searchfield">Zoek lijn:</label> <input type="text" name="l" id="line-searchfield"></input><input type="submit" value="Zoek"></input>';
echo '</form></div>';
echo '</div>';
}
public function listify($array) {
$listString = '';
$length = count($array);
switch ($length) {
case 0:
return false;
break;
case 1:
return HTMLTools::makeSafeAndWrapBetter($array[0]);
break;
case 2:
return HTMLTools::makeSafeAndWrapBetter($array[0]) . ' <span class="deemphasize">en</span> ' . HTMLTools::makeSafeAndWrapBetter($array[1]);
break;
default:
return HTMLTools::makeSafeAndWrapBetter($array[0]) . '<span class="deemphasize">,</span> ' . HTMLTools::makeSafeAndWrapBetter($array[1]) . '<span class="deemphasize">...</span>';
break;
}
}
}
?>