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


PHP ilObjTest::_getPass方法代码示例

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


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

示例1: getPassOverview

 /**
  * Returns the pass overview for a given active ID
  *
  * @return string HTML code of the pass overview
  * @access public
  * 
  * @deprecated
  */
 public function getPassOverview($active_id, $targetclass = "", $targetcommand = "", $short = FALSE, $hide_details = FALSE)
 {
     require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
     require_once 'Modules/Test/classes/tables/class.ilTestPassOverviewTableGUI.php';
     $table = new ilTestPassOverviewTableGUI($this, '', $short ? ilTestPassOverviewTableGUI::CONTEXT_SHORT : ilTestPassOverviewTableGUI::CONTEXT_LONG, isset($_GET['pdf']) && $_GET['pdf'] == 1);
     $data = array();
     $counted_pass = $this->object->_getResultPass($active_id);
     $reached_pass = $this->object->_getPass($active_id);
     for ($pass = 0; $pass <= $reached_pass; $pass++) {
         $row = array();
         $finishdate = $this->object->getPassFinishDate($active_id, $pass);
         if ($finishdate > 0) {
             if (!$short) {
                 $result_array =& $this->object->getTestResult($active_id, $pass);
                 if (!$result_array['pass']['total_max_points']) {
                     $percentage = 0;
                 } else {
                     $percentage = $result_array['pass']['total_reached_points'] / $result_array['pass']['total_max_points'] * 100;
                 }
                 $total_max = $result_array['pass']['total_max_points'];
                 $total_reached = $result_array['pass']['total_reached_points'];
                 $total_requested_hints = $result_array['pass']['total_requested_hints'];
             }
             if (!$hide_details) {
                 if (strlen($targetclass) && strlen($targetcommand)) {
                     $this->ctrl->setParameterByClass($targetclass, 'active_id', $active_id);
                     $this->ctrl->setParameterByClass($targetclass, 'pass', $pass);
                     $aslgui = new ilAdvancedSelectionListGUI();
                     $aslgui->setListTitle($this->lng->txt('actions'));
                     $aslgui->setId($pass);
                     $aslgui->addItem($this->lng->txt('tst_pass_details'), 'tst_pass_details', $this->ctrl->getLinkTargetByClass($targetclass, $targetcommand));
                     if ($this->object->isPassDeletionAllowed()) {
                         $aslgui->addItem($this->lng->txt('delete'), 'tst_pass_delete', $this->ctrl->getLinkTargetByClass($targetclass, 'confirmDeletePass'));
                     }
                     $row['pass_details'] = $aslgui->getHTML();
                 }
             }
             if (!$short) {
                 if ($pass == $counted_pass) {
                     $row['scored'] = '&otimes;';
                 } else {
                     $row['scored'] = '';
                 }
             }
             $row['pass'] = $pass + 1;
             $row['date'] = $finishdate;
             if (!$short) {
                 $row['answered'] = $this->object->getAnsweredQuestionCount($active_id, $pass) . ' ' . strtolower($this->lng->txt('of')) . ' ' . (count($result_array) - 2);
                 if ($this->object->isOfferingQuestionHintsEnabled()) {
                     $row['hints'] = $total_requested_hints;
                 }
                 $row['reached'] = $total_reached . ' ' . strtolower($this->lng->txt('of')) . ' ' . $total_max;
                 $row['percentage'] = $percentage;
             }
             $data[] = $row;
         }
     }
     $table->setData($data);
     return $table->getHTML();
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:68,代码来源:class.ilTestServiceGUI.php

示例2: getPassOverviewData

 /**
  * @access public
  * @global	ilObjUser	$ilUser
  * @param	integer		$active_id
  * @param	boolean		$short
  * @return	array		$passOverwiewData
  */
 public function getPassOverviewData($active_id, $short = false)
 {
     $passOverwiewData = array();
     global $ilUser;
     $scoredPass = $this->object->_getResultPass($active_id);
     $lastPass = $this->object->_getPass($active_id);
     $testPercentage = 0;
     $testReachedPoints = 0;
     $testMaxPoints = 0;
     for ($pass = 0; $pass <= $lastPass; $pass++) {
         $passFinishDate = $this->object->getPassFinishDate($active_id, $pass);
         if ($passFinishDate <= 0) {
             continue;
         }
         if (!$short) {
             $resultData =& $this->object->getTestResult($active_id, $pass);
             if (!$resultData["pass"]["total_max_points"]) {
                 $passPercentage = 0;
             } else {
                 $passPercentage = $resultData["pass"]["total_reached_points"] / $resultData["pass"]["total_max_points"] * 100;
             }
             $passMaxPoints = $resultData["pass"]["total_max_points"];
             $passReachedPoints = $resultData["pass"]["total_reached_points"];
             $passAnsweredQuestions = $this->object->getAnsweredQuestionCount($active_id, $pass);
             $passTotalQuestions = count($resultData) - 2;
             if ($pass == $scoredPass) {
                 $isScoredPass = true;
                 if (!$resultData["test"]["total_max_points"]) {
                     $testPercentage = 0;
                 } else {
                     $testPercentage = $resultData["test"]["total_reached_points"] / $resultData["test"]["total_max_points"] * 100;
                 }
                 $testMaxPoints = $resultData["test"]["total_max_points"];
                 $testReachedPoints = $resultData["test"]["total_reached_points"];
                 $passOverwiewData['test'] = array('active_id' => $active_id, 'scored_pass' => $scoredPass, 'max_points' => $testMaxPoints, 'reached_points' => $testReachedPoints, 'percentage' => $testPercentage);
             } else {
                 $isScoredPass = false;
             }
             $passOverwiewData['passes'][] = array('active_id' => $active_id, 'pass' => $pass, 'finishdate' => $passFinishDate, 'max_points' => $passMaxPoints, 'reached_points' => $passReachedPoints, 'percentage' => $passPercentage, 'answered_questions' => $passAnsweredQuestions, 'total_questions' => $passTotalQuestions, 'is_scored_pass' => $isScoredPass);
         }
     }
     return $passOverwiewData;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:50,代码来源:class.ilTestService.php

示例3: getTestOutput

 /**
  * @param integer		$active_id
  * @param integer|null	$pass
  * @param bool			$is_postponed
  * @param bool			$use_post_solutions
  *
  * @return string
  */
 public function getTestOutput($active_id, $pass = NULL, $is_postponed = FALSE, $use_post_solutions = FALSE)
 {
     $solutions = 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);
             }
         }
         $solutions =& $this->object->getSolutionValues($active_id, $pass);
     }
     // generate the question output
     require_once './Services/UICore/classes/class.ilTemplate.php';
     $template = new ilTemplate("tpl.il_as_qpl_numeric_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     if (is_array($solutions)) {
         foreach ($solutions as $solution) {
             $template->setVariable("NUMERIC_VALUE", " value=\"" . $solution["value1"] . "\"");
         }
     }
     $template->setVariable("NUMERIC_SIZE", $this->object->getMaxChars());
     $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:arlendotcn,项目名称:ilias,代码行数:36,代码来源:class.assNumericGUI.php

