From 6bf09a069577fa9fcefdb0f92da81001465a50e0 Mon Sep 17 00:00:00 2001 From: steckbrief Date: Sun, 3 Dec 2017 22:16:49 +0100 Subject: floating action button added to open a modal dialog to create a new story --- index.php | 47 ++++++++++++++++++++++++++++++++++++-------- lib/new-story-dialog.inc.php | 38 +++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 8 deletions(-) create mode 100644 lib/new-story-dialog.inc.php 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;?> + <?=$name;?>

@@ -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; + } Kindergeschichten