90 string $a_import_dir =
"" 94 $this->log = $DIC[
"ilLog"];
95 $lng = $DIC->language();
96 $tree = $DIC->repositoryTree();
100 $this->import_dir = ($a_import_dir !=
"")
102 : $a_content_object->getImportDirectory();
105 $this->cnt = array();
106 $this->current_element = array();
107 $this->structure_objects = array();
108 $this->content_object = $a_content_object;
109 $this->st_into_tree = array();
110 $this->pg_into_tree = array();
111 $this->pages_to_parse = array();
112 $this->mobs_with_int_links = array();
113 $this->mob_mapping = array();
114 $this->file_item_mapping = array();
115 $this->pg_mapping = array();
116 $this->link_targets = array();
117 $this->subdir = $a_subdir;
120 $this->inside_code =
false;
121 $this->qst_mapping = array();
122 $this->coType = $this->content_object->getType();
123 $this->metadata_parsing_disabled =
false;
125 if (($this->coType !=
"tst") && ($this->coType !=
"qpl")) {
126 $this->lm_tree =
new ilLMTree($this->content_object->getId());
135 xml_set_object($a_xml_parser, $this);
136 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
137 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
147 $this->log->debug(
"start");
150 parent::startParsing();
169 foreach ($this->st_into_tree as $st) {
170 $this->lm_tree->insertNode($st[
"id"], $st[
"parent"]);
171 if (is_array($this->pg_into_tree[$st[
"id"]])) {
172 foreach ($this->pg_into_tree[$st[
"id"]] as $pg) {
174 switch ($pg[
"type"]) {
176 if ($this->pg_mapping[$pg[
"id"]] ==
"") {
177 $ilLog->
write(
"LM Import: No PageObject for PageAlias " .
178 $pg[
"id"] .
" found! (Please update export installation to ILIAS 3.3.0)");
183 $pg_id = $this->pg_mapping[$pg[
"id"]];
190 if (!$this->lm_tree->isInTree($pg_id)) {
191 $this->lm_tree->insertNode($pg_id, $st[
"id"]);
204 foreach ($this->pages_to_parse as $page_id) {
205 $page_arr = explode(
":", $page_id);
208 switch ($page_arr[0]) {
210 switch ($this->content_object->getType()) {
212 $page_obj =
new ilLMPage($page_arr[1]);
216 die(
"Unknown content type " . $this->content_object->getType());
229 $page_obj->buildDom();
230 $page_obj->resolveIntLinks();
231 $page_obj->resolveIIMMediaAliases($this->mob_mapping);
232 if ($this->coType ==
"lm") {
233 $page_obj->resolveQuestionReferences($this->qst_mapping);
235 $page_obj->update(
false);
237 if ($page_arr[0] ==
"gdf") {
239 $def->updateShortText();
247 foreach ($this->mobs_with_int_links as $mob_id) {
254 foreach ($this->link_targets as $link_target) {
256 if (!isset($parsed)) {
261 $parsed[
'target_type'],
262 $parsed[
'target_id'],
263 $parsed[
'target_inst']
268 if (in_array(
$key, $done)) {
271 $type_arr = explode(
":",
$source[
"type"]);
274 if ($type_arr[1] ==
"pg") {
285 if ($type_arr[0] ==
"qst") {
289 if ($type_arr[0] ==
"sqst") {
304 foreach ($this->mob_mapping as $origin_id => $mob_id) {
305 if (empty($origin_id)) {
309 $obj_dir = $origin_id;
310 $source_dir = $imp_dir .
"/" . $this->subdir .
"/objects/" . $obj_dir;
313 if (is_dir($source_dir)) {
316 if (is_dir($target_dir)) {
330 foreach ($this->file_item_mapping as $origin_id => $file_id) {
331 if (empty($origin_id)) {
334 $obj_dir = $origin_id;
335 $source_dir = $imp_dir .
"/" . $this->subdir .
"/objects/" . $obj_dir;
337 $file_obj =
new ilObjFile($file_id,
false);
338 if (is_dir($source_dir)) {
339 $files = scandir($source_dir, SCANDIR_SORT_DESCENDING);
340 if ($files !==
false && $files !== [] && is_file($source_dir .
'/' . $files[0])) {
341 $file = fopen($source_dir .
'/' . $files[0],
'rb');
342 $file_stream = Streams::ofResource($file);
343 $file_obj->appendStream($file_stream, $files[0]);
356 $this->qst_mapping = $a_map;
361 if (!isset($this->status[
"$a_name"])) {
362 $this->cnt[$a_name] = 1;
364 $this->cnt[$a_name]++;
366 $this->current_element[count($this->current_element)] = $a_name;
371 $this->cnt[$a_name]--;
372 unset($this->current_element[count($this->current_element) - 1]);
377 return ($this->current_element[count($this->current_element) - 1] ??
"");
382 if (isset($this->cnt[$a_name])) {
383 return $this->cnt[$a_name];
395 if ($type ==
"end") {
401 if (is_array($attr)) {
402 foreach ($attr as $k => $v) {
403 $tag .=
" " . $k .
"=\"$v\"";
412 public function handlerBeginTag($a_xml_parser,
string $a_name, array $a_attribs):
void 415 case "ContentObject":
417 if ($a_attribs[
"Type"] ==
"Glossary") {
422 case "StructureObject":
425 $this->structure_objects[count($this->structure_objects)]
427 $this->current_object = $this->structure_objects[count($this->structure_objects) - 1];
428 $this->current_object->setLMId($this->content_object->getId());
432 $this->current_object->create(
true);
436 $this->in_page_object =
true;
438 if (($this->coType !=
"tst") && ($this->coType !=
"qpl")) {
442 $this->page_object =
new ilLMPage();
443 $this->lm_page_object->setLMId($this->content_object->getId());
444 $this->lm_page_object->assignPageObject($this->page_object);
455 case "InteractiveImage":
456 if ($a_name ==
"MediaObject") {
457 $this->in_media_object =
true;
459 $this->media_meta_start =
true;
460 $this->media_meta_cache = array();
465 $this->media_object->setAlias(
true);
466 $this->media_object->setImportId($a_attribs[
"OriginId"]);
467 if (is_object($this->page_object)) {
468 $this->page_object->needsImportParsing(
true);
473 case "MediaAliasItem":
474 $this->in_media_item =
true;
476 $this->media_item->setPurpose($a_attribs[
"Purpose"]);
480 if (is_object($this->media_object) && $this->in_media_object) {
481 $this->media_item->setWidth($a_attribs[
"Width"] ??
'');
482 $this->media_item->setHeight($a_attribs[
"Height"] ??
'');
483 $this->media_item->setHAlign($a_attribs[
"HorizontalAlign"] ??
'');
488 if (is_object($this->media_object) && $this->in_media_object) {
489 $this->media_item->setParameter($a_attribs[
"Name"], $a_attribs[
"Value"]);
494 $this->in_map_area =
true;
496 $this->map_area->setShape($a_attribs[
"Shape"]);
497 $this->map_area->setCoords($a_attribs[
"Coords"]);
498 $this->map_area->setHighlightMode($a_attribs[
"HighlightMode"]);
499 $this->map_area->setHighlightClass($a_attribs[
"HighlightClass"]);
503 $this->in_glossary =
true;
504 if ($this->content_object->getType() !=
"glo") {
506 $this->glossary_object->setTitle(
"");
507 $this->glossary_object->setDescription(
"");
508 $this->glossary_object->create(
true);
509 $this->glossary_object->createReference();
510 $parent = $this->tree->getParentNodeData($this->content_object->getRefId());
511 $this->glossary_object->putInTree($parent[
"child"]);
512 $this->glossary_object->setPermissions($parent[
"child"]);
519 $this->glossary_term->setGlossaryId($this->glossary_object->getId());
520 $this->glossary_term->setLanguage($a_attribs[
"Language"]);
521 $this->glossary_term->setImportId($a_attribs[
"Id"]);
523 if (isset($parsed)) {
524 $this->link_targets[$a_attribs[
"Id"]] = $a_attribs[
"Id"];
529 $this->in_glossary_definition =
true;
532 $this->page_object->setParentId($this->glossary_term->getGlossaryId());
533 $this->glossary_definition->setTermId($this->glossary_term->getId());
534 $this->glossary_definition->assignPageObject($this->page_object);
536 $this->glossary_definition->
create(
true);
539 $this->page_object->setXMLContent(
"");
543 $this->in_file_item =
true;
545 $this->file_item->setTitle(
"dummy");
546 $this->file_item->setMode(
"filelist");
547 if (is_object($this->page_object)) {
548 $this->page_object->needsImportParsing(
true);
553 if ($a_attribs[
"Characteristic"] ==
"Code") {
554 $this->inside_code =
true;
559 $this->in_properties =
true;
563 if ($this->content_object->getType() ==
"lm") {
564 switch ($a_attribs[
"Name"]) {
566 $this->content_object->setLayout($a_attribs[
"Value"]);
570 $this->content_object->setPageHeader($a_attribs[
"Value"]);
574 $this->content_object->setTOCMode($a_attribs[
"Value"]);
578 $this->content_object->setActiveLMMenu(
583 case "ActiveNumbering":
584 $this->content_object->setActiveNumbering(
590 $this->content_object->setActiveTOC(
595 case "ActivePrintView":
596 $this->content_object->setActivePrintView(
602 $this->content_object->setCleanFrames(
608 $this->content_object->setPublicNotes(
613 case "HistoryUserComments":
614 $this->content_object->setHistoryUserComments(
620 $this->content_object->setRating(
626 $this->content_object->setRatingPages(
632 if ($a_attribs[
"Value"] !=
"") {
633 if ($this->pg_mapping[$a_attribs[
"Value"]] > 0) {
634 $this->content_object->setHeaderPage(
635 $this->pg_mapping[$a_attribs[
"Value"]]
642 if ($a_attribs[
"Value"] !=
"") {
643 if ($this->pg_mapping[$a_attribs[
"Value"]] > 0) {
644 $this->content_object->setFooterPage(
645 $this->pg_mapping[$a_attribs[
"Value"]]
651 case "LayoutPerPage":
652 $this->content_object->setLayoutPerPage($a_attribs[
"Value"]);
655 case "ProgressIcons":
656 $this->content_object->setProgressIcons($a_attribs[
"Value"]);
660 $this->content_object->setStoreTries($a_attribs[
"Value"]);
663 case "RestrictForwardNavigation":
664 $this->content_object->setRestrictForwardNavigation($a_attribs[
"Value"]);
667 case "DisableDefaultFeedback":
668 $this->content_object->setDisableDefaultFeedback($a_attribs[
"Value"]);
679 $this->in_meta_data =
true;
683 if (!$this->in_media_object) {
684 if (($this->coType !=
"tst") && ($this->coType !=
"qpl")) {
686 if ($this->current_object->getType() ==
"st" ||
687 $this->current_object->getType() ==
"pg") {
689 if ($this->current_object->getType() ==
"pg") {
690 $this->lm_page_object->create(
true);
692 $this->md =
new ilMD(
693 $this->content_object->getId(),
694 $this->current_object->getId(),
695 $this->current_object->getType()
699 elseif ($this->current_object->getType() ==
"gdf") {
700 $this->md =
new ilMD(
701 $this->glossary_object->getId(),
702 $this->current_object->getId(),
703 $this->current_object->getType()
709 $this->md =
new ilMD(
710 $this->current_object->getId(),
712 $this->current_object->getType()
718 $this->md =
new ilMD(
719 $this->content_object->getId(),
721 $this->current_object->getType()
723 if ($this->md->getGeneral() !=
false) {
724 $this->metadata_parsing_disabled =
true;
738 if ($import_id_parsed[
'type'] ==
'st') {
739 $this->mapping->addMapping(
740 'Modules/LearningModule',
742 $import_id_parsed[
'id'],
743 $this->current_object->getId()
751 if (!$this->in_meta_meta_data) {
752 if ($this->in_meta_data && !$this->in_glossary_definition) {
753 if (!$this->in_media_object) {
754 $this->current_object->setImportId($a_attribs[
"Entry"]);
759 if (isset($parsed)) {
760 $this->link_targets[$a_attribs[
"Entry"]] = $a_attribs[
"Entry"];
763 if ($this->in_file_item) {
764 if (!isset($this->file_item_mapping[$a_attribs[
"Entry"]])
765 || $this->file_item_mapping[$a_attribs[
"Entry"]] ===
"") {
766 $this->file_item->create();
767 $this->file_item->setImportId($a_attribs[
"Entry"]);
768 $this->file_item_mapping[$a_attribs[
"Entry"]] = $this->file_item->getId();
771 if ($this->in_meta_data && $this->in_media_object) {
774 $mob_id = $this->mob_mapping[$a_attribs[
"Entry"]];
783 $this->media_object->create(
true,
false);
784 $this->mob_mapping[$a_attribs[
"Entry"]]
785 = $this->media_object->getId();
787 $this->media_object->setImportId($a_attribs[
"Entry"]);
788 $this->md =
new ilMD(
790 $this->media_object->getId(),
798 case "Meta-Metadata":
799 $this->in_meta_meta_data =
true;
804 if (is_object($this->page_object)) {
805 $this->page_object->setContainsIntLink(
true);
807 if ($this->in_map_area) {
810 $this->map_area->setTarget($a_attribs[
"Target"]);
811 $this->map_area->setType($a_attribs[
"Type"]);
812 $this->map_area->setTargetFrame($a_attribs[
"TargetFrame"]);
813 if (is_object($this->media_object)) {
815 $this->media_object->setContainsIntLink(
true);
822 if ($this->in_map_area) {
824 $this->map_area->setHref($a_attribs[
"Href"]);
825 $this->map_area->setExtTitle($a_attribs[
"Title"]);
831 $this->cur_qid = $a_attribs[
"QRef"];
832 $this->page_object->setContainsQuestion(
true);
836 $this->loc_type = $a_attribs[
"Type"];
843 if (($this->in_page_object || $this->in_glossary_definition)
844 && !$this->in_meta_data && !$this->in_media_object) {
845 if ($a_name ==
"Definition") {
846 $app_name =
"PageObject";
847 $app_attribs = array();
850 $app_attribs = $a_attribs;
854 if ($this->in_file_item && $app_name ==
"Identifier") {
855 $app_attribs[
"Entry"] =
"il__file_" . $this->file_item_mapping[$a_attribs[
"Entry"]];
859 $this->page_object->appendXMLContent($this->
buildTag(
"start", $app_name, $app_attribs));
870 if ($this->in_media_object && $this->media_meta_start) {
871 $this->media_meta_cache[] =
872 array(
"type" =>
"handlerBeginTag",
"par1" => $a_name,
"par2" => $a_attribs);
874 if ($a_name ==
"Identifier") {
875 if (!$this->in_media_object) {
876 $a_attribs[
"Entry"] =
"il__" . $this->current_object->getType() .
877 "_" . $this->current_object->getId();
879 $a_attribs[
"Entry"] =
"il__mob" .
880 "_" . $this->media_object->getId();
882 $a_attribs[
"Catalog"] =
"ILIAS";
885 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
894 if ($this->content_object->getType() ==
"glo" &&
895 $this->in_glossary && !$this->in_media_object
911 if ($this->in_media_object && $this->media_meta_start) {
912 $this->media_meta_cache[] =
913 array(
"type" =>
"handlerEndTag",
"par1" => $a_name);
915 parent::handlerEndTag($a_xml_parser, $a_name);
920 if (($this->in_page_object || $this->in_glossary_definition)
921 && !$this->in_meta_data && !$this->in_media_object) {
922 $app_name = ($a_name ==
"Definition")
925 $this->page_object->appendXMLContent($this->
buildTag(
"end", $app_name));
929 case "StructureObject":
930 unset($this->structure_objects[count($this->structure_objects) - 1]);
935 $this->in_page_object =
false;
936 if (($this->coType !=
"tst") && ($this->coType !=
"qpl")) {
938 $this->page_object->updateFromXML();
939 $this->pg_mapping[$this->lm_page_object->getImportId()]
940 = $this->lm_page_object->getId();
944 if ($import_id_parsed[
'type'] ==
'pg') {
945 $this->mapping->addMapping(
946 'Modules/LearningModule',
948 $import_id_parsed[
'id'],
949 $this->lm_page_object->getId()
955 if ($this->page_object->containsIntLink()) {
956 $this->pages_to_parse[
"lm:" . $this->page_object->getId()] =
"lm:" . $this->page_object->getId();
960 if ($this->page_object->needsImportParsing()) {
961 $this->pages_to_parse[
"lm:" . $this->page_object->getId()] =
"lm:" . $this->page_object->getId();
965 if ($this->page_object->getContainsQuestion()) {
966 $this->pages_to_parse[
"lm:" . $this->page_object->getId()] =
"lm:" . $this->page_object->getId();
970 $xml = $this->page_object->getXMLContent();
971 if ($this->cur_qid !=
"") {
972 $ids = $this->qst_mapping[
$this->cur_qid] ?? [
'pool' => 0,
'test' => 0];
973 if ($ids[
"pool"] > 0) {
976 $xmlcontent = str_replace(
978 "il__qst_" . $ids[
"pool"],
981 $page->setXMLContent($xmlcontent);
982 $page->updateFromXML();
983 if ($this->page_object->needsImportParsing()) {
984 $this->pages_to_parse[
"qpl:" . $page->getId()] =
"qpl:" . $page->getId();
988 if ($ids[
"test"] > 0) {
991 $xmlcontent = str_replace(
993 "il__qst_" . $ids[
"test"],
996 $page->setXMLContent($xmlcontent);
997 $page->updateFromXML();
998 if ($this->page_object->needsImportParsing()) {
999 $this->pages_to_parse[
"qpl:" . $page->getId()] =
"qpl:" . $page->getId();
1007 $cnt = count($this->structure_objects);
1009 $parent_id = $this->structure_objects[$cnt - 1]->getId();
1013 $this->pg_into_tree[$parent_id][] = array(
"type" =>
"pg",
"id" => $this->lm_page_object->getId());
1017 unset($this->page_object);
1018 unset($this->lm_page_object);
1019 unset($this->container[count($this->container) - 1]);
1023 case "InteractiveImage":
1024 if ($a_name ==
"MediaObject") {
1025 $this->in_media_object =
false;
1028 if (empty($this->mob_mapping[$this->media_object->getImportId()])) {
1032 $this->media_object->create(
true,
false);
1035 if ($this->media_object->containsIntLink()) {
1037 $this->mobs_with_int_links[] = $this->media_object->getId();
1040 $this->mob_mapping[$this->media_object->getImportId()]
1041 = $this->media_object->getId();
1044 $this->media_object->setId($this->mob_mapping[$this->media_object->getImportId()]);
1051 if (!$this->media_object->isAlias()) {
1053 $this->media_object->update();
1058 if ($this->media_object->containsIntLink()) {
1060 $this->mobs_with_int_links[] = $this->media_object->getId();
1066 if ($this->in_page_object || $this->in_glossary_definition) {
1067 if ($a_name !=
"InteractiveImage") {
1068 $this->page_object->appendXMLContent($this->media_object->getXML(
IL_MODE_ALIAS));
1076 case "MediaAliasItem":
1077 $this->in_media_item =
false;
1078 $this->media_object->addMediaItem($this->media_item);
1082 $this->in_map_area =
false;
1083 $this->media_item->addMapArea($this->map_area);
1087 $this->in_properties =
false;
1088 if ($this->content_object->getType() ==
"lm") {
1089 $this->content_object->update();
1094 $this->in_meta_data =
false;
1095 if (strtolower(get_class($this->current_object)) ==
"illmpageobject" && !$this->in_media_object) {
1097 if (is_object($this->lm_page_object)) {
1099 $this->current_object->MDUpdateListener(
'General');
1101 $this->current_object->getId(),
1102 $this->current_object->getImportId()
1105 } elseif ((strtolower(get_class($this->current_object)) ==
"ilobjquestionpool" ||
1106 strtolower(get_class($this->current_object)) ==
"ilobjtest") &&
1107 !$this->in_media_object) {
1111 if ($this->metadata_parsing_disabled) {
1114 if ($this->in_page_object && !is_null($this->page_object)) {
1122 $this->current_object->MDUpdateListener(
'General');
1124 $this->current_object->getId(),
1125 $this->current_object->getImportId()
1129 } elseif (strtolower(get_class($this->current_object)) ==
"ilstructureobject") {
1131 $cnt = count($this->structure_objects);
1133 $parent_id = $this->structure_objects[$cnt - 2]->getId();
1135 $parent_id = $this->lm_tree->getRootId();
1138 $this->st_into_tree[] = array(
"id" => $this->current_object->getId(),
1139 "parent" => $parent_id);
1142 $this->current_object->MDUpdateListener(
'General');
1144 $this->current_object->getId(),
1145 $this->current_object->getImportId()
1147 } elseif (strtolower(get_class($this->current_object)) ==
"ilobjlearningmodule" ||
1148 strtolower(get_class($this->current_object)) ==
"ilobjcontentobject" ||
1149 (strtolower(get_class($this->current_object)) ==
"ilobjglossary" && $this->in_glossary)) {
1152 } elseif (strtolower(get_class($this->current_object)) ==
"ilglossarydefinition" && !$this->in_media_object) {
1156 $this->page_object->setId($this->glossary_definition->getId());
1157 $this->page_object->updateFromXML();
1164 if (strtolower(get_class($this->current_object)) ==
"ilobjlearningmodule" ||
1165 strtolower(get_class($this->current_object)) ==
"ilobjglossary") {
1166 if (strtolower(get_class($this->current_object)) ==
"ilobjglossary" &&
1167 $this->content_object->getType() !=
"glo") {
1169 $this->current_object->setTitle($this->content_object->getTitle() .
" - " .
1170 $this->
lng->txt(
"glossary"));
1173 $this->current_object->MDUpdateListener(
'General');
1182 if ($this->in_media_object) {
1184 $this->media_object->MDUpdateListener(
'General');
1187 if ($this->in_glossary_definition) {
1188 $this->glossary_definition->MDUpdateListener(
'General');
1193 case "Meta-Metadata":
1194 $this->in_meta_meta_data =
false;
1198 $this->in_file_item =
false;
1200 if ($this->file_item->getImportId()) {
1201 $this->file_item->update();
1207 unset($this->container[count($this->container) - 1]);
1211 $this->in_glossary =
false;
1214 case "GlossaryTerm":
1215 $term = trim($this->chr_data);
1216 $term = str_replace(
"<",
"<", $term);
1217 $term = str_replace(
">",
">", $term);
1218 $this->glossary_term->setTerm($term);
1219 $this->glossary_term->create();
1220 $iia = explode(
"_", $this->glossary_term->getImportId());
1221 $this->glossary_term_map[(
int) $iia[count($iia) - 1]] = $this->glossary_term->getId();
1225 $this->inside_code =
false;
1229 $this->in_glossary_definition =
false;
1230 $this->page_object->updateFromXML();
1231 $this->page_object->buildDom();
1232 $this->glossary_definition->setShortText($this->page_object->getFirstParagraphText());
1233 $this->glossary_definition->update();
1234 if ($this->page_object->containsIntLink()) {
1235 $this->pages_to_parse[
"gdf:" . $this->page_object->getId()] =
"gdf:" . $this->page_object->getId();
1237 if ($this->page_object->needsImportParsing()) {
1238 $this->pages_to_parse[
"gdf:" . $this->page_object->getId()] =
"gdf:" . $this->page_object->getId();
1243 if ($this->in_media_item) {
1244 $this->media_item->setFormat(trim($this->chr_data));
1249 if ($this->in_meta_data && !$this->in_media_object) {
1250 $this->current_object->setTitle(trim($this->chr_data));
1252 if ($this->in_media_object) {
1253 $this->media_object->setTitle(trim($this->chr_data));
1262 if ($this->in_media_object) {
1263 $this->media_item->setCaption(trim($this->chr_data));
1267 case "TextRepresentation":
1268 if ($this->in_media_object) {
1269 $this->media_item->setTextRepresentation(trim($this->chr_data));
1276 if ($this->in_media_item) {
1277 $this->media_item->setLocationType($this->loc_type);
1278 if ($this->loc_type ==
"Reference") {
1279 $this->media_item->setLocation(str_replace(
"&",
"&", trim($this->chr_data)));
1281 $this->media_item->setLocation(trim($this->chr_data));
1284 if ($this->in_file_item) {
1286 $this->file_item->setFileName(trim($this->chr_data));
1290 if ($this->file_item->getType() ==
"file" &&
1291 is_int(strpos($this->chr_data,
"&")) &&
1292 is_int(strpos($this->chr_data,
";"))) {
1294 $source_dir = $imp_dir .
"/" . $this->subdir .
"/objects/" .
1295 $this->file_item->getImportId();
1298 if ($dir = opendir($source_dir)) {
1299 while (
false !== ($file = readdir($dir))) {
1300 if ($file !=
"." && $file !=
"..") {
1301 $this->file_item->setFileName($file);
1309 $this->file_item->setTitle(trim($this->chr_data));
1315 $this->chr_data =
"";
1321 if ($this->in_meta_data && $this->
processMeta()) {
1325 if ($this->in_media_object && $this->media_meta_start) {
1326 $this->media_meta_cache[] =
1327 array(
"type" =>
"handlerCharacterData",
"par1" => $a_data);
1329 parent::handlerCharacterData($a_xml_parser, $a_data);
1337 $a_data = str_replace(
"<",
"<", $a_data);
1338 $a_data = str_replace(
">",
">", $a_data);
1342 $a_data = preg_replace(
"/\n/",
"", $a_data);
1343 if (!$this->inside_code) {
1344 $a_data = preg_replace(
"/\t+/",
"", $a_data);
1347 $this->chr_data .= $a_data;
1349 if (!empty($a_data) || $a_data ===
"0") {
1352 if (($this->in_page_object || $this->in_glossary_definition)
1353 && !$this->in_meta_data && !$this->in_media_object) {
1354 $this->page_object->appendXMLContent($a_data);
1361 if ($this->in_map_area) {
1362 $this->map_area->appendTitle($a_data);
1375 foreach ($this->media_meta_cache as $cache_entry) {
1376 switch ($cache_entry[
"type"]) {
1377 case "handlerBeginTag":
1378 parent::handlerBeginTag(
1380 $cache_entry[
"par1"],
1381 $cache_entry[
"par2"]
1385 case "handlerEndTag":
1386 parent::handlerEndTag(
1388 $cache_entry[
"par1"]
1392 case "handlerCharacterData":
1393 parent::handlerCharacterData(
1395 $cache_entry[
"par1"]
1401 $this->media_meta_start =
false;
1402 $this->media_meta_cache[] = array();
1420 $link_arr = explode(
'_', $identifier);
1422 if (count($link_arr) !== 4
1423 || $link_arr[0] !==
'il' 1424 || !is_numeric($link_arr[1])
1425 || !is_numeric($link_arr[3])
1431 'target_inst' => (
int) $link_arr[1],
1432 'target_type' => (
string) $link_arr[2],
1433 '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)
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)
create(bool $a_upload=false, bool $a_omit_page_creation=false)
ilGlossaryTerm $glossary_term
write(string $a_message, $a_level=ilLogLevel::INFO)
write log message
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...
setQuestionMapping(array $a_map)
set question import ident to pool/test question id mapping
ilGlossaryDefinition $glossary_definition
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="")
_resolveIntLinks(int $question_id)
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)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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...
__construct(Container $dic, ilPlugin $plugin)
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