示例4: saveWorkingData

 /**
  * Saves the learners input of the question to the database.
  * 
  * @access public
  * @param integer $active_id Active id of the user
  * @param integer $pass Test pass
  * @return boolean $status
  */
 public function saveWorkingData($active_id, $pass = NULL)
 {
     global $ilDB;
     global $ilUser;
     if (is_null($pass)) {
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         $pass = ilObjTest::_getPass($active_id);
     }
     $entered_values = 0;
     $result = $ilDB->queryF("SELECT solution_id FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s", array('integer', 'integer', 'integer'), array($active_id, $this->getId(), $pass));
     $row = $ilDB->fetchAssoc($result);
     $update = $row["solution_id"];
     if ($update) {
         if (strlen($_POST["multiple_choice_result"])) {
             $affectedRows = $ilDB->update("tst_solutions", array("value1" => array("clob", $_POST["multiple_choice_result"]), "tstamp" => array("integer", time())), array("solution_id" => array("integer", $update)));
             $entered_values++;
         } else {
             $affectedRows = $ilDB->manipulateF("DELETE FROM tst_solutions WHERE solution_id = %s", array('integer'), array($update));
         }
     } else {
         if (strlen($_POST["multiple_choice_result"])) {
             $next_id = $ilDB->nextId('tst_solutions');
             $affectedRows = $ilDB->insert("tst_solutions", array("solution_id" => array("integer", $next_id), "active_fi" => array("integer", $active_id), "question_fi" => array("integer", $this->getId()), "value1" => array("clob", $_POST['multiple_choice_result']), "value2" => array("clob", null), "pass" => array("integer", $pass), "tstamp" => array("integer", time())));
             $entered_values++;
         }
     }
     if ($entered_values) {
         include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
         if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
             $this->logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
         }
     } else {
         include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
         if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
             $this->logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
         }
     }
     return true;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:47,代码来源:class.assSingleChoice.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_errortext_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);
     }
     $errortext_value = "";
     $selections = array();
     if (is_array($solutions)) {
         foreach ($solutions as $solution) {
             array_push($selections, $solution['value1']);
         }
         $errortext_value = join(",", $selections);
     }
     if ($this->object->getTextSize() >= 10) {
         $template->setVariable("STYLE", " style=\"font-size: " . $this->object->getTextSize() . "%;\"");
     }
     $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
     $errortext = $this->object->createErrorTextOutput($selections);
     $this->ctrl->setParameterByClass($this->getTargetGuiClass(), 'errorvalue', '');
     $template->setVariable("ERRORTEXT", $errortext);
     $template->setVariable("ERRORTEXT_ID", "qst_" . $this->object->getId());
     $template->setVariable("ERRORTEXT_VALUE", $errortext_value);
     $questionoutput = $template->get();
     if (!$show_question_only) {
         // get page object output
         $questionoutput = $this->getILIASPage($questionoutput);
     }
     $this->tpl->addJavascript("./Modules/TestQuestionPool/templates/default/errortext.js");
     $questionoutput = $template->get();
     $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
     return $pageoutput;
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:41,代码来源:class.assErrorTextGUI.php

