4 define(
"IL_INSERT_BEFORE", 0);
 
    5 define(
"IL_INSERT_AFTER", 1);
 
    6 define(
"IL_INSERT_CHILD", 2);
 
    8 define (
"IL_CHAPTER_TITLE", 
"st_title");
 
    9 define (
"IL_PAGE_TITLE", 
"pg_title");
 
   10 define (
"IL_NO_HEADER", 
"none");
 
   52         function ilPageObject($a_parent_type, $a_id = 0, $a_old_nr = 0, $a_halt = 
true)
 
   56                 require_once(
"./Services/COPage/syntax_highlight/php/Beautifier/Init.php");
 
   57                 require_once(
"./Services/COPage/syntax_highlight/php/Output/Output_css.php");
 
   59                 $this->parent_type = $a_parent_type;
 
   63                 $this->contains_int_link = 
false;
 
   64                 $this->needs_parsing = 
false;
 
   65                 $this->update_listeners = array();
 
   66                 $this->update_listener_cnt = 0;
 
   67                 $this->dom_builded = 
false;
 
   68                 $this->halt_on_error = $a_halt;
 
   69                 $this->page_not_found = 
false;
 
   70                 $this->old_nr = $a_old_nr;
 
   71                 $this->layout_mode = 
false;
 
   72                 $this->encoding = 
"UTF-8";              
 
   74                         array(
"PageContent", 
"TableRow", 
"TableData", 
"ListItem", 
"FileItem",
 
   75                                 "Section", 
"Tab", 
"ContentPopup");
 
   87                 $this->halt_on_error = $a_halt;
 
   97                 $this->rendermd5 = $a_rendermd5;
 
  107                 return $this->rendermd5;
 
  117                 $this->renderedcontent = $a_renderedcontent;
 
  127                 return $this->renderedcontent;
 
  137                 $this->renderedtime = $a_renderedtime;
 
  147                 return $this->renderedtime;
 
  157                 $this->lastchange = $a_lastchange;
 
  167                 return $this->lastchange;
 
  177                 $this->layout_mode = $a_layout_mode;
 
  197                 $this->last_change_user = $a_val;
 
  207                 return $this->last_change_user;
 
  217                 $this->show_page_act_info = $a_val;
 
  227                 return $this->show_page_act_info;
 
  237                 $ilBench->start(
"ContentPresentation", 
"ilPageObject_read");
 
  240                 if ($this->old_nr == 0)
 
  242                         $query = 
"SELECT * FROM page_object WHERE page_id = ".$ilDB->quote($this->
id, 
"integer").
" ".
 
  243                                 "AND parent_type=".$ilDB->quote($this->
getParentType(), 
"text");
 
  244                         $pg_set = $this->ilias->db->query(
$query);
 
  245                         $this->page_record = $ilDB->fetchAssoc($pg_set);
 
  246                         $this->
setActive($this->page_record[
"active"]);
 
  253                         $query = 
"SELECT * FROM page_history WHERE ".
 
  254                                 "page_id = ".$ilDB->quote($this->
id, 
"integer").
" ".
 
  255                                 "AND parent_type=".$ilDB->quote($this->
getParentType(), 
"text").
 
  256                                 " AND nr = ".$ilDB->quote((
int) $this->old_nr, 
"integer");
 
  257                         $pg_set = $ilDB->query(
$query);
 
  258                         $this->page_record = $ilDB->fetchAssoc($pg_set);
 
  260                 if (!$this->page_record)
 
  262                         if ($this->halt_on_error)
 
  264                                 include_once(
"./Services/COPage/exceptions/class.ilCOPageNotFoundException.php");
 
  272                                 $this->page_not_found = 
true;
 
  276                 $this->xml = $this->page_record[
"content"];
 
  277                 $this->
setParentId($this->page_record[
"parent_id"]);
 
  278                 $this->last_change_user = $this->page_record[
"last_change_user"];
 
  279                 $this->create_user = $this->page_record[
"create_user"];
 
  285                 $ilBench->stop(
"ContentPresentation", 
"ilPageObject_read");
 
  294         static function _exists($a_parent_type, $a_id)
 
  297                 if (isset(self::$exists[$a_parent_type.
":".$a_id]))
 
  299                         return self::$exists[$a_parent_type.
":".$a_id];
 
  302                 $query = 
"SELECT page_id FROM page_object WHERE page_id = ".$ilDB->quote($a_id, 
"integer").
" ".
 
  303                         "AND parent_type= ".$ilDB->quote($a_parent_type, 
"text");
 
  304                 $set = $ilDB->query(
$query);
 
  305                 if (
$row = $ilDB->fetchAssoc($set))
 
  307                         self::$exists[$a_parent_type.
":".$a_id] = 
true;
 
  312                         self::$exists[$a_parent_type.
":".$a_id] = 
false;
 
  327                 $query = 
"SELECT page_id, is_empty FROM page_object WHERE page_id = ".$ilDB->quote($a_id, 
"integer").
" ".
 
  328                         "AND parent_type= ".$ilDB->quote($a_parent_type, 
"text");
 
  330                 $set = $ilDB->query(
$query);
 
  331                 if (
$row = $ilDB->fetchAssoc($set))
 
  333                         if (
$row[
"is_empty"] != 1)
 
  345                 if ($this->dom_builded && !$a_force)
 
  352                 $ilBench->start(
"ContentPresentation", 
"ilPageObject_buildDom");
 
  354                 $ilBench->stop(
"ContentPresentation", 
"ilPageObject_buildDom");
 
  357                 $path = 
"//PageObject";
 
  359                 if (count(
$res->nodeset) == 1)
 
  361                         $this->node =& 
$res->nodeset[0];
 
  366                         $this->dom_builded = 
true;
 
  401                 $this->parent_id = $a_id;
 
  411                 $this->parent_type = $a_type;
 
  422                 $this->update_listeners[$cnt][
"object"] =& $a_object;
 
  423                 $this->update_listeners[$cnt][
"method"] = $a_method;
 
  424                 $this->update_listeners[$cnt][
"parameters"] = $a_parameters;
 
  425                 $this->update_listener_cnt++;
 
  432                         $object =& $this->update_listeners[$i][
"object"];
 
  433                         $method = $this->update_listeners[$i][
"method"];
 
  434                         $parameters = $this->update_listeners[$i][
"parameters"];
 
  435                         $object->$method($parameters);
 
  446                 $this->active = $a_active;
 
  454         function getActive($a_check_scheduled_activation = 
false)
 
  456                 if ($a_check_scheduled_activation && !$this->active)
 
  458                         include_once(
"./Services/Calendar/classes/class.ilDateTime.php");
 
  467                 return $this->active;
 
  473         function _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation = 
false)
 
  477                 $set = $ilDB->queryF(
"SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s".
 
  478                         " AND parent_type = %s",
 
  479                                 array(
"integer", 
"text"),
 
  480                                 array($a_id, $a_parent_type));
 
  481                 $rec = $ilDB->fetchAssoc($set);
 
  484                 if (!$rec[
"active"] && $a_check_scheduled_activation)
 
  486                         if ($rec[
"n"] >= $rec[
"activation_start"] &&
 
  487                                 $rec[
"n"] <= $rec[
"activation_end"])
 
  493                 return $rec[
"active"];
 
  503                 $set = $ilDB->queryF(
"SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s".
 
  504                         " AND parent_type = %s", array(
"integer", 
"text"),
 
  505                         array($a_id, $a_parent_type));
 
  506                 $rec = $ilDB->fetchAssoc($set);
 
  508                 if (!$rec[
"active"] && $rec[
"activation_start"] != 
"")
 
  519         function _writeActive($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation = 
true)
 
  523                 if ($a_reset_scheduled_activation)
 
  525                         $st = $ilDB->manipulateF(
"UPDATE page_object SET active = %s, activation_start = %s, ".
 
  526                                 " activation_end = %s WHERE page_id = %s".
 
  527                                 " AND parent_type = %s", array(
"boolean", 
"timestamp", 
"timestamp", 
"integer", 
"text"),
 
  528                                 array($a_active, null, null, $a_id, $a_parent_type));
 
  532                         $st = $ilDB->prepareManip(
"UPDATE page_object SET active = %s WHERE page_id = %s".
 
  533                                 " AND parent_type = %s", array(
"boolean", 
"integer", 
"text"),
 
  534                                 array($a_active, $a_id, $a_parent_type));
 
  545                 $set = $ilDB->queryF(
"SELECT active, activation_start, activation_end, show_activation_info FROM page_object WHERE page_id = %s".
 
  546                         " AND parent_type = %s",
 
  547                                 array(
"integer", 
"text"),
 
  548                                 array($a_id, $a_parent_type));
 
  549                 $rec = $ilDB->fetchAssoc($set);
 
  562                 $res = $ilDB->query(
"SELECT parent_id FROM page_object WHERE page_id = ".$ilDB->quote($a_id, 
"integer").
" ".
 
  563                                 "AND parent_type=".$ilDB->quote($a_type, 
"text"));
 
  564                 $rec = $ilDB->fetchAssoc(
$res);
 
  565                 return $rec[
"parent_id"];
 
  575                 $st = $ilDB->manipulateF(
"UPDATE page_object SET parent_id = %s WHERE page_id = %s".
 
  576                         " AND parent_type = %s", array(
"integer", 
"integer", 
"text"),
 
  577                         array($a_par_id, $a_pg_id, $a_parent_type));
 
  587                 $this->activationstart = $a_activationstart;
 
  597                 return $this->activationstart;
 
  607                 $this->activationend = $a_activationend;
 
  617                 return $this->activationend;
 
  635                 if (!is_object($cont_node))
 
  639                 switch($cont_node->node_name())
 
  642                                 $child_node =& $cont_node->first_child();
 
  644                                 switch($child_node->node_name())
 
  647                                                 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
 
  649                                                 $par->setNode($cont_node);
 
  650                                                 $par->setHierId($a_hier_id);
 
  651                                                 $par->setPcId($a_pc_id);
 
  655                                                 if ($child_node->get_attribute(
"DataTable") == 
"y")
 
  657                                                         require_once(
"./Services/COPage/classes/class.ilPCDataTable.php");
 
  659                                                         $tab->setNode($cont_node);
 
  660                                                         $tab->setHierId($a_hier_id);
 
  664                                                         require_once(
"./Services/COPage/classes/class.ilPCTable.php");
 
  666                                                         $tab->setNode($cont_node);
 
  667                                                         $tab->setHierId($a_hier_id);
 
  669                                                 $tab->setPcId($a_pc_id);
 
  673 if (
$_GET[
"pgEdMediaMode"] != 
"") {echo 
"ilPageObject::error media"; 
exit;}
 
  676                                                 require_once(
"./Services/COPage/classes/class.ilPCMediaObject.php");
 
  678                                                 $mal_node =& $child_node->first_child();
 
  680                                                 $id_arr = explode(
"_", $mal_node->get_attribute(
"OriginId"));
 
  681                                                 $mob_id = $id_arr[count($id_arr) - 1];
 
  691                                                 $mob->readMediaObject($mob_id);
 
  694                                                 $mob->setNode($cont_node);
 
  695                                                 $mob->setHierId($a_hier_id);
 
  696                                                 $mob->setPcId($a_pc_id);
 
  700                                                 require_once(
"./Services/COPage/classes/class.ilPCList.php");
 
  702                                                 $list->setNode($cont_node);
 
  703                                                 $list->setHierId($a_hier_id);
 
  704                                                 $list->setPcId($a_pc_id);
 
  708                                                 require_once(
"./Services/COPage/classes/class.ilPCFileList.php");
 
  710                                                 $file_list->setNode($cont_node);
 
  711                                                 $file_list->setHierId($a_hier_id);
 
  712                                                 $file_list->setPcId($a_pc_id);
 
  717                                                 require_once(
"./Services/COPage/classes/class.ilPCQuestion.php");
 
  719                                                 $pc_question->setNode($cont_node);
 
  720                                                 $pc_question->setHierId($a_hier_id);
 
  721                                                 $pc_question->setPcId($a_pc_id);
 
  725                                                 require_once(
"./Services/COPage/classes/class.ilPCSection.php");
 
  727                                                 $sec->setNode($cont_node);
 
  728                                                 $sec->setHierId($a_hier_id);
 
  729                                                 $sec->setPcId($a_pc_id);
 
  733                                                 require_once(
"./Services/COPage/classes/class.ilPCResources.php");
 
  735                                                 $res->setNode($cont_node);
 
  736                                                 $res->setHierId($a_hier_id);
 
  737                                                 $res->setPcId($a_pc_id);
 
  740                                         case 'LoginPageElement':
 
  741                                                 include_once 
