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/Glossary/classes/class.ilObjGlossary.php");
15 require_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
16 require_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
17 require_once(
"./Services/Link/classes/class.ilInternalLink.php");
18 require_once(
"./Modules/File/classes/class.ilObjFile.php");
20 include_once(
"Services/MetaData/classes/class.ilMDSaxParser.php");
21 include_once(
"Services/MetaData/classes/class.ilMD.php");
87 public function __construct(&$a_content_object, $a_xml_file, $a_subdir, $a_import_dir =
"")
91 $this->log = $DIC[
"ilLog"];
92 $lng = $DIC->language();
93 $tree = $DIC->repositoryTree();
97 $this->import_dir = ($a_import_dir !=
"")
99 : $a_content_object->getImportDirectory();
101 parent::__construct($a_xml_file);
102 $this->cnt = array();
103 $this->current_element = array();
104 $this->structure_objects = array();
105 $this->content_object = $a_content_object;
107 $this->st_into_tree = array();
108 $this->pg_into_tree = array();
109 $this->pages_to_parse = array();
110 $this->mobs_with_int_links = array();
111 $this->mob_mapping = array();
112 $this->file_item_mapping = array();
113 $this->pg_mapping = array();
114 $this->link_targets = array();
115 $this->subdir = $a_subdir;
118 $this->inside_code =
false;
119 $this->qst_mapping = array();
120 $this->coType = $this->content_object->getType();
121 $this->metadata_parsing_disabled =
false;
123 if (($this->coType !=
"tst")
and ($this->coType !=
"qpl")) {
124 $this->lm_tree =
new ilTree($this->content_object->getId());
126 $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
139 xml_set_object($a_xml_parser, $this);
140 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
141 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
150 $this->mapping = $mapping;
159 $this->log->debug(
"start");
162 parent::startParsing();
183 foreach ($this->st_into_tree as $st) {
185 $this->lm_tree->insertNode($st[
"id"], $st[
"parent"]);
189 if (is_array($this->pg_into_tree[$st[
"id"]])) {
190 foreach ($this->pg_into_tree[$st[
"id"]] as $pg) {
191 switch ($pg[
"type"]) {
193 if ($this->pg_mapping[$pg[
"id"]] ==
"") {
194 $ilLog->write(
"LM Import: No PageObject for PageAlias " .
195 $pg[
"id"] .
" found! (Please update export installation to ILIAS 3.3.0)");
200 $pg_id = $this->pg_mapping[$pg[
"id"]];
207 if (!$this->lm_tree->isInTree($pg_id)) {
208 $this->lm_tree->insertNode($pg_id, $st[
"id"]);
232 foreach ($this->pages_to_parse as $page_id) {
233 $page_arr = explode(
":", $page_id);
235 switch ($page_arr[0]) {
237 switch ($this->content_object->getType()) {
239 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
240 $page_obj =
new ilLMPage($page_arr[1]);
244 die(
"Unknown content type " . $this->content_object->getType());
250 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefPage.php");
258 $page_obj->buildDom();
259 $page_obj->resolveIntLinks();
260 $page_obj->resolveIIMMediaAliases($this->mob_mapping);
261 if (in_array($this->coType, array(
"lm"))) {
262 $page_obj->resolveQuestionReferences($this->qst_mapping);
264 $page_obj->update(
false);
266 if ($page_arr[0] ==
"gdf") {
268 $def->updateShortText();
276 foreach ($this->mobs_with_int_links as $mob_id) {
283 foreach ($this->link_targets as $link_target) {
285 $link_arr = explode(
"_", $link_target);
286 $target_inst = $link_arr[1];
293 if (in_array(
$key, $done)) {
296 $type_arr = explode(
":",
$source[
"type"]);
299 if ($type_arr[1] ==
"pg") {
301 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
311 if ($type_arr[0] ==
"qst") {
312 require_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
316 if ($type_arr[0] ==
"sqst") {
317 require_once
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
331 $imp_dir = $this->import_dir;
332 foreach ($this->mob_mapping as $origin_id => $mob_id) {
333 if (empty($origin_id)) {
348 $obj_dir = $origin_id;
349 $source_dir = $imp_dir .
"/" . $this->subdir .
"/objects/" . $obj_dir;
352 if (@is_dir($source_dir)) {
358 if (@is_dir($target_dir)) {
371 $imp_dir = $this->import_dir;
372 foreach ($this->file_item_mapping as $origin_id => $file_id) {
373 if (empty($origin_id)) {
376 $obj_dir = $origin_id;
377 $source_dir = $imp_dir .
"/" . $this->subdir .
"/objects/" . $obj_dir;
379 include_once(
"./Modules/File/classes/class.ilObjFile.php");
380 $file_obj =
new ilObjFile($file_id,
false);
382 $target_dir = $file_obj->getDirectory();
383 if (@is_dir($source_dir)) {
389 if (@is_dir($target_dir)) {
393 $test = $file_obj->determineFilesize();
403 $this->qst_mapping = $a_map;
412 if (!isset($this->status[
"$a_name"])) {
413 $this->cnt[$a_name] == 1;
415 $this->cnt[$a_name]++;
417 $this->current_element[count($this->current_element)] = $a_name;
427 $this->cnt[$a_name]--;
428 unset($this->current_element[count($this->current_element) - 1]);
436 return ($this->current_element[count($this->current_element) - 1]);
446 if (isset($this->cnt[$a_name])) {
447 return $this->cnt[$a_name];
464 if (
$type ==
"end") {
470 if (is_array($attr)) {
471 foreach ($attr as $k => $v) {
472 $tag .=
" " . $k .
"=\"$v\"";
492 case "ContentObject":
495 if ($a_attribs[
"Type"] ==
"Glossary") {
500 case "StructureObject":
502 $this->structure_objects[count($this->structure_objects)]
504 $this->current_object = $this->structure_objects[count($this->structure_objects) - 1];
505 $this->current_object->setLMId($this->content_object->getId());
509 $this->current_object->create(
true);
513 $this->in_page_object =
true;
515 if (($this->coType !=
"tst")
and ($this->coType !=
"qpl")) {
516 $this->lm_page_object =
new ilLMPageObject($this->content_object);
517 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
518 $this->page_object =
new ilLMPage();
519 $this->lm_page_object->setLMId($this->content_object->getId());
520 $this->lm_page_object->assignPageObject($this->page_object);
523 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
529 if (($this->coType !=
"tst")
and ($this->coType !=
"qpl")) {
530 $this->lm_page_object->setAlias(
true);
531 $this->lm_page_object->setOriginID($a_attribs[
"OriginId"]);
536 $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)) {
550 $this->page_object->needsImportParsing(
true);
555 case "MediaAliasItem":
556 $this->in_media_item =
true;
558 $this->media_item->setPurpose($a_attribs[
"Purpose"]);
567 if (is_object($this->media_object) && $this->in_media_object) {
568 $this->media_item->setWidth($a_attribs[
"Width"]);
569 $this->media_item->setHeight($a_attribs[
"Height"]);
570 $this->media_item->setHAlign($a_attribs[
"HorizontalAlign"]);
575 if (is_object($this->media_object) && $this->in_media_object) {
576 $this->media_item->setParameter($a_attribs[
"Name"], $a_attribs[
"Value"]);
581 $this->in_map_area =
true;
583 $this->map_area->setShape($a_attribs[
"Shape"]);
584 $this->map_area->setCoords($a_attribs[
"Coords"]);
585 $this->map_area->setHighlightMode($a_attribs[
"HighlightMode"]);
586 $this->map_area->setHighlightClass($a_attribs[
"HighlightClass"]);
590 $this->in_glossary =
true;
591 if ($this->content_object->getType() !=
"glo") {
593 $this->glossary_object->setTitle(
"");
594 $this->glossary_object->setDescription(
"");
595 $this->glossary_object->create(
true);
596 $this->glossary_object->createReference();
597 $parent = $this->tree->getParentNodeData($this->content_object->getRefId());
598 $this->glossary_object->putInTree($parent[
"child"]);
599 $this->glossary_object->setPermissions($parent[
"child"]);
606 $this->glossary_term->setGlossaryId($this->glossary_object->getId());
607 $this->glossary_term->setLanguage($a_attribs[
"Language"]);
608 $this->glossary_term->setImportId($a_attribs[
"Id"]);
609 $this->link_targets[$a_attribs[
"Id"]] = $a_attribs[
"Id"];
613 $this->in_glossary_definition =
true;
615 include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefPage.php");
617 $this->page_object->setParentId($this->glossary_term->getGlossaryId());
618 $this->glossary_definition->setTermId($this->glossary_term->getId());
619 $this->glossary_definition->assignPageObject($this->page_object);
620 $this->current_object = $this->glossary_definition;
621 $this->glossary_definition->create(
true);
624 $this->page_object->setXMLContent(
"");
628 $this->in_file_item =
true;
630 $this->file_item->setTitle(
"dummy");
631 $this->file_item->setMode(
"filelist");
632 if (is_object($this->page_object)) {
633 $this->page_object->needsImportParsing(
true);
638 if ($a_attribs[
"Characteristic"] ==
"Code") {
639 $this->inside_code =
true;
644 $this->in_properties =
true;
648 if ($this->content_object->getType() ==
"lm") {
649 switch ($a_attribs[
"Name"]) {
651 $this->content_object->setLayout($a_attribs[
"Value"]);
655 $this->content_object->setPageHeader($a_attribs[
"Value"]);
659 $this->content_object->setTOCMode($a_attribs[
"Value"]);
663 $this->content_object->setActiveLMMenu(
668 case "ActiveNumbering":
669 $this->content_object->setActiveNumbering(
675 $this->content_object->setActiveTOC(
680 case "ActivePrintView":
681 $this->content_object->setActivePrintView(
687 $this->content_object->setCleanFrames(
693 $this->content_object->setPublicNotes(
698 case "HistoryUserComments":
699 $this->content_object->setHistoryUserComments(
705 $this->content_object->setRating(
711 $this->content_object->setRatingPages(
717 if ($a_attribs[
"Value"] !=
"") {
718 if ($this->pg_mapping[$a_attribs[
"Value"]] > 0) {
719 $this->content_object->setHeaderPage(
720 $this->pg_mapping[$a_attribs[
"Value"]]
727 if ($a_attribs[
"Value"] !=
"") {
728 if ($this->pg_mapping[$a_attribs[
"Value"]] > 0) {
729 $this->content_object->setFooterPage(
730 $this->pg_mapping[$a_attribs[
"Value"]]
736 case "LayoutPerPage":
737 $this->content_object->setLayoutPerPage($a_attribs[
"Value"]);
740 case "ProgressIcons":
741 $this->content_object->setProgressIcons($a_attribs[
"Value"]);
745 $this->content_object->setStoreTries($a_attribs[
"Value"]);
748 case "RestrictForwardNavigation":
749 $this->content_object->setRestrictForwardNavigation($a_attribs[
"Value"]);
752 case "DisableDefaultFeedback":
753 $this->content_object->setDisableDefaultFeedback($a_attribs[
"Value"]);
765 $this->in_meta_data =
true;
770 if (!$this->in_media_object) {
771 if (($this->coType !=
"tst")
and ($this->coType !=
"qpl")) {
773 if ($this->current_object->getType() ==
"st" ||
774 $this->current_object->getType() ==
"pg") {
776 if ($this->current_object->getType() ==
"pg") {
777 $this->lm_page_object->create(
true);
779 $this->md =
new ilMD(
780 $this->content_object->getId(),
781 $this->current_object->getId(),
782 $this->current_object->getType()
786 elseif ($this->current_object->getType() ==
"gdf") {
787 $this->md =
new ilMD(
788 $this->glossary_object->getId(),
789 $this->current_object->getId(),
790 $this->current_object->getType()
796 $this->md =
new ilMD(
797 $this->current_object->getId(),
799 $this->current_object->getType()
805 $this->md =
new ilMD(
806 $this->content_object->getId(),
808 $this->current_object->getType()
810 if ($this->md->getGeneral() !=
false) {
811 $this->metadata_parsing_disabled =
true;
825 if ($import_id_parsed[
'type'] ==
'st') {
826 $this->mapping->addMapping(
827 'Modules/LearningModule',
829 $import_id_parsed[
'id'],
830 $this->current_object->getId()
838 if (!$this->in_meta_meta_data) {
839 if ($this->in_meta_data && !$this->in_glossary_definition) {
840 if (!$this->in_media_object) {
841 $this->current_object->setImportId($a_attribs[
"Entry"]);
843 $this->link_targets[$a_attribs[
"Entry"]] = $a_attribs[
"Entry"];
845 if ($this->in_file_item) {
846 if ($this->file_item_mapping[$a_attribs[
"Entry"]] ==
"") {
847 $this->file_item->create();
848 $this->file_item->setImportId($a_attribs[
"Entry"]);
849 $this->file_item_mapping[$a_attribs[
"Entry"]] = $this->file_item->getId();
852 if ($this->in_meta_data && $this->in_media_object) {
855 $mob_id = $this->mob_mapping[$a_attribs[
"Entry"]];
864 $this->media_object->create(
true,
false);
865 $this->mob_mapping[$a_attribs[
"Entry"]]
866 = $this->media_object->getId();
868 $this->media_object->setImportId($a_attribs[
"Entry"]);
869 $this->md =
new ilMD(
871 $this->media_object->getId(),
879 case "Meta-Metadata":
880 $this->in_meta_meta_data =
true;
885 if (is_object($this->page_object)) {
886 $this->page_object->setContainsIntLink(
true);
888 if ($this->in_map_area) {
891 $this->map_area->setTarget($a_attribs[
"Target"]);
892 $this->map_area->setType($a_attribs[
"Type"]);
893 $this->map_area->setTargetFrame($a_attribs[
"TargetFrame"]);
894 if (is_object($this->media_object)) {
896 $this->media_object->setContainsIntLink(
true);
903 if ($this->in_map_area) {
905 $this->map_area->setHref($a_attribs[
"Href"]);
906 $this->map_area->setExtTitle($a_attribs[
"Title"]);
912 $this->cur_qid = $a_attribs[
"QRef"];
913 $this->page_object->setContainsQuestion(
true);
917 $this->loc_type = $a_attribs[
"Type"];
924 if (($this->in_page_object || $this->in_glossary_definition)
925 && !$this->in_meta_data && !$this->in_media_object) {
926 if ($a_name ==
"Definition") {
927 $app_name =
"PageObject";
928 $app_attribs = array();
931 $app_attribs = $a_attribs;
935 if ($this->in_file_item && $app_name ==
"Identifier") {
936 $app_attribs[
"Entry"] =
"il__file_" . $this->file_item_mapping[$a_attribs[
"Entry"]];
940 $this->page_object->appendXMLContent($this->
buildTag(
"start", $app_name, $app_attribs));
951 if ($this->in_media_object && $this->media_meta_start) {
952 $this->media_meta_cache[] =
953 array(
"type" =>
"handlerBeginTag",
"par1" => $a_name,
"par2" => $a_attribs);
955 if ($a_name ==
"Identifier") {
956 if (!$this->in_media_object) {
957 $a_attribs[
"Entry"] =
"il__" . $this->current_object->getType() .
958 "_" . $this->current_object->getId();
960 $a_attribs[
"Entry"] =
"il__mob" .
961 "_" . $this->media_object->getId();
963 $a_attribs[
"Catalog"] =
"ILIAS";
966 parent::handlerBeginTag($a_xml_parser, $a_name, $a_attribs);
978 if ($this->content_object->getType() ==
"glo" &&
979 $this->in_glossary && !$this->in_media_object
980 && !$this->in_glossary_definition) {
1001 if ($this->in_media_object && $this->media_meta_start) {
1002 $this->media_meta_cache[] =
1003 array(
"type" =>
"handlerEndTag",
"par1" => $a_name);
1005 parent::handlerEndTag($a_xml_parser, $a_name);
1011 if (($this->in_page_object || $this->in_glossary_definition)
1012 && !$this->in_meta_data && !$this->in_media_object) {
1013 $app_name = ($a_name ==
"Definition")
1016 $this->page_object->appendXMLContent($this->
buildTag(
"end", $app_name));
1020 case "StructureObject":
1022 unset($this->structure_objects[count($this->structure_objects) - 1]);
1027 $this->in_page_object =
false;
1028 if (($this->coType !=
"tst")
and ($this->coType !=
"qpl")) {
1029 if (!$this->lm_page_object->isAlias()) {
1031 $this->page_object->updateFromXML();
1032 $this->pg_mapping[$this->lm_page_object->getImportId()]
1033 = $this->lm_page_object->getId();
1037 if ($import_id_parsed[
'type'] ==
'pg') {
1038 $this->mapping->addMapping(
1039 'Modules/LearningModule',
1041 $import_id_parsed[
'id'],
1042 $this->lm_page_object->getId()
1048 if ($this->page_object->containsIntLink()) {
1049 $this->pages_to_parse[
"lm:" . $this->page_object->getId()] =
"lm:" . $this->page_object->getId();
1053 if ($this->page_object->needsImportParsing()) {
1054 $this->pages_to_parse[
"lm:" . $this->page_object->getId()] =
"lm:" . $this->page_object->getId();
1058 if ($this->page_object->getContainsQuestion()) {
1059 $this->pages_to_parse[
"lm:" . $this->page_object->getId()] =
"lm:" . $this->page_object->getId();
1063 $xml = $this->page_object->getXMLContent();
1064 if ($this->cur_qid !=
"") {
1065 $ids = $this->qst_mapping[$this->cur_qid];
1066 if ($ids[
"pool"] > 0) {
1068 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
1070 $xmlcontent = str_replace(
1072 "il__qst_" . $ids[
"pool"],
1075 $page->setXMLContent($xmlcontent);
1076 $page->updateFromXML();
1077 if ($this->page_object->needsImportParsing()) {
1078 $this->pages_to_parse[
"qpl:" . $page->getId()] =
"qpl:" . $page->getId();
1082 if ($ids[
"test"] > 0) {
1084 include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
1086 $xmlcontent = str_replace(
1088 "il__qst_" . $ids[
"test"],
1091 $page->setXMLContent($xmlcontent);
1092 $page->updateFromXML();
1093 if ($this->page_object->needsImportParsing()) {
1094 $this->pages_to_parse[
"qpl:" . $page->getId()] =
"qpl:" . $page->getId();
1102 $cnt = count($this->structure_objects);
1107 $parent_id = $this->structure_objects[
$cnt - 1]->getId();
1108 if ($this->lm_page_object->isAlias()) {
1110 $this->pg_into_tree[$parent_id][] = array(
"type" =>
"pg_alias",
"id" => $this->lm_page_object->getOriginId());
1114 $this->pg_into_tree[$parent_id][] = array(
"type" =>
"pg",
"id" => $this->lm_page_object->getId());
1118 unset($this->page_object);
1119 unset($this->lm_page_object);
1120 unset($this->container[count($this->container) - 1]);
1124 $this->in_media_object =
false;
1126 case "InteractiveImage":
1132 if (empty($this->mob_mapping[$this->media_object->getImportId()])) {
1138 $this->media_object->create(
true,
false);
1143 if ($this->media_object->containsIntLink()) {
1145 $this->mobs_with_int_links[] = $this->media_object->getId();
1148 $this->mob_mapping[$this->media_object->getImportId()]
1149 = $this->media_object->getId();
1154 $this->media_object->setId($this->mob_mapping[$this->media_object->getImportId()]);
1161 if (!$this->media_object->isAlias()) {
1163 $this->media_object->update();
1168 if ($this->media_object->containsIntLink()) {
1170 $this->mobs_with_int_links[] = $this->media_object->getId();
1176 if ($this->in_page_object || $this->in_glossary_definition) {
1177 if ($a_name !=
"InteractiveImage") {
1178 $this->page_object->appendXMLContent($this->media_object->getXML(
IL_MODE_ALIAS));
1186 case "MediaAliasItem":
1187 $this->in_media_item =
false;
1188 $this->media_object->addMediaItem($this->media_item);
1193 $this->in_map_area =
false;
1194 $this->media_item->addMapArea($this->map_area);
1198 $this->in_properties =
false;
1199 if ($this->content_object->getType() ==
"lm") {
1200 $this->content_object->update();
1205 $this->in_meta_data =
false;
1206 if (strtolower(get_class($this->current_object)) ==
"illmpageobject" && !$this->in_media_object) {
1208 if (is_object($this->lm_page_object)) {
1210 $this->current_object->MDUpdateListener(
'General');
1212 $this->current_object->getId(),
1213 $this->current_object->getImportId()
1216 } elseif ((strtolower(get_class($this->current_object)) ==
"ilobjquestionpool" ||
1217 strtolower(get_class($this->current_object)) ==
"ilobjtest") &&
1218 !$this->in_media_object) {
1222 if ($this->metadata_parsing_disabled) {
1225 if ($this->in_page_object) {
1226 $this->page_object->MDUpdateListener(
'General');
1228 $this->page_object->getId(),
1229 $this->page_object->getImportId()
1232 $this->current_object->MDUpdateListener(
'General');
1234 $this->current_object->getId(),
1235 $this->current_object->getImportId()
1239 } elseif (strtolower(get_class($this->current_object)) ==
"ilstructureobject") {
1241 $cnt = count($this->structure_objects);
1243 $parent_id = $this->structure_objects[
$cnt - 2]->getId();
1245 $parent_id = $this->lm_tree->getRootId();
1250 $this->st_into_tree[] = array(
"id" => $this->current_object->getId(),
1251 "parent" => $parent_id);
1254 $this->current_object->MDUpdateListener(
'General');
1256 $this->current_object->getId(),
1257 $this->current_object->getImportId()
1259 } elseif (strtolower(get_class($this->current_object)) ==
"ilobjlearningmodule" ||
1260 strtolower(get_class($this->current_object)) ==
"ilobjcontentobject" ||
1261 (strtolower(get_class($this->current_object)) ==
"ilobjglossary" && $this->in_glossary)) {
1264 } elseif (strtolower(get_class($this->current_object)) ==
"ilglossarydefinition" && !$this->in_media_object) {
1268 $this->page_object->setId($this->glossary_definition->getId());
1269 $this->page_object->updateFromXML();
1276 if (strtolower(get_class($this->current_object)) ==
"ilobjlearningmodule" ||
1277 strtolower(get_class($this->current_object)) ==
"ilobjglossary") {
1278 if (strtolower(get_class($this->current_object)) ==
"ilobjglossary" &&
1279 $this->content_object->getType() !=
"glo") {
1281 $this->current_object->setTitle($this->content_object->getTitle() .
" - " .
1282 $this->lng->txt(
"glossary"));
1285 $this->current_object->MDUpdateListener(
'General');
1294 if ($this->in_media_object) {
1296 $this->media_object->MDUpdateListener(
'General');
1299 if ($this->in_glossary_definition) {
1300 $this->glossary_definition->MDUpdateListener(
'General');
1305 case "Meta-Metadata":
1306 $this->in_meta_meta_data =
false;
1310 $this->in_file_item =
false;
1312 if ($this->file_item->getImportId($a_attribs[
"Entry"] !=
"")) {
1313 $this->file_item->update();
1319 unset($this->container[count($this->container) - 1]);
1323 $this->in_glossary =
false;
1326 case "GlossaryTerm":
1327 $term = trim($this->chr_data);
1328 $term = str_replace(
"<",
"<", $term);
1329 $term = str_replace(
">",
">", $term);
1330 $this->glossary_term->setTerm($term);
1331 $this->glossary_term->create();
1332 $iia = explode(
"_", $this->glossary_term->getImportId());
1333 $this->glossary_term_map[(int) $iia[count($iia) - 1]] = $this->glossary_term->getId();
1337 $this->inside_code =
false;
1341 $this->in_glossary_definition =
false;
1342 $this->page_object->updateFromXML();
1345 $this->page_object->buildDom();
1346 $this->glossary_definition->setShortText($this->page_object->getFirstParagraphText());
1347 $this->glossary_definition->update();
1350 if ($this->page_object->containsIntLink()) {
1352 $this->pages_to_parse[
"gdf:" . $this->page_object->getId()] =
"gdf:" . $this->page_object->getId();
1354 if ($this->page_object->needsImportParsing()) {
1355 $this->pages_to_parse[
"gdf:" . $this->page_object->getId()] =
"gdf:" . $this->page_object->getId();
1360 if ($this->in_media_item) {
1361 $this->media_item->setFormat(trim($this->chr_data));
1363 if ($this->in_file_item) {
1364 $this->file_item->setFileType(trim($this->chr_data));
1369 if (!$this->in_media_object) {
1370 $this->current_object->setTitle(trim($this->chr_data));
1373 $this->media_object->setTitle(trim($this->chr_data));
1392 if ($this->in_media_object) {
1393 $this->media_item->setCaption(trim($this->chr_data));
1397 case "TextRepresentation":
1398 if ($this->in_media_object) {
1399 $this->media_item->setTextRepresentation(trim($this->chr_data));
1406 if ($this->in_media_item) {
1407 $this->media_item->setLocationType($this->loc_type);
1408 if ($this->loc_type ==
"Reference") {
1409 $this->media_item->setLocation(str_replace(
"&",
"&", trim($this->chr_data)));
1411 $this->media_item->setLocation(trim($this->chr_data));
1415 if ($this->in_file_item) {
1417 $this->file_item->setFileName(trim($this->chr_data));
1421 if ($this->file_item->getType() ==
"file" &&
1422 is_int(strpos($this->chr_data,
"&")) &&
1423 is_int(strpos($this->chr_data,
";"))) {
1424 $imp_dir = $this->import_dir;
1425 $source_dir = $imp_dir .
"/" . $this->subdir .
"/objects/" .
1426 $this->file_item->getImportId();
1429 if ($dir = opendir($source_dir)) {
1430 while (
false !== ($file = readdir($dir))) {
1431 if ($file !=
"." && $file !=
"..") {
1432 $this->file_item->setFileName($file);
1440 $this->file_item->setTitle(trim($this->chr_data));
1446 $this->chr_data =
"";
1458 if ($this->in_meta_data && $this->
processMeta()) {
1462 if ($this->in_media_object && $this->media_meta_start) {
1463 $this->media_meta_cache[] =
1464 array(
"type" =>
"handlerCharacterData",
"par1" => $a_data);
1466 parent::handlerCharacterData($a_xml_parser, $a_data);
1474 $a_data = str_replace(
"<",
"<", $a_data);
1475 $a_data = str_replace(
">",
">", $a_data);
1479 $a_data = preg_replace(
"/\n/",
"", $a_data);
1480 if (!$this->inside_code) {
1481 $a_data = preg_replace(
"/\t+/",
"", $a_data);
1484 $this->chr_data .= $a_data;
1486 if (!empty($a_data) || $a_data ===
"0") {
1489 if (($this->in_page_object || $this->in_glossary_definition)
1490 && !$this->in_meta_data && !$this->in_media_object) {
1491 $this->page_object->appendXMLContent($a_data);
1494 if ($this->in_meta_data) {
1503 if ($this->in_map_area) {
1504 $this->map_area->appendTitle($a_data);
1519 foreach ($this->media_meta_cache as $cache_entry) {
1520 switch ($cache_entry[
"type"]) {
1521 case "handlerBeginTag":
1522 parent::handlerBeginTag(
1524 $cache_entry[
"par1"],
1525 $cache_entry[
"par2"]
1529 case "handlerEndTag":
1530 parent::handlerEndTag(
1532 $cache_entry[
"par1"]
1536 case "handlerCharacterData":
1537 parent::handlerCharacterData(
1539 $cache_entry[
"par1"]
1545 $this->media_meta_start =
false;
1546 $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)
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
setTreeTablePK($a_column_name)
set column containing primary key in tree table public
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
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
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Extension of ilPageObject for learning modules.
getGlossaryTermMap()
Get glossary term map (imported ids to new ids)
setHandlers($a_xml_parser)
set event handlers