示例6: saveWorkingData

 /**
  * Saves the learners input of the question to the database.
  * 
  * @param integer $active_id Active id of the user
  * @param integer $pass Test pass
  *                      
  * @return boolean $status
  */
 public function saveWorkingData($active_id, $pass = NULL)
 {
     /** @var $ilDB ilDB */
     global $ilDB;
     if (is_null($pass)) {
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         $pass = ilObjTest::_getPass($active_id);
     }
     $entered_values = 0;
     $this->getProcessLocker()->requestUserSolutionUpdateLock();
     $this->removeCurrentSolution($active_id, $pass);
     $solutionSubmit = $this->getSolutionSubmit();
     foreach ($solutionSubmit as $value) {
         if (strlen($value)) {
             $this->saveCurrentSolution($active_id, $pass, $value, null);
             $entered_values++;
         }
     }
     $this->getProcessLocker()->releaseUserSolutionUpdateLock();
     if ($entered_values) {
         include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
         if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
             $this->logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
         }
     } else {
         include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
         if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
             $this->logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
         }
     }
     return true;
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:40,代码来源:class.assMultipleChoice.php

示例7: 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

示例8: saveWorkingData

 /**
  * Saves the learners input of the question to the database
  * @param integer $test_id The database id of the test containing this question
  * @return boolean Indicates the save status (true if saved successful, false otherwise)
  * @access public
  * @see    $answers
  */
 function saveWorkingData($active_id, $pass = NULL)
 {
     global $ilDB;
     if (is_null($pass)) {
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         $pass = ilObjTest::_getPass($active_id);
     }
     $this->getProcessLocker()->requestUserSolutionUpdateLock();
     $solutionSubmit = $this->getSolutionSubmit();
     $entered_values = FALSE;
     foreach ($solutionSubmit as $key => $value) {
         $matches = null;
         if (preg_match("/^result_(\\\$r\\d+)\$/", $key, $matches)) {
             if (strlen($value)) {
                 $entered_values = TRUE;
             }
             $result = $ilDB->queryF("SELECT solution_id FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s  AND " . $ilDB->like('value1', 'clob', $matches[1]), array('integer', 'integer', 'integer'), array($active_id, $pass, $this->getId()));
             if ($result->numRows()) {
                 while ($row = $ilDB->fetchAssoc($result)) {
                     $affectedRows = $ilDB->manipulateF("DELETE FROM tst_solutions WHERE solution_id = %s", array('integer'), array($row['solution_id']));
                 }
             }
             $affectedRows = $this->saveCurrentSolution($active_id, $pass, $matches[1], str_replace(",", ".", $value));
         } else {
             if (preg_match("/^result_(\\\$r\\d+)_unit\$/", $key, $matches)) {
                 $result = $ilDB->queryF("SELECT solution_id FROM tst_solutions WHERE active_fi = %s AND pass = %s AND question_fi = %s AND " . $ilDB->like('value1', 'clob', $matches[1] . "_unit"), array('integer', 'integer', 'integer'), array($active_id, $pass, $this->getId()));
                 if ($result->numRows()) {
                     while ($row = $ilDB->fetchAssoc($result)) {
                         $affectedRows = $ilDB->manipulateF("DELETE FROM tst_solutions WHERE solution_id = %s", array('integer'), array($row['solution_id']));
                     }
                 }
                 $affectedRows = $this->saveCurrentSolution($active_id, $pass, $matches[1] . "_unit", $value);
             }
         }
     }
     $this->getProcessLocker()->releaseUserSolutionUpdateLock();
     if ($entered_values) {
         include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
         if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
             $this->logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
         }
     } else {
         include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
         if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
             $this->logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
         }
     }
     return true;
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:56,代码来源:class.assFormulaQuestion.php

