function editAppointement() { if (!(isset($_POST['title']) && isset($_POST['deadline']) && isset($_POST['options']) && isset($_POST['votes']))) { throw new Exception('Terminabsprache konnte nicht bearbeitet werden. Es wurden nicht alle benötigten Werte gesetzt.'); } $userid = $_SESSION['userid']; $tid = $_SESSION['tid']; unset($_SESSION['tid']); $datesArray = explode(',', $_POST['options']); $votesArray = explode(',', $_POST['votes']); if (count($datesArray) != count($votesArray)) { throw new Exception('Terminabsprache konnte nicht gespeichert werden. Ungleiche Anzahl an Terminen und Stimmen'); } $description = isset($_POST['description']) ? $_POST['description'] : ''; $place = isset($_POST['place']) ? $_POST['place'] : ''; $date = date_parse($_POST['deadline']); $deadline = $date['year'] . '-' . $date['month'] . '-' . $date['day'] . ' ' . $date['hour'] . ':' . $date['minute']; $datesCoord = new DatesCoordination($_POST['title'], $description, $place, $deadline, ''); try { $dbc = new DBConnect(); $dbc->updateDatesCoordination($datesCoord, $tid); $dbc->updateAllUserVotes($userid, $tid, $votesArray, $datesArray); echo "Termin erfolgreich bearbeitet!"; } catch (PDOException $e) { echo "Das Speichern der Terminabsprache war nicht erfolgreich. Versuchen Sie es später noch einmal"; } }