-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathco_books.php
56 lines (50 loc) · 1.73 KB
/
co_books.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
<?php
$content['episode'][0] = "";
$content['episode'][1] = "";
$content['title'] = 'Alle Bücher';
$content['episode'][0] .= '
<h2>Alle Bücher:</h2>
<table class="handwritten">
<tr>
<th>Buch</th>
<th>Kapitel</th>
<th>Lizenzen</th>
</tr>';
$sql_query = "SELECT album, license FROM `episodes` ".($db_conntection['hidden']?" ":"WHERE `hidden` = '0'")." ;";
$sql_result = mysql_query($sql_query);
$book_shelf = array();
while ($row = mysql_fetch_object($sql_result)) {
if (!array_key_exists($row -> album,$book_shelf)) { $book_shelf[$row -> album] = array("title" => "title","episodes" => 0,"licenses" => array()); }
$book_shelf[$row -> album]['title'] = $row -> album;
$book_shelf[$row -> album]['episodes']++;
$book_shelf[$row -> album]['licenses'][(int)$row -> license] = true;
}
foreach ($book_shelf as $book_data) {
$content['episode'][0] .= '
<tr>
<td><a href="./?b='.urlencode($book_data['title']).'">'.$book_data['title'].'</a></td>
<td>'.$book_data['episodes'].'</td>
<td>';
if (count($book_data['licenses']) > 1) {
$content['episode'][0] .= '
<ul>';
}
foreach ($book_data['licenses'] as $key => $value) {
if ($key == 0) {
//alle Rechte vorbehalten
} else if ($key == 1) {
$content['episode'][0] .= '
'.(count($book_data['licenses']) > 1?"<li>":"").'<a href="http://creativecommons.org/licenses/by/3.0/de/" title="Creative Commons Namensnennung 3.0 Deutschland Lizenz."><img src="./images/lic_ccby.svg" alt="ceative commons by" />'.(count($book_data['licenses']) > 1?"</li>":"");
}
}
if (count($book_data['licenses']) > 1) {
$content['episode'][0] .= '
</ul>';
}
$content['episode'][0] .= '
</td>
</tr>';
}
$content['episode'][0] .= '
</table>';
?>