示例9: 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);
         foreach ($solutions as $idx => $solution_value) {
             $user_solution = $solution_value["value1"];
         }
     }
     // generate the question output
     include_once "./Services/UICore/classes/class.ilTemplate.php";
     $template = new ilTemplate("tpl.il_as_qpl_text_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     if ($this->object->getMaxNumOfChars()) {
         $template->setCurrentBlock("maximum_char_hint");
         $template->setVariable("MAXIMUM_CHAR_HINT", sprintf($this->lng->txt("text_maximum_chars_allowed"), $this->object->getMaxNumOfChars()));
         $template->parseCurrentBlock();
         #mbecker: No such block. $template->setCurrentBlock("has_maxchars");
         $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
         $template->parseCurrentBlock();
         $template->setCurrentBlock("maxchars_counter");
         $template->setVariable("MAXCHARS", $this->object->getMaxNumOfChars());
         $template->setVariable("TEXTBOXSIZE", strlen($this->object->getMaxNumOfChars()));
         $template->setVariable("CHARACTERS", $this->lng->txt("characters"));
         $template->parseCurrentBlock();
     }
     $template->setVariable("ESSAY", ilUtil::prepareFormOutput($user_solution));
     $questiontext = $this->object->getQuestion();
     $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($questiontext, TRUE));
     $questionoutput = $template->get();
     $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initDomEvent();
     return $pageoutput;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:42,代码来源:class.assTextQuestionGUI.php

