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;
105 $this->tree =&
$tree;
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');
161 foreach($this->st_into_tree as $st)
164 $this->lm_tree->insertNode($st[
"id"], $st[
"parent"]);
166 if (is_array($this->pg_into_tree[$st[
"id"]]))
168 foreach($this->pg_into_tree[$st[
"id"]] as $pg)
173 if ($this->pg_mapping[$pg[
"id"]] ==
"")
175 $ilLog->write(
"LM Import: No PageObject for PageAlias ".
176 $pg[
"id"].
" found! (Please update export installation to ILIAS 3.3.0)");
181 $pg_id = $this->pg_mapping[$pg[
"id"]];
188 if (!$this->lm_tree->isInTree($pg_id))
190 $this->lm_tree->insertNode($pg_id, $st[
"id"]);
213 foreach($this->pages_to_parse as $page_id)
215 $page_arr = explode(
":", $page_id);
220 $page_obj =&
new ilPageObject($this->content_object->getType(), $page_arr[1]);
231 $page_obj->buildDom();
232 $page_obj->resolveIntLinks();
233 $page_obj->resolveIIMMediaAliases($this->mob_mapping);
234 if (in_array($this->coType, array(
"lm",
"dbk")))
236 $page_obj->resolveQuestionReferences($this->qst_mapping);
238 $page_obj->update(
false);
240 if ($page_arr[0] ==
"gdf")
243 $def->updateShortText();
251 foreach($this->mobs_with_int_links as $mob_id)
259 foreach ($this->link_targets as $link_target)
262 $link_arr = explode(
"_", $link_target);
263 $target_inst = $link_arr[1];
268 foreach($sources as $key => $source)
271 if(in_array($key, $done))
275 $type_arr = explode(
":", $source[
"type"]);
278 if ($type_arr[1] ==
"pg")
291 if ($type_arr[0] ==
"qst")
293 require_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
297 if ($type_arr[0] ==
"sqst")
299 require_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
313 $imp_dir = $this->content_object->getImportDirectory();
315 foreach ($this->mob_mapping as $origin_id => $mob_id)
317 if(empty($origin_id))
333 $obj_dir = $origin_id;
334 $source_dir = $imp_dir.
"/".$this->subdir.
"/objects/".$obj_dir;
338 if (@is_dir($source_dir))
345 if (@is_dir($target_dir))
358 $imp_dir = $this->content_object->getImportDirectory();
359 foreach ($this->file_item_mapping as $origin_id => $file_id)
361 if(empty($origin_id))
365 $obj_dir = $origin_id;
366 $source_dir = $imp_dir.
"/".$this->subdir.
"/objects/".$obj_dir;
368 include_once(
"./Modules/File/classes/class.ilObjFile.php");
369 $file_obj =
new ilObjFile($file_id,
false);
371 $target_dir = $file_obj->getDirectory();
372 if (@is_dir($source_dir))
379 if (@is_dir($target_dir))
384 $test = $file_obj->determineFilesize();
394 $this->qst_mapping = $a_map;
403 if(!isset($this->status[
"$a_name"]))
405 $this->cnt[$a_name] == 1;
409 $this->cnt[$a_name]++;
411 $this->current_element[count($this->current_element)] = $a_name;
421 $this->cnt[$a_name]--;
422 unset ($this->current_element[count($this->current_element) - 1]);
430 return ($this->current_element[count($this->current_element) - 1]);
440 if (isset($this->cnt[$a_name]))
442 return $this->cnt[$a_name];
469 while (list($k,$v) = each($attr))
470 $tag.=
" ".$k.
"=\"$v\"";
490 case "ContentObject":
493 if ($a_attribs[
"Type"] ==
"Glossary")
499 case "StructureObject":
501 $this->structure_objects[count($this->structure_objects)]
503 $this->current_object =& $this->structure_objects[count($this->structure_objects) - 1];
504 $this->current_object->setLMId($this->content_object->getId());
508 $this->current_object->create(
true);
512 $this->in_page_object =
true;
514 if (($this->coType !=
"tst") and ($this->coType !=
"qpl"))
516 $this->lm_page_object =&
new ilLMPageObject($this->content_object);
517 $this->page_object =&
new ilPageObject($this->content_object->getType());
518 $this->lm_page_object->setLMId($this->content_object->getId());
519 $this->lm_page_object->assignPageObject($this->page_object);
529 if (($this->coType !=
"tst") and ($this->coType !=
"qpl"))
531 $this->lm_page_object->setAlias(
true);
532 $this->lm_page_object->setOriginID($a_attribs[
"OriginId"]);
537 $this->in_media_object =
true;
538 case "InteractiveImage":
540 $this->media_meta_start =
true;
541 $this->media_meta_cache = array();
547 $this->media_object->setAlias(
true);
548 $this->media_object->setImportId($a_attribs[
"OriginId"]);
549 if (is_object($this->page_object))
551 $this->page_object->needsImportParsing(
true);
556 case "MediaAliasItem":
557 $this->in_media_item =
true;
559 $this->media_item->setPurpose($a_attribs[
"Purpose"]);
568 if (is_object($this->media_object) && $this->in_media_object)
570 $this->media_item->setWidth($a_attribs[
"Width"]);
571 $this->media_item->setHeight($a_attribs[
"Height"]);
572 $this->media_item->setHAlign($a_attribs[
"HorizontalAlign"]);
577 if (is_object($this->media_object) && $this->in_media_object)
579 $this->media_item->setParameter($a_attribs[
"Name"], $a_attribs[
"Value"]);
584 $this->in_map_area =
true;
586 $this->map_area->setShape($a_attribs[
"Shape"]);
587 $this->map_area->setCoords($a_attribs[
"Coords"]);
588 $this->map_area->setHighlightMode($a_attribs[
"HighlightMode"]);
589 $this->map_area->setHighlightClass($a_attribs[
"HighlightClass"]);
593 $this->in_glossary =
true;
594 if ($this->content_object->getType() !=
"glo")
597 $this->glossary_object->setTitle(
"");
598 $this->glossary_object->setDescription(
"");
599 $this->glossary_object->create(
true);
600 $this->glossary_object->createReference();
601 $parent =& $this->tree->getParentNodeData($this->content_object->getRefId());
602 $this->glossary_object->putInTree($parent[
"child"]);
603 $this->glossary_object->setPermissions($parent[
"child"]);
604 $this->glossary_object->notify(
"new",
$_GET[
"ref_id"],
$_GET[
"parent_non_rbac_id"],
$_GET[
"ref_id"],$this->glossary_object->getRefId());
611 $this->glossary_term->setGlossaryId($this->glossary_object->getId());
612 $this->glossary_term->setLanguage($a_attribs[
"Language"]);
613 $this->glossary_term->setImportId($a_attribs[
"Id"]);
614 $this->link_targets[$a_attribs[
"Id"]] = $a_attribs[
"Id"];
618 $this->in_glossary_definition =
true;
621 $this->page_object->setParentId($this->glossary_term->getGlossaryId());
622 $this->glossary_definition->setTermId($this->glossary_term->getId());
623 $this->glossary_definition->assignPageObject($this->page_object);
624 $this->current_object =& $this->glossary_definition;
625 $this->glossary_definition->create(
true);
629 $this->in_file_item =
true;
631 $this->file_item->setTitle(
"dummy");
632 $this->file_item->setMode(
"filelist");
633 if (is_object($this->page_object))
635 $this->page_object->needsImportParsing(
true);
640 if ($a_attribs[
"Characteristic"] ==
"Code")
642 $this->inside_code =
true;
647 $this->in_properties =
true;
651 if ($this->content_object->getType() ==
"lm"
652 || $this->content_object->getType() ==
"dbk")
654 switch($a_attribs[
"Name"])
657 $this->content_object->setLayout($a_attribs[
"Value"]);
661 $this->content_object->setPageHeader($a_attribs[
"Value"]);
665 $this->content_object->setTOCMode($a_attribs[
"Value"]);
669 $this->content_object->setActiveLMMenu(
673 case "ActiveNumbering":
674 $this->content_object->setActiveNumbering(
679 $this->content_object->setActiveTOC(
683 case "ActivePrintView":
684 $this->content_object->setActivePrintView(
689 $this->content_object->setCleanFrames(
694 $this->content_object->setPublicNotes(
698 case "HistoryUserComments":
699 $this->content_object->setHistoryUserComments(
704 if ($a_attribs[
"Value"] !=
"")
706 if ($this->pg_mapping[$a_attribs[
"Value"]] > 0)
708 $this->content_object->setHeaderPage(
709 $this->pg_mapping[$a_attribs[
"Value"]]);
715 if ($a_attribs[
"Value"] !=
"")
717 if ($this->pg_mapping[$a_attribs[
"Value"]] > 0)
719 $this->content_object->setFooterPage(
720 $this->pg_mapping[$a_attribs[
"Value"]]);
733 $this->in_meta_data =
true;
738 if(!$this->in_media_object)
740 if (($this->coType !=
"tst") and ($this->coType !=
"qpl"))
743 if ($this->current_object->getType() ==
"st" ||
744 $this->current_object->getType() ==
"pg")
747 if ($this->current_object->getType() ==
"pg")
749 $this->lm_page_object->create(
true);
751 $this->md =&
new ilMD($this->content_object->getId() ,
752 $this->current_object->getId(),
753 $this->current_object->getType());
756 else if ($this->current_object->getType() ==
"gdf")
758 $this->md =&
new ilMD($this->glossary_object->getId() ,
759 $this->current_object->getId(),
760 $this->current_object->getType());
767 $this->md =&
new ilMD($this->current_object->getId() ,
769 $this->current_object->getType());
776 $this->md =&
new ilMD($this->content_object->getId() ,
778 $this->current_object->getType()
780 if ($this->md->getGeneral() !=
false)
782 $this->metadata_parsing_disabled =
true;
793 if (!$this->in_meta_meta_data)
795 if ($this->in_meta_data && !$this->in_glossary_definition)
797 if (!$this->in_media_object)
799 $this->current_object->setImportId($a_attribs[
"Entry"]);
801 $this->link_targets[$a_attribs[
"Entry"]] = $a_attribs[
"Entry"];
803 if ($this->in_file_item)
805 if ($this->file_item_mapping[$a_attribs[
"Entry"]] ==
"")
807 $this->file_item->create();
808 $this->file_item->setImportId($a_attribs[
"Entry"]);
809 $this->file_item_mapping[$a_attribs[
"Entry"]] = $this->file_item->getId();
812 if ($this->in_meta_data && $this->in_media_object)
816 $mob_id = $this->mob_mapping[$a_attribs[
"Entry"]];
828 $this->media_object->create(
true,
false);
829 $this->mob_mapping[$a_attribs[
"Entry"]]
830 = $this->media_object->getId();
832 $this->media_object->setImportId($a_attribs[
"Entry"]);
833 $this->md =&
new ilMD(0 ,
834 $this->media_object->getId(),
841 case "Meta-Metadata":
842 $this->in_meta_meta_data =
true;
847 if (is_object($this->page_object))
849 $this->page_object->setContainsIntLink(
true);
851 if ($this->in_map_area)
855 $this->map_area->setTarget($a_attribs[
"Target"]);
856 $this->map_area->setType($a_attribs[
"Type"]);
857 $this->map_area->setTargetFrame($a_attribs[
"TargetFrame"]);
858 if (is_object($this->media_object))
861 $this->media_object->setContainsIntLink(
true);
868 if ($this->in_map_area)
871 $this->map_area->setHref($a_attribs[
"Href"]);
872 $this->map_area->setExtTitle($a_attribs[
"Title"]);
878 $this->cur_qid = $a_attribs[
"QRef"];
879 $this->page_object->setContainsQuestion(
true);
883 $this->loc_type = $a_attribs[
"Type"];
887 $this->in_bib_item =
true;
896 if(($this->in_page_object || $this->in_glossary_definition)
897 && !$this->in_meta_data && !$this->in_media_object)
899 if ($a_name ==
"Definition")
901 $app_name =
"PageObject";
902 $app_attribs = array();
907 $app_attribs = $a_attribs;
911 if ($this->in_file_item && $app_name ==
"Identifier")
913 $app_attribs[
"Entry"] =
"il__file_".$this->file_item_mapping[$a_attribs[
"Entry"]];
917 $this->page_object->appendXMLContent($this->
buildTag(
"start", $app_name, $app_attribs));
922 if ($this->in_bib_item)
924 $this->bib_item->appendXMLContent(
"\n".$this->
buildTag(
"start", $a_name, $a_attribs));
934 if ($this->in_media_object && $this->media_meta_start)
936 $this->media_meta_cache[] =
937 array(
"type" =>
"handlerBeginTag",
"par1" => $a_name,
"par2" => $a_attribs);
941 if ($a_name ==
"Identifier")
943 if (!$this->in_media_object)
945 $a_attribs[
"Entry"] =
"il__".$this->current_object->getType().
946 "_".$this->current_object->getId();
950 $a_attribs[
"Entry"] =
"il__mob".
951 "_".$this->media_object->getId();
953 $a_attribs[
"Catalog"] =
"ILIAS";
968 if ($this->content_object->getType() ==
"glo" &&
969 $this->in_glossary && !$this->in_media_object
970 && !$this->in_glossary_definition)
993 if ($this->in_media_object && $this->media_meta_start)
995 $this->media_meta_cache[] =
996 array(
"type" =>
"handlerEndTag",
"par1" => $a_name);
1006 if (($this->in_page_object || $this->in_glossary_definition)
1007 && !$this->in_meta_data && !$this->in_media_object)
1009 $app_name = ($a_name ==
"Definition")
1012 $this->page_object->appendXMLContent($this->
buildTag(
"end", $app_name));
1016 if ($this->in_bib_item)
1018 if($a_name ==
"BibItem")
1020 $this->bib_item->appendXMLContent(
"\n".$this->
buildTag(
"end", $a_name));
1024 $this->bib_item->appendXMLContent($this->
buildTag(
"end", $a_name));
1031 case "StructureObject":
1033 unset($this->structure_objects[count($this->structure_objects) - 1]);
1038 $this->in_page_object =
false;
1039 if (($this->coType !=
"tst") and ($this->coType !=
"qpl"))
1041 if (!$this->lm_page_object->isAlias())
1044 $this->page_object->updateFromXML();
1045 $this->pg_mapping[$this->lm_page_object->getImportId()]
1046 = $this->lm_page_object->getId();
1049 if ($this->page_object->containsIntLink())
1051 $this->pages_to_parse[
"lm:".$this->page_object->getId()] =
"lm:".$this->page_object->getId();
1055 if ($this->page_object->needsImportParsing())
1057 $this->pages_to_parse[
"lm:".$this->page_object->getId()] =
"lm:".$this->page_object->getId();
1061 if ($this->page_object->getContainsQuestion())
1063 $this->pages_to_parse[
"lm:".$this->page_object->getId()] =
"lm:".$this->page_object->getId();
1070 $xml = $this->page_object->getXMLContent();
1071 if ($this->cur_qid !=
"")
1073 $ids = $this->qst_mapping[$this->cur_qid];
1074 if ($ids[
"pool"] > 0)
1078 $xmlcontent = str_replace($this->cur_qid,
1079 "il__qst_".$ids[
"pool"], $xml);
1080 $page->setXMLContent($xmlcontent);
1081 $page->saveMobUsage($xmlcontent);
1082 $page->updateFromXML();
1083 if( $this->page_object->needsImportParsing() )
1085 $this->pages_to_parse[
"qpl:".$page->getId()] =
"qpl:".$page->getId();
1089 if ($ids[
"test"] > 0)
1093 $xmlcontent = str_replace($this->cur_qid,
1094 "il__qst_".$ids[
"test"], $xml);
1095 $page->setXMLContent($xmlcontent);
1096 $page->saveMobUsage($xmlcontent);
1097 $page->updateFromXML();
1098 if( $this->page_object->needsImportParsing() )
1100 $this->pages_to_parse[
"qpl:".$page->getId()] =
"qpl:".$page->getId();
1108 $cnt = count($this->structure_objects);
1111 $parent_id = $this->structure_objects[
$cnt - 1]->getId();
1112 if ($this->lm_page_object->isAlias())
1114 $this->pg_into_tree[$parent_id][] = array(
"type" =>
"pg_alias",
"id" => $this->lm_page_object->getOriginId());
1118 $this->pg_into_tree[$parent_id][] = array(
"type" =>
"pg",
"id" => $this->lm_page_object->getId());
1122 unset($this->page_object);
1123 unset($this->lm_page_object);
1124 unset ($this->container[count($this->container) - 1]);
1128 $this->in_media_object =
false;
1129 case "InteractiveImage":
1135 if(empty($this->mob_mapping[$this->media_object->getImportId()]))
1142 $this->media_object->create(
true,
false);
1147 if ($this->media_object->containsIntLink())
1150 $this->mobs_with_int_links[] = $this->media_object->getId();
1153 $this->mob_mapping[$this->media_object->getImportId()]
1154 = $this->media_object->getId();
1161 $this->media_object->setId($this->mob_mapping[$this->media_object->getImportId()]);
1168 if (!$this->media_object->isAlias())
1171 $this->media_object->update();
1176 if ($this->media_object->containsIntLink())
1179 $this->mobs_with_int_links[] = $this->media_object->getId();
1185 if ($this->in_page_object || $this->in_glossary_definition)
1187 if ($a_name !=
"InteractiveImage")
1189 $this->page_object->appendXMLContent($this->media_object->getXML(
IL_MODE_ALIAS));
1197 case "MediaAliasItem":
1198 $this->in_media_item =
false;
1199 $this->media_object->addMediaItem($this->media_item);
1204 $this->in_map_area =
false;
1205 $this->media_item->addMapArea($this->map_area);
1209 $this->in_properties =
false;
1210 if ($this->content_object->getType() ==
"lm"
1211 || $this->content_object->getType() ==
"dbk")
1213 $this->content_object->update();
1218 $this->in_meta_data =
false;
1219 if(strtolower(get_class($this->current_object)) ==
"illmpageobject" && !$this->in_media_object)
1222 if (is_object($this->lm_page_object))
1225 $this->current_object->MDUpdateListener(
'General');
1227 $this->current_object->getImportId());
1230 else if((strtolower(get_class($this->current_object)) ==
"ilobjquestionpool" ||
1231 strtolower(get_class($this->current_object)) ==
"ilobjtest") &&
1237 if ($this->metadata_parsing_disabled)
1243 if ($this->in_page_object)
1245 $this->page_object->MDUpdateListener(
'General');
1247 $this->page_object->getImportId());
1251 $this->current_object->MDUpdateListener(
'General');
1253 $this->current_object->getImportId());
1257 else if(strtolower(get_class($this->current_object)) ==
"ilstructureobject")
1260 $cnt = count($this->structure_objects);
1263 $parent_id = $this->structure_objects[
$cnt - 2]->getId();
1267 $parent_id = $this->lm_tree->getRootId();
1272 $this->st_into_tree[] = array (
"id" => $this->current_object->getId(),
1273 "parent" => $parent_id);
1276 $this->current_object->MDUpdateListener(
'General');
1278 $this->current_object->getImportId());
1280 else if(strtolower(get_class($this->current_object)) ==
"ilobjdlbook" || strtolower(get_class($this->current_object)) ==
"ilobjlearningmodule" ||
1281 strtolower(get_class($this->current_object)) ==
"ilobjcontentobject" ||
1282 (strtolower(get_class($this->current_object)) ==
"ilobjglossary" &&
$this->in_glossary))
1287 else if(strtolower(get_class($this->current_object)) ==
"ilglossarydefinition" && !$this->in_media_object)
1292 $this->page_object->setId($this->glossary_definition->getId());
1293 $this->page_object->updateFromXML();
1300 if(strtolower(get_class($this->current_object)) ==
"ilobjlearningmodule" ||
1301 strtolower(get_class($this->current_object)) ==
"ilobjdlbook" ||
1302 strtolower(get_class($this->current_object)) ==
"ilobjglossary")
1304 if (strtolower(get_class($this->current_object)) ==
"ilobjglossary" &&
1305 $this->content_object->getType() !=
"glo")
1308 $this->current_object->setTitle($this->content_object->getTitle().
" - ".
1309 $this->lng->txt(
"glossary"));
1312 $this->current_object->MDUpdateListener(
'General');
1321 if ($this->in_media_object)
1324 $this->media_object->MDUpdateListener(
'General');
1327 if ($this->in_glossary_definition)
1329 $this->glossary_definition->MDUpdateListener(
'General');
1334 case "Meta-Metadata":
1335 $this->in_meta_meta_data =
false;
1339 $this->in_file_item =
false;
1341 if ($this->file_item->getImportId($a_attribs[
"Entry"] !=
""))
1343 $this->file_item->update();
1347 case "Bibliography":
1349 $this->in_bib_item =
false;
1352 $nested->import($this->bib_item->getXMLContent(),$this->content_object->getId(),
"bib");
1356 unset ($this->container[count($this->container) - 1]);
1360 $this->in_glossary =
false;
1363 case "GlossaryTerm":
1364 $this->glossary_term->setTerm(trim($this->chr_data));
1365 $this->glossary_term->create();
1366 $iia = explode(
"_", $this->glossary_term->getImportId());
1367 $this->glossary_term_map[(int) $iia[count($iia) - 1]] = $this->glossary_term->getId();
1371 $this->inside_code =
false;
1375 $this->in_glossary_definition =
false;
1376 $this->page_object->updateFromXML();
1377 $this->page_object->buildDom();
1378 $this->glossary_definition->setShortText($this->page_object->getFirstParagraphText());
1379 $this->glossary_definition->update();
1382 if ($this->page_object->containsIntLink())
1385 $this->pages_to_parse[
"gdf:".$this->page_object->getId()] =
"gdf:".$this->page_object->getId();
1387 if ($this->page_object->needsImportParsing())
1389 $this->pages_to_parse[
"gdf:".$this->page_object->getId()] =
"gdf:".$this->page_object->getId();
1394 if ($this->in_media_item)
1396 $this->media_item->setFormat(trim($this->chr_data));
1398 if ($this->in_file_item)
1400 $this->file_item->setFileType(trim($this->chr_data));
1405 if (!$this->in_media_object)
1407 $this->current_object->setTitle(trim($this->chr_data));
1412 $this->media_object->setTitle(trim($this->chr_data));
1424 if (is_object($this->bib_item))
1426 $this->bib_item->setLanguage(trim($this->chr_data));
1435 if ($this->in_media_object)
1437 $this->media_item->setCaption(trim($this->chr_data));
1441 case "TextRepresentation":
1442 if ($this->in_media_object)
1444 $this->media_item->setTextRepresentation(trim($this->chr_data));
1451 if ($this->in_media_item)
1453 $this->media_item->setLocationType($this->loc_type);
1454 if ($this->loc_type ==
"Reference")
1456 $this->media_item->setLocation(str_replace(
"&",
"&", trim($this->chr_data)));
1460 $this->media_item->setLocation(trim($this->chr_data));
1464 if ($this->in_file_item)
1467 $this->file_item->setFileName(trim($this->chr_data));
1471 if ($this->file_item->getType() ==
"file" &&
1472 is_int(strpos($this->chr_data,
"&")) &&
1473 is_int(strpos($this->chr_data,
";")))
1475 $imp_dir = $this->content_object->getImportDirectory();
1476 $source_dir = $imp_dir.
"/".$this->subdir.
"/objects/".
1477 $this->file_item->getImportId();
1480 if ($dir = opendir($source_dir))
1482 while (
false !== (
$file = readdir($dir)))
1486 $this->file_item->setFileName(
$file);
1494 $this->file_item->setTitle(trim($this->chr_data));
1500 $this->chr_data =
"";
1517 if ($this->in_media_object && $this->media_meta_start)
1519 $this->media_meta_cache[] =
1520 array(
"type" =>
"handlerCharacterData",
"par1" => $a_data);
1532 $a_data = str_replace(
"<",
"<",$a_data);
1533 $a_data = str_replace(
">",
">",$a_data);
1537 $a_data = preg_replace(
"/\n/",
"",$a_data);
1538 if (!$this->inside_code)
1540 $a_data = preg_replace(
"/\t+/",
"",$a_data);
1543 $this->chr_data .= $a_data;
1545 if(!empty($a_data) || $a_data ===
"0")
1549 if (($this->in_page_object || $this->in_glossary_definition)
1550 && !$this->in_meta_data && !$this->in_media_object)
1552 $this->page_object->appendXMLContent($a_data);
1555 if ($this->in_meta_data)
1561 if ($this->in_bib_item )
1563 $this->bib_item->appendXMLContent($a_data);
1571 if($this->in_map_area)
1573 $this->map_area->appendTitle($a_data);
1589 foreach ($this->media_meta_cache as $cache_entry)
1591 switch($cache_entry[
"type"])
1593 case "handlerBeginTag":
1595 $cache_entry[
"par1"], $cache_entry[
"par2"]);
1598 case "handlerEndTag":
1600 $cache_entry[
"par1"]);
1603 case "handlerCharacterData":
1605 $cache_entry[
"par1"]);
1610 $this->media_meta_start =
false;
1611 $this->media_meta_cache[] = array();