4require_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
5require_once(
"./Services/COPage/classes/class.ilPageObject.php");
6require_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
7require_once(
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
8require_once(
"Services/MetaData/classes/class.ilMDLanguageItem.php");
9require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
10require_once(
"./Services/COPage/classes/class.ilPCTable.php");
11require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
12require_once(
"./Services/MediaObjects/classes/class.ilMediaItem.php");
13require_once(
"./Services/MediaObjects/classes/class.ilMapArea.php");
14require_once(
"./Modules/Glossary/classes/class.ilObjGlossary.php");
15require_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
16require_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
17require_once(
"./Services/Link/classes/class.ilInternalLink.php");
18require_once(
"./Modules/File/classes/class.ilObjFile.php");
20include_once(
"Services/MetaData/classes/class.ilMDSaxParser.php");
21include_once(
"Services/MetaData/classes/class.ilMD.php");
87 function __construct(&$a_content_object, $a_xml_file, $a_subdir, $a_import_dir =
"")
93 $this->import_dir = ($a_import_dir !=
"")
95 : $a_content_object->getImportDirectory();
97 parent::__construct($a_xml_file);
99 $this->current_element = array();
100 $this->structure_objects = array();
101 $this->content_object = $a_content_object;
103 $this->st_into_tree = array();
104 $this->pg_into_tree = array();
105 $this->pages_to_parse = array();
106 $this->mobs_with_int_links = array();
107 $this->mob_mapping = array();
108 $this->file_item_mapping = array();
109 $this->pg_mapping = array();
110 $this->link_targets = array();
111 $this->subdir = $a_subdir;
114 $this->inside_code =
false;
115 $this->qst_mapping = array();
116 $this->coType = $this->content_object->getType();
117 $this->metadata_parsing_disabled =
false;
119 if (($this->coType !=
"tst") and ($this->coType !=
"qpl"))
121 $this->lm_tree =
new ilTree($this->content_object->getId());
122 $this->lm_tree->setTreeTablePK(
"lm_id");
123 $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
137 xml_set_object($a_xml_parser,$this);
138 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
139 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
148 $this->mapping = $mapping;
157 $this->log->debug(
"start");
160 parent::startParsing();
181 foreach($this->st_into_tree as $st)
184 $this->lm_tree->insertNode($st[
"id"], $st[
"parent"]);
188 if (is_array($this->pg_into_tree[$st[
"id"]]))
190 foreach($this->pg_into_tree[$st[
"id"]] as $pg)
195 if ($this->pg_mapping[$pg[
"id"]] ==
"")
197 $ilLog->write(
"LM Import: No PageObject for PageAlias ".
198 $pg[
"id"].
" found! (Please update export installation to ILIAS 3.3.0)");
203 $pg_id = $this->pg_mapping[$pg[
"id"]];
210 if (!$this->lm_tree->isInTree($pg_id))
212 $this->lm_tree->insertNode($pg_id, $st[
"id"]);
236 foreach($this->pages_to_parse as $page_id)
238 $page_arr = explode(
":", $page_id);
243 switch ($this->content_object->getType())
246 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
247 $page_obj =
new ilLMPage($page_arr[1]);
251 die(
"Unknown content type ".$this->content_object->getType());
257 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefPage.php");
265 $page_obj->buildDom();
266 $page_obj->resolveIntLinks();
267 $page_obj->resolveIIMMediaAliases($this->mob_mapping);
268 if (in_array($this->coType, array(
"lm")))
270 $page_obj->resolveQuestionReferences($this->qst_mapping);
272 $page_obj->update(
false);
274 if ($page_arr[0] ==
"gdf")
277 $def->updateShortText();
285 foreach($this->mobs_with_int_links as $mob_id)
293 foreach ($this->link_targets as $link_target)
296 $link_arr = explode(
"_", $link_target);
297 $target_inst = $link_arr[1];
302 foreach($sources as $key => $source)
305 if(in_array($key, $done))
309 $type_arr = explode(
":", $source[
"type"]);
312 if ($type_arr[1] ==
"pg")
316 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
326 if ($type_arr[0] ==
"qst")
328 require_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
332 if ($type_arr[0] ==
"sqst")
334 require_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
348 $imp_dir = $this->import_dir;
349 foreach ($this->mob_mapping as $origin_id => $mob_id)
351 if(empty($origin_id))
367 $obj_dir = $origin_id;
368 $source_dir = $imp_dir.
"/".$this->subdir.
"/objects/".$obj_dir;
371 if (@is_dir($source_dir))
378 if (@is_dir($target_dir))
391 $imp_dir = $this->import_dir;
392 foreach ($this->file_item_mapping as $origin_id => $file_id)
394 if(empty($origin_id))
398 $obj_dir = $origin_id;
399 $source_dir = $imp_dir.
"/".$this->subdir.
"/objects/".$obj_dir;
401 include_once(
"./Modules/File/classes/class.ilObjFile.php");
402 $file_obj =
new ilObjFile($file_id,
false);
404 $target_dir = $file_obj->getDirectory();
405 if (@is_dir($source_dir))
412 if (@is_dir($target_dir))
417 $test = $file_obj->determineFilesize();
427 $this->qst_mapping = $a_map;
436 if(!isset($this->status[
"$a_name"]))
438 $this->cnt[$a_name] == 1;
442 $this->cnt[$a_name]++;
444 $this->current_element[count($this->current_element)] = $a_name;
454 $this->cnt[$a_name]--;
455 unset ($this->current_element[count($this->current_element) - 1]);
463 return ($this->current_element[count($this->current_element) - 1]);
473 if (isset($this->cnt[$a_name]))
475 return $this->cnt[$a_name];
502 while (list($k,$v) = each($attr))
503 $tag.=
" ".$k.
"=\"$v\"";
523 case "ContentObject":
526 if ($a_attribs[
"Type"] ==
"Glossary")
532 case "StructureObject":
534 $this->structure_objects[count($this->structure_objects)]
536 $this->current_object = $this->structure_objects[count($this->structure_objects) - 1];
537 $this->current_object->setLMId($this->content_object->getId());
541 $this->current_object->create(
true);
545 $this->in_page_object =
true;
547 if (($this->coType !=
"tst") and ($this->coType !=
"qpl"))
549 $this->lm_page_object =
new ilLMPageObject($this->content_object);
550 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
551 $this->page_object =
new ilLMPage();
552 $this->lm_page_object->setLMId($this->content_object->getId());
553 $this->lm_page_object->assignPageObject($this->page_object);
558 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
564 if (($this->coType !=
"tst") and ($this->coType !=
"qpl"))
566 $this->lm_page_object->setAlias(
true);
567 $this->lm_page_object->setOriginID($a_attribs[
"OriginId"]);
572 $this->in_media_object =
true;
573case "InteractiveImage":
575 $this->media_meta_start =
true;
576 $this->media_meta_cache = array();
582 $this->media_object->setAlias(
true);
583 $this->media_object->setImportId($a_attribs[
"OriginId"]);
584 if (is_object($this->page_object))
586 $this->page_object->needsImportParsing(
true);
591 case "MediaAliasItem":
592 $this->in_media_item =
true;
594 $this->media_item->setPurpose($a_attribs[
"Purpose"]);
603 if (is_object($this->media_object) && $this->in_media_object)
605 $this->media_item->setWidth($a_attribs[
"Width"]);
606 $this->media_item->setHeight($a_attribs[
"Height"]);
607 $this->media_item->setHAlign($a_attribs[
"HorizontalAlign"]);
612 if (is_object($this->media_object) && $this->in_media_object)
614 $this->media_item->setParameter($a_attribs[
"Name"], $a_attribs[
"Value"]);
619 $this->in_map_area =
true;
621 $this->map_area->setShape($a_attribs[
"Shape"]);
622 $this->map_area->setCoords($a_attribs[
"Coords"]);
623 $this->map_area->setHighlightMode($a_attribs[
"HighlightMode"]);
624 $this->map_area->setHighlightClass($a_attribs[
"HighlightClass"]);
628 $this->in_glossary =
true;
629 if ($this->content_object->getType() !=
"glo")
632 $this->glossary_object->setTitle(
"");
633 $this->glossary_object->setDescription(
"");
634 $this->glossary_object->create(
true);
635 $this->glossary_object->createReference();
636 $parent = $this->tree->getParentNodeData($this->content_object->getRefId());
637 $this->glossary_object->putInTree($parent[
"child"]);
638 $this->glossary_object->setPermissions($parent[
"child"]);
645 $this->glossary_term->setGlossaryId($this->glossary_object->getId());
646 $this->glossary_term->setLanguage($a_attribs[
"Language"]);
647 $this->glossary_term->setImportId($a_attribs[
"Id"]);
648 $this->link_targets[$a_attribs[
"Id"]] = $a_attribs[
"Id"];
652 $this->in_glossary_definition =
true;
654 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefPage.php");
656 $this->page_object->setParentId($this->glossary_term->getGlossaryId());
657 $this->glossary_definition->setTermId($this->glossary_term->getId());
658 $this->glossary_definition->assignPageObject($this->page_object);
659 $this->current_object = $this->glossary_definition;
660 $this->glossary_definition->create(
true);
663 $this->page_object->setXMLContent(
"");
667 $this->in_file_item =
true;
669 $this->file_item->setTitle(
"dummy");
670 $this->file_item->setMode(
"filelist");
671 if (is_object($this->page_object))
673 $this->page_object->needsImportParsing(
true);
678 if ($a_attribs[
"Characteristic"] ==
"Code")
680 $this->inside_code =
true;
685 $this->in_properties =
true;
689 if ($this->content_object->getType() ==
"lm")
691 switch($a_attribs[
"Name"])
694 $this->content_object->setLayout($a_attribs[
"Value"]);
698 $this->content_object->setPageHeader($a_attribs[
"Value"]);
702 $this->content_object->setTOCMode($a_attribs[
"Value"]);
706 $this->content_object->setActiveLMMenu(
710 case "ActiveNumbering":
711 $this->content_object->setActiveNumbering(
716 $this->content_object->setActiveTOC(
720 case "ActivePrintView":
721 $this->content_object->setActivePrintView(
726 $this->content_object->setCleanFrames(
731 $this->content_object->setPublicNotes(
735 case "HistoryUserComments":
736 $this->content_object->setHistoryUserComments(
741 $this->content_object->setRating(
746 $this->content_object->setRatingPages(
751 if ($a_attribs[
"Value"] !=
"")
753 if ($this->pg_mapping[$a_attribs[
"Value"]] > 0)
755 $this->content_object->setHeaderPage(
756 $this->pg_mapping[$a_attribs[
"Value"]]);
762 if ($a_attribs[
"Value"] !=
"")
764 if ($this->pg_mapping[$a_attribs[
"Value"]] > 0)
766 $this->content_object->setFooterPage(
767 $this->pg_mapping[$a_attribs[
"Value"]]);
772 case "LayoutPerPage":
773 $this->content_object->setLayoutPerPage($a_attribs[
"Value"]);
776 case "ProgressIcons":
777 $this->content_object->setProgressIcons($a_attribs[
"Value"]);
781 $this->content_object->setStoreTries($a_attribs[
"Value"]);
784 case "RestrictForwardNavigation":
785 $this->content_object->setRestrictForwardNavigation($a_attribs[
"Value"]);
788 case "DisableDefaultFeedback":
789 $this->content_object->setDisableDefaultFeedback($a_attribs[
"Value"]);
801 $this->in_meta_data =
true;
806 if(!$this->in_media_object)
808 if (($this->coType !=
"tst") and ($this->coType !=
"qpl"))
811 if ($this->current_object->getType() ==
"st" ||
812 $this->current_object->getType() ==
"pg")
815 if ($this->current_object->getType() ==
"pg")
817 $this->lm_page_object->create(
true);
819 $this->md =
new ilMD($this->content_object->getId() ,
820 $this->current_object->getId(),
821 $this->current_object->getType());
824 else if ($this->current_object->getType() ==
"gdf")
826 $this->md =
new ilMD($this->glossary_object->getId() ,
827 $this->current_object->getId(),
828 $this->current_object->getType());
835 $this->md =
new ilMD($this->current_object->getId() ,
837 $this->current_object->getType());
844 $this->md =
new ilMD($this->content_object->getId() ,
846 $this->current_object->getType()
848 if ($this->md->getGeneral() !=
false)
850 $this->metadata_parsing_disabled =
true;
866 if($import_id_parsed[
'type'] ==
'st')
868 $this->mapping->addMapping(
869 'Modules/LearningModule',
871 $import_id_parsed[
'id'],
872 $this->current_object->getId()
880 if (!$this->in_meta_meta_data)
882 if ($this->in_meta_data && !$this->in_glossary_definition)
884 if (!$this->in_media_object)
886 $this->current_object->setImportId($a_attribs[
"Entry"]);
888 $this->link_targets[$a_attribs[
"Entry"]] = $a_attribs[
"Entry"];
890 if ($this->in_file_item)
892 if ($this->file_item_mapping[$a_attribs[
"Entry"]] ==
"")
894 $this->file_item->create();
895 $this->file_item->setImportId($a_attribs[
"Entry"]);
896 $this->file_item_mapping[$a_attribs[
"Entry"]] = $this->file_item->getId();
899 if ($this->in_meta_data && $this->in_media_object)
903 $mob_id = $this->mob_mapping[$a_attribs[
"Entry"]];
915 $this->media_object->create(
true,
false);
916 $this->mob_mapping[$a_attribs[
"Entry"]]
917 = $this->media_object->getId();
919 $this->media_object->setImportId($a_attribs[
"Entry"]);
920 $this->md =
new ilMD(0 ,
921 $this->media_object->getId(),
928 case "Meta-Metadata":
929 $this->in_meta_meta_data =
true;
934 if (is_object($this->page_object))
936 $this->page_object->setContainsIntLink(
true);
938 if ($this->in_map_area)
942 $this->map_area->setTarget($a_attribs[
"Target"]);
943 $this->map_area->setType($a_attribs[
"Type"]);
944 $this->map_area->setTargetFrame($a_attribs[
"TargetFrame"]);
945 if (is_object($this->media_object))
948 $this->media_object->setContainsIntLink(
true);
955 if ($this->in_map_area)
958 $this->map_area->setHref($a_attribs[
"Href"]);
959 $this->map_area->setExtTitle($a_attribs[
"Title"]);
965 $this->cur_qid = $a_attribs[
"QRef"];
966 $this->page_object->setContainsQuestion(
true);
970 $this->loc_type = $a_attribs[
"Type"];
977 if(($this->in_page_object || $this->in_glossary_definition)
978 && !$this->in_meta_data && !$this->in_media_object)
980 if ($a_name ==
"Definition")
982 $app_name =
"PageObject";
983 $app_attribs = array();
988 $app_attribs = $a_attribs;
992 if ($this->in_file_item && $app_name ==
"Identifier")
994 $app_attribs[
"Entry"] =
"il__file_".$this->file_item_mapping[$a_attribs[
"Entry"]];
998 $this->page_object->appendXMLContent($this->
buildTag(
"start", $app_name, $app_attribs));
1010 if ($this->in_media_object && $this->media_meta_start)
1012 $this->media_meta_cache[] =
1013 array(
"type" =>
"handlerBeginTag",
"par1" => $a_name,
"par2" => $a_attribs);
1017 if ($a_name ==
"Identifier")
1019 if (!$this->in_media_object)
1021 $a_attribs[
"Entry"] =
"il__".$this->current_object->getType().
1022 "_".$this->current_object->getId();
1026 $a_attribs[
"Entry"] =
"il__mob".
1027 "_".$this->media_object->getId();
1029 $a_attribs[
"Catalog"] =
"ILIAS";
1032 parent::handlerBeginTag($a_xml_parser,$a_name,$a_attribs);
1044 if ($this->content_object->getType() ==
"glo" &&
1045 $this->in_glossary && !$this->in_media_object
1046 && !$this->in_glossary_definition)
1069 if ($this->in_media_object && $this->media_meta_start)
1071 $this->media_meta_cache[] =
1072 array(
"type" =>
"handlerEndTag",
"par1" => $a_name);
1076 parent::handlerEndTag($a_xml_parser,$a_name);
1082 if (($this->in_page_object || $this->in_glossary_definition)
1083 && !$this->in_meta_data && !$this->in_media_object)
1085 $app_name = ($a_name ==
"Definition")
1088 $this->page_object->appendXMLContent($this->
buildTag(
"end", $app_name));
1093 case "StructureObject":
1095 unset($this->structure_objects[count($this->structure_objects) - 1]);
1100 $this->in_page_object =
false;
1101 if (($this->coType !=
"tst") and ($this->coType !=
"qpl"))
1103 if (!$this->lm_page_object->isAlias())
1106 $this->page_object->updateFromXML();
1107 $this->pg_mapping[$this->lm_page_object->getImportId()]
1108 = $this->lm_page_object->getId();
1113 if($import_id_parsed[
'type'] ==
'pg')
1115 $this->mapping->addMapping(
1116 'Modules/LearningModule',
1118 $import_id_parsed[
'id'],
1119 $this->lm_page_object->getId()
1126 if ($this->page_object->containsIntLink())
1128 $this->pages_to_parse[
"lm:".$this->page_object->getId()] =
"lm:".$this->page_object->getId();
1132 if ($this->page_object->needsImportParsing())
1134 $this->pages_to_parse[
"lm:".$this->page_object->getId()] =
"lm:".$this->page_object->getId();
1138 if ($this->page_object->getContainsQuestion())
1140 $this->pages_to_parse[
"lm:".$this->page_object->getId()] =
"lm:".$this->page_object->getId();
1147 $xml = $this->page_object->getXMLContent();
1148 if ($this->cur_qid !=
"")
1150 $ids = $this->qst_mapping[$this->cur_qid];
1151 if ($ids[
"pool"] > 0)
1154 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
1156 $xmlcontent = str_replace($this->cur_qid,
1157 "il__qst_".$ids[
"pool"], $xml);
1158 $page->setXMLContent($xmlcontent);
1159 $page->updateFromXML();
1160 if( $this->page_object->needsImportParsing() )
1162 $this->pages_to_parse[
"qpl:".$page->getId()] =
"qpl:".$page->getId();
1166 if ($ids[
"test"] > 0)
1169 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
1171 $xmlcontent = str_replace($this->cur_qid,
1172 "il__qst_".$ids[
"test"], $xml);
1173 $page->setXMLContent($xmlcontent);
1174 $page->updateFromXML();
1175 if( $this->page_object->needsImportParsing() )
1177 $this->pages_to_parse[
"qpl:".$page->getId()] =
"qpl:".$page->getId();
1185 $cnt = count($this->structure_objects);
1191 $parent_id = $this->structure_objects[
$cnt - 1]->getId();
1192 if ($this->lm_page_object->isAlias())
1195 $this->pg_into_tree[$parent_id][] = array(
"type" =>
"pg_alias",
"id" => $this->lm_page_object->getOriginId());
1201 $this->pg_into_tree[$parent_id][] = array(
"type" =>
"pg",
"id" => $this->lm_page_object->getId());
1205 unset($this->page_object);
1206 unset($this->lm_page_object);
1207 unset ($this->container[count($this->container) - 1]);
1211 $this->in_media_object =
false;
1212case "InteractiveImage":
1218 if(empty($this->mob_mapping[$this->media_object->getImportId()]))
1225 $this->media_object->create(
true,
false);
1230 if ($this->media_object->containsIntLink())
1233 $this->mobs_with_int_links[] = $this->media_object->getId();
1236 $this->mob_mapping[$this->media_object->getImportId()]
1237 = $this->media_object->getId();
1244 $this->media_object->setId($this->mob_mapping[$this->media_object->getImportId()]);
1251 if (!$this->media_object->isAlias())
1254 $this->media_object->update();
1259 if ($this->media_object->containsIntLink())
1262 $this->mobs_with_int_links[] = $this->media_object->getId();
1268 if ($this->in_page_object || $this->in_glossary_definition)
1270 if ($a_name !=
"InteractiveImage")
1272 $this->page_object->appendXMLContent($this->media_object->getXML(
IL_MODE_ALIAS));
1280 case "MediaAliasItem":
1281 $this->in_media_item =
false;
1282 $this->media_object->addMediaItem($this->media_item);
1287 $this->in_map_area =
false;
1288 $this->media_item->addMapArea($this->map_area);
1292 $this->in_properties =
false;
1293 if ($this->content_object->getType() ==
"lm")
1295 $this->content_object->update();
1300 $this->in_meta_data =
false;
1301 if(strtolower(get_class($this->current_object)) ==
"illmpageobject" && !$this->in_media_object)
1304 if (is_object($this->lm_page_object))
1307 $this->current_object->MDUpdateListener(
'General');
1309 $this->current_object->getImportId());
1312 else if((strtolower(get_class($this->current_object)) ==
"ilobjquestionpool" ||
1313 strtolower(get_class($this->current_object)) ==
"ilobjtest") &&
1314 !$this->in_media_object)
1319 if ($this->metadata_parsing_disabled)
1325 if ($this->in_page_object)
1327 $this->page_object->MDUpdateListener(
'General');
1329 $this->page_object->getImportId());
1333 $this->current_object->MDUpdateListener(
'General');
1335 $this->current_object->getImportId());
1339 else if(strtolower(get_class($this->current_object)) ==
"ilstructureobject")
1342 $cnt = count($this->structure_objects);
1345 $parent_id = $this->structure_objects[
$cnt - 2]->getId();
1349 $parent_id = $this->lm_tree->getRootId();
1354 $this->st_into_tree[] = array (
"id" => $this->current_object->getId(),
1355 "parent" => $parent_id);
1358 $this->current_object->MDUpdateListener(
'General');
1360 $this->current_object->getImportId());
1362 else if(strtolower(get_class($this->current_object)) ==
"ilobjlearningmodule" ||
1363 strtolower(get_class($this->current_object)) ==
"ilobjcontentobject" ||
1364 (strtolower(get_class($this->current_object)) ==
"ilobjglossary" && $this->in_glossary))
1369 else if(strtolower(get_class($this->current_object)) ==
"ilglossarydefinition" && !$this->in_media_object)
1374 $this->page_object->setId($this->glossary_definition->getId());
1375 $this->page_object->updateFromXML();
1382 if(strtolower(get_class($this->current_object)) ==
"ilobjlearningmodule" ||
1383 strtolower(get_class($this->current_object)) ==
"ilobjglossary")
1385 if (strtolower(get_class($this->current_object)) ==
"ilobjglossary" &&
1386 $this->content_object->getType() !=
"glo")
1389 $this->current_object->setTitle($this->content_object->getTitle().
" - ".
1390 $this->lng->txt(
"glossary"));
1393 $this->current_object->MDUpdateListener(
'General');
1402 if ($this->in_media_object)
1405 $this->media_object->MDUpdateListener(
'General');
1408 if ($this->in_glossary_definition)
1410 $this->glossary_definition->MDUpdateListener(
'General');
1415 case "Meta-Metadata":
1416 $this->in_meta_meta_data =
false;
1420 $this->in_file_item =
false;
1422 if ($this->file_item->getImportId($a_attribs[
"Entry"] !=
""))
1424 $this->file_item->update();
1430 unset ($this->container[count($this->container) - 1]);
1434 $this->in_glossary =
false;
1437 case "GlossaryTerm":
1438 $term = trim($this->chr_data);
1439 $term = str_replace(
"<",
"<", $term);
1440 $term = str_replace(
">",
">", $term);
1441 $this->glossary_term->setTerm($term);
1442 $this->glossary_term->create();
1443 $iia = explode(
"_", $this->glossary_term->getImportId());
1444 $this->glossary_term_map[(int) $iia[count($iia) - 1]] = $this->glossary_term->getId();
1448 $this->inside_code =
false;
1452 $this->in_glossary_definition =
false;
1453 $this->page_object->updateFromXML();
1456 $this->page_object->buildDom();
1457 $this->glossary_definition->setShortText($this->page_object->getFirstParagraphText());
1458 $this->glossary_definition->update();
1461 if ($this->page_object->containsIntLink())
1464 $this->pages_to_parse[
"gdf:".$this->page_object->getId()] =
"gdf:".$this->page_object->getId();
1466 if ($this->page_object->needsImportParsing())
1468 $this->pages_to_parse[
"gdf:".$this->page_object->getId()] =
"gdf:".$this->page_object->getId();
1473 if ($this->in_media_item)
1475 $this->media_item->setFormat(trim($this->chr_data));
1477 if ($this->in_file_item)
1479 $this->file_item->setFileType(trim($this->chr_data));
1484 if (!$this->in_media_object)
1486 $this->current_object->setTitle(trim($this->chr_data));
1491 $this->media_object->setTitle(trim($this->chr_data));
1510 if ($this->in_media_object)
1512 $this->media_item->setCaption(trim($this->chr_data));
1516 case "TextRepresentation":
1517 if ($this->in_media_object)
1519 $this->media_item->setTextRepresentation(trim($this->chr_data));
1526 if ($this->in_media_item)
1528 $this->media_item->setLocationType($this->loc_type);
1529 if ($this->loc_type ==
"Reference")
1531 $this->media_item->setLocation(str_replace(
"&",
"&", trim($this->chr_data)));
1535 $this->media_item->setLocation(trim($this->chr_data));
1539 if ($this->in_file_item)
1542 $this->file_item->setFileName(trim($this->chr_data));
1546 if ($this->file_item->getType() ==
"file" &&
1547 is_int(strpos($this->chr_data,
"&")) &&
1548 is_int(strpos($this->chr_data,
";")))
1550 $imp_dir = $this->import_dir;
1551 $source_dir = $imp_dir.
"/".$this->subdir.
"/objects/".
1552 $this->file_item->getImportId();
1555 if ($dir = opendir($source_dir))
1557 while (
false !== (
$file = readdir($dir)))
1561 $this->file_item->setFileName(
$file);
1569 $this->file_item->setTitle(trim($this->chr_data));
1575 $this->chr_data =
"";
1592 if ($this->in_media_object && $this->media_meta_start)
1594 $this->media_meta_cache[] =
1595 array(
"type" =>
"handlerCharacterData",
"par1" => $a_data);
1599 parent::handlerCharacterData($a_xml_parser,$a_data);
1607 $a_data = str_replace(
"<",
"<",$a_data);
1608 $a_data = str_replace(
">",
">",$a_data);
1612 $a_data = preg_replace(
"/\n/",
"",$a_data);
1613 if (!$this->inside_code)
1615 $a_data = preg_replace(
"/\t+/",
"",$a_data);
1618 $this->chr_data .= $a_data;
1620 if(!empty($a_data) || $a_data ===
"0")
1624 if (($this->in_page_object || $this->in_glossary_definition)
1625 && !$this->in_meta_data && !$this->in_media_object)
1627 $this->page_object->appendXMLContent($a_data);
1630 if ($this->in_meta_data)
1641 if($this->in_map_area)
1643 $this->map_area->appendTitle($a_data);
1659 foreach ($this->media_meta_cache as $cache_entry)
1661 switch($cache_entry[
"type"])
1663 case "handlerBeginTag":
1664 parent::handlerBeginTag($a_xml_parser,
1665 $cache_entry[
"par1"], $cache_entry[
"par2"]);
1668 case "handlerEndTag":
1669 parent::handlerEndTag($a_xml_parser,
1670 $cache_entry[
"par1"]);
1673 case "handlerCharacterData":
1674 parent::handlerCharacterData($a_xml_parser,
1675 $cache_entry[
"par1"]);
1680 $this->media_meta_start =
false;
1681 $this->media_meta_cache[] = array();
An exception for terminatinating execution or to throw for unit testing.
static _resolveIntLinks($question_id)
_resolveIntLinks($question_id)
setQuestionMapping($a_map)
set question import ident to pool/test question id mapping
storeTree()
insert StructureObjects and PageObjects into tree
handlerEndTag($a_xml_parser, $a_name)
handler for end of element
buildTag($type, $name, $attr="")
generate a tag with given name and attributes
emptyMediaMetaCache(&$a_xml_parser)
send all cached tags to the meta data parser and clear the cache
$metadata_parsing_disabled
startParsing()
start parser
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
getGlossaryTermMap()
Get glossary term map (imported ids to new ids)
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
processPagesToParse()
parse pages that contain files, mobs and/or internal links
copyMobFiles()
copy multimedia object files from import zip file to mob directory
setHandlers($a_xml_parser)
set event handlers
__construct(&$a_content_object, $a_xml_file, $a_subdir, $a_import_dir="")
Constructor.
processMeta()
check whether meta data should be processed
copyFileItems()
copy files of file items
setImportMapping(ilImportMapping $mapping=null)
Set import mapping.
Glossary definition page object.
Class ilGlossaryDefinition.
static _getSourcesOfTarget($a_target_type, $a_target_id, $a_target_inst)
get all sources of a link target
static _writeImportId($a_id, $a_import_id)
write import id to db (static)
Extension of ilPageObject for learning modules.
static getLogger($a_component_id)
Get component logger.
enableMDParsing($a_status)
static getInstance($a_parent_type, $a_id=0, $a_old_nr=0, $a_lang="-")
Get page object instance.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static parseImportId($a_import_id)
Parse an ilias import id Typically of type il_[IL_INST_ID]_[OBJ_TYPE]_[OBJ_ID] returns array( 'orig' ...
static getWebspaceDir($mode="filesystem")
get webspace directory
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static yn2tf($a_yn)
convert "y"/"n" to true/false
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file