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++) : ?>