示例10: 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 = 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();
         }
     }
     // generate the question output
     include_once "./Services/UICore/classes/class.ilTemplate.php";
     $template = new ilTemplate("tpl.il_as_qpl_cloze_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     $output = $this->object->getClozeText();
     foreach ($this->object->getGaps() as $gap_index => $gap) {
         switch ($gap->getType()) {
             case CLOZE_TEXT:
                 $gaptemplate = new ilTemplate("tpl.il_as_qpl_cloze_question_gap_text.html", TRUE, TRUE, "Modules/TestQuestionPool");
                 $gaptemplate->setVariable("TEXT_GAP_SIZE", $this->object->getFixedTextLength() ? $this->object->getFixedTextLength() : $gap->getMaxWidth());
                 $gaptemplate->setVariable("GAP_COUNTER", $gap_index);
                 foreach ($user_solution as $solution) {
                     if (strcmp($solution["value1"], $gap_index) == 0) {
                         $gaptemplate->setVariable("VALUE_GAP", " value=\"" . ilUtil::prepareFormOutput($solution["value2"]) . "\"");
                     }
                 }
                 $output = preg_replace("/\\[gap\\].*?\\[\\/gap\\]/", $gaptemplate->get(), $output, 1);
                 break;
             case CLOZE_SELECT:
                 $gaptemplate = new ilTemplate("tpl.il_as_qpl_cloze_question_gap_select.html", TRUE, TRUE, "Modules/TestQuestionPool");
                 foreach ($gap->getItems() as $item) {
                     $gaptemplate->setCurrentBlock("select_gap_option");
                     $gaptemplate->setVariable("SELECT_GAP_VALUE", $item->getOrder());
                     $gaptemplate->setVariable("SELECT_GAP_TEXT", ilUtil::prepareFormOutput($item->getAnswerText()));
                     foreach ($user_solution as $solution) {
                         if (strcmp($solution["value1"], $gap_index) == 0) {
                             if (strcmp($solution["value2"], $item->getOrder()) == 0) {
                                 $gaptemplate->setVariable("SELECT_GAP_SELECTED", " selected=\"selected\"");
                             }
                         }
                     }
                     $gaptemplate->parseCurrentBlock();
                 }
                 $gaptemplate->setVariable("PLEASE_SELECT", $this->lng->txt("please_select"));
                 $gaptemplate->setVariable("GAP_COUNTER", $gap_index);
                 $output = preg_replace("/\\[gap\\].*?\\[\\/gap\\]/", $gaptemplate->get(), $output, 1);
                 break;
             case CLOZE_NUMERIC:
                 $gaptemplate = new ilTemplate("tpl.il_as_qpl_cloze_question_gap_numeric.html", TRUE, TRUE, "Modules/TestQuestionPool");
                 $gaptemplate->setVariable("TEXT_GAP_SIZE", $this->object->getFixedTextLength() ? $this->object->getFixedTextLength() : $gap->getMaxWidth());
                 $gaptemplate->setVariable("GAP_COUNTER", $gap_index);
                 foreach ($user_solution as $solution) {
                     if (strcmp($solution["value1"], $gap_index) == 0) {
                         $gaptemplate->setVariable("VALUE_GAP", " value=\"" . ilUtil::prepareFormOutput($solution["value2"]) . "\"");
                     }
                 }
                 $output = preg_replace("/\\[gap\\].*?\\[\\/gap\\]/", $gaptemplate->get(), $output, 1);
                 break;
         }
     }
     $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($output, TRUE));
     $questionoutput = $template->get();
     $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
     return $pageoutput;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:70,代码来源:class.assClozeTestGUI.php

