summaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php47
1 files changed, 39 insertions, 8 deletions
diff --git a/index.php b/index.php
index f290c1f..a7c71a5 100644
--- a/index.php
+++ b/index.php
@@ -7,6 +7,9 @@ $storiesDir = __DIR__.DIRECTORY_SEPARATOR.'stories';
$storiesDirContent = getDirectoryContent($storiesDir);
+$isAuthenticated = true;
+$isAdmin = true;
+
$currentStory = $_GET['story'];
$currentStoryIsSet = isset($currentStory) && !empty($currentStory);
$stories = array();
@@ -17,8 +20,10 @@ foreach ($storiesDirContent as $storyName) {
if (is_dir($storyPath)) {
$storyDescription = file_get_contents($storyPath.DIRECTORY_SEPARATOR.'description.txt');
$stories[$storyName] = $storyDescription;
+
if ($currentStoryIsSet && $currentStory == $storyName) {
$charactersDirContent = array_diff(scandir($storyPath), array('..', '.'));
+
foreach ($charactersDirContent as $character) {
$characterPath = $storyPath.DIRECTORY_SEPARATOR.$character;
if (is_dir($characterPath)) {
@@ -32,13 +37,17 @@ foreach ($storiesDirContent as $storyName) {
$currentStoryName = visibleName($currentStory);
-function printEntities($entities) {
+function printEntities($entities, $storyName = NULL) {
foreach ($entities as $entity=>$description) {
$name = visibleName($entity);
+ $imgName = (NULL != $storyName) ? 'passphoto.png' : 'logo.png';
+ $imgPath = 'stories/'.((NULL != $storyName) ? (urlencode($storyName).'/') : '');
+ $imgPath .= urlencode($entity);
+?>
<!-- <?=$name;?> -->
<div class="row">
<div class="col-md-7 text-center">
- <img class="img-fluid rounded mb-3 mb-md-0 figure-pic" src="stories/<?=urlencode($entity)?>/<?=urlencode($entity);?>/passphoto.png" alt="<?=$name;?>" title="<?=$name;?>">
+ <img class="img-fluid rounded mb-3 mb-md-0 figure-pic" src="<?=$imgPath.'/'.$imgName;?>" alt="<?=$name;?>" title="<?=$name;?>">
</div>
<div class="col-md-5">
<h3><?=$name;?></h3>
@@ -68,19 +77,34 @@ function printEntities($entities) {
height: 300px;
width: 300px;
}
- .story-logo {
+ .story-header {
font-size: 2em;
}
.spacer {
height: 55px;
}
+ .floating-action-btn {
+ position: fixed;
+ bottom: 45px;
+ right: 34px;
+ background-color: #ff8000;
+ border-radius: 50%;
+ box-shadow: 5px 5px 5px #ccc;
+ width: 50px;
+ height: 50px;
+ line-height: 50px;
+ text-align: center;
+ vertical-align: middle;
+ font-size: 2.6em;
+ cursor: pointer;
+ }
</style>
<title>Kindergeschichten</title>
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top navbar-right">
<div class="navbar-header">
- <a class="navbar-brand" href="#">Kindergeschichten</a>
+ <a class="navbar-brand" href="index.php">Kindergeschichten</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>
@@ -92,7 +116,7 @@ function printEntities($entities) {
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<?php
- foreach ($stories as $storyName) {
+ foreach ($stories as $storyName=>$desc) {
$visibleName = visibleName($storyName);
$cssClass = ($visibleName == $currentStoryName) ? " class=\"active\"" : "";
?>
@@ -109,15 +133,22 @@ function printEntities($entities) {
<?php if ($currentStoryIsSet) { ?>
<div class="row">
<div class="col-md-7 text-center">
- <img class="img-fluid mb-3 mb-md-0 story-logo" src="stories/<?=urlencode($currentStory)?>/logo.png" alt="<?=$currentStoryName;?>" title="<?=$currentStoryName;?>">
+ <img class="img-fluid mb-3 mb-md-0 story-header" src="stories/<?=urlencode($currentStory)?>/header.png" alt="<?=$currentStoryName;?>" title="<?=$currentStoryName;?>">
</div>
</div>
<?php
printEntities($characters);
} else {
- printEntities(stories);
+ printEntities($stories);
+}
+?>
+</div>
+<?php
+if ($isAuthenticated && $isAdmin) {
+ if (!$currentStoryIsSet) {
+ include(__DIR__.DIRECTORY_SEPARATOR.'lib'.DIRECTORY_SEPARATOR.'new-story-dialog.inc.php');
+ }
}
?>
- </div>
</body>
</html>