'./Services/COPage/classes/class.ilPCLoginPageElements.php';
 
  743                                                 $res->setNode($cont_node);
 
  744                                                 $res->setHierId($a_hier_id);
 
  745                                                 $res->setPcId($a_pcid);
 
  749                                                 require_once(
"./Services/COPage/classes/class.ilPCMap.php");
 
  750                                                 $map = 
new ilPCMap($this->dom);
 
  751                                                 $map->setNode($cont_node);
 
  752                                                 $map->setHierId($a_hier_id);
 
  753                                                 $map->setPcId($a_pc_id);
 
  757                                                 require_once(
"./Services/COPage/classes/class.ilPCTabs.php");
 
  759                                                 $map->setNode($cont_node);
 
  760                                                 $map->setHierId($a_hier_id);
 
  761                                                 $map->setPcId($a_pc_id);
 
  765                                                 require_once(
"./Services/COPage/classes/class.ilPCPlugged.php");
 
  767                                                 $plugged->setNode($cont_node);
 
  768                                                 $plugged->setHierId($a_hier_id);
 
  769                                                 $plugged->setPcId($a_pc_id);
 
  774                                                 require_once(
"./Services/COPage/classes/class.ilPCPlaceHolder.php");
 
  776                                                 $placeholder->setNode($cont_node);
 
  777                                                 $placeholder->setHierId($a_hier_id);
 
  778                                                 $placeholder->setPcId($a_pc_id);
 
  781                                         case "ContentInclude":
 
  782                                                 require_once(
"./Services/COPage/classes/class.ilPCContentInclude.php");
 
  784                                                 $inc->setNode($cont_node);
 
  785                                                 $inc->setHierId($a_hier_id);
 
  786                                                 $inc->setPcId($a_pc_id);
 
  789                                         case "InteractiveImage":
 
  790                                                 require_once(
"./Services/COPage/classes/class.ilPCInteractiveImage.php");
 
  792                                                 $iim->setNode($cont_node);
 
  793                                                 $iim->setHierId($a_hier_id);
 
  794                                                 $iim->setPcId($a_pc_id);
 
  798                                                 require_once(
"./Services/COPage/classes/class.ilPCProfile.php");
 
  800                                                 $prof->setNode($cont_node);
 
  801                                                 $prof->setHierId($a_hier_id);
 
  802                                                 $prof->setPcId($a_pc_id);
 
  806                                                 require_once(
"./Services/COPage/classes/class.ilPCVerification.php");
 
  808                                                 $vrfc->setNode($cont_node);
 
  809                                                 $vrfc->setHierId($a_hier_id);
 
  810                                                 $vrfc->setPcId($a_pc_id);
 
  814                                                 require_once(
"./Services/COPage/classes/class.ilPCBlog.php");
 
  816                                                 $blog->setNode($cont_node);
 
  817                                                 $blog->setHierId($a_hier_id);
 
  818                                                 $blog->setPcId($a_pc_id);
 
  821                                         case "QuestionOverview":
 
  822                                                 require_once(
"./Services/COPage/classes/class.ilPCQuestionOverview.php");
 
  824                                                 $qover->setNode($cont_node);
 
  825                                                 $qover->setHierId($a_hier_id);
 
  826                                                 $qover->setPcId($a_pc_id);
 
  830                                                 require_once(
"./Services/COPage/classes/class.ilPCSkills.php");
 
  832                                                 $skill->setNode($cont_node);
 
  833                                                 $skill->setHierId($a_hier_id);
 
  834                                                 $skill->setPcId($a_pc_id);
 
  840                                 require_once(
"./Services/COPage/classes/class.ilPCTableData.php");
 
  842                                 $td->setNode($cont_node);
 
  843                                 $td->setHierId($a_hier_id);
 
  847                                 require_once(
"./Services/COPage/classes/class.ilPCListItem.php");
 
  849                                 $td->setNode($cont_node);
 
  850                                 $td->setHierId($a_hier_id);
 
  854                                 require_once(
"./Services/COPage/classes/class.ilPCFileItem.php");
 
  856                                 $file_item->setNode($cont_node);
 
  857                                 $file_item->setHierId($a_hier_id);
 
  879                 if($a_hier_id == 
"pg")
 
  888                                 $path = 
"//*[@PCID = '$a_pc_id']";
 
  890                                 if (count(
$res->nodeset) == 1)
 
  892                                         $cont_node =& 
$res->nodeset[0];
 
  898                         $path = 
"//*[@HierId = '$a_hier_id']";
 
  900                         if (count(
$res->nodeset) == 1)
 
  902                                 $cont_node =& 
$res->nodeset[0];
 
  920                         $path = 
"//*[@PCID = '$a_pc_id']//".$a_content_tag;
 
  922                         if (count(
$res->nodeset) > 0)
 
  929                 $path = 
"//*[@HierId = '$a_hier_id']//".$a_content_tag;
 
  931                 if (count(
$res->nodeset) > 0)
 
  942                 $path = 
"//*[@HierId = '$a_hier_id']";
 
  944                 if (count(
$res->nodeset) == 1)
 
  967                 $this->encoding = $a_encoding;
 
  993                         $enc_str = (!empty($this->encoding))
 
  994                                 ? 
"encoding=\"".$this->encoding.
"\"" 
  996                         return "<?xml version=\"1.0\" $enc_str ?>".
 
  997                 "<!DOCTYPE PageObject SYSTEM \"".ILIAS_ABSOLUTE_PATH.
"/xml/".$this->cur_dtd.
"\">".
 
 1012                 $xml = $this->getXmlContent();
 
 1020                 $xml = $temp_dom->dump_mem(0, $this->encoding);
 
 1021                 $xml = eregi_replace(
"<\?xml[^>]*>",
"",
$xml);
 
 1022                 $xml = eregi_replace(
"<!DOCTYPE[^>]*>",
"",
$xml);
 
 1037                 $a_clone_mobs = 
false)
 
 1066                 $path = 
"//InteractiveImage/MediaAlias";
 
 1071                 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
 
 1072                 for ($i = 0; $i < count (
$res->nodeset); $i++)
 
 1074                         $or_id = 
$res->nodeset[$i]->get_attribute(
"OriginId");
 
 1079                         if (!($inst_id > 0))
 
 1083                                         include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 1088                                         $new_mob = $media_object->duplicate();
 
 1090                                         $res->nodeset[$i]->set_attribute(
"OriginId", 
"il__mob_".$new_mob->getId());
 
 1102                 $path = 
"//MediaObject/MediaAlias";
 
 1107                 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
 
 1108                 for ($i = 0; $i < count (
$res->nodeset); $i++)
 
 1110                         $or_id = 
$res->nodeset[$i]->get_attribute(
"OriginId");
 
 1115                         if (!($inst_id > 0))
 
 1119                                         include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 1124                                         $new_mob = $media_object->duplicate();
 
 1126                                         $res->nodeset[$i]->set_attribute(
"OriginId", 
"il__mob_".$new_mob->getId());
 
 1139                 $path = 
"//Question";
 
 1144                 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
 
 1145                 for ($i = 0; $i < count (
$res->nodeset); $i++)
 
 1147                         $qref = 
$res->nodeset[$i]->get_attribute(
"QRef");
 
 1152                         if (!($inst_id > 0))
 
 1156                                         include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 1163                                                 $question->createPageObject();
 
 1168                                         $duplicate_id = $question->duplicate(
false);
 
 1169                                         $res->nodeset[$i]->set_attribute(
"QRef", 
"il__qst_".$duplicate_id);
 
 1184                 $path = 
"//Question";
 
 1187                 for ($i = 0; $i < count (
$res->nodeset); $i++)
 
 1189                         $parent_node = 
$res->nodeset[$i]->parent_node();
 
 1190                         $parent_node->unlink_node($parent_node);
 
 1204                 $path = 
"//PageContent";
 
 1207                 return count (
$res->nodeset);
 
 1214         function getXMLFromDom($a_incl_head = 
false, $a_append_mobs = 
false, $a_append_bib = 
false,
 
 1215                 $a_append_str = 
"", $a_omit_pageobject_tag = 
false)
 
 1220                         return $this->dom->dump_mem(0, $this->encoding);
 
 1225                         if ($a_append_mobs || $a_append_bib || $a_append_link_info)
 
 1238                                 return "<dummy>".$this->dom->dump_node($this->node).$mobs.$bibs.$trans.$a_append_str.
"</dummy>";
 
 1242                                 if (is_object($this->dom))
 
 1244                                         if ($a_omit_pageobject_tag)
 
 1247                                                 $childs =& $this->node->child_nodes();
 
 1248                                                 for($i = 0; $i < count($childs); $i++)
 
 1250                                                         $xml.= $this->dom->dump_node($childs[$i]);
 
 1256                                                 $xml = $this->dom->dump_mem(0, $this->encoding);
 
 1257                                                 $xml = eregi_replace(
"<\?xml[^>]*>",
"",
$xml);
 
 1258                                                 $xml = eregi_replace(
"<!DOCTYPE[^>]*>",
"",
$xml);
 
 1282                 $lang_vars = array(
"ed_insert_par", 
"ed_insert_code",
 
 1283                         "ed_insert_dtable", 
"ed_insert_atable", 
"ed_insert_media", 
"ed_insert_list",
 
 1284                         "ed_insert_filelist", 
"ed_paste_clip", 
"ed_edit", 
"ed_insert_section",
 
 1285                         "ed_edit_prop",
"ed_edit_files", 
"ed_edit_data", 
"ed_delete", 
"ed_moveafter", 
"ed_movebefore",
 
 1286                         "ed_go", 
"ed_new_row_after", 
"ed_new_row_before",
 
 1287                         "ed_new_col_after", 
"ed_new_col_before", 
"ed_delete_col",
 
 1288                         "ed_delete_row", 
"ed_class", 
"ed_width", 
"ed_align_left",
 
 1289                         "ed_align_right", 
"ed_align_center", 
"ed_align_left_float",
 
 1290                         "ed_align_right_float", 
"ed_delete_item", 
"ed_new_item_before",
 
 1291                         "ed_new_item_after", 
"ed_copy_clip", 
"please_select", 
"ed_split_page",
 
 1292                         "ed_item_up", 
"ed_item_down", 
"ed_row_up", 
"ed_row_down",
 
 1293                         "ed_col_left", 
"ed_col_right", 
"ed_split_page_next",
"ed_enable",
 
 1294                         "de_activate", 
"ed_insert_repobj", 
"ed_insert_login_page_element", 
"ed_insert_map", 
"ed_insert_tabs",
 
 1295                         "ed_insert_pcqst", 
"empty_question", 
"ed_paste",
"question_placeh",
"media_placeh",
"text_placeh",
 
 1296                         "ed_insert_plach",
"question_placehl",
"media_placehl",
"text_placehl",
 
 1297                         "pc_flist", 
"pc_par", 
"pc_mob", 
"pc_qst", 
"pc_sec", 
"pc_dtab", 
"pc_tab",
 
 1298                         "pc_code", 
"pc_vacc", 
"pc_hacc", 
"pc_res", 
"pc_map", 
"pc_list", 
"ed_insert_incl", 
"pc_incl",
 
 1299                         "pc_iim", 
"ed_insert_iim", 
"pc_prof", 
"ed_insert_profile", 
"pc_vrfc",
 
 1300                         "ed_insert_verification", 
"pc_blog", 
"ed_insert_blog", 
"ed_edit_multiple", 
"pc_qover", 
"ed_insert_qover",
 
 1301                         "pc_skills", 
"ed_insert_skills", 
"ed_cut", 
"ed_copy");
 
 1303                 foreach ($lang_vars as $lang_var)
 
 1317                 $xml.= 
"<LV name=\"$var\" value=\"".$lng->txt(
"cont_".$var).
"\"/>";
 
 1324                         require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
 
 1326                         $path = 
"//Paragraph[1]";
 
 1328                         if (count(
$res->nodeset) > 0)
 
 1330                                 $cont_node =& 
