-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
90 lines (74 loc) · 2.54 KB
/
Copy pathindex.php
File metadata and controls
90 lines (74 loc) · 2.54 KB
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
87
88
89
90
<!DOCTYPE html>
<html lang="el">
<head>
<meta charset="UTF-8">
<title>Καλλικράτης ΟΤΑ Διάρθρωση</title>
<style>
body {
font-family: sans-serif;
margin: 20px;
background-color: #f9f9f9;
}
.region {
background-color: #e3e3e3;
padding: 10px;
margin-top: 20px;
border-radius: 6px;
}
summary {
font-weight: bold;
cursor: pointer;
}
.unit, .municipality, .municipal-unit, .community {
margin-left: 20px;
margin-top: 5px;
background: white;
padding: 10px;
border: 1px solid #ddd;
border-radius: 4px;
}
.info {
font-size: 0.9em;
color: #333;
margin-top: 4px;
}
</style>
</head>
<body>
<h1>Καλλικράτης Ιεραρχία ΟΤΑ</h1>
<?php
require __DIR__.'/vendor/autoload.php';
use Kallikratis\Repository\KallikratisRepository;
function escape($value) {
return htmlspecialchars($value, ENT_QUOTES, 'UTF-8');
}
$repo = new KallikratisRepository();
foreach ($repo->allRegions() as $region) {
echo "<div class='region'>";
echo "<details open><summary>Περιφέρεια: " . escape($region->name) . " (ID: {$region->id})</summary>";
foreach ($region->getRegionalUnits() as $ru) {
echo "<div class='unit'>";
echo "<details><summary>Π.Ε.: " . escape($ru->name) . " (ID: {$ru->id})</summary>";
foreach ($ru->getMunicipalities() as $municipality) {
echo "<div class='municipality'>";
echo "<details><summary>Δήμος: " . escape($municipality->name) . " (ID: {$municipality->id})</summary>";
foreach ($municipality->getMunicipalUnits() as $munUnit) {
echo "<div class='municipal-unit'>";
echo "<details><summary>Δημοτική Ενότητα: " . escape($munUnit->name) . " (ID: {$munUnit->id})";
echo "</summary>";
foreach ($munUnit->getCommunities() as $community) {
echo "<div class='community'>";
echo "<strong>" . $community->id. ' - ' . escape($community->name) . " - " . $community->type->value . " </strong><br>";
echo "</div>";
}
echo "</details></div>";
}
echo "</details></div>";
}
echo "</details></div>";
}
echo "</details></div>";
}
?>
</body>
</html>