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


PHP ilObjTest::_getImportDirectory方法代码示例

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


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

示例1: getTstImportArchivDirectory

 /**
  * returns the full path to extracted tst import archiv (tst import dir + tst archiv subdir)
  */
 protected function getTstImportArchivDirectory()
 {
     include_once "./Modules/Test/classes/class.ilObjTest.php";
     return ilObjTest::_getImportDirectory() . '/' . $_SESSION["tst_import_subdir"];
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:8,代码来源:class.assQuestionImport.php

示例2: fromXML


//.........这里部分代码省略.........
                 }
                 break;
             case "processing_time":
                 $this->setProcessingTime($metadata['entry']);
                 break;
             case "starting_time":
                 $iso8601period = $metadata["entry"];
                 if (preg_match("/P(\\d+)Y(\\d+)M(\\d+)DT(\\d+)H(\\d+)M(\\d+)S/", $iso8601period, $matches)) {
                     $this->setStartingTime(sprintf("%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
                     $this->setStartingTimeEnabled(true);
                 }
                 break;
             case "ending_time":
                 $iso8601period = $metadata["entry"];
                 if (preg_match("/P(\\d+)Y(\\d+)M(\\d+)DT(\\d+)H(\\d+)M(\\d+)S/", $iso8601period, $matches)) {
                     $this->setEndingTime(sprintf("%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
                     $this->setEndingTimeEnabled(true);
                 }
                 break;
             case "enable_examview":
                 $this->setEnableExamview($metadata["entry"]);
                 break;
             case 'show_examview_html':
                 $this->setShowExamviewHtml($metadata['entry']);
                 break;
             case 'show_examview_pdf':
                 $this->setShowExamviewPdf($metadata['entry']);
                 break;
             case 'redirection_mode':
                 $this->setRedirectionMode($metadata['entry']);
                 break;
             case 'redirection_url':
                 $this->setRedirectionUrl($metadata['entry']);
                 break;
             case 'examid_in_kiosk':
             case 'examid_in_test_pass':
                 $this->setShowExamIdInTestPassEnabled($metadata['entry']);
                 break;
             case 'show_exam_id':
             case 'examid_in_test_res':
                 $this->setShowExamIdInTestResultsEnabled($metadata['entry']);
                 break;
             case 'enable_archiving':
                 $this->setEnableArchiving($metadata['entry']);
                 break;
             case 'sign_submission':
                 $this->setSignSubmission($metadata['entry']);
                 break;
             case 'char_selector_availability':
                 $this->setCharSelectorAvailability($metadata['entry']);
                 break;
             case 'char_selector_definition':
                 $this->setCharSelectorDefinition($metadata['entry']);
                 break;
             case 'skill_service':
                 $this->setSkillServiceEnabled((bool) $metadata['entry']);
                 break;
             case 'result_tax_filters':
                 $this->setResultFilterTaxIds(strlen($metadata['entry']) ? unserialize($metadata['entry']) : array());
                 break;
             case 'show_grading_status':
                 $this->setShowGradingStatusEnabled((bool) $metadata['entry']);
                 break;
             case 'show_grading_mark':
                 $this->setShowGradingMarkEnabled((bool) $metadata['entry']);
                 break;
         }
         if (preg_match("/mark_step_\\d+/", $metadata["label"])) {
             $xmlmark = $metadata["entry"];
             preg_match("/<short>(.*?)<\\/short>/", $xmlmark, $matches);
             $mark_short = $matches[1];
             preg_match("/<official>(.*?)<\\/official>/", $xmlmark, $matches);
             $mark_official = $matches[1];
             preg_match("/<percentage>(.*?)<\\/percentage>/", $xmlmark, $matches);
             $mark_percentage = $matches[1];
             preg_match("/<passed>(.*?)<\\/passed>/", $xmlmark, $matches);
             $mark_passed = $matches[1];
             $this->mark_schema->addMarkStep($mark_short, $mark_official, $mark_percentage, $mark_passed);
         }
     }
     // handle the import of media objects in XHTML code
     if (is_array($_SESSION["import_mob_xhtml"])) {
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Services/RTE/classes/class.ilRTE.php";
         include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
         foreach ($_SESSION["import_mob_xhtml"] as $mob) {
             $importfile = ilObjTest::_getImportDirectory() . '/' . $mob["uri"];
             if (file_exists($importfile)) {
                 $media_object =& ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, FALSE);
                 ilObjMediaObject::_saveUsage($media_object->getId(), "tst:html", $this->getId());
                 $this->setIntroduction(ilRTE::_replaceMediaObjectImageSrc(str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $this->getIntroduction()), 1));
                 $this->setFinalStatement(ilRTE::_replaceMediaObjectImageSrc(str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $this->getFinalStatement()), 1));
             } else {
                 global $ilLog;
                 $ilLog->write("Error: Could not open XHTML mob file for test introduction during test import. File {$importfile} does not exist!");
             }
         }
         $this->saveToDb();
     }
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:101,代码来源:class.ilObjTest.php

