当前位置: 首页>>代码示例>>PHP>>正文


PHP Submission::createSubmission方法代码示例

本文整理汇总了PHP中Submission::createSubmission方法的典型用法代码示例。如果您正苦于以下问题:PHP Submission::createSubmission方法的具体用法?PHP Submission::createSubmission怎么用?PHP Submission::createSubmission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Submission的用法示例。


在下文中一共展示了Submission::createSubmission方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

     $error = 0;
 }
 if ($error === 0) {
     $errormsg = '';
     // prüfe ob nur erlaubte Zeichen im Dateinamen verwendet wurden
     $pregRes = @preg_match("%^((?!\\.)[a-zA-Z0-9\\.\\-_]+)\$%", $file['name']);
     if ($file === null || $pregRes) {
         if (isset($_FILES[$fileName])) {
             $filePath = $file['tmp_name'];
             $uploadFile = File::createFile(null, $file['name'], null, $timestamp, null, null);
             $uploadFile->setBody(Reference::createReference($file['tmp_name']));
         } else {
             $uploadFile = File::createFile(null, null, null, $timestamp, null, null);
             $uploadFile->setBody(Form::encodeForm($formdata), true);
         }
         $uploadSubmission = Submission::createSubmission(null, $uid, null, $exerciseId, $exercise['comment'], 1, $timestamp, null, $leaderId);
         $uploadSubmission->setFile($uploadFile);
         $uploadSubmission->setExerciseName(isset($exercise['name']) ? $exercise['name'] : null);
         $uploadSubmission->setSelectedForGroup('1');
         if ($isExpired) {
             $uploadSubmission->setAccepted(0);
         }
         $URL = $serverURI . '/logic/LProcessor/submission';
         ///echo Submission::encodeSubmission($uploadSubmission);return;
         $result = http_post_data($URL, Submission::encodeSubmission($uploadSubmission), true, $message);
         //echo $result;
         if ($message != "201") {
             $result = Submission::decodeSubmission($result);
             $exercise = $key + 1;
             $errormsg = Language::Get('main', 'errorUploadSubmission', $langTemplate, array('status' => $message, 'exerciseName' => $exercise['name']));
             if ($result !== null && !empty($result)) {
开发者ID:sawh,项目名称:ostepu-system,代码行数:31,代码来源:Upload.php

示例2: exit

                        $tempMarking = Marking::decodeMarking(json_encode($exercise['submission']['marking']));
                        $tempSubmission = Submission::decodeSubmission(json_encode($exercise['submission']));
                        $tempMarking->setSubmission($tempSubmission);
                        $markings[] = $tempMarking;
                    } else {
                        // no marking
                        $tempMarking = Marking::createMarking($newMarkings, $uid, null, $exercise['submission']['id'], null, null, 1, null, $timestamp, null);
                        $newMarkings--;
                        $tempSubmission = Submission::decodeSubmission(json_encode($exercise['submission']));
                        $tempMarking->setSubmission($tempSubmission);
                        $markings[] = $tempMarking;
                    }
                } else {
                    // no submission
                    $tempMarking = Marking::createMarking($newMarkings, $uid, null, null, null, null, 1, null, $timestamp, null);
                    $tempSubmission = Submission::createSubmission($newMarkings, $group['leader']['id'], null, $exercise['id'], null, null, $timestamp, null, $group['leader']['id'], null);
                    $tempSubmission->setSelectedForGroup(1);
                    $newMarkings--;
                    $tempMarking->setSubmission($tempSubmission);
                    $markings[] = $tempMarking;
                }
            }
        }
    }
    $URI = $logicURI . '/tutor/archive/user/' . $uid . '/exercisesheet/' . $sid . '/withnames';
    $csvFile = http_post_data($URI, Marking::encodeMarking($markings), true);
    echo $csvFile;
    exit(0);
}
$markingTool_data['filesystemURI'] = $filesystemURI;
// adds the selected sheetID, tutorID and statusID
开发者ID:sawh,项目名称:ostepu-system,代码行数:31,代码来源:MarkingTool.php

示例3: dirname

Language::loadLanguageFile('de', $langTemplate, 'json', dirname(__FILE__) . '/');
$sheetNotifications = array();
if (isset($_POST['deleteSubmissionWarning'])) {
    $notifications[] = MakeNotification("warning", Language::Get('main', 'askDeleteSubmission', $langTemplate));
} elseif (isset($_POST['deleteSubmission'])) {
    $suid = cleanInput($_POST['deleteSubmission']);
    // extractes the studentId of the submission
    $URI = $databaseURI . "/submission/" . $suid;
    $submission = http_get($URI, true);
    $submission = json_decode($submission, true);
    // only deletes the submission if it belongs to the user
    if ($submission['studentId'] == $uid) {
        $URI = $databaseURI . "/selectedsubmission/submission/" . $suid;
        http_delete($URI, true, $message);
        // todo: treat the case if the previous operation failed
        $submissionUpdate = Submission::createSubmission($suid, null, null, null, null, null, null, 0);
        $URI = $databaseURI . "/submission/submission/" . $suid;
        http_put_data($URI, Submission::encodeSubmission($submissionUpdate), true, $message2);
        if ($message == "201" && $message2 == 201) {
            $notifications[] = MakeNotification("success", Language::Get('main', 'successDeleteSubmission', $langTemplate));
        } else {
            $notifications[] = MakeNotification("error", Language::Get('main', 'errorDeleteSubmission', $langTemplate));
        }
    }
} elseif (isset($_POST['downloadMarkings'])) {
    downloadMarkingsForSheet($uid, $_POST['downloadMarkings']);
}
// load tutor data from GetSite
$URI = $getSiteURI . "/student/user/{$uid}/course/{$cid}";
$student_data = http_get($URI, true);
$student_data = json_decode($student_data, true);
开发者ID:sawh,项目名称:ostepu-system,代码行数:31,代码来源:Student.php

