added some htmlOutput functions for shiai

This commit is contained in:
marko
2022-06-29 19:08:53 +02:00
parent 269c680fe0
commit 5903f65185

View File

@@ -1,5 +1,8 @@
<?php
/**
* frame for a shiai
*/
class shiai
{
private $id = null; //< unique id
@@ -26,19 +29,29 @@ class shiai
$this->promoImgUrl = $promoImgUrl;
}
public function getId()
{
return $this->id;
}
public function getName()
{
return $this->name;
return ($this->name != null ? $this->name : 'Wettkampf ohne Namen');
}
public function getHtmlDate()
{
return ($this->date != null ? $this->date->format('Y-m-d') : 'fehlendes Datum');
}
public function getAgeClasses()
{
return $this->ageclasses ? $this->ageclasses : '-';
return ($this->ageclasses != null ? $this->ageclasses : '-');
}
public function getId()
public function getPlace()
{
return $this->id;
return ($this->place != null ? $this->place : '-');
}
public static function fromArray($member)
@@ -55,6 +68,26 @@ class shiai
$member['promoPic'] ?? null
);
}
/**
* shiai event as html code for displaying
*
* @return html formated string
*/
public function getHtml()
{
$retHtml = '';
$retHtml =
'<div>' .
'<h3>' . $this->getName() . '</h3>' .
'<dl>' .
'<dt>Datum:</dt><dd>' . $this->getHtmlDate() . '</dd>' .
'<dt>Altersklassen</dt><dd>' . $this->getAgeClasses() . '</dd>' .
'<dt>Ort</dt><dd>' . $this->getPlace() . '</dd>' .
'</dl>';
return $retHtml;
}
} // end class shiai
class event
@@ -110,10 +143,7 @@ class event
{
return
'<div id="event-modal-' . $this->id . '" class="modal">' .
'<div class="modal-content">' .
'<h4>' . $this->shiai->getName() . '</h4>' .
'<p>A bunch of text</p>' .
'</div>' . // end modal-content
'<div class="modal-content">' . $this->shiai->getHtml() . '</div>' .
'<div class="modal-footer">' .
'<a href="#!" class="modal-close waves-effect waves-green btn-flat">Agree</a>' .
'</div>' .