69 public function __construct(&$a_content_object, $a_xml_file, $a_subdir, $a_import_dir =
"")
73 $this->log = $DIC[
"ilLog"];
74 $lng = $DIC->language();
75 $tree = $DIC->repositoryTree();
79 $this->import_dir = ($a_import_dir !=
"")
81 : $a_content_object->getImportDirectory();
85 $this->current_element = array();
86 $this->structure_objects = array();
87 $this->content_object = $a_content_object;
89 $this->st_into_tree = array();
90 $this->pg_into_tree = array();
91 $this->pages_to_parse = array();
92 $this->mobs_with_int_links = array();
93 $this->mob_mapping = array();
94 $this->file_item_mapping = array();
95 $this->pg_mapping = array();
96 $this->link_targets = array();
97 $this->subdir = $a_subdir;
100 $this->inside_code =
false;
101 $this->qst_mapping = array();
102 $this->coType = $this->content_object->getType();
103 $this->metadata_parsing_disabled =
false;
105 if (($this->coType !=
"tst") and ($this->coType !=
"qpl")) {
106 $this->lm_tree =
new ilTree($this->content_object->getId());
107 $this->lm_tree->setTreeTablePK(
"lm_id");
108 $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
121 xml_set_object($a_xml_parser, $this);
122 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
123 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
132 $this->mapping = $mapping;
141 $this->log->debug(
"start");
144 parent::startParsing();
165 foreach ($this->st_into_tree as $st) {
167 $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) {
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"]);
214 foreach ($this->pages_to_parse as $page_id) {
215 $page_arr = explode(
":", $page_id);
217 switch ($page_arr[0]) {
219 switch ($this->content_object->getType()) {
221 $page_obj =
new ilLMPage($page_arr[1]);
225 die(
"Unknown content type " . $this->content_object->getType());
238 $page_obj->buildDom();
239 $page_obj->resolveIntLinks();
240 $page_obj->resolveIIMMediaAliases($this->mob_mapping);
241 if (in_array($this->coType, array(
"lm"))) {
242 $page_obj->resolveQuestionReferences($this->qst_mapping);
244 $page_obj->update(
false);
246 if ($page_arr[0] ==
"gdf") {
248 $def->updateShortText();
256 foreach ($this->mobs_with_int_links as $mob_id) {
263 foreach ($this->link_targets as $link_target) {
265 $link_arr = explode(
"_", $link_target);
266 $target_inst = $link_arr[1];
271 foreach ($sources as $key =>
$source) {
273 if (in_array($key, $done)) {
276 $type_arr = explode(
":",
$source[
"type"]);
279 if ($type_arr[1] ==
"pg") {
290 if ($type_arr[0] ==
"qst") {
294 if ($type_arr[0] ==
"sqst") {
308 $imp_dir = $this->import_dir;
309 foreach ($this->mob_mapping as $origin_id => $mob_id) {
310 if (empty($origin_id)) {
325 $obj_dir = $origin_id;
326 $source_dir = $imp_dir .
"/" . $this->subdir .
"/objects/" . $obj_dir;
329 if (@is_dir($source_dir)) {
335 if (@is_dir($target_dir)) {
348 $imp_dir = $this->import_dir;
349 foreach ($this->file_item_mapping as $origin_id => $file_id) {
350 if (empty($origin_id)) {
353 $obj_dir = $origin_id;
354 $source_dir = $imp_dir .
"/" . $this->subdir .
"/objects/" . $obj_dir;
356 $file_obj =
new ilObjFile($file_id,
false);
358 $target_dir = $file_obj->getDirectory();
359 if (@is_dir($source_dir)) {
365 if (@is_dir($target_dir)) {
369 $test = $file_obj->determineFilesize();
379 $this->qst_mapping = $a_map;
388 if (!isset($this->status[
"$a_name"])) {
389 $this->cnt[$a_name] == 1;
391 $this->cnt[$a_name]++;
393 $this->current_element[count($this->current_element)] = $a_name;
403 $this->cnt[$a_name]--;
404 unset($this->current_element[count($this->current_element) - 1]);
412 return ($this->current_element[count($this->current_element) - 1]);
422 if (isset($this->cnt[$a_name])) {
423 return $this->cnt[$a_name];
440 if (
$type ==
"end") {
446 if (is_array($attr)) {
447 foreach ($attr as $k => $v) {
448 $tag .=
" " . $k .
"=\"$v\"";
468 case "ContentObject":
471 if ($a_attribs[
"Type"] ==
"Glossary") {
476 case "StructureObject":
478 $this->structure_objects[count($this->structure_objects)]
480 $this->current_object = $this->structure_objects[count($this->structure_objects) - 1];
481 $this->current_object->setLMId($this->content_object->getId());
485 $this->current_object->create(
true);
489 $this->in_page_object =
true;
491 if (($this->coType !=
"tst") and ($this->coType !=
"qpl")) {
492 $this->lm_page_object =
new ilLMPageObject($this->content_object);
493 $this->page_object =
new ilLMPage();
494 $this->lm_page_object->setLMId($this->content_object->getId());
495 $this->lm_page_object->assignPageObject($this->page_object);
503 if (($this->coType !=
"tst") and ($this->coType !=
"qpl")) {
504 $this->lm_page_object->setAlias(
true);
505 $this->lm_page_object->setOriginID($a_attribs[
"OriginId"]);
510 $this->in_media_object =
true;
512 case "InteractiveImage":
514 $this->media_meta_start =
true;
515 $this->media_meta_cache = array();
521 $this->media_object->setAlias(
true);
522 $this->media_object->setImportId($a_attribs[
"OriginId"]);
523 if (is_object($this->page_object)) {
524 $this->page_object->needsImportParsing(
true);
529 case "MediaAliasItem":
530 $this->in_media_item =
true;
532 $this->media_item->setPurpose($a_attribs[
"Purpose"]);
541 if (is_object($this->media_object) && $this->in_media_object) {
542 $this->media_item->setWidth($a_attribs[
"Width"]);
543 $this->media_item->setHeight($a_attribs[
"Height"]);
544 $this->media_item->setHAlign($a_attribs[
"HorizontalAlign"]);
549 if (is_object($this->media_object) && $this->in_media_object) {
550 $this->media_item->setParameter($a_attribs[
"Name"], $a_attribs[
"Value"]);
555 $this->in_map_area =
true;
557 $this->map_area->setShape($a_attribs[
"Shape"]);
558 $this->map_area->setCoords($a_attribs[
"Coords"]);
559 $this->map_area->setHighlightMode($a_attribs[
"HighlightMode"]);
560 $this->map_area->setHighlightClass($a_attribs[
"HighlightClass"]);
564 $this->in_glossary =
true;
565 if ($this->content_object->getType() !=
"glo") {
567 $this->glossary_object->setTitle(
"");
568 $this->glossary_object->setDescription(
"");
569 $this->glossary_object->create(
true);
570 $this->glossary_object->createReference();
571 $parent = $this->tree->getParentNodeData($this->content_object->getRefId());
572 $this->glossary_object->putInTree($parent[
"child"]);
573 $this->glossary_object->setPermissions($parent[
"child"]);
580 $this->glossary_term->setGlossaryId($this->glossary_object->getId());
581 $this->glossary_term->setLanguage($a_attribs[
"Language"]);
582 $this->glossary_term->setImportId($a_attribs[
"Id"]);
583 $this->link_targets[$a_attribs[
"Id"]] = $a_attribs[
"Id"];
587 $this->in_glossary_definition =
true;
590 $this->page_object->setParentId($this->glossary_term->getGlossaryId());
591 $this->glossary_definition->setTermId($this->glossary_term->getId());
592 $this->glossary_definition->assignPageObject($this->page_object);
593 $this->current_object = $this->glossary_definition;
594 $this->glossary_definition->create(
true);
597 $this->page_object->setXMLContent(
"");
601 $this->in_file_item =
true;
603 $this->file_item->setTitle(
"dummy");
604 $this->file_item->setMode(
"filelist");
605 if (is_object($this->page_object)) {
606 $this->page_object->needsImportParsing(
true);
611 if ($a_attribs[
"Characteristic"] ==
"Code") {
612 $this->inside_code =
true;
617 $this->in_properties =
true;
621 if ($this->content_object->getType() ==
"lm") {
622 switch ($a_attribs[
"Name"]) {
624 $this->content_object->setLayout($a_attribs[
"Value"]);
628 $this->content_object->setPageHeader($a_attribs[
"Value"]);
632 $this->content_object->setTOCMode($a_attribs[
"Value"]);
636 $this->content_object->setActiveLMMenu(
641 case "ActiveNumbering":
642 $this->content_object->setActiveNumbering(
648 $this->content_object->setActiveTOC(
653 case "ActivePrintView":
654 $this->content_object->setActivePrintView(
660 $this->content_object->setCleanFrames(
666 $this->content_object->setPublicNotes(
671 case "HistoryUserComments":
672 $this->content_object->setHistoryUserComments(
678 $this->content_object->setRating(
684 $this->content_object->setRatingPages(
690 if ($a_attribs[
"Value"] !=
"") {
691 if ($this->pg_mapping[$a_attribs[
"Value"]] > 0) {
692 $this->content_object->setHeaderPage(
693 $this->pg_mapping[$a_attribs[
"Value"]]
700 if ($a_attribs[
"Value"] !=
"") {
701 if ($this->pg_mapping[$a_attribs[
"Value"]] > 0) {
702 $this->content_object->setFooterPage(
703 $this->pg_mapping[$a_attribs[
"Value"]]
709 case "LayoutPerPage":
710 $this->content_object->setLayoutPerPage($a_attribs[
"Value"]);
713 case "ProgressIcons":
714 $this->content_object->setProgressIcons($a_attribs[
"Value"]);
718 $this->content_object->setStoreTries($a_attribs[
"Value"]);
721 case "RestrictForwardNavigation":
722 $this->content_object->setRestrictForwardNavigation($a_attribs[
"Value"]);
725 case "DisableDefaultFeedback":
726 $this->content_object->setDisableDefaultFeedback($a_attribs[
"Value"]);
738 $this->in_meta_data =
true;
743 if (!$this->in_media_object) {
744 if (($this->coType !=
"tst") and ($this->coType !=
"qpl")) {
746 if ($this->current_object->getType() ==
"st" ||
747 $this->current_object->getType() ==
"pg") {
749 if ($this->current_object->getType() ==
"pg") {
750 $this->lm_page_object->create(
true);
752 $this->md =
new ilMD(
753 $this->content_object->getId(),
754 $this->current_object->getId(),
755 $this->current_object->getType()
759 elseif ($this->current_object->getType() ==
"gdf") {
760 $this->md =
new ilMD(
761 $this->glossary_object->getId(),
762 $this->current_object->getId(),
763 $this->current_object->getType()
769 $this->md =
new ilMD(
770 $this->current_object->getId(),
772 $this->current_object->getType()
778 $this->md =
new ilMD(
779 $this->content_object->getId(),
781 $this->current_object->getType()
783 if ($this->md->getGeneral() !=
false) {
784 $this->metadata_parsing_disabled =
true;
798 if ($import_id_parsed[
'type'] ==
'st') {
799 $this->mapping->addMapping(
800 'Modules/LearningModule',
802 $import_id_parsed[
'id'],
803 $this->current_object->getId()
811 if (!$this->in_meta_meta_data) {
812 if ($this->in_meta_data && !$this->in_glossary_definition) {
813 if (!$this->in_media_object) {
814 $this->current_object->setImportId($a_attribs[
"Entry"]);
816 $this->link_targets[$a_attribs[
"Entry"]] = $a_attribs[
"Entry"];
818 if ($this->in_file_item) {
819 if ($this->file_item_mapping[$a_attribs[
"Entry"]] ==
"") {
820 $this->file_item->create();
821 $this->file_item->setImportId($a_attribs[
"Entry"]);
822 $this->file_item_mapping[$a_attribs[
"Entry"]] = $this->file_item->getId();
825 if ($this->in_meta_data && $this->in_media_object) {
828 $mob_id = $this->mob_mapping[$a_attribs[
"Entry"]];
837 $this->media_object->create(
true,
false);
838 $this->mob_mapping[$a_attribs[
"Entry"]]
839 = $this->media_object->getId();
841 $this->media_object->setImportId($a_attribs[
"Entry"]);
842 $this->md =
new ilMD(
844 $this->media_object->getId(),
852 case "Meta-Metadata":
853 $this->in_meta_meta_data =
true;
858 if (is_object($this->page_object)) {
859 $this->page_object->setContainsIntLink(
true);
861 if ($this->in_map_area) {
864 $this->map_area->setTarget($a_attribs[
"Target"]);
865 $this->map_area->setType($a_attribs[
"Type"]);
866 $this->map_area->setTargetFrame($a_attribs[
"TargetFrame"]);
867 if (is_object($this->media_object)) {
869 $this->media_object->setContainsIntLink(
true);
876 if ($this->in_map_area) {
878 $this->map_area->setHref($a_attribs[
"Href"]);
879 $this->map_area->setExtTitle($a_attribs[
"Title"]);
885 $this->cur_qid = $a_attribs[
"QRef"];
886 $this->page_object->setContainsQuestion(
true);
890 $this->loc_type = $a_attribs[
"Type"];
897 if (($this->in_page_object || $this->in_glossary_definition)
898 && !$this->in_meta_data && !$this->in_media_object) {
899 if ($a_name ==
"Definition") {
900 $app_name =
"PageObject";
901 $app_attribs = array();
904 $app_attribs = $a_attribs;
908 if ($this->in_file_item && $app_name ==
"Identifier") {
909 $app_attribs[
"Entry"] =
"il__file_" . $this->file_item_mapping[$a_attribs[
"Entry"]];
913 $this->page_object->appendXMLContent($this->
buildTag(
"start", $app_name, $app_attribs));
924 if ($this->in_media_object && $this->media_meta_start) {
925 $this->media_meta_cache[] =
926 array(
"type" =>
"handlerBeginTag",
"par1" => $a_name,
"par2" => $a_attribs);
928 if ($a_name ==
"Identifier") {
929 if (!$this->in_media_object) {
930 $a_attribs[
"Entry"] =
"il__" . $this->current_object->getType() .
931 "_" . $this->current_object->getId();
933 $a_attribs[
"Entry"] =
"il__mob" .
934 "_" . $this->media_object->getId();
936 $a_attribs[
"Catalog"] =
"ILIAS";
939 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
951 if ($this->content_object->getType() ==
"glo" &&
952 $this->in_glossary && !$this->in_media_object
953 && !$this->in_glossary_definition) {
974 if ($this->in_media_object && $this->media_meta_start) {
975 $this->media_meta_cache[] =
976 array(
"type" =>
"handlerEndTag",
"par1" => $a_name);
978 parent::handlerEndTag($a_xml_parser, $a_name);
984 if (($this->in_page_object || $this->in_glossary_definition)
985 && !$this->in_meta_data && !$this->in_media_object) {
986 $app_name = ($a_name ==
"Definition")
989 $this->page_object->appendXMLContent($this->
buildTag(
"end", $app_name));
993 case "StructureObject":
995 unset($this->structure_objects[count($this->structure_objects) - 1]);
1000 $this->in_page_object =
false;
1001 if (($this->coType !=
"tst") and ($this->coType !=
"qpl")) {
1002 if (!$this->lm_page_object->isAlias()) {
1004 $this->page_object->updateFromXML();
1005 $this->pg_mapping[$this->lm_page_object->getImportId()]
1006 = $this->lm_page_object->getId();
1010 if ($import_id_parsed[
'type'] ==
'pg') {
1011 $this->mapping->addMapping(
1012 'Modules/LearningModule',
1014 $import_id_parsed[
'id'],
1015 $this->lm_page_object->getId()
1021 if ($this->page_object->containsIntLink()) {
1022 $this->pages_to_parse[
"lm:" . $this->page_object->getId()] =
"lm:" . $this->page_object->getId();
1026 if ($this->page_object->needsImportParsing()) {
1027 $this->pages_to_parse[
"lm:" . $this->page_object->getId()] =
"lm:" . $this->page_object->getId();
1031 if ($this->page_object->getContainsQuestion()) {
1032 $this->pages_to_parse[
"lm:" . $this->page_object->getId()] =
"lm:" . $this->page_object->getId();
1036 $xml = $this->page_object->getXMLContent();
1037 if ($this->cur_qid !=
"") {
1038 $ids = $this->qst_mapping[$this->cur_qid];
1039 if ($ids[
"pool"] > 0) {
1042 $xmlcontent = str_replace(
1044 "il__qst_" . $ids[
"pool"],
1047 $page->setXMLContent($xmlcontent);
1048 $page->updateFromXML();
1049 if ($this->page_object->needsImportParsing()) {
1050 $this->pages_to_parse[
"qpl:" . $page->getId()] =
"qpl:" . $page->getId();
1054 if ($ids[
"test"] > 0) {
1057 $xmlcontent = str_replace(
1059 "il__qst_" . $ids[
"test"],
1062 $page->setXMLContent($xmlcontent);
1063 $page->updateFromXML();
1064 if ($this->page_object->needsImportParsing()) {
1065 $this->pages_to_parse[
"qpl:" . $page->getId()] =
"qpl:" . $page->getId();
1073 $cnt = count($this->structure_objects);
1078 $parent_id = $this->structure_objects[
$cnt - 1]->getId();
1079 if ($this->lm_page_object->isAlias()) {
1081 $this->pg_into_tree[$parent_id][] = array(
"type" =>
"pg_alias",
"id" => $this->lm_page_object->getOriginId());
1085 $this->pg_into_tree[$parent_id][] = array(
"type" =>
"pg",
"id" => $this->lm_page_object->getId());
1089 unset($this->page_object);
1090 unset($this->lm_page_object);
1091 unset($this->container[count($this->container) - 1]);
1095 $this->in_media_object =
false;
1097 case "InteractiveImage":
1103 if (empty($this->mob_mapping[$this->media_object->getImportId()])) {
1109 $this->media_object->create(
true,
false);
1114 if ($this->media_object->containsIntLink()) {
1116 $this->mobs_with_int_links[] = $this->media_object->getId();
1119 $this->mob_mapping[$this->media_object->getImportId()]
1120 = $this->media_object->getId();
1125 $this->media_object->setId($this->mob_mapping[$this->media_object->getImportId()]);
1132 if (!$this->media_object->isAlias()) {
1134 $this->media_object->update();
1139 if ($this->media_object->containsIntLink()) {
1141 $this->mobs_with_int_links[] = $this->media_object->getId();
1147 if ($this->in_page_object || $this->in_glossary_definition) {
1148 if ($a_name !=
"InteractiveImage") {
1149 $this->page_object->appendXMLContent($this->media_object->getXML(
IL_MODE_ALIAS));
1157 case "MediaAliasItem":
1158 $this->in_media_item =
false;
1159 $this->media_object->addMediaItem($this->media_item);
1164 $this->in_map_area =
false;
1165 $this->media_item->addMapArea($this->map_area);
1169 $this->in_properties =
false;
1170 if ($this->content_object->getType() ==
"lm") {
1171 $this->content_object->update();
1176 $this->in_meta_data =
false;
1177 if (strtolower(get_class($this->current_object)) ==
"illmpageobject" && !$this->in_media_object) {
1179 if (is_object($this->lm_page_object)) {
1181 $this->current_object->MDUpdateListener(
'General');
1183 $this->current_object->getId(),
1184 $this->current_object->getImportId()
1187 } elseif ((strtolower(get_class($this->current_object)) ==
"ilobjquestionpool" ||
1188 strtolower(get_class($this->current_object)) ==
"ilobjtest") &&
1189 !$this->in_media_object) {
1193 if ($this->metadata_parsing_disabled) {
1196 if ($this->in_page_object) {
1197 $this->page_object->MDUpdateListener(
'General');
1199 $this->page_object->getId(),
1200 $this->page_object->getImportId()
1203 $this->current_object->MDUpdateListener(
'General');
1205 $this->current_object->getId(),
1206 $this->current_object->getImportId()
1210 } elseif (strtolower(get_class($this->current_object)) ==
"ilstructureobject") {
1212 $cnt = count($this->structure_objects);
1214 $parent_id = $this->structure_objects[
$cnt - 2]->getId();
1216 $parent_id = $this->lm_tree->getRootId();
1221 $this->st_into_tree[] = array(
"id" => $this->current_object->getId(),
1222 "parent" => $parent_id);
1225 $this->current_object->MDUpdateListener(
'General');
1227 $this->current_object->getId(),
1228 $this->current_object->getImportId()
1230 } elseif (strtolower(get_class($this->current_object)) ==
"ilobjlearningmodule" ||
1231 strtolower(get_class($this->current_object)) ==
"ilobjcontentobject" ||
1232 (strtolower(get_class($this->current_object)) ==
"ilobjglossary" && $this->in_glossary)) {
1235 } elseif (strtolower(get_class($this->current_object)) ==
"ilglossarydefinition" && !$this->in_media_object) {
1239 $this->page_object->setId($this->glossary_definition->getId());
1240 $this->page_object->updateFromXML();
1247 if (strtolower(get_class($this->current_object)) ==
"ilobjlearningmodule" ||
1248 strtolower(get_class($this->current_object)) ==
"ilobjglossary") {
1249 if (strtolower(get_class($this->current_object)) ==
"ilobjglossary" &&
1250 $this->content_object->getType() !=
"glo") {
1252 $this->current_object->setTitle($this->content_object->getTitle() .
" - " .
1253 $this->lng->txt(
"glossary"));
1256 $this->current_object->MDUpdateListener(
'General');
1265 if ($this->in_media_object) {
1267 $this->media_object->MDUpdateListener(
'General');
1270 if ($this->in_glossary_definition) {
1271 $this->glossary_definition->MDUpdateListener(
'General');
1276 case "Meta-Metadata":
1277 $this->in_meta_meta_data =
false;
1281 $this->in_file_item =
false;
1283 if ($this->file_item->getImportId($a_attribs[
"Entry"] !=
"")) {
1284 $this->file_item->update();
1290 unset($this->container[count($this->container) - 1]);
1294 $this->in_glossary =
false;
1297 case "GlossaryTerm":
1298 $term = trim($this->chr_data);
1299 $term = str_replace(
"<",
"<", $term);
1300 $term = str_replace(
">",
">", $term);
1301 $this->glossary_term->setTerm($term);
1302 $this->glossary_term->create();
1303 $iia = explode(
"_", $this->glossary_term->getImportId());
1304 $this->glossary_term_map[(int) $iia[count($iia) - 1]] = $this->glossary_term->getId();
1308 $this->inside_code =
false;
1312 $this->in_glossary_definition =
false;
1313 $this->page_object->updateFromXML();
1316 $this->page_object->buildDom();
1317 $this->glossary_definition->setShortText($this->page_object->getFirstParagraphText());
1318 $this->glossary_definition->update();
1321 if ($this->page_object->containsIntLink()) {
1323 $this->pages_to_parse[
"gdf:" . $this->page_object->getId()] =
"gdf:" . $this->page_object->getId();
1325 if ($this->page_object->needsImportParsing()) {
1326 $this->pages_to_parse[
"gdf:" . $this->page_object->getId()] =
"gdf:" . $this->page_object->getId();
1331 if ($this->in_media_item) {
1332 $this->media_item->setFormat(trim($this->chr_data));
1334 if ($this->in_file_item) {
1335 $this->file_item->setFileType(trim($this->chr_data));
1340 if (!$this->in_media_object) {
1341 $this->current_object->setTitle(trim($this->chr_data));
1344 $this->media_object->setTitle(trim($this->chr_data));
1363 if ($this->in_media_object) {
1364 $this->media_item->setCaption(trim($this->chr_data));
1368 case "TextRepresentation":
1369 if ($this->in_media_object) {
1370 $this->media_item->setTextRepresentation(trim($this->chr_data));
1377 if ($this->in_media_item) {
1378 $this->media_item->setLocationType($this->loc_type);
1379 if ($this->loc_type ==
"Reference") {
1380 $this->media_item->setLocation(str_replace(
"&",
"&", trim($this->chr_data)));
1382 $this->media_item->setLocation(trim($this->chr_data));
1386 if ($this->in_file_item) {
1388 $this->file_item->setFileName(trim($this->chr_data));
1392 if ($this->file_item->getType() ==
"file" &&
1393 is_int(strpos($this->chr_data,
"&")) &&
1394 is_int(strpos($this->chr_data,
";"))) {
1395 $imp_dir = $this->import_dir;
1396 $source_dir = $imp_dir .
"/" . $this->subdir .
"/objects/" .
1397 $this->file_item->getImportId();
1400 if ($dir = opendir($source_dir)) {
1401 while (
false !== ($file = readdir($dir))) {
1402 if ($file !=
"." && $file !=
"..") {
1403 $this->file_item->setFileName($file);
1411 $this->file_item->setTitle(trim($this->chr_data));
1417 $this->chr_data =
"";
1429 if ($this->in_meta_data && $this->
processMeta()) {
1433 if ($this->in_media_object && $this->media_meta_start) {
1434 $this->media_meta_cache[] =
1435 array(
"type" =>
"handlerCharacterData",
"par1" => $a_data);
1437 parent::handlerCharacterData($a_xml_parser, $a_data);
1445 $a_data = str_replace(
"<",
"<", $a_data);
1446 $a_data = str_replace(
">",
">", $a_data);
1450 $a_data = preg_replace(
"/\n/",
"", $a_data);
1451 if (!$this->inside_code) {
1452 $a_data = preg_replace(
"/\t+/",
"", $a_data);
1455 $this->chr_data .= $a_data;
1457 if (!empty($a_data) || $a_data ===
"0") {
1460 if (($this->in_page_object || $this->in_glossary_definition)
1461 && !$this->in_meta_data && !$this->in_media_object) {
1462 $this->page_object->appendXMLContent($a_data);
1465 if ($this->in_meta_data) {
1474 if ($this->in_map_area) {
1475 $this->map_area->appendTitle($a_data);
1490 foreach ($this->media_meta_cache as $cache_entry) {
1491 switch ($cache_entry[
"type"]) {
1492 case "handlerBeginTag":
1493 parent::handlerBeginTag(
1495 $cache_entry[
"par1"],
1496 $cache_entry[
"par2"]
1500 case "handlerEndTag":
1501 parent::handlerEndTag(
1503 $cache_entry[
"par1"]
1507 case "handlerCharacterData":
1508 parent::handlerCharacterData(
1510 $cache_entry[
"par1"]
1516 $this->media_meta_start =
false;
1517 $this->media_meta_cache[] = array();
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
__construct(&$a_content_object, $a_xml_file, $a_subdir, $a_import_dir="")
Constructor.
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
startParsing()
start parser
$metadata_parsing_disabled
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
enableMDParsing($a_status)
processPagesToParse()
parse pages that contain files, mobs and/or internal links
emptyMediaMetaCache(&$a_xml_parser)
send all cached tags to the meta data parser and clear the cache
static _resolveIntLinks($question_id)
static parseImportId($a_import_id)
Parse an ilias import id Typically of type il_[IL_INST_ID]_[OBJ_TYPE]_[OBJ_ID] returns array( 'orig' ...
setImportMapping(ilImportMapping $mapping=null)
Set import mapping.
copyFileItems()
copy files of file items
setQuestionMapping($a_map)
set question import ident to pool/test question id mapping
storeTree()
insert StructureObjects and PageObjects into tree
static _getSourcesOfTarget($a_target_type, $a_target_id, $a_target_inst)
get all sources of a link target
Glossary definition page object.
static _writeImportId($a_id, $a_import_id)
write import id to db (static)
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
Class ilGlossaryDefinition.
_resolveIntLinks($question_id)
static getInstance($a_parent_type, $a_id=0, $a_old_nr=0, $a_lang="-")
Get page object instance.
handlerEndTag($a_xml_parser, $a_name)
handler for end of element
__construct(Container $dic, ilPlugin $plugin)
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
copyMobFiles()
copy multimedia object files from import zip file to mob directory
static getLogger($a_component_id)
Get component logger.
processMeta()
check whether meta data should be processed
static yn2tf($a_yn)
convert "y"/"n" to true/false
buildTag($type, $name, $attr="")
generate a tag with given name and attributes
static getWebspaceDir($mode="filesystem")
get webspace directory
Extension of ilPageObject for learning modules.
getGlossaryTermMap()
Get glossary term map (imported ids to new ids)
setHandlers($a_xml_parser)
set event handlers