forked from ifgi-webteam/Campusplan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wohnheime.php
74 lines (52 loc) · 1.52 KB
/
wohnheime.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
<?php
require_once("functions.php");
checkCache();
getHead();
?>
<div class="container">
<div class="row-fluid">
<h1>Wohnheime</h1>
</div>
<?php
if(isset($_GET['lang'])){
getDorms($_GET['lang']);
} else {
getDorms();
}
?>
</div><!--/container -->
<?php
getFoot();
// loads all dorms in $lang (currently supported: de, en (TODO!))
function getDorms($lang = "de"){
$fbs = sparql_get("
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix lodum: <http://vocab.lodum.de/helper/>
SELECT DISTINCT * WHERE {
?fb a lodum:StudentHousing ;
foaf:name ?name;
FILTER langMatches(lang(?name),'".$lang."') .
} ORDER BY ?name
");
if( !isset($fbs) ) {
print '<p class="alert alert-error">Fehler beim Abruf der Wohnheimdaten.</p>';
}else{
// only start if there are any results:
if($fbs->results->bindings){
echo '<div class="row-fluid">
<div class="btn-group btn-group-vertical">';
foreach ($fbs->results->bindings as $fb) {
// TODO: English!
$name = $fb->name->value;
$name = str_replace("Wohnanlage ", "<span class='hidden-phone'>Wohnanlage </span>", $name);
$name = str_replace("Studentenwohnheim ", "<span class='hidden-phone'>Studentenwohnheim </span>", $name);
$name = str_replace("Internationales", "Int.", $name);
$url = $fb->fb->value;
echo '<a class="btn btn-large btn-stacked internal" href="orgdetails.php?org_uri='.$url.'">'.$name.'</a>';
}
echo '</div></div>';
}
}
}
flushCache();
?>