-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
86 lines (81 loc) · 3.3 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
include ('WSIVMissionsNextRequest.php');
$line = "RB";
$station = "Lozere";
$direction = "A";
if(isset($_GET['line'])) {
$line = $_GET['line'];
$station = "";
$direction = "*";
}
if(isset($_GET['station'])) {
$station = $_GET['station'];
}
if(isset($_GET['direction'])) {
$direction = $_GET['direction'];
}
$request = new WSIVMissionsNextRequest($line, $station, $direction);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Horaires RATP">
<meta http-equiv="refresh" content="5" >
<meta name="author" content="">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<title>Horaires RATP</title>
</head>
<body>
<h1 class="text-center"><samp>Prochains passages RATP</samp><br /><small>Powered by RATP's <a href="https://data.ratp.fr/explore/dataset/horaires-temps-reel/">Open Data API</a></small></h1>
<div class="container" id="prochains_passages">
<fieldset class="rer">
<div class="line_details">
<strong><?php echo $request->getLine(); ?></strong><br />
<strong>Station: </strong><span><?php echo $request->getStation(); ?></span><br />
<strong>Direction: </strong><span><?php echo $request->getDirection() ?></span>
</div>
<div class="date_time pull-right">
<strong>API time:</strong>
<span class="datetime"><?php
echo strftime("%d %B %Y, %H:%M:%S", $request->getTime());?></span><br />
<strong>Server time:</strong>
<span class="datetime"><?php
echo strftime("%d %B %Y, %H:%M:%S", time());?></span><br />
</div>
<div class="perturbations">
<?php
foreach($request->getPerturbations() as $perturbation) {
echo '<p class="perturbation">' . $perturbation->message->text . '</p>';
}
?>
</div>
<table class="table table-hover">
<thead>
<tr>
<th class="name">Nom</th>
<th class="terminus">Terminus</th>
<th class="passing_time">Heure de passage</th>
</tr>
</thead>
<tbody>
<?php
foreach($request->getMissions() as $mission) {
$id = isset($mission->id) ? $mission->id . ' ' : "";
?>
<tr>
<td class="name"><?php echo $id; ?></td>
<td class="terminus"><?php echo $mission->stations[1]->name; ?></td>
<td class="passing_time"><?php echo $mission->stationsMessages; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</fieldset>
</div>
</body>
</html>