-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtable.php
78 lines (65 loc) · 3.43 KB
/
table.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
75
76
77
78
<?php include 'header.php';?>
<!--<a href="edit.php?kid=0" class="btn btn-success" role="button">Neue Korporation anlegen</a><br/><br/>-->
<a onclick="filter()" id="filterBtn" class="btn btn-success" role="button">Filter anwenden</a><br/><br/>
<table id=findex class="table table-hover table-responsive">
<script src="scripts/filter.js"></script>
<tr class="active">
<th>Name<br/><input type="text" id="filterName" placeholder="Filter..."></th>
<th>Ort<br/><input type="text" id="filterOrt" placeholder="Filter..."></th>
<?php
if (isset($_GET['aktiv']) && strcmp($_GET["aktiv"],"on")==0)
echo "<th>Aktiv?<br/><input type=\"checkbox\" checked=\"checked\" onclick=\"window.location.assign('table.php?aktiv=off')\"/></th>";
else
echo "<th>Aktiv?<br/><input type=\"checkbox\" onclick=\"window.location.assign('table.php?aktiv=on')\"/></th>";
?>
<th>Gründung</th>
<th>Wahlspruch<br/><input type="text" id="filterWahlspruch" placeholder="Filter..."></th>
<th>Aufgegangen in</th>
<!--<th>Verband</th>-->
<!--<th>Region</th>-->
<th>Farben</th>
</tr>
<?php
$mysqli = new mysqli($sccdbhost, $sccdbuser, $sccdbpassword, $sccdbname);
$mysqli->set_charset("utf8");
/* check connection */
if ($mysqli->connect_errno) {
die('Connect failed: '.$mysqli->connect_error.'\n');
}
$sql = "SELECT korporation.id as kid, korporation.name as name, ort.id as oid, ort.name as ortname, ort.region as region, korporation.aktiv as aktiv, korporation.gruendungstag as gtag, korporation.gruendungszeitraum as gzeitraum, korporation.wahlspruch as wahlspruch, korporation.aufgegangenin_text as fusion, verband.name as verbandname, band.farbe1 as farbe1, band.farbe2 as farbe2, band.farbe3 as farbe3, band.farbe4 as farbe4, band.farbe5 as farbe5, band.farbe6 as farbe6, band.farbe7 as farbe7, band.farbe8 as farbe8, band.farbe9 as farbe9, band.farbe10 as farbe10 FROM korporation LEFT JOIN ort ON korporation.ort=ort.id LEFT JOIN verband on korporation.verband=verband.id LEFT JOIN band on band.korporation=korporation.id WHERE korporation.aktiv=".((isset($_GET['aktiv']) && strcmp($_GET["aktiv"],"on")==0)?"1":"0");
if (isset($_GET['farbe1']) && is_numeric($_GET['farbe1'])) {
$sql = $sql." AND band.farbe1=".$_GET['farbe1'];
for($i=2;$i<11;++$i) {
if (isset($_GET['farbe'.$i]) && is_numeric($_GET['farbe'.$i]) && $_GET['farbe'.$i]>0) {
$sql = $sql." AND band.farbe".$i."=".$_GET['farbe'.$i];
}
}
}
if (isset($_GET['oid']) && is_numeric($_GET['oid'])) {
$sql = $sql." AND korporation.ort=".$_GET['oid'];
}
$sql = $sql." ORDER BY name";
$statement = $mysqli->prepare($sql);
$statement->execute();
$result = $statement->get_result();
while($row = $result->fetch_object()) {
echo "<tr class='eintrag'>";
echo "<td><a href=details.php?kid=".$row->kid.">".$row->name."</a></td>";
echo "<td><a href=table.php?aktiv=on&oid=".$row->oid.">".$row->ortname."</a></td>";
//echo "<td>".$row->region."</td>";
echo "<td>".($row->aktiv?"Ja":"Nein")."</td>";
echo "<td>".$row->gtag."".$row->gzeitraum."</td>";
echo "<td>".$row->wahlspruch."</td>";
echo "<td>".$row->fusion."</td>";
//echo "<td>".$row->verbandname."</td>";
$band = get_band($row);
echo "<td><table><tr>";
foreach ($band as $farb) {
echo "<div style='min-width:100px;''><td bgcolor=".$farb.">__</td></div>";
}
echo "</tr></td></table>";
echo "</tr>";
}
?>
</table>
<?php include 'footer.php'; ?>