示例3: importVerifiedFileObject

 /**
  * imports question(s) into the questionpool (after verification)
  */
 function importVerifiedFileObject()
 {
     include_once "./Modules/Test/classes/class.ilObjTest.php";
     // create new questionpool object
     $newObj = new ilObjTest(0, true);
     // set type of questionpool object
     $newObj->setType($_GET["new_type"]);
     // set title of questionpool object to "dummy"
     $newObj->setTitle("dummy");
     // set description of questionpool object
     $newObj->setDescription("test import");
     // create the questionpool class in the ILIAS database (object_data table)
     $newObj->create(true);
     // create a reference for the questionpool object in the ILIAS database (object_reference table)
     $newObj->createReference();
     // put the questionpool object in the administration tree
     $newObj->putInTree($_GET["ref_id"]);
     // get default permissions and set the permissions for the questionpool object
     $newObj->setPermissions($_GET["ref_id"]);
     // notify the questionpool object and all its parent objects that a "new" object was created
     $newObj->notify("new", $_GET["ref_id"], $_GET["parent_non_rbac_id"], $_GET["ref_id"], $newObj->getRefId());
     // empty mark schema
     $newObj->mark_schema->flush();
     // start parsing of QTI files
     include_once "./Services/QTI/classes/class.ilQTIParser.php";
     // Handle selection of "no questionpool" as qpl_id = -1 -> use test object id instead.
     // TODO: chek if empty strings in $_POST["qpl_id"] relates to a bug or not
     if ($_POST["qpl_id"] == "-1") {
         $qpl_id = $newObj->id;
     } else {
         $qpl_id = $_POST["qpl_id"];
     }
     $qtiParser = new ilQTIParser($_SESSION["tst_import_qti_file"], IL_MO_PARSE_QTI, $qpl_id, $_POST["ident"]);
     $qtiParser->setTestObject($newObj);
     $result = $qtiParser->startParsing();
     $newObj->saveToDb();
     // import page data
     include_once "./Modules/LearningModule/classes/class.ilContObjParser.php";
     $contParser = new ilContObjParser($newObj, $_SESSION["tst_import_xml_file"], $_SESSION["tst_import_subdir"]);
     $contParser->setQuestionMapping($qtiParser->getImportMapping());
     $contParser->startParsing();
     // import test results
     if (@file_exists($_SESSION["tst_import_results_file"])) {
         include_once "./Modules/Test/classes/class.ilTestResultsImportParser.php";
         $results = new ilTestResultsImportParser($_SESSION["tst_import_results_file"], $newObj);
         $results->startParsing();
     }
     // delete import directory
     ilUtil::delDir(ilObjTest::_getImportDirectory());
     ilUtil::sendSuccess($this->lng->txt("object_imported"), true);
     $newObj->updateMetaData();
     ilUtil::redirect("ilias.php?ref_id=" . $newObj->getRefId() . "&baseClass=ilObjTestGUI");
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:56,代码来源:class.ilObjTestGUI.php

示例4: fromXML


//.........这里部分代码省略.........
                                 foreach ($ifb->material as $material) {
                                     $feedbacksgeneric[1] = $material;
                                 }
                             }
                             if (count($ifb->flow_mat) > 0) {
                                 foreach ($ifb->flow_mat as $fmat) {
                                     if (count($fmat->material)) {
                                         foreach ($fmat->material as $material) {
                                             $feedbacksgeneric[1] = $material;
                                         }
                                     }
                                 }
                             }
                         } else {
                             if (strcmp($ifb->getIdent(), "response_onenotcorrect") == 0) {
                                 // found a feedback for the identifier
                                 if (count($ifb->material)) {
                                     foreach ($ifb->material as $material) {
                                         $feedbacksgeneric[0] = $material;
                                     }
                                 }
                                 if (count($ifb->flow_mat) > 0) {
                                     foreach ($ifb->flow_mat as $fmat) {
                                         if (count($fmat->material)) {
                                             foreach ($fmat->material as $material) {
                                                 $feedbacksgeneric[0] = $material;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $this->object->setTitle($item->getTitle());
     $this->object->setComment($item->getComment());
     $this->object->setAuthor($item->getAuthor());
     $this->object->setOwner($ilUser->getId());
     $this->object->setQuestion($this->object->QTIMaterialToString($item->getQuestiontext()));
     $this->object->setObjId($questionpool_id);
     $this->object->setEstimatedWorkingTime($duration["h"], $duration["m"], $duration["s"]);
     $this->object->setPoints($maxpoints);
     $this->object->setMaxNumOfChars($maxchars);
     $textrating = $item->getMetadataEntry("textrating");
     if (strlen($textrating)) {
         $this->object->setTextRating($textrating);
     }
     $keywords = $item->getMetadataEntry("keywords");
     if (strlen($keywords)) {
         $this->object->setKeywords($keywords);
     }
     $this->object->saveToDb();
     if (count($item->suggested_solutions)) {
         foreach ($item->suggested_solutions as $suggested_solution) {
             $this->object->setSuggestedSolution($suggested_solution["solution"]->getContent(), $suggested_solution["gap_index"], true);
         }
         $this->object->saveToDb();
     }
     foreach ($feedbacksgeneric as $correctness => $material) {
         $m = $this->object->QTIMaterialToString($material);
         $feedbacksgeneric[$correctness] = $m;
     }
     // handle the import of media objects in XHTML code
     $questiontext = $this->object->getQuestion();
     if (is_array($_SESSION["import_mob_xhtml"])) {
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Services/RTE/classes/class.ilRTE.php";
         foreach ($_SESSION["import_mob_xhtml"] as $mob) {
             if ($tst_id > 0) {
                 include_once "./Modules/Test/classes/class.ilObjTest.php";
                 $importfile = ilObjTest::_getImportDirectory() . "/" . $_SESSION["tst_import_subdir"] . "/" . $mob["uri"];
             } else {
                 include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
                 $importfile = ilObjQuestionPool::_getImportDirectory() . "/" . $_SESSION["qpl_import_subdir"] . "/" . $mob["uri"];
             }
             $media_object =& ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, FALSE);
             ilObjMediaObject::_saveUsage($media_object->getId(), "qpl:html", $this->object->getId());
             $questiontext = str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $questiontext);
             foreach ($feedbacksgeneric as $correctness => $material) {
                 $feedbacksgeneric[$correctness] = str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $material);
             }
         }
     }
     $this->object->setQuestion(ilRTE::_replaceMediaObjectImageSrc($questiontext, 1));
     foreach ($feedbacksgeneric as $correctness => $material) {
         $this->object->saveFeedbackGeneric($correctness, ilRTE::_replaceMediaObjectImageSrc($material, 1));
     }
     $this->object->saveToDb();
     if ($tst_id > 0) {
         $q_1_id = $this->object->getId();
         $question_id = $this->object->duplicate(true);
         $tst_object->questions[$question_counter++] = $question_id;
         $import_mapping[$item->getIdent()] = array("pool" => $q_1_id, "test" => $question_id);
     } else {
         $import_mapping[$item->getIdent()] = array("pool" => $this->object->getId(), "test" => 0);
     }
 }
开发者ID:prometoys,项目名称:fourtree,代码行数:101,代码来源:class.SyntaxTreeImport.php

示例5: fromXML


//.........这里部分代码省略.........
             case "show_marker":
                 $this->setShowMarker($metadata["entry"]);
                 break;
             case "fixed_participants":
                 $this->setFixedParticipants($metadata["entry"]);
                 break;
             case "score_reporting":
                 $this->setScoreReporting($metadata["entry"]);
                 break;
             case "shuffle_questions":
                 $this->setShuffleQuestions($metadata["entry"]);
                 break;
             case "count_system":
                 $this->setCountSystem($metadata["entry"]);
                 break;
             case "mc_scoring":
                 $this->setMCScoring($metadata["entry"]);
                 break;
             case "mailnotification":
                 $this->setMailNotification($metadata["entry"]);
                 break;
             case "mailnottype":
                 $this->setMailNotificationType($metadata["entry"]);
                 break;
             case "exportsettings":
                 $this->setExportSettings($metadata['exportsettings']);
                 break;
             case "score_cutting":
                 $this->setScoreCutting($metadata["entry"]);
                 break;
             case "password":
                 $this->setPassword($metadata["entry"]);
                 break;
             case "allowedUsers":
                 $this->setAllowedUsers($metadata["entry"]);
                 break;
             case "allowedUsersTimeGap":
                 $this->setAllowedUsersTimeGap($metadata["entry"]);
                 break;
             case "pass_scoring":
                 $this->setPassScoring($metadata["entry"]);
                 break;
             case "show_summary":
                 $this->setListOfQuestionsSettings($metadata["entry"]);
                 break;
             case "reporting_date":
                 $iso8601period = $metadata["entry"];
                 if (preg_match("/P(\\d+)Y(\\d+)M(\\d+)DT(\\d+)H(\\d+)M(\\d+)S/", $iso8601period, $matches)) {
                     $this->setReportingDate(sprintf("%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
                 }
                 break;
             case "processing_time":
                 $this->setProcessingTime($metadata['entry']);
                 break;
             case "starting_time":
                 $iso8601period = $metadata["entry"];
                 if (preg_match("/P(\\d+)Y(\\d+)M(\\d+)DT(\\d+)H(\\d+)M(\\d+)S/", $iso8601period, $matches)) {
                     $this->setStartingTime(sprintf("%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
                 }
                 break;
             case "ending_time":
                 $iso8601period = $metadata["entry"];
                 if (preg_match("/P(\\d+)Y(\\d+)M(\\d+)DT(\\d+)H(\\d+)M(\\d+)S/", $iso8601period, $matches)) {
                     $this->setEndingTime(sprintf("%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
                 }
                 break;
         }
         if (preg_match("/mark_step_\\d+/", $metadata["label"])) {
             $xmlmark = $metadata["entry"];
             preg_match("/<short>(.*?)<\\/short>/", $xmlmark, $matches);
             $mark_short = $matches[1];
             preg_match("/<official>(.*?)<\\/official>/", $xmlmark, $matches);
             $mark_official = $matches[1];
             preg_match("/<percentage>(.*?)<\\/percentage>/", $xmlmark, $matches);
             $mark_percentage = $matches[1];
             preg_match("/<passed>(.*?)<\\/passed>/", $xmlmark, $matches);
             $mark_passed = $matches[1];
             $this->mark_schema->addMarkStep($mark_short, $mark_official, $mark_percentage, $mark_passed);
         }
     }
     // handle the import of media objects in XHTML code
     if (is_array($_SESSION["import_mob_xhtml"])) {
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Services/RTE/classes/class.ilRTE.php";
         include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
         foreach ($_SESSION["import_mob_xhtml"] as $mob) {
             $importfile = ilObjTest::_getImportDirectory() . '/' . $mob["uri"];
             if (file_exists($importfile)) {
                 $media_object =& ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, FALSE);
                 ilObjMediaObject::_saveUsage($media_object->getId(), "tst:html", $this->getId());
                 $this->setIntroduction(ilRTE::_replaceMediaObjectImageSrc(str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $this->getIntroduction()), 1));
                 $this->setFinalStatement(ilRTE::_replaceMediaObjectImageSrc(str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $this->getFinalStatement()), 1));
             } else {
                 global $ilLog;
                 $ilLog->write("Error: Could not open XHTML mob file for test introduction during test import. File {$importfile} does not exist!");
             }
         }
         $this->saveToDb();
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:101,代码来源:class.ilObjTest.php

示例6: fromXML

 /**
  * Creates a question from a QTI file
  *
  * Receives parameters from a QTI parser and creates a valid ILIAS question object
  *
  * @param object $item The QTI item object
  * @param integer $questionpool_id The id of the parent questionpool
  * @param integer $tst_id The id of the parent test if the question is part of a test
  * @param object $tst_object A reference to the parent test object
  * @param integer $question_counter A reference to a question counter to count the questions of an imported question pool
  * @param array $import_mapping An array containing references to included ILIAS objects
  * @access public
  */
 function fromXML(&$item, $questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 {
     global $ilUser;
     // empty session variable for imported xhtml mobs
     unset($_SESSION["import_mob_xhtml"]);
     $presentation = $item->getPresentation();
     $duration = $item->getDuration();
     $now = getdate();
     $created = sprintf("%04d%02d%02d%02d%02d%02d", $now['year'], $now['mon'], $now['mday'], $now['hours'], $now['minutes'], $now['seconds']);
     $feedbacksgeneric = array();
     $this->object->setTitle($item->getTitle());
     $this->object->setComment($item->getComment());
     $this->object->setAuthor($item->getAuthor());
     $this->object->setOwner($ilUser->getId());
     $this->object->setQuestion($this->object->QTIMaterialToString($item->getQuestiontext()));
     $this->object->setObjId($questionpool_id);
     $this->object->setEstimatedWorkingTime($duration["h"], $duration["m"], $duration["s"]);
     if (preg_match_all("/(\\\$v\\d+)/ims", $this->object->getQuestion(), $matches)) {
         foreach ($matches[1] as $variable) {
             $data = unserialize($item->getMetadataEntry($variable));
             $unit = $this->object->getUnitRepository()->getUnit($data["unitvalue"]);
             require_once 'Modules/TestQuestionPool/classes/class.assFormulaQuestionVariable.php';
             $varObj = new assFormulaQuestionVariable($variable, $data["rangemin"], $data["rangemax"], $unit, $data["precision"], $data["intprecision"]);
             $this->object->addVariable($varObj);
         }
     }
     if (preg_match_all("/(\\\$r\\d+)/ims", $this->object->getQuestion(), $rmatches)) {
         foreach ($rmatches[1] as $result) {
             $data = unserialize($item->getMetadataEntry($result));
             $unit = $this->object->getUnitRepository()->getUnit($data["unitvalue"]);
             require_once 'Modules/TestQuestionPool/classes/class.assFormulaQuestionResult.php';
             if (!is_array($data["rating"])) {
                 $resObj = new assFormulaQuestionResult($result, $data["rangemin"], $data["rangemax"], $data["tolerance"], $unit, $data["formula"], $data["points"], $data["precision"], TRUE);
             } else {
                 $resObj = new assFormulaQuestionResult($result, $data["rangemin"], $data["rangemax"], $data["tolerance"], $unit, $data["formula"], $data["points"], $data["precision"], FALSE, $data["rating"]["sign"], $data["rating"]["value"], $data["rating"]["unit"]);
             }
             $this->object->addResult($resObj);
             if (is_array($data["resultunits"])) {
                 foreach ($data["resultunits"] as $resu) {
                     $ru = $this->object->getUnitRepository()->getUnit($resu["unitvalue"]);
                     if (is_object($ru)) {
                         $this->object->addResultUnit($resObj, $ru);
                     }
                 }
             }
         }
     }
     $this->object->setPoints($item->getMetadataEntry("points"));
     $this->addGeneralMetadata($item);
     // additional content editing mode information
     $this->object->setAdditionalContentEditingMode($this->fetchAdditionalContentEditingModeInformation($item));
     $this->object->saveToDb();
     // handle the import of media objects in XHTML code
     $questiontext = $this->object->getQuestion();
     if (is_array($_SESSION["import_mob_xhtml"])) {
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Services/RTE/classes/class.ilRTE.php";
         foreach ($_SESSION["import_mob_xhtml"] as $mob) {
             if ($tst_id > 0) {
                 include_once "./Modules/Test/classes/class.ilObjTest.php";
                 $importfile = ilObjTest::_getImportDirectory() . "/" . $_SESSION["tst_import_subdir"] . "/" . $mob["uri"];
             } else {
                 include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
                 $importfile = ilObjQuestionPool::_getImportDirectory() . "/" . $_SESSION["qpl_import_subdir"] . "/" . $mob["uri"];
             }
             $media_object =& ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, FALSE);
             ilObjMediaObject::_saveUsage($media_object->getId(), "qpl:html", $this->object->getId());
             $questiontext = str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $questiontext);
         }
     }
     $this->object->setQuestion(ilRTE::_replaceMediaObjectImageSrc($questiontext, 1));
     // additional content editing mode information
     $this->object->setAdditionalContentEditingMode($this->fetchAdditionalContentEditingModeInformation($item));
     $this->object->saveToDb();
     if (count($item->suggested_solutions)) {
         foreach ($item->suggested_solutions as $suggested_solution) {
             $this->object->setSuggestedSolution($suggested_solution["solution"]->getContent(), $suggested_solution["gap_index"], true);
         }
         $this->object->saveToDb();
     }
     if ($tst_id > 0) {
         $q_1_id = $this->object->getId();
         $question_id = $this->object->duplicate(true);
         $tst_object->questions[$question_counter++] = $question_id;
         $import_mapping[$item->getIdent()] = array("pool" => $q_1_id, "test" => $question_id);
     } else {
         $import_mapping[$item->getIdent()] = array("pool" => $this->object->getId(), "test" => 0);
//.........这里部分代码省略.........
开发者ID:arlendotcn,项目名称:ilias,代码行数:101,代码来源:class.assFormulaQuestionImport.php

示例7: fromXML

 /**
  * Creates a question from a QTI file
  *
  * Receives parameters from a QTI parser and creates a valid ILIAS question object
  *
  * @param object $item The QTI item object
  * @param integer $questionpool_id The id of the parent questionpool
  * @param integer $tst_id The id of the parent test if the question is part of a test
  * @param object $tst_object A reference to the parent test object
  * @param integer $question_counter A reference to a question counter to count the questions of an imported question pool
  * @param array $import_mapping An array containing references to included ILIAS objects
  * @access public
  */
 function fromXML(&$item, $questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 {
     global $ilUser;
     // empty session variable for imported xhtml mobs
     unset($_SESSION["import_mob_xhtml"]);
     $presentation = $item->getPresentation();
     $duration = $item->getDuration();
     $now = getdate();
     $created = sprintf("%04d%02d%02d%02d%02d%02d", $now['year'], $now['mon'], $now['mday'], $now['hours'], $now['minutes'], $now['seconds']);
     $feedbacksgeneric = array();
     $this->object->setTitle($item->getTitle());
     $this->object->setComment($item->getComment());
     $this->object->setAuthor($item->getAuthor());
     $this->object->setOwner($ilUser->getId());
     $this->object->setQuestion($this->object->QTIMaterialToString($item->getQuestiontext()));
     $this->object->setObjId($questionpool_id);
     $this->object->setEstimatedWorkingTime($duration["h"], $duration["m"], $duration["s"]);
     $this->object->setPoints($item->getMetadataEntry("points"));
     $this->object->setOptionString($item->getMetadataEntry("option_string"));
     $this->object->setSampleSolution($item->getMetadataEntry("sample_solution"));
     $this->object->saveToDb('', false);
     // handle the import of media objects in XHTML code
     $questiontext = $this->object->getQuestion();
     if (is_array($_SESSION["import_mob_xhtml"])) {
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Services/RTE/classes/class.ilRTE.php";
         foreach ($_SESSION["import_mob_xhtml"] as $mob) {
             if ($tst_id > 0) {
                 include_once "./Modules/Test/classes/class.ilObjTest.php";
                 $importfile = ilObjTest::_getImportDirectory() . '/' . $mob["uri"];
             } else {
                 include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
                 $importfile = ilObjQuestionPool::_getImportDirectory() . '/' . $mob["uri"];
             }
             $media_object =& ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, FALSE);
             ilObjMediaObject::_saveUsage($media_object->getId(), "qpl:html", $this->object->getId());
             $questiontext = str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $questiontext);
         }
     }
     $this->object->setQuestion(ilRTE::_replaceMediaObjectImageSrc($questiontext, 1));
     // feedback
     $feedbacksgeneric = array();
     foreach ($item->itemfeedback as $ifb) {
         if (strcmp($ifb->getIdent(), "response_allcorrect") == 0) {
             // found a feedback for the identifier
             if (count($ifb->material)) {
                 foreach ($ifb->material as $material) {
                     $feedbacksgeneric[1] = $material;
                 }
             }
             if (count($ifb->flow_mat) > 0) {
                 foreach ($ifb->flow_mat as $fmat) {
                     if (count($fmat->material)) {
                         foreach ($fmat->material as $material) {
                             $feedbacksgeneric[1] = $material;
                         }
                     }
                 }
             }
         } else {
             if (strcmp($ifb->getIdent(), "response_onenotcorrect") == 0) {
                 // found a feedback for the identifier
                 if (count($ifb->material)) {
                     foreach ($ifb->material as $material) {
                         $feedbacksgeneric[0] = $material;
                     }
                 }
                 if (count($ifb->flow_mat) > 0) {
                     foreach ($ifb->flow_mat as $fmat) {
                         if (count($fmat->material)) {
                             foreach ($fmat->material as $material) {
                                 $feedbacksgeneric[0] = $material;
                             }
                         }
                     }
                 }
             }
         }
     }
     // genericFeedback
     foreach ($feedbacksgeneric as $correctness => $material) {
         $m = $this->object->QTIMaterialToString($material);
         $feedbacksgeneric[$correctness] = $m;
     }
     foreach ($feedbacksgeneric as $correctness => $material) {
         //$this->object->saveFeedbackGeneric($correctness, ilRTE::_replaceMediaObjectImageSrc($material, 1));
         $this->object->feedbackOBJ->importGenericFeedback($this->object->getId(), $correctness, ilRTE::_replaceMediaObjectImageSrc($material, 1));
//.........这里部分代码省略.........
开发者ID:ba-al,项目名称:ILIAS-ChemistryQuestion44,代码行数:101,代码来源:class.assJSMEQuestionImport.php


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