$res->nodeset[0]->parent_node();
 
 1332                                 $par->setNode($cont_node);
 
 1333                                 return $par->getText();
 
 1348                 if (is_object(
$node))
 
 1350                         $node->set_content($a_content);
 
 1365                 $this->contains_int_link = $a_contains_link;
 
 1380                 if ($a_parse === 
true)
 
 1382                         $this->needs_parsing = 
true;
 
 1384                 if ($a_parse === 
false)
 
 1386                         $this->needs_parsing = 
false;
 
 1398                 $this->contains_question = $a_val;
 
 1408                 return $this->contains_question;
 
 1423         $r = $ilias->db->query(
"SELECT * FROM object_reference WHERE ref_id=".
 
 1424                         $ilDB->quote(
$_GET[
"ref_id"],
'integer'));
 
 1427         include_once(
"./Services/Xml/classes/class.ilNestedSetXML.php");
 
 1429         $bibs_xml = $nested->export(
$row[
"obj_id"], 
"bib");
 
 1444                 $path = 
"//MediaObject/MediaAlias";
 
 1447                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1449                         $id_arr = explode(
"_", 
$res->nodeset[$i]->get_attribute(
"OriginId"));
 
 1450                         $mob_id = $id_arr[count($id_arr) - 1];
 
 1451                         $mob_ids[$mob_id] = $mob_id;
 
 1456                 $path = 
"//InteractiveImage/MediaAlias";
 
 1458                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1460                         $id_arr = explode(
"_", 
$res->nodeset[$i]->get_attribute(
"OriginId"));
 
 1461                         $mob_id = $id_arr[count($id_arr) - 1];
 
 1462                         $mob_ids[$mob_id] = $mob_id;
 
 1467                 $path = 
"//IntLink[@Type = 'MediaObject']";
 
 1470                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1472                         if ((
$res->nodeset[$i]->get_attribute(
"TargetFrame") == 
"") ||
 
 1475                                 $target = 
$res->nodeset[$i]->get_attribute(
"Target");
 
 1476                                 $id_arr = explode(
"_", $target);
 
 1477                                 if (($id_arr[1] == IL_INST_ID) ||
 
 1478                                         (substr($target, 0, 4) == 
"il__"))
 
 1480                                         $mob_id = $id_arr[count($id_arr) - 1];
 
 1483                                                 $mob_ids[$mob_id] = $mob_id;
 
 1500                 $path = 
"//IntLink";
 
 1505                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1508                         if ($a_cnt_multiple)
 
 1510                                 $add = 
":".$cnt_multiple;
 
 1512                         $target = 
$res->nodeset[$i]->get_attribute(
"Target");
 
 1513                         $type = 
$res->nodeset[$i]->get_attribute(
"Type");
 
 1514                         $targetframe = 
$res->nodeset[$i]->get_attribute(
"TargetFrame");
 
 1515                         $anchor = 
$res->nodeset[$i]->get_attribute(
"Anchor");
 
 1516                         $links[$target.
":".$type.
":".$targetframe.
":".$anchor.$add] =
 
 1517                                 array(
"Target" => $target, 
"Type" => $type,
 
 1518                                         "TargetFrame" => $targetframe, 
"Anchor" => $anchor);
 
 1521                         if ($type == 
"MediaObject" && $targetframe == 
"")
 
 1523                                 if (substr($target, 0, 4) ==
"il__")
 
 1525                                         $id_arr = explode(
"_", $target);
 
 1526                                         $id = $id_arr[count($id_arr) - 1];
 
 1529                                         foreach($med_links as $key => $med_link)
 
 1531                                                 $links[$key] = $med_link;
 
 1543                 $path = 
"//MediaAlias";
 
 1546                 require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
 
 1547                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1549                         $oid = 
$res->nodeset[$i]->get_attribute(
"OriginId");
 
 1550                         if (substr($oid, 0, 4) ==
"il__")
 
 1552                                 $id_arr = explode(
"_", $oid);
 
 1553                                 $id = $id_arr[count($id_arr) - 1];
 
 1556                                 foreach($med_links as $key => $med_link)
 
 1558                                         $links[$key] = $med_link;
 
 1578                         $path = 
"//FileItem/Identifier";
 
 1585                         $path = 
"//FileItem/Identifier";
 
 1588                 $file_ids = array();
 
 1589                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1591                         $id_arr = explode(
"_", 
$res->nodeset[$i]->get_attribute(
"Entry"));
 
 1592                         $file_id = $id_arr[count($id_arr) - 1];
 
 1593                         $file_ids[$file_id] = $file_id;
 
 1598                 $path = 
"//IntLink[@Type='File']";
 
 1600                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1602                         $t = 
$res->nodeset[$i]->get_attribute(
"Target");
 
 1603                         if (substr(
$t, 0, 9) == 
"il__dfile")
 
 1605                                 $id_arr = explode(
"_", 
$t);
 
 1606                                 $file_id = $id_arr[count($id_arr) - 1];
 
 1607                                 $file_ids[$file_id] = $file_id;
 
 1624                 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 1625                 foreach($mob_ids as $mob_id => $dummy)
 
 1643                 $path = 
"//MediaObject/MediaAlias[@OriginId='il__mob_$a_mob_id']";
 
 1645                 $mal_node =& 
$res->nodeset[$a_nr - 1];
 
 1646                 $mob_node =& $mal_node->parent_node();
 
 1648                 return $this->dom->dump_node($mob_node);
 
 1661                 libxml_disable_entity_loader(
false);
 
 1663                 $this->dom->validate($error);
 
 1684                 $this->hier_ids = array();
 
 1685                 $this->first_row_ids = array();
 
 1686                 $this->first_col_ids = array();
 
 1687                 $this->list_item_ids = array();
 
 1688                 $this->file_item_ids = array();
 
 1695                 foreach ($this->id_elements as $el)
 
 1697                         $path.= $sep.
"//".$el;
 
 1702                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1704                         $cnode = 
$res->nodeset[$i];
 
 1705                         $ctag = $cnode->node_name();
 
 1709                         while($cnode =& $cnode->previous_sibling())
 
 1711                                 if (($cnode->node_type() == XML_ELEMENT_NODE)
 
 1712                                         && $cnode->has_attribute(
"HierId"))
 
 1714                                         $sib_hier_id = $cnode->get_attribute(
"HierId");
 
 1720                         if ($sib_hier_id != 
"")         
 
 1722                                 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
 
 1724                                 $res->nodeset[$i]->set_attribute(
"HierId", $node_hier_id);
 
 1725                                 $this->hier_ids[] = $node_hier_id;
 
 1726                                 if ($ctag == 
"TableData")
 
 1728                                         if (substr($par_hier_id,strlen($par_hier_id)-2) == 
"_1")
 
 1730                                                 $this->first_row_ids[] = $node_hier_id;
 
 1733                                 if ($ctag == 
"ListItem")
 
 1735                                         $this->list_item_ids[] = $node_hier_id;
 
 1737                                 if ($ctag == 
"FileItem")
 
 1739                                         $this->file_item_ids[] = $node_hier_id;
 
 1745                                 $cnode = 
$res->nodeset[$i];
 
 1747                                 while($cnode =& $cnode->parent_node())
 
 1749                                         if (($cnode->node_type() == XML_ELEMENT_NODE)
 
 1750                                                 && $cnode->has_attribute(
"HierId"))
 
 1752                                                 $par_hier_id = $cnode->get_attribute(
"HierId");
 
 1758                                 if (($par_hier_id != 
"") && ($par_hier_id != 
"pg"))             
 
 1760                                         $node_hier_id = $par_hier_id.
"_1";
 
 1761                                         $res->nodeset[$i]->set_attribute(
"HierId", $node_hier_id);
 
 1762                                         $this->hier_ids[] = $node_hier_id;
 
 1763                                         if ($ctag == 
"TableData")
 
 1765                                                 $this->first_col_ids[] = $node_hier_id;
 
 1766                                                 if (substr($par_hier_id,strlen($par_hier_id)-2) == 
"_1")
 
 1768                                                         $this->first_row_ids[] = $node_hier_id;
 
 1771                                         if ($ctag == 
"ListItem")
 
 1773                                                 $this->list_item_ids[] = $node_hier_id;
 
 1775                                         if ($ctag == 
"FileItem")
 
 1777                                                 $this->file_item_ids[] = $node_hier_id;
 
 1783                                         $node_hier_id = 
"1";
 
 1784                                         $res->nodeset[$i]->set_attribute(
"HierId", $node_hier_id);
 
 1785                                         $this->hier_ids[] = $node_hier_id;
 
 1792                 $path = 
"//PageObject";
 
 1794                 for($i = 0; $i < count(
$res->nodeset); $i++)    
 
 1796                         $res->nodeset[$i]->set_attribute(
"HierId", 
"pg");
 
 1797                         $this->hier_ids[] = 
"pg";
 
 1807                 return $this->hier_ids;
 
 1815                 return $this->first_row_ids;
 
 1823                 return $this->first_col_ids;
 
 1831                 return $this->list_item_ids;
 
 1839                 return $this->file_item_ids;
 
 1847                 if(is_object($this->dom))
 
 1850                         $path = 
"//*[@HierId]";
 
 1852                         for($i = 0; $i < count(
$res->nodeset); $i++)    
 
 1854                                 if (
$res->nodeset[$i]->has_attribute(
"HierId"))
 
 1856                                         $res->nodeset[$i]->remove_attribute(
"HierId");
 
 1868                 if (!is_array($a_pc_ids) || count($a_pc_ids) == 0)
 
 1874                 if(is_object($this->dom))
 
 1877                         $path = 
"//*[@PCID]";
 
 1879                         for($i = 0; $i < count(
$res->nodeset); $i++)    
 
 1881                                 $pc_id = 
$res->nodeset[$i]->get_attribute(
"PCID");
 
 1882                                 if (in_array($pc_id, $a_pc_ids))
 
 1884                                         $ret[$pc_id] = 
$res->nodeset[$i]->get_attribute(
"HierId");
 
 1899                 $path = 
"//FileItem";
 
 1901                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1903                         $cnode =& 
$res->nodeset[$i];
 
 1904                         $size_node =& $this->dom->create_element(
"Size");
 
 1905                         $size_node =& $cnode->append_child($size_node);
 
 1907                         $childs =& $cnode->child_nodes();
 
 1909                         for($j = 0; $j < count($childs); $j++)
 
 1911                                 if ($childs[$j]->node_name() == 
"Identifier")
 
 1913                                         if ($childs[$j]->has_attribute(
"Entry"))
 
 1915                                                 $entry = $childs[$j]->get_attribute(
"Entry");
 
 1916                                                 $entry_arr = explode(
"_", $entry);
 
 1917                                                 $id = $entry_arr[count($entry_arr) - 1];
 
 1918                                                 require_once(
"./Modules/File/classes/class.ilObjFile.php");
 
 1923                         $size_node->set_content(
$size);
 
 1937                 $path = 
"//IntLink";
 
 1939                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1941                         $target = 
$res->nodeset[$i]->get_attribute(
"Target");
 
 1942                         $type = 
$res->nodeset[$i]->get_attribute(
"Type");
 
 1945                         if ($new_target !== 
false)
 
 1947                                 $res->nodeset[$i]->set_attribute(
"Target", $new_target);
 
 1952                                         IL_INST_ID > 0 && $type != 
"RepositoryItem")
 
 1957                                                 $res->nodeset[$i]->set_attribute(
"Target", $new_target);        
 
 1967                 $path = 
"//MediaAlias";
 
 1971                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1973                         $orig_id = 
$res->nodeset[$i]->get_attribute(
"OriginId");
 
 1974                         $id_arr = explode(
"_", $orig_id);
 
 1975                         $mob_id = $id_arr[count($id_arr) - 1];
 
 1990                 $path = 
"//MediaAlias";
 
 1993                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1995                         $old_id = 
$res->nodeset[$i]->get_attribute(
"OriginId");
 
 1996                         $old_id = explode(
"_", $old_id);
 
 1997                         $old_id = $old_id[count($old_id) - 1];
 
 1998                         if ($a_mapping[$old_id] > 0)
 
 2000                                 $res->nodeset[$i]->set_attribute(
"OriginId", 
"il__mob_".$a_mapping[$old_id]);
 
 2019                 $path = 
