summaryrefslogtreecommitdiffstats
path: root/index.php
blob: 9c96bfbf7ee65e84656d9f69571d3e9e4335c3fc (plain)
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
<?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>