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 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342
| <?php
if(isset($_GET['series'])) {
$seriesId = $_GET['series'];
}
if(isset($_GET['title'])) {
$seriesTitle = $_GET['title'];
}
?>
<section class="series accueilContainer col-10">
<!--<?php
$sql = <<<SQL
SELECT * FROM SERIES
WHERE seriesId = :seriesId or seriesTitle like :seriesTitle
SQL;
$idQuery = $pdo->prepare($sql);
$idQuery->bindParam(':seriesId', $seriesId, PDO::PARAM_INT);
$idQuery->bindParam(':seriesTitle', $seriesTitle, PDO::PARAM_INT);
$idQuery->execute();
$row = $idQuery->fetch();
if(($row['seriesId'] = 0) || ($row['seriesTitle'] = 0)) {
include('../error.php');
}
?>-->
<figure class="poster">
<?php
// Image Query
$sql = <<<SQL
SELECT seriesTitle, seriesPoster FROM SERIES
WHERE seriesId = :seriesId
SQL;
$imageQuery = $pdo->prepare($sql);
$imageQuery->bindParam(':seriesId', $seriesId, PDO::PARAM_INT);
$imageQuery->execute();
$row = $imageQuery->fetch();
if(isset($row['seriesPoster'])) {
echo '<img class="seriesImage" src="/series/images/'.$row['seriesPoster'].'">';
}
else {
echo '<img class="seriesImage" src="/series/images/no_image_available.png">';
}
?>
</figure>
<article class="seriesRecord">
<!-- TITLE SECTION DISPLAY -->
<?php
// Title Query
$sql = <<<SQL
SELECT SL.seriesTitle AS frenchTitle, S.seriesTitle AS seriesTitle FROM SERIESLIST AS SL
LEFT JOIN SERIES AS S ON S.seriesId = SL.seriesId
WHERE SL.seriesId = :seriesId
SQL;
$titleQuery = $pdo->prepare($sql);
$titleQuery->bindParam(':seriesId', $seriesId, PDO::PARAM_INT);
$titleQuery->execute();
$row = $titleQuery->fetch();
if ($row['frenchTitle'] == $row['seriesTitle']) { // Test if The original an french titles are the same
$title = mb_strtoupper($row['frenchTitle']); // If they are the same display only one uppercase title
} else { // If they're different, display the french title uppercase and the original one lowercase
$title = mb_strtoupper($row['frenchTitle'])." (".$row['seriesTitle'].")";
$limit = "40";
if(strlen($title) <= $limit) { // Test String Lenght
$title = mb_strtoupper($row['frenchTitle'])." (".$row['seriesTitle'].")"; // If the lenght is smaller then limit
} else { // If lenght is bigger, display the title on 2 lines
$title = mb_strtoupper($row['frenchTitle'])."<br>(".$row['seriesTitle'].")";
}
}
echo '<h1 class="seriesTitle">'.$title.'</h1>';
// Is the Series a Spin-Off Query
$sql = <<<SQL
SELECT S.seriesId FROM SERIES AS S
JOIN SPINOFF AS SO ON SO.seriesId_spinOff = S.seriesId
WHERE S.seriesId = :seriesId AND SO.seriesId_spinOff = S.seriesId
SQL;
$isSpinOffQuery = $pdo->prepare($sql);
$isSpinOffQuery->bindParam(':seriesId', $seriesId, PDO::PARAM_INT);
$isSpinOffQuery->execute();
$row = $isSpinOffQuery->fetch();
if (isset($row['seriesId'] )) { // Test if the series is a Spin-Off
// Spin-Off from Query
$sql = <<<SQL
SELECT PL.seriesTitle AS prequel, S.seriesTitle AS spinOff FROM SPINOFF AS SO
JOIN SERIESLIST AS PL ON PL.seriesId = SO.seriesId_prequel
JOIN SERIESLIST AS S ON S.seriesId = SO.seriesId_spinOff
WHERE S.seriesId = :seriesId
SQL;
$spinOffQuery = $pdo->prepare($sql);
$spinOffQuery->bindParam(':seriesId', $seriesId, PDO::PARAM_INT);
$spinOffQuery->execute();
$row = $spinOffQuery->fetch(); // If it is one, display this line
echo '<span id="spinOff">Spin-Off de '.$row['prequel'].'</span>';
}
?>
<!-- PRODUCTION SECTION DISPLAY -->
<?php
// Company Name Query
$sql = <<<SQL
SELECT companyName AS companyName FROM COMPANY AS C
LEFT JOIN PRODUCTION AS P ON P.companyId = C.companyId
LEFT JOIN SERIES AS S ON S.seriesId = P.seriesId
WHERE S.seriesId = :seriesId
SQL;
$companyQuery = $pdo->prepare($sql);
$companyQuery->bindParam(':seriesId', $seriesId, PDO::PARAM_INT);
$companyQuery->execute();
$rows = $companyQuery->fetchAll();
if(isset($rows[0]['companyName'])) {
echo '<div class="castAndCrew">';
echo '<h2>PRODUCTION</h2>';
echo '<dl>';
foreach ($rows as $row) {
echo '<dd>'.$row['companyName'].'</dd>';
}
echo '</dl>';
echo '</div>';
}
?>
<!-- PRODUCER SECTION DISPLAY -->
<?php
// Producer Name Query
$sql = <<<SQL
SELECT personName AS personName FROM PERSON AS P
LEFT JOIN CREW AS C ON C.personId = P.personId
LEFT JOIN ROLE AS R ON R.roleId = C.roleId
LEFT JOIN SERIES AS S ON S.seriesId = C.seriesId
WHERE S.seriesId = :seriesId
AND R.roleId = 1
SQL;
$producerQuery = $pdo->prepare($sql);
$producerQuery->bindParam(':seriesId', $seriesId, PDO::PARAM_INT);
$producerQuery->execute();
$rows = $producerQuery->fetchAll();
if(isset($rows[0]['personName'])) {
echo '<div class="castAndCrew">';
echo '<h2>PRODUCTEUR</h2>';
echo '<dl>';
foreach ($rows as $row) {
echo '<dd>'.$row['personName'].'</dd>';
}
echo '</dl>';
echo '</div>';
}
?>
<!-- EXECUTIVE PRODUCER SECTION DISPLAY -->
<?php
// Executive Producer Name Query
$sql = <<<SQL
SELECT personName AS personName FROM PERSON AS P
LEFT JOIN CREW AS C ON C.personId = P.personId
LEFT JOIN ROLE AS R ON R.roleId = C.roleId
LEFT JOIN SERIES AS S ON S.seriesId = C.seriesId
WHERE S.seriesId = :seriesId
AND R.roleId = 2
SQL;
$execProducerQuery = $pdo->prepare($sql);
$execProducerQuery->bindParam(':seriesId', $seriesId, PDO::PARAM_INT);
$execProducerQuery->execute();
$rows = $execProducerQuery->fetchAll();
if(isset($rows[0]['personName'])) {
echo '<div class="castAndCrew">';
echo '<h2>PRODUCTEUR EXECUTIF</h2>';
echo '<dl>';
foreach ($rows as $row) {
echo '<dd>'.$row['personName'].'</dd>';
}
echo '</dl>';
echo '</div>';
}
?>
<!-- DIRECTOR SECTION DISPLAY -->
<?php
// Director Name Query
$sql = <<<SQL
SELECT personName AS personName FROM PERSON AS P
LEFT JOIN CREW AS C ON C.personId = P.personId
LEFT JOIN ROLE AS R ON R.roleId = C.roleId
LEFT JOIN SERIES AS S ON S.seriesId = C.seriesId
WHERE S.seriesId = :seriesId AND R.roleId = 3
SQL;
$directorQuery = $pdo->prepare($sql);
$directorQuery->bindParam(':seriesId', $seriesId, PDO::PARAM_INT);
$directorQuery->execute();
$rows = $directorQuery->fetchAll();
if(isset($rows[0]['personName'])) {
echo '<div class="castAndCrew">';
echo '<h2>REALISATEUR</h2>';
echo '<dl>';
foreach ($rows as $row) {
echo '<dd>'.$row['personName'].'</dd>';
}
echo '</dl>';
echo '</div>';
}
?>
<!-- CREATED BY SECTION DISPLAY -->
<?php
// Creator Name Query
$crSql = <<<SQL
SELECT personName AS personName FROM PERSON AS P
LEFT JOIN CREW AS C ON C.personId = P.personId
LEFT JOIN ROLE AS R ON R.roleId = C.roleId
LEFT JOIN SERIES AS S ON S.seriesId = C.seriesId
WHERE S.seriesId = :seriesId AND R.roleId = 5
SQL;
$ocSql = <<<SQL
SELECT originalText AS origText FROM ORIG_CREATION AS OC
LEFT JOIN SERIES AS S ON S.originalId = OC.originalId
WHERE S.seriesId = :seriesId
SQL;
$creatorQuery = $pdo->prepare($crSql);
$creatorQuery->bindParam(':seriesId', $seriesId, PDO::PARAM_INT);
$creatorQuery->execute();
$rows = $creatorQuery->fetchAll();
if(isset($rows[0]['personName'])) {
echo '<div class="castAndCrew">';
echo '<h2>CREATION</h2>';
echo '<dl>';
foreach ($rows as $row) {
echo '<dd class="castAndCrew">'.$row['personName'].'</dd>';
}
echo '</dl>';
echo '</div>';
}
$origCreator = $pdo->prepare($ocSql);
$origCreator->bindParam(':seriesId', $seriesId, PDO::PARAM_INT);
$origCreator->execute();
$rows = $origCreator->fetchAll();
if(isset($rows[0]['origText'])) {
echo '<div class="castAndCrew">';
echo '<dl>';
foreach ($rows as $row) {
echo $row['origText'];
}
echo '</dl>';
echo '</div>';
}
?>
<!-- CAST SECTION DISPLAY -->
<div class="castAndCrew">
<h2>DISTRIBUTION</h2>
<?php
// Cast Query
$sql = <<<SQL
SELECT S.seriesId, CP.characterId AS charId, P.personId, seriesTitle, characterName AS charName, personName, appearanceOrder AS appOrder, period, periodNumber AS periodNum FROM CASTING AS C
JOIN SERIES AS S ON S.seriesId = C.seriesId
JOIN PERSON AS P ON P.personId = C.personId
JOIN CHAR_PLAYED AS CP ON CP.characterId = C.characterId
WHERE S.seriesId = :seriesId
ORDER BY periodNum, appOrder
SQL;
$castQuery = $pdo->prepare($sql);
$castQuery->bindParam(':seriesId', $seriesId, PDO::PARAM_INT);
$castQuery->execute();
$rows = $castQuery->fetchAll();
if ($rows[0]['period'] == '-') {
echo '<dl>';
foreach ($rows as $row) {
$cast[$row['charName']][] = $row['personName'];
}
foreach ($cast as $char => $persons) {
echo '<dd>', implode(' -> ', $persons), " : {$char}</dd>";
}
echo '</dl>';
} else {
foreach ($rows as $row) {
$cast[$row['period']][$row['charName']][] = $row['personName'];
}
foreach ($cast as $period => $chars) {
echo '<dl>';
echo "<dt>".$period."</dt>";
foreach ($chars as $char => $persons) {
echo '<dd>', implode(' -> ', $persons), " : {$char}</dd>";
}
echo '</dl>';
}
}
?>
</div>
<!-- FIRST AIRED SECTION DISPLAY -->
<div class="castAndCrew">
<h2>PREMIERE DIFFUSION</h2>
<?php
// Is the series French Query
$sql = <<<SQL
SELECT S.seriesId FROM SERIES AS S
JOIN FRENCH_SERIES AS F ON F.seriesId = S.seriesId
WHERE S.seriesId = :seriesId AND F.seriesId = S.seriesId
SQL;
$isFrenchQuery = $pdo->prepare($sql);
$isFrenchQuery->bindParam(':seriesId', $seriesId, PDO::PARAM_INT);
$isFrenchQuery->execute();
$row = $isFrenchQuery->fetch();
// First Aired Query
$sql = <<<SQL
SELECT countryName, releaseYear, frenchReleaseYear, channelName, frenchChannelName FROM FIRSTAIRED
WHERE seriesId = :seriesId
SQL;
$airedQuery = $pdo->prepare($sql);
$airedQuery->bindParam(':seriesId', $seriesId, PDO::PARAM_INT);
$airedQuery->execute();
echo '<dl>';
if (isset($row['seriesId'] )) { // Test if it's a french series
$row = $airedQuery->fetch(); // If it's a french series display only this line
echo '<dd class="castAndCrew">France : '.$row['channelName'].' - '.$row['releaseYear'].'</dd>';
} else { // If it's a foreign series display the two first aired lines
$row = $airedQuery->fetch();
echo '<dd class="castAndCrew">'.$row['countryName'].' : '.$row['channelName'].' - '.$row['releaseYear'].'</dd>';
echo '<dd class="castAndCrew">France : '.$row['frenchChannelName'].' - '.$row['frenchReleaseYear'].'</dd>';
}
echo '</dl>';
?>
</div>
<div class="retour">
<span><?php echo "<a href=\"javascript:history.go(-1)\">" ?>RETOUR</a></span>
</div>
</article>
</section> |
Partager