added admin function: add user

This commit is contained in:
marko
2023-03-27 05:15:18 +02:00
parent 3f76d82897
commit 4f2a05b9eb
16 changed files with 380 additions and 122 deletions

View File

@@ -14,6 +14,7 @@ class Event
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)
// linked data
private $shiai = null; //< a place to load the linked shiai to (if loaded)
/** constructor
@@ -32,8 +33,6 @@ class Event
$this->shiaiId = filterId($shiaiId);
$this->deadline = DateTime::createFromFormat('Y-m-d', $deadline);
$this->remarks = $remarks;
$this->shiai = $shiai;
}
// Getter
@@ -75,17 +74,15 @@ class Event
}
/** Getter for the shiai
*
* If the Shiai isn't loaded yet, it is loaded
*
* @return Shiai shiai for the event
*/
public function getShiai()
public function getShiai($forceLoading = false)
{
return $this->shiai;
}
public function loadShiai()
{
if ($this->shiaiId != null) {
// We want to load if it isn't loaded yet or we want to enforce it. But in either case we need an id to load
if( (!isset($this->shiai) || $forceLoading) && isset($this->shiaiId) ){
$this->shiai = Shiai::loadFromDb($this->shiaiId);
}
return $this->shiai;
@@ -112,7 +109,7 @@ class Event
*/
public function asHtmlCard()
{
$shiai = self::loadShiai();
$shiai = $this->getShiai();
return
'<div class="card blue-grey darken-1">' .
'<div class="card-content white-text">' .
@@ -124,13 +121,14 @@ class Event
'<dd>' . $this->deadline->format('Y-m-d') . '</dd>' .
'<dt>Altersklassen</dt>' .
'<dd>' . $this->shiai->getAgeClasses() . '</dd>' .
'</dl>'.
'</div>' .
'</div>';
}
public function htmlTableRow()
{
$shiai = $this->loadShiai();
$shiai = $this->getShiai();
return
'<tr>' .
'<td>' . $this->date->format('Y-m-d') . '</td>' .