id = (int) $id; $this->date = DateTime::createFromFormat('Y-m-d', $date); $this->name = $name; $this->ageclasses = $ageclasses; $this->place = $place; $this->announcementUrl = $announcementUrl; $this->routeUrl = $routeUrl; $this->galleryUrl = $galleryUrl; $this->promoImgUrl = $promoImgUrl; } public function getId() { return $this->id; } public function getHtmlName() { $name = ($this->name != null ? $this->name : 'Wettkampf ohne Namen'); foreach (['meisterschaft', 'turnier', 'randori'] as $fragment) { str_replace($fragment, '­', $name); } return $name; } public function getHtmlDate() { return ($this->date != null ? $this->date->format('Y-m-d') : 'fehlendes Datum'); } public function getAgeClasses() { return ($this->ageclasses != null ? $this->ageclasses : '-'); } public function getPlace() { return ($this->place != null ? $this->place : '-'); } public static function fromArray($member) { return new shiai( $member['lfdeNr'] ?? null, $member['Datum'] ?? null, $member['Veranstaltung'] ?? '', $member['Altersklassen'] ?? null, $member['Ort'] ?? '', $member['Ausschreibung'] ?? null, $member['Routenplaner'] ?? null, $member['galleryLink'] ?? null, $member['promoPic'] ?? null ); } /** * shiai event as html code for displaying * * @return html formated string */ public function getHtml() { $retHtml = ''; $retHtml = '
' . '

' . $this->getHtmlName() . '

' . '
' . '
Datum:
' . $this->getHtmlDate() . '
' . '
Altersklassen
' . $this->getAgeClasses() . '
' . '
Ort
' . $this->getPlace() . '
' . '
' . '
'; return $retHtml; } } // end class shiai