コード例 #1
0
 public function getNextRequestableHint()
 {
     $query = "\n\t\t\tSELECT\t\tqht_hint_id\n\t\t\t\n\t\t\tFROM\t\tqpl_hints\n\t\t\t\n\t\t\tWHERE\t\tqht_question_fi = %s\n\t\t\t\n\t\t\tORDER BY\tqht_hint_index ASC\n\t\t";
     $res = $this->db->queryF($query, array('integer'), array($this->previewSession->getQuestionId()));
     while ($row = $this->db->fetchAssoc($res)) {
         if (!$this->isRequested($row['qht_hint_id'])) {
             return ilAssQuestionHint::getInstanceById($row['qht_hint_id']);
         }
     }
     throw new ilTestException("no next hint found for questionId={$this->previewSession->getQuestionId()}, userId={$this->previewSession->getUserId()}");
 }
コード例 #2
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);
 }