-
Notifications
You must be signed in to change notification settings - Fork 12
/
tag.php
40 lines (38 loc) · 1.28 KB
/
tag.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
<?php
include('include/db.php');
if(array_key_exists("id", $_GET)) {
$s = intval($_GET['id']);
} else {
die('No id');
}
$sql1 = 'SELECT * FROM '.db('tags').' WHERE `id` = '.$s;
$req1 = $mysqli->query($sql1) or die('Erreur SQL !<br />'.$sql1.'<br />'.$mysqli->error);
$t = $req1->fetch_assoc();
$title = 'Tag - '.$t['tag'];
include('include/header.php');
echo "<h2>$title</h2>\n";
$chants = array();
$sql1 = 'SELECT * FROM '.db('chant_tags').' WHERE `tag_id` = '.$s;
$req1 = $mysqli->query($sql1) or die('Erreur SQL !<br />'.$sql1.'<br />'.$mysqli->error);
while($ct = $req1->fetch_assoc()) {
$sql2 = 'SELECT * FROM '.db('chants').' WHERE id = '.$ct['chant_id'];
$req2 = $mysqli->query($sql2) or die('Erreur SQL !<br />'.$sql2.'<br />'.$mysqli->error);
$chants[] = $req2->fetch_assoc();
}
if(count($chants)) {
usort($chants, "custom_cmp");
}
echo "<ul class=\"incipit\">\n";
foreach($chants as $c) {
$incipit = $c['incipit']?format_incipit($c['incipit']):'░░'.$c['id'].'░░';
echo '<li class="usage-marker '.$c['office-part'].'">';
if($c['gabc'] > '') {
echo '<a href="chant.php?id='.$c['id'].'">'.$incipit."</a>";
} else {
echo '<span class="todo">'.$incipit.'</span>';
}
echo ' <span class="version">('.$c['version'].")</span></li>\n";
}
echo "</ul>\n";
include('include/footer.php');
?>