"//InteractiveImage/MediaAlias";
 
 2022                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 2024                         $old_id = 
$res->nodeset[$i]->get_attribute(
"OriginId");
 
 2025                         if ($a_mapping[$old_id] > 0)
 
 2027                                 $res->nodeset[$i]->set_attribute(
"OriginId", 
"il__mob_".$a_mapping[$old_id]);
 
 2046                 $path = 
"//FileItem/Identifier";
 
 2049                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 2051                         $old_id = 
$res->nodeset[$i]->get_attribute(
"Entry");
 
 2052                         $old_id = explode(
"_", $old_id);
 
 2053                         $old_id = $old_id[count($old_id) - 1];
 
 2054                         if ($a_mapping[$old_id] > 0)
 
 2056                                 $res->nodeset[$i]->set_attribute(
"Entry", 
"il__file_".$a_mapping[$old_id]);
 
 2073                 $path = 
"//Question";
 
 2075                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 2077                         $qref = 
$res->nodeset[$i]->get_attribute(
"QRef");
 
 2079                         if (isset($a_mapping[$qref]))
 
 2081                                 $res->nodeset[$i]->set_attribute(
"QRef", 
"il__qst_".$a_mapping[$qref][
"pool"]);
 
 2102                 $path = 
"//IntLink";
 
 2104                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 2106                         $target = 
$res->nodeset[$i]->get_attribute(
"Target");
 
 2107                         $type = 
$res->nodeset[$i]->get_attribute(
"Type");
 
 2109                         if ($a_from_to[$obj_id] > 0 && is_int(strpos($target, 
"__")))
 
 2113                                         $res->nodeset[$i]->set_attribute(
"Target", 
"il__pg_".$a_from_to[$obj_id]);
 
 2118                                         $res->nodeset[$i]->set_attribute(
"Target", 
"il__st_".$a_from_to[$obj_id]);
 
 2128                 $path = 
"//MediaAlias";
 
 2131                 require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
 
 2132                 require_once(
"Services/COPage/classes/class.ilMediaAliasItem.php");
 
 2134                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 2136                         $media_object_node = 
$res->nodeset[$i]->parent_node();
 
 2137                         $page_content_node = $media_object_node->parent_node();
 
 2138                         $c_hier_id = $page_content_node->get_attribute(
"HierId");
 
 2142                                 $c_hier_id, 
"Standard");
 
 2143                         $areas = $std_alias_item->getMapAreas();
 
 2144                         $correction_needed = 
false;
 
 2145                         if (count($areas) > 0)
 
 2148                                 foreach($areas as $area)
 
 2150                                         if ($area[
"Type"] == 
"PageObject" ||
 
 2151                                                 $area[
"Type"] == 
"StructureObject")
 
 2153                                                 $t = $area[
"Target"];
 
 2154                                                 $tid = _extractObjIdOfTarget(
$t);
 
 2155                                                 if ($a_from_to[$tid] > 0)
 
 2157                                                         $correction_needed = 
true;
 
 2168                                 $oid = 
$res->nodeset[$i]->get_attribute(
"OriginId");
 
 2169                                 if (substr($oid, 0, 4) ==
"il__")
 
 2171                                         $id_arr = explode(
"_", $oid);
 
 2172                                         $id = $id_arr[count($id_arr) - 1];
 
 2175                                         $med_item = $mob->getMediaItem(
"Standard");
 
 2176                                         $med_areas = $med_item->getMapAreas();
 
 2178                                         foreach($med_areas as $area)
 
 2180                                                 $link_type = ($area->getLinkType() == 
"int")
 
 2185                                                         "Nr" => $area->getNr(),
 
 2186                                                         "Shape" => $area->getShape(),
 
 2187                                                         "Coords" => $area->getCoords(),
 
 2189                                                                 "LinkType" => $link_type,
 
 2190                                                                 "Href" => $area->getHref(),
 
 2191                                                                 "Title" => $area->getTitle(),
 
 2192                                                                 "Target" => $area->getTarget(),
 
 2193                                                                 "Type" => $area->getType(),
 
 2194                                                                 "TargetFrame" => $area->getTargetFrame()
 
 2198                                                 if ($area->getType() == 
"PageObject" ||
 
 2199                                                         $area->getType() == 
"StructureObject")
 
 2201                                                         $t = $area->getTarget();
 
 2203                                                         if ($a_from_to[$tid] > 0)
 
 2205                                                                 $correction_needed = 
