/[projects]/tog-php/html_display.php
ViewVC logotype

Contents of /tog-php/html_display.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 300 - (show annotations) (download)
Wed Sep 2 13:49:30 2009 UTC (14 years, 8 months ago) by torben
File size: 1536 byte(s)
Initial import


1 <?
2 header("Content-type: text/html; charset=ISO-8859-1");
3
4 header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
5 header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
6
7 require("function.php");
8
9 function printField($field)
10 {
11 if (trim($field) != "")
12 echo "<td>" . $field . "</td>\n";
13 else
14 echo "<td>&nbsp;</td>\n";
15 }
16
17 $stationcode = $_GET["stationcode"];
18 $stationname = $_GET["stationname"];
19 $type = $_GET["type"];
20
21 $advanced = $_GET["advanced"];
22
23 if ($advanced == "")
24 $advanced = 0;
25 $nextadvanced = ($advanced+1) % 2;
26
27 $result = tog($type, $stationcode,$stationname);
28
29
30 echo "<html><body>Station: $stationname<br>";
31 echo "<a href='html_display.php?type=$type&stationcode=$stationcode&stationname=$stationname&advanced=$nextadvanced'>Switch view</a>";
32 echo "<table border=1>\n";
33
34 echo "<tr><th>Time</th><th>Updated</th>";
35 if ($advanced)
36 {
37 echo "<th>Trainnumber</th>";
38 }
39 echo "<th>Destination</th>";
40 if ($advanced)
41 {
42 echo "<th>Origin</th><th>Location</th>";
43 }
44 echo "<th>Status</th><th>Note</th></tr>\n";
45
46 for ($i = 0; $i< sizeof($result); $i++)
47 {
48 echo "<tr>";
49
50 printField($result[$i][0]); //Time
51 printField( lastUpdateString($result[$i][1]) ); //Updated
52 if ($advanced)
53 {
54 printField($result[$i][2]); //Trainnumber
55 }
56 printField($result[$i][3]); //Destination
57 if ($advanced)
58 {
59 printField($result[$i][4]); //Origin
60 printField($result[$i][5]); //Location
61 }
62 printField($result[$i][6]); //Status
63 printField($result[$i][7]); //Note
64
65 echo "</tr>\n\n";
66
67 }
68 echo "</table></body></html>\n";
69
70 ?>

  ViewVC Help
Powered by ViewVC 1.1.20