4require_once(
"./Modules/LearningModule/classes/class.ilLMPageObject.php");
 
    5require_once(
"./Services/COPage/classes/class.ilPageObject.php");
 
    6require_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
 
    7require_once(
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
 
    8require_once(
"Services/MetaData/classes/class.ilMDLanguageItem.php");
 
    9require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
 
   10require_once(
"./Services/COPage/classes/class.ilPCTable.php");
 
   11require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
   12require_once(
"./Services/MediaObjects/classes/class.ilMediaItem.php");
 
   13require_once(
"./Services/MediaObjects/classes/class.ilMapArea.php");
 
   14require_once(
"./Modules/LearningModule/classes/class.ilBibItem.php");
 
   15require_once(
"./Modules/Glossary/classes/class.ilObjGlossary.php");
 
   16require_once(
"./Modules/Glossary/classes/class.ilGlossaryTerm.php");
 
   17require_once(
"./Modules/Glossary/classes/class.ilGlossaryDefinition.php");
 
   18require_once(
"./Services/Link/classes/class.ilInternalLink.php");
 
   19require_once(
"./Modules/File/classes/class.ilObjFile.php");
 
   21include_once(
"Services/MetaData/classes/class.ilMDSaxParser.php");
 
   22include_once(
"Services/MetaData/classes/class.ilMD.php");
 
   90        function ilContObjParser(&$a_content_object, $a_xml_file, $a_subdir, $a_import_dir = 
"")
 
   96                $this->import_dir = ($a_import_dir != 
"")
 
   98                        : $a_content_object->getImportDirectory();
 
  100                parent::ilMDSaxParser($a_xml_file);
 
  101                $this->cnt = array();
 
  102                $this->current_element = array();
 
  103                $this->structure_objects = array();
 
  104                $this->content_object = $a_content_object;
 
  106                $this->st_into_tree = array();
 
  107                $this->pg_into_tree = array();
 
  108                $this->pages_to_parse = array();
 
  109                $this->mobs_with_int_links = array();
 
  110                $this->mob_mapping = array();
 
  111                $this->file_item_mapping = array();
 
  112                $this->pg_mapping = array();
 
  113                $this->link_targets = array();
 
  114                $this->subdir = $a_subdir;
 
  117                $this->inside_code = 
false;
 
  118                $this->qst_mapping = array();
 
  119                $this->coType = $this->content_object->getType();
 
  120                $this->metadata_parsing_disabled = 
false;
 
  122                if (($this->coType != 
"tst") and ($this->coType != 
"qpl"))
 
  124                        $this->lm_tree = 
new ilTree($this->content_object->getId());
 
  125                        $this->lm_tree->setTreeTablePK(
"lm_id");
 
  126                        $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
 
  140                xml_set_object($a_xml_parser,$this);
 
  141                xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
 
  142                xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
 
  151                $this->mapping = $mapping;
 
  160                $this->log->debug(
"start");
 
  163                parent::startParsing();
 
  184                foreach($this->st_into_tree as $st)
 
  187                        $this->lm_tree->insertNode($st[
"id"], $st[
"parent"]);
 
  191                        if (is_array($this->pg_into_tree[$st[
"id"]]))
 
  193                                foreach($this->pg_into_tree[$st[
"id"]] as $pg)
 
  198                                                        if ($this->pg_mapping[$pg[
"id"]] == 
"")
 
  200                                                                $ilLog->write(
"LM Import: No PageObject for PageAlias ".
 
  201                                                                                          $pg[
"id"].
" found! (Please update export installation to ILIAS 3.3.0)");
 
  206                                                        $pg_id = $this->pg_mapping[$pg[
"id"]];
 
  213                                        if (!$this->lm_tree->isInTree($pg_id))
 
  215                                                $this->lm_tree->insertNode($pg_id, $st[
"id"]);
 
  239                foreach($this->pages_to_parse as $page_id)
 
  241                        $page_arr = explode(
":", $page_id);
 
  246                                        switch ($this->content_object->getType())
 
  249                                                        include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
 
  250                                                        $page_obj = 
new ilLMPage($page_arr[1]);
 
  254                                                        die(
"Unknown content type ".$this->content_object->getType());
 
  260                                        include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefPage.php");
 
  268                        $page_obj->buildDom();
 
  269                        $page_obj->resolveIntLinks();
 
  270                        $page_obj->resolveIIMMediaAliases($this->mob_mapping);
 
  271                        if (in_array($this->coType, array(
"lm", 
"dbk")))
 
  273                                $page_obj->resolveQuestionReferences($this->qst_mapping);
 
  275                        $page_obj->update(
false);
 
  277                        if ($page_arr[0] == 
"gdf")
 
  280                                $def->updateShortText();
 
  288                foreach($this->mobs_with_int_links as $mob_id)
 
  296                foreach ($this->link_targets as $link_target)
 
  299                        $link_arr = explode(
"_", $link_target);
 
  300                        $target_inst = $link_arr[1];
 
  305                        foreach($sources as $key => $source)
 
  308                                if(in_array($key, $done))
 
  312                                $type_arr = explode(
":", $source[
"type"]);
 
  315                                if ($type_arr[1] == 
"pg")
 
  319                                                include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
 
  329                                if ($type_arr[0] == 
"qst")
 
  331                                        require_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  335                                if ($type_arr[0] == 
"sqst")
 
  337                                        require_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
  351                $imp_dir = $this->import_dir;
 
  352                foreach ($this->mob_mapping as $origin_id => $mob_id)
 
  354                        if(empty($origin_id))
 
  370                        $obj_dir = $origin_id;
 
  371                        $source_dir = $imp_dir.
"/".$this->subdir.
"/objects/".$obj_dir;
 
  374                        if (@is_dir($source_dir))
 
  381                                if (@is_dir($target_dir))
 
  394                $imp_dir = $this->import_dir;
 
  395                foreach ($this->file_item_mapping as $origin_id => $file_id)
 
  397                        if(empty($origin_id))
 
  401                        $obj_dir = $origin_id;
 
  402                        $source_dir = $imp_dir.
"/".$this->subdir.
"/objects/".$obj_dir;
 
  404                        include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
  405                        $file_obj = 
new ilObjFile($file_id, 
false);
 
  407                        $target_dir = $file_obj->getDirectory();
 
  408                        if (@is_dir($source_dir))
 
  415                                if (@is_dir($target_dir))
 
  420                        $test = $file_obj->determineFilesize();
 
  430                $this->qst_mapping = $a_map;
 
  439                if(!isset($this->status[
"$a_name"]))
 
  441                        $this->cnt[$a_name] = 1;
 
  445                        $this->cnt[$a_name]++;
 
  447                $this->current_element[count($this->current_element)] = $a_name;
 
  457                $this->cnt[$a_name]--;
 
  458                unset ($this->current_element[count($this->current_element) - 1]);
 
  466                return ($this->current_element[count($this->current_element) - 1]);
 
  476                if (isset($this->cnt[$a_name]))
 
  478                        return $this->cnt[$a_name];
 
  505                        while (list($k,$v) = each($attr))
 
  506                                $tag.= 
" ".$k.
"=\"$v\"";
 
  526                        case "ContentObject":
 
  529                                if ($a_attribs[
"Type"] == 
"Glossary")
 
  535                        case "StructureObject":
 
  537                                $this->structure_objects[count($this->structure_objects)]
 
  539                                $this->current_object = $this->structure_objects[count($this->structure_objects) - 1];
 
  540                                $this->current_object->setLMId($this->content_object->getId());
 
  544                                $this->current_object->create(
true);
 
  548                                $this->in_page_object = 
true;
 
  550                                if (($this->coType != 
"tst") and ($this->coType != 
"qpl"))
 
  552                                        $this->lm_page_object = 
new ilLMPageObject($this->content_object);
 
  553                                        include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
 
  554                                        $this->page_object = 
new ilLMPage();
 
  555                                        $this->lm_page_object->setLMId($this->content_object->getId());
 
  556                                        $this->lm_page_object->assignPageObject($this->page_object);
 
  561                                        include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
 
  567                                if (($this->coType != 
"tst") and ($this->coType != 
"qpl"))
 
  569                                        $this->lm_page_object->setAlias(
true);
 
  570                                        $this->lm_page_object->setOriginID($a_attribs[
"OriginId"]);
 
  575                                $this->in_media_object = 
true;
 
  576case "InteractiveImage":
 
  578                                $this->media_meta_start = 
true;
 
  579                                $this->media_meta_cache = array();
 
  585                                $this->media_object->setAlias(
true);
 
  586                                $this->media_object->setImportId($a_attribs[
"OriginId"]);
 
  587                                if (is_object($this->page_object))
 
  589                                        $this->page_object->needsImportParsing(
true);
 
  594                        case "MediaAliasItem":
 
  595                                $this->in_media_item = 
true;
 
  597                                $this->media_item->setPurpose($a_attribs[
"Purpose"]);
 
  606                                if (is_object($this->media_object) && $this->in_media_object)
 
  608                                        $this->media_item->setWidth($a_attribs[
"Width"]);
 
  609                                        $this->media_item->setHeight($a_attribs[
"Height"]);
 
  610                                        $this->media_item->setHAlign($a_attribs[
"HorizontalAlign"]);
 
  615                                if (is_object($this->media_object) && $this->in_media_object)
 
  617                                        $this->media_item->setParameter($a_attribs[
"Name"], $a_attribs[
"Value"]);
 
  622                                $this->in_map_area = 
true;
 
  624                                $this->map_area->setShape($a_attribs[
"Shape"]);
 
  625                                $this->map_area->setCoords($a_attribs[
"Coords"]);
 
  626                                $this->map_area->setHighlightMode($a_attribs[
"HighlightMode"]);
 
  627                                $this->map_area->setHighlightClass($a_attribs[
"HighlightClass"]);
 
  631                                $this->in_glossary = 
true;
 
  632                                if ($this->content_object->getType() != 
"glo")
 
  635                                        $this->glossary_object->setTitle(
"");
 
  636                                        $this->glossary_object->setDescription(
"");
 
  637                                        $this->glossary_object->create(
true);
 
  638                                        $this->glossary_object->createReference();
 
  639                                        $parent = $this->tree->getParentNodeData($this->content_object->getRefId());
 
  640                                        $this->glossary_object->putInTree($parent[
"child"]);
 
  641                                        $this->glossary_object->setPermissions($parent[
"child"]);
 
  642                                        $this->glossary_object->notify(
"new", 
$_GET[
"ref_id"],
$_GET[
"parent_non_rbac_id"],
$_GET[
"ref_id"],$this->glossary_object->getRefId());
 
  649                                $this->glossary_term->setGlossaryId($this->glossary_object->getId());
 
  650                                $this->glossary_term->setLanguage($a_attribs[
"Language"]);
 
  651                                $this->glossary_term->setImportId($a_attribs[
"Id"]);
 
  652                                $this->link_targets[$a_attribs[
"Id"]] = $a_attribs[
"Id"];
 
  656                                $this->in_glossary_definition = 
true;
 
  658                                include_once(
"./Modules/Glossary/classes/class.ilGlossaryDefPage.php");
 
  660                                $this->page_object->setParentId($this->glossary_term->getGlossaryId());
 
  661                                $this->glossary_definition->setTermId($this->glossary_term->getId());
 
  662                                $this->glossary_definition->assignPageObject($this->page_object);
 
  663                                $this->current_object = $this->glossary_definition;
 
  664                                $this->glossary_definition->create(
true);
 
  667                                $this->page_object->setXMLContent(
"");
 
  671                                $this->in_file_item = 
true;
 
  673                                $this->file_item->setTitle(
"dummy");
 
  674                                $this->file_item->setMode(
"filelist");
 
  675                                if (is_object($this->page_object))
 
  677                                        $this->page_object->needsImportParsing(
true);
 
  682                                if ($a_attribs[
"Characteristic"] == 
"Code")
 
  684                                        $this->inside_code = 
true;
 
  689                                $this->in_properties = 
true;
 
  693                                if ($this->content_object->getType() == 
"lm" 
  694                                        || $this->content_object->getType() == 
"dbk")
 
  696                                        switch($a_attribs[
"Name"])
 
  699                                                        $this->content_object->setLayout($a_attribs[
"Value"]);
 
  703                                                        $this->content_object->setPageHeader($a_attribs[
"Value"]);
 
  707                                                        $this->content_object->setTOCMode($a_attribs[
"Value"]);
 
  711                                                        $this->content_object->setActiveLMMenu(
 
  715                                                case "ActiveNumbering":
 
  716                                                        $this->content_object->setActiveNumbering(
 
  721                                                        $this->content_object->setActiveTOC(
 
  725                                                case "ActivePrintView":
 
  726                                                        $this->content_object->setActivePrintView(
 
  731                                                        $this->content_object->setCleanFrames(
 
  736                                                        $this->content_object->setPublicNotes(
 
  740                                                case "HistoryUserComments":
 
  741                                                        $this->content_object->setHistoryUserComments(
 
  746                                                        $this->content_object->setRating(
 
  751                                                        $this->content_object->setRatingPages(
 
  756                                                        if ($a_attribs[
"Value"] != 
"")
 
  758                                                                if ($this->pg_mapping[$a_attribs[
"Value"]] > 0)
 
  760                                                                        $this->content_object->setHeaderPage(
 
  761                                                                                $this->pg_mapping[$a_attribs[
"Value"]]);
 
  767                                                        if ($a_attribs[
"Value"] != 
"")
 
  769                                                                if ($this->pg_mapping[$a_attribs[
"Value"]] > 0)
 
  771                                                                        $this->content_object->setFooterPage(
 
  772                                                                                $this->pg_mapping[$a_attribs[
"Value"]]);
 
  777                                                case "LayoutPerPage":
 
  778                                                        $this->content_object->setLayoutPerPage($a_attribs[
"Value"]);
 
  781                                                case "ProgressIcons":
 
  782                                                        $this->content_object->setProgressIcons($a_attribs[
"Value"]);
 
  786                                                        $this->content_object->setStoreTries($a_attribs[
"Value"]);
 
  789                                                case "RestrictForwardNavigation":
 
  790                                                        $this->content_object->setRestrictForwardNavigation($a_attribs[
"Value"]);
 
  793                                                case "DisableDefaultFeedback":
 
  794                                                        $this->content_object->setDisableDefaultFeedback($a_attribs[
"Value"]);
 
  806                                $this->in_meta_data = 
true;
 
  811                                if(!$this->in_media_object)
 
  813                                        if (($this->coType != 
"tst") and ($this->coType != 
"qpl"))
 
  816                                                if ($this->current_object->getType() == 
"st" ||
 
  817                                                        $this->current_object->getType() == 
"pg")
 
  820                                                        if ($this->current_object->getType() == 
"pg")
 
  822                                                                $this->lm_page_object->create(
true);
 
  824                                                        $this->md = 
new ilMD($this->content_object->getId() ,
 
  825                                                                $this->current_object->getId(),
 
  826                                                                $this->current_object->getType());
 
  829                                                else if ($this->current_object->getType() == 
"gdf")
 
  831                                                        $this->md = 
new ilMD($this->glossary_object->getId() ,
 
  832                                                                $this->current_object->getId(),
 
  833                                                                $this->current_object->getType());
 
  840                                                                $this->md = 
new ilMD($this->current_object->getId() ,
 
  842                                                                        $this->current_object->getType());
 
  849                                                $this->md = 
new ilMD($this->content_object->getId() ,
 
  851                                                        $this->current_object->getType()
 
  853                                                if ($this->md->getGeneral() != 
false)
 
  855                                                        $this->metadata_parsing_disabled = 
true;
 
  871                                                if($import_id_parsed[
'type'] == 
'st')
 
  873                                                        $this->mapping->addMapping(
 
  874                                                                'Modules/LearningModule',
 
  876                                                                $import_id_parsed[
'id'],
 
  877                                                                $this->current_object->getId()
 
  885                                if (!$this->in_meta_meta_data)
 
  887                                        if ($this->in_meta_data && !$this->in_glossary_definition)
 
  889                                                if (!$this->in_media_object)
 
  891                                                        $this->current_object->setImportId($a_attribs[
"Entry"]);
 
  893                                                $this->link_targets[$a_attribs[
"Entry"]] = $a_attribs[
"Entry"];
 
  895                                        if ($this->in_file_item)
 
  897                                                if ($this->file_item_mapping[$a_attribs[
"Entry"]] == 
"")
 
  899                                                        $this->file_item->create();
 
  900                                                        $this->file_item->setImportId($a_attribs[
"Entry"]);
 
  901                                                        $this->file_item_mapping[$a_attribs[
"Entry"]] = $this->file_item->getId();
 
  904                                        if ($this->in_meta_data && $this->in_media_object)
 
  908                                                $mob_id = $this->mob_mapping[$a_attribs[
"Entry"]];
 
  920                                                        $this->media_object->create(
true, 
false);
 
  921                                                        $this->mob_mapping[$a_attribs[
"Entry"]]
 
  922                                                                = $this->media_object->getId();
 
  924                                                $this->media_object->setImportId($a_attribs[
"Entry"]);
 
  925                                                $this->md = 
new ilMD(0 ,
 
  926                                                        $this->media_object->getId(),
 
  933                        case "Meta-Metadata":
 
  934                                $this->in_meta_meta_data = 
true;
 
  939                                if (is_object($this->page_object))
 
  941                                        $this->page_object->setContainsIntLink(
true);
 
  943                                if ($this->in_map_area)
 
  947                                        $this->map_area->setTarget($a_attribs[
"Target"]);
 
  948                                        $this->map_area->setType($a_attribs[
"Type"]);
 
  949                                        $this->map_area->setTargetFrame($a_attribs[
"TargetFrame"]);
 
  950                                        if (is_object($this->media_object))
 
  953                                                $this->media_object->setContainsIntLink(
true);
 
  960                                if ($this->in_map_area)
 
  963                                        $this->map_area->setHref($a_attribs[
"Href"]);
 
  964                                        $this->map_area->setExtTitle($a_attribs[
"Title"]);
 
  970                                $this->cur_qid = $a_attribs[
"QRef"];
 
  971                                $this->page_object->setContainsQuestion(
true);
 
  975                                $this->loc_type = $a_attribs[
"Type"];
 
  979                                $this->in_bib_item = 
true;
 
  988                if(($this->in_page_object || $this->in_glossary_definition)
 
  989                        && !$this->in_meta_data && !$this->in_media_object)
 
  991                        if ($a_name == 
"Definition")
 
  993                                $app_name = 
"PageObject";
 
  994                                $app_attribs = array();
 
  999                                $app_attribs = $a_attribs;
 
 1003                        if ($this->in_file_item && $app_name == 
"Identifier")
 
 1005                                $app_attribs[
"Entry"] = 
"il__file_".$this->file_item_mapping[$a_attribs[
"Entry"]];
 
 1009                        $this->page_object->appendXMLContent($this->
buildTag(
"start", $app_name, $app_attribs));
 
 1014                if ($this->in_bib_item)   
 
 1016                        $this->bib_item->appendXMLContent(
"\n".$this->
buildTag(
"start", $a_name, $a_attribs));
 
 1026                        if ($this->in_media_object && $this->media_meta_start)
 
 1028                                $this->media_meta_cache[] =
 
 1029                                        array(
"type" => 
"handlerBeginTag", 
"par1" => $a_name, 
"par2" => $a_attribs);
 
 1033                                if ($a_name == 
"Identifier")
 
 1035                                        if (!$this->in_media_object)
 
 1037                                                $a_attribs[
"Entry"] = 
"il__".$this->current_object->getType().
 
 1038                                                        "_".$this->current_object->getId();
 
 1042                                                $a_attribs[
"Entry"] = 
"il__mob".
 
 1043                                                        "_".$this->media_object->getId();
 
 1045                                        $a_attribs[
"Catalog"] = 
"ILIAS";
 
 1048                                parent::handlerBeginTag($a_xml_parser,$a_name,$a_attribs);
 
 1060                if ($this->content_object->getType() == 
"glo" &&
 
 1061                        $this->in_glossary && !$this->in_media_object
 
 1062                        && !$this->in_glossary_definition)
 
 1085                        if ($this->in_media_object && $this->media_meta_start)
 
 1087                                $this->media_meta_cache[] =
 
 1088                                        array(
"type" => 
"handlerEndTag", 
"par1" => $a_name);
 
 1092                                parent::handlerEndTag($a_xml_parser,$a_name);
 
 1098                if (($this->in_page_object || $this->in_glossary_definition)
 
 1099                        && !$this->in_meta_data && !$this->in_media_object)
 
 1101                        $app_name = ($a_name == 
"Definition")
 
 1104                        $this->page_object->appendXMLContent($this->
buildTag(
"end", $app_name));
 
 1108                if ($this->in_bib_item) 
 
 1110                        if($a_name == 
"BibItem")
 
 1112                                $this->bib_item->appendXMLContent(
"\n".$this->
buildTag(
"end", $a_name));
 
 1116                                $this->bib_item->appendXMLContent($this->
buildTag(
"end", $a_name));
 
 1123                        case "StructureObject":
 
 1125                                unset($this->structure_objects[count($this->structure_objects) - 1]);
 
 1130                                $this->in_page_object = 
false;
 
 1131                                if (($this->coType != 
"tst") and ($this->coType != 
"qpl"))
 
 1133                                        if (!$this->lm_page_object->isAlias())
 
 1136                                                $this->page_object->updateFromXML();
 
 1137                                                $this->pg_mapping[$this->lm_page_object->getImportId()]
 
 1138                                                        = $this->lm_page_object->getId();
 
 1143                                                        if($import_id_parsed[
'type'] == 
'pg')
 
 1145                                                                $this->mapping->addMapping(
 
 1146                                                                        'Modules/LearningModule',
 
 1148                                                                        $import_id_parsed[
'id'], 
 
 1149                                                                        $this->lm_page_object->getId()
 
 1156                                                if ($this->page_object->containsIntLink())
 
 1158                                                        $this->pages_to_parse[
"lm:".$this->page_object->getId()] = 
"lm:".$this->page_object->getId();
 
 1162                                                if ($this->page_object->needsImportParsing())
 
 1164                                                        $this->pages_to_parse[
"lm:".$this->page_object->getId()] = 
"lm:".$this->page_object->getId();
 
 1168                                                if ($this->page_object->getContainsQuestion())
 
 1170                                                        $this->pages_to_parse[
"lm:".$this->page_object->getId()] = 
"lm:".$this->page_object->getId();
 
 1177                                        $xml = $this->page_object->getXMLContent();
 
 1178                                        if ($this->cur_qid != 
"")
 
 1180                                                $ids = $this->qst_mapping[$this->cur_qid];
 
 1181                                                if ($ids[
"pool"] > 0)
 
 1184                                                        include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
 
 1186                                                        $xmlcontent = str_replace($this->cur_qid,
 
 1187                                                                "il__qst_".$ids[
"pool"], $xml);
 
 1188                                                        $page->setXMLContent($xmlcontent);
 
 1189                                                        $page->updateFromXML();
 
 1190                                                        if( $this->page_object->needsImportParsing() )
 
 1192                                                                $this->pages_to_parse[
"qpl:".$page->getId()] = 
"qpl:".$page->getId();
 
 1196                                                if ($ids[
"test"] > 0)
 
 1199                                                        include_once(
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php");
 
 1201                                                        $xmlcontent = str_replace($this->cur_qid, 
 
 1202                                                                "il__qst_".$ids[
"test"], $xml);
 
 1203                                                        $page->setXMLContent($xmlcontent);
 
 1204                                                        $page->updateFromXML();
 
 1205                                                        if( $this->page_object->needsImportParsing() )
 
 1207                                                                $this->pages_to_parse[
"qpl:".$page->getId()] = 
"qpl:".$page->getId();
 
 1215                                $cnt = count($this->structure_objects);
 
 1221                                        $parent_id = $this->structure_objects[
$cnt - 1]->getId();
 
 1222                                        if ($this->lm_page_object->isAlias())
 
 1225                                                $this->pg_into_tree[$parent_id][] = array(
"type" => 
"pg_alias", 
"id" => $this->lm_page_object->getOriginId());
 
 1231                                                $this->pg_into_tree[$parent_id][] = array(
"type" => 
"pg", 
"id" => $this->lm_page_object->getId());
 
 1235                                unset($this->page_object);
 
 1236                                unset($this->lm_page_object);
 
 1237                                unset ($this->container[count($this->container) - 1]);
 
 1241                                $this->in_media_object = 
false;
 
 1242case "InteractiveImage":
 
 1248                                if(empty($this->mob_mapping[$this->media_object->getImportId()]))
 
 1255                                        $this->media_object->create(
true, 
false);
 
 1260                                        if ($this->media_object->containsIntLink())
 
 1263                                                $this->mobs_with_int_links[] = $this->media_object->getId();
 
 1266                                        $this->mob_mapping[$this->media_object->getImportId()]
 
 1267                                                        = $this->media_object->getId();
 
 1274                                        $this->media_object->setId($this->mob_mapping[$this->media_object->getImportId()]);
 
 1281                                        if (!$this->media_object->isAlias())
 
 1284                                                $this->media_object->update();
 
 1289                                                if ($this->media_object->containsIntLink())
 
 1292                                                        $this->mobs_with_int_links[] = $this->media_object->getId();
 
 1298                                if ($this->in_page_object || $this->in_glossary_definition)
 
 1300                                        if ($a_name != 
"InteractiveImage")
 
 1302                                                $this->page_object->appendXMLContent($this->media_object->getXML(
IL_MODE_ALIAS));
 
 1310                        case "MediaAliasItem":
 
 1311                                $this->in_media_item = 
false;
 
 1312                                $this->media_object->addMediaItem($this->media_item);
 
 1317                                $this->in_map_area = 
false;
 
 1318                                $this->media_item->addMapArea($this->map_area);
 
 1322                                $this->in_properties = 
false;
 
 1323                                if ($this->content_object->getType() == 
"lm" 
 1324                                        || $this->content_object->getType() == 
"dbk")
 
 1326                                        $this->content_object->update();
 
 1331                                $this->in_meta_data = 
false;
 
 1332                                if(strtolower(get_class($this->current_object)) == 
"illmpageobject" && !$this->in_media_object)
 
 1335                                        if (is_object($this->lm_page_object))
 
 1338                                                $this->current_object->MDUpdateListener(
'General');
 
 1340                                                        $this->current_object->getImportId());
 
 1343                                else if((strtolower(get_class($this->current_object)) == 
"ilobjquestionpool" ||
 
 1344                                        strtolower(get_class($this->current_object)) == 
"ilobjtest") &&
 
 1345                                        !$this->in_media_object)
 
 1350                                        if ($this->metadata_parsing_disabled)
 
 1356                                                if ($this->in_page_object)
 
 1358                                                        $this->page_object->MDUpdateListener(
'General');
 
 1360                                                                        $this->page_object->getImportId());
 
 1364                                                        $this->current_object->MDUpdateListener(
'General');
 
 1366                                                                        $this->current_object->getImportId());
 
 1370                                else if(strtolower(get_class($this->current_object)) == 
"ilstructureobject")
 
 1373                                        $cnt = count($this->structure_objects);
 
 1376                                                $parent_id = $this->structure_objects[
$cnt - 2]->getId();
 
 1380                                                $parent_id = $this->lm_tree->getRootId();
 
 1385                                        $this->st_into_tree[] = array (
"id" => $this->current_object->getId(),
 
 1386                                                "parent" => $parent_id);
 
 1389                                        $this->current_object->MDUpdateListener(
'General');
 
 1391                                                        $this->current_object->getImportId());
 
 1393                                else if(strtolower(get_class($this->current_object)) == 
"ilobjdlbook" || strtolower(get_class($this->current_object)) == 
"ilobjlearningmodule" ||
 
 1394                                        strtolower(get_class($this->current_object)) == 
"ilobjcontentobject" ||
 
 1395                                        (strtolower(get_class($this->current_object)) == 
"ilobjglossary" && $this->in_glossary))
 
 1400                                else if(strtolower(get_class($this->current_object)) == 
"ilglossarydefinition" && !$this->in_media_object)
 
 1405                                        $this->page_object->setId($this->glossary_definition->getId());
 
 1406                                        $this->page_object->updateFromXML();
 
 1413                                if(strtolower(get_class($this->current_object)) == 
"ilobjlearningmodule" ||
 
 1414                                        strtolower(get_class($this->current_object)) == 
"ilobjdlbook" ||
 
 1415                                        strtolower(get_class($this->current_object)) == 
"ilobjglossary")
 
 1417                                        if (strtolower(get_class($this->current_object)) == 
"ilobjglossary" &&
 
 1418                                                $this->content_object->getType() != 
"glo")
 
 1421                                                $this->current_object->setTitle($this->content_object->getTitle().
" - ".
 
 1422                                                        $this->lng->txt(
"glossary"));
 
 1425                                        $this->current_object->MDUpdateListener(
'General');
 
 1434                                if ($this->in_media_object)
 
 1437                                        $this->media_object->MDUpdateListener(
'General');
 
 1440                                if ($this->in_glossary_definition)
 
 1442                                        $this->glossary_definition->MDUpdateListener(
'General');
 
 1447                        case "Meta-Metadata":
 
 1448                                $this->in_meta_meta_data = 
false;
 
 1452                                $this->in_file_item = 
false;
 
 1454                                if ($this->file_item->getImportId($a_attribs[
"Entry"] != 
""))
 
 1456                                        $this->file_item->update();
 
 1460                        case "Bibliography":
 
 1462                                $this->in_bib_item = 
false;
 
 1465                                $nested->import($this->bib_item->getXMLContent(),$this->content_object->getId(),
"bib");
 
 1469                                unset ($this->container[count($this->container) - 1]);
 
 1473                                $this->in_glossary = 
false;
 
 1476                        case "GlossaryTerm":
 
 1477                                $term = trim($this->chr_data);
 
 1478                                $term = str_replace(
"<", 
"<", $term);
 
 1479                                $term = str_replace(
">", 
">", $term);
 
 1480                                $this->glossary_term->setTerm($term);
 
 1481                                $this->glossary_term->create();
 
 1482                                $iia = explode(
"_", $this->glossary_term->getImportId());
 
 1483                                $this->glossary_term_map[(int) $iia[count($iia) - 1]] = $this->glossary_term->getId();
 
 1487                                $this->inside_code = 
false;
 
 1491                                $this->in_glossary_definition = 
false;
 
 1492                                $this->page_object->updateFromXML();
 
 1495                                $this->page_object->buildDom();
 
 1496                                $this->glossary_definition->setShortText($this->page_object->getFirstParagraphText());
 
 1497                                $this->glossary_definition->update();
 
 1500                                if ($this->page_object->containsIntLink())
 
 1503                                        $this->pages_to_parse[
"gdf:".$this->page_object->getId()] = 
"gdf:".$this->page_object->getId();
 
 1505                                if ($this->page_object->needsImportParsing())
 
 1507                                        $this->pages_to_parse[
"gdf:".$this->page_object->getId()] = 
"gdf:".$this->page_object->getId();
 
 1512                                if ($this->in_media_item)
 
 1514                                        $this->media_item->setFormat(trim($this->chr_data));
 
 1516                                if ($this->in_file_item)
 
 1518                                        $this->file_item->setFileType(trim($this->chr_data));
 
 1523                                if (!$this->in_media_object)
 
 1525                                        $this->current_object->setTitle(trim($this->chr_data));
 
 1530                                        $this->media_object->setTitle(trim($this->chr_data));
 
 1542                                if (is_object($this->bib_item))
 
 1544                                        $this->bib_item->setLanguage(trim($this->chr_data));
 
 1553                                if ($this->in_media_object)
 
 1555                                        $this->media_item->setCaption(trim($this->chr_data));
 
 1559                        case "TextRepresentation":
 
 1560                                if ($this->in_media_object)
 
 1562                                        $this->media_item->setTextRepresentation(trim($this->chr_data));
 
 1569                                if ($this->in_media_item)
 
 1571                                        $this->media_item->setLocationType($this->loc_type);
 
 1572                                        if ($this->loc_type == 
"Reference")
 
 1574                                                $this->media_item->setLocation(str_replace(
"&", 
"&", trim($this->chr_data)));
 
 1578                                                $this->media_item->setLocation(trim($this->chr_data));
 
 1582                                if ($this->in_file_item)
 
 1585                                        $this->file_item->setFileName(trim($this->chr_data));
 
 1589                                        if ($this->file_item->getType() == 
"file" &&
 
 1590                                                is_int(strpos($this->chr_data, 
"&")) &&
 
 1591                                                is_int(strpos($this->chr_data, 
";")))
 
 1593                                                $imp_dir = $this->import_dir;
 
 1594                                                $source_dir = $imp_dir.
"/".$this->subdir.
"/objects/".
 
 1595                                                        $this->file_item->getImportId();
 
 1598                                                if ($dir = opendir($source_dir))
 
 1600                                                   while (
false !== (
$file = readdir($dir)))
 
 1604                                                                   $this->file_item->setFileName(
$file);
 
 1612                                        $this->file_item->setTitle(trim($this->chr_data));
 
 1618                $this->chr_data = 
"";
 
 1635                        if ($this->in_media_object && $this->media_meta_start)
 
 1637                                $this->media_meta_cache[] =
 
 1638                                        array(
"type" => 
"handlerCharacterData", 
"par1" => $a_data);
 
 1642                                parent::handlerCharacterData($a_xml_parser,$a_data);
 
 1650                $a_data = str_replace(
"<",
"<",$a_data);
 
 1651                $a_data = str_replace(
">",
">",$a_data);
 
 1655                $a_data = preg_replace(
"/\n/",
"",$a_data);
 
 1656                if (!$this->inside_code)
 
 1658                        $a_data = preg_replace(
"/\t+/",
"",$a_data);
 
 1661                $this->chr_data .= $a_data;
 
 1663                if(!empty($a_data) || $a_data === 
"0")
 
 1667                        if (($this->in_page_object || $this->in_glossary_definition)
 
 1668                                && !$this->in_meta_data && !$this->in_media_object)
 
 1670                                $this->page_object->appendXMLContent($a_data);
 
 1673                        if ($this->in_meta_data)
 
 1679                        if ($this->in_bib_item  )
 
 1681                                $this->bib_item->appendXMLContent($a_data);
 
 1689                                        if($this->in_map_area)
 
 1691                                                $this->map_area->appendTitle($a_data);
 
 1707                foreach ($this->media_meta_cache as $cache_entry)
 
 1709                        switch($cache_entry[
"type"])
 
 1711                                case "handlerBeginTag": 
 
 1712                                        parent::handlerBeginTag($a_xml_parser, 
 
 1713                                                $cache_entry[
"par1"], $cache_entry[
"par2"]);
 
 1716                                case "handlerEndTag":
 
 1717                                        parent::handlerEndTag($a_xml_parser, 
 
 1718                                                $cache_entry[
"par1"]);
 
 1721                                case "handlerCharacterData":
 
 1722                                        parent::handlerCharacterData($a_xml_parser,
 
 1723                                                $cache_entry[
"par1"]);
 
 1728                $this->media_meta_start = 
false;
 
 1729                $this->media_meta_cache[] = array();
 
_resolveIntLinks($question_id)
_resolveIntLinks($question_id)
setQuestionMapping($a_map)
set question import ident to pool/test question id mapping
storeTree()
insert StructureObjects and PageObjects into tree
handlerEndTag($a_xml_parser, $a_name)
handler for end of element
buildTag($type, $name, $attr="")
generate a tag with given name and attributes
emptyMediaMetaCache(&$a_xml_parser)
send all cached tags to the meta data parser and clear the cache
$metadata_parsing_disabled
startParsing()
start parser
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
getGlossaryTermMap()
Get glossary term map (imported ids to new ids)
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
processPagesToParse()
parse pages that contain files, mobs and/or internal links
copyMobFiles()
copy multimedia object files from import zip file to mob directory
ilContObjParser(&$a_content_object, $a_xml_file, $a_subdir, $a_import_dir="")
Constructor.
setHandlers($a_xml_parser)
set event handlers
processMeta()
check whether meta data should be processed
copyFileItems()
copy files of file items
setImportMapping(ilImportMapping $mapping=null)
Set import mapping.
Glossary definition page object.
Class ilGlossaryDefinition.
_getSourcesOfTarget($a_target_type, $a_target_id, $a_target_inst)
get all sources of a link target
_writeImportId($a_id, $a_import_id)
write import id to db (static)
Extension of ilPageObject for learning modules.
static getLogger($a_component_id)
Get component logger.
enableMDParsing($a_status)
Class NestedSetXML functions for storing XML-Data into nested-set-database-strcture.
static getInstance($a_parent_type, $a_id=0, $a_old_nr=0, $a_lang="-")
Get page object instance.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static parseImportId($a_import_id)
Parse an ilias import id Typically of type il_[IL_INST_ID]_[OBJ_TYPE]_[OBJ_ID] returns array( 'orig' ...
static getWebspaceDir($mode="filesystem")
get webspace directory
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static yn2tf($a_yn)
convert "y"/"n" to true/false
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...