<?php // automatically assigns all unassigned submissions to the selected tutors if (isset($_POST['action']) && $_POST['action'] == "AssignAutomatically") { set_time_limit(180); $f = new FormEvaluator($_POST); $f->checkArrayOfIntegersForKey('tutorIds', FormEvaluator::REQUIRED, 'warning', Language::Get('main', 'invalidTutors', $langTemplate)); if ($f->evaluate(true)) { // extracts the php POST data $foundValues = $f->foundValues; $selectedTutorIDs = $foundValues['tutorIds']; $data = array('tutors' => array(), 'unassigned' => array()); // load user data from the database for the first time $URL = $getSiteURI . "/tutorassign/user/{$uid}/course/{$cid}/exercisesheet/{$sid}"; $tutorAssign_data = http_get($URL, false); $tutorAssign_data = json_decode($tutorAssign_data, true); // adds all tutors that are selected in the form to the request body foreach ($selectedTutorIDs as $tutorID) { $newTutor = array('tutorId' => $tutorID); $data['tutors'][] = $newTutor; } // adds all unassigned submissions to the request body if (!empty($tutorAssign_data['tutorAssignments'])) { foreach ($tutorAssign_data['tutorAssignments'] as $tutorAssignment) { if ($tutorAssignment['tutor']['userName'] == "unassigned") { foreach ($tutorAssignment['submissions'] as $submission) { unset($submission['unassigned']); $data['unassigned'][] = $submission; } } }
global $globalUserData; Authentication::checkRights(PRIVILEGE_LEVEL::SUPER_ADMIN, null, $uid, $globalUserData); $langTemplate = 'MainSettings_Controller'; Language::loadLanguageFile('de', $langTemplate, 'json', dirname(__FILE__) . '/'); // load Plugins data from LogicController $URI = $serverURI . "/logic/LExtension/link/extension"; $temp = http_get($URI, true); $plugins_data = json_decode($temp, true); if (isset($_POST['action'])) { // creates a new course if ($_POST['action'] == "CreateCourse") { $f = new FormEvaluator($_POST); $f->checkStringForKey('courseName', FormEvaluator::REQUIRED, 'warning', Language::Get('main', 'invalidCourseName', $langTemplate), array('min' => 1)); $f->checkStringForKey('semester', FormEvaluator::REQUIRED, array('min' => 1), 'warning', Language::Get('main', 'invalidSemester', $langTemplate)); $f->checkIntegerForKey('defaultGroupSize', FormEvaluator::REQUIRED, 'warning', Language::Get('main', 'invalidGroupSize', $langTemplate), array('min' => 0)); $f->checkArrayOfIntegersForKey('exerciseTypes', FormEvaluator::OPTIONAL, 'warning', Language::Get('main', 'invalidExerciseType', $langTemplate)); $f->checkArrayOfIntegersForKey('plugins', FormEvaluator::OPTIONAL, 'warning', Language::Get('main', 'noSelectedExtensions', $langTemplate)); if ($f->evaluate(true)) { // bool which is true if any error occured $RequestError = false; $foundValues = $f->foundValues; // extracts the php POST data $courseName = $foundValues['courseName']; $semester = $foundValues['semester']; $defaultGroupSize = $foundValues['defaultGroupSize']; $plugins = $foundValues['plugins']; $exerciseTypes = $foundValues['exerciseTypes']; // creates a new course $newCourse = Course::createCourse(null, $courseName, $semester, $defaultGroupSize); $newCourseSettings = Course::encodeCourse($newCourse); $URI = $logicURI . "/course";