From 990a32d8a1ca33772a4b5df001aad07528413b46 Mon Sep 17 00:00:00 2001 From: flashwave Date: Tue, 22 May 2018 02:54:20 +0200 Subject: [PATCH] Posting page --- assets/less/mio/classes/forum/posting.less | 30 ++++++++++++++ assets/less/mio/main.less | 1 + public/forum/posting.php | 46 +++++++++++++++------- views/mio/forum/posting.twig | 44 +++++++++++++++++++++ 4 files changed, 107 insertions(+), 14 deletions(-) create mode 100644 assets/less/mio/classes/forum/posting.less create mode 100644 views/mio/forum/posting.twig diff --git a/assets/less/mio/classes/forum/posting.less b/assets/less/mio/classes/forum/posting.less new file mode 100644 index 00000000..3d292656 --- /dev/null +++ b/assets/less/mio/classes/forum/posting.less @@ -0,0 +1,30 @@ +.forum__posting { + + &__content { + margin: 2px; + display: flex; + flex-direction: column; + } + + &__title { + margin-bottom: 2px; + + &__input { + width: 100%; + } + } + + &__text { + margin-bottom: 2px; + + &__input { + min-width: 100%; + max-width: 100%; + min-height: 200px; + } + } + + &__buttons { + display: flex; + } +} diff --git a/assets/less/mio/main.less b/assets/less/mio/main.less index c5f697e5..45a4bfc1 100644 --- a/assets/less/mio/main.less +++ b/assets/less/mio/main.less @@ -74,4 +74,5 @@ body { @import "classes/forum/actions"; @import "classes/forum/listing"; @import "classes/forum/post"; +@import "classes/forum/posting"; @import "classes/forum/topics"; diff --git a/public/forum/posting.php b/public/forum/posting.php index 488ddbc0..3a6cfd6d 100644 --- a/public/forum/posting.php +++ b/public/forum/posting.php @@ -12,6 +12,7 @@ if (!$app->hasActiveSession()) { $postRequest = $_SERVER['REQUEST_METHOD'] === 'POST'; $db = Database::connection(); +$templating = $app->getTemplating(); // ORDER OF CHECKING // - $postId non-zero: enter quote mode @@ -43,7 +44,7 @@ if (!empty($postId)) { if (!empty($topicId)) { $getTopic = $db->prepare(' - SELECT `topic_id`, `forum_id` + SELECT `topic_id`, `forum_id`, `topic_title` FROM `msz_forum_topics` WHERE `topic_id` = :topic_id '); @@ -57,7 +58,7 @@ if (!empty($topicId)) { if (!empty($forumId)) { $getForum = $db->prepare(' - SELECT `forum_id` + SELECT `forum_id`, `forum_name` FROM `msz_forum_categories` WHERE `forum_id` = :forum_id '); @@ -107,21 +108,38 @@ if ($postRequest) { return; } -echo '
'; +$lastParent = $forumId; +$breadcrumbs = []; +$getBreadcrumb = $db->prepare(' + SELECT `forum_id`, `forum_name`, `forum_parent` + FROM `msz_forum_categories` + WHERE `forum_id` = :forum_id +'); -if (isset($topic)) { - echo ""; -} else { - echo ""; - echo '
'; +while ($lastParent > 0) { + $getBreadcrumb->bindValue('forum_id', $lastParent); + $breadcrumb = $getBreadcrumb->execute() ? $getBreadcrumb->fetch() : []; + + if (!$breadcrumb) { + break; + } + + $breadcrumbs[$breadcrumb['forum_name']] = '/forum/forum.php?f=' . $breadcrumb['forum_id']; + $lastParent = $breadcrumb['forum_parent']; } -echo '
- -
'; +if (!empty($post)) { + $templating->var('posting_quote', $post); +} + +echo $templating->render('forum.posting', [ + 'posting_breadcrumbs' => $breadcrumbs, + 'posting_forum' => $forum, +]); diff --git a/views/mio/forum/posting.twig b/views/mio/forum/posting.twig new file mode 100644 index 00000000..5e0ddd95 --- /dev/null +++ b/views/mio/forum/posting.twig @@ -0,0 +1,44 @@ +{% extends '@mio/forum/master.twig' %} +{% from '@mio/macros.twig' import navigation %} + +{% set title = 'Posting' %} + +{% block content %} + {{ navigation(posting_breadcrumbs, posting_breadcrumbs|last, true, null, 'left') }} + +
+
+ {% if posting_quote is defined %} + Quoting » {{ posting_topic.topic_title }} + {% elseif posting_topic is defined %} + Replying » {{ posting_topic.topic_title }} + {% else %} + Creating Topic » {{ posting_forum.forum_name }} + {% endif %} +
+
+ {% if posting_topic is defined %} + + {% else %} + + +
+ +
+ {% endif %} + +
+ +
+ +
+ +
+
+
+ + {{ navigation(mio_navigation, '/forum/') }} +{% endblock %}