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");
 
   90                 $this->current_element = array();
 
   91                 $this->structure_objects = array();
 
   92                 $this->content_object =& $a_content_object;
 
   94                 $this->st_into_tree = array();
 
   95                 $this->pg_into_tree = array();
 
   96                 $this->pages_to_parse = array();
 
   97                 $this->mobs_with_int_links = array();
 
   98                 $this->mob_mapping = array();
 
   99                 $this->file_item_mapping = array();
 
  100                 $this->pg_mapping = array();
 
  101                 $this->link_targets = array();
 
  102                 $this->subdir = $a_subdir;
 
  104                 $this->tree =& 
$tree;
 
  105                 $this->inside_code = 
false;
 
  106                 $this->qst_mapping = array();
 
  107                 $this->coType = $this->content_object->getType();
 
  108                 $this->metadata_parsing_disabled = 
false;
 
  110                 if (($this->coType != 
"tst") and ($this->coType != 
"qpl"))
 
  112                         $this->lm_tree = 
new ilTree($this->content_object->getId());
 
  114                         $this->lm_tree->setTableNames(
'lm_tree',
'lm_data');
 
  128                 xml_set_object($a_xml_parser,$this);
 
  129                 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
 
  130                 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
 
  160                 foreach($this->st_into_tree as $st)
 
  163                         $this->lm_tree->insertNode($st[
"id"], $st[
"parent"]);
 
  165                         if (is_array($this->pg_into_tree[$st[
"id"]]))
 
  167                                 foreach($this->pg_into_tree[$st[
"id"]] as $pg)
 
  172                                                         if ($this->pg_mapping[$pg[
"id"]] == 
"")
 
  174                                                                 $ilLog->write(
"LM Import: No PageObject for PageAlias ".
 
  175                                                                                           $pg[
"id"].
" found! (Please update export installation to ILIAS 3.3.0)");
 
  180                                                         $pg_id = $this->pg_mapping[$pg[
"id"]];
 
  187                                         if (!$this->lm_tree->isInTree($pg_id))
 
  189                                                 $this->lm_tree->insertNode($pg_id, $st[
"id"]);
 
  212                 foreach($this->pages_to_parse as $page_id)
 
  214                         $page_arr = explode(
":", $page_id);
 
  219                                         $page_obj =& 
new ilPageObject($this->content_object->getType(), $page_arr[1]);
 
  226                         $page_obj->buildDom();
 
  227                         $page_obj->resolveIntLinks();
 
  228                         if (in_array($this->coType, array(
"lm", 
"dbk")))
 
  230                                 $page_obj->resolveQuestionReferences($this->qst_mapping);
 
  232                         $page_obj->update(
false);
 
  234                         if ($page_arr[0] == 
"gdf")
 
  237                                 $def->updateShortText();
 
  245                 foreach($this->mobs_with_int_links as $mob_id)
 
  253                 foreach ($this->link_targets as $link_target)
 
  256                         $link_arr = explode(
"_", $link_target);
 
  257                         $target_inst = $link_arr[1];
 
  261                         foreach($sources as $key => $source)
 
  264                                 if(in_array($key, $done))
 
  268                                 $type_arr = explode(
":", $source[
"type"]);
 
  271                                 if ($type_arr[1] == 
"pg")
 
  280                                 if ($type_arr[0] == 
"qst")
 
  282                                         require_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
  286                                 if ($type_arr[0] == 
"sqst")
 
  288                                         require_once 
"./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
 
  302                 $imp_dir = $this->content_object->getImportDirectory();
 
  303                 foreach ($this->mob_mapping as $origin_id => $mob_id)
 
  305                         if(empty($origin_id))
 
  321                         $obj_dir = $origin_id;
 
  322                         $source_dir = $imp_dir.
