-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.php
62 lines (59 loc) · 2.44 KB
/
data.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
<?php
// Producten queried, load products for city
$cities = array('ingelmunster', 'roeselare', 'kortrijk', 'gent', 'destelbergen');
foreach ($cities as $city) {
$productstring = file_get_contents($base . "data/" . $city . ".json");
$products = json_decode($productstring);
?>
<h1>Producten voor<?php echo $city; ?></h1>
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<h3 class="box-title">Overzicht Producten</h3>
<div class="box-tools">
<div class="input-group" style="width: 150px;">
<input type="text" name="table_search" class="form-control input-sm pull-right" placeholder="Search"/>
<div class="input-group-btn">
<button class="btn btn-sm btn-default"><i class="fa fa-search"></i></button>
</div>
</div>
</div>
</div><!-- /.box-header -->
<div class="box-body table-responsive no-padding">
<table class="table table-hover">
<tr>
<th>ID</th>
<th>Title</th>
<th>Productencatalogus</th>
<th>Productencatalogus ID</th>
<th>Organisatie</th>
</tr>
<?php foreach ($products as $product) {
$product = (array) $product;
print('<tr>');
// get ID
$pid = (preg_match("/\/([a-zA-Z0-9]+)$/", $product['?product'], $matches)) ? $matches[1] : $product['?product'];
print('<td><a href="' . $product['?product'] . '" target="_blank">' . $pid . '</a></td>');
// Get title
print('<td>' . $product['?title'] . '</td>');
// Get productencatalogus
if (array_key_exists('?type', $product)) {
print('<td><span class="label label-success">Ja</span></td>');
} else {
print('<td><span class="label label-danger">Nee</span></td>');
}
// Get productencatalogus ID
$pcid = (preg_match("/\/(\d+)$/", $product['?type'], $matches)) ? $matches[1] : "";
print('<td><a href="' . $product['?type'] . '" target="_blank">' . $pcid . '</a></td>');
print('<tr>');
}
?>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div>
</div>
<?php
}
?>