89 string $a_import_dir =
"" 93 $this->log = $DIC[
"ilLog"];
94 $lng = $DIC->language();
95 $tree = $DIC->repositoryTree();
99 $this->import_dir = ($a_import_dir !=
"")
101 : $a_content_object->getImportDirectory();
105 $this->current_element = [];
106 $this->structure_objects = [];
107 $this->content_object = $a_content_object;
108 $this->st_into_tree = [];
109 $this->pg_into_tree = [];
110 $this->pages_to_parse = [];
111 $this->mobs_with_int_links = [];
112 $this->mob_mapping = [];
113 $this->file_item_mapping = [];
114 $this->pg_mapping = [];
115 $this->link_targets = [];
116 $this->subdir = $a_subdir;
119 $this->inside_code =
false;
120 $this->qst_mapping = [];
121 $this->coType = $this->content_object->getType();
122 $this->metadata_parsing_disabled =
false;
124 if (($this->coType !=
"tst") && ($this->coType !=
"qpl")) {
125 $this->lm_tree =
new ilLMTree($this->content_object->getId());
134 xml_set_object($a_xml_parser, $this);
135 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
136 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
146 $this->log->debug(
"start");
149 parent::startParsing();
168 foreach ($this->st_into_tree as $st) {
169 $this->lm_tree->insertNode($st[
"id"], $st[
"parent"]);
170 if (is_array($this->pg_into_tree[$st[
"id"]])) {
171 foreach ($this->pg_into_tree[$st[
"id"]] as $pg) {
173 switch ($pg[
"type"]) {
175 if ($this->pg_mapping[$pg[
"id"]] ==
"") {
176 $ilLog->
write(
"LM Import: No PageObject for PageAlias " .
177 $pg[
"id"] .
" found! (Please update export installation to ILIAS 3.3.0)");
182 $pg_id = $this->pg_mapping[$pg[
"id"]];
189 if (!$this->lm_tree->isInTree($pg_id)) {
190 $this->lm_tree->insertNode($pg_id, $st[
"id"]);
203 foreach ($this->pages_to_parse as $page_id) {
204 $page_arr = explode(
":", $page_id);
207 switch ($page_arr[0]) {
209 switch ($this->content_object->getType()) {
211 $page_obj =
new ilLMPage($page_arr[1]);
215 die(
"Unknown content type " . $this->content_object->getType());
228 $page_obj->buildDom();
229 $page_obj->resolveIntLinks();
230 $page_obj->resolveIIMMediaAliases($this->mob_mapping);
231 if ($this->coType ==
"lm") {
232 $page_obj->resolveQuestionReferences($this->qst_mapping);
234 $page_obj->update(
false);
236 if ($page_arr[0] ==
"term") {
238 $term->updateShortText();
246 foreach ($this->mobs_with_int_links as $mob_id) {
253 foreach ($this->link_targets as $link_target) {
255 if (!isset($parsed)) {
260 $parsed[
'target_type'],
261 $parsed[
'target_id'],
262 $parsed[
'target_inst']
265 foreach ($sources as
$key => $source) {
267 if (in_array(
$key, $done)) {
270 $type_arr = explode(
":", $source[
"type"]);
273 if ($type_arr[1] ==
"pg") {
284 if ($type_arr[0] ==
"qst") {
288 if ($type_arr[0] ==
"sqst") {
303 foreach ($this->mob_mapping as $origin_id => $mob_id) {
304 if (empty($origin_id)) {
308 $obj_dir = $origin_id;
309 $source_dir = $imp_dir .
"/" . $this->subdir .
"/objects/" . $obj_dir;
312 if (is_dir($source_dir)) {
315 if (is_dir($target_dir)) {
329 foreach ($this->file_item_mapping as $origin_id => $file_id) {
330 if (empty($origin_id)) {
333 $obj_dir = $origin_id;
334 $source_dir = $imp_dir .
"/" . $this->subdir .
"/objects/" . $obj_dir;
336 $file_obj =
new ilObjFile($file_id,
false);
337 if (is_dir($source_dir)) {
338 $files = scandir($source_dir, SCANDIR_SORT_DESCENDING);
339 if ($files !==
false && $files !== [] && is_file($source_dir .
'/' . $files[0])) {
340 $file = fopen($source_dir .
'/' . $files[0],
'rb');
341 $file_stream = Streams::ofResource($file);
342 $file_obj->appendStream($file_stream, $files[0]);
355 $this->qst_mapping = $a_map;
360 if (!isset($this->status[
"$a_name"])) {
361 $this->cnt[$a_name] = 1;
363 $this->cnt[$a_name]++;
365 $this->current_element[count($this->current_element)] = $a_name;
370 $this->cnt[$a_name]--;
371 unset($this->current_element[count($this->current_element) - 1]);
376 return ($this->current_element[count($this->current_element) - 1] ??
"");
381 if (isset($this->cnt[$a_name])) {
382 return $this->cnt[$a_name];
394 if ($type ==
"end") {
400 if (is_array($attr)) {
401 foreach ($attr as $k => $v) {
402 $tag .=
" " . $k .
"=\"$v\"";
411 public function handlerBeginTag($a_xml_parser,
string $a_name, array $a_attribs):
void 414 case "ContentObject":
416 if ($a_attribs[
"Type"] ==
"Glossary") {
421 case "StructureObject":
424 $this->structure_objects[count($this->structure_objects)]
426 $this->current_object = $this->structure_objects[count($this->structure_objects) - 1];
427 $this->current_object->setLMId($this->content_object->getId());
431 $this->current_object->create(
true);
435 $this->in_page_object =
true;
437 if (($this->coType !=
"tst") && ($this->coType !=
"qpl")) {
441 $this->page_object =
new ilLMPage();
442 $this->lm_page_object->setLMId($this->content_object->getId());
443 $this->lm_page_object->assignPageObject($this->page_object);
454 case "InteractiveImage":
455 if ($a_name ==
"MediaObject") {
456 $this->in_media_object =
true;
458 $this->media_meta_start =
true;
459 $this->media_meta_cache = [];
464 $this->media_object->setAlias(
true);
465 $this->media_object->setImportId($a_attribs[
"OriginId"]);
466 if (is_object($this->page_object)) {
467 $this->page_object->needsImportParsing(
true);
472 case "MediaAliasItem":
473 $this->in_media_item =
true;
475 $this->media_item->setPurpose($a_attribs[
"Purpose"]);
479 if (is_object($this->media_object) && $this->in_media_object) {
480 $this->media_item->setWidth($a_attribs[
"Width"] ??
'');
481 $this->media_item->setHeight($a_attribs[
"Height"] ??
'');
482 $this->media_item->setHAlign($a_attribs[
"HorizontalAlign"] ??
'');
487 if (is_object($this->media_object) && $this->in_media_object) {
488 $this->media_item->setParameter($a_attribs[
"Name"], $a_attribs[
"Value"]);
493 $this->in_map_area =
true;
495 $this->map_area->setShape($a_attribs[
"Shape"]);
496 $this->map_area->setCoords($a_attribs[
"Coords"]);
497 $this->map_area->setHighlightMode($a_attribs[
"HighlightMode"]);
498 $this->map_area->setHighlightClass($a_attribs[
"HighlightClass"]);
502 $this->in_glossary =
true;
503 if ($this->content_object->getType() !=
"glo") {
505 $this->glossary_object->setTitle(
"");
506 $this->glossary_object->setDescription(
"");
507 $this->glossary_object->create(
true);
508 $this->glossary_object->createReference();
509 $parent = $this->tree->getParentNodeData($this->content_object->getRefId());
510 $this->glossary_object->putInTree($parent[
"child"]);
511 $this->glossary_object->setPermissions($parent[
"child"]);
518 $this->glossary_term->setGlossaryId($this->glossary_object->getId());
519 $this->glossary_term->setLanguage($a_attribs[
"Language"]);
520 $this->glossary_term->setImportId($a_attribs[
"Id"]);
522 if (isset($parsed)) {
523 $this->link_targets[$a_attribs[
"Id"]] = $a_attribs[
"Id"];
528 $this->in_glossary_definition =
true;
530 $this->page_object->setParentId($this->glossary_term->getGlossaryId());
531 $this->glossary_term->assignPageObject($this->page_object);
535 $this->page_object->setXMLContent(
"");
539 $this->in_file_item =
true;
541 $this->file_item->setTitle(
"dummy");
542 $this->file_item->setMode(
"filelist");
543 if (is_object($this->page_object)) {
544 $this->page_object->needsImportParsing(
true);
549 if ($a_attribs[
"Characteristic"] ==
"Code") {
550 $this->inside_code =
true;
555 $this->in_properties =
true;
559 if ($this->content_object->getType() ==
"lm") {
560 switch ($a_attribs[
"Name"]) {
562 $this->content_object->setLayout($a_attribs[
"Value"]);
566 $this->content_object->setPageHeader($a_attribs[
"Value"]);
570 $this->content_object->setTOCMode($a_attribs[
"Value"]);
574 $this->content_object->setActiveLMMenu(
579 case "ActiveNumbering":
580 $this->content_object->setActiveNumbering(
586 $this->content_object->setActiveTOC(
591 case "ActivePrintView":
592 $this->content_object->setActivePrintView(
598 $this->content_object->setCleanFrames(
604 $this->content_object->setPublicNotes(
609 case "HistoryUserComments":
610 $this->content_object->setHistoryUserComments(
616 $this->content_object->setRating(
622 $this->content_object->setRatingPages(
628 if ($a_attribs[
"Value"] !=
"") {
629 if ($this->pg_mapping[$a_attribs[
"Value"]] > 0) {
630 $this->content_object->setHeaderPage(
631 $this->pg_mapping[$a_attribs[
"Value"]]
638 if ($a_attribs[
"Value"] !=
"") {
639 if ($this->pg_mapping[$a_attribs[
"Value"]] > 0) {
640 $this->content_object->setFooterPage(
641 $this->pg_mapping[$a_attribs[
"Value"]]
647 case "LayoutPerPage":
648 $this->content_object->setLayoutPerPage($a_attribs[
"Value"]);
651 case "ProgressIcons":
652 $this->content_object->setProgressIcons($a_attribs[
"Value"]);
656 $this->content_object->setStoreTries($a_attribs[
"Value"]);
659 case "RestrictForwardNavigation":
660 $this->content_object->setRestrictForwardNavigation($a_attribs[
"Value"]);
663 case "DisableDefaultFeedback":
664 $this->content_object->setDisableDefaultFeedback($a_attribs[
"Value"]);
674 $this->in_meta_data =
true;
678 if (!$this->in_media_object) {
679 if (($this->coType !=
"tst") && ($this->coType !=
"qpl")) {
681 if ($this->current_object->getType() ==
"st" ||
682 $this->current_object->getType() ==
"pg") {
684 if ($this->current_object->getType() ==
"pg") {
685 $this->lm_page_object->create(
true);
687 $this->md =
new ilMD(
688 $this->content_object->getId(),
689 $this->current_object->getId(),
690 $this->current_object->getType()
694 elseif ($this->current_object->getType() ==
"term") {
695 $this->md =
new ilMD(
696 $this->glossary_object->getId(),
697 $this->current_object->getId(),
698 $this->current_object->getType()
704 $this->md =
new ilMD(
705 $this->current_object->getId(),
707 $this->current_object->getType()
713 $this->md =
new ilMD(
714 $this->content_object->getId(),
716 $this->current_object->getType()
718 if ($this->md->getGeneral() !=
false) {
719 $this->metadata_parsing_disabled =
true;
733 if ($import_id_parsed[
'type'] ==
'st') {
734 $this->mapping->addMapping(
735 'Modules/LearningModule',
737 $import_id_parsed[
'id'],
738 $this->current_object->getId()
746 if (!$this->in_meta_meta_data) {
747 if ($this->in_meta_data && !$this->in_glossary_definition) {
748 if (!$this->in_media_object) {
749 $this->current_object->setImportId($a_attribs[
"Entry"]);
754 if (isset($parsed)) {
755 $this->link_targets[$a_attribs[
"Entry"]] = $a_attribs[
"Entry"];
758 if ($this->in_file_item) {
759 if (!isset($this->file_item_mapping[$a_attribs[
"Entry"]])
760 || $this->file_item_mapping[$a_attribs[
"Entry"]] ===
"") {
761 $this->file_item->create();
762 $this->file_item->setImportId($a_attribs[
"Entry"]);
763 $this->file_item_mapping[$a_attribs[
"Entry"]] = $this->file_item->getId();
766 if ($this->in_meta_data && $this->in_media_object) {
769 $mob_id = $this->mob_mapping[$a_attribs[
"Entry"]];
778 $this->media_object->create(
true,
false);
779 $this->mob_mapping[$a_attribs[
"Entry"]]
780 = $this->media_object->getId();
782 $this->media_object->setImportId($a_attribs[
"Entry"]);
783 $this->md =
new ilMD(
785 $this->media_object->getId(),
793 case "Meta-Metadata":
794 $this->in_meta_meta_data =
true;
799 if (is_object($this->page_object)) {
800 $this->page_object->setContainsIntLink(
true);
802 if ($this->in_map_area) {
805 $this->map_area->setTarget($a_attribs[
"Target"]);
806 $this->map_area->setType($a_attribs[
"Type"]);
807 $this->map_area->setTargetFrame($a_attribs[
"TargetFrame"]);
808 if (is_object($this->media_object)) {
810 $this->media_object->setContainsIntLink(
true);
817 if ($this->in_map_area) {
819 $this->map_area->setHref($a_attribs[
"Href"]);
820 $this->map_area->setExtTitle($a_attribs[
"Title"]);
826 $this->cur_qid = $a_attribs[
"QRef"];
827 $this->page_object->setContainsQuestion(
true);
831 $this->loc_type = $a_attribs[
"Type"];
837 if (($this->in_page_object || $this->in_glossary_definition)
838 && !$this->in_meta_data && !$this->in_media_object) {
839 if ($a_name ==
"Definition") {
840 $app_name =
"PageObject";
844 $app_attribs = $a_attribs;
848 if ($this->in_file_item && $app_name ==
"Identifier") {
849 $app_attribs[
"Entry"] =
"il__file_" . $this->file_item_mapping[$a_attribs[
"Entry"]];
852 $this->page_object->appendXMLContent($this->
buildTag(
"start", $app_name, $app_attribs));
862 if ($this->in_media_object && $this->media_meta_start) {
863 $this->media_meta_cache[] =
864 [
"type" =>
"handlerBeginTag",
"par1" => $a_name,
"par2" => $a_attribs];
866 if ($a_name ==
"Identifier") {
867 if (!$this->in_media_object) {
868 $a_attribs[
"Entry"] =
"il__" . $this->current_object->getType() .
869 "_" . $this->current_object->getId();
871 $a_attribs[
"Entry"] =
"il__mob" .
872 "_" . $this->media_object->getId();
874 $a_attribs[
"Catalog"] =
"ILIAS";
877 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
886 if ($this->content_object->getType() ==
"glo" &&
887 $this->in_glossary && !$this->in_media_object
903 if ($this->in_media_object && $this->media_meta_start) {
904 $this->media_meta_cache[] =
905 [
"type" =>
"handlerEndTag",
"par1" => $a_name];
907 parent::handlerEndTag($a_xml_parser, $a_name);
912 if (($this->in_page_object || $this->in_glossary_definition)
913 && !$this->in_meta_data && !$this->in_media_object) {
914 $app_name = ($a_name ==
"Definition")
917 $this->page_object->appendXMLContent($this->
buildTag(
"end", $app_name));
921 case "StructureObject":
922 unset($this->structure_objects[count($this->structure_objects) - 1]);
927 $this->in_page_object =
false;
928 if (($this->coType !=
"tst") && ($this->coType !=
"qpl")) {
930 $this->page_object->updateFromXML();
931 $this->pg_mapping[$this->lm_page_object->getImportId()]
932 = $this->lm_page_object->getId();
936 if ($import_id_parsed[
'type'] ==
'pg') {
937 $this->mapping->addMapping(
938 'Modules/LearningModule',
940 $import_id_parsed[
'id'],
941 $this->lm_page_object->getId()
947 if ($this->page_object->containsIntLink()) {
948 $this->pages_to_parse[
"lm:" . $this->page_object->getId()] =
"lm:" . $this->page_object->getId();
952 if ($this->page_object->needsImportParsing()) {
953 $this->pages_to_parse[
"lm:" . $this->page_object->getId()] =
"lm:" . $this->page_object->getId();
957 if ($this->page_object->getContainsQuestion()) {
958 $this->pages_to_parse[
"lm:" . $this->page_object->getId()] =
"lm:" . $this->page_object->getId();
962 $xml = $this->page_object->getXMLContent();
963 if ($this->cur_qid !=
"") {
964 $ids = $this->qst_mapping[
$this->cur_qid] ?? [
'pool' => 0,
'test' => 0];
965 if ($ids[
"pool"] > 0) {
968 $xmlcontent = str_replace(
970 "il__qst_" . $ids[
"pool"],
973 $page->setXMLContent($xmlcontent);
974 $page->updateFromXML();
975 if ($this->page_object->needsImportParsing()) {
976 $this->pages_to_parse[
"qpl:" . $page->getId()] =
"qpl:" . $page->getId();
980 if ($ids[
"test"] > 0) {
983 $xmlcontent = str_replace(
985 "il__qst_" . $ids[
"test"],
988 $page->setXMLContent($xmlcontent);
989 $page->updateFromXML();
990 if ($this->page_object->needsImportParsing()) {
991 $this->pages_to_parse[
"qpl:" . $page->getId()] =
"qpl:" . $page->getId();
999 $cnt = count($this->structure_objects);
1001 $parent_id = $this->structure_objects[$cnt - 1]->getId();
1005 $this->pg_into_tree[$parent_id][] = [
"type" =>
"pg",
"id" => $this->lm_page_object->getId()];
1009 unset($this->page_object);
1010 unset($this->lm_page_object);
1011 unset($this->container[count($this->container) - 1]);
1015 case "InteractiveImage":
1016 if ($a_name ==
"MediaObject") {
1017 $this->in_media_object =
false;
1020 if (empty($this->mob_mapping[$this->media_object->getImportId()])) {
1024 $this->media_object->create(
true,
false);
1027 if ($this->media_object->containsIntLink()) {
1029 $this->mobs_with_int_links[] = $this->media_object->getId();
1032 $this->mob_mapping[$this->media_object->getImportId()]
1033 = $this->media_object->getId();
1036 $this->media_object->setId($this->mob_mapping[$this->media_object->getImportId()]);
1043 if (!$this->media_object->isAlias()) {
1045 $this->media_object->update();
1050 if ($this->media_object->containsIntLink()) {
1052 $this->mobs_with_int_links[] = $this->media_object->getId();
1058 if ($this->in_page_object || $this->in_glossary_definition) {
1059 if ($a_name !=
"InteractiveImage") {
1060 $this->page_object->appendXMLContent($this->media_object->getXML(
IL_MODE_ALIAS));
1068 case "MediaAliasItem":
1069 $this->in_media_item =
false;
1070 $this->media_object->addMediaItem($this->media_item);
1074 $this->in_map_area =
false;
1075 $this->media_item->addMapArea($this->map_area);
1079 $this->in_properties =
false;
1080 if ($this->content_object->getType() ==
"lm") {
1081 $this->content_object->update();
1086 $this->in_meta_data =
false;
1087 if (strtolower(get_class($this->current_object)) ==
"illmpageobject" && !$this->in_media_object) {
1089 if (is_object($this->lm_page_object)) {
1091 $this->current_object->MDUpdateListener(
'General');
1093 $this->current_object->getId(),
1094 $this->current_object->getImportId()
1097 } elseif ((strtolower(get_class($this->current_object)) ==
"ilobjquestionpool" ||
1098 strtolower(get_class($this->current_object)) ==
"ilobjtest") &&
1099 !$this->in_media_object) {
1103 if ($this->metadata_parsing_disabled) {
1106 if ($this->in_page_object && !is_null($this->page_object)) {
1114 $this->current_object->MDUpdateListener(
'General');
1116 $this->current_object->getId(),
1117 $this->current_object->getImportId()
1121 } elseif (strtolower(get_class($this->current_object)) ==
"ilstructureobject") {
1123 $cnt = count($this->structure_objects);
1125 $parent_id = $this->structure_objects[$cnt - 2]->getId();
1127 $parent_id = $this->lm_tree->getRootId();
1130 $this->st_into_tree[] = [
"id" => $this->current_object->getId(),
1131 "parent" => $parent_id];
1134 $this->current_object->MDUpdateListener(
'General');
1136 $this->current_object->getId(),
1137 $this->current_object->getImportId()
1139 } elseif (strtolower(get_class($this->current_object)) ==
"ilobjlearningmodule" ||
1140 strtolower(get_class($this->current_object)) ==
"ilobjcontentobject" ||
1141 (strtolower(get_class($this->current_object)) ==
"ilobjglossary" && $this->in_glossary)) {
1144 } elseif (strtolower(get_class($this->current_object)) ==
"ilglossaryterm" && !$this->in_media_object) {
1147 $this->page_object->setId($this->glossary_term->getId());
1148 $this->page_object->updateFromXML();
1155 if (strtolower(get_class($this->current_object)) ==
"ilobjlearningmodule" ||
1156 strtolower(get_class($this->current_object)) ==
"ilobjglossary") {
1157 if (strtolower(get_class($this->current_object)) ==
"ilobjglossary" &&
1158 $this->content_object->getType() !=
"glo") {
1160 $this->current_object->setTitle($this->content_object->getTitle() .
" - " .
1161 $this->
lng->txt(
"glossary"));
1164 $this->current_object->MDUpdateListener(
'General');
1173 if ($this->in_media_object) {
1175 $this->media_object->MDUpdateListener(
'General');
1180 case "Meta-Metadata":
1181 $this->in_meta_meta_data =
false;
1185 $this->in_file_item =
false;
1187 if ($this->file_item->getImportId()) {
1188 $this->file_item->update();
1194 unset($this->container[count($this->container) - 1]);
1198 $this->in_glossary =
false;
1201 case "GlossaryTerm":
1202 $term = trim($this->chr_data);
1203 $term = str_replace(
"<",
"<", $term);
1204 $term = str_replace(
">",
">", $term);
1205 $this->glossary_term->setTerm($term);
1206 $this->glossary_term->create();
1207 $iia = explode(
"_", $this->glossary_term->getImportId());
1208 $this->glossary_term_map[(
int) $iia[count($iia) - 1]] = $this->glossary_term->getId();
1212 $this->inside_code =
false;
1216 $this->in_glossary_definition =
false;
1217 $this->page_object->updateFromXML();
1218 $this->page_object->buildDom();
1219 $this->glossary_term->setShortText($this->page_object->getFirstParagraphText());
1220 $this->glossary_term->update();
1221 if ($this->page_object->containsIntLink()) {
1222 $this->pages_to_parse[
"term:" . $this->page_object->getId()] =
"term:" . $this->page_object->getId();
1224 if ($this->page_object->needsImportParsing()) {
1225 $this->pages_to_parse[
"term:" . $this->page_object->getId()] =
"term:" . $this->page_object->getId();
1230 if ($this->in_media_item) {
1231 $this->media_item->setFormat(trim($this->chr_data));
1236 if ($this->in_meta_data && !$this->in_media_object) {
1237 $this->current_object->setTitle(trim($this->chr_data));
1239 if ($this->in_media_object) {
1240 $this->media_object->setTitle(trim($this->chr_data));
1249 if ($this->in_media_object) {
1250 $this->media_item->setCaption(trim($this->chr_data));
1254 case "TextRepresentation":
1255 if ($this->in_media_object) {
1256 $this->media_item->setTextRepresentation(trim($this->chr_data));
1263 if ($this->in_media_item) {
1264 $this->media_item->setLocationType($this->loc_type);
1265 if ($this->loc_type ==
"Reference") {
1266 $this->media_item->setLocation(str_replace(
"&",
"&", trim($this->chr_data)));
1268 $this->media_item->setLocation(trim($this->chr_data));
1271 if ($this->in_file_item) {
1273 $this->file_item->setFileName(trim($this->chr_data));
1277 if ($this->file_item->getType() ==
"file" &&
1278 is_int(strpos($this->chr_data,
"&")) &&
1279 is_int(strpos($this->chr_data,
";"))) {
1281 $source_dir = $imp_dir .
"/" . $this->subdir .
"/objects/" .
1282 $this->file_item->getImportId();
1285 if ($dir = opendir($source_dir)) {
1286 while (
false !== ($file = readdir($dir))) {
1287 if ($file !=
"." && $file !=
"..") {
1288 $this->file_item->setFileName($file);
1296 $this->file_item->setTitle(trim($this->chr_data));
1301 $this->chr_data =
"";
1307 if ($this->in_meta_data && $this->
processMeta()) {
1311 if ($this->in_media_object && $this->media_meta_start) {
1312 $this->media_meta_cache[] =
1313 [
"type" =>
"handlerCharacterData",
"par1" => $a_data];
1315 parent::handlerCharacterData($a_xml_parser, $a_data);
1323 $a_data = str_replace(
"<",
"<", $a_data);
1324 $a_data = str_replace(
">",
">", $a_data);
1328 $a_data = preg_replace(
"/\n/",
"", $a_data);
1329 if (!$this->inside_code) {
1330 $a_data = preg_replace(
"/\t+/",
"", $a_data);
1333 $this->chr_data .= $a_data;
1335 if (!empty($a_data) || $a_data ===
"0") {
1338 if (($this->in_page_object || $this->in_glossary_definition)
1339 && !$this->in_meta_data && !$this->in_media_object) {
1340 $this->page_object->appendXMLContent($a_data);
1346 if ($this->in_map_area) {
1347 $this->map_area->appendTitle($a_data);
1359 foreach ($this->media_meta_cache as $cache_entry) {
1360 switch ($cache_entry[
"type"]) {
1361 case "handlerBeginTag":
1362 parent::handlerBeginTag(
1364 $cache_entry[
"par1"],
1365 $cache_entry[
"par2"]
1369 case "handlerEndTag":
1370 parent::handlerEndTag(
1372 $cache_entry[
"par1"]
1376 case "handlerCharacterData":
1377 parent::handlerCharacterData(
1379 $cache_entry[
"par1"]
1385 $this->media_meta_start =
false;
1386 $this->media_meta_cache[] = [];
1404 $link_arr = explode(
'_', $identifier);
1406 if (count($link_arr) !== 4
1407 || $link_arr[0] !==
'il' 1408 || !is_numeric($link_arr[1])
1409 || !is_numeric($link_arr[3])
1415 'target_inst' => (
int) $link_arr[1],
1416 'target_type' => (
string) $link_arr[2],
1417 'target_id' => (
int) $link_arr[3]
static getWebspaceDir(string $mode="filesystem")
get webspace directory
processPagesToParse()
parse pages that contain files, mobs and/or internal links
enableMDParsing(bool $a_status)
getOpenCount(string $a_name)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
buildDom(bool $a_force=false)
static getLogger(string $a_component_id)
Get component logger.
static _getSourcesOfTarget(string $a_target_type, int $a_target_id, int $a_target_inst)
get all sources of a link target
buildTag(string $type, string $name, array $attr=[])
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
handlerEndTag($a_xml_parser, string $a_name)
write(string $message, $level=ilLogLevel::INFO, array $context=[])
write log message
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
handlerBeginTag($a_xml_parser, string $a_name, array $a_attribs)
resolveIntLinks(array $a_link_map=null)
Resolves all internal link targets of the page, if targets are available (after import) ...
update(bool $a_validate=true, bool $a_no_history=false)
update complete page content in db (dom xml content is used)
ilGlossaryTerm $glossary_term
endElement(string $a_name)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
setImportMapping(ilImportMapping $mapping=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
bool $metadata_parsing_disabled
ilPageObject $page_object
copyMobFiles()
copy multimedia object files from import zip file to mob directory
bool $in_glossary_definition
parseLinkTarget(string $identifier)
Parse a string the get the elements of a link target Return null if the string is not a link target...
static instantiateQuestion(int $question_id)
setQuestionMapping(array $a_map)
set question import ident to pool/test question id mapping
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(ilObject $a_content_object, string $a_xml_file, string $a_subdir, string $a_import_dir="")
handlerCharacterData($a_xml_parser, string $a_data)
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
Legacy Content Object Parser.
static _resolveIntLinks(int $question_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static parseImportId(string $a_import_id)
Parse an ilias import id Typically of type il_[IL_INST_ID]_[OBJ_TYPE]_[OBJ_ID] returns array( 'orig' ...
static _writeImportId(int $a_id, string $a_import_id)
setHandlers($a_xml_parser)
ilObjLearningModule $learning_module
copyFileItems()
copy files of file items
emptyMediaMetaCache($a_xml_parser)
array $mobs_with_int_links
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilLMPageObject $lm_page_object
static yn2tf(string $a_yn)
ilObjGlossary $glossary_object
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstance(string $a_parent_type, int $a_id=0, int $a_old_nr=0, string $a_lang="-")
Get page object instance.
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
beginElement(string $a_name)
ilObjMediaObject $media_object
storeTree()
insert StructureObjects and PageObjects into tree