示例11: saveWorkingData

 /**
  * Saves the learners input of the question to the database.
  * 
  * @access public
  * @param integer $active_id Active id of the user
  * @param integer $pass Test pass
  * @return boolean $status
  */
 public function saveWorkingData($active_id, $pass = NULL)
 {
     global $ilDB;
     global $ilUser;
     if (is_null($pass)) {
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         $pass = ilObjTest::_getPass($active_id);
     }
     if ($_POST['cmd'][$this->questionActionCmd] != $this->lng->txt('delete') && strlen($_FILES["upload"]["tmp_name"])) {
         $checkUploadResult = $this->checkUpload();
     } else {
         $checkUploadResult = false;
     }
     $result = $ilDB->queryF("SELECT test_fi FROM tst_active WHERE active_id = %s", array('integer'), array($active_id));
     $test_id = 0;
     if ($result->numRows() == 1) {
         $row = $ilDB->fetchAssoc($result);
         $test_id = $row["test_fi"];
     }
     $this->getProcessLocker()->requestUserSolutionUpdateLock();
     $entered_values = false;
     if ($_POST['cmd'][$this->questionActionCmd] == $this->lng->txt('delete')) {
         if (is_array($_POST['deletefiles']) && count($_POST['deletefiles']) > 0) {
             $this->deleteUploadedFiles($_POST['deletefiles'], $test_id, $active_id);
         } else {
             ilUtil::sendInfo($this->lng->txt('no_checkbox'), true);
         }
     } elseif ($checkUploadResult) {
         if (!@file_exists($this->getFileUploadPath($test_id, $active_id))) {
             ilUtil::makeDirParents($this->getFileUploadPath($test_id, $active_id));
         }
         $version = time();
         $filename_arr = pathinfo($_FILES["upload"]["name"]);
         $extension = $filename_arr["extension"];
         $newfile = "file_" . $active_id . "_" . $pass . "_" . $version . "." . $extension;
         ilUtil::moveUploadedFile($_FILES["upload"]["tmp_name"], $_FILES["upload"]["name"], $this->getFileUploadPath($test_id, $active_id) . $newfile);
         $next_id = $ilDB->nextId('tst_solutions');
         $affectedRows = $ilDB->insert("tst_solutions", array("solution_id" => array("integer", $next_id), "active_fi" => array("integer", $active_id), "question_fi" => array("integer", $this->getId()), "value1" => array("clob", $newfile), "value2" => array("clob", $_FILES['upload']['name']), "pass" => array("integer", $pass), "tstamp" => array("integer", time())));
         $entered_values = true;
     }
     $this->getProcessLocker()->releaseUserSolutionUpdateLock();
     if ($entered_values) {
         include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
         if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
             $this->logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
         }
     } else {
         include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
         if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
             $this->logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
         }
     }
     return true;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:62,代码来源:class.assFileUpload.php

示例12: saveWorkingData

 /**
  * Saves the learners input of the question to the database
  *
  * Saves the learners input of the question to the database
  *
  * @param integer $test_id The database id of the test containing this question
  * @return boolean Indicates the save status (true if saved successful, false otherwise)
  * @access public
  * @see $ranges
  */
 function saveWorkingData($active_id, $pass = NULL)
 {
     global $ilDB;
     global $ilUser;
     if (is_null($pass)) {
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         $pass = ilObjTest::_getPass($active_id);
     }
     $entered_values = 0;
     $query = sprintf("DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s", $ilDB->quote($active_id . ""), $ilDB->quote($this->getId() . ""), $ilDB->quote($pass . ""));
     $result = $ilDB->query($query);
     foreach ($_POST as $key => $value) {
         if (preg_match("/^SYNTAXTREE_(\\d+)/", $key, $matches)) {
             if (strlen($value)) {
                 $tstamp = array("integer", time());
                 $next_id = $ilDB->nextId('tst_solutions');
                 $query = sprintf("INSERT INTO tst_solutions (solution_id, active_fi, question_fi, value1, value2, pass, tstamp) VALUES (%s, %s, %s, %s, NULL, %s, %s)", $ilDB->quote($next_id), $ilDB->quote($active_id), $ilDB->quote($this->getId()), $ilDB->quote(trim($value)), $ilDB->quote($pass . ""), $ilDB->quote($tstamp));
                 $result = $ilDB->query($query);
                 $entered_values++;
             }
         }
     }
     if ($entered_values) {
         include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
         if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
             $this->logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
         }
     } else {
         include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
         if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
             $this->logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
         }
     }
     parent::saveWorkingData($active_id, $pass);
     return true;
 }
