Bugfix: hidden select menu in starting type selection replaced by radio buttons
This commit is contained in:
96
homepage/participo/lib/participoLib/eventPage.php
Normal file
96
homepage/participo/lib/participoLib/eventPage.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
class EventPage
|
||||
{
|
||||
public function __construct($eventId = null)
|
||||
{
|
||||
$this->eventId = filterId($eventId);
|
||||
}
|
||||
|
||||
public function init()
|
||||
{
|
||||
$params = participo::parseParams(
|
||||
['eventId' => function ($param) {return filterId($param); }]
|
||||
);
|
||||
$this->eventId = $params['eventId'];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public function getHtmlNotFound()
|
||||
{
|
||||
return '<div>Der Event "' . $this->id . '" existiert leider nicht!</div>'
|
||||
. '<h2>Anstehende Termine</h2>'
|
||||
. eventPlaner::getHtmlEventTable(
|
||||
eventPlaner::getComingWkEvents()
|
||||
);
|
||||
}
|
||||
|
||||
public function getHtml()
|
||||
{
|
||||
if (!$this->event()) {
|
||||
return $this->getHtmlNotFound();
|
||||
}
|
||||
|
||||
$html = '';
|
||||
|
||||
$html .=
|
||||
'<div>'
|
||||
. '<dl>'
|
||||
. '<dt>Termine</dt>'
|
||||
. '<dd>
|
||||
<dl>'
|
||||
. '<dt>Datum</dt><dd>' . $this->event()->htmlDate() . '</dd>'
|
||||
. '<dt>Deadline zum Einschreiben:</dt><dd>' . $this->event()->htmlDeadline() . '</dd>'
|
||||
. '</dl>';
|
||||
// Not all Events have a shiai linked to them
|
||||
if ($this->event()->shiai()) {
|
||||
$html .=
|
||||
'<dt>Wettkampfdetails</dt><dd>' . $this->event()->shiai()->getHtmlDetails() . '</dd>';
|
||||
}
|
||||
$html .=
|
||||
'<dt>Einschreibungen</dt><dd>' . $this->event()->getHtmlStarterStatistic() . '</dd>'
|
||||
. '<dt>Eigene, gemeldete Starter</dt><dd>' . $this->event()->getHtmlStarterList() . '</dd>'
|
||||
. '</dl>'
|
||||
. '</div>';
|
||||
|
||||
$html .=
|
||||
'<div>';
|
||||
foreach ($this->event()->shiai()->ageGroups() as $ageClass => $starterList) {
|
||||
$html .=
|
||||
'<dl>' .
|
||||
'<dt>' . (!empty($ageClass) ? $ageClass : 'keiner Altersklasse zugeordnet') . '</dt>'
|
||||
. '<dd>
|
||||
<ul>';
|
||||
foreach ($starterList as $starter) {
|
||||
if (!array_key_exists($starter->getId(), $this->event()->getStarter())) {
|
||||
$html .=
|
||||
'<li>' . $starter->getName() . ', ' . $starter->getFirstname() . ' - ' . $starter->yearOfBirth() . '
|
||||
</li>';
|
||||
}
|
||||
}
|
||||
$html .= '
|
||||
</dd>
|
||||
</ul>';
|
||||
}
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function html()
|
||||
{
|
||||
echo($this->getHtml());
|
||||
}
|
||||
|
||||
private function event(bool $forceLoading = false)
|
||||
{
|
||||
if (!$this->event || $forceLoading) {
|
||||
$this->event = Event::loadFromDb($this->eventId);
|
||||
}
|
||||
return $this->event;
|
||||
}
|
||||
|
||||
private $eventId = null;
|
||||
private $event = null;
|
||||
}
|
||||
Reference in New Issue
Block a user