64 lines
2.4 KiB
PHP
64 lines
2.4 KiB
PHP
<?php
|
|
|
|
class eventPlaner{
|
|
static private $db = null;
|
|
function setDbConnection($db){
|
|
$this->$db = $db;
|
|
}
|
|
}
|
|
|
|
class shiai{
|
|
private $id = null; //< unique id
|
|
private $date = null; //< date of the shiai
|
|
private $name = null; //< name of the shiai as string
|
|
private $ageclasses = null; //< age classes as space separated Uxy in a string
|
|
private $place = null; //< place of the shiai as string
|
|
private $announcementUrl = null; //< url to the announcement
|
|
private $routeUrl = null; //< url to a routing planner
|
|
private $galleryUrl = null; //< url of the gallery to a gallery of the shiai
|
|
private $promoImgUrl = null; //< promotional image for the shiai (as url)
|
|
|
|
function __construct($id, $date, $name, $ageclasses, $place, $announcementUrl, $routeUrl, $galleryUrl, $promoImgUrl){
|
|
//! @todo input validation and sanitation
|
|
$this->$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;
|
|
}
|
|
static public function fromArray($member){
|
|
$id = $member['lfdeNr'] ?? null;
|
|
$date = $member['Datum'] ?? null;
|
|
$name = $member['Veranstaltung'] ?? "<fehlender Name>";
|
|
$ageclasses = $member['Altersklassen'] ?? null;
|
|
$place = $member['Ort'] ?? "<fehlender Ort>";
|
|
$announcementUrl = $member['Ausschreibung'] ?? null;
|
|
$routeUrl = $member['Routenplaner'] ?? null;
|
|
$galleryUrl = $member['galleryLink'] ?? null;
|
|
$promoImgUrl = $member['promoPic'] ?? null;
|
|
}
|
|
}
|
|
class event{
|
|
private $id = null; //< unique id of the event in the db
|
|
private $date = null; //< date for the event (@todo ranges?)
|
|
private $shiaiId = null; //< unique id of the shiai in the db (if appropriate)
|
|
private $deadline = null; //< until when one can register for the event
|
|
private $remarks = null; //< remarks to the event (special rules) or a json object for missing data (e.g. non-shiai events)
|
|
|
|
private $shiai = null;
|
|
|
|
function __construct($id, $date, $shiaiId, $deadline, $remarks){
|
|
//! @todo InputValidation
|
|
$this->$id = (int) $id;
|
|
$this->$date = DateTime::createFromFormat("Y-m-d", $date);
|
|
$this->shiaiId = (($shiaiId!=null)?((int)$shiaiId):(null));
|
|
$this->deadline = DateTime::createFromFormat("Y-m-d");
|
|
$this->remarks = $remarks;
|
|
}
|
|
}
|
|
|
|
?>
|