Exemplo n.º 1
0
             // show notification
             if ($message == "201") {
                 $revokeRightsNotifications[] = MakeNotification("success", Language::Get('main', 'successRemoveUser', $langTemplate));
             }
         } else {
             // otherwise show conflict page
             set_error("409");
             exit;
         }
     } else {
         $revokeRightsNotifications[] = MakeNotification("error", Language::Get('main', 'noSelectedUser', $langTemplate));
     }
 } elseif ($_POST['action'] == "AddUser") {
     $f = new FormEvaluator($_POST);
     $f->checkStringForKey('userName', FormEvaluator::REQUIRED, 'warning', Language::Get('main', 'invalidUserName', $langTemplate), array('min' => 1));
     $f->checkIntegerForKey('rights', FormEvaluator::REQUIRED, 'warning', Language::Get('main', 'invalidCourseStatus', $langTemplate), array('min' => 0, 'max' => 2));
     if ($f->evaluate(true)) {
         $foundValues = $f->foundValues;
         $userName = $foundValues['userName'];
         $rights = $foundValues['rights'];
         $URL = $databaseURI . '/user/user/' . $userName;
         $user = http_get($URL, true);
         $user = json_decode($user, true);
         if (isset($user['id'])) {
             $userId = $user['id'];
             $newUser = User::createCourseStatus($userId, $cid, $rights);
             $newUser = User::encodeUser($newUser);
             $URL = $databaseURI . '/coursestatus';
             http_post_data($URL, $newUser, true, $message);
             if ($message == "201") {
                 $addUserNotifications[] = MakeNotification('success', Language::Get('main', 'successAddUser', $langTemplate));
Exemplo n.º 2
0
         }
     }
     $URI = $serverURI . "/logic/LMarking/marking";
     http_post_data($URI, Marking::encodeMarking($markings), true, $message);
     if ($message == "201" || $message == "200") {
         $msg = Language::Get('main', 'successAssignment', $langTemplate);
         $assignManuallyNotifications[] = MakeNotification("success", $msg);
     } else {
         $msg = Language::Get('main', 'errorAssignment', $langTemplate);
         $assignManuallyNotifications[] = MakeNotification("error", $msg);
     }
 }
 // assigns manually chosen submissions to the selected tutor
 if (isset($_POST['actionAssignManually'])) {
     $f = new FormEvaluator($_POST);
     $f->checkIntegerForKey('tutorId', FormEvaluator::REQUIRED, 'warning', Language::Get('main', 'invalidTutor', $langTemplate));
     $f->checkArrayOfArraysForKey('assign', FormEvaluator::REQUIRED, 'warning', Language::Get('main', 'invalidSelection', $langTemplate));
     if ($f->evaluate(true)) {
         // extracts the php POST data
         $foundValues = $f->foundValues;
         $selectedTutorID = $foundValues['tutorId'];
         $assigns = cleanInput($_POST['assign']);
         $markings = array();
         foreach ($assigns as $owner => $ass) {
             $markingList = isset($ass['marking']) ? $ass['marking'] : array();
             $proposals = isset($ass['proposal']) ? $ass['proposal'] : array();
             // change assignment only if different source and target
             if ($owner != $selectedTutorID) {
                 foreach ($markingList as $markingId => $subs) {
                     $subs = $subs[0];
                     $sub = new Submission();
Exemplo n.º 3
0
 $hasChangedSubmission = false;
 foreach ($exercises as $exerciseId => $exercise) {
     $maxPoints = cleanInput($exercise['maxPoints']);
     $submissionID = cleanInput($exercise['submissionID']);
     $markingID = cleanInput($exercise['markingID']);
     $userName = isset($exercise['user']) ? $exercise['user'] : '******';
     if (isset($exercise['points'])) {
         $exercise['points'] = str_replace(',', '.', $exercise['points']);
     }
     $f = new FormEvaluator($exercise);
     $f->checkNumberForKey('points', FormEvaluator::OPTIONAL, 'warning', Language::Get('main', 'invalidPoints', $langTemplate), array('min' => 0));
     $f->checkStringForKey('tutorComment', FormEvaluator::OPTIONAL, 'warning', Language::Get('main', 'invalidComment', $langTemplate), array('min' => 1));
     /**
      * @todo get maxStatusID for FormEvaluator.
      */
     $f->checkIntegerForKey('status', FormEvaluator::OPTIONAL, 'warning', Language::Get('main', 'invalidStatus', $langTemplate), array('min' => 0, 'max' => $maxMarkingStatus));
     $f->checkIntegerForKey('accepted', FormEvaluator::OPTIONAL, 'warning', Language::Get('main', 'invalidAcceptance', $langTemplate), array('min' => 0, 'max' => 1));
     if ($f->evaluate(true)) {
         $foundValues = $f->foundValues;
         $changed = false;
         $points = isset($foundValues['points']) ? $foundValues['points'] : null;
         if ($points > $maxPoints) {
             $msg = Language::Get('main', 'tooManyPoints', $langTemplate, array('maxPoints' => $maxPoints));
             if (!isset($GroupNotificationElements[$key])) {
                 $GroupNotificationElements[$key] = array();
             }
             $GroupNotificationElements[$key][] = MakeNotification("warning", $msg);
         }
         if (!isset($exercise['oldPoints']) && $points != null || isset($exercise['oldPoints']) && $points != $exercise['oldPoints']) {
             $changed = true;
             ///echo "A";
Exemplo n.º 4
0
if (isset($_POST['action'])) {
    // && $_POST['action'] == "new"
    $timestamp = time();
    $errorInSent = false;
    // validate all sheet data
    $f = new FormEvaluator($_POST);
    $f->checkStringForKey('sheetName', FormEvaluator::REQUIRED, 'error', Language::Get('main', 'invalidSheetName', $langTemplate));
    $f->checkStringForKey('startDate', FormEvaluator::REQUIRED, 'warning', Language::Get('main', 'invalidPeriodBegin', $langTemplate));
    $f->checkStringForKey('endDate', FormEvaluator::REQUIRED, 'warning', Language::Get('main', 'invalidPeriodEnd', $langTemplate));
    // check if defaultGroupSize is bigger than standard groupsize 10
    if ($createsheetData['user']['courses'][0]['course']['defaultGroupSize'] < 10) {
        $maxgroup = 10;
    } else {
        $maxgroup = $createsheetData['user']['courses'][0]['course']['defaultGroupSize'];
    }
    $f->checkIntegerForKey('groupSize', FormEvaluator::REQUIRED, 'warning', Language::Get('main', 'invalidGroupSize', $langTemplate), array('min' => 0, 'max' => $maxgroup));
    /*$f->checkArrayOfArraysForKey('exercises',
      FormEvaluator::REQUIRED,
      'warning',
      'Bitte erstellen Sie mindestens eine Aufgabe.');*/
    // check if startDate is not later than endDate and if it matches format
    $correctDates = true;
    /*if (strtotime(str_replace(" - ", " ", $_POST['startDate'])) > strtotime(str_replace(" - ", " ", $_POST['endDate']))
          || !preg_match("#^\d\d.\d\d.\d\d\d\d - \d\d:\d\d$#", $_POST['startDate'])
          || !preg_match("#^\d\d.\d\d.\d\d\d\d - \d\d:\d\d$#", $_POST['endDate'])) {
          $correctDates = false;
          $errormsg = "Überprüfen Sie Bearbeitungsanfang sowie Bearbeitungsende!";
          array_push($notifications, MakeNotification('warning', $errormsg));
      }*/
    // check if sheetPDF is given
    $noFile = false;