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

@@ -150,7 +150,7 @@ class Event
$kids = participo::getKids();
$modal .= '<div class="row">';
foreach ($kids as $k) {
$modal .= $this->getHtmlAddStarterForm($k);
$modal .= $this->getHtmlAddStarterForm($k, ['returnToUrl'=>'/participo/events#' . $this->id]);
}
$modal .= '</div>';
$modal .=
@@ -174,7 +174,7 @@ class Event
foreach ($listOfStarter as $start) {
$startingUser = $start->loadStarter();
$starterList .= '<div class="col s12 m6"><div class="row valign-wrapper">'
. '<div class="col s6">' . $startingUser->getName() . ', ' . $startingUser->getFirstname() . ':</div>'
. '<div class="col s6">' . $startingUser->getName() . ', ' . $startingUser->getFirstname() . ' ('.StartingType::$AsString[$start->getTypeId()].'):</div>'
. '<div class="col s6">' . $start->getHtmlFormRemove() . '</div>'
. '</div></div>';
}
@@ -236,34 +236,16 @@ class Event
return dbConnector::query($query, $params);
}
// @todo docu
public function getHtmlRemoveStarterForm($starterId)
public function getHtmlAddStarterForm($user, $options = [])
{
$html = self::getHtmlRemoveStarterFromEventForm($this->id, $starterId);
}
$returnToUrl = $options['returnToUrl'] ?? urlencode(getCurPagesUrl());
// returns html code for a button to remove the user from an event
public static function getHtmlRemoveStarterFromEventForm($eventId, $userId, $class = null)
{
$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="' . $userId . '">'
. '<button class="btn red" type="submit" name="submit">austragen</button>'
. '</form>';
return $form;
}
public function getHtmlAddStarterForm($user)
{
$key = isset($_SESSION['apiKey']) ? $_SESSION['apiKey'] : null;
$form =
'<form class="card col s12 m6" action="api.starter.add.php" method="post">'
. '<input type="hidden" name="eventId" id="eventId" value="' . $this->id . '">'
. '<input type="hidden" name="userId" id="userId" value="' . $user->getId() . '">'
. '<input type="hidden" name="returnToUrl" id="returnToUrl" value="' . urlencode(getCurPagesUrl()) . '" >'
. '<input type="hidden" name="returnToUrl" id="returnToUrl" value="' . $returnToUrl . '" >'
. '<div class="input-field">'
. '<select id="selectTypeForm" name="type">'
. '<option value="1" selected="">als Starter</option>'