-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollection.php
More file actions
66 lines (60 loc) · 2 KB
/
Copy pathcollection.php
File metadata and controls
66 lines (60 loc) · 2 KB
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
<?php if(empty($_GET['coll'])) {header('Location: index.php');}
require_once('structure/header.php');
require_once('treatment/pdo.php');
$coll = $_GET['coll'];
switch($coll) {
case 'coc':
echo '<h2>Collection cinématographique</h2>';
break;
case 'col':
echo '<h2>Collection littéraire</h2>';
break;
case 'com':
echo '<h2>Collection musicale</h2>';
break;
case 'cov':
echo '<h2>Collection vidéoludique</h2>';
break;
}
$alphabet = '#ABCDEFGHIJKLMNOPQRSTUVWXYZ';
for($k = 0; $k < strlen($alphabet); $k++) { ?>
<section id="<?php echo $k == 0 ? 'Other' : $alphabet[$k]; ?>">
<h3>- <?php echo $alphabet[$k]; ?> -</h3>
<?php if($k == 0) {
$regex = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
$select = "SELECT id_oeuvre, title, sort_title, franchise FROM oeuvre
WHERE collection = ? AND INSTR(?, SUBSTRING(sort_title, 1, 1)) = 0 AND media_link IS NOT NULL
ORDER BY sort_title;";
$stmt = $connexion->prepare($select);
$stmt->bindParam(1, $coll);
$stmt->bindParam(2, $regex);
$stmt->execute();
} else {
$letter = $alphabet[$k];
$select = "SELECT id_oeuvre, title, sort_title, franchise FROM oeuvre
WHERE collection = ? AND SUBSTRING(sort_title, 1, 1) = ? AND media_link IS NOT NULL
ORDER BY sort_title;";
$stmt = $connexion->prepare($select);
$stmt->bindParam(1, $coll);
$stmt->bindParam(2, $letter);
$stmt->execute();
}
if(!empty($stmt)) { ?>
<ul>
<?php $franchise = '';
foreach($stmt as $row) {
if($franchise != '' && $franchise != $row['franchise']) { ?>
</section>
<?php }
if(!empty($row['franchise']) && $franchise != $row['franchise']) { ?>
<section>
<h4><?php echo $row['franchise']; ?></h4>
<?php }
$franchise = $row['franchise']; ?>
<li><a href="work.php?workid=<?php echo $row['id_oeuvre']; ?>"><?php echo $row['title']; ?></a></li>
<?php } ?>
</ul>
<?php } ?>
</section>
<?php } ?>
<?php require_once('structure/footer.php'); ?>