From c5bc01649e3033f73cf29877b0e200f7744e8cf7 Mon Sep 17 00:00:00 2001 From: marko Date: Sat, 25 Mar 2023 17:02:07 +0100 Subject: [PATCH 1/3] bugfix remove starter, return to shiai modal after add starter, startertype info in startertable and shiai modal --- homepage/participo/api.starter.remove.php | 6 ++-- .../lib/participoLib/dbConnector.php | 4 ++- homepage/participo/lib/participoLib/event.php | 28 ++++--------------- .../participo/lib/participoLib/participo.php | 3 +- .../participo/lib/participoLib/starter.php | 22 ++++++++------- 5 files changed, 23 insertions(+), 40 deletions(-) diff --git a/homepage/participo/api.starter.remove.php b/homepage/participo/api.starter.remove.php index bc6130a..6087eae 100644 --- a/homepage/participo/api.starter.remove.php +++ b/homepage/participo/api.starter.remove.php @@ -16,12 +16,10 @@ dbConnector::connect( participo::authentificate(); -$eventId = $_POST['eventId'] ?? null; -$starterId = $_POST['userId'] ?? null; - +$starterId = $_POST['starterId'] ?? null; $returnToUrl = $_POST['returnToUrl'] ?? 'participo/'; -$starter = new Starter(null, $eventId, null, $starterId); +$starter = Starter::loadFromDb($starterId); $starter->removeFromDb(); header('Location: ' . urldecode($returnToUrl), true, 301); diff --git a/homepage/participo/lib/participoLib/dbConnector.php b/homepage/participo/lib/participoLib/dbConnector.php index 1c3bb2e..63bfe9c 100644 --- a/homepage/participo/lib/participoLib/dbConnector.php +++ b/homepage/participo/lib/participoLib/dbConnector.php @@ -38,6 +38,8 @@ class dbConnector if (empty($someOptions['dontFetch'])) { $someOptions['dontFetch'] = false; } + + $ignoreErrors = $someOptions['ignoreErrors'] ?? false; /// @toDo: Bisher wird nur die Rückgabe konvertiert. Eigentlich muss /// doch auch die Eingabe konvertiert werden. Aber das jetzt @@ -63,7 +65,7 @@ class dbConnector ); } $pdoResult = $pdoStatement->execute(); - if (!$pdoResult) { + if (!$ignoreErrors && !$pdoResult) { echo("Error during dbQuery!\n"); echo("DB-Error:\n"); var_dump(self::$db->errorInfo()); diff --git a/homepage/participo/lib/participoLib/event.php b/homepage/participo/lib/participoLib/event.php index 5c2cb5a..dfa52a2 100644 --- a/homepage/participo/lib/participoLib/event.php +++ b/homepage/participo/lib/participoLib/event.php @@ -150,7 +150,7 @@ class Event $kids = participo::getKids(); $modal .= '
'; foreach ($kids as $k) { - $modal .= $this->getHtmlAddStarterForm($k); + $modal .= $this->getHtmlAddStarterForm($k, ['returnToUrl'=>'/participo/events#' . $this->id]); } $modal .= '
'; $modal .= @@ -174,7 +174,7 @@ class Event foreach ($listOfStarter as $start) { $startingUser = $start->loadStarter(); $starterList .= '
' - . '
' . $startingUser->getName() . ', ' . $startingUser->getFirstname() . ':
' + . '
' . $startingUser->getName() . ', ' . $startingUser->getFirstname() . ' ('.StartingType::$AsString[$start->getTypeId()].'):
' . '
' . $start->getHtmlFormRemove() . '
' . '
'; } @@ -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 = - '
' - . '' - . '' - . '' - . '' - . '
'; - - return $form; - } - - public function getHtmlAddStarterForm($user) - { $key = isset($_SESSION['apiKey']) ? $_SESSION['apiKey'] : null; $form = '
' . '' . '' - . '' + . '' . '
' . '' - . '' - . '' + . '' + . '' . '' . ''; From 5e100b9720263561b4702783dee2d0c1e6ec46c0 Mon Sep 17 00:00:00 2001 From: marko Date: Sun, 26 Mar 2023 14:34:52 +0200 Subject: [PATCH 2/3] removed wkOrg submodule --- submodules/wkOrg | 1 - 1 file changed, 1 deletion(-) delete mode 160000 submodules/wkOrg diff --git a/submodules/wkOrg b/submodules/wkOrg deleted file mode 160000 index 41fe0c5..0000000 --- a/submodules/wkOrg +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 41fe0c5a45ec7a480fd3b10719560b4b47ce4fdb From 3f76d8289770ed19a874d6ebb7d667ebfd7a8659 Mon Sep 17 00:00:00 2001 From: marko Date: Sun, 26 Mar 2023 14:42:58 +0200 Subject: [PATCH 3/3] readded wkOrg repository --- .gitmodules | 6 ++++++ submodules/wkOrg | 1 + 2 files changed, 7 insertions(+) create mode 160000 submodules/wkOrg diff --git a/.gitmodules b/.gitmodules index a5a3134..1a2182f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,9 @@ [submodule "submodules/materialize"] path = submodules/materialize url = https://github.com/materializecss/materialize.git +[submodule "submodules/--force"] + path = submodules/--force + url = http://gitea.cwsvjudo.dedyn.io/marko/wkOrg.git +[submodule "submodules/wkOrg"] + path = submodules/wkOrg + url = http://gitea.cwsvjudo.dedyn.io/marko/wkOrg.git diff --git a/submodules/wkOrg b/submodules/wkOrg new file mode 160000 index 0000000..7e81899 --- /dev/null +++ b/submodules/wkOrg @@ -0,0 +1 @@ +Subproject commit 7e81899f08485399df98e177a9ce22d5c0414237