"/".$this->subdir.
"/objects/".$obj_dir;
 
  326                         if (@is_dir($source_dir))
 
  333                                 if (@is_dir($target_dir))
 
  346                 $imp_dir = $this->content_object->getImportDirectory();
 
  347                 foreach ($this->file_item_mapping as $origin_id => $file_id)
 
  349                         if(empty($origin_id))
 
  353                         $obj_dir = $origin_id;
 
  354                         $source_dir = $imp_dir.
"/".$this->subdir.
"/objects/".$obj_dir;
 
  356                         include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
  357                         $file_obj = 
new ilObjFile($file_id, 
false);
 
  359                         $target_dir = $file_obj->getDirectory();
 
  360                         if (@is_dir($source_dir))
 
  367                                 if (@is_dir($target_dir))
 
  372                         $test = $file_obj->determineFilesize();
 
  382                 $this->qst_mapping = $a_map;
 
  391                 if(!isset($this->status[
"$a_name"]))
 
  393                         $this->cnt[$a_name] == 1;
 
  397                         $this->cnt[$a_name]++;
 
  399                 $this->current_element[count($this->current_element)] = $a_name;
 
  409                 $this->cnt[$a_name]--;
 
  410                 unset ($this->current_element[count($this->current_element) - 1]);
 
  418                 return ($this->current_element[count($this->current_element) - 1]);
 
  428                 if (isset($this->cnt[$a_name]))
 
  430                         return $this->cnt[$a_name];
 
  457                         while (list($k,$v) = each($attr))
 
  458                                 $tag.= 
" ".$k.
"=\"$v\"";
 
  478                         case "ContentObject":
 
  481                                 if ($a_attribs[
"Type"] == 
"Glossary")
 
  487                         case "StructureObject":
 
  489                                 $this->structure_objects[count($this->structure_objects)]
 
  491                                 $this->current_object =& $this->structure_objects[count($this->structure_objects) - 1];
 
  492                                 $this->current_object->setLMId($this->content_object->getId());
 
  496                                 $this->current_object->create(
true);
 
  500                                 $this->in_page_object = 
true;
 
  502                                 if (($this->coType != 
"tst") and ($this->coType != 
"qpl"))
 
  504                                         $this->lm_page_object =& 
new ilLMPageObject($this->content_object);
 
  505                                         $this->page_object =& 
new ilPageObject($this->content_object->getType());
 
  506                                         $this->lm_page_object->setLMId($this->content_object->getId());
 
  507                                         $this->lm_page_object->assignPageObject($this->page_object);
 
  517                                 if (($this->coType != 
"tst") and ($this->coType != 
"qpl"))
 
  519                                         $this->lm_page_object->setAlias(
true);
 
  520                                         $this->lm_page_object->setOriginID($a_attribs[
"OriginId"]);
 
  525                                 $this->in_media_object = 
true;
 
  526                                 $this->media_meta_start = 
true;
 
  527                                 $this->media_meta_cache = array();
 
  533                                 $this->media_object->setAlias(
true);
 
  534                                 $this->media_object->setImportId($a_attribs[
"OriginId"]);
 
  535                                 if (is_object($this->page_object))
 
  537                                         $this->page_object->needsImportParsing(
true);
 
  542                         case "MediaAliasItem":
 
  543                                 $this->in_media_item = 
true;
 
  545                                 $this->media_item->setPurpose($a_attribs[
"Purpose"]);
 
  549                                 if (is_object($this->media_object) && $this->in_media_object)
 
  551                                         $this->media_item->setWidth($a_attribs[
"Width"]);
 
  552                                         $this->media_item->setHeight($a_attribs[
"Height"]);
 
  553                                         $this->media_item->setHAlign($a_attribs[
"HorizontalAlign"]);
 
  558                                 if (is_object($this->media_object) && $this->in_media_object)
 
  560                                         $this->media_item->setParameter($a_attribs[
"Name"], $a_attribs[
"Value"]);
 
  565                                 $this->in_map_area = 
true;
 
  567                                 $this->map_area->setShape($a_attribs[
"Shape"]);
 
  568                                 $this->map_area->setCoords($a_attribs[
"Coords"]);
 
  572                                 $this->in_glossary = 
