4 require_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
5 require_once(
"./Services/COPage/classes/class.ilPageObject.php");
6 require_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
7 require_once(
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
8 require_once(
"Services/MetaData/classes/class.ilMDLanguageItem.php");
9 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
10 require_once(
"./Services/COPage/classes/class.ilPCTable.php");
11 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
12 require_once(
"./Services/MediaObjects/classes/class.ilMediaItem.php");
13 require_once(
"./Services/MediaObjects/classes/class.ilMapArea.php");
14 require_once(
"./Modules/LearningModule/classes/class.ilBibItem.php");
15 require_once(
"./Modules/Glossary/classes/class.ilObjGlossary.php");
16 require_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
17 require_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
18 require_once(
"./Services/Link/classes/class.ilInternalLink.php");
19 require_once(
"./Modules/File/classes/class.ilObjFile.php");
21 include_once(
"Services/MetaData/classes/class.ilMDSaxParser.php");
22 include_once(
"Services/MetaData/classes/class.ilMD.php");
91 $this->current_element = array();
92 $this->structure_objects = array();
93 $this->content_object = $a_content_object;
95 $this->st_into_tree = array();
96 $this->pg_into_tree = array();
97 $this->pages_to_parse = array();
98 $this->mobs_with_int_links = array();
99 $this->mob_mapping = array();
100 $this->file_item_mapping = array();
101 $this->pg_mapping = array();
102 $this->link_targets = array();
103 $this->subdir = $a_subdir;
106 $this->inside_code =
false;
107 $this->qst_mapping = array();
108 $this->coType = $this->content_object->getType();
109 $this->metadata_parsing_disabled =
false;
111 if (($this->coType !=
"tst") and ($this->coType !=
"qpl"))
113 $this->lm_tree =
new ilTree($this->content_object->getId());
115 $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
129 xml_set_object($a_xml_parser,$this);
130 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
131 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
162 foreach($this->st_into_tree as $st)
165 $this->lm_tree->insertNode($st[
"id"], $st[
"parent"]);
169 if (is_array($this->pg_into_tree[$st[
"id"]]))
171 foreach($this->pg_into_tree[$st[
"id"]] as $pg)
176 if ($this->pg_mapping[$pg[
"id"]] ==
"")
178 $ilLog->write(
"LM Import: No PageObject for PageAlias ".
179 $pg[
"id"].
" found! (Please update export installation to ILIAS 3.3.0)");
184 $pg_id = $this->pg_mapping[$pg[
"id"]];
191 if (!$this->lm_tree->isInTree($pg_id))
193 $this->lm_tree->insertNode($pg_id, $st[
"id"]);
217 foreach($this->pages_to_parse as $page_id)
219 $page_arr = explode(
":", $page_id);
224 switch ($this->content_object->getType())
227 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
228 $page_obj =
new ilLMPage($page_arr[1]);
232 die(
"Unknown content type ".$this->content_object->getType());
238 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefPage.php");
246 $page_obj->buildDom();
247 $page_obj->resolveIntLinks();
248 $page_obj->resolveIIMMediaAliases($this->mob_mapping);
249 if (in_array($this->coType, array(
"lm",
"dbk")))
251 $page_obj->resolveQuestionReferences($this->qst_mapping);
253 $page_obj->update(
false);
255 if ($page_arr[0] ==
"gdf")
258 $def->updateShortText();
266 foreach($this->mobs_with_int_links as $mob_id)
274 foreach ($this->link_targets as $link_target)
277 $link_arr = explode(
"_", $link_target);
278 $target_inst = $link_arr[1];
283 foreach($sources as $key => $source)
286 if(in_array($key, $done))
290 $type_arr = explode(
":", $source[
"type"]);
293 if ($type_arr[1] ==
"pg")
297 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
307 if ($type_arr[0] ==
"qst")
309 require_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
313 if ($type_arr[0] ==
"sqst")
315 require_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
329 $imp_dir = $this->content_object->getImportDirectory();
331 foreach ($this->mob_mapping as $origin_id => $mob_id)
333 if(empty($origin_id))
349 $obj_dir = $origin_id;
350 $source_dir = $imp_dir.
"/".$this->subdir.
"/objects/".$obj_dir;
354 if (@is_dir($source_dir))
361 if (@is_dir($target_dir))
374 $imp_dir = $this->content_object->getImportDirectory();
375 foreach ($this->file_item_mapping as $origin_id => $file_id)
377 if(empty($origin_id))
381 $obj_dir = $origin_id;
382 $source_dir = $imp_dir.
"/".$this->subdir.
"/objects/".$obj_dir;
384 include_once(
"./Modules/File/classes/class.ilObjFile.php");
385 $file_obj =
new ilObjFile($file_id,
false);
387 $target_dir = $file_obj->getDirectory();
388 if (@is_dir($source_dir))
395 if (@is_dir($target_dir))
400 $test = $file_obj->determineFilesize();
410 $this->qst_mapping = $a_map;
419 if(!isset($this->status[
"$a_name"]))
421 $this->cnt[$a_name] == 1;
425 $this->cnt[$a_name]++;
427 $this->current_element[count($this->current_element)] = $a_name;
437 $this->cnt[$a_name]--;
438 unset ($this->current_element[count($this->current_element) - 1]);
446 return ($this->current_element[count($this->current_element) - 1]);
456 if (isset($this->cnt[$a_name]))
458 return $this->cnt[$a_name];
485 while (list($k,$v) = each($attr))
486 $tag.=
" ".$k.
"=\"$v\"";
506 case "ContentObject":
509 if ($a_attribs[
"Type"] ==
"Glossary")
515 case "StructureObject":
517 $this->structure_objects[count($this->structure_objects)]
519 $this->current_object = $this->structure_objects[count($this->structure_objects) - 1];
520 $this->current_object->setLMId($this->content_object->getId());
524 $this->current_object->create(
true);
528 $this->in_page_object =
true;
530 if (($this->coType !=
"tst") and ($this->coType !=
"qpl"))
532 $this->lm_page_object =
new ilLMPageObject($this->content_object);
533 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
534 $this->page_object =
new ilLMPage();
535 $this->lm_page_object->setLMId($this->content_object->getId());
536 $this->lm_page_object->assignPageObject($this->page_object);
541 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
547 if (($this->coType !=
"tst") and ($this->coType !=
"qpl"))
549 $this->lm_page_object->setAlias(
true);
550 $this->lm_page_object->setOriginID($a_attribs[
"OriginId"]);
555 $this->in_media_object =
true;
556 case "InteractiveImage":
558 $this->media_meta_start =
true;
559 $this->media_meta_cache = array();
565 $this->media_object->setAlias(
true);
566 $this->media_object->setImportId($a_attribs[
"OriginId"]);
567 if (is_object($this->page_object))
569 $this->page_object->needsImportParsing(
true);
574 case "MediaAliasItem":
575 $this->in_media_item =
true;
577 $this->media_item->setPurpose($a_attribs[
"Purpose"]);
586 if (is_object($this->media_object) && $this->in_media_object)
588 $this->media_item->setWidth($a_attribs[
"Width"]);
589 $this->media_item->setHeight($a_attribs[
"Height"]);
590 $this->media_item->setHAlign($a_attribs[
"HorizontalAlign"]);
595 if (is_object($this->media_object) && $this->in_media_object)
597 $this->media_item->setParameter($a_attribs[
"Name"], $a_attribs[
"Value"]);
602 $this->in_map_area =
true;
604 $this->map_area->setShape($a_attribs[
"Shape"]);
605 $this->map_area->setCoords($a_attribs[
"Coords"]);
606 $this->map_area->setHighlightMode($a_attribs[
"HighlightMode"]);
607 $this->map_area->setHighlightClass($a_attribs[
"HighlightClass"]);
611 $this->in_glossary =
true;
612 if ($this->content_object->getType() !=
"glo")
615 $this->glossary_object->setTitle(
"");
616 $this->glossary_object->setDescription(
"");
617 $this->glossary_object->create(
true);
618 $this->glossary_object->createReference();
619 $parent = $this->tree->getParentNodeData($this->content_object->getRefId());
620 $this->glossary_object->putInTree($parent[
"child"]);
621 $this->glossary_object->setPermissions($parent[
"child"]);
622 $this->glossary_object->notify(
"new",
$_GET[
"ref_id"],
$_GET[
"parent_non_rbac_id"],
$_GET[
"ref_id"],$this->glossary_object->getRefId());
629 $this->glossary_term->setGlossaryId($this->glossary_object->getId());
630 $this->glossary_term->setLanguage($a_attribs[
"Language"]);
631 $this->glossary_term->setImportId($a_attribs[
"Id"]);
632 $this->link_targets[$a_attribs[
"Id"]] = $a_attribs[
"Id"];
636 $this->in_glossary_definition =
true;
638 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefPage.php");
640 $this->page_object->setParentId($this->glossary_term->getGlossaryId());
641 $this->glossary_definition->setTermId($this->glossary_term->getId());
642 $this->glossary_definition->assignPageObject($this->page_object);
643 $this->current_object = $this->glossary_definition;
644 $this->glossary_definition->create(
true);
647 $this->page_object->setXMLContent(
"");
651 $this->in_file_item =
true;
653 $this->file_item->setTitle(
"dummy");
654 $this->file_item->setMode(
"filelist");
655 if (is_object($this->page_object))
657 $this->page_object->needsImportParsing(
true);
662 if ($a_attribs[
"Characteristic"] ==
"Code")
664 $this->inside_code =
true;
669 $this->in_properties =
true;
673 if ($this->content_object->getType() ==
"lm"
674 || $this->content_object->getType() ==
"dbk")
676 switch($a_attribs[
"Name"])
679 $this->content_object->setLayout($a_attribs[
"Value"]);
683 $this->content_object->setPageHeader($a_attribs[
"Value"]);
687 $this->content_object->setTOCMode($a_attribs[
"Value"]);
691 $this->content_object->setActiveLMMenu(
695 case "ActiveNumbering":
696 $this->content_object->setActiveNumbering(
701 $this->content_object->setActiveTOC(
705 case "ActivePrintView":
706 $this->content_object->setActivePrintView(
711 $this->content_object->setCleanFrames(
716 $this->content_object->setPublicNotes(
720 case "HistoryUserComments":
721 $this->content_object->setHistoryUserComments(
726 $this->content_object->setRating(
731 $this->content_object->setRatingPages(
736 if ($a_attribs[
"Value"] !=
"")
738 if ($this->pg_mapping[$a_attribs[
"Value"]] > 0)
740 $this->content_object->setHeaderPage(
741 $this->pg_mapping[$a_attribs[
"Value"]]);
747 if ($a_attribs[
"Value"] !=
"")
749 if ($this->pg_mapping[$a_attribs[
"Value"]] > 0)
751 $this->content_object->setFooterPage(
752 $this->pg_mapping[$a_attribs[
"Value"]]);
757 case "LayoutPerPage":
758 $this->content_object->setLayoutPerPage($a_attribs[
"Value"]);
761 case "ProgressIcons":
762 $this->content_object->setProgressIcons($a_attribs[
"Value"]);
766 $this->content_object->setStoreTries($a_attribs[
"Value"]);
769 case "RestrictForwardNavigation":
770 $this->content_object->setRestrictForwardNavigation($a_attribs[
"Value"]);
773 case "DisableDefaultFeedback":
774 $this->content_object->setDisableDefaultFeedback($a_attribs[
"Value"]);
786 $this->in_meta_data =
true;
791 if(!$this->in_media_object)
793 if (($this->coType !=
"tst") and ($this->coType !=
"qpl"))
796 if ($this->current_object->getType() ==
"st" ||
797 $this->current_object->getType() ==
"pg")
800 if ($this->current_object->getType() ==
"pg")
802 $this->lm_page_object->create(
true);
804 $this->md =
new ilMD($this->content_object->getId() ,
805 $this->current_object->getId(),
806 $this->current_object->getType());
809 else if ($this->current_object->getType() ==
"gdf")
811 $this->md =
new ilMD($this->glossary_object->getId() ,
812 $this->current_object->getId(),
813 $this->current_object->getType());
820 $this->md =
new ilMD($this->current_object->getId() ,
822 $this->current_object->getType());
829 $this->md =
new ilMD($this->content_object->getId() ,
831 $this->current_object->getType()
833 if ($this->md->getGeneral() !=
false)
835 $this->metadata_parsing_disabled =
true;
846 if (!$this->in_meta_meta_data)
848 if ($this->in_meta_data && !$this->in_glossary_definition)
850 if (!$this->in_media_object)
852 $this->current_object->setImportId($a_attribs[
"Entry"]);
854 $this->link_targets[$a_attribs[
"Entry"]] = $a_attribs[
"Entry"];
856 if ($this->in_file_item)
858 if ($this->file_item_mapping[$a_attribs[
"Entry"]] ==
"")
860 $this->file_item->create();
861 $this->file_item->setImportId($a_attribs[
"Entry"]);
862 $this->file_item_mapping[$a_attribs[
"Entry"]] = $this->file_item->getId();
865 if ($this->in_meta_data && $this->in_media_object)
869 $mob_id = $this->mob_mapping[$a_attribs[
"Entry"]];
881 $this->media_object->create(
true,
false);
882 $this->mob_mapping[$a_attribs[
"Entry"]]
883 = $this->media_object->getId();
885 $this->media_object->setImportId($a_attribs[
"Entry"]);
886 $this->md =
new ilMD(0 ,
887 $this->media_object->getId(),
894 case "Meta-Metadata":
895 $this->in_meta_meta_data =
true;
900 if (is_object($this->page_object))
902 $this->page_object->setContainsIntLink(
true);
904 if ($this->in_map_area)
908 $this->map_area->setTarget($a_attribs[
"Target"]);
909 $this->map_area->setType($a_attribs[
"Type"]);
910 $this->map_area->setTargetFrame($a_attribs[
"TargetFrame"]);
911 if (is_object($this->media_object))
914 $this->media_object->setContainsIntLink(
true);
921 if ($this->in_map_area)
924 $this->map_area->setHref($a_attribs[
"Href"]);
925 $this->map_area->setExtTitle($a_attribs[
"Title"]);
931 $this->cur_qid = $a_attribs[
"QRef"];
932 $this->page_object->setContainsQuestion(
true);
936 $this->loc_type = $a_attribs[
"Type"];
940 $this->in_bib_item =
true;
949 if(($this->in_page_object || $this->in_glossary_definition)
950 && !$this->in_meta_data && !$this->in_media_object)
952 if ($a_name ==
"Definition")
954 $app_name =
"PageObject";
955 $app_attribs = array();
960 $app_attribs = $a_attribs;
964 if ($this->in_file_item && $app_name ==
"Identifier")
966 $app_attribs[
"Entry"] =
"il__file_".$this->file_item_mapping[$a_attribs[
"Entry"]];
970 $this->page_object->appendXMLContent($this->
buildTag(
"start", $app_name, $app_attribs));
975 if ($this->in_bib_item)
977 $this->bib_item->appendXMLContent(
"\n".$this->
buildTag(
"start", $a_name, $a_attribs));
987 if ($this->in_media_object && $this->media_meta_start)
989 $this->media_meta_cache[] =
990 array(
"type" =>
"handlerBeginTag",
"par1" => $a_name,
"par2" => $a_attribs);
994 if ($a_name ==
"Identifier")
996 if (!$this->in_media_object)
998 $a_attribs[
"Entry"] =
"il__".$this->current_object->getType().
999 "_".$this->current_object->getId();
1003 $a_attribs[
"Entry"] =
"il__mob".
1004 "_".$this->media_object->getId();
1006 $a_attribs[
"Catalog"] =
"ILIAS";
1021 if ($this->content_object->getType() ==
"glo" &&
1022 $this->in_glossary && !$this->in_media_object
1023 && !$this->in_glossary_definition)
1046 if ($this->in_media_object && $this->media_meta_start)
1048 $this->media_meta_cache[] =
1049 array(
"type" =>
"handlerEndTag",
"par1" => $a_name);
1059 if (($this->in_page_object || $this->in_glossary_definition)
1060 && !$this->in_meta_data && !$this->in_media_object)
1062 $app_name = ($a_name ==
"Definition")
1065 $this->page_object->appendXMLContent($this->
buildTag(
"end", $app_name));
1069 if ($this->in_bib_item)
1071 if($a_name ==
"BibItem")
1073 $this->bib_item->appendXMLContent(
"\n".$this->
buildTag(
"end", $a_name));
1077 $this->bib_item->appendXMLContent($this->
buildTag(
"end", $a_name));
1084 case "StructureObject":
1086 unset($this->structure_objects[count($this->structure_objects) - 1]);
1091 $this->in_page_object =
false;
1092 if (($this->coType !=
"tst") and ($this->coType !=
"qpl"))
1094 if (!$this->lm_page_object->isAlias())
1097 $this->page_object->updateFromXML();
1098 $this->pg_mapping[$this->lm_page_object->getImportId()]
1099 = $this->lm_page_object->getId();
1102 if ($this->page_object->containsIntLink())
1104 $this->pages_to_parse[
"lm:".$this->page_object->getId()] =
"lm:".$this->page_object->getId();
1108 if ($this->page_object->needsImportParsing())
1110 $this->pages_to_parse[
"lm:".$this->page_object->getId()] =
"lm:".$this->page_object->getId();
1114 if ($this->page_object->getContainsQuestion())
1116 $this->pages_to_parse[
"lm:".$this->page_object->getId()] =
"lm:".$this->page_object->getId();
1123 $xml = $this->page_object->getXMLContent();
1124 if ($this->cur_qid !=
"")
1126 $ids = $this->qst_mapping[$this->cur_qid];
1127 if ($ids[
"pool"] > 0)
1130 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
1132 $xmlcontent = str_replace($this->cur_qid,
1133 "il__qst_".$ids[
"pool"], $xml);
1134 $page->setXMLContent($xmlcontent);
1135 $page->updateFromXML();
1136 if( $this->page_object->needsImportParsing() )
1138 $this->pages_to_parse[
"qpl:".$page->getId()] =
"qpl:".$page->getId();
1142 if ($ids[
"test"] > 0)
1145 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
1147 $xmlcontent = str_replace($this->cur_qid,
1148 "il__qst_".$ids[
"test"], $xml);
1149 $page->setXMLContent($xmlcontent);
1150 $page->updateFromXML();
1151 if( $this->page_object->needsImportParsing() )
1153 $this->pages_to_parse[
"qpl:".$page->getId()] =
"qpl:".$page->getId();
1161 $cnt = count($this->structure_objects);
1167 $parent_id = $this->structure_objects[
$cnt - 1]->getId();
1168 if ($this->lm_page_object->isAlias())
1171 $this->pg_into_tree[$parent_id][] = array(
"type" =>
"pg_alias",
"id" => $this->lm_page_object->getOriginId());
1177 $this->pg_into_tree[$parent_id][] = array(
"type" =>
"pg",
"id" => $this->lm_page_object->getId());
1181 unset($this->page_object);
1182 unset($this->lm_page_object);
1183 unset ($this->container[count($this->container) - 1]);
1187 $this->in_media_object =
false;
1188 case "InteractiveImage":
1194 if(empty($this->mob_mapping[$this->media_object->getImportId()]))
1201 $this->media_object->create(
true,
false);
1206 if ($this->media_object->containsIntLink())
1209 $this->mobs_with_int_links[] = $this->media_object->getId();
1212 $this->mob_mapping[$this->media_object->getImportId()]
1213 = $this->media_object->getId();
1220 $this->media_object->setId($this->mob_mapping[$this->media_object->getImportId()]);
1227 if (!$this->media_object->isAlias())
1230 $this->media_object->update();
1235 if ($this->media_object->containsIntLink())
1238 $this->mobs_with_int_links[] = $this->media_object->getId();
1244 if ($this->in_page_object || $this->in_glossary_definition)
1246 if ($a_name !=
"InteractiveImage")
1248 $this->page_object->appendXMLContent($this->media_object->getXML(
IL_MODE_ALIAS));
1256 case "MediaAliasItem":
1257 $this->in_media_item =
false;
1258 $this->media_object->addMediaItem($this->media_item);
1263 $this->in_map_area =
false;
1264 $this->media_item->addMapArea($this->map_area);
1268 $this->in_properties =
false;
1269 if ($this->content_object->getType() ==
"lm"
1270 || $this->content_object->getType() ==
"dbk")
1272 $this->content_object->update();
1277 $this->in_meta_data =
false;
1278 if(strtolower(get_class($this->current_object)) ==
"illmpageobject" && !$this->in_media_object)
1281 if (is_object($this->lm_page_object))
1284 $this->current_object->MDUpdateListener(
'General');
1286 $this->current_object->getImportId());
1289 else if((strtolower(get_class($this->current_object)) ==
"ilobjquestionpool" ||
1290 strtolower(get_class($this->current_object)) ==
"ilobjtest") &&
1296 if ($this->metadata_parsing_disabled)
1302 if ($this->in_page_object)
1304 $this->page_object->MDUpdateListener(
'General');
1306 $this->page_object->getImportId());
1310 $this->current_object->MDUpdateListener(
'General');
1312 $this->current_object->getImportId());
1316 else if(strtolower(get_class($this->current_object)) ==
"ilstructureobject")
1319 $cnt = count($this->structure_objects);
1322 $parent_id = $this->structure_objects[
$cnt - 2]->getId();
1326 $parent_id = $this->lm_tree->getRootId();
1331 $this->st_into_tree[] = array (
"id" => $this->current_object->getId(),
1332 "parent" => $parent_id);
1335 $this->current_object->MDUpdateListener(
'General');
1337 $this->current_object->getImportId());
1339 else if(strtolower(get_class($this->current_object)) ==
"ilobjdlbook" || strtolower(get_class($this->current_object)) ==
"ilobjlearningmodule" ||
1340 strtolower(get_class($this->current_object)) ==
"ilobjcontentobject" ||
1341 (strtolower(get_class($this->current_object)) ==
"ilobjglossary" &&
$this->in_glossary))
1346 else if(strtolower(get_class($this->current_object)) ==
"ilglossarydefinition" && !$this->in_media_object)
1351 $this->page_object->setId($this->glossary_definition->getId());
1352 $this->page_object->updateFromXML();
1359 if(strtolower(get_class($this->current_object)) ==
"ilobjlearningmodule" ||
1360 strtolower(get_class($this->current_object)) ==
"ilobjdlbook" ||
1361 strtolower(get_class($this->current_object)) ==
"ilobjglossary")
1363 if (strtolower(get_class($this->current_object)) ==
"ilobjglossary" &&
1364 $this->content_object->getType() !=
"glo")
1367 $this->current_object->setTitle($this->content_object->getTitle().
" - ".
1368 $this->lng->txt(
"glossary"));
1371 $this->current_object->MDUpdateListener(
'General');
1380 if ($this->in_media_object)
1383 $this->media_object->MDUpdateListener(
'General');
1386 if ($this->in_glossary_definition)
1388 $this->glossary_definition->MDUpdateListener(
'General');
1393 case "Meta-Metadata":
1394 $this->in_meta_meta_data =
false;
1398 $this->in_file_item =
false;
1400 if ($this->file_item->getImportId($a_attribs[
"Entry"] !=
""))
1402 $this->file_item->update();
1406 case "Bibliography":
1408 $this->in_bib_item =
false;
1411 $nested->import($this->bib_item->getXMLContent(),$this->content_object->getId(),
"bib");
1415 unset ($this->container[count($this->container) - 1]);
1419 $this->in_glossary =
false;
1422 case "GlossaryTerm":
1423 $term = trim($this->chr_data);
1424 $term = str_replace(
"<",
"<", $term);
1425 $term = str_replace(
">",
">", $term);
1426 $this->glossary_term->setTerm($term);
1427 $this->glossary_term->create();
1428 $iia = explode(
"_", $this->glossary_term->getImportId());
1429 $this->glossary_term_map[(int) $iia[count($iia) - 1]] = $this->glossary_term->getId();
1433 $this->inside_code =
false;
1437 $this->in_glossary_definition =
false;
1438 $this->page_object->updateFromXML();
1441 $this->page_object->buildDom();
1442 $this->glossary_definition->setShortText($this->page_object->getFirstParagraphText());
1443 $this->glossary_definition->update();
1446 if ($this->page_object->containsIntLink())
1449 $this->pages_to_parse[
"gdf:".$this->page_object->getId()] =
"gdf:".$this->page_object->getId();
1451 if ($this->page_object->needsImportParsing())
1453 $this->pages_to_parse[
"gdf:".$this->page_object->getId()] =
"gdf:".$this->page_object->getId();
1458 if ($this->in_media_item)
1460 $this->media_item->setFormat(trim($this->chr_data));
1462 if ($this->in_file_item)
1464 $this->file_item->setFileType(trim($this->chr_data));
1469 if (!$this->in_media_object)
1471 $this->current_object->setTitle(trim($this->chr_data));
1476 $this->media_object->setTitle(trim($this->chr_data));
1488 if (is_object($this->bib_item))
1490 $this->bib_item->setLanguage(trim($this->chr_data));
1499 if ($this->in_media_object)
1501 $this->media_item->setCaption(trim($this->chr_data));
1505 case "TextRepresentation":
1506 if ($this->in_media_object)
1508 $this->media_item->setTextRepresentation(trim($this->chr_data));
1515 if ($this->in_media_item)
1517 $this->media_item->setLocationType($this->loc_type);
1518 if ($this->loc_type ==
"Reference")
1520 $this->media_item->setLocation(str_replace(
"&",
"&", trim($this->chr_data)));
1524 $this->media_item->setLocation(trim($this->chr_data));
1528 if ($this->in_file_item)
1531 $this->file_item->setFileName(trim($this->chr_data));
1535 if ($this->file_item->getType() ==
"file" &&
1536 is_int(strpos($this->chr_data,
"&")) &&
1537 is_int(strpos($this->chr_data,
";")))
1539 $imp_dir = $this->content_object->getImportDirectory();
1540 $source_dir = $imp_dir.
"/".$this->subdir.
"/objects/".
1541 $this->file_item->getImportId();
1544 if ($dir = opendir($source_dir))
1546 while (
false !== (
$file = readdir($dir)))
1550 $this->file_item->setFileName(
$file);
1558 $this->file_item->setTitle(trim($this->chr_data));
1564 $this->chr_data =
"";
1581 if ($this->in_media_object && $this->media_meta_start)
1583 $this->media_meta_cache[] =
1584 array(
"type" =>
"handlerCharacterData",
"par1" => $a_data);
1596 $a_data = str_replace(
"<",
"<",$a_data);
1597 $a_data = str_replace(
">",
">",$a_data);
1601 $a_data = preg_replace(
"/\n/",
"",$a_data);
1602 if (!$this->inside_code)
1604 $a_data = preg_replace(
"/\t+/",
"",$a_data);
1607 $this->chr_data .= $a_data;
1609 if(!empty($a_data) || $a_data ===
"0")
1613 if (($this->in_page_object || $this->in_glossary_definition)
1614 && !$this->in_meta_data && !$this->in_media_object)
1616 $this->page_object->appendXMLContent($a_data);
1619 if ($this->in_meta_data)
1625 if ($this->in_bib_item )
1627 $this->bib_item->appendXMLContent($a_data);
1635 if($this->in_map_area)
1637 $this->map_area->appendTitle($a_data);
1653 foreach ($this->media_meta_cache as $cache_entry)
1655 switch($cache_entry[
"type"])
1657 case "handlerBeginTag":
1659 $cache_entry[
"par1"], $cache_entry[
"par2"]);
1662 case "handlerEndTag":
1664 $cache_entry[
"par1"]);
1667 case "handlerCharacterData":
1669 $cache_entry[
"par1"]);
1674 $this->media_meta_start =
false;
1675 $this->media_meta_cache[] = array();