示例4: uploadZip


//.........这里部分代码省略.........
                     // check if markingId exists in transaction
                     if (!isset($transaction['markings'][$markingId])) {
                         // unknown markingId
                         fclose($csv);
                         $this->deleteDir($tempDir);
                         $this->app->response->setStatus(409);
                         $errors[] = "unknown ID: {$markingId}";
                         $this->app->response->setBody(json_encode($errors));
                         $this->app->stop();
                     }
                     ///var_dump($transaction['markings'][$markingId]);
                     $markingData = $transaction['markings'][$markingId];
                     // checks whether the points are less or equal to the maximum points
                     if ($points > $markingData['maxPoints'] || $points < 0) {
                         // too much points
                         ///fclose($csv);
                         ///$this->deleteDir($tempDir);
                         ///$this->app->response->setStatus(409);
                         ///$errors[] = "incorrect points in marking: {$markingId}";
                         ///$this->app->response->setBody(json_encode($errors));
                         ///$this->app->stop();
                     }
                     // checks if file with this markingid exists
                     if ($markingFile == null || $markingFile == '' || file_exists($files . '/' . $markingFile)) {
                         if ($markingFile != '' && $markingFile != null) {
                             $fileAddress = $files . '/' . $markingFile;
                             ///file_get_contents($files.'/'.$markingFile);
                             // file
                             $fileInfo = pathinfo($markingFile);
                             $file = new File();
                             $file->setDisplayName($fileInfo['basename']);
                             $file->setBody(Reference::createReference($fileAddress));
                         } else {
                             $file = null;
                         }
                         if (isset($transaction['markings'][$markingId]['submissionId']) && $transaction['markings'][$markingId]['submissionId'] < 0) {
                             // create new submission object
                             $submissionId = $transaction['markings'][$markingId]['submissionId'];
                             $studentId = $transaction['markings'][$markingId]['studentId'];
                             $exerciseId = $transaction['markings'][$markingId]['exerciseId'];
                             $submission = Submission::createSubmission(null, $studentId, null, $exerciseId, null, 1, time(), null, $leaderId, 1);
                             $submission->setSelectedForGroup('1');
                             ///echo json_encode($submission);return;
                             $result = Request::routeRequest('POST', '/submission', array(), json_encode($submission), $this->_postSubmission, 'submission');
                             if ($result['status'] == 201) {
                                 $transaction['markings'][$markingId]['submissionId'] = json_decode($result['content'], true)['id'];
                             }
                         }
                         // create new marking object
                         $marking = Marking::createMarking($markingId < 0 ? null : $markingId, $userid, null, $transaction['markings'][$markingId]['submissionId'], isset($currectOrder['TUTORCOMMENT']) ? $row[$currectOrder['TUTORCOMMENT']] : null, isset($currectOrder['OUTSTANDING']) ? $row[$currectOrder['OUTSTANDING']] : null, isset($currectOrder['STATUS']) ? $row[$currectOrder['STATUS']] : null, $points, time(), $file == null ? 1 : 0);
                         $marking->setFile($file);
                         /*array(
                           'id' => ($markingId<0 ? null : $markingId),
                           'points' => $points,
                           'outstanding' => isset($currectOrder['OUTSTANDING']) ? $row[$currectOrder['OUTSTANDING']] : null,
                           'tutorId' => $userid,
                           'tutorComment' => isset($currectOrder['TUTORCOMMENT']) ? $row[$currectOrder['TUTORCOMMENT']] : null,
                           'file' => $file,
                           'status' => isset($currectOrder['STATUS']) ? $row[$currectOrder['STATUS']] : null,
                           'date' => time(),
                           'hideFile' => 
                           );*/
                         $markings[] = $marking;
                     } else {
                         //if file with this markingid not exists
                         $errors[] = 'File does not exist: ' . $markingFile;
                         fclose($csv);
                         $this->deleteDir($tempDir);
                         $this->app->response->setStatus(409);
                         $this->app->response->setBody(json_encode($errors));
                         $this->app->stop();
                     }
                 }
             }
             $mark = @json_encode($markings);
             if ($mark !== false) {
                 ///echo json_encode($markings); return;
                 //request to database to edit the markings
                 $result = Request::routeRequest('POST', '/marking', array(), $mark, $this->_postMarking, 'marking');
                 /// TODO: prüfen ob jede hochgeladen wurde
                 if ($result['status'] != 201) {
                     $errors[] = 'send markings failed';
                 }
             } else {
                 $errors[] = 'invalid input';
             }
         } else {
             $errors[] = 'no transaction data';
         }
         fclose($csv);
     } else {
         // if csv file does not exist
         $errors[] = '.csv file does not exist in uploaded zip-Archiv';
     }
     $this->deleteDir($tempDir);
     $this->app->response->setBody(json_encode($errors));
     if (!($errors == array())) {
         $this->app->response->setStatus(409);
     }
 }
开发者ID:sawh,项目名称:ostepu-system,代码行数:101,代码来源:LTutor.php

示例5: updateSubmission

function updateSubmission($submissionId, $accepted)
{
    global $databaseURI;
    $newSubmission = Submission::createSubmission(null, null, null, null, null, $accepted, null, null);
    $newSubmission = Submission::encodeSubmission($newSubmission);
    $URI = $databaseURI . "/submission/{$submissionId}";
    http_put_data($URI, $newSubmission, true, $message);
    if ($message != 201) {
        return false;
    } else {
        return true;
    }
}
开发者ID:sawh,项目名称:ostepu-system,代码行数:13,代码来源:Helpers.php


注:本文中的Submission::createSubmission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。