true;
 
  573                                 if ($this->content_object->getType() != 
"glo")
 
  576                                         $this->glossary_object->setTitle(
"");
 
  577                                         $this->glossary_object->setDescription(
"");
 
  578                                         $this->glossary_object->create(
true);
 
  579                                         $this->glossary_object->createReference();
 
  580                                         $parent =& $this->tree->getParentNodeData($this->content_object->getRefId());
 
  581                                         $this->glossary_object->putInTree($parent[
"child"]);
 
  582                                         $this->glossary_object->setPermissions($parent[
"child"]);
 
  583                                         $this->glossary_object->notify(
"new", 
$_GET[
"ref_id"],
$_GET[
"parent_non_rbac_id"],
$_GET[
"ref_id"],$this->glossary_object->getRefId());
 
  590                                 $this->glossary_term->setGlossaryId($this->glossary_object->getId());
 
  591                                 $this->glossary_term->setLanguage($a_attribs[
"Language"]);
 
  592                                 $this->glossary_term->setImportId($a_attribs[
"Id"]);
 
  593                                 $this->link_targets[$a_attribs[
"Id"]] = $a_attribs[
"Id"];
 
  597                                 $this->in_glossary_definition = 
true;
 
  600                                 $this->page_object->setParentId($this->glossary_term->getGlossaryId());
 
  601                                 $this->glossary_definition->setTermId($this->glossary_term->getId());
 
  602                                 $this->glossary_definition->assignPageObject($this->page_object);
 
  603                                 $this->current_object =& $this->glossary_definition;
 
  604                                 $this->glossary_definition->create(
true);
 
  608                                 $this->in_file_item = 
true;
 
  610                                 $this->file_item->setTitle(
"dummy");
 
  611                                 $this->file_item->setMode(
"filelist");
 
  612                                 if (is_object($this->page_object))
 
  614                                         $this->page_object->needsImportParsing(
true);
 
  619                                 if ($a_attribs[
"Characteristic"] == 
"Code")
 
  621                                         $this->inside_code = 
true;
 
  626                                 $this->in_properties = 
