-
Notifications
You must be signed in to change notification settings - Fork 10
/
lug-list.phtml
78 lines (68 loc) · 1.93 KB
/
lug-list.phtml
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
<?php
require_once ('utils.php');
# parsing della richiesta per individuare
if (isset ($_REQUEST["reg"])) {
if (array_key_exists ($_REQUEST["reg"], $elenco_regioni)) {
$regione = $elenco_regioni[$_REQUEST["reg"]];
$db_file = $_REQUEST["reg"];
$db_regione = file ('./db/'.$db_file.'.txt');
$title = 'LUG presenti nella regione ' . $regione;
}
else {
header("location: http://lugmap.linux.it/");
}
}
else {
$db_regione = array ();
foreach (glob ('./db/*.txt') as $db_file)
$db_regione = array_merge ($db_regione, file ($db_file));
sort ($db_regione);
$db_file = null;
$regione = 'Italia';
$title = 'LUG presenti in Italia';
}
lugheader ($title, $regione);
?>
<div id="center">
<a id="backLugMapLink" href="index.phtml">» torna alla LUGmap</a>
<table id="lugListTable">
<thead>
<tr>
<th>Provincia</th>
<th>Denominazione</th>
<th>Zona</th>
<th>Contatti</th>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="4"></td>
</tr>
</tfoot>
<tbody>
<?php while (list ($nriga, $linea) = each ($db_regione)): ?>
<?php # estrazione variabili
$campi = explode("|",$linea);
$provincia = $campi[0];
$denominazione = $campi[1];
$zona = $campi[2];
$contatti = $campi[3];
# stampa dei campi ?>
<tr class="row_<?php echo ($nriga % 2); ?>">
<td class="province"><?php echo $provincia ?></td>
<td><?php echo $denominazione ?></td>
<td><?php echo $zona ?></td>
<td class="contactUrl"><a href="<?php echo $contatti?>"><?php echo $contatti ?></a></td>
</tr>
<?php endwhile;?>
</tbody>
</table>
<?php if ($db_file != null) { ?>
<a id="csvLink" href="db/<?php echo $db_file ?>.txt">» Elenco in formato CSV</a>
<?php } else { ?>
<br />
<?php } ?>
</div>
<?php
lugfooter ();
?>