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


PHP ilObjTest::_getUsePreviousAnswers方法代码示例

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


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

示例1: getTestOutput

 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
 {
     // generate the question output
     $template = new ilTemplate("tpl.il_as_qpl_fileupload_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     if ($active_id) {
         $solutions = NULL;
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         $solutions =& $this->object->getSolutionValues($active_id, $pass);
         $files = $this->object->getUploadedFiles($active_id, $pass);
         if (count($files)) {
             include_once "./Modules/TestQuestionPool/classes/tables/class.assFileUploadFileTableGUI.php";
             $table_gui = new assFileUploadFileTableGUI(null, $this->getQuestionActionCmd());
             $table_gui->setTitle($this->lng->txt('already_delivered_files'), 'icon_file.svg', $this->lng->txt('already_delivered_files'));
             $table_gui->setData($files);
             $template->setCurrentBlock("files");
             $template->setVariable('FILES', $table_gui->getHTML());
             $template->parseCurrentBlock();
         }
     }
     if (strlen($this->object->getAllowedExtensions())) {
         $template->setCurrentBlock("allowed_extensions");
         $template->setVariable("TXT_ALLOWED_EXTENSIONS", $this->object->prepareTextareaOutput($this->lng->txt("allowedextensions") . ": " . $this->object->getAllowedExtensions()));
         $template->parseCurrentBlock();
     }
     $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->question, TRUE));
     $template->setVariable("CMD_UPLOAD", $this->getQuestionActionCmd());
     $template->setVariable("TEXT_UPLOAD", $this->object->prepareTextareaOutput($this->lng->txt('upload')));
     $template->setVariable("TXT_UPLOAD_FILE", $this->object->prepareTextareaOutput($this->lng->txt('file_add')));
     $template->setVariable("TXT_MAX_SIZE", $this->object->prepareTextareaOutput($this->lng->txt('file_notice') . " " . $this->object->getMaxFilesizeAsString()));
     $questionoutput = $template->get();
     if (!$show_question_only) {
         // get page object output
         $questionoutput = $this->getILIASPage($questionoutput);
     }
     $questionoutput = $template->get();
     $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
     return $pageoutput;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:43,代码来源:class.assFileUploadGUI.php

示例2: getTestOutput

 /**
  * @param integer		$active_id
  * @param integer|null	$pass
  * @param bool			$is_postponed
  * @param bool			$use_post_solutions
  * @param bool			$show_feedback
  *
  * @return string
  */
 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $showInlineFeedback = FALSE)
 {
     // shuffle output
     $keys = $this->getParticipantsAnswerKeySequence();
     // get the solution of the user for the active pass or from the last pass if allowed
     $user_solution = array();
     if ($active_id) {
         $solutions = NULL;
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         $solutions =& $this->object->getSolutionValues($active_id, $pass);
         foreach ($solutions as $idx => $solution_value) {
             $user_solution[$solution_value["value1"]] = $solution_value["value2"];
         }
     }
     // generate the question output
     include_once "./Services/UICore/classes/class.ilTemplate.php";
     $template = new ilTemplate("tpl.il_as_qpl_mc_kprim_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     foreach ($keys as $answer_id) {
         $answer = $this->object->getAnswer($answer_id);
         if (strlen($answer->getImageFile())) {
             if ($this->object->getThumbSize()) {
                 $template->setCurrentBlock("preview");
                 $template->setVariable("URL_PREVIEW", $answer->getImageWebPath());
                 $template->setVariable("TEXT_PREVIEW", $this->lng->txt('preview'));
                 $template->setVariable("IMG_PREVIEW", ilUtil::getImagePath('enlarge.svg'));
                 $template->setVariable("ANSWER_IMAGE_URL", $answer->getThumbWebPath());
                 list($width, $height, $type, $attr) = getimagesize($answer->getImageFsPath());
                 $alt = $answer->getImageFile();
                 if (strlen($answer->getAnswertext())) {
                     $alt = $answer->getAnswertext();
                 }
                 $alt = preg_replace("/<[^>]*?>/", "", $alt);
                 $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($alt));
                 $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($alt));
                 $template->parseCurrentBlock();
             } else {
                 $template->setCurrentBlock("answer_image");
                 $template->setVariable("ANSWER_IMAGE_URL", $answer->getImageWebPath());
                 list($width, $height, $type, $attr) = getimagesize($answer->getImageFsPath());
                 $alt = $answer->getImageFile();
                 if (strlen($answer->getAnswertext())) {
                     $alt = $answer->getAnswertext();
                 }
                 $alt = preg_replace("/<[^>]*?>/", "", $alt);
                 $template->setVariable("ATTR", $attr);
                 $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($alt));
                 $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($alt));
                 $template->parseCurrentBlock();
             }
         }
         if ($showInlineFeedback) {
             $this->populateSpecificFeedbackInline($user_solution, $answer_id, $template);
         }
         $template->setCurrentBlock("answer_row");
         $template->setVariable("ANSWER_ID", $answer_id);
         $template->setVariable("ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
         $template->setVariable('VALUE_TRUE', 1);
         $template->setVariable('VALUE_FALSE', 0);
         if (isset($user_solution[$answer->getPosition()])) {
             $tplVar = $user_solution[$answer->getPosition()] ? 'CHECKED_ANSWER_TRUE' : 'CHECKED_ANSWER_FALSE';
             $template->setVariable($tplVar, " checked=\"checked\"");
         }
         $template->parseCurrentBlock();
     }
     $questiontext = $this->object->getQuestion();
     $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
     $template->setVariable("INSTRUCTIONTEXT", $this->object->getInstructionTextTranslation($this->lng, $this->object->getOptionLabel()));
     $template->setVariable("OPTION_LABEL_TRUE", $this->object->getTrueOptionLabelTranslation($this->lng, $this->object->getOptionLabel()));
     $template->setVariable("OPTION_LABEL_FALSE", $this->object->getFalseOptionLabelTranslation($this->lng, $this->object->getOptionLabel()));
     $questionoutput = $template->get();
     $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
     return $pageoutput;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:87,代码来源:class.assKprimChoiceGUI.php

