private function resetCmd()
 {
     $this->previewSession->resetRequestedHints();
     $this->previewSession->setParticipantsSolution(null);
     $this->previewSession->setInstantResponseActive(false);
     ilUtil::sendInfo($this->lng->txt('qst_preview_reset_msg'), true);
     $this->ctrl->redirect($this, self::CMD_SHOW);
 }
 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 savePreviewData(ilAssQuestionPreviewSession $previewSession)
 {
     if (strlen($_POST["qst_" . $this->getId()])) {
         $selection = explode(',', $_POST["qst_{$this->getId()}"]);
     } else {
         $selection = array();
     }
     $previewSession->setParticipantsSolution($selection);
 }
예제 #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);
 }
 protected function savePreviewData(ilAssQuestionPreviewSession $previewSession)
 {
     if ($this->checkSaveData()) {
         $previewSession->setParticipantsSolution($this->getSolutionSubmit());
     }
 }
예제 #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
 protected function savePreviewData(ilAssQuestionPreviewSession $previewSession)
 {
     if (strlen($_POST['multiple_choice_result' . $this->getId() . 'ID'])) {
         $previewSession->setParticipantsSolution($_POST['multiple_choice_result' . $this->getId() . 'ID']);
     } else {
         $previewSession->setParticipantsSolution(null);
     }
 }
예제 #8
0
 protected function savePreviewData(ilAssQuestionPreviewSession $previewSession)
 {
     $submittedMatchings = $this->fetchSubmittedMatchingsFromPost();
     if ($this->checkSubmittedMatchings($submittedMatchings)) {
         $previewSession->setParticipantsSolution($submittedMatchings);
     }
 }
예제 #9
0
 protected function savePreviewData(ilAssQuestionPreviewSession $previewSession)
 {
     $numericSolution = $this->getSolutionSubmit();
     if (!$this->isValidSolutionSubmit($numericSolution)) {
         ilUtil::sendInfo($this->lng->txt("err_no_numeric_value"), true);
     }
     $previewSession->setParticipantsSolution($numericSolution);
 }
 function resetSavedPreviewSession()
 {
     global $ilUser;
     $user_id = $ilUser->getId();
     $question_id = $this->object->getId();
     require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewSession.php';
     $ilAssQuestionPreviewSession = new ilAssQuestionPreviewSession($user_id, $question_id);
     $ilAssQuestionPreviewSession->setParticipantsSolution(array());
 }