true;
 
  630                                 if ($this->content_object->getType() == 
"lm" 
  631                                         || $this->content_object->getType() == 
"dbk")
 
  633                                         switch($a_attribs[
"Name"])
 
  636                                                         $this->content_object->setLayout($a_attribs[
"Value"]);
 
  640                                                         $this->content_object->setPageHeader($a_attribs[
"Value"]);
 
  644                                                         $this->content_object->setTOCMode($a_attribs[
"Value"]);
 
  648                                                         $this->content_object->setActiveLMMenu(
 
  652                                                 case "ActiveNumbering":
 
  653                                                         $this->content_object->setActiveNumbering(
 
  658                                                         $this->content_object->setActiveTOC(
 
  662                                                 case "ActivePrintView":
 
  663                                                         $this->content_object->setActivePrintView(
 
  668                                                         $this->content_object->setCleanFrames(
 
  673                                                         $this->content_object->setPublicNotes(
 
  677                                                 case "HistoryUserComments":
 
  678                                                         $this->content_object->setHistoryUserComments(
 
  683                                                         if ($a_attribs[
"Value"] != 
"")
 
  685                                                                 if ($this->pg_mapping[$a_attribs[
"Value"]] > 0)
 
  687                                                                         $this->content_object->setHeaderPage(
 
  688                                                                                 $this->pg_mapping[$a_attribs[
"Value"]]);
 
  694                                                         if ($a_attribs[
"Value"] != 
"")
 
  696                                                                 if ($this->pg_mapping[$a_attribs[
"Value"]] > 0)
 
  698                                                                         $this->content_object->setFooterPage(
 
  699                                                                                 $this->pg_mapping[$a_attribs[
"Value"]]);
 
  712                                 $this->in_meta_data = 
true;
 
  717                                 if(!$this->in_media_object)
 
  719                                         if (($this->coType != 
"tst") and ($this->coType != 
"qpl"))
 
  722                                                 if ($this->current_object->getType() == 
"st" ||
 
  723                                                         $this->current_object->getType() == 
"pg")
 
  726                                                         if ($this->current_object->getType() == 
"pg")
 
  728                                                                 $this->lm_page_object->create(
true);
 
  730                                                         $this->md =& 
new ilMD($this->content_object->getId() ,
 
  731                                                                 $this->current_object->getId(),
 
  732                                                                 $this->current_object->getType());
 
  735                                                 else if ($this->current_object->getType() == 
"gdf")
 
  737                                                         $this->md =& 
new ilMD($this->glossary_object->getId() ,
 
  738                                                                 $this->current_object->getId(),
 
  739                                                                 $this->current_object->getType());
 
  746                                                                 $this->md =& 
new ilMD($this->current_object->getId() ,
 
  748                                                                         $this->current_object->getType());
 
  755                                                 $this->md =& 
new ilMD($this->content_object->getId() ,
 
  757                                                         $this->current_object->getType()
 
  759                                                 if ($this->md->getGeneral() != 
false)
 
  761                                                         $this->metadata_parsing_disabled = 
true;
 
  772                                 if (!$this->in_meta_meta_data)
 
  774                                         if ($this->in_meta_data && !$this->in_glossary_definition)
 
  776                                                 if (!$this->in_media_object)
 
  778                                                         $this->current_object->setImportId($a_attribs[
"Entry"]);
 
  780                                                 $this->link_targets[$a_attribs[
"Entry"]] = $a_attribs[
"Entry"];
 
  782                                         if ($this->in_file_item)
 
  784                                                 if ($this->file_item_mapping[$a_attribs[
"Entry"]] == 
"")
 
  786                                                         $this->file_item->create();
 
  787                                                         $this->file_item->setImportId($a_attribs[
"Entry"]);
 
  788                                                         $this->file_item_mapping[$a_attribs[
"Entry"]] = $this->file_item->getId();
 
  791                                         if ($this->in_meta_data && $this->in_media_object)
 
  795                                                 $mob_id = $this->mob_mapping[$a_attribs[
"Entry"]];
 
  807                                                         $this->media_object->create(
true, 
false);
 
  808                                                         $this->mob_mapping[$a_attribs[
"Entry"]]
 
  809                                                                 = $this->media_object->getId();
 
  811                                                 $this->media_object->setImportId($a_attribs[
"Entry"]);
 
  812                                                 $this->md =& 
new ilMD(0 ,
 
  813                                                         $this->media_object->getId(),
 
  820                         case "Meta-Metadata":
 
  821                                 $this->in_meta_meta_data = 
true;
 
  826                                 if (is_object($this->page_object))
 
  828                                         $this->page_object->setContainsIntLink(
true);
 
  830                                 if ($this->in_map_area)
 
  834                                         $this->map_area->setTarget($a_attribs[
"Target"]);
 
  835                                         $this->map_area->setType($a_attribs[
"Type"]);
 
  836                                         $this->map_area->setTargetFrame($a_attribs[
"TargetFrame"]);
 
  837                                         if (is_object($this->media_object))
 
  840                                                 $this->media_object->setContainsIntLink(
true);
 
  847                                 if ($this->in_map_area)
 
  850                                         $this->map_area->setHref($a_attribs[
"Href"]);
 
  851                                         $this->map_area->setExtTitle($a_attribs[
"Title"]);
 
  857                                 $this->cur_qid = $a_attribs[
"QRef"];
 
  858                                 $this->page_object->setContainsQuestion(
true);
 
  862                                 $this->loc_type = $a_attribs[
"Type"];
 
  866                                 $this->in_bib_item = 
true;
 
  875                 if(($this->in_page_object || $this->in_glossary_definition)
 
  876                         && !$this->in_meta_data && !$this->in_media_object)
 
  878                         if ($a_name == 
"Definition")
 
  880                                 $app_name = 
"PageObject";
 
  881                                 $app_attribs = array();
 
  886                                 $app_attribs = $a_attribs;
 
  890                         if ($this->in_file_item && $app_name == 
"Identifier")
 
  892                                 $app_attribs[
"Entry"] = 
"il__file_".$this->file_item_mapping[$a_attribs[
"Entry"]];
 
  896                         $this->page_object->appendXMLContent($this->
buildTag(
"start", $app_name, $app_attribs));
 
  901                 if ($this->in_bib_item)   
 
  903                         $this->bib_item->appendXMLContent(
"\n".$this->
buildTag(
"start", $a_name, $a_attribs));
 
  913                         if ($this->in_media_object && $this->media_meta_start)
 
  915                                 $this->media_meta_cache[] =
 
  916                                         array(
"type" => 
"handlerBeginTag", 
"par1" => $a_name, 
"par2" => $a_attribs);
 
  920                                 if ($a_name == 
"Identifier")
 
  922                                         if (!$this->in_media_object)
 
  924                                                 $a_attribs[
"Entry"] = 
"il__".$this->current_object->getType().
 
  925                                                         "_".$this->current_object->getId();
 
  929                                                 $a_attribs[
"Entry"] = 
"il__mob".
 
  930                                                         "_".$this->media_object->getId();
 
  932                                         $a_attribs[
"Catalog"] = 
"ILIAS";
 
  947                 if ($this->content_object->getType() == 
"glo" &&
 
  948                         $this->in_glossary && !$this->in_media_object
 
  949                         && !$this->in_glossary_definition)
 
  972                         if ($this->in_media_object && $this->media_meta_start)
 
  974                                 $this->media_meta_cache[] =
 
  975                                         array(
"type" => 
"handlerEndTag", 
"par1" => $a_name);
 
  985                 if (($this->in_page_object || $this->in_glossary_definition)
 
  986                         && !$this->in_meta_data && !$this->in_media_object)
 
  988                         $app_name = ($a_name == 
"Definition")
 
  991                         $this->page_object->appendXMLContent($this->
buildTag(
"end", $app_name));
 
  995                 if ($this->in_bib_item) 
 
  997                         if($a_name == 
"BibItem")
 
  999                                 $this->bib_item->appendXMLContent(
"\n".$this->
buildTag(
"end", $a_name));
 
 1003                                 $this->bib_item->appendXMLContent($this->
buildTag(
"end", $a_name));
 
 1010                         case "StructureObject":
 
 1012                                 unset($this->structure_objects[count($this->structure_objects) - 1]);
 
 1017                                 $this->in_page_object = 
false;
 
 1018                                 if (($this->coType != 
"tst") and ($this->coType != 
"qpl"))
 
 1020                                         if (!$this->lm_page_object->isAlias())
 
 1023                                                 $this->page_object->updateFromXML();
 
 1024                                                 $this->pg_mapping[$this->lm_page_object->getImportId()]
 
 1025                                                         = $this->lm_page_object->getId();
 
 1028                                                 if ($this->page_object->containsIntLink())
 
 1030                                                         $this->pages_to_parse[
"lm:".$this->page_object->getId()] = 
"lm:".$this->page_object->getId();
 
 1034                                                 if ($this->page_object->needsImportParsing())
 
 1036                                                         $this->pages_to_parse[
"lm:".$this->page_object->getId()] = 
"lm:".$this->page_object->getId();
 
 1040                                                 if ($this->page_object->getContainsQuestion())
 
 1042                                                         $this->pages_to_parse[
"lm:".$this->page_object->getId()] = 
"lm:".$this->page_object->getId();
 
 1049                                         $xml = $this->page_object->getXMLContent();
 
 1050                                         if ($this->cur_qid != 
"")
 
 1052                                                 $ids = $this->qst_mapping[$this->cur_qid];
 
 1053                                                 if ($ids[
"pool"] > 0)
 
 1057                                                         $xmlcontent = str_replace($this->cur_qid,
 
 1058                                                                 "il__qst_".$ids[
"pool"], $xml);
 
 1059                                                         $page->setXMLContent($xmlcontent);
 
 1060                                                         $page->saveMobUsage($xmlcontent);
 
 1061                                                         $page->updateFromXML();
 
 1064                                                 if ($ids[
"test"] > 0)
 
 1068                                                         $xmlcontent = str_replace($this->cur_qid, 
 
 1069                                                                 "il__qst_".$ids[
"test"], $xml);
 
 1070                                                         $page->setXMLContent($xmlcontent);
 
 1071                                                         $page->saveMobUsage($xmlcontent);
 
 1072                                                         $page->updateFromXML();
 
 1079                                 $cnt = count($this->structure_objects);
 
 1082                                         $parent_id = $this->structure_objects[
$cnt - 1]->getId();
 
 1083                                         if ($this->lm_page_object->isAlias())
 
 1085                                                 $this->pg_into_tree[$parent_id][] = array(
"type" => 
"pg_alias", 
"id" => $this->lm_page_object->getOriginId());
 
 1089                                                 $this->pg_into_tree[$parent_id][] = array(
"type" => 
"pg", 
"id" => $this->lm_page_object->getId());
 
 1093                                 unset($this->page_object);
 
 1094                                 unset($this->lm_page_object);
 
 1095                                 unset ($this->container[count($this->container) - 1]);
 
 1099                                 $this->in_media_object = 
false;
 
 1104                                 if(empty($this->mob_mapping[$this->media_object->getImportId()]))
 
 1111                                         $this->media_object->create(
true, 
false);
 
 1116                                         if ($this->media_object->containsIntLink())
 
 1119                                                 $this->mobs_with_int_links[] = $this->media_object->getId();
 
 1122                                         $this->mob_mapping[$this->media_object->getImportId()]
 
 1123                                                         = $this->media_object->getId();
 
 1130                                         $this->media_object->setId($this->mob_mapping[$this->media_object->getImportId()]);
 
 1137                                         if (!$this->media_object->isAlias())
 
 1140                                                 $this->media_object->update();
 
 1145                                                 if ($this->media_object->containsIntLink())
 
 1148                                                         $this->mobs_with_int_links[] = $this->media_object->getId();
 
 1154                                 if ($this->in_page_object || $this->in_glossary_definition)
 
 1156                                         $this->page_object->appendXMLContent($this->media_object->getXML(
IL_MODE_ALIAS));
 
 1163                         case "MediaAliasItem":
 
 1164                                 $this->in_media_item = 
false;
 
 1165                                 $this->media_object->addMediaItem($this->media_item);
 
 1170                                 $this->in_map_area = 
false;
 
 1171                                 $this->media_item->addMapArea($this->map_area);
 
 1175                                 $this->in_properties = 
false;
 
 1176                                 if ($this->content_object->getType() == 
"lm" 
 1177                                         || $this->content_object->getType() == 
"dbk")
 
 1179                                         $this->content_object->update();
 
 1184                                 $this->in_meta_data = 
false;
 
 1185                                 if(strtolower(get_class($this->current_object)) == 
"illmpageobject" && !$this->in_media_object)
 
 1188                                         if (is_object($this->lm_page_object))
 
 1191                                                 $this->current_object->MDUpdateListener(
'General');
 
 1193                                                         $this->current_object->getImportId());
 
 1196                                 else if((strtolower(get_class($this->current_object)) == 
"ilobjquestionpool" ||
 
 1197                                         strtolower(get_class($this->current_object)) == 
"ilobjtest") &&
 
 1203                                         if ($this->metadata_parsing_disabled)
 
 1209                                                 if ($this->in_page_object)
 
 1211                                                         $this->page_object->MDUpdateListener(
'General');
 
 1213                                                                         $this->page_object->getImportId());
 
 1217                                                         $this->current_object->MDUpdateListener(
'General');
 
 1219                                                                         $this->current_object->getImportId());
 
 1223                                 else if(strtolower(get_class($this->current_object)) == 
"ilstructureobject")
 
 1226                                         $cnt = count($this->structure_objects);
 
 1229                                                 $parent_id = $this->structure_objects[
$cnt - 2]->getId();
 
 1233                                                 $parent_id = $this->lm_tree->getRootId();
 
 1238                                         $this->st_into_tree[] = array (
"id" => $this->current_object->getId(),
 
 1239                                                 "parent" => $parent_id);
 
 1242                                         $this->current_object->MDUpdateListener(
'General');
 
 1244                                                         $this->current_object->getImportId());
 
 1246                                 else if(strtolower(get_class($this->current_object)) == 
"ilobjdlbook" || strtolower(get_class($this->current_object)) == 
"ilobjlearningmodule" ||
 
 1247                                         strtolower(get_class($this->current_object)) == 
"ilobjcontentobject" ||
 
 1248                                         (strtolower(get_class($this->current_object)) == 
"ilobjglossary" && 
$this->in_glossary))
 
 1253                                 else if(strtolower(get_class($this->current_object)) == 
"ilglossarydefinition" && !$this->in_media_object)
 
 1258                                         $this->page_object->setId($this->glossary_definition->getId());
 
 1259                                         $this->page_object->updateFromXML();
 
 1266                                 if(strtolower(get_class($this->current_object)) == 
"ilobjlearningmodule" ||
 
 1267                                         strtolower(get_class($this->current_object)) == 
"ilobjdlbook" ||
 
 1268                                         strtolower(get_class($this->current_object)) == 
"ilobjglossary")
 
 1270                                         if (strtolower(get_class($this->current_object)) == 
"ilobjglossary" &&
 
 1271                                                 $this->content_object->getType() != 
"glo")
 
 1274                                                 $this->current_object->setTitle($this->content_object->getTitle().
" - ".
 
 1275                                                         $this->lng->txt(
"glossary"));
 
 1278                                         $this->current_object->MDUpdateListener(
'General');
 
 1287                                 if ($this->in_media_object)
 
 1290                                         $this->media_object->MDUpdateListener(
'General');
 
 1293                                 if ($this->in_glossary_definition)
 
 1295                                         $this->glossary_definition->MDUpdateListener(
'General');
 
 1300                         case "Meta-Metadata":
 
 1301                                 $this->in_meta_meta_data = 
false;
 
 1305                                 $this->in_file_item = 
false;
 
 1307                                 if ($this->file_item->getImportId($a_attribs[
"Entry"] != 
""))
 
 1309                                         $this->file_item->update();
 
 1313                         case "Bibliography":
 
 1315                                 $this->in_bib_item = 
false;
 
 1318                                 $nested->import($this->bib_item->getXMLContent(),$this->content_object->getId(),
"bib");
 
 1322                                 unset ($this->container[count($this->container) - 1]);
 
 1326                                 $this->in_glossary = 
false;
 
 1329                         case "GlossaryTerm":
 
 1330                                 $this->glossary_term->setTerm(trim($this->chr_data));
 
 1331                                 $this->glossary_term->create();
 
 1335                                 $this->inside_code = 
false;
 
 1339                                 $this->in_glossary_definition = 
false;
 
 1340                                 $this->page_object->updateFromXML();
 
 1341                                 $this->page_object->buildDom();
 
 1342                                 $this->glossary_definition->setShortText($this->page_object->getFirstParagraphText());
 
 1343                                 $this->glossary_definition->update();
 
 1346                                 if ($this->page_object->containsIntLink())
 
 1349                                         $this->pages_to_parse[
"gdf:".$this->page_object->getId()] = 
"gdf:".$this->page_object->getId();
 
 1351                                 if ($this->page_object->needsImportParsing())
 
 1353                                         $this->pages_to_parse[
"gdf:".$this->page_object->getId()] = 
"gdf:".$this->page_object->getId();
 
 1358                                 if ($this->in_media_item)
 
 1360                                         $this->media_item->setFormat(trim($this->chr_data));
 
 1362                                 if ($this->in_file_item)
 
 1364                                         $this->file_item->setFileType(trim($this->chr_data));
 
 1369                                 if (!$this->in_media_object)
 
 1371                                         $this->current_object->setTitle(trim($this->chr_data));
 
 1376                                         $this->media_object->setTitle(trim($this->chr_data));
 
 1388                                 if (is_object($this->bib_item))
 
 1390                                         $this->bib_item->setLanguage(trim($this->chr_data));
 
 1399                                 if ($this->in_media_object)
 
 1401                                         $this->media_item->setCaption(trim($this->chr_data));
 
 1405                         case "TextRepresentation":
 
 1406                                 if ($this->in_media_object)
 
 1408                                         $this->media_item->setTextRepresentation(trim($this->chr_data));
 
 1415                                 if ($this->in_media_item)
 
 1417                                         $this->media_item->setLocationType($this->loc_type);
 
 1418                                         if ($this->loc_type == 
"Reference")
 
 1420                                                 $this->media_item->setLocation(str_replace(
"&", 
"&", trim($this->chr_data)));
 
 1424                                                 $this->media_item->setLocation(trim($this->chr_data));
 
 1428                                 if ($this->in_file_item)
 
 1431                                         $this->file_item->setFileName(trim($this->chr_data));
 
 1435                                         if ($this->file_item->getType() == 
"file" &&
 
 1436                                                 is_int(strpos($this->chr_data, 
"&")) &&
 
 1437                                                 is_int(strpos($this->chr_data, 
";")))
 
 1439                                                 $imp_dir = $this->content_object->getImportDirectory();
 
 1440                                                 $source_dir = $imp_dir.
"/".$this->subdir.
"/objects/".
 
 1441                                                         $this->file_item->getImportId();
 
 1444                                                 if (
$dir = opendir($source_dir))
 
 1446                                                    while (
false !== (
$file = readdir(
$dir)))
 
 1450                                                                    $this->file_item->setFileName(
$file);
 
 1458                                         $this->file_item->setTitle(trim($this->chr_data));
 
 1464                 $this->chr_data = 
"";
 
 1481                         if ($this->in_media_object && $this->media_meta_start)
 
 1483                                 $this->media_meta_cache[] =
 
 1484                                         array(
"type" => 
"handlerCharacterData", 
"par1" => $a_data);
 
 1496                 $a_data = str_replace(
"<",
"<",$a_data);
 
 1497                 $a_data = str_replace(
">",
">",$a_data);
 
 1501                 $a_data = preg_replace(
"/\n/",
"",$a_data);
 
 1502                 if (!$this->inside_code)
 
 1504                         $a_data = preg_replace(
"/\t+/",
"",$a_data);
 
 1507                 $this->chr_data .= $a_data;
 
 1509                 if(!empty($a_data) || $a_data === 
"0")
 
 1513                         if (($this->in_page_object || $this->in_glossary_definition)
 
 1514                                 && !$this->in_meta_data && !$this->in_media_object)
 
 1516                                 $this->page_object->appendXMLContent($a_data);
 
 1519                         if ($this->in_meta_data)
 
 1525                         if ($this->in_bib_item  )
 
 1527                                 $this->bib_item->appendXMLContent($a_data);
 
 1535                                         if($this->in_map_area)
 
 1537                                                 $this->map_area->appendTitle($a_data);
 
 1553                 foreach ($this->media_meta_cache as $cache_entry)
 
 1555                         switch($cache_entry[
"type"])
 
 1557                                 case "handlerBeginTag": 
 
 1559                                                 $cache_entry[
"par1"], $cache_entry[
"par2"]);
 
 1562                                 case "handlerEndTag":
 
 1564                                                 $cache_entry[
"par1"]);
 
 1567                                 case "handlerCharacterData":
 
 1569                                                 $cache_entry[
"par1"]);
 
 1574                 $this->media_meta_start = 
false;
 
 1575                 $this->media_meta_cache[] = array();