annotate herbs/index.php @ 84:7ec0ad742009

Rename directory.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 09 Mar 2015 10:11:04 +0200
parents info/index.php@3428ff77ff47
children 95781f84cbe7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
1 <?php
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
2 $terrainData = array(
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
3 array("light forests" , "lf", "f"),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
4 array("heavy forests" , "hf", "F"),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
5 array("plains" , "pl", "."),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
6 array("valleys" , "va", "v"),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
7 array("fields" , "fi", "y"),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
8 array("highlands" , "hg", "H"),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
9 array("hills" , "hi", "h"),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
10 array("desert" , "de", "d"),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
11 array("swamps" , "sw", "s"),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
12 array("abandoned ruins" , "ru", "#"),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
13 array("shores" , "sh", "z"),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
14 array("beaches" , "be", "b"),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
15 array("jungles" , "ju", "j"),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
16 array("tundra" , "tu", "t"),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
17 array("shallow water" , "wa", "S"),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
18 array("mountains" , "mo", "^"),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
19 array("badlands" , "ba", "x"),
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
20 );
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
21
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
22 $seasonData = array(
82
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
23 "spring" => 0x01,
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
24 "summer" => 0x02,
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
25 "autumn" => 0x04,
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
26 "winter" => 0x08,
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
27 );
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
28
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
29
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
30 function tlGetTerrainDataByName($name)
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
31 {
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
32 global $terrainData;
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
33 foreach ($terrainData as $rkey => $rdata)
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
34 {
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
35 if ($rdata[0] == $name)
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
36 return $rkey;
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
37 }
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
38
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
39 die("Unsupported terrain type '".$name."'.\n");
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
40 }
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
41
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
42
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
43 function tlGetTerrainDataByCode($val)
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
44 {
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
45 global $terrainData;
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
46 foreach ($terrainData as $rkey => $rdata)
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
47 {
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
48 if ($rdata[1] == $val)
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
49 return $rkey;
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
50 }
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
51
82
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
52 return -1;
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
53 }
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
54
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
55
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
56 function tlGetSeasonFromName($name, $fail = FALSE)
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
57 {
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
58 global $seasonData;
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
59 foreach ($seasonData as $rkey => $rval)
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
60 {
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
61 if ($rkey == $name)
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
62 return $rval;
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
63 }
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
64
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
65 if ($fail)
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
66 die("Invalid season name '".$name."'.\n");
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
67 else
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
68 return 0;
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
69 }
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
70
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
71
82
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
72 function tlGetSeasonsFromFlags($val)
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
73 {
82
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
74 $res = array();
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
75 global $seasonData;
82
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
76 foreach ($seasonData as $rkey => $rval)
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
77 {
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
78 if ($val & $rval)
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
79 $res[] = $rkey;
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
80 }
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
81
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
82 return $res;
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
83 }
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
84
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
85
82
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
86 //
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
87 // Parse data from CSV input
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
88 //
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
89 $herbData = array();
82
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
90 if (($fh = @fopen("herbs.csv", "r")) !== FALSE)
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
91 {
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
92 while ($data = fgetcsv($fh, 1000, ";"))
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
93 {
82
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
94 $sdata = 0;
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
95 foreach (preg_split("/, */", $data[1]) as $value)
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
96 {
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
97 if ($value != "")
82
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
98 $sdata |= tlGetSeasonFromName($value, TRUE);
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
99 }
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
100
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
101 $rdata = array();
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
102 foreach (preg_split("/, */", $data[2]) as $value)
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
103 {
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
104 if ($value != "")
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
105 $rdata[] = tlGetTerrainDataByName($value);
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
106 }
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
107
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
108 $herbData[] = array(
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
109 "name" => $data[0],
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
110 "seasons" => $sdata,
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
111 "terrains" => $rdata,
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
112 "pair" => $data[3],
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
113 "info" => $data[4],
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
114 );
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
115 }
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
116 fclose($fh);
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
117 }
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
118
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
119
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
120 ?>
0
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
121 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
122 <html>
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
123 <head>
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
124 <title>Some stupid plants</title>
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
125 <link href="style.css" title="compact" rel="stylesheet" type="text/css">
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
126 </head>
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
127 <body>
0
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
128 <table>
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
129 <caption>Some stupid plants</caption>
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
130 <tr>
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
131 <th>Plant name</th>
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
132 <th>Seasons</th>
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
133 <th>Terrain types</th>
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
134 <th>Herb pair</th>
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
135 <th>Information</th>
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
136 </tr>
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
137 <?php
82
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
138 $sefilter = FALSE;
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
139 $trfilter = FALSE;
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
140 if (isset($_GET["terrain"]))
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
141 {
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
142 $data = tlGetTerrainDataByCode(strtolower(trim($_GET["terrain"])));
82
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
143 if ($data >= 0)
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
144 $trfilter = $data;
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
145 }
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
146
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
147
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
148 if (isset($_GET["season"]))
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
149 {
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
150 $data = tlGetSeasonFromName(strtolower(trim($_GET["season"])));
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
151 if ($data > 0)
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
152 $sefilter = $data;
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
153 }
0
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
154
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
155 $row = 0;
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
156 foreach ($herbData as $data)
0
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
157 {
82
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
158 if ($trfilter !== FALSE && array_search($trfilter, $data["terrains"]) === FALSE)
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
159 continue;
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
160
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
161 if ($sefilter !== FALSE && ($data["seasons"] & $sefilter) == 0)
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
162 continue;
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
163
82
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
164 $seasons = array_map(function($x) {
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
165 return "<a href=\"?season=".$x."\">".$x."</a>";
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
166 }, tlGetSeasonsFromFlags($data["seasons"]));
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
167
0
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
168 $row++;
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
169 echo
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
170 "<tr class=\"".(($row % 2) ? "even" : "odd")."\">".
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
171 "<td>".$data["name"]."</td>".
82
3428ff77ff47 More work, adding filtering.
Matti Hamalainen <ccr@tnsp.org>
parents: 80
diff changeset
172 "<td>".implode(", ", $seasons)."</td>".
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
173 "<td>";
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
174
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
175 foreach ($data["terrains"] as $rkey)
0
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
176 {
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
177 $rdata = $terrainData[$rkey];
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
178 echo "<a href=\"?terrain=".$rdata[1]."\"><span class=\"".$rdata[1]."\">".$rdata[2]."</span></a>";
0
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
179 }
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
180
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
181 echo
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
182 "</td>".
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
183 "<td>".$data["pair"]."</td>".
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
184 "<td>".$data["info"]."</td>".
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
185 "</tr>\n";
0
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
186 }
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
187 ?>
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
188 </table>
a928c3c75c5f Initial import.
ccr@tnsp.org
parents:
diff changeset
189 </body>
78
03c54e5b60aa Improve this silly thing as well.
Matti Hamalainen <ccr@tnsp.org>
parents: 0
diff changeset
190 </html>