From af2f823ed9eb8369ebb98d04c72adbf8af945d26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=91cze=20Bence?= Date: Sun, 28 May 2023 04:05:53 +0200 Subject: [PATCH] RVRNEXT-11 add upcoming events for user --- src/Controller/HomeController.php | 7 ++++++- views/home.php | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index d3a4960..a5af7ff 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -1,8 +1,10 @@ communityMemberRepository = new CommunityMemberRepository(); + $this->eventRepository = new EventRepository(); } public function isAuthenticationRequired(): bool @@ -39,7 +44,7 @@ class HomeController implements IAuthenticationRequired return new HtmlContent('home', [ 'communities' => $communities, - 'upcomingEvents' => [] + 'upcomingEvents' => iterator_to_array($this->eventRepository->getUpcomingByUser($user, new DateTime(), 3, true, ['community'])) ]); } } diff --git a/views/home.php b/views/home.php index 67a997d..f7db5c3 100644 --- a/views/home.php +++ b/views/home.php @@ -19,7 +19,13 @@

Upcoming events

0): ?> - +

+ getTitle() ?> + + (getCommunity()->getName() ?>) + getStartDate()->format('Y-m-d') ?> – getEndDate()->format('Y-m-d') ?> + +

There is no upcoming event.