61 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
@extends(templates/layout_normal)
 | 
						||
 | 
						||
@section(main)
 | 
						||
    <h2>
 | 
						||
        <a href="<?= Container::$routeCollection->getRoute('community')->generateLink(['communitySlug' => $community->getSlug()]) ?>"><?= $community->getName() ?></a> »
 | 
						||
        Events
 | 
						||
    </h2>
 | 
						||
 | 
						||
    <p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.events.new')->generateLink(['communitySlug' => $community->getSlug()]) ?>">New event</a></p>
 | 
						||
 | 
						||
    <?php if ($numberOfEvents > 0): ?>
 | 
						||
        <?php if ($pages > 1): ?>
 | 
						||
            <p class="paginateContainer marginTop">
 | 
						||
                <a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => 0]) ?>">«</a>
 | 
						||
                <a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => max(0, $currentPage - 1)]) ?>">‹</a>
 | 
						||
                <?php for ($i = 0; $i < $pages; $i++): ?>
 | 
						||
                    <?php if ($currentPage == $i): ?>
 | 
						||
                        <span class="selected"><?= $i + 1 ?></span>
 | 
						||
                    <?php else: ?>
 | 
						||
                        <a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => $i]) ?>"><?= $i + 1 ?></a>
 | 
						||
                    <?php endif; ?>
 | 
						||
                <?php endfor; ?>
 | 
						||
                <a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => min($pages - 1, $currentPage + 1)]) ?>">›</a>
 | 
						||
                <a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => $pages - 1]) ?>">»</a>
 | 
						||
            </p>
 | 
						||
        <?php endif; ?>
 | 
						||
 | 
						||
        <?php foreach ($events as $event): ?>
 | 
						||
            <a class="block" href="<?= Container::$routeCollection->getRoute('community.event')->generateLink(['communitySlug' => $community->getSlug(), 'eventSlug' => $event->getSlug()]) ?>">
 | 
						||
            <div class="box">
 | 
						||
                <p style="font-weight: bold;"><?= $event->getTitle() ?></p>
 | 
						||
                <p class="small"><?= $event->getStartDate()->format('Y-m-d') ?> – <?= $event->getEndDate()->format('Y-m-d') ?></p>
 | 
						||
                <p class="small"><?= $event->getDescription() ?></p>
 | 
						||
            </div>
 | 
						||
            </a>
 | 
						||
        <?php endforeach; ?>
 | 
						||
 | 
						||
        <?php if ($pages > 1): ?>
 | 
						||
            <p class="paginateContainer marginTop">
 | 
						||
                <a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => 0]) ?>">«</a>
 | 
						||
                <a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => max(0, $currentPage - 1)]) ?>">‹</a>
 | 
						||
                <?php for ($i = 0; $i < $pages; $i++): ?>
 | 
						||
                    <?php if ($currentPage == $i): ?>
 | 
						||
                        <span class="selected"><?= $i + 1 ?></span>
 | 
						||
                    <?php else: ?>
 | 
						||
                        <a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => $i]) ?>"><?= $i + 1 ?></a>
 | 
						||
                    <?php endif; ?>
 | 
						||
                <?php endfor; ?>
 | 
						||
                <a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => min($pages - 1, $currentPage + 1)]) ?>">›</a>
 | 
						||
                <a href="<?= Container::$routeCollection->getRoute('community.events')->generateLink(['communitySlug' => $community->getSlug(), 'page' => $pages - 1]) ?>">»</a>
 | 
						||
            </p>
 | 
						||
        <?php endif; ?>
 | 
						||
 | 
						||
        <p class="marginTop"><a href="<?= Container::$routeCollection->getRoute('community.events.new')->generateLink(['communitySlug' => $community->getSlug()]) ?>">New event</a></p>
 | 
						||
    <?php else: ?>
 | 
						||
        <div class="box">
 | 
						||
            <p>There are no events yet.</p>
 | 
						||
        </div>
 | 
						||
    <?php endif; ?>
 | 
						||
@endsection
 |