bugfix remove starter, return to shiai modal after add starter, startertype info in startertable and shiai modal

This commit is contained in:
marko
2023-03-25 17:02:07 +01:00
parent 77279da565
commit c5bc01649e
5 changed files with 23 additions and 40 deletions

View File

@@ -202,7 +202,7 @@ class Starter
if ($today > $eventDeadline) {
return self::getHtmlModalToLate($this->id);
}
return self::getHtmlFormRemoveStarterFromEvent($this->id, $this->eventId, $class);
return self::getHtmlFormRemoveStarterFromEvent($this->getId(), $class);
}
// inject html code of table with coming starts for the session user
@@ -212,7 +212,7 @@ class Starter
echo(self::getHtmlTableComingStarts($userId));
}
// Member
// member variables
// - static member
/** Name of the table with all the starts
*
@@ -338,8 +338,9 @@ class Starter
':typeId' => ['value' => $typeId, 'data_type' => PDO::PARAM_INT],
':userId' => ['value' => $userId, 'data_type' => PDO::PARAM_INT]
];
$response = dbConnector::query($query, $params);
// @todo remove ignoreErrors again
// @todo Inserting-Starter-Statement returns false on execution: Why? It seems to succeed!
$response = dbConnector::query($query, $params, ['ignoreErrors'=>true]);
return dbConnector::getLastInsertId();
}
@@ -405,7 +406,7 @@ class Starter
private static function getHtmlTable($starts)
{
$html = '<table>'
. '<thead><tr><th>Datum</th><th>Veranstaltung</th><th>Starter</th><th></th></tr></thead>'
. '<thead><tr><th>Datum</th><th>Veranstaltung</th><th>Starter</th><th></th><th></th></tr></thead>'
. '<tbody>';
foreach ($starts as $start) {
$today = new DateTime();
@@ -421,6 +422,7 @@ class Starter
. '<td>' . getHtmlSquareDate($eventDate) . '</td>'
. '<td>' . $shiai->getHtmlName() . '</td>'
. '<td>' . $startingUser->getName() . ', ' . $startingUser->getFirstName() . '</td>'
. '<td>' . StartingType::$AsString[$start->getTypeId()] . '</td>'
. '<td>' . $start->getHtmlFormRemove() . '</td>'
. '</tr>';
}
@@ -430,7 +432,7 @@ class Starter
private static function getHtmlModalToLate($startId, $caption = 'Austragen')
{
$modal = $html = '<a class="btn grey waves-effect waves-light modal-trigger" href="#modal-remove-starter-' . $startId . '">' . $caption . '</a>'
$modal = '<a class="btn grey waves-effect waves-light modal-trigger" href="#modal-remove-starter-' . $startId . '">' . $caption . '</a>'
. '<div id="modal-remove-starter-' . $startId . '" class="modal">'
. '<div class="modal-content">'
. '<p>Das Fenster zum Ein- und Austragen ist bereits geschlossen.</p>'
@@ -443,13 +445,13 @@ class Starter
return $modal;
}
private static function getHtmlFormRemoveStarterFromEvent($starterId, $eventId, $class = null)
private static function getHtmlFormRemoveStarterFromEvent($starterId, $class = null)
{
$returnToUrl = urlencode(getCurPagesUrl());
$form =
'<form ' . (isset($class) ? ('class="' . $class . '"') : '') . ' action="api.starter.remove.php" method="post">'
. '<input type="hidden" name="returnToUrl" id="returnToUrl" value="' . urlencode(getCurPagesUrl()) . '" >'
. '<input type="hidden" name="eventId" id="eventId" value="' . $eventId . '">'
. '<input type="hidden" name="userId" id="userId" value="' . $starterId . '">'
. '<input type="hidden" name="returnToUrl" id="returnToUrl" value="' . $returnToUrl . '" >'
. '<input type="hidden" name="starterId" id="starterId" value="' . $starterId . '">'
. '<button class="btn red" type="submit" name="submit">austragen</button>'
. '</form>';