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/COPage/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"]]);
765 $this->in_meta_data =
true;
770 if(!$this->in_media_object)
772 if (($this->coType !=
"tst") and ($this->coType !=
"qpl"))
775 if ($this->current_object->getType() ==
"st" ||
776 $this->current_object->getType() ==
"pg")
779 if ($this->current_object->getType() ==
"pg")
781 $this->lm_page_object->create(
true);
783 $this->md =
new ilMD($this->content_object->getId() ,
784 $this->current_object->getId(),
785 $this->current_object->getType());
788 else if ($this->current_object->getType() ==
"gdf")
790 $this->md =
new ilMD($this->glossary_object->getId() ,
791 $this->current_object->getId(),
792 $this->current_object->getType());
799 $this->md =
new ilMD($this->current_object->getId() ,
801 $this->current_object->getType());
808 $this->md =
new ilMD($this->content_object->getId() ,
810 $this->current_object->getType()
812 if ($this->md->getGeneral() !=
false)
814 $this->metadata_parsing_disabled =
true;
825 if (!$this->in_meta_meta_data)
827 if ($this->in_meta_data && !$this->in_glossary_definition)
829 if (!$this->in_media_object)
831 $this->current_object->setImportId($a_attribs[
"Entry"]);
833 $this->link_targets[$a_attribs[
"Entry"]] = $a_attribs[
"Entry"];
835 if ($this->in_file_item)
837 if ($this->file_item_mapping[$a_attribs[
"Entry"]] ==
"")
839 $this->file_item->create();
840 $this->file_item->setImportId($a_attribs[
"Entry"]);
841 $this->file_item_mapping[$a_attribs[
"Entry"]] = $this->file_item->getId();
844 if ($this->in_meta_data && $this->in_media_object)
848 $mob_id = $this->mob_mapping[$a_attribs[
"Entry"]];
860 $this->media_object->create(
true,
false);
861 $this->mob_mapping[$a_attribs[
"Entry"]]
862 = $this->media_object->getId();
864 $this->media_object->setImportId($a_attribs[
"Entry"]);
865 $this->md =
new ilMD(0 ,
866 $this->media_object->getId(),
873 case "Meta-Metadata":
874 $this->in_meta_meta_data =
true;
879 if (is_object($this->page_object))
881 $this->page_object->setContainsIntLink(
true);
883 if ($this->in_map_area)
887 $this->map_area->setTarget($a_attribs[
"Target"]);
888 $this->map_area->setType($a_attribs[
"Type"]);
889 $this->map_area->setTargetFrame($a_attribs[
"TargetFrame"]);
890 if (is_object($this->media_object))
893 $this->media_object->setContainsIntLink(
true);
900 if ($this->in_map_area)
903 $this->map_area->setHref($a_attribs[
"Href"]);
904 $this->map_area->setExtTitle($a_attribs[
"Title"]);
910 $this->cur_qid = $a_attribs[
"QRef"];
911 $this->page_object->setContainsQuestion(
true);
915 $this->loc_type = $a_attribs[
"Type"];
919 $this->in_bib_item =
true;
928 if(($this->in_page_object || $this->in_glossary_definition)
929 && !$this->in_meta_data && !$this->in_media_object)
931 if ($a_name ==
"Definition")
933 $app_name =
"PageObject";
934 $app_attribs = array();
939 $app_attribs = $a_attribs;
943 if ($this->in_file_item && $app_name ==
"Identifier")
945 $app_attribs[
"Entry"] =
"il__file_".$this->file_item_mapping[$a_attribs[
"Entry"]];
949 $this->page_object->appendXMLContent($this->
buildTag(
"start", $app_name, $app_attribs));
954 if ($this->in_bib_item)
956 $this->bib_item->appendXMLContent(
"\n".$this->
buildTag(
"start", $a_name, $a_attribs));
966 if ($this->in_media_object && $this->media_meta_start)
968 $this->media_meta_cache[] =
969 array(
"type" =>
"handlerBeginTag",
"par1" => $a_name,
"par2" => $a_attribs);
973 if ($a_name ==
"Identifier")
975 if (!$this->in_media_object)
977 $a_attribs[
"Entry"] =
"il__".$this->current_object->getType().
978 "_".$this->current_object->getId();
982 $a_attribs[
"Entry"] =
"il__mob".
983 "_".$this->media_object->getId();
985 $a_attribs[
"Catalog"] =
"ILIAS";
1000 if ($this->content_object->getType() ==
"glo" &&
1001 $this->in_glossary && !$this->in_media_object
1002 && !$this->in_glossary_definition)
1025 if ($this->in_media_object && $this->media_meta_start)
1027 $this->media_meta_cache[] =
1028 array(
"type" =>
"handlerEndTag",
"par1" => $a_name);
1038 if (($this->in_page_object || $this->in_glossary_definition)
1039 && !$this->in_meta_data && !$this->in_media_object)
1041 $app_name = ($a_name ==
"Definition")
1044 $this->page_object->appendXMLContent($this->
buildTag(
"end", $app_name));
1048 if ($this->in_bib_item)
1050 if($a_name ==
"BibItem")
1052 $this->bib_item->appendXMLContent(
"\n".$this->
buildTag(
"end", $a_name));
1056 $this->bib_item->appendXMLContent($this->
buildTag(
"end", $a_name));
1063 case "StructureObject":
1065 unset($this->structure_objects[count($this->structure_objects) - 1]);
1070 $this->in_page_object =
false;
1071 if (($this->coType !=
"tst") and ($this->coType !=
"qpl"))
1073 if (!$this->lm_page_object->isAlias())
1076 $this->page_object->updateFromXML();
1077 $this->pg_mapping[$this->lm_page_object->getImportId()]
1078 = $this->lm_page_object->getId();
1081 if ($this->page_object->containsIntLink())
1083 $this->pages_to_parse[
"lm:".$this->page_object->getId()] =
"lm:".$this->page_object->getId();
1087 if ($this->page_object->needsImportParsing())
1089 $this->pages_to_parse[
"lm:".$this->page_object->getId()] =
"lm:".$this->page_object->getId();
1093 if ($this->page_object->getContainsQuestion())
1095 $this->pages_to_parse[
"lm:".$this->page_object->getId()] =
"lm:".$this->page_object->getId();
1102 $xml = $this->page_object->getXMLContent();
1103 if ($this->cur_qid !=
"")
1105 $ids = $this->qst_mapping[$this->cur_qid];
1106 if ($ids[
"pool"] > 0)
1109 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
1111 $xmlcontent = str_replace($this->cur_qid,
1112 "il__qst_".$ids[
"pool"], $xml);
1113 $page->setXMLContent($xmlcontent);
1114 $page->updateFromXML();
1115 if( $this->page_object->needsImportParsing() )
1117 $this->pages_to_parse[
"qpl:".$page->getId()] =
"qpl:".$page->getId();
1121 if ($ids[
"test"] > 0)
1124 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
1126 $xmlcontent = str_replace($this->cur_qid,
1127 "il__qst_".$ids[
"test"], $xml);
1128 $page->setXMLContent($xmlcontent);
1129 $page->updateFromXML();
1130 if( $this->page_object->needsImportParsing() )
1132 $this->pages_to_parse[
"qpl:".$page->getId()] =
"qpl:".$page->getId();
1140 $cnt = count($this->structure_objects);
1146 $parent_id = $this->structure_objects[
$cnt - 1]->getId();
1147 if ($this->lm_page_object->isAlias())
1150 $this->pg_into_tree[$parent_id][] = array(
"type" =>
"pg_alias",
"id" => $this->lm_page_object->getOriginId());
1156 $this->pg_into_tree[$parent_id][] = array(
"type" =>
"pg",
"id" => $this->lm_page_object->getId());
1160 unset($this->page_object);
1161 unset($this->lm_page_object);
1162 unset ($this->container[count($this->container) - 1]);
1166 $this->in_media_object =
false;
1167 case "InteractiveImage":
1173 if(empty($this->mob_mapping[$this->media_object->getImportId()]))
1180 $this->media_object->create(
true,
false);
1185 if ($this->media_object->containsIntLink())
1188 $this->mobs_with_int_links[] = $this->media_object->getId();
1191 $this->mob_mapping[$this->media_object->getImportId()]
1192 = $this->media_object->getId();
1199 $this->media_object->setId($this->mob_mapping[$this->media_object->getImportId()]);
1206 if (!$this->media_object->isAlias())
1209 $this->media_object->update();
1214 if ($this->media_object->containsIntLink())
1217 $this->mobs_with_int_links[] = $this->media_object->getId();
1223 if ($this->in_page_object || $this->in_glossary_definition)
1225 if ($a_name !=
"InteractiveImage")
1227 $this->page_object->appendXMLContent($this->media_object->getXML(
IL_MODE_ALIAS));
1235 case "MediaAliasItem":
1236 $this->in_media_item =
false;
1237 $this->media_object->addMediaItem($this->media_item);
1242 $this->in_map_area =
false;
1243 $this->media_item->addMapArea($this->map_area);
1247 $this->in_properties =
false;
1248 if ($this->content_object->getType() ==
"lm"
1249 || $this->content_object->getType() ==
"dbk")
1251 $this->content_object->update();
1256 $this->in_meta_data =
false;
1257 if(strtolower(get_class($this->current_object)) ==
"illmpageobject" && !$this->in_media_object)
1260 if (is_object($this->lm_page_object))
1263 $this->current_object->MDUpdateListener(
'General');
1265 $this->current_object->getImportId());
1268 else if((strtolower(get_class($this->current_object)) ==
"ilobjquestionpool" ||
1269 strtolower(get_class($this->current_object)) ==
"ilobjtest") &&
1275 if ($this->metadata_parsing_disabled)
1281 if ($this->in_page_object)
1283 $this->page_object->MDUpdateListener(
'General');
1285 $this->page_object->getImportId());
1289 $this->current_object->MDUpdateListener(
'General');
1291 $this->current_object->getImportId());
1295 else if(strtolower(get_class($this->current_object)) ==
"ilstructureobject")
1298 $cnt = count($this->structure_objects);
1301 $parent_id = $this->structure_objects[
$cnt - 2]->getId();
1305 $parent_id = $this->lm_tree->getRootId();
1310 $this->st_into_tree[] = array (
"id" => $this->current_object->getId(),
1311 "parent" => $parent_id);
1314 $this->current_object->MDUpdateListener(
'General');
1316 $this->current_object->getImportId());
1318 else if(strtolower(get_class($this->current_object)) ==
"ilobjdlbook" || strtolower(get_class($this->current_object)) ==
"ilobjlearningmodule" ||
1319 strtolower(get_class($this->current_object)) ==
"ilobjcontentobject" ||
1320 (strtolower(get_class($this->current_object)) ==
"ilobjglossary" &&
$this->in_glossary))
1325 else if(strtolower(get_class($this->current_object)) ==
"ilglossarydefinition" && !$this->in_media_object)
1330 $this->page_object->setId($this->glossary_definition->getId());
1331 $this->page_object->updateFromXML();
1338 if(strtolower(get_class($this->current_object)) ==
"ilobjlearningmodule" ||
1339 strtolower(get_class($this->current_object)) ==
"ilobjdlbook" ||
1340 strtolower(get_class($this->current_object)) ==
"ilobjglossary")
1342 if (strtolower(get_class($this->current_object)) ==
"ilobjglossary" &&
1343 $this->content_object->getType() !=
"glo")
1346 $this->current_object->setTitle($this->content_object->getTitle().
" - ".
1347 $this->lng->txt(
"glossary"));
1350 $this->current_object->MDUpdateListener(
'General');
1359 if ($this->in_media_object)
1362 $this->media_object->MDUpdateListener(
'General');
1365 if ($this->in_glossary_definition)
1367 $this->glossary_definition->MDUpdateListener(
'General');
1372 case "Meta-Metadata":
1373 $this->in_meta_meta_data =
false;
1377 $this->in_file_item =
false;
1379 if ($this->file_item->getImportId($a_attribs[
"Entry"] !=
""))
1381 $this->file_item->update();
1385 case "Bibliography":
1387 $this->in_bib_item =
false;
1390 $nested->import($this->bib_item->getXMLContent(),$this->content_object->getId(),
"bib");
1394 unset ($this->container[count($this->container) - 1]);
1398 $this->in_glossary =
false;
1401 case "GlossaryTerm":
1402 $term = trim($this->chr_data);
1403 $term = str_replace(
"<",
"<", $term);
1404 $term = str_replace(
">",
">", $term);
1405 $this->glossary_term->setTerm($term);
1406 $this->glossary_term->create();
1407 $iia = explode(
"_", $this->glossary_term->getImportId());
1408 $this->glossary_term_map[(int) $iia[count($iia) - 1]] = $this->glossary_term->getId();
1412 $this->inside_code =
false;
1416 $this->in_glossary_definition =
false;
1417 $this->page_object->updateFromXML();
1420 $this->page_object->buildDom();
1421 $this->glossary_definition->setShortText($this->page_object->getFirstParagraphText());
1422 $this->glossary_definition->update();
1425 if ($this->page_object->containsIntLink())
1428 $this->pages_to_parse[
"gdf:".$this->page_object->getId()] =
"gdf:".$this->page_object->getId();
1430 if ($this->page_object->needsImportParsing())
1432 $this->pages_to_parse[
"gdf:".$this->page_object->getId()] =
"gdf:".$this->page_object->getId();
1437 if ($this->in_media_item)
1439 $this->media_item->setFormat(trim($this->chr_data));
1441 if ($this->in_file_item)
1443 $this->file_item->setFileType(trim($this->chr_data));
1448 if (!$this->in_media_object)
1450 $this->current_object->setTitle(trim($this->chr_data));
1455 $this->media_object->setTitle(trim($this->chr_data));
1467 if (is_object($this->bib_item))
1469 $this->bib_item->setLanguage(trim($this->chr_data));
1478 if ($this->in_media_object)
1480 $this->media_item->setCaption(trim($this->chr_data));
1484 case "TextRepresentation":
1485 if ($this->in_media_object)
1487 $this->media_item->setTextRepresentation(trim($this->chr_data));
1494 if ($this->in_media_item)
1496 $this->media_item->setLocationType($this->loc_type);
1497 if ($this->loc_type ==
"Reference")
1499 $this->media_item->setLocation(str_replace(
"&",
"&", trim($this->chr_data)));
1503 $this->media_item->setLocation(trim($this->chr_data));
1507 if ($this->in_file_item)
1510 $this->file_item->setFileName(trim($this->chr_data));
1514 if ($this->file_item->getType() ==
"file" &&
1515 is_int(strpos($this->chr_data,
"&")) &&
1516 is_int(strpos($this->chr_data,
";")))
1518 $imp_dir = $this->content_object->getImportDirectory();
1519 $source_dir = $imp_dir.
"/".$this->subdir.
"/objects/".
1520 $this->file_item->getImportId();
1523 if ($dir = opendir($source_dir))
1525 while (
false !== (
$file = readdir($dir)))
1529 $this->file_item->setFileName(
$file);
1537 $this->file_item->setTitle(trim($this->chr_data));
1543 $this->chr_data =
"";
1560 if ($this->in_media_object && $this->media_meta_start)
1562 $this->media_meta_cache[] =
1563 array(
"type" =>
"handlerCharacterData",
"par1" => $a_data);
1575 $a_data = str_replace(
"<",
"<",$a_data);
1576 $a_data = str_replace(
">",
">",$a_data);
1580 $a_data = preg_replace(
"/\n/",
"",$a_data);
1581 if (!$this->inside_code)
1583 $a_data = preg_replace(
"/\t+/",
"",$a_data);
1586 $this->chr_data .= $a_data;
1588 if(!empty($a_data) || $a_data ===
"0")
1592 if (($this->in_page_object || $this->in_glossary_definition)
1593 && !$this->in_meta_data && !$this->in_media_object)
1595 $this->page_object->appendXMLContent($a_data);
1598 if ($this->in_meta_data)
1604 if ($this->in_bib_item )
1606 $this->bib_item->appendXMLContent($a_data);
1614 if($this->in_map_area)
1616 $this->map_area->appendTitle($a_data);
1632 foreach ($this->media_meta_cache as $cache_entry)
1634 switch($cache_entry[
"type"])
1636 case "handlerBeginTag":
1638 $cache_entry[
"par1"], $cache_entry[
"par2"]);
1641 case "handlerEndTag":
1643 $cache_entry[
"par1"]);
1646 case "handlerCharacterData":
1648 $cache_entry[
"par1"]);
1653 $this->media_meta_start =
false;
1654 $this->media_meta_cache[] = array();