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


PHP Process::setAttachment方法代码示例

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


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

示例1: postSubmission


//.........这里部分代码省略.........
                     if (strpos($mimeType, $type[0]) !== false && (!isset($type[1]) || '.' . $foundExtension == $type[1])) {
                         $found = true;
                         break;
                     }
                 }
                 if (!$found && count($exerciseFileTypes) > 0) {
                     $submission->addMessage("falscher Dateityp \nGefunden: " . $mimeType . " ." . $foundExtension . "\nErlaubt: " . implode(',', $types));
                     $res[] = $submission;
                     $this->app->response->setStatus(409);
                     unlink($filePath);
                     continue;
                 }
                 unlink($filePath);
             }
         } else {
             if ($result2['status'] != 404) {
                 $submission->addMessage("Interner Fehler");
                 $res[] = $submission;
                 $this->app->response->setStatus(409);
                 continue;
             }
         }
         // process submission
         if ($processors !== null) {
             if (!is_array($processors)) {
                 $processors = array($processors);
             }
             foreach ($processors as $pro) {
                 $component = $pro->getTarget();
                 if ($process->getExercise() === null) {
                     $process->setExercise($pro->getExercise());
                 }
                 $process->setParameter($pro->getParameter());
                 $process->setAttachment($pro->getAttachment());
                 $process->setTarget($pro->getTarget());
                 $process->setWorkFiles($pro->getWorkFiles());
                 //echo Process::encodeProcess($process)."_______";// return;
                 $result = Request::post($component->getAddress() . '/process', array(), Process::encodeProcess($process));
                 //echo $result['content'].'_______';
                 if ($result['status'] >= 200 && $result['status'] <= 299) {
                     $process = Process::decodeProcess($result['content']);
                 } else {
                     $fail = true;
                     $submission->addMessage("Beim Verarbeiten der Einsendung ist ein Fehler aufgetreten");
                     if (isset($result['content'])) {
                         $content = Process::decodeProcess($result['content']);
                         $submission->setStatus($content->getStatus());
                         $submission->addMessages($content->getMessages());
                     }
                     break;
                 }
             }
         }
         if ($fail) {
             if (isset($submission)) {
                 $submission->setFile(null);
             }
             $res[] = $submission;
             $this->app->response->setStatus(409);
             continue;
         }
         // upload submission
         $uploadSubmission = $process->getSubmission();
         if ($uploadSubmission === null) {
             $uploadSubmission = $process->getRawSubmission();
             if ($uploadSubmission->getFile() != null) {
开发者ID:sawh,项目名称:ostepu-system,代码行数:67,代码来源:LProcessor.php

示例2: array

     $processor->SetTarget($component);
     $processor->SetProcessId(isset($subexercise['processorId'][$tempKey]) ? $subexercise['processorId'][$tempKey] : null);
     // add attachement if given
     if (isset($_FILES['exercises']) && isset($_FILES['exercises']['error']) && isset($_FILES['exercises']['error'][$key1]) && isset($_FILES['exercises']['error'][$key1]['subexercises']) && isset($_FILES['exercises']['error'][$key1]['subexercises'][$key2]) && isset($_FILES['exercises']['error'][$key1]['subexercises'][$key2]['processAttachment']) && isset($_FILES['exercises']['error'][$key1]['subexercises'][$key2]['processAttachment'][$tempKey])) {
         if ($_FILES['exercises']['error'][$key1]['subexercises'][$key2]['processAttachment'][$tempKey] != 4) {
             $filePath = $_FILES['exercises']['tmp_name'][$key1]['subexercises'][$key2]['processAttachment'][$tempKey];
             $displayName = $_FILES['exercises']['name'][$key1]['subexercises'][$key2]['processAttachment'][$tempKey];
             $attachments = array();
             foreach ($filePath as $attachKey => $attachPath) {
                 $attachment = new Attachment();
                 $attachementFile = File::createFile(NULL, $displayName[$attachKey], NULL, $timestamp, NULL, NULL, NULL);
                 $attachementFile->setBody(Reference::createReference($attachPath));
                 $attachment->setFile($attachementFile);
                 $attachments[] = $attachment;
             }
             $processor->setAttachment($attachments);
         }
     }
     $tempProcessors[$tempKey] = $processor;
 }
 if (isset($subexercise['processorParameterList']) && !empty($subexercise['processorParameterList']) && $subexercise['processorParameterList'] !== '') {
     $processorParameter = $subexercise['processorParameterList'];
     foreach ($processorParameter as $tempKey => $Data) {
         $Data2 = array();
         foreach ($Data as &$dat) {
             if ($dat !== '') {
                 $Data2[] = $dat;
             }
         }
         if (isset($tempProcessors[$tempKey])) {
             $tempProcessors[$tempKey]->setParameter(implode(' ', array_values($Data2)));
开发者ID:sawh,项目名称:ostepu-system,代码行数:31,代码来源:CreateSheet.php


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