From 3c848bc8aeec3aef689fc7ce83c4184065db1da2 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Fri, 11 Aug 2017 20:26:03 +0200 Subject: [PATCH] Create better minimized version --- Models/Calendar.php | 20 +++++++++++++ Models/CalendarMapper.php | 1 + Theme/Backend/calendar-dashboard.tpl.php | 36 +++++++++++++----------- Theme/Backend/css/styles.css | 3 ++ Theme/Backend/css/styles.scss | 5 ++++ Theme/Backend/dashboard-calendar.tpl.php | 26 +++++++---------- 6 files changed, 58 insertions(+), 33 deletions(-) diff --git a/Models/Calendar.php b/Models/Calendar.php index 406a0a9..947a470 100644 --- a/Models/Calendar.php +++ b/Models/Calendar.php @@ -315,4 +315,24 @@ class Calendar return $events; } + + /** + * Has event on date + * + * @param \DateTime $date Date of the event + * + * @return bool + * + * @since 1.0.0 + */ + public function hasEventOnDate(\DateTime $date) : bool + { + foreach ($this->events as $event) { + if ($event->getCreatedAt()->format('Y-m-d') === $date->format('Y-m-d')) { + return true; + } + } + + return false; + } } diff --git a/Models/CalendarMapper.php b/Models/CalendarMapper.php index 8de5576..bd37bdf 100644 --- a/Models/CalendarMapper.php +++ b/Models/CalendarMapper.php @@ -10,6 +10,7 @@ * @license OMS License 1.0 * @version 1.0.0 * @link http://orange-management.com + * @todo only load events of 3 month or 1 year?! */ declare(strict_types=1); namespace Modules\Calendar\Models; diff --git a/Theme/Backend/calendar-dashboard.tpl.php b/Theme/Backend/calendar-dashboard.tpl.php index 2ce0e12..0cde3a7 100644 --- a/Theme/Backend/calendar-dashboard.tpl.php +++ b/Theme/Backend/calendar-dashboard.tpl.php @@ -35,23 +35,25 @@ $calendar = $this->getData('calendar'); getDate()->getMonthCalendar(0); $isActiveMonth = false; for($i = 0; $i < 6; $i++) : ?> diff --git a/Theme/Backend/css/styles.css b/Theme/Backend/css/styles.css index a90a1c8..da75103 100644 --- a/Theme/Backend/css/styles.css +++ b/Theme/Backend/css/styles.css @@ -61,6 +61,9 @@ background: #dfdfdf; } .m-calendar.m-calendar-mini .days li { height: auto; } + .m-calendar .has-event { + font-weight: bold; + background: #009aaf; } @media (max-width: 768px) { .m-calendar .weekdays, .m-calendar .other-month { diff --git a/Theme/Backend/css/styles.scss b/Theme/Backend/css/styles.scss index fc9b908..ae4e264 100644 --- a/Theme/Backend/css/styles.scss +++ b/Theme/Backend/css/styles.scss @@ -91,6 +91,11 @@ height: auto; } } + + .has-event { + font-weight: bold; + background: #009aaf; + } } @media(max-width: 768px) { diff --git a/Theme/Backend/dashboard-calendar.tpl.php b/Theme/Backend/dashboard-calendar.tpl.php index ea6f4c7..ab2eea8 100644 --- a/Theme/Backend/dashboard-calendar.tpl.php +++ b/Theme/Backend/dashboard-calendar.tpl.php @@ -20,24 +20,18 @@ $calendar = $this->getData('calendar'); getDate()->getMonthCalendar(0); $isActiveMonth = false; for($i = 0; $i < 6; $i++) : ?>