コード例 #1
0
 public function calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
 {
     return $this->getPointsForSelectedPositions($previewSession->getParticipantsSolution());
 }
コード例 #2
0
 protected function savePreviewData(ilAssQuestionPreviewSession $previewSession)
 {
     $solution = $previewSession->getParticipantsSolution();
     if ($this->is_multiple_choice && strlen($_GET['remImage'])) {
         unset($solution[(int) $_GET['remImage']]);
     }
     if (strlen($_GET['selImage'])) {
         if (!$this->is_multiple_choice) {
             $solution = array();
         }
         $solution[(int) $_GET['selImage']] = (int) $_GET['selImage'];
     }
     $previewSession->setParticipantsSolution($solution);
 }
コード例 #3
0
 public function calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
 {
     $user_order = array();
     $nested_solution = false;
     foreach ($previewSession->getParticipantsSolution() as $val1 => $val2) {
         if (strcmp($val1, "") != 0 && strcmp($val2, "") != 0) {
             if (strchr($val2, ':') == true) {
                 $current_solution = explode(':', $val2);
                 $user_order[$current_solution[0]]['index'] = $val1;
                 $user_order[$current_solution[0]]['depth'] = $current_solution[1];
                 $user_order[$current_solution[0]]['random_id'] = $current_solution[0];
                 $nested_solution = true;
             } else {
                 $user_order[$val2] = $val1;
                 $nested_solution = false;
             }
         }
     }
     return $this->calculateReachedPointsForSolution($user_order, $nested_solution);
 }
コード例 #4
0
 protected function savePreviewData(ilAssQuestionPreviewSession $previewSession)
 {
     $userSolution = $previewSession->getParticipantsSolution();
     foreach ($this->getSolutionSubmit() as $key => $val) {
         $matches = null;
         if (preg_match("/^result_(\\\$r\\d+)\$/", $key, $matches)) {
             $userSolution[$matches[1]] = $val;
         } else {
             if (preg_match("/^result_(\\\$r\\d+)_unit\$/", $key, $matches)) {
                 $userSolution[$matches[1] . "_unit"] = $val;
             }
         }
     }
     $previewSession->setParticipantsSolution($userSolution);
 }
コード例 #5
0
 public function calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
 {
     $points = 0;
     foreach ($previewSession->getParticipantsSolution() as $solution) {
         if (isset($solution['points'])) {
             $points += $solution['points'];
         }
     }
     return $points;
 }
コード例 #6
0
 protected function savePreviewData(ilAssQuestionPreviewSession $previewSession)
 {
     $userSolution = $previewSession->getParticipantsSolution();
     if (!is_array($userSolution)) {
         $userSolution = array();
     }
     if (strcmp($_POST['cmd'][$this->questionActionCmd], $this->lng->txt('delete')) == 0) {
         if (is_array($_POST['deletefiles']) && count($_POST['deletefiles']) > 0) {
             $userSolution = $this->deletePreviewFileUploads($previewSession->getUserId(), $userSolution, $_POST['deletefiles']);
         } else {
             ilUtil::sendInfo($this->lng->txt('no_checkbox'), true);
         }
     } else {
         if (strlen($_FILES["upload"]["tmp_name"])) {
             if ($this->checkUpload()) {
                 if (!@file_exists($this->getPreviewFileUploadPath($previewSession->getUserId()))) {
                     ilUtil::makeDirParents($this->getPreviewFileUploadPath($previewSession->getUserId()));
                 }
                 $version = time();
                 $filename_arr = pathinfo($_FILES["upload"]["name"]);
                 $extension = $filename_arr["extension"];
                 $newfile = "file_" . md5($_FILES["upload"]["name"]) . "_" . $version . "." . $extension;
                 ilUtil::moveUploadedFile($_FILES["upload"]["tmp_name"], $_FILES["upload"]["name"], $this->getPreviewFileUploadPath($previewSession->getUserId()) . $newfile);
                 $userSolution[$newfile] = array('solution_id' => $newfile, 'value1' => $newfile, 'value2' => $_FILES['upload']['name'], 'tstamp' => $version, 'webpath' => $this->getPreviewFileUploadPathWeb($previewSession->getUserId()));
             }
         }
     }
     $previewSession->setParticipantsSolution($userSolution);
 }
コード例 #7
0
 public function calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
 {
     foreach ($this->answers as $key => $answer) {
         if ($key == $previewSession->getParticipantsSolution()) {
             return $answer->getPoints();
         }
     }
     return 0;
 }
コード例 #8
0
ファイル: class.assNumeric.php プロジェクト: bheyser/qplskl
 public function calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
 {
     $points = 0;
     if ($this->contains($previewSession->getParticipantsSolution())) {
         $points = $this->getPoints();
     }
     return $points;
 }
コード例 #9
0
ファイル: class.assClozeTest.php プロジェクト: bheyser/qplskl
 public function calculateReachedPointsFromPreviewSession(ilAssQuestionPreviewSession $previewSession)
 {
     $userSolution = array();
     foreach ($previewSession->getParticipantsSolution() as $key => $val) {
         $userSolution[] = array('gap_id' => $key, 'value' => $val);
     }
     return $this->calculateReachedPointsForSolution($userSolution);
 }