示例3: getTestOutput

 /**
  * @param integer		$active_id
  * @param integer|null	$pass
  * @param bool			$is_postponed
  * @param bool			$use_post_solutions
  * @param bool			$show_feedback
  *
  * @return string
  */
 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
 {
     // shuffle output
     $keys = $this->getChoiceKeys();
     // get the solution of the user for the active pass or from the last pass if allowed
     $user_solution = array();
     if ($active_id) {
         $solutions = NULL;
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         $solutions =& $this->object->getSolutionValues($active_id, $pass);
         foreach ($solutions as $idx => $solution_value) {
             array_push($user_solution, $solution_value["value1"]);
         }
     }
     // generate the question output
     include_once "./Services/UICore/classes/class.ilTemplate.php";
     $template = new ilTemplate("tpl.il_as_qpl_mc_mr_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     foreach ($keys as $answer_id) {
         $answer = $this->object->answers[$answer_id];
         if (strlen($answer->getImage())) {
             if ($this->object->getThumbSize()) {
                 $template->setCurrentBlock("preview");
                 $template->setVariable("URL_PREVIEW", $this->object->getImagePathWeb() . $answer->getImage());
                 $template->setVariable("TEXT_PREVIEW", $this->lng->txt('preview'));
                 $template->setVariable("IMG_PREVIEW", ilUtil::getImagePath('enlarge.png'));
                 $template->setVariable("ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $answer->getImage());
                 list($width, $height, $type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
                 $alt = $answer->getImage();
                 if (strlen($answer->getAnswertext())) {
                     $alt = $answer->getAnswertext();
                 }
                 $alt = preg_replace("/<[^>]*?>/", "", $alt);
                 $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($alt));
                 $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($alt));
                 $template->parseCurrentBlock();
             } else {
                 $template->setCurrentBlock("answer_image");
                 $template->setVariable("ANSWER_IMAGE_URL", $this->object->getImagePathWeb() . $answer->getImage());
                 list($width, $height, $type, $attr) = getimagesize($this->object->getImagePath() . $answer->getImage());
                 $alt = $answer->getImage();
                 if (strlen($answer->getAnswertext())) {
                     $alt = $answer->getAnswertext();
                 }
                 $alt = preg_replace("/<[^>]*?>/", "", $alt);
                 $template->setVariable("ATTR", $attr);
                 $template->setVariable("ANSWER_IMAGE_ALT", ilUtil::prepareFormOutput($alt));
                 $template->setVariable("ANSWER_IMAGE_TITLE", ilUtil::prepareFormOutput($alt));
                 $template->parseCurrentBlock();
             }
         }
         if ($show_feedback && $this->object->getSpecificFeedbackSetting() == 2) {
             foreach ($user_solution as $mc_solution) {
                 if (strcmp($mc_solution, $answer_id) == 0) {
                     $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
                     if (strlen($fb)) {
                         $template->setCurrentBlock("feedback");
                         $template->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($fb, true));
                         $template->parseCurrentBlock();
                     }
                 }
             }
         }
         if ($show_feedback && $this->object->getSpecificFeedbackSetting() == 1) {
             $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
             if (strlen($fb)) {
                 $template->setCurrentBlock("feedback");
                 $template->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($fb, true));
                 $template->parseCurrentBlock();
             }
         }
         if ($show_feedback && $this->object->getSpecificFeedbackSetting() == 3) {
             $answer = $this->object->getAnswer($answer_id);
             if ($answer->getPoints() > 0) {
                 $fb = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
                 if (strlen($fb)) {
                     $template->setCurrentBlock("feedback");
                     $template->setVariable("FEEDBACK", $this->object->prepareTextareaOutput($fb, true));
                     $template->parseCurrentBlock();
                 }
             }
         }
         $template->setCurrentBlock("answer_row");
         $template->setVariable("ANSWER_ID", $answer_id);
         $template->setVariable("ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
         foreach ($user_solution as $mc_solution) {
             if (strcmp($mc_solution, $answer_id) == 0) {
//.........这里部分代码省略.........
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:101,代码来源:class.assMultipleChoiceGUI.php

示例4: getTestOutput

 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
 {
     // generate the question output
     $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     $elements = $this->object->getRandomOrderingElements();
     if ($active_id) {
         $solutions = NULL;
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         $solutions =& $this->object->getSolutionValues($active_id, $pass);
         if (count($solutions) == 1) {
             $elements = split("{::}", $solutions[0]["value1"]);
         }
     }
     if (count($solutions) == 0) {
         $_SESSION['qst_ordering_horizontal_elements'] = $elements;
     } else {
         unset($_SESSION['qst_ordering_horizontal_elements']);
     }
     foreach ($elements as $id => $element) {
         $template->setCurrentBlock("element");
         $template->setVariable("ELEMENT_ID", "e_" . $this->object->getId() . "_{$id}");
         $template->setVariable("ORDERING_VALUE", ilUtil::prepareFormOutput($element));
         $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
         $template->parseCurrentBlock();
     }
     $template->setVariable("QUESTION_ID", $this->object->getId());
     if ($this->object->textsize >= 10) {
         $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
     }
     $template->setVariable("VALUE_ORDERRESULT", ' value="' . join($elements, '{::}') . '"');
     $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
     $questionoutput = $template->get();
     if (!$show_question_only) {
         // get page object output
         $questionoutput = $this->getILIASPage($questionoutput);
     }
     $this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/orderinghorizontal.js");
     $questionoutput = $template->get();
     $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
     return $pageoutput;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:46,代码来源:class.assOrderingHorizontalGUI.php

示例5: getTestOutput

 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
 {
     // generate the question output
     $template = new ilTemplate("tpl.il_as_qpl_orderinghorizontal_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     $elements = $this->object->getRandomOrderingElements();
     if ($active_id) {
         $solutions = NULL;
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         $solutions =& $this->object->getSolutionValues($active_id, $pass);
         if (count($solutions) == 1) {
             $elements = split("{::}", $solutions[0]["value1"]);
         }
     }
     if (strlen($_SESSION['qst_selection'])) {
         $this->object->moveRight($_SESSION['qst_selection'], $active_id, $pass);
         unset($_SESSION['qst_selection']);
         $solutions =& $this->object->getSolutionValues($active_id, $pass);
         if (count($solutions) == 1) {
             $elements = split("{::}", $solutions[0]["value1"]);
         }
     }
     if (count($solutions) == 0) {
         $_SESSION['qst_ordering_horizontal_elements'] = $elements;
     } else {
         unset($_SESSION['qst_ordering_horizontal_elements']);
     }
     $idx = 0;
     foreach ($elements as $id => $element) {
         $template->setCurrentBlock("element");
         $template->setVariable("ELEMENT_ID", "e_" . $this->object->getId() . "_{$id}");
         $template->setVariable("ELEMENT_VALUE", ilUtil::prepareFormOutput($element));
         $this->ctrl->setParameterByClass('iltestoutputgui', 'qst_selection', $idx);
         $idx++;
         $url = $this->ctrl->getLinkTargetByClass('iltestoutputgui', 'gotoQuestion');
         $template->setVariable("MOVE_RIGHT", $url);
         $template->setVariable("TEXT_MOVE_RIGHT", $this->lng->txt('move_right'));
         $template->setVariable("RIGHT_IMAGE", ilUtil::getImagePath('nav_arr_R.png'));
         $template->parseCurrentBlock();
     }
     if ($this->object->textsize >= 10) {
         echo $template->setVariable("STYLE", " style=\"font-size: " . $this->object->textsize . "%;\"");
     }
     $template->setVariable("VALUE_ORDERRESULT", ' value="' . join($elements, '{::}') . '"');
     $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
     $questionoutput = $template->get();
     if (!$show_question_only) {
         // get page object output
         $questionoutput = $this->getILIASPage($questionoutput);
     }
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initDragDropAnimation();
     $this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/orderinghorizontal.js");
     $questionoutput = $template->get();
     $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
     return $pageoutput;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:61,代码来源:class.assOrderingHorizontalGUI.php

示例6: getTestOutput

 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE)
 {
     $userdata = $this->object->getActiveUserData($active_id);
     // generate the question output
     include_once "./Services/UICore/classes/class.ilTemplate.php";
     $template = new ilTemplate("tpl.il_as_qpl_javaapplet_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "test_type");
     include_once "./Modules/Test/classes/class.ilObjTest.php";
     if (ilObjTest::_lookupAnonymity(ilObjTest::_getObjectIDFromTestID($userdata["test_id"]))) {
         $template->setVariable("PARAM_VALUE", "0");
     } else {
         $template->setVariable("PARAM_VALUE", "1");
     }
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "active_id");
     $template->setVariable("PARAM_VALUE", $active_id);
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "test_id");
     $template->setVariable("PARAM_VALUE", $userdata["test_id"]);
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "question_id");
     $template->setVariable("PARAM_VALUE", $this->object->getId());
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "user_id");
     $template->setVariable("PARAM_VALUE", $userdata["user_id"]);
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "points_max");
     $template->setVariable("PARAM_VALUE", $this->object->getPoints());
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "session_id");
     $template->setVariable("PARAM_VALUE", $_COOKIE["PHPSESSID"]);
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "client");
     $template->setVariable("PARAM_VALUE", CLIENT_ID);
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "pass");
     $actualpass = ilObjTest::_getPass($active_id);
     $template->setVariable("PARAM_VALUE", $actualpass);
     $template->parseCurrentBlock();
     $template->setCurrentBlock("appletparam");
     $template->setVariable("PARAM_NAME", "post_url");
     $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/Modules/TestQuestionPool/save_question_post_data.php");
     $template->parseCurrentBlock();
     // additional parameters
     for ($i = 0; $i < $this->object->getParameterCount(); $i++) {
         $parameter = $this->object->getParameter($i);
         $template->setCurrentBlock("appletparam");
         $template->setVariable("PARAM_NAME", $parameter["name"]);
         $template->setVariable("PARAM_VALUE", $parameter["value"]);
         $template->parseCurrentBlock();
     }
     if ($active_id) {
         $solutions = NULL;
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         $info = $this->object->getReachedInformation($active_id, $pass);
         foreach ($info as $kk => $infodata) {
             $template->setCurrentBlock("appletparam");
             $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_1");
             $template->setVariable("PARAM_VALUE", $infodata["value1"]);
             $template->parseCurrentBlock();
             $template->setCurrentBlock("appletparam");
             $template->setVariable("PARAM_NAME", "value_" . $infodata["order"] . "_2");
             $template->setVariable("PARAM_VALUE", $infodata["value2"]);
             $template->parseCurrentBlock();
         }
         include_once './Services/Administration/classes/class.ilSetting.php';
         $soapSetting = new ilSetting();
         if ($soapSetting->get("soap_user_administration") == 1) {
             $template->setCurrentBlock("appletparam");
             $template->setVariable("PARAM_NAME", "server");
             $template->setVariable("PARAM_VALUE", ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/webservice/soap/server.php");
         }
     }
     $questiontext = $this->object->getQuestion();
     $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
     $template->setVariable("APPLET_WIDTH", $this->object->getJavaWidth());
     $template->setVariable("APPLET_HEIGHT", $this->object->getJavaHeight());
     $template->setVariable("APPLET_CODE", $this->object->getJavaCode());
     if (strlen($this->object->getJavaArchive()) > 0) {
         $template->setVariable("APPLET_ARCHIVE", " archive=\"" . $this->object->getJavaArchive() . "\"");
     } else {
         if (strpos($this->object->getJavaAppletFilename(), ".jar") !== FALSE) {
             $template->setVariable("APPLET_ARCHIVE", " archive=\"" . $this->object->getJavaPathWeb() . $this->object->getJavaAppletFilename() . "\"");
         }
     }
     if (strlen($this->object->getJavaCodebase()) > 0) {
//.........这里部分代码省略.........
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:101,代码来源:class.assJavaAppletGUI.php

示例7: getSolutionOutput

 /**
  * Get the question solution output
  * @param integer $active_id             The active user id
  * @param integer $pass                  The test pass
  * @param boolean $graphicalOutput       Show visual feedback for right/wrong answers
  * @param boolean $result_output         Show the reached points for parts of the question
  * @param boolean $show_question_only    Show the question without the ILIAS content around
  * @param boolean $show_feedback         Show the question feedback
  * @param boolean $show_correct_solution Show the correct solution instead of the user solution
  * @param boolean $show_manual_scoring   Show specific information for the manual scoring output
  * @return The solution output of the question as HTML code
  */
 function getSolutionOutput($active_id, $pass = NULL, $graphicalOutput = FALSE, $result_output = FALSE, $show_question_only = TRUE, $show_feedback = FALSE, $show_correct_solution = FALSE, $show_manual_scoring = FALSE, $show_question_text = TRUE)
 {
     // get the solution of the user for the active pass or from the last pass if allowed
     $user_solution = "";
     if ($active_id > 0 && !$show_correct_solution) {
         $solutions = NULL;
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         $user_solution["active_id"] = $active_id;
         $user_solution["pass"] = $pass;
         $solutions =& $this->object->getSolutionValues($active_id, $pass);
         foreach ($solutions as $idx => $solution_value) {
             if (preg_match("/^(\\\$v\\d+)\$/", $solution_value["value1"], $matches)) {
                 $user_solution[$matches[1]] = $solution_value["value2"];
             } else {
                 if (preg_match("/^(\\\$r\\d+)\$/", $solution_value["value1"], $matches)) {
                     if (!array_key_exists($matches[1], $user_solution)) {
                         $user_solution[$matches[1]] = array();
                     }
                     $user_solution[$matches[1]]["value"] = $solution_value["value2"];
                 } else {
                     if (preg_match("/^(\\\$r\\d+)_unit\$/", $solution_value["value1"], $matches)) {
                         if (!array_key_exists($matches[1], $user_solution)) {
                             $user_solution[$matches[1]] = array();
                         }
                         $user_solution[$matches[1]]["unit"] = $solution_value["value2"];
                     }
                 }
             }
         }
     } else {
         if ($active_id) {
             $solutions = NULL;
             include_once "./Modules/Test/classes/class.ilObjTest.php";
             if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
                 if (is_null($pass)) {
                     $pass = ilObjTest::_getPass($active_id);
                 }
             }
             $user_solution = $this->object->getBestSolution($this->object->getSolutionValues($active_id, $pass));
         } elseif (is_object($this->getPreviewSession())) {
             $solutionValues = array();
             foreach ($this->getPreviewSession()->getParticipantsSolution() as $val1 => $val2) {
                 $solutionValues[] = array('value1' => $val1, 'value2' => $val2);
             }
             $user_solution = $this->object->getBestSolution($solutionValues);
         }
     }
     $template = new ilTemplate("tpl.il_as_qpl_formulaquestion_output_solution.html", true, true, 'Modules/TestQuestionPool');
     $questiontext = $this->object->substituteVariables($user_solution, $graphicalOutput, TRUE, $result_output, $this->getPreviewSession());
     $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
     $questionoutput = $template->get();
     $solutiontemplate = new ilTemplate("tpl.il_as_tst_solution_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     $solutiontemplate->setVariable("SOLUTION_OUTPUT", $questionoutput);
     $solutionoutput = $solutiontemplate->get();
     if (!$show_question_only) {
         // get page object output
         $solutionoutput = $this->getILIASPage($solutionoutput);
     }
     return $solutionoutput;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:77,代码来源:class.assFormulaQuestionGUI.php

示例8: getTestOutput

 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
 {
     // get the solution of the user for the active pass or from the last pass if allowed
     $user_solution = "";
     if ($this->object->getIsMultipleChoice()) {
         $user_solution = array();
     }
     if ($active_id) {
         $solutions = NULL;
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         $solutions =& $this->object->getSolutionValues($active_id, $pass);
         foreach ($solutions as $idx => $solution_value) {
             if ($this->object->getIsMultipleChoice()) {
                 $user_solution[] = $solution_value["value1"];
             } else {
                 $user_solution = $solution_value["value1"];
             }
         }
     }
     $imagepath = $this->object->getImagePathWeb() . $this->object->getImageFilename();
     if ($active_id) {
         $solutions = NULL;
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         if (!$showsolution && !ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         $solutions =& $this->object->getSolutionValues($active_id, $pass);
         include_once "./Modules/TestQuestionPool/classes/class.ilImagemapPreview.php";
         $preview = new ilImagemapPreview($this->object->getImagePath() . $this->object->getImageFilename());
         foreach ($solutions as $idx => $solution_value) {
             if (strcmp($solution_value["value1"], "") != 0) {
                 $preview->addArea($solution_value["value1"], $this->object->answers[$solution_value["value1"]]->getArea(), $this->object->answers[$solution_value["value1"]]->getCoords(), $this->object->answers[$solution_value["value1"]]->getAnswertext(), "", "", true, $this->linecolor);
             }
         }
         $preview->createPreview();
         $imagepath = $this->object->getImagePathWeb() . $preview->getPreviewFilename($this->object->getImagePath(), $this->object->getImageFilename());
     }
     // generate the question output
     include_once "./Services/UICore/classes/class.ilTemplate.php";
     $template = new ilTemplate("tpl.il_as_qpl_imagemap_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     $this->ctrl->setParameterByClass($this->getTargetGuiClass(), "formtimestamp", time());
     $hrefArea = $this->ctrl->getLinkTargetByClass($this->getTargetGuiClass(), $this->getQuestionActionCmd());
     foreach ($this->object->answers as $answer_id => $answer) {
         $template->setCurrentBlock("imagemap_area");
         $parameter = "&amp;selImage={$answer_id}";
         if (is_array($user_solution) && in_array($answer_id, $user_solution)) {
             $parameter = "&amp;remImage={$answer_id}";
         }
         $template->setVariable("HREF_AREA", $hrefArea . $parameter);
         $template->setVariable("SHAPE", $answer->getArea());
         $template->setVariable("COORDS", $answer->getCoords());
         $template->setVariable("ALT", ilUtil::prepareFormOutput($answer->getAnswertext()));
         $template->setVariable("TITLE", ilUtil::prepareFormOutput($answer->getAnswertext()));
         $template->parseCurrentBlock();
         if ($show_feedback) {
             if (!$this->object->getIsMultipleChoice() && strlen($user_solution) && $user_solution == $answer_id) {
                 $feedback = $this->object->feedbackOBJ->getSpecificAnswerFeedbackTestPresentation($this->object->getId(), $answer_id);
                 if (strlen($feedback)) {
                     $template->setCurrentBlock("feedback");
                     $template->setVariable("FEEDBACK", $feedback);
                     $template->parseCurrentBlock();
                 }
             }
         }
     }
     $questiontext = $this->object->getQuestion();
     $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
     $template->setVariable("IMG_SRC", "{$imagepath}");
     $template->setVariable("IMG_ALT", $this->lng->txt("imagemap"));
     $template->setVariable("IMG_TITLE", $this->lng->txt("imagemap"));
     $questionoutput = $template->get();
     $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
     return $pageoutput;
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:81,代码来源:class.assImagemapQuestionGUI.php

示例9: getTestOutput

 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $user_post_solution = FALSE)
 {
     if ($this->object->getOutputType() == OUTPUT_JAVASCRIPT) {
         return $this->getTestOutputJS($active_id, $pass, $is_postponed, $user_post_solution);
     }
     // generate the question output
     include_once "./Services/UICore/classes/class.ilTemplate.php";
     $template = new ilTemplate("tpl.il_as_qpl_matching_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     if ($active_id) {
         $solutions = NULL;
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         if (is_array($user_post_solution)) {
             $solutions = array();
             foreach ($user_post_solution['matching'][$this->object->getId()] as $definition => $term) {
                 array_push($solutions, array("value1" => $term, "value2" => $definition));
             }
         } else {
             $solutions =& $this->object->getSolutionValues($active_id, $pass);
         }
     }
     // shuffle output
     $terms = $this->object->getTerms();
     $definitions = $this->object->getDefinitions();
     switch ($this->object->getShuffle()) {
         case 1:
             $terms = $this->object->pcArrayShuffle($terms);
             if (count($solutions)) {
                 $definitions = $this->sortDefinitionsBySolution($solutions);
             } else {
                 $definitions = $this->object->pcArrayShuffle($definitions);
             }
             break;
         case 2:
             $terms = $this->object->pcArrayShuffle($terms);
             break;
         case 3:
             if (count($solutions)) {
                 $definitions = $this->sortDefinitionsBySolution($solutions);
             } else {
                 $definitions = $this->object->pcArrayShuffle($definitions);
             }
             break;
     }
     $maxcount = max(count($terms), count($definitions));
     for ($i = 0; $i < count($definitions); $i++) {
         $definition = $definitions[$i];
         if (is_object($definition)) {
             if (strlen($definition->picture)) {
                 $template->setCurrentBlock('definition_image');
                 $template->setVariable('ANSWER_IMAGE_URL', $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $definition->picture);
                 $template->setVariable('ANSWER_IMAGE_ALT', strlen($definition->text) ? ilUtil::prepareFormOutput($definition->text) : ilUtil::prepareFormOutput($definition->picture));
                 $template->setVariable('ANSWER_IMAGE_TITLE', strlen($definition->text) ? ilUtil::prepareFormOutput($definition->text) : ilUtil::prepareFormOutput($definition->picture));
                 $template->setVariable('URL_PREVIEW', $this->object->getImagePathWeb() . $definition->picture);
                 $template->setVariable("TEXT_PREVIEW", $this->lng->txt('preview'));
                 $template->setVariable("IMG_PREVIEW", ilUtil::getImagePath('enlarge.png'));
                 $template->setVariable("TEXT_DEFINITION", strlen($definition->text) ? $this->lng->txt('definition') . ' ' . ($i + 1) . ': ' . ilUtil::prepareFormOutput($definition->text) : $this->lng->txt('definition') . ' ' . ($i + 1));
                 $template->parseCurrentBlock();
             } else {
                 $template->setCurrentBlock('definition_text');
                 $template->setVariable("DEFINITION", $this->object->prepareTextareaOutput($definition->text, true));
                 $template->parseCurrentBlock();
             }
         }
         $template->setCurrentBlock('option');
         $template->setVariable("VALUE_OPTION", 0);
         $template->setVariable("TEXT_OPTION", ilUtil::prepareFormOutput($this->lng->txt('please_select')));
         $template->parseCurrentBlock();
         $j = 1;
         foreach ($terms as $term) {
             $template->setCurrentBlock('option');
             $template->setVariable("VALUE_OPTION", $term->identifier);
             $template->setVariable("TEXT_OPTION", strlen($term->text) ? $this->lng->txt('term') . ' ' . $j . ': ' . ilUtil::prepareFormOutput($term->text) : $this->lng->txt('term') . ' ' . $j);
             foreach ($solutions as $solution) {
                 if ($solution["value1"] == $term->identifier && $solution["value2"] == $definition->identifier) {
                     $template->setVariable("SELECTED_OPTION", " selected=\"selected\"");
                 }
             }
             $template->parseCurrentBlock();
             $j++;
         }
         $template->setCurrentBlock('row');
         $template->setVariable("TEXT_MATCHES", $this->lng->txt("matches"));
         if ($this->object->getEstimatedElementHeight() > 0) {
             $template->setVariable("ELEMENT_HEIGHT", " style=\"height: " . $this->object->getEstimatedElementHeight() . "px;\"");
         }
         $template->setVariable("QUESTION_ID", $this->object->getId());
         $template->setVariable("DEFINITION_ID", $definition->identifier);
         $template->parseCurrentBlock();
     }
     $i = 0;
     foreach ($terms as $term) {
         if (strlen($term->picture)) {
             $template->setCurrentBlock('term_image');
             $template->setVariable('ANSWER_IMAGE_URL', $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $term->picture);
             $template->setVariable('ANSWER_IMAGE_ALT', strlen($term->text) ? ilUtil::prepareFormOutput($term->text) : ilUtil::prepareFormOutput($term->picture));
//.........这里部分代码省略.........
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:101,代码来源:class.assMatchingQuestionGUI.php

示例10: getTestOutput

 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE)
 {
     // get page object output
     $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id);
     // get the solution of the user for the active pass or from the last pass if allowed
     $user_solution = "";
     if ($active_id) {
         $solutions = NULL;
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         $solutions =& $this->object->getSolutionValues($active_id, $pass);
     }
     // generate the question output
     include_once "./classes/class.ilTemplate.php";
     $template = new ilTemplate("tpl.il_as_qpl_syntaxtree_output.html", TRUE, TRUE, $this->ownDir);
     $this->tpl->addCss($this->cssDir . "/default.css");
     $this->tpl->addJavascript($this->ownDir . "/js/bracketCount.js");
     $this->tpl->addJavascript($this->ownDir . "/js/url_encode.js");
     $width = $this->object->getMaxTextboxWidth();
     for ($i = 0; $i < $this->object->getCorrectAnswers(); $i++) {
         $template->setCurrentBlock("syntaxtree_row");
         foreach ($solutions as $idx => $solution_value) {
             if ($idx == $i) {
                 $template->setVariable("TEXTFIELD_VALUE", $solution_value["value1"]);
             }
         }
         $template->setVariable("COUNTER", $i + 1);
         $template->setVariable("TEXTFIELD_ID", sprintf("%02d", $i + 1));
         $template->setVariable("TEXTFIELD_SIZE", $width);
         $template->setVariable("GRAPHPATH", $this->ownDir . "/phpsyntaxtree_obj/stgraph.png");
         $template->setVariable("TEXT_PHRASE_HEADER", $this->lng->txt("qpl_qst_syntaxtree_phrase_header"));
         $template->setVariable("TEXT_OPEN_BRACKETS", $this->lng->txt("qpl_qst_syntaxtree_open_brackets"));
         $template->setVariable("TEXT_CLOSED_BRACKETS", $this->lng->txt("qpl_qst_syntaxtree_closed_brackets"));
         $template->setVariable("TEXT_YOUR_GRAPH", $this->lng->txt("qpl_qst_syntaxtree_your_graph"));
         $template->parseCurrentBlock();
     }
     $questiontext = $this->object->getQuestion();
     $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
     $questionoutput = $template->get();
     $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
     return $pageoutput;
 }
开发者ID:prometoys,项目名称:fourtree,代码行数:46,代码来源:class.SyntaxTreeGUI.php

示例11: getTestOutput

 /**
  * Get the HTML output of the question for a test
  *
  * @param integer $active_id The active user id
  * @param integer $pass The test pass
  * @param boolean $is_postponed Question is postponed
  * @param boolean $use_post_solutions Use post solutions
  * @param boolean $show_feedback Show a feedback
  * @return string
  */
 public function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
 {
     $solution = NULL;
     // get the solution of the user for the active pass or from the last pass if allowed
     if ($active_id) {
         require_once './Modules/Test/classes/class.ilObjTest.php';
         if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         // get preferrably the intermediate solution
         $solution = $this->object->getSolutionStored($active_id, $pass, null);
     }
     $questionoutput = $this->getQuestionOutput($solution);
     $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
     return $pageoutput;
 }
开发者ID:ilifau,项目名称:assAccountingQuestion,代码行数:28,代码来源:class.assAccountingQuestionGUI.php

示例12: getTestOutput

 /**
  * Get the HTML output of the question for a test
  * 
  * @param integer $active_id			The active user id
  * @param integer $pass					The test pass
  * @param boolean $is_postponed			Question is postponed
  * @param boolean $use_post_solutions	Use post solutions
  * @param boolean $show_feedback		Show a feedback
  * @return string
  */
 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE, $show_feedback = FALSE)
 {
     global $tpl;
     // get the solution of the user for the active pass or from the last pass if allowed
     $user_solution = array();
     if ($active_id) {
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         $user_solution =& $this->object->getSolutionValues($active_id, $pass);
         if (!is_array($user_solution)) {
             $user_solution = array();
         }
     }
     $template = $this->getJsmeOutputTemplate($this->object->getQuestion(), $this->object->getOptionString(), $user_solution[0]["value1"]);
     $questionoutput = $template->get();
     $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
     return $pageoutput;
 }
开发者ID:ba-al,项目名称:ILIAS-ChemistryQuestion44,代码行数:32,代码来源:class.assJSMEQuestionGUI.php

示例13: getTestOutput

 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $user_post_solution = FALSE)
 {
     $this->tpl->addJavaScript('Modules/TestQuestionPool/js/jquery-ui-1-10-3-fixed.js');
     $this->tpl->addJavaScript('Modules/TestQuestionPool/js/ilMatchingQuestion.js');
     $this->tpl->addCss(ilUtil::getStyleSheetLocation('output', 'test_javascript.css', 'Modules/TestQuestionPool'));
     $template = new ilTemplate("tpl.il_as_qpl_matching_output.html", true, true, "Modules/TestQuestionPool");
     if ($active_id) {
         $solutions = NULL;
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         if (is_array($user_post_solution)) {
             $solutions = array();
             foreach ($user_post_solution['matching'][$this->object->getId()] as $definition => $term) {
                 array_push($solutions, array("value1" => $term, "value2" => $definition));
             }
         } else {
             $solutions =& $this->object->getSolutionValues($active_id, $pass);
         }
         $counter = 0;
         foreach ($solutions as $idx => $solution_value) {
             if ($solution_value["value2"] > -1 && $solution_value["value1"] > -1) {
                 $template->setCurrentBlock("matching_data");
                 $template->setVariable("TERM_ID", $solution_value["value1"]);
                 $template->setVariable("DEFINITION_ID", $solution_value["value2"]);
                 $template->parseCurrentBlock();
             }
             $counter++;
         }
     }
     $terms = $this->object->getTerms();
     $definitions = $this->object->getDefinitions();
     switch ($this->object->getShuffle()) {
         case 1:
             $terms = $this->object->pcArrayShuffle($terms);
             if (count($solutions)) {
                 $definitions = $this->sortDefinitionsBySolution($solutions, $definitions);
             } else {
                 $definitions = $this->object->pcArrayShuffle($definitions);
             }
             break;
         case 2:
             $terms = $this->object->pcArrayShuffle($terms);
             break;
         case 3:
             if (count($solutions)) {
                 $definitions = $this->sortDefinitionsBySolution($solutions, $definitions);
             } else {
                 $definitions = $this->object->pcArrayShuffle($definitions);
             }
             break;
     }
     // create definitions
     $counter = 0;
     foreach ($definitions as $definition) {
         if (strlen($definition->picture)) {
             $template->setCurrentBlock("definition_picture");
             $template->setVariable("DEFINITION_ID", $definition->identifier);
             $template->setVariable("IMAGE_HREF", $this->object->getImagePathWeb() . $definition->picture);
             $thumbweb = $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $definition->picture;
             $thumb = $this->object->getImagePath() . $this->object->getThumbPrefix() . $definition->picture;
             if (!@file_exists($thumb)) {
                 $this->object->rebuildThumbnails();
             }
             $template->setVariable("THUMBNAIL_HREF", $thumbweb);
             $template->setVariable("THUMB_ALT", $this->lng->txt("image"));
             $template->setVariable("THUMB_TITLE", $this->lng->txt("image"));
             $template->setVariable("TEXT_DEFINITION", strlen($definition->text) ? ilUtil::prepareFormOutput($definition->text) : '');
             $template->setVariable("TEXT_PREVIEW", $this->lng->txt('preview'));
             $template->setVariable("IMG_PREVIEW", ilUtil::getImagePath('enlarge.svg'));
             $template->parseCurrentBlock();
         } else {
             $template->setCurrentBlock("definition_text");
             $template->setVariable("DEFINITION", $this->object->prepareTextareaOutput($definition->text, true));
             $template->parseCurrentBlock();
         }
         $template->setCurrentBlock("droparea");
         $template->setVariable("ID_DROPAREA", $definition->identifier);
         $template->setVariable("QUESTION_ID", $this->object->getId());
         $template->parseCurrentBlock();
         $template->setCurrentBlock("definition_data");
         $template->setVariable("DEFINITION_ID", $definition->identifier);
         $template->parseCurrentBlock();
     }
     // create terms
     $counter = 0;
     foreach ($terms as $term) {
         if (strlen($term->picture)) {
             $template->setCurrentBlock("term_picture");
             $template->setVariable("TERM_ID", $term->identifier);
             $template->setVariable("IMAGE_HREF", $this->object->getImagePathWeb() . $term->picture);
             $thumbweb = $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $term->picture;
             $thumb = $this->object->getImagePath() . $this->object->getThumbPrefix() . $term->picture;
             if (!@file_exists($thumb)) {
                 $this->object->rebuildThumbnails();
             }
             $template->setVariable("THUMBNAIL_HREF", $thumbweb);
//.........这里部分代码省略.........
开发者ID:arlendotcn,项目名称:ilias,代码行数:101,代码来源:class.assMatchingQuestionGUI.php

示例14: getTestOutput

 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE)
 {
     // get the solution of the user for the active pass or from the last pass if allowed
     $user_solution = "";
     if ($active_id) {
         $solutions = NULL;
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         $solutions =& $this->object->getSolutionValues($active_id, $pass);
     }
     // generate the question output
     include_once "./Services/UICore/classes/class.ilTemplate.php";
     $template = new ilTemplate("tpl.il_as_qpl_textsubset_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     $width = $this->object->getMaxTextboxWidth();
     for ($i = 0; $i < $this->object->getCorrectAnswers(); $i++) {
         $template->setCurrentBlock("textsubset_row");
         foreach ($solutions as $idx => $solution_value) {
             if ($idx == $i) {
                 $template->setVariable("TEXTFIELD_VALUE", " value=\"" . $solution_value["value1"] . "\"");
             }
         }
         $template->setVariable("COUNTER", $i + 1);
         $template->setVariable("TEXTFIELD_ID", sprintf("%02d", $i + 1));
         $template->setVariable("TEXTFIELD_SIZE", $width);
         $template->parseCurrentBlock();
     }
     $questiontext = $this->object->getQuestion();
     $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
     $questionoutput = $template->get();
     $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
     return $pageoutput;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:36,代码来源:class.assTextSubsetGUI.php

示例15: getTestOutput

 function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $user_post_solution = FALSE)
 {
     // shuffle output
     $keys = array();
     if (is_array($user_post_solution)) {
         $keys = $_SESSION["ordering_keys"];
     } else {
         $keys = array_keys($this->object->answers);
         shuffle($keys);
     }
     $_SESSION["ordering_keys"] = $keys;
     // generate the question output
     include_once "./Services/UICore/classes/class.ilTemplate.php";
     $template = new ilTemplate("tpl.il_as_qpl_ordering_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     if ($this->object->getOutputType() == OUTPUT_JAVASCRIPT) {
         // BEGIN: add javascript code for javascript enabled ordering questions
         $this->tpl->addBlockFile("CONTENT_BLOCK", "head_content", "tpl.il_as_qpl_ordering_output_javascript.html", "Modules/TestQuestionPool");
         $this->tpl->setCurrentBlock("head_content");
         $this->tpl->setVariable("JS_LOCATION", "./Modules/TestQuestionPool/js/toolman/");
         $this->tpl->parseCurrentBlock();
         // END: add javascript code for javascript enabled ordering questions
         // BEGIN: add additional stylesheet for javascript enabled ordering questions
         $this->tpl->setCurrentBlock("AdditionalStyle");
         $this->tpl->setVariable("LOCATION_ADDITIONAL_STYLESHEET", ilUtil::getStyleSheetLocation("output", "test_javascript.css", "Modules/TestQuestionPool"));
         $this->tpl->parseCurrentBlock();
         // END: add additional stylesheet for javascript enabled ordering questions
         // BEGIN: onsubmit form action for javascript enabled ordering questions
         $this->tpl->setVariable("ON_SUBMIT", "return saveOrder('orderlist');");
         // END: onsubmit form action for javascript enabled ordering questions
     }
     // get the solution of the user for the active pass or from the last pass if allowed
     if ($active_id) {
         $solutions = NULL;
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         if (!ilObjTest::_getUsePreviousAnswers($active_id, true)) {
             if (is_null($pass)) {
                 $pass = ilObjTest::_getPass($active_id);
             }
         }
         if (is_array($user_post_solution)) {
             $solutions = array();
             foreach ($user_post_solution as $key => $value) {
                 if (preg_match("/order_(\\d+)/", $key, $matches)) {
                     foreach ($this->object->getAnswers() as $answeridx => $answer) {
                         if ($answer->getRandomID() == $matches[1]) {
                             array_push($solutions, array("value1" => $answeridx, "value2" => $value));
                         }
                     }
                 }
             }
         } else {
             $solutions =& $this->object->getSolutionValues($active_id, $pass);
         }
         if ($this->object->getOutputType() == OUTPUT_JAVASCRIPT) {
             $solution_script .= "";
             $jssolutions = array();
             foreach ($solutions as $idx => $solution_value) {
                 if (strcmp($solution_value["value2"], "") != 0 && strcmp($solution_value["value1"], "") != 0) {
                     $jssolutions[$solution_value["value2"]] = $solution_value["value1"];
                 }
             }
             if (count($jssolutions)) {
                 ksort($jssolutions);
                 $js = "";
                 foreach ($jssolutions as $key => $value) {
                     if (is_object($this->object->getAnswer($value))) {
                         $js .= "initialorder.push('id_" . $this->object->getAnswer($value)->getRandomID() . "');";
                     }
                 }
                 $js .= "restoreInitialOrder();";
             }
             if (strlen($js)) {
                 $template->setCurrentBlock("javascript_restore_order");
                 $template->setVariable("RESTORE_ORDER", $js);
                 $template->parseCurrentBlock();
             }
         }
     }
     if ($this->object->getOutputType() != OUTPUT_JAVASCRIPT) {
         foreach ($keys as $idx) {
             $answer = $this->object->answers[$idx];
             if ($this->object->getOrderingType() == OQ_PICTURES) {
                 $template->setCurrentBlock("ordering_row_standard_pictures");
                 $template->setVariable("PICTURE_HREF", $this->object->getImagePathWeb() . $answer->getAnswertext());
                 $thumbweb = $this->object->getImagePathWeb() . $this->object->getThumbPrefix() . $answer->getAnswertext();
                 $thumb = $this->object->getImagePath() . $this->object->getThumbPrefix() . $answer->getAnswertext();
                 if (!@file_exists($thumb)) {
                     $this->object->rebuildThumbnails();
                 }
                 $template->setVariable("THUMB_HREF", $thumbweb);
                 $template->setVariable("THUMB_ALT", $this->lng->txt("thumbnail"));
                 $template->setVariable("THUMB_TITLE", $this->lng->txt("enlarge"));
                 $template->setVariable("ANSWER_ID", $answer->getRandomID());
                 $template->parseCurrentBlock();
             } else {
                 $template->setCurrentBlock("ordering_row_standard_text");
                 $template->setVariable("ANSWER_TEXT", $this->object->prepareTextareaOutput($answer->getAnswertext(), TRUE));
                 $template->setVariable("ANSWER_ID", $answer->getRandomID());
                 $template->parseCurrentBlock();
             }
//.........这里部分代码省略.........
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:101,代码来源:class.assOrderingQuestionGUI.php


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