开发者ID:prometoys,项目名称:fourtree,代码行数:46,代码来源:class.SyntaxTree.php

示例13: saveWorkingData

 /**
  * Saves the learners input of the question to the database.
  * 
  * @param integer $active_id Active id of the user
  * @param integer $pass Test pass
  *                      
  * @return boolean $status
  */
 public function saveWorkingData($active_id, $pass = NULL)
 {
     /** @var $ilDB ilDB */
     global $ilDB;
     if (is_null($pass)) {
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         $pass = ilObjTest::_getPass($active_id);
     }
     $entered_values = 0;
     $ilDB->manipulateF("DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s", array('integer', 'integer', 'integer'), array($active_id, $this->getId(), $pass));
     foreach ($_POST as $key => $value) {
         if (preg_match("/^multiple_choice_result_(\\d+)/", $key, $matches)) {
             if (strlen($value)) {
                 $next_id = $ilDB->nextId('tst_solutions');
                 $ilDB->insert("tst_solutions", array("solution_id" => array("integer", $next_id), "active_fi" => array("integer", $active_id), "question_fi" => array("integer", $this->getId()), "value1" => array("clob", $value), "value2" => array("clob", null), "pass" => array("integer", $pass), "tstamp" => array("integer", time())));
                 $entered_values++;
             }
         }
     }
     if ($entered_values) {
         include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
         if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
             $this->logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
         }
     } else {
         include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
         if (ilObjAssessmentFolder::_enabledAssessmentLogging()) {
             $this->logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
         }
     }
     return true;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:40,代码来源:class.assMultipleChoice.php

示例14: 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_flash_question_output.html", TRUE, TRUE, "Modules/TestQuestionPool");
     $params = array();
     if (is_array($this->object->getParameters())) {
         foreach ($this->object->getParameters() as $name => $value) {
             array_push($params, urlencode($name) . "=" . urlencode($value));
         }
     }
     array_push($params, "session_id=" . urlencode($_COOKIE["PHPSESSID"]));
     array_push($params, "client=" . urlencode(CLIENT_ID));
     array_push($params, "points_max=" . urlencode($this->object->getPoints()));
     array_push($params, "server=" . urlencode(ilUtil::removeTrailingPathSeparators(ILIAS_HTTP_PATH) . "/webservice/soap/server.php?wsdl"));
     if (strlen($pass)) {
         array_push($params, "pass=" . $pass);
     } else {
         include_once "./Modules/Test/classes/class.ilObjTest.php";
         array_push($params, "pass=" . ilObjTest::_getPass($active_id));
     }
     if ($active_id) {
         array_push($params, "active_id=" . $active_id);
     }
     array_push($params, "question_id=" . $this->object->getId());
     if (count($params)) {
         $template->setCurrentBlock("flash_vars");
         $template->setVariable("FLASH_VARS", join($params, "&"));
         $template->parseCurrentBlock();
         $template->setCurrentBlock("applet_parameters");
         $template->setVariable("PARAM_VALUE", join($params, "&"));
         $template->parseCurrentBlock();
     }
     $template->setVariable("QUESTIONTEXT", $this->object->prepareTextareaOutput($this->object->getQuestion(), TRUE));
     $template->setVariable("APPLET_WIDTH", $this->object->getWidth());
     $template->setVariable("APPLET_HEIGHT", $this->object->getHeight());
     $template->setVariable("ID", $this->object->getId());
     $template->setVariable("APPLET_PATH", $this->object->getFlashPathWeb() . $this->object->getApplet());
     $template->setVariable("APPLET_FILE", $this->object->getFlashPathWeb() . $this->object->getApplet());
     $questionoutput = $template->get();
     $pageoutput = $this->outQuestionPage("", $is_postponed, $active_id, $questionoutput);
     return $pageoutput;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:42,代码来源:class.assFlashQuestionGUI.php

示例15: 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


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