true;
 
 2214                         if ($correction_needed)
 
 2217                                 $std_alias_item->deleteAllMapAreas();
 
 2218                                 foreach($areas as $area)
 
 2220                                         if ($area[
"Link"][
"LinkType"] == 
"IntLink")
 
 2222                                                 $target = $area[
"Link"][
"Target"];
 
 2223                                                 $type = $area[
"Link"][
"Type"];
 
 2225                                                 if ($a_from_to[$obj_id] > 0)
 
 2229                                                                 $area[
"Link"][
"Target"] = 
"il__pg_".$a_from_to[$obj_id];
 
 2233                                                                 $area[
"Link"][
"Target"] = 
"il__st_".$a_from_to[$obj_id];
 
 2238                                         $std_alias_item->addMapArea($area[
"Shape"], $area[
"Coords"],
 
 2239                                                 $area[
"Link"][
"Title"],
 
 2240                                                 array(  
"Type" => $area[
"Link"][
"Type"],
 
 2241                                                                 "TargetFrame" => $area[
"Link"][
"TargetFrame"],
 
 2242                                                                 "Target" => $area[
"Link"][
"Target"],
 
 2243                                                                 "Href" => $area[
"Link"][
"Href"],
 
 2244                                                                 "LinkType" => $area[
"Link"][
"LinkType"],
 
 2261                 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
 
 2268                 foreach($sources as $source)
 
 2271                         if ($source[
"type"] == 
"lm:pg")
 
 2274                                 $page_obj = 
new ilPageObject(
"lm", $source[
"id"], 
false);
 
 2275                                 if  (!$page_obj->page_not_found)
 
 2278                                         $page_obj->handleImportRepositoryLink($a_rep_import_id,
 
 2279                                                 $a_rep_type, $a_rep_ref_id);
 
 2281                                 $page_obj->update();
 
 2292                 $path = 
"//IntLink";
 
 2295                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 2298                         $target = 
$res->nodeset[$i]->get_attribute(
"Target");
 
 2299                         $type = 
$res->nodeset[$i]->get_attribute(
"Type");
 
 2300                         if ($target == $a_rep_import_id && $type == 
"RepositoryItem")
 
 2303                                 $res->nodeset[$i]->set_attribute(
"Target",
 
 2304                                         "il__".$a_rep_type.
"_".$a_rep_ref_id);
 
 2339                 $ilDB->insert(
"page_object", array(
 
 2340                         "page_id" => array(
"integer", $this->
getId()),
 
 2341                         "parent_id" => array(
"integer", $this->
getParentId()),
 
 2344                         "create_user" => array(
"integer", $ilUser->getId()),
 
 2345                         "last_change_user" => array(
"integer", $ilUser->getId()),
 
 2346                         "active" => array(
"integer", $this->
getActive()),
 
 2347                         "inactive_elements" => array(
"integer", $iel),
 
 2348                         "int_links" => array(
"integer", $inl),
 
 2350                         "last_change" => array(
"timestamp", 
ilUtil::now())
 
 2391                 $ilDB->update(
"page_object", array(
 
 2393                         "parent_id" => array(
"integer", $this->
getParentId()),
 
 2394                         "last_change_user" => array(
"integer", $ilUser->getId()),
 
 2395                         "last_change" => array(
"timestamp", 
ilUtil::now()),
 
 2396                         "active" => array(
"integer", $this->
getActive()),
 
 2399                         "inactive_elements" => array(
"integer", $iel),
 
 2400                         "int_links" => array(
"integer", $inl),
 
 2402                         "page_id" => array(
"integer", $this->
getId()),
 
 2424         function update($a_validate = 
true, $a_no_history = 
false, $skip_handle_usages = 
false)
 
 2457                         $old_set = $ilDB->query(
"SELECT * FROM page_object WHERE ".
 
 2458                                 "page_id = ".$ilDB->quote($this->getId(), 
"integer").
" AND ".
 
 2459                                 "parent_type = ".$ilDB->quote($this->getParentType(), 
"text"));
 
 2460                         $last_nr_set = $ilDB->query(
"SELECT max(nr) as mnr FROM page_history WHERE ".
 
 2461                                 "page_id = ".$ilDB->quote($this->getId(), 
"integer").
" AND ".
 
 2462                                 "parent_type = ".$ilDB->quote($this->getParentType(), 
"text"));
 
 2463                         $last_nr = $ilDB->fetchAssoc($last_nr_set);
 
 2464                         if ($old_rec = $ilDB->fetchAssoc($old_set))
 
 2467                                 if (($content != $old_rec[
"content"]) && !$a_no_history &&
 
 2468                                         !$this->history_saved && !$this->layout_mode &&
 
 2469                                         $lm_set->get(
"page_history", 1))
 
 2471                                         if ($old_rec[
"content"] != 
"<PageObject></PageObject>")
 
 2473                                                 $ilDB->manipulateF(
"DELETE FROM page_history WHERE ".
 
 2474                                                         "page_id = %s AND parent_type = %s AND hdate = %s",
 
 2475                                                         array(
"integer", 
"text", 
"timestamp"),
 
 2476                                                         array($old_rec[
"page_id"], $old_rec[
"parent_type"], $old_rec[
"last_change"]));
 
 2480                                                 $last_c = $old_rec[
"last_change"];
 
 2486                                                 $ilDB->insert(
"page_history", array(
 
 2487                                                         "page_id" =>            array(
"integer", $old_rec[
"page_id"]),
 
 2488                                                         "parent_type" =>        array(
"text", $old_rec[
"parent_type"]),
 
 2489                                                         "hdate" =>                      array(
"timestamp", $last_c),
 
 2490                                                         "parent_id" =>          array(
"integer", $old_rec[
"parent_id"]),
 
 2491                                                         "content" =>            array(
"clob", $old_rec[
"content"]),
 
 2492                                                         "user_id" =>            array(
"integer", $old_rec[
"last_change_user"]),
 
 2494                                                         "nr" =>                         array(
"integer", (
int) $last_nr[
"mnr"] + 1)
 
 2508                                                 $this->
saveMobUsage($old_rec[
"content"], $last_nr[
"mnr"] + 1);
 
 2510                                                 $this->
saveFileUsage($old_rec[
"content"], $last_nr[
"mnr"] + 1);
 
 2513                                                 $this->history_saved = 
true;            
 
 2517                                                 $this->history_saved = 
true;            
 
 2522                         $em = (trim($content) == 
"<PageObject/>")
 
 2542                         $ilDB->update(
"page_object", array(
 
 2543                                 "content" => array(
"clob", $content),
 
 2544                                 "parent_id" => array(
"integer", $this->
getParentId()),
 
 2545                                 "last_change_user" => array(
"integer", $ilUser->getId()),
 
 2546                                 "last_change" => array(
"timestamp", 
ilUtil::now()),
 
 2547                                 "is_empty" => array(
"integer", $em),
 
 2548                                 "active" => array(
"integer", $this->
getActive()),
 
 2552                                 "inactive_elements" => array(
"integer", $iel),
 
 2553                                 "int_links" => array(
"integer", $inl),
 
 2555                                 "page_id" => array(
"integer", $this->
getId()),
 
 2568                         if (!$skip_handle_usages)
 
 2571                                 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 2576                                 foreach($mob_ids as $mob)       
 
 2581                                                 $usages = $mob_obj->getUsages(
false);
 
 2582                                                 if (count($usages) == 0)        
 
 2590                                 include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
 2594                                 foreach($file_ids as 
$file)     
 
 2598                                                 $file_obj = 
new ilObjFile($file, 
false);
 
 2599                                                 $usages = $file_obj->getUsages();
 
 2600                                                 if (count($usages) == 0)        
 
 2602                                                         if ($file_obj->getMode() == 
"filelist")         
 
 2604                                                                 $file_obj->delete();
 
 2642                 if (!$this->page_not_found)
 
 2666                 include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
 2670                 include_once(
"./Services/News/classes/class.ilNewsItem.php");
 
 2675                 $ilDB->manipulate(
"DELETE FROM page_object ".
 
 2676                         "WHERE page_id = ".$ilDB->quote($this->getId(), 
"integer").
 
 2677                         " AND parent_type= ".$ilDB->quote($this->getParentType(), 
"text"));
 
 2681                 foreach (
$mobs as $mob_id)
 
 2685                                 $GLOBALS[
'ilLog']->write(__METHOD__.
': Type mismatch. Ignoring mob with id: '.$mob_id);
 
 2696                 include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
 2697                 foreach ($files as $file_id)
 
 2701                                 $file_obj =& 
new ilObjFile($file_id, 
false);
 
 2702                                 $file_obj->delete();
 
 2735                         $keywords = array();
 
 2741                         for ($i=0; $i < count(
$res->nodeset); $i++)
 
 2743                                 $k =  trim(strip_tags(
$res->nodeset[$i]->get_content()));
 
 2744                                 if (!in_array($k, $keywords))
 
 2754                         $meta_id = $this->
getId();
 
 2756                         include_once(
"./Services/MetaData/classes/class.ilMD.php");
 
 2757                         $md_obj = 
new ilMD($meta_rep_id, $meta_id, $meta_type);
 
 2758                         $mkeywords = array();
 
 2760                         if(is_object($md_section = $md_obj->getGeneral()))
 
 2762                                 foreach($ids = $md_section->getKeywordIds() as 
$id)
 
 2764                                         $md_key = $md_section->getKeyword(
$id);
 
 2765                                         $mkeywords[] = strtolower($md_key->getKeyword());
 
 2768                                                 $lang = $md_key->getKeywordLanguageCode();
 
 2774                                 foreach($ids = $md_section->getLanguageIds() as 
$id)
 
 2776                                         $md_lang = $md_section->getLanguage(
$id);
 
 2779                                                 $lang = $md_lang->getLanguageCode();
 
 2783                         foreach ($keywords as $k)
 
 2785                                 if (!in_array(strtolower($k), $mkeywords))
 
 2787                                         if (trim($k) != 
"" && 
$lang != 
"")
 
 2789                                                 $md_key = $md_section->addKeyword();
 
 2794                                         $mkeywords[] = strtolower($k);
 
 2811                 $path = 
"//MediaAlias";
 
 2814                 for ($i=0; $i < count(
$res->nodeset); $i++)
 
 2816                         $id_arr = explode(
"_", 
$res->nodeset[$i]->get_attribute(
"OriginId"));
 
 2817                         $mob_id = $id_arr[count($id_arr) - 1];
 
 2820                                 $usages[$mob_id] = 
true;
 
 2826                 $path = 
"//MediaObject/MetaData/General/Identifier";
 
 2828                 for ($i=0; $i < count(
$res->nodeset); $i++)
 
 2830                         $mob_entry = 
$res->nodeset[$i]->get_attribute(
"Entry");
 
 2831                         $mob_arr = explode(
"_", $mob_entry);
 
 2832                         $mob_id = $mob_arr[count($mob_arr) - 1];
 
 2835                                 $usages[$mob_id] = 
true;
 
 2841                 $path = 
"//IntLink[@Type='MediaObject']";
 
 2843                 for ($i=0; $i < count(
$res->nodeset); $i++)
 
 2845                         $mob_target = 
$res->nodeset[$i]->get_attribute(
"Target");
 
 2846                         $mob_arr = explode(
"_", $mob_target);
 
 2847                         $mob_id = $mob_arr[count($mob_arr) - 1];
 
 2850                                 $usages[$mob_id] = 
true;
 
 2854                 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 2856                 foreach($usages as $mob_id => $val)
 
 2870                 include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
 2872                 foreach($file_ids as $file_id)
 
 2883                 include_once(
"./Services/COPage/classes/class.ilPageContentUsage.php");
 
 2886                 foreach($ci_ids as $ci_id)
 
 2888                         if ((
int) $ci_id[
"inst_id"] <= 0)
 
 2905                         $path = 
"//ContentInclude";
 
 2912                         $path = 
"//ContentInclude";
 
 2916                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 2918                         $type = 
$res->nodeset[$i]->get_attribute(
"ContentType");
 
 2919                         $id = 
$res->nodeset[$i]->get_attribute(
"ContentId");
 
 2920                         $inst_id = 
$res->nodeset[$i]->get_attribute(
"InstId");
 
 2921                         $ci_ids[$type.
":".
$id.
":".$inst_id] = array(
 
 2922                                 "type" => $type, 
"id" => 
$id, 
"inst_id" => $inst_id);
 
 2933                 include_once(
"./Services/COPage/classes/class.ilPageContentUsage.php");
 
 2936                 foreach($skl_ids as $skl_id)
 
 2938                         if ((
int) $skl_id[
"inst_id"] <= 0)
 
 2966                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 2968                         $user = 
$res->nodeset[$i]->get_attribute(
"User");
 
 2969                         $id = 
$res->nodeset[$i]->get_attribute(
"Id");
 
 2970                         $inst_id = 
$res->nodeset[$i]->get_attribute(
"InstId");
 
 2971                         $skl_ids[$user.
":".
$id.
":".$inst_id] = array(
 
 2972                                 "user" => $user, 
"id" => 
$id, 
"inst_id" => $inst_id);
 
 2992                 $path = 
"//Paragraph | //Section | //MediaAlias | //FileItem".
 
 2993                         " | //Table | //TableData | //Tabs | //List";
 
 2996                 for ($i=0; $i < count(
$res->nodeset); $i++)
 
 2998                         switch (
$res->nodeset[$i]->node_name())
 
 3001                                         $sname = 
$res->nodeset[$i]->get_attribute(
"Characteristic");
 
 3002                                         $stype = 
"text_block";
 
 3007                                         $sname = 
$res->nodeset[$i]->get_attribute(
"Characteristic");
 
 3013                                         $sname = 
$res->nodeset[$i]->get_attribute(
"Class");
 
 3014                                         $stype = 
"media_cont";
 
 3019                                         $sname = 
$res->nodeset[$i]->get_attribute(
"Class");
 
 3020                                         $stype = 
"flist_li";
 
 3025                                         $sname = 
$res->nodeset[$i]->get_attribute(
"Template");
 
 3028                                                 $sname = 
$res->nodeset[$i]->get_attribute(
"Class");
 
 3040                                         $sname = 
$res->nodeset[$i]->get_attribute(
"Class");
 
 3041                                         $stype = 
"table_cell";
 
 3046                                         $sname = 
$res->nodeset[$i]->get_attribute(
"Template");
 
 3049                                                 if (
$res->nodeset[$i]->get_attribute(
"Type") == 
"HorizontalAccordion")
 
 3051                                                         $stype = 
"haccordion";
 
 3053                                                 if (
$res->nodeset[$i]->get_attribute(
"Type") == 
"VerticalAccordion")
 
 3055                                                         $stype = 
"vaccordion";
 
 3062                                         $sname = 
$res->nodeset[$i]->get_attribute(
"Class");
 
 3063                                         if (
$res->nodeset[$i]->get_attribute(
"Type") == 
"Ordered")
 
 3074                         if ($sname != 
"" &&  $stype != 
"")
 
 3076                                 $usages[$sname.
":".$stype.
":".$template] = array(
"sname" => $sname,
 
 3077                                         "stype" => $stype, 
"template" => $template);
 
 3081                 $ilDB->manipulate(
"DELETE FROM page_style_usage WHERE ".
 
 3082                         " page_id = ".$ilDB->quote($this->getId(), 
"integer").
 
 3083                         " AND page_type = ".$ilDB->quote($this->getParentType(), 
"text").
 
 3084                         " AND page_nr = ".$ilDB->quote($a_old_nr, 
"integer")
 
 3087                 foreach ($usages as $u)
 
 3089                         $ilDB->manipulate(
"INSERT INTO page_style_usage ".
 
 3090                                 "(page_id, page_type, page_nr, template, stype, sname) VALUES (".
 
 3091                                 $ilDB->quote($this->getId(), 
"integer").
",".
 
 3092                                 $ilDB->quote($this->getParentType(), 
"text").
",".
 
 3093                                 $ilDB->quote($a_old_nr, 
"integer").
",".
 
 3094                                 $ilDB->quote($u[
"template"], 
"integer").
",".
 
 3095                                 $ilDB->quote($u[
"stype"], 
"text").
",".
 
 3096                                 $ilDB->quote($u[
"sname"], 
"text").
 
 3107                 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 3108                 include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
 3113                 $objs = array_merge(
$mobs, $files);
 
 3130                 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
 
 3135                 $path = 
"//IntLink";
 
 3137                 for ($i=0; $i < count(
$res->nodeset); $i++)
 
 3139                         $link_type = 
$res->nodeset[$i]->get_attribute(
"Type");
 
 3143                                 case "StructureObject":
 
 3151                                 case "GlossaryItem":
 
 3159                                 case "RepositoryItem":
 
 3168                         $target = 
$res->nodeset[$i]->get_attribute(
"Target");
 
 3173                         if (is_int(strpos($target, 
"__")))
 
 3192                 $ilDB->manipulateF(
"DELETE FROM page_question WHERE page_parent_type = %s ".
 
 3193                         " AND page_id = %s", array(
"text", 
"integer"),
 
 3199                 $path = 
"//Question";
 
 3202                 for ($i=0; $i < count(
$res->nodeset); $i++)
 
 3204                         $q_ref = 
$res->nodeset[$i]->get_attribute(
"QRef");
 
 3207                         if (!($inst_id > 0))
 
 3212                                         $q_ids[$q_id] = $q_id;
 
 3216                 foreach($q_ids as $qid)
 
 3218                         $ilDB->manipulateF(
"INSERT INTO page_question (page_parent_type, page_id, question_id)".
 
 3219                                 " VALUES (%s,%s,%s)",
 
 3220                                 array(
"text", 
"integer", 
"integer"),
 
 3232                 $res = $ilDB->queryF(
"SELECT * FROM page_question WHERE page_parent_type = %s ".
 
 3233                         " AND page_id = %s",
 
 3234                         array(
"text", 
"integer"),
 
 3235                         array($a_parent_type, $a_page_id));
 
 3237                 while ($rec = $ilDB->fetchAssoc(
$res))
 
 3239                         $q_ids[] = $rec[
"question_id"];
 
 3261                 for ($i=0; $i < count(
$res->nodeset); $i++)
 
 3263                         $name = 
$res->nodeset[$i]->get_attribute(
"Name");
 
 3264                         if (trim($name) != 
"" && !in_array($name, $saved))
 
 3280                 $st = $ilDB->prepareManip(
"DELETE FROM page_anchor WHERE page_parent_type = ? ".
 
 3281                         " AND page_id = ?", array(
"text", 
"integer"));
 
 3282                 $ilDB->execute($st, array($a_parent_type, $a_page_id));
 
 3288         static function _saveAnchor($a_parent_type, $a_page_id, $a_anchor_name)
 
 3292                 $st = $ilDB->prepareManip(
"INSERT INTO page_anchor (page_parent_type, page_id, anchor_name) ".
 
 3293                         " VALUES (?,?,?) ", array(
"text", 
"integer", 
"text"));
 
 3294                 $ilDB->execute($st, array($a_parent_type, $a_page_id, $a_anchor_name));
 
 3304                 $st = $ilDB->prepare(
"SELECT * FROM page_anchor WHERE page_parent_type = ? ".
 
 3305                         " AND page_id = ?", array(
"text", 
"integer"));
 
 3306                 $set = $ilDB->execute($st, array($a_parent_type, $a_page_id));
 
 3308                 while ($rec = $ilDB->fetchAssoc($set))
 
 3310                         $anchors[] = $rec[
"anchor_name"];
 
 3333                 $curr_node->unlink_node($curr_node);
 
 3350                 if (!is_array($a_hids))
 
 3354                 foreach($a_hids as $a_hid)
 
 3356                         $a_hid = explode(
":", $a_hid);
 
 3360                         if (!$this->
checkForTag(
"Question", $a_hid[0], $a_hid[1]) || $a_self_ass)
 
 3363                                 if (is_object($curr_node))
 
 3365                                         $parent_node = $curr_node->parent_node();
 
 3366                                         if ($parent_node->node_name() != 
"TableRow")
 
 3368                                                 $curr_node->unlink_node($curr_node);
 
 3399                 if (!is_array($a_hids))
 
 3404                 $time = date(
"Y-m-d H:i:s", time());
 
 3406                 $hier_ids = array();
 
 3408                 foreach($a_hids as $a_hid)
 
 3414                         $a_hid = explode(
":", $a_hid);
 
 3418                         foreach($hier_ids as $h)
 
 3420                                 if($h.
"_" == substr($a_hid[0], 0, strlen($h) + 1))
 
 3422                                         $skip[] = $a_hid[0];
 
 3424                                 if($a_hid[0].
"_" == substr($h, 0, strlen($a_hid[0]) + 1))
 
 3429                         $pc_id[$a_hid[0]] = $a_hid[1];
 
 3430                         if ($a_hid[0] != 
"")
 
 3432                                 $hier_ids[$a_hid[0]] = $a_hid[0];
 
 3435                 foreach ($skip as $s)
 
 3437                         unset($hier_ids[$s]);
 
 3439                 include_once(
"./Services/COPage/classes/class.ilPageContent.php");
 
 3442                 foreach($hier_ids as $hid)
 
 3445                         if (is_object($curr_node))
 
 3447                                 if ($curr_node->node_name() == 
"PageContent")
 
 3449                                         $content = $this->dom->dump_node($curr_node);
 
 3451                                         $content = eregi_replace(
"PCID=\"[a-z0-9]*\"",
"",$content);
 
 3452                                         $content = eregi_replace(
"HierId=\"[a-z0-9_]*\"",
"",$content);
 
 3454                                         $ilUser->addToPCClipboard($content, $time, $nr);
 
 3459                 include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
 
 3470                 $a_hid = explode(
":", $a_hier_id);
 
 3471                 $content = $ilUser->getPCClipboardContent();
 
 3475                 for ($i = count($content) - 1; $i >= 0; $i--)
 
 3479                         $temp_dom = 
domxml_open_mem(
'<?xml version="1.0" encoding="UTF-8"?>'.$c,
 
 3485                                 $path = 
"//PageContent";
 
 3487                                 if (count(
$res->nodeset) > 0)
 
 3489                                         $new_pc_node = 
$res->nodeset[0];
 
 3490                                         $cloned_pc_node = $new_pc_node->clone_node (
true);
 
 3491                                         $cloned_pc_node->unlink_node ($cloned_pc_node);
 
 3510                 if (!is_array($a_hids))
 
 3514                 $obj = & $this->content_obj;
 
 3516                 foreach($a_hids as $a_hid)
 
 3518                         $a_hid = explode(
":", $a_hid);
 
 3520                         if (is_object($curr_node))
 
 3522                                 if ($curr_node->node_name() == 
"PageContent")
 
 3525                                         if ($cont_obj->isEnabled ())
 
 3528                                                 if (!$this->
checkForTag(
"Question", $a_hid[0], $a_hid[1]) || $a_self_ass)
 
 3530                                                         $cont_obj->disable();
 
 3535                                                 $cont_obj->enable();
 
 3560                 foreach ($hier_ids as $hier_id)
 
 3563                         if (!is_int(strpos($hier_id, 
"_")))
 
 3565                                 if ($hier_id != 
"pg" && $hier_id >= $a_hid)
 
 3568                                         $curr_node->unlink_node($curr_node);
 
 3590                 foreach ($hier_ids as $hier_id)
 
 3593                         if (!is_int(strpos($hier_id, 
"_")))
 
 3595                                 if ($hier_id != 
"pg" && $hier_id < $a_hid)
 
 3598                                         $curr_node->unlink_node($curr_node);
 
 3618                 $hier_ids = $a_source_page->getHierIds();
 
 3620                 $copy_ids = array();
 
 3623                 foreach ($hier_ids as $hier_id)
 
 3626                         if (!is_int(strpos($hier_id, 
"_")))
 
 3628                                 if ($hier_id != 
"pg" && $hier_id >= $a_hid)
 
 3630                                         $copy_ids[] = $hier_id;
 
 3636                 $parent_node =& $a_target_page->getContentNode(
"pg");
 
 3637                 $target_dom =& $a_target_page->getDom();
 
 3638                 $parent_childs =& $parent_node->child_nodes();
 
 3639                 $cnt_parent_childs = count($parent_childs);
 
 3641                 $first_child =& $parent_childs[0];
 
 3642                 foreach($copy_ids as $copy_id)
 
 3644                         $source_node =& $a_source_page->getContentNode($copy_id);
 
 3646                         $new_node =& $source_node->clone_node(
true);
 
 3647                         $new_node->unlink_node($new_node);
 
 3649                         $source_node->unlink_node($source_node);
 
 3651                         if($cnt_parent_childs == 0)
 
 3653                                 $new_node =& $parent_node->append_child($new_node);
 
 3658                                 $new_node =& $first_child->insert_before($new_node, $first_child);
 
 3660                         $parent_childs =& $parent_node->child_nodes();
 
 3665                 $a_target_page->update();
 
 3666                 $a_source_page->update();
 
 3678                 $curr_name = $curr_node->node_name();
 
 3679                 if (($curr_name == 
"TableData") || ($curr_name == 
"PageObject") ||
 
 3680                         ($curr_name == 
"ListItem") || ($curr_name == 
"Section")
 
 3681                         || ($curr_name == 
"Tab") || ($curr_name == 
"ContentPopup"))
 
 3686                 $hid = $curr_node->get_attribute(
"HierId");
 
 3695                         $pos = explode(
"_", $a_pos);
 
 3696                         $target_pos = array_pop($pos);
 
 3697                         $parent_pos = implode($pos, 
"_");
 
 3701                         $parent_pos = $a_pos;
 
 3705                 if($parent_pos != 
"")
 
 3711                         $parent_node =& $this->
getNode();
 
 3715                 $parent_childs =& $parent_node->child_nodes();
 
 3716                 $cnt_parent_childs = count($parent_childs);
 
 3722                                 $new_node =& $a_cont_obj->getNode();
 
 3726                                 if($succ_node =& $curr_node->next_sibling())
 
 3728                                         $new_node =& $succ_node->insert_before($new_node, $succ_node);
 
 3733                                         $new_node =& $parent_node->append_child($new_node);
 
 3735                                 $a_cont_obj->setNode($new_node);
 
 3740                                 $new_node =& $a_cont_obj->getNode();
 
 3742                                 $new_node =& $succ_node->insert_before($new_node, $succ_node);
 
 3743                                 $a_cont_obj->setNode($new_node);
 
 3749                                 $new_node =& $a_cont_obj->getNode();
 
 3750                                 if($cnt_parent_childs == 0)
 
 3752                                         $new_node =& $parent_node->append_child($new_node);
 
 3756                                         $new_node =& $parent_childs[0]->insert_before($new_node, $parent_childs[0]);
 
 3758                                 $a_cont_obj->setNode($new_node);
 
 3765                         $sub_nodes = $curr_node->child_nodes() ;
 
 3766                         foreach ( $sub_nodes as $sub_node ) {
 
 3767                                 if ($sub_node->node_name() == 
"PlaceHolder") {
 
 3768                                         $curr_node->unlink_node();
 
 3781                 $curr_name = $curr_node->node_name();
 
 3782                 if (($curr_name == 
"TableData") || ($curr_name == 
"PageObject") ||
 
 3783                         ($curr_name == 
"ListItem") || ($curr_name == 
"Section")
 
 3784                         || ($curr_name == 
"Tab") || ($curr_name == 
"ContentPopup"))
 
 3789                 $hid = $curr_node->get_attribute(
"HierId");
 
 3797                         $pos = explode(
"_", $a_pos);
 
 3798                         $target_pos = array_pop($pos);
 
 3799                         $parent_pos = implode($pos, 
"_");
 
 3803                         $parent_pos = $a_pos;
 
 3807                 if($parent_pos != 
"")
 
 3813                         $parent_node =& $this->
getNode();
 
 3817                 $parent_childs =& $parent_node->child_nodes();
 
 3818                 $cnt_parent_childs = count($parent_childs);
 
 3825                                 if($succ_node = $curr_node->next_sibling())
 
 3827                                         $a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
 
 3831                                         $a_cont_node = $parent_node->append_child($a_cont_node);
 
 3839                                 $a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
 
 3846                                 if($cnt_parent_childs == 0)
 
 3848                                         $a_cont_node = $parent_node->append_child($a_cont_node);
 
 3852                                         $a_cont_node = $parent_childs[0]->insert_before($a_cont_node, $parent_childs[0]);
 
 3865                 if($a_source == $a_target)
 
 3872                 $source_node =& $content->getNode();
 
 3873                 $clone_node =& $source_node->clone_node(
true);
 
 3879                 $content->setNode($clone_node);
 
 3891                 if($a_source == $a_target)
 
 3898                 $source_node =& $content->getNode();
 
 3899                 $clone_node =& $source_node->clone_node(
true);
 
 3905                 $content->setNode($clone_node);
 
 3915                 $a_content = eregi_replace(
"\[com\]",
"<Comment>",$a_content);
 
 3916                 $a_content = eregi_replace(
"\[\/com\]",
"</Comment>",$a_content);
 
 3917                 $a_content = eregi_replace(
"\[emp]",
"<Emph>",$a_content);
 
 3918                 $a_content = eregi_replace(
"\[\/emp\]",
"</Emph>",$a_content);
 
 3919                 $a_content = eregi_replace(
"\[str]",
"<Strong>",$a_content);
 
 3920                 $a_content = eregi_replace(
"\[\/str\]",
"</Strong>",$a_content);
 
 3931                 $path = 
"//IntLink";
 
 3933                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 3935                         $target = 
$res->nodeset[$i]->get_attribute(
"Target");
 
 3936                         $type = 
$res->nodeset[$i]->get_attribute(
"Type");
 
 3938                         if (substr($target, 0, 4) == 
"il__")
 
 3940                                 $id = substr($target, 4, strlen($target) - 4);
 
 3944                                 if ($a_res_ref_to_obj_id && $type == 
"RepositoryItem")
 
 3946                                         $id_arr = explode(
"_", 
$id);
 
 3965                                 $new_target = 
"il_".$a_inst.
"_".
$id;
 
 3966                                 $res->nodeset[$i]->set_attribute(
"Target", $new_target);
 
 3973                 $path = 
"//MediaAlias";
 
 3975                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 3977                         $origin_id = 
$res->nodeset[$i]->get_attribute(
"OriginId");
 
 3978                         if (substr($origin_id, 0, 4) == 
"il__")
 
 3980                                 $new_id = 
"il_".$a_inst.
"_".substr($origin_id, 4, strlen($origin_id) - 4);
 
 3981                                 $res->nodeset[$i]->set_attribute(
"OriginId", $new_id);
 
 3988                 $path = 
"//FileItem/Identifier";
 
 3990                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 3992                         $origin_id = 
$res->nodeset[$i]->get_attribute(
"Entry");
 
 3993                         if (substr($origin_id, 0, 4) == 
"il__")
 
 3995                                 $new_id = 
"il_".$a_inst.
"_".substr($origin_id, 4, strlen($origin_id) - 4);
 
 3996                                 $res->nodeset[$i]->set_attribute(
"Entry", $new_id);
 
 4003                 $path = 
"//Question";
 
 4005                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 4007                         $qref = 
$res->nodeset[$i]->get_attribute(
"QRef");
 
 4009                         if (substr($qref, 0, 4) == 
"il__")
 
 4011                                 $new_id = 
"il_".$a_inst.
"_".substr($qref, 4, strlen($qref) - 4);
 
 4013                                 $res->nodeset[$i]->set_attribute(
"QRef", $new_id);
 
 4031                 require_once(
"./Services/COPage/syntax_highlight/php/HFile/HFile_".$proglang.
".php");
 
 4032                 $classname =  
"HFile_$proglang";
 
 4033                 $h_instance = 
new $classname();
 
 4034                 if ($autoindent == 
"n") {
 
 4035                         $h_instance ->notrim   = 1;
 
 4036                         $h_instance ->indent   = array (
"");
 
 4037                         $h_instance ->unindent = array (
"");
 
 4041                 $a_text = $highlighter->highlight_text(html_entity_decode($a_text));
 
 4047                 return file_exists (
"Services/COPage/syntax_highlight/php/HFile/HFile_".$hfile_ext.
".php");
 
 4058                 $path = 
"//Paragraph"; 
 
 4060                 for($i = 0; $i < count(
$res->nodeset); $i++)
 
 4062                         $context_node = 
$res->nodeset[$i];
 
 4063                         $char = $context_node->get_attribute(
'Characteristic');
 
 4065                         if ($char != 
"Code")                    
 
 4068                         $n = $context_node->parent_node();
 
 4069                         $char = $context_node->get_attribute(
'Characteristic');
 
 4070                         $subchar = $context_node->get_attribute(
'SubCharacteristic');
 
 4071                         $showlinenumbers = $context_node->get_attribute(
'ShowLineNumbers');
 
 4072                         $downloadtitle = $context_node->get_attribute(
'DownloadTitle');
 
 4073                         $autoindent = $context_node->get_attribute(
'AutoIndent');
 
 4078                         $childs = $context_node->child_nodes();
 
 4080                         for($j=0; $j<count($childs); $j++)
 
 4082                                 $content .= $this->dom->dump_node($childs[$j]);
 
 4085                         while ($context_node->has_child_nodes ())
 
 4087                                 $node_del = $context_node->first_child ();
 
 4088                                 $context_node->remove_child ($node_del);
 
 4091                         $content = str_replace(
"<br />", 
"<br/>", utf8_decode($content) );
 
 4092                         $content = str_replace(
"<br/>", 
"\n", $content);
 
 4093                         $rownums = count(split (
"\n",$content));
 
 4095                         $plain_content = html_entity_decode($content);
 
 4096                         $plain_content = preg_replace (
"/\&#x([1-9a-f]{2});?/ise",
"chr (base_convert (\\1, 16, 10))",$plain_content);
 
 4097                         $plain_content = preg_replace (
"/\&#(\d+);?/ise",
"chr (\\1)",$plain_content);                   
 
 4098                         $content = utf8_encode($this->
highlightText($plain_content, $subchar, $autoindent));
 
 4100                         $content = str_replace(
"&lt;", 
"<", $content);
 
 4101                         $content = str_replace(
"&gt;", 
">", $content);
 
 4104                         $rows    = 
"<tr valign=\"top\">";
 
 4109                         if (strcmp($showlinenumbers,
"y")==0)
 
 4111                                 $linenumbers = 
"<td nowrap=\"nowrap\" class=\"ilc_LineNumbers\" >";
 
 4112                                 $linenumbers .= 
"<pre class=\"ilc_Code\">";
 
 4114                                 for ($j=0; $j < $rownums; $j++)
 
 4116                                         $indentno      = strlen($rownums) - strlen($j+1) + 2;
 
 4117                                         $rownumeration = ($j+1);
 
 4118                                         $linenumbers   .= 
"<span class=\"ilc_LineNumber\">$rownumeration</span>";
 
 4119                                         if ($j < $rownums-1)
 
 4121                                                 $linenumbers .= 
"\n";
 
 4124                                 $linenumbers .= 
"</pre>";
 
 4125                                 $linenumbers .= 
"</td>";
 
 4128                         $rows .= $linenumbers.
"<td class=\"ilc_Sourcecode\"><pre class=\"ilc_Code\">".$content.
"</pre></td>";
 
 4133                         $newcontent = str_replace(
"\n", 
"<br/>",$rows);
 
 4135                         $newcontent = str_replace(
"<br/><br/>", 
"<br/> <br/>",$newcontent);     
 
 4137                         $newcontent = str_replace(
"<br/><br/>", 
"<br/> <br/>",$newcontent);
 
 4142                         $newcontent = str_replace(
"{", 
"{", $newcontent);
 
 4143                         $newcontent = str_replace(
"}", 
"}", $newcontent);
 
 4146                         $a_output = str_replace(
"[[[[[Code;".($i + 1).
"]]]]]", $newcontent, $a_output);
 
 4148                         if ($outputmode != 
"presentation" && is_object($this->offline_handler)
 
 4149                                 && trim($downloadtitle) != 
"")
 
 4152                                 $this->offline_handler->handleCodeParagraph ($this->
id, $i + 1, $downloadtitle, $plain_content);
 
 4169                 foreach ($this->id_elements as $el)
 
 4171                         $path.= $sep.
"//".$el.
"[not(@PCID)]";
 
 4178                 if (count (
$res->nodeset) > 0)
 
 4199                 foreach ($this->id_elements as $el)
 
 4201                         $path.= $sep.
"//".$el.
"[@PCID]";
 
 4209                 for ($i = 0; $i < count (
$res->nodeset); $i++)
 
 4212                         $pcids[] = 
$node->get_attribute(
"PCID");
 
 4231                 foreach ($this->id_elements as $el)
 
 4233                         $path.= $sep.
"//".$el.
"[@PCID='".$a_pc_id.
"']";
 
 4240                 return (count(
$res->nodeset) > 0);
 
 4251                 if ($a_pc_ids === 
false)
 
 4255                 $id = ilUtil::randomHash(10, $a_pc_ids);
 
 4272                 foreach ($this->id_elements as $el)
 
 4274                         $path.= $sep.
"//".$el.
"[not(@PCID)]";
 
 4280                 for ($i = 0; $i < count (
$res->nodeset); $i++)
 
 4283                         $id = ilUtil::randomHash(10, $pcids);
 
 4286                         $res->nodeset[$i]->set_attribute(
"PCID", 
$id);
 
 4296                 $this->addHierIds();
 
 4300                 $path = 
"//PageContent";
 
 4305                 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
 
 4306                 for ($i = 0; $i < count (
$res->nodeset); $i++)
 
 4308                         $hier_id = 
$res->nodeset[$i]->get_attribute(
"HierId");
 
 4309                         $pc_id = 
$res->nodeset[$i]->get_attribute(
"PCID");
 
 4310                         $dump = $mydom->dump_node(
$res->nodeset[$i]);
 
 4311                         if (($hpos = strpos($dump, 
' HierId="'.$hier_id.
'"')) > 0)
 
 4313                                 $dump = substr($dump, 0, $hpos).
 
 4314                                         substr($dump, $hpos + strlen(
' HierId="'.$hier_id.
'"'));
 
 4317                         $childs = 
$res->nodeset[$i]->child_nodes();
 
 4319                         if ($childs[0] && $childs[0]->node_name() == 
"Paragraph")
 
 4321                                 $content = $mydom->dump_node($childs[0]);
 
 4322                                 $content = substr($content, strpos($content, 
">") + 1,
 
 4323                                         strrpos($content, 
"<") - (strpos($content, 
">") + 1));
 
 4331                                 array(
"hier_id" => $hier_id, 
"hash" => md5($dump), 
"content" => $content);
 
 4346                 $path = 
"//Question";
 
 4351                 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
 
 4352                 for ($i = 0; $i < count (
$res->nodeset); $i++)
 
 4354                         $qref = 
$res->nodeset[$i]->get_attribute(
"QRef");
 
 4359                         if (!($inst_id > 0))
 
 4380                 $path = 
"/descendant::Paragraph[position() = $par_id]";
 
 4384                 if (count (
$res->nodeset) != 1)
 
 4385                         die (
"Should not happen");
 
 4387                 $context_node = 
$res->nodeset[0];
 
 4391                 $childs = $context_node->child_nodes();
 
 4393                 for($j=0; $j<count($childs); $j++)
 
 4395                         $content .= $mydom->dump_node($childs[$j]);
 
 4398                 $content = str_replace(
"<br />", 
"\n", $content);
 
 4399                 $content = str_replace(
"<br/>", 
"\n", $content);
 
 4401                 $plain_content = html_entity_decode($content);
 
 4418                 $xsl = file_get_contents(
"./Services/COPage/xsl/page_fo.xsl");
 
 4419                 $args = array( 
'/_xml' => 
$xml, 
'/_xsl' => $xsl );
 
 4425                 $fo = 
xslt_process($xh,
"arg:/_xml",
"arg:/_xsl",NULL,$args, $params);
 
 4428                 $fo = str_replace(
"\n", 
"", $fo);
 
 4429                 $fo = str_replace(
"<br/>", 
"<br>", $fo);
 
 4430                 $fo = str_replace(
"<br>", 
"\n", $fo);
 
 4435                 $fo = substr($fo, strpos($fo,
">") + 1);
 
 4441                 $this->offline_handler = $handler;
 
 4455                 $query = 
"SELECT * FROM page_object WHERE page_id = ".
 
 4456                         $ilDB->quote($a_id, 
"integer").
" AND ".
 
 4457                         " parent_type = ".$ilDB->quote($a_parent_type, 
"text").
" AND ".
 
 4458                         " inactive_elements = ".$ilDB->quote(1, 
"integer");
 
 4459                 $obj_set = $ilDB->query(
$query);
 
 4477                 if (strpos($a_content,  
" Enabled=\"False\""))
 
 4491                 $h_query = 
"SELECT * FROM page_history ".
 
 4492                         " WHERE page_id = ".$ilDB->quote($this->
getId(), 
"integer").
 
 4493                         " AND parent_type = ".$ilDB->quote($this->
getParentType(), 
"text").
 
 4494                         " ORDER BY hdate DESC";
 
 4496                 $hset = $ilDB->query($h_query);
 
 4497                 $hentries = array();
 
 4499                 while ($hrec = $ilDB->fetchAssoc($hset))
 
 4501                         $hrec[
"sortkey"] = (int) $hrec[
"nr"];
 
 4502                         $hrec[
"user"] = (int) $hrec[
"user_id"];
 
 4503                         $hentries[] = $hrec;
 
 4516                 $res = $ilDB->queryF(
"SELECT * FROM page_history ".
 
 4517                         " WHERE page_id = %s ".
 
 4518                         " AND parent_type = %s ".
 
 4520                         array(
"integer", 
"text", 
"integer"),
 
 4522                 if ($hrec = $ilDB->fetchAssoc(
$res))
 
 4542                 $res = $ilDB->query(
"SELECT MAX(nr) mnr FROM page_history ".
 
 4543                         " WHERE page_id = ".$ilDB->quote($this->getId(), 
"integer").
 
 4544                         " AND parent_type = ".$ilDB->quote($this->getParentType(), 
"text").
 
 4545                         " AND nr < ".$ilDB->quote((
int) $a_nr, 
"integer"));
 
 4547                 if (
$row[
"mnr"] > 0)
 
 4549                         $res = $ilDB->query(
"SELECT * FROM page_history ".
 
 4550                                 " WHERE page_id = ".$ilDB->quote($this->getId(), 
"integer").
 
 4551                                 " AND parent_type = ".$ilDB->quote($this->getParentType(), 
"text").
 
 4552                                 " AND nr = ".$ilDB->quote((
int) 
$row[
"mnr"], 
"integer"));
 
 4553                         $row = $ilDB->fetchAssoc(
$res);
 
 4558                 $res = $ilDB->query(
"SELECT MIN(nr) mnr FROM page_history ".
 
 4559                         " WHERE page_id = ".$ilDB->quote($this->getId(), 
"integer").
 
 4560                         " AND parent_type = ".$ilDB->quote($this->getParentType(), 
"text").
 
 4561                         " AND nr > ".$ilDB->quote((
int) $a_nr, 
"integer"));
 
 4563                 if (
$row[
"mnr"] > 0)
 
 4565                         $res = $ilDB->query(
"SELECT * FROM page_history ".
 
 4566                                 " WHERE page_id = ".$ilDB->quote($this->getId(), 
"integer").
 
 4567                                 " AND parent_type = ".$ilDB->quote($this->getParentType(), 
"text").
 
 4568                                 " AND nr = ".$ilDB->quote((
int) 
$row[
"mnr"], 
"integer"));
 
 4569                         $row = $ilDB->fetchAssoc(
$res);
 
 4574                 $res = $ilDB->query(
"SELECT * FROM page_history ".
 
 4575                         " WHERE page_id = ".$ilDB->quote($this->getId(), 
"integer").
 
 4576                         " AND parent_type = ".$ilDB->quote($this->getParentType(), 
"text").
 
 4577                         " AND nr = ".$ilDB->quote((
int) $a_nr, 
"integer"));
 
 4589                 $rnode = 
$res->nodeset[0];
 
 4592                 foreach($a_hashes as $pc_id => $h)
 
 4595                         if ($h[
"change"] != 
"")
 
 4598                                 $dc_node = $this->dom->create_element(
"DivClass");
 
 4599                                 $dc_node->set_attribute(
"HierId", $h[
"hier_id"]);
 
 4600                                 $dc_node->set_attribute(
"Class", 
"ilEdit".$h[
"change"]);
 
 4601                                 $dc_node = $rnode->append_child($dc_node);
 
 4620                 $l_hashes = $l_page->getPageContentsHashes();
 
 4621                 $r_hashes = $r_page->getPageContentsHashes();
 
 4624                 foreach ($l_hashes as $pc_id => $h)
 
 4626                         if (!isset($r_hashes[$pc_id]))
 
 4628                                 $l_hashes[$pc_id][
"change"] = 
"Deleted";
 
 4632                                 if ($l_hashes[$pc_id][
"hash"] != $r_hashes[$pc_id][
"hash"])
 
 4634                                         $l_hashes[$pc_id][
"change"] = 
"Modified";
 
 4635                                         $r_hashes[$pc_id][
"change"] = 
"Modified";
 
 4637                                         include_once(
"./Services/COPage/mediawikidiff/class.WordLevelDiff.php");
 
 4639                                         if ($l_hashes[$pc_id][
"content"] != 
"" &&
 
 4640                                                 $r_hashes[$pc_id][
"content"] != 
"")
 
 4642                                                 $new_left = str_replace(
"\n", 
"<br />", $l_hashes[$pc_id][
"content"]);
 
 4643                                                 $new_right = str_replace(
"\n", 
"<br />", $r_hashes[$pc_id][
"content"]);
 
 4646                                                 $new_left = $wldiff->orig();
 
 4647                                                 $new_right = $wldiff->closing();
 
 4648                                                 $l_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_left[0]);
 
 4649                                                 $r_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_right[0]);
 
 4656                 foreach ($r_hashes as $pc_id => $h)
 
 4658                         if (!isset($l_hashes[$pc_id]))
 
 4660                                 $r_hashes[$pc_id][
"change"] = 
"New";
 
 4664                 $l_page->addChangeDivClasses($l_hashes);
 
 4665                 $r_page->addChangeDivClasses($r_hashes);
 
 4667                 return array(
"l_page" => $l_page, 
"r_page" => $r_page,
 
 4668                         "l_changes" => $l_hashes, 
"r_changes" => $r_hashes);
 
 4678                 $ilDB->manipulate(
"UPDATE page_object ".
 
 4679                         " SET view_cnt = view_cnt + 1 ".
 
 4680                         " WHERE page_id = ".$ilDB->quote($this->getId(), 
"integer").
 
 4681                         " AND parent_type = ".$ilDB->quote($this->getParentType(), 
"text"));
 
 4696                 $page_changes = array();
 
 4697                 $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
 
 4698                 $q = 
"SELECT * FROM page_object ".
 
 4699                         " WHERE parent_id = ".$ilDB->quote($a_parent_id, 
"integer").
 
 4700                         " AND parent_type = ".$ilDB->quote($a_parent_type, 
"text").
 
 4701                         " AND last_change >= ".$ilDB->quote($limit_ts, 
"timestamp");
 
 4703                 $set = $ilDB->query($q);
 
 4704                 while($page = $ilDB->fetchAssoc($set))
 
 4706                         $page_changes[] = array(
"date" => $page[
"last_change"],
 
 4707                                 "id" => $page[
"page_id"], 
"type" => 
"page",
 
 4708                                 "user" => $page[
"last_change_user"]);
 
 4714                         $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
 
 4715                         $and_str = 
" AND hdate >= ".$ilDB->quote($limit_ts, 
"timestamp").
" ";
 
 4718                 $q = 
"SELECT * FROM page_history ".
 
 4719                         " WHERE parent_id = ".$ilDB->quote($a_parent_id, 
"integer").
 
 4720                         " AND parent_type = ".$ilDB->quote($a_parent_type, 
"text").
 
 4722                 $set = $ilDB->query($q);
 
 4723                 while ($page = $ilDB->fetchAssoc($set))
 
 4725                         $page_changes[] = array(
"date" => $page[
"hdate"],
 
 4726                                 "id" => $page[
"page_id"], 
"type" => 
"hist", 
"nr" => $page[
"nr"],
 
 4727                                 "user" => $page[
"user_id"]);
 
 4732                 return $page_changes;
 
 4746                 $page_changes = array();
 
 4748                 $q = 
"SELECT * FROM page_object ".
 
 4749                         " WHERE parent_id = ".$ilDB->quote($a_parent_id, 
"integer").
 
 4750                         " AND parent_type = ".$ilDB->quote($a_parent_type, 
"text");
 
 4751                 $set = $ilDB->query($q);
 
 4753                 while ($page = $ilDB->fetchAssoc($set))
 
 4755                         $pages[$page[
"page_id"]] = array(
"date" => $page[
"last_change"],
 
 4756                                 "id" => $page[
"page_id"], 
"user" => $page[
"last_change_user"]);
 
 4774                 $q = 
"SELECT * FROM page_object ".
 
 4775                         " WHERE parent_id = ".$ilDB->quote($a_parent_id, 
"integer").
 
 4776                         " AND parent_type = ".$ilDB->quote($a_parent_type, 
"text").
 
 4777                         " ORDER BY created DESC";
 
 4778                 $set = $ilDB->query($q);
 
 4779                 while($page = $ilDB->fetchAssoc($set))
 
 4781                         if ($page[
"created"] != 
"")
 
 4783                                 $pages[] = array(
"created" => $page[
"created"],
 
 4784                                         "id" => $page[
"page_id"],
 
 4785                                         "user" => $page[
"create_user"],
 
 4803                 $contributors = array();
 
 4804                 $set = $ilDB->queryF(
"SELECT last_change_user FROM page_object ".
 
 4805                         " WHERE parent_id = %s AND parent_type = %s ".
 
 4806                         " AND last_change_user != %s",
 
 4807                         array(
"integer", 
"text", 
"integer"),
 
 4808                         array($a_parent_id, $a_parent_type, 0));
 
 4810                 while ($page = $ilDB->fetchAssoc($set))
 
 4812                         $contributors[$page[
"last_change_user"]][$page[
"page_id"]] = 1;
 
 4815                 $set = $ilDB->queryF(
"SELECT count(DISTINCT page_id, parent_type, hdate) as cnt, page_id, user_id FROM page_history ".
 
 4816                         " WHERE parent_id = %s AND parent_type = %s AND user_id != %s ".
 
 4817                         " GROUP BY page_id, user_id ",
 
 4818                         array(
"integer", 
"text", 
"integer"),
 
 4819                         array($a_parent_id, $a_parent_type, 0));
 
 4820                 while ($hpage = $ilDB->fetchAssoc($set))
 
 4822                         $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] =
 
 4823                                 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] + $hpage[
"cnt"];
 
 4827                 foreach ($contributors as $k => $co)
 
 4832                                 $c[] = array(
"user_id" => $k, 
"pages" => $co,
 
 4833                                         "lastname" => $name[
"lastname"], 
"firstname" => $name[
"firstname"]);
 
 4850                 $contributors = array();
 
 4851                 $set = $ilDB->queryF(
"SELECT last_change_user FROM page_object ".
 
 4852                         " WHERE page_id = %s AND parent_type = %s ".
 
 4853                         " AND last_change_user != %s",
 
 4854                         array(
"integer", 
"text", 
"integer"),
 
 4855                         array($a_page_id, $a_parent_type, 0));
 
 4857                 while ($page = $ilDB->fetchAssoc($set))
 
 4859                         $contributors[$page[
"last_change_user"]] = 1;
 
 4862                 $set = $ilDB->queryF(
"SELECT count(*) as cnt, page_id, user_id FROM page_history ".
 
 4863                         " WHERE page_id = %s AND parent_type = %s AND user_id != %s ".
 
 4864                         " GROUP BY user_id, page_id ",
 
 4865                         array(
"integer", 
"text", 
"integer"),
 
 4866                         array($a_page_id, $a_parent_type, 0));
 
 4867                 while ($hpage = $ilDB->fetchAssoc($set))
 
 4869                         $contributors[$hpage[
"user_id"]] =
 
 4870                                 $contributors[$hpage[
"user_id"]] + $hpage[
"cnt"];
 
 4874                 foreach ($contributors as $k => $co)
 
 4877                         $c[] = array(
"user_id" => $k, 
"pages" => $co,
 
 4878                                 "lastname" => $name[
"lastname"], 
"firstname" => $name[
"firstname"]);
 
 4891                 $ilDB->update(
"page_object", array(
 
 4892                         "rendered_content" => array(
"clob", $a_content),
 
 4893                         "render_md5" => array(
"text", $a_md5),
 
 4894                         "rendered_time" => array(
"timestamp", 
ilUtil::now())
 
 4896                         "page_id" => array(
"integer", $this->
getId()),
 
 4918                 $page_changes = array();
 
 4920                 $q = 
"SELECT * FROM page_object ".
 
 4921                         " WHERE parent_id = ".$ilDB->quote($a_parent_id, 
"integer").
 
 4922                         " AND parent_type = ".$ilDB->quote($a_parent_type, 
"text").
 
 4923                         " AND int_links = ".$ilDB->quote(1, 
"integer");
 
 4924                 $set = $ilDB->query($q);
 
 4926                 while ($page = $ilDB->fetchAssoc($set))
 
 4928                         $pages[$page[
"page_id"]] = array(
"date" => $page[
"last_change"],
 
 4929                                 "id" => $page[
"page_id"], 
"user" => $page[
"last_change_user"]);
 
 4943                 if (strpos($a_content,  
"IntLink"))
 
 4969                                 $link_type = 
"MediaObject";
 
 4970                                 $a_id = 
"il__mob_".$a_id;
 
 4974                                 $link_type = 
"PageObject";
 
 4975                                 $a_id = 
"il__pg_".$a_id;
 
 4979                                 $link_type = 
"GlossaryItem";
 
 4980                                 $a_id = 
"il__git_".$a_id;
 
 4981                                 $a_target = 
"Glossary";
 
 4986                 if ($link_type == 
"" || $a_id == 
"")
 
 4989                         $path = 
"//PageObject/InitOpenedContent";
 
 4991                         if (count(
$res->nodeset) > 0)
 
 4993                                 $res->nodeset[0]->unlink_node(
$res->nodeset[0]);
 
 4999                         $path = 
"//PageObject/InitOpenedContent";
 
 5001                         if (count(
$res->nodeset) > 0)
 
 5003                                 $init_node = 
$res->nodeset[0];
 
 5004                                 $childs = $init_node->child_nodes();
 
 5005                                 for($i = 0; $i < count($childs); $i++)
 
 5007                                         if ($childs[$i]->node_name() == 
"IntLink")
 
 5009                                                 $il_node = $childs[$i];
 
 5015                                 $path = 
"//PageObject";
 
 5017                                 $page_node = 
$res->nodeset[0];
 
 5018                                 $init_node = $this->dom->create_element(
"InitOpenedContent");
 
 5019                                 $init_node = $page_node->append_child($init_node);
 
 5020                                 $il_node = $this->dom->create_element(
"IntLink");
 
 5021                                 $il_node = $init_node->append_child($il_node);
 
 5023                         $il_node->set_attribute(
"Target", $a_id);
 
 5024                         $il_node->set_attribute(
"Type", $link_type);
 
 5025                         $il_node->set_attribute(
"TargetFrame", $a_target);
 
 5042                 $path = 
"//PageObject/InitOpenedContent";
 
 5045                 if (count(
$res->nodeset) > 0)
 
 5047                         $init_node = 
$res->nodeset[0];
 
 5048                         $childs = $init_node->child_nodes();
 
 5049                         for($i = 0; $i < count($childs); $i++)
 
 5051                                 if ($childs[$i]->node_name() == 
"IntLink")
 
 5053                                         $il_node = $childs[$i];
 
 5057                 if (!is_null($il_node))
 
 5059                         $id = $il_node->get_attribute(
"Target");
 
 5060                         $link_type = $il_node->get_attribute(
"Type");
 
 5061                         $target = $il_node->get_attribute(
"TargetFrame");
 
 5073                                 case "GlossaryItem":
 
 5077                         include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
 
 5079                         return array(
"id" => 
$id, 
"type" => $type, 
"target" => $target);