} else { $notifications[] = MakeNotification("success", Language::Get('main', 'successLeaveGroup', $langTemplate)); } } } // updates the selectedSubmissions for the group if ($_POST['action'] == "ManageGroup" && isset($_POST['exercises'])) { $exercises = cleanInput($_POST['exercises']); // bool which is true if any error occured $RequestError = false; // extracts the exerciseIDs and the submissionIDs and updates // the selectedSubmissions foreach ($exercises as $key => $value) { $exerciseID = $key; $submissionID = $value; updateSelectedSubmission($databaseURI, $uid, $submissionID, $exerciseID, $message); if ($message != "201") { $RequestError = true; } } // shows notification if ($RequestError == false) { $notifications[] = MakeNotification("success", Language::Get('main', 'successSelectSubmission', $langTemplate)); } else { $notifications[] = MakeNotification("error", Language::Get('main', 'errorSelectSubmission', $langTemplate)); } } // apply last group if ($_POST['action'] == "InviteGroup" && isset($_POST['applyGroup'])) { $RequestError = false; if (isset($_POST['members'])) {
$sid = $_POST['sheetID']; } if (isset($sid)) { $sheetID = $sid; $_POST['sheetID'] = $sid; } if (isset($_GET['action']) && !isset($_POST['action'])) { $_POST['action'] = $_GET['action']; } // updates the selectedSubmissions for the group if (isset($_POST['updateSelectedSubmission'])) { $obj = json_decode($_POST['updateSelectedSubmission'], true); // bool which is true if any error occured $RequestError = false; $message = null; updateSelectedSubmission($databaseURI, $obj['leaderId'], $obj['id'], $obj['exerciseId'], $message, 1); if ($message != "201") { $RequestError = true; } // shows notification if ($RequestError == false) { $uploadHistoryNotifications[] = MakeNotification("success", Language::Get('main', 'successSelectSubmission', $langTemplate)); } else { $uploadHistoryNotifications[] = MakeNotification("error", Language::Get('main', 'errorSelectSubmission', $langTemplate)); } } // loads data for the settings element $URL = $getSiteURI . "/uploadhistoryoptions/user/{$uid}/course/{$cid}"; $uploadHistoryOptions_data = http_get($URL, true); $uploadHistoryOptions_data = json_decode($uploadHistoryOptions_data, true); $dataList = array();
/** * Creates a submission. * The submission contains a dummy file for consistency reasons * which isn't shown to anyone by setting the 'hideFile' flag * * @param $leaderID The userID of the group leader * @param $eID The id of the exercisesheet * * @return Returns the submission on success, NULL otherwise */ function createSubmission($leaderID, $eID) { global $databaseURI; global $filesystemURI; // creates the new submission including the dummy file $newSubmission = Submission::createSubmission(null, $leaderID, null, $eID, null, 1, time(), null, null, true); $newSubmission = Submission::encodeSubmission($newSubmission); $URI = $databaseURI . "/submission"; $submission = http_post_data($URI, $newSubmission, true, $message); if ($message != "201") { return NULL; } $submission = json_decode($submission, true); $submissionID = $submission['id']; // makes the currently created submission selected updateSelectedSubmission($databaseURI, $leaderID, $submissionID, $eID, $message); if ($message != "201") { return NULL; } return $submission; }