Compare commits
No commits in common. "a5978393798ea3a482fd84c07bf0ae2ea1dc9048" and "61eb2404a20afdb815cb74efa74da3fe4da9f499" have entirely different histories.
a597839379
...
61eb2404a2
@ -10,7 +10,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"esoko/soko-web": "0.13.1",
|
"esoko/soko-web": "0.13",
|
||||||
"firebase/php-jwt": "^6.4"
|
"firebase/php-jwt": "^6.4"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
8
composer.lock
generated
8
composer.lock
generated
@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "59130fbd82b1c81275666b16adb0c1a1",
|
"content-hash": "707bad5bd796500db300c5384f2ce378",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "cocur/slugify",
|
"name": "cocur/slugify",
|
||||||
@ -82,11 +82,11 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "esoko/soko-web",
|
"name": "esoko/soko-web",
|
||||||
"version": "v0.13.1",
|
"version": "v0.13",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.esoko.eu/esoko/soko-web.git",
|
"url": "https://git.esoko.eu/esoko/soko-web.git",
|
||||||
"reference": "8bf495c89b4ce1456da1133adc285003e544dd48"
|
"reference": "4283bc9bb15d17914393b4ba3463d83717487c53"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"cocur/slugify": "^4.3",
|
"cocur/slugify": "^4.3",
|
||||||
@ -108,7 +108,7 @@
|
|||||||
"GNU GPL 3.0"
|
"GNU GPL 3.0"
|
||||||
],
|
],
|
||||||
"description": "Lightweight web framework",
|
"description": "Lightweight web framework",
|
||||||
"time": "2023-07-08T12:38:40+00:00"
|
"time": "2023-06-17T12:32:56+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "firebase/php-jwt",
|
"name": "firebase/php-jwt",
|
||||||
|
@ -79,7 +79,7 @@ class CommunityController implements IAuthenticationRequired
|
|||||||
|
|
||||||
return new HtmlContent('communities/community', [
|
return new HtmlContent('communities/community', [
|
||||||
'community' => $community,
|
'community' => $community,
|
||||||
'upcomingAndRecentEvents' => iterator_to_array($this->eventRepository->getUpcomingAndRecentByCommunity($community, new DateTime(), 30, 3)),
|
'upcomingEvents' => iterator_to_array($this->eventRepository->getUpcomingByCommunity($community, new DateTime(), 3)),
|
||||||
'debtItems' => $debtItems,
|
'debtItems' => $debtItems,
|
||||||
'debtBalance' => $debtBalance,
|
'debtBalance' => $debtBalance,
|
||||||
'outstandingItems' => $outstandingItems,
|
'outstandingItems' => $outstandingItems,
|
||||||
|
@ -44,7 +44,7 @@ class HomeController implements IAuthenticationRequired
|
|||||||
|
|
||||||
return new HtmlContent('home', [
|
return new HtmlContent('home', [
|
||||||
'communities' => $communities,
|
'communities' => $communities,
|
||||||
'upcomingAndRecentEvents' => iterator_to_array($this->eventRepository->getUpcomingAndRecentByUser($user, new DateTime(), 30, 3, true, ['community']))
|
'upcomingEvents' => iterator_to_array($this->eventRepository->getUpcomingByUser($user, new DateTime(), 3, true, ['community']))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
use Container;
|
use Container;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use DateInterval;
|
|
||||||
use Generator;
|
use Generator;
|
||||||
use RVR\PersistentData\Model\Community;
|
use RVR\PersistentData\Model\Community;
|
||||||
use RVR\PersistentData\Model\Event;
|
use RVR\PersistentData\Model\Event;
|
||||||
@ -33,21 +32,21 @@ class EventRepository
|
|||||||
return $this->selectAllByCommunity($community)->count();
|
return $this->selectAllByCommunity($community)->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUpcomingAndRecentByCommunity(Community $community, DateTime $from, int $days, int $limit, bool $useRelations = false, array $withRelations = []): Generator
|
public function getUpcomingByCommunity(Community $community, DateTime $from, int $limit, bool $useRelations = false, array $withRelations = []): Generator
|
||||||
{
|
{
|
||||||
$select = $this->selectAllByCommunity($community);
|
$select = $this->selectAllByCommunity($community);
|
||||||
$this->selectUpcomingAndRecent($select, $from, $days);
|
$select->where('end', '>', $from->format('Y-m-d H:i:s'));
|
||||||
$select->orderBy('start', 'DESC');
|
$select->orderBy('start', 'ASC');
|
||||||
$select->limit($limit, 0);
|
$select->limit($limit, 0);
|
||||||
|
|
||||||
yield from Container::$persistentDataManager->selectMultipleFromDb($select, Event::class, $useRelations, $withRelations);
|
yield from Container::$persistentDataManager->selectMultipleFromDb($select, Event::class, $useRelations, $withRelations);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUpcomingAndRecentByUser(User $user, DateTime $from, int $days, int $limit, bool $useRelations = false, array $withRelations = []): Generator
|
public function getUpcomingByUser(User $user, DateTime $from, int $limit, bool $useRelations = false, array $withRelations = []): Generator
|
||||||
{
|
{
|
||||||
$select = $this->selectAllByUser($user);
|
$select = $this->selectAllByUser($user);
|
||||||
$this->selectUpcomingAndRecent($select, $from, $days);
|
$select->where('end', '>', $from->format('Y-m-d H:i:s'));
|
||||||
$select->orderBy('start', 'DESC');
|
$select->orderBy('start', 'ASC');
|
||||||
$select->limit($limit, 0);
|
$select->limit($limit, 0);
|
||||||
|
|
||||||
yield from Container::$persistentDataManager->selectMultipleFromDb($select, Event::class, $useRelations, $withRelations);
|
yield from Container::$persistentDataManager->selectMultipleFromDb($select, Event::class, $useRelations, $withRelations);
|
||||||
@ -87,12 +86,4 @@ class EventRepository
|
|||||||
$select->where(['community_members', 'user_id'], '=', $user->getId());
|
$select->where(['community_members', 'user_id'], '=', $user->getId());
|
||||||
return $select;
|
return $select;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function selectUpcomingAndRecent(Select $select, DateTime $from, int $days)
|
|
||||||
{
|
|
||||||
$select->where(function (Select $select) use ($from, $days) {
|
|
||||||
$select->where('start', '<', (clone $from)->add(DateInterval::createFromDateString("$days days"))->format('Y-m-d H:i:s'));
|
|
||||||
$select->orWhere('end', '>', (clone $from)->sub(DateInterval::createFromDateString("$days days"))->format('Y-m-d H:i:s'));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -12,16 +12,16 @@
|
|||||||
|
|
||||||
<div class="gridContainer marginTop">
|
<div class="gridContainer marginTop">
|
||||||
<div>
|
<div>
|
||||||
<h3 class="marginBottom">Upcoming and recent events</h3>
|
<h3 class="marginBottom">Upcoming events</h3>
|
||||||
<?php if (count($upcomingAndRecentEvents) > 0): ?>
|
<?php if (count($upcomingEvents) > 0): ?>
|
||||||
<?php foreach ($upcomingAndRecentEvents as $event): ?>
|
<?php foreach ($upcomingEvents as $event): ?>
|
||||||
<p>
|
<p>
|
||||||
<a href="<?= Container::$routeCollection->getRoute('community.event')->generateLink(['communitySlug' => $community->getSlug(), 'eventSlug' => $event->getSlug()]) ?>"><?= $event->getTitle() ?></a>
|
<a href="<?= Container::$routeCollection->getRoute('community.event')->generateLink(['communitySlug' => $community->getSlug(), 'eventSlug' => $event->getSlug()]) ?>"><?= $event->getTitle() ?></a>
|
||||||
<span class="small"><?= $event->getStartDate()->format('Y-m-d') ?> – <?= $event->getEndDate()->format('Y-m-d') ?></span>
|
<span class="small"><?= $event->getStartDate()->format('Y-m-d') ?> – <?= $event->getEndDate()->format('Y-m-d') ?></span>
|
||||||
</p>
|
</p>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<p>There is no event to show.</p>
|
<p>There is no upcoming event.</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug()]) ?>">All events</a> | <a href="<?= Container::$routeCollection->getRoute('community.events.new')->generateLink(['communitySlug' => $community->getSlug()]) ?>">New event</a></p>
|
<p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug()]) ?>">All events</a> | <a href="<?= Container::$routeCollection->getRoute('community.events.new')->generateLink(['communitySlug' => $community->getSlug()]) ?>">New event</a></p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h3 class="marginBottom">Upcoming and recent events</h3>
|
<h3 class="marginBottom">Upcoming events</h3>
|
||||||
<?php if (count($upcomingAndRecentEvents) > 0): ?>
|
<?php if (count($upcomingEvents) > 0): ?>
|
||||||
<?php foreach ($upcomingAndRecentEvents as $event): ?>
|
<?php foreach ($upcomingEvents as $event): ?>
|
||||||
<p>
|
<p>
|
||||||
<a href="<?= Container::$routeCollection->getRoute('community.event')->generateLink(['communitySlug' => $event->getCommunity()->getSlug(), 'eventSlug' => $event->getSlug()]) ?>"><?= $event->getTitle() ?></a>
|
<a href="<?= Container::$routeCollection->getRoute('community.event')->generateLink(['communitySlug' => $event->getCommunity()->getSlug(), 'eventSlug' => $event->getSlug()]) ?>"><?= $event->getTitle() ?></a>
|
||||||
<span class="small">
|
<span class="small">
|
||||||
@ -28,7 +28,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<p>There is no event to show.</p>
|
<p>There is no upcoming event.</p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user