當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Process::setTarget方法代碼示例

本文整理匯總了PHP中Process::setTarget方法的典型用法代碼示例。如果您正苦於以下問題:PHP Process::setTarget方法的具體用法?PHP Process::setTarget怎麽用?PHP Process::setTarget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Process的用法示例。


在下文中一共展示了Process::setTarget方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: postSubmission


//.........這裏部分代碼省略.........
                         $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) {
                 $file = $uploadSubmission->getFile();
開發者ID:sawh,項目名稱:ostepu-system,代碼行數:67,代碼來源:LProcessor.php

示例2: addCourse

 /**
  * Adds the component to a course
  *
  * Called when this component receives an HTTP POST request to
  * /course(/).
  */
 public function addCourse()
 {
     Logger::Log('starts POST AddCourse', LogLevel::DEBUG);
     $header = $this->app->request->headers->all();
     $body = $this->app->request->getBody();
     $courses = Course::decodeCourse($body);
     $processes = array();
     if (!is_array($courses)) {
         $courses = array($courses);
     }
     foreach ($courses as $course) {
         $process = new Process();
         $exercise = new Exercise();
         $exercise->setCourseId($course->getId());
         $process->setExercise($exercise);
         $component = new Component();
         $component->setId($this->_conf->getId());
         $process->setTarget($component);
         $processes[] = $process;
     }
     foreach ($this->_postProcess as $_link) {
         $result = Request::routeRequest('POST', '/process', $header, Process::encodeProcess($processes), $_link, 'process');
         // checks the correctness of the query
         if ($result['status'] >= 200 && $result['status'] <= 299) {
             $this->app->response->setStatus(201);
             if (isset($result['headers']['Content-Type'])) {
                 $this->app->response->headers->set('Content-Type', $result['headers']['Content-Type']);
             }
         } else {
             /* if ($courses->getId()!==null){
                    $this->deleteCourse($courses->getId());
                }*/
             Logger::Log('POST AddCourse failed', LogLevel::ERROR);
             $this->app->response->setStatus(isset($result['status']) ? $result['status'] : 409);
             $this->app->response->setBody(Course::encodeCourse($courses));
             $this->app->stop();
         }
     }
     $this->app->response->setBody(Course::encodeCourse($courses));
 }
開發者ID:sawh,項目名稱:ostepu-system,代碼行數:46,代碼來源:LFormProcessor.php

示例3: addCourse

 /**
  * Adds the component to a course
  *
  * Called when this component receives an HTTP POST request to
  * /course(/).
  */
 public function addCourse()
 {
     Logger::Log('starts POST AddCourse', LogLevel::DEBUG);
     $body = $this->app->request->getBody();
     // die Daten der Veranstaltung kommen über den Aufrufkörper rein
     $courses = Course::decodeCourse($body);
     $processes = array();
     if (!is_array($courses)) {
         $courses = array($courses);
     }
     // wenn die Komponente direkt in mehrere Veranstaltungen eingetragen werden soll,
     // wird das Eintragen für alle vorgenommen
     foreach ($courses as $course) {
         // ab hier wird der neue Eintrag zusammengestellt
         $process = new Process();
         $exercise = new Exercise();
         $exercise->setCourseId($course->getId());
         $process->setExercise($exercise);
         $component = new Component();
         $component->setId($this->_conf->getId());
         $process->setTarget($component);
         // und nun wird gesammelt
         $processes[] = $process;
     }
     // die erstellten Einträge können nun an den Zuständigen geschickt werden
     foreach ($this->_postProcess as $_link) {
         $result = Request::routeRequest('POST', '/process', array(), Process::encodeProcess($processes), $_link, 'process');
         // checks the correctness of the query
         if ($result['status'] >= 200 && $result['status'] <= 299) {
             // wenn der Erstellvorgang erfolgreich war, können wir dies melden
             $this->app->response->setStatus(201);
             if (isset($result['headers']['Content-Type'])) {
                 $this->app->response->headers->set('Content-Type', $result['headers']['Content-Type']);
             }
         } else {
             // der Eintrag konnte nicht erstellt werden
             /* if ($courses->getId()!==null){
                    $this->deleteCourse($courses->getId());
                }*/
             Logger::Log('POST AddCourse failed', LogLevel::ERROR);
             // gibt den Status der "Erstellanfrage" zurück oder eine 409 und zusätzlich
             // das eingehende Veranstaltungsobjekt
             $this->app->response->setStatus(isset($result['status']) ? $result['status'] : 409);
             $this->app->response->setBody(Course::encodeCourse($courses));
             $this->app->stop();
         }
     }
     // die bearbeiteten Veranstaltungen können nun zur Ausgabe hinzugefügt werden
     $this->app->response->setBody(Course::encodeCourse($courses));
 }
開發者ID:sawh,項目名稱:ostepu-system,代碼行數:56,代碼來源:LOOP.php


注:本文中的Process::setTarget方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。