diff options
author | steckbrief <steckbrief@chefmail.de> | 2017-11-25 17:19:44 +0100 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2017-11-25 17:19:44 +0100 |
commit | 9878738abc642ed693b9dc1351bdc35cba5a0171 (patch) | |
tree | b361f82dc777a73741445fb86a03403b6decaf32 /index.php |
Display of children tv series implemented, bootstrap JS v3.3.7 added
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/index.php b/index.php new file mode 100644 index 0000000..9c96bfb --- /dev/null +++ b/index.php @@ -0,0 +1,116 @@ +<?php + +$tvSeriesDir = "."; + +$tvSeriesDirContent = array_diff(scandir($tvSeriesDir), array('..', '.')); + +$currentTvSeries = $_GET["series"]; +$currentTvSeriesIsSet = isset($currentTvSeries) && !empty($currentTvSeries); +$tvSeries = array(); +$characters = array(); + +foreach ($tvSeriesDirContent as $tvSeriesName) { + $tvSeriesPath = $tvSeriesDir.DIRECTORY_SEPARATOR.$tvSeriesName; + if (is_dir($tvSeriesPath)) { + array_push($tvSeries, $tvSeriesName); + if ($currentTvSeriesIsSet && $currentTvSeries == $tvSeriesName) { + $charactersDirContent = array_diff(scandir($tvSeriesPath), array('..', '.')); + foreach ($charactersDirContent as $character) { + $characterPath = $tvSeriesPath.DIRECTORY_SEPARATOR.$character; + if (is_dir($characterPath)) { + $characterDescription = file_get_contents($characterPath.DIRECTORY_SEPARATOR.'description.txt'); + $characters[$character] = $characterDescription; + } + } + } + } +} + +function visibleName($nameWithUnderscore) { + return str_replace('_', ' ', $nameWithUnderscore); +} + +$currentTvSeriesName = visibleName($currentTvSeries); + +?> +<!DOCTYPE html> +<html lang="de"> + <head> + <meta name="viewport" content="width=device-width, initial-scale=1.0"> + <link rel="stylesheet" href="https://www.sl-its.de/css/bootstrap.spacelab.min.css"> + <script src="https://www.sl-its.de/js/jquery-1.11.2.min.js"></script> + <script src="https://www.sl-its.de/js/bootstrap.min.js"></script> + <style type="text/css"> + .figure-desc { + text-align: justify; + } + .figure-pic { + height: 300px; + width: 300px; + } + .series-logo { + font-size: 2em; + } + .spacer { + height: 55px; + } + </style> + <title>Kinderserienfiguren</title> + </head> + <body> + <nav class="navbar navbar-default navbar-fixed-top navbar-right"> + <div class="navbar-header"> + <a class="navbar-brand" href="#">Kinderserienfiguren</a> + <button type="button" class="navbar-toggle navbar-toggle-si" data-toggle="collapse" data-target=".navbar-collapse"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + </div> + <div class="container-fluid"> + <div class="collapse navbar-collapse" id="myNavbar"> + <ul class="nav navbar-nav"> + <?php + foreach ($tvSeries as $tvSeriesName) { + $cssClass = ($tvSeriesName == $currentTvSeries) ? " class=\"active\"" : ""; + $visibleName = visibleName($tvSeriesName); + ?> + <li<?=$cssClass;?>><a href="index.php?series=<?=$tvSeriesName;?>"><?=$visibleName;?></a></li> + <?php + } + ?> +</ul> + </div> + </div> + </nav> + <div class="spacer"></div> + <div class="container"> + <div class="row"> + <div class="col-md-7 text-center"> + <img class="img-fluid mb-3 mb-md-0 series-logo" src="<?=$currentTvSeries?>/logo.png" alt="<?=$currentTvSeriesName;?>" title="<?=$currentTvSeriesName;?>"> + </div> + </div> + <?php + foreach ($characters as $character=>$characterDescription) { + $characterName = str_replace('_', ' ', $character); + ?> + <!-- <?=$characterName;?> --> + <div class="row"> + <div class="col-md-7 text-center"> + <img class="img-fluid rounded mb-3 mb-md-0 figure-pic" src="<?=$currentTvSeries?>/<?=$character;?>/passphoto.png" alt="<?=$characterName;?>" title="<?=$characterName;?>"> + </div> + <div class="col-md-5"> + <h3><?=$characterName;?></h3> + <p class="figure-desc"><?=$characterDescription;?></p> + </div> + </div> + <!-- /.row --> + + <hr> + <?php + } + ?> + </div> + </body> +</html>
\ No newline at end of file |