/** * export page objects to xml (see ilias_co.dtd) * * @param object $a_xml_writer ilXmlWriter object that receives the * xml data */ function exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog, $questions) { global $ilBench; include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php"; foreach ($questions as $question_id) { $ilBench->start("ContentObjectExport", "exportPageObject"); $expLog->write(date("[y-m-d H:i:s] ") . "Page Object " . $question_id); $attrs = array(); $a_xml_writer->xmlStartTag("PageObject", $attrs); // export xml to writer object $ilBench->start("ContentObjectExport", "exportPageObject_XML"); include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php"; $page_object = new ilAssQuestionPage($question_id); $page_object->buildDom(); $page_object->insertInstIntoIDs($a_inst); $mob_ids = $page_object->collectMediaObjects(false); require_once 'Services/COPage/classes/class.ilPCFileList.php'; $file_ids = ilPCFileList::collectFileItems($page_object, $page_object->getDomDoc()); $xml = $page_object->getXMLFromDom(false, false, false, "", true); $xml = str_replace("&", "&", $xml); $a_xml_writer->appendXML($xml); $page_object->freeDom(); unset($page_object); $ilBench->stop("ContentObjectExport", "exportPageObject_XML"); // collect media objects $ilBench->start("ContentObjectExport", "exportPageObject_CollectMedia"); //$mob_ids = $page_obj->getMediaObjectIDs(); foreach ($mob_ids as $mob_id) { $this->mob_ids[$mob_id] = $mob_id; } $ilBench->stop("ContentObjectExport", "exportPageObject_CollectMedia"); // collect all file items $ilBench->start("ContentObjectExport", "exportPageObject_CollectFileItems"); //$file_ids = $page_obj->getFileItemIds(); foreach ($file_ids as $file_id) { $this->file_ids[$file_id] = $file_id; } $ilBench->stop("ContentObjectExport", "exportPageObject_CollectFileItems"); $a_xml_writer->xmlEndTag("PageObject"); //unset($page_obj); $ilBench->stop("ContentObjectExport", "exportPageObject"); } }
/** * parse pages that contain files, mobs and/or internal links */ function processPagesToParse() { /* $pg_mapping = array(); foreach($this->pg_mapping as $key => $value) { $pg_mapping[$key] = "il__pg_".$value; }*/ //echo "<br><b>processIntLinks</b>"; flush(); // outgoin internal links foreach ($this->pages_to_parse as $page_id) { $page_arr = explode(":", $page_id); //echo "<br>resolve:".$this->content_object->getType().":".$page_id; flush(); switch ($page_arr[0]) { case "lm": switch ($this->content_object->getType()) { case "lm": include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; $page_obj = new ilLMPage($page_arr[1]); break; default: die("Unknown content type " . $this->content_object->getType()); } break; case "gdf": include_once "./Modules/Glossary/classes/class.ilGlossaryDefPage.php"; $page_obj = new ilGlossaryDefPage($page_arr[1]); break; case "qpl": $page_obj = new ilAssQuestionPage($page_arr[1]); break; } $page_obj->buildDom(); $page_obj->resolveIntLinks(); $page_obj->resolveIIMMediaAliases($this->mob_mapping); if (in_array($this->coType, array("lm", "dbk"))) { $page_obj->resolveQuestionReferences($this->qst_mapping); } $page_obj->update(false); if ($page_arr[0] == "gdf") { $def = new ilGlossaryDefinition($page_arr[1]); $def->updateShortText(); } unset($page_obj); } //echo "<br><b>map area internal links</b>"; flush(); // outgoins map area (mob) internal links foreach ($this->mobs_with_int_links as $mob_id) { ilMediaItem::_resolveMapAreaLinks($mob_id); } //echo "<br><b>incoming interna links</b>"; flush(); // incoming internal links $done = array(); foreach ($this->link_targets as $link_target) { //echo "doin link target:".$link_target.":<br>"; $link_arr = explode("_", $link_target); $target_inst = $link_arr[1]; $target_type = $link_arr[2]; $target_id = $link_arr[3]; //echo "<br>-".$target_type."-".$target_id."-".$target_inst."-"; $sources = ilInternalLink::_getSourcesOfTarget($target_type, $target_id, $target_inst); foreach ($sources as $key => $source) { //echo "got source:".$key.":<br>"; if (in_array($key, $done)) { continue; } $type_arr = explode(":", $source["type"]); // content object pages if ($type_arr[1] == "pg") { if (ilPageObject::_exists($type_arr[0], $source["id"])) { include_once "./Services/COPage/classes/class.ilPageObjectFactory.php"; $page_object = ilPageObjectFactory::getInstance($type_arr[0], $source["id"]); $page_object->buildDom(); $page_object->resolveIntLinks(); $page_object->update(); unset($page_object); } } // eventually correct links in questions to learning modules if ($type_arr[0] == "qst") { require_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; assQuestion::_resolveIntLinks($source["id"]); } // eventually correct links in survey questions to learning modules if ($type_arr[0] == "sqst") { require_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php"; SurveyQuestion::_resolveIntLinks($source["id"]); } $done[$key] = $key; } } }