4define(
"IL_INSERT_BEFORE", 0);
 
    5define(
"IL_INSERT_AFTER", 1);
 
    6define(
"IL_INSERT_CHILD", 2);
 
    8define (
"IL_CHAPTER_TITLE", 
"st_title");
 
    9define (
"IL_PAGE_TITLE", 
"pg_title");
 
   10define (
"IL_NO_HEADER", 
"none");
 
   79        final public function __construct($a_id = 0, $a_old_nr = 0, $a_lang = 
"-")
 
   94                $this->contains_int_link = 
false;
 
   95                $this->needs_parsing = 
false;
 
   96                $this->update_listeners = array();
 
   97                $this->update_listener_cnt = 0;
 
   98                $this->dom_builded = 
false;
 
   99                $this->page_not_found = 
false;
 
  100                $this->old_nr = $a_old_nr;
 
  101                $this->encoding = 
"UTF-8";              
 
  103                        array(
"PageContent", 
"TableRow", 
"TableData", 
"ListItem", 
"FileItem",
 
  104                                "Section", 
"Tab", 
"ContentPopup");
 
  106                $this->show_page_act_info = 
false;
 
  144                include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
 
  156                $this->language = $a_val;
 
  176                $this->page_config = $a_val;
 
  186                return $this->page_config;
 
  196                $this->rendermd5 = $a_rendermd5;
 
  206                return $this->rendermd5;
 
  216                $this->renderedcontent = $a_renderedcontent;
 
  226                return $this->renderedcontent;
 
  236                $this->renderedtime = $a_renderedtime;
 
  246                return $this->renderedtime;
 
  256                $this->lastchange = $a_lastchange;
 
  266                return $this->lastchange;
 
  276                $this->last_change_user = $a_val;
 
  286                return $this->last_change_user;
 
  296                $this->show_page_act_info = $a_val;
 
  306                return $this->show_page_act_info;
 
  317                if ($this->old_nr == 0)
 
  319                        $query = 
"SELECT * FROM page_object".
 
  320                                " WHERE page_id = ".$ilDB->quote($this->
id, 
"integer").
 
  321                                " AND parent_type=".$ilDB->quote($this->
getParentType(), 
"text").
 
  322                                " AND lang = ".$ilDB->quote($this->
getLanguage(), 
"text");
 
  324                        $this->page_record = 
$ilDB->fetchAssoc($pg_set);
 
  325                        $this->
setActive($this->page_record[
"active"]);
 
  332                        $query = 
"SELECT * FROM page_history".
 
  333                                " WHERE page_id = ".$ilDB->quote($this->
id, 
"integer").
 
  334                                " AND parent_type=".$ilDB->quote($this->
getParentType(), 
"text").
 
  335                                " AND nr = ".$ilDB->quote((
int) $this->old_nr, 
"integer").
 
  336                                " AND lang = ".$ilDB->quote($this->
getLanguage(), 
"text");
 
  338                        $this->page_record = 
$ilDB->fetchAssoc($pg_set);
 
  340                if (!$this->page_record)
 
  342                        include_once(
"./Services/COPage/exceptions/class.ilCOPageNotFoundException.php");
 
  347                $this->xml = $this->page_record[
"content"];
 
  348                $this->
setParentId($this->page_record[
"parent_id"]);
 
  349                $this->last_change_user = $this->page_record[
"last_change_user"];
 
  350                $this->create_user = $this->page_record[
"create_user"];
 
  365        static function _exists($a_parent_type, $a_id, $a_lang = 
"", $a_no_cache = 
false)
 
  368                if (!$a_no_cache && isset(self::$exists[$a_parent_type.
":".$a_id.
":".$a_lang]))
 
  370                        return self::$exists[$a_parent_type.
":".$a_id.
":".$a_lang];
 
  376                        $and_lang = 
" AND lang = ".$ilDB->quote($a_lang, 
"text");
 
  379                $query = 
"SELECT page_id FROM page_object WHERE page_id = ".$ilDB->quote($a_id, 
"integer").
" ".
 
  380                        "AND parent_type = ".$ilDB->quote($a_parent_type, 
"text").$and_lang;
 
  384                        self::$exists[$a_parent_type.
":".$a_id.
":".$a_lang] = 
true;
 
  389                        self::$exists[$a_parent_type.
":".$a_id.
":".$a_lang] = 
false;
 
  405                include_once(
"./Services/COPage/classes/class.ilPageUtil.php");
 
  412                if ($this->dom_builded && !$a_force)
 
  427                $path = 
"//PageObject";
 
  429                if (count(
$res->nodeset) == 1)
 
  432                        $this->node = 
$res->nodeset[0];
 
  438                        $this->dom_builded = 
true;
 
  471                        return $this->dom->myDOMDocument;
 
  493                $this->parent_id = $a_id;
 
  504                $this->update_listeners[$cnt][
"object"] = $a_object;
 
  505                $this->update_listeners[$cnt][
"method"] = $a_method;
 
  506                $this->update_listeners[$cnt][
"parameters"] = $a_parameters;
 
  507                $this->update_listener_cnt++;
 
  514                        $object = $this->update_listeners[$i][
"object"];
 
  515                        $method = $this->update_listeners[$i][
"method"];
 
  516                        $parameters = $this->update_listeners[$i][
"parameters"];
 
  517                        $object->$method($parameters);
 
  528                $this->active = $a_active;
 
  536        function getActive($a_check_scheduled_activation = 
false)
 
  538                if ($a_check_scheduled_activation && !$this->active)
 
  540                        include_once(
"./Services/Calendar/classes/class.ilDateTime.php");
 
  549                return $this->active;
 
  561                $set = 
$ilDB->query(
"SELECT page_id, parent_type, lang, active, activation_start, activation_end, show_activation_info FROM page_object ".
 
  562                        " WHERE parent_id = ".
$ilDB->quote($a_parent_id, 
"integer")
 
  564                while ($rec = 
$ilDB->fetchAssoc($set))
 
  566                        self::$activation_data[$rec[
"page_id"].
":".$rec[
"parent_type"].
":".$rec[
"lang"]] = $rec;
 
  574        static function _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation = 
false, $a_lang = 
"-")
 
  584                if (isset(self::$activation_data[$a_id.
":".$a_parent_type.
":".$a_lang]))
 
  586                        $rec = self::$activation_data[$a_id.
":".$a_parent_type.
":".$a_lang];
 
  590                        $set = 
$ilDB->queryF(
"SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s".
 
  591                                " AND parent_type = %s AND lang = %s",
 
  592                                        array(
"integer", 
"text", 
"text"),
 
  593                                        array($a_id, $a_parent_type, $a_lang));
 
  594                        $rec = 
$ilDB->fetchAssoc($set);
 
  600                if (!$rec[
"active"] && $a_check_scheduled_activation)
 
  602                        if ($rec[
"n"] >= $rec[
"activation_start"] &&
 
  603                                $rec[
"n"] <= $rec[
"activation_end"])
 
  609                return $rec[
"active"];
 
  627                if (isset(self::$activation_data[$a_id.
":".$a_parent_type.
":".$a_lang]))
 
  629                        $rec = self::$activation_data[$a_id.
":".$a_parent_type.
":".$a_lang];
 
  633                        $set = 
$ilDB->queryF(
"SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s".
 
  634                        " AND parent_type = %s AND lang = %s", array(
"integer", 
"text", 
"text"),
 
  635                        array($a_id, $a_parent_type, $a_lang));
 
  636                        $rec = 
$ilDB->fetchAssoc($set);
 
  639                if (!$rec[
"active"] && $rec[
"activation_start"] != 
"")
 
  650        static function _writeActive($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation = 
true, $a_lang = 
"-")
 
  660                if ($a_reset_scheduled_activation)
 
  662                        $st = 
$ilDB->manipulateF(
"UPDATE page_object SET active = %s, activation_start = %s, ".
 
  663                                " activation_end = %s WHERE page_id = %s".
 
  664                                " AND parent_type = %s AND lang = %s", array(
"boolean", 
"timestamp", 
"timestamp", 
"integer", 
"text", 
"text"),
 
  665                                array($a_active, 
null, 
null, $a_id, $a_parent_type, $a_lang));
 
  669                        $st = 
$ilDB->prepareManip(
"UPDATE page_object SET active = %s WHERE page_id = %s".
 
  670                                " AND parent_type = %s AND lang = %s", array(
"boolean", 
"integer", 
"text", 
"text"),
 
  671                                array($a_active, $a_id, $a_parent_type, $a_lang));
 
  688                if (isset(self::$activation_data[$a_id.
":".$a_parent_type.
":".$a_lang]))
 
  690                        $rec = self::$activation_data[$a_id.
":".$a_parent_type.
":".$a_lang];
 
  694                        $set = 
$ilDB->queryF(
"SELECT active, activation_start, activation_end, show_activation_info FROM page_object WHERE page_id = %s".
 
  695                        " AND parent_type = %s AND lang = %s",
 
  696                                array(
"integer", 
"text", 
"text"),
 
  697                                array($a_id, $a_parent_type, $a_lang));
 
  698                        $rec = 
$ilDB->fetchAssoc($set);
 
  712                $res = 
$ilDB->query(
"SELECT parent_id FROM page_object WHERE page_id = ".
$ilDB->quote($a_id, 
"integer").
" ".
 
  713                                "AND parent_type=".$ilDB->quote(
$a_type, 
"text"));
 
  715                return $rec[
"parent_id"];
 
  725                $st = 
$ilDB->manipulateF(
"UPDATE page_object SET parent_id = %s WHERE page_id = %s".
 
  726                        " AND parent_type = %s", array(
"integer", 
"integer", 
"text"),
 
  727                        array($a_par_id, $a_pg_id, $a_parent_type));
 
  737                if ($a_activationstart == 
"")
 
  739                        $a_activationstart = 
null;
 
  741                $this->activationstart = $a_activationstart;
 
  751                return $this->activationstart;
 
  761                if ($a_activationend == 
"")
 
  763                        $a_activationend = 
null;
 
  765                $this->activationend = $a_activationend;
 
  775                return $this->activationend;
 
  789                if (!is_object($cont_node))
 
  793                include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
 
  794                $node_name = $cont_node->node_name();
 
  795                if ($node_name == 
"PageObject")
 
  799                if ($node_name == 
"PageContent")
 
  801                        $child_node = $cont_node->first_child();
 
  802                        $node_name = $child_node->node_name();
 
  806                if ($node_name == 
"Table")
 
  808                        if ($child_node->get_attribute(
"DataTable") == 
"y")
 
  810                                require_once(
"./Services/COPage/classes/class.ilPCDataTable.php");
 
  812                                $tab->setNode($cont_node);
 
  813                                $tab->setHierId($a_hier_id);
 
  817                                require_once(
"./Services/COPage/classes/class.ilPCTable.php");
 
  819                                $tab->setNode($cont_node);
 
  820                                $tab->setHierId($a_hier_id);
 
  822                        $tab->setPcId($a_pc_id);
 
  827                if ($node_name == 
"MediaObject")
 
  829                        if (
$_GET[
"pgEdMediaMode"] != 
"") {echo 
"ilPageObject::error media"; 
exit;}
 
  832                        require_once(
"./Services/COPage/classes/class.ilPCMediaObject.php");
 
  834                        $mal_node = $child_node->first_child();
 
  836                        $id_arr = explode(
"_", $mal_node->get_attribute(
"OriginId"));
 
  837                        $mob_id = $id_arr[count($id_arr) - 1];
 
  847                        $mob->readMediaObject($mob_id);
 
  850                        $mob->setNode($cont_node);
 
  851                        $mob->setHierId($a_hier_id);
 
  852                        $mob->setPcId($a_pc_id);
 
  863                if (!is_array($pc_def))
 
  865                        include_once(
"./Services/COPage/exceptions/class.ilCOPageUnknownPCTypeException.php");
 
  868                $pc_class = 
"ilPC".$pc_def[
"name"];
 
  869                $pc_path = 
"./".$pc_def[
"component"].
"/".$pc_def[
"directory"].
"/class.".$pc_class.
".php";
 
  870                require_once($pc_path);
 
  871                $pc = 
new $pc_class($this);
 
  872                $pc->setNode($cont_node);
 
  873                $pc->setHierId($a_hier_id);
 
  874                $pc->setPcId($a_pc_id);
 
  887                if($a_hier_id == 
"pg")
 
  896                                $path = 
"//*[@PCID = '$a_pc_id']";
 
  898                                if (count(
$res->nodeset) == 1)
 
  900                                        $cont_node = 
$res->nodeset[0];
 
  906                        $path = 
"//*[@HierId = '$a_hier_id']";
 
  908                        if (count(
$res->nodeset) == 1)
 
  910                                $cont_node = 
$res->nodeset[0];
 
  928                        $path = 
"//*[@PCID = '$a_pc_id']//".$a_content_tag;
 
  930                        if (count(
$res->nodeset) > 0)
 
  937                $path = 
"//*[@HierId = '$a_hier_id']//".$a_content_tag;
 
  939                if (count(
$res->nodeset) > 0)
 
  950                $path = 
"//*[@HierId = '$a_hier_id']";
 
  952                if (count(
$res->nodeset) == 1)
 
  975                $this->encoding = $a_encoding;
 
 1001                        $enc_str = (!empty($this->encoding))
 
 1002                                ? 
"encoding=\"".$this->encoding.
"\"" 
 1004                        return "<?xml version=\"1.0\" $enc_str ?>".
 
 1005                "<!DOCTYPE PageObject SYSTEM \"".ILIAS_ABSOLUTE_PATH.
"/xml/".$this->cur_dtd.
"\">".
 
 1020                $xml = $this->getXmlContent();
 
 1022                        DOMXML_LOAD_PARSING, 
$error);
 
 1027                $xml = $temp_dom->dump_mem(0, $this->encoding);
 
 1028                $xml = preg_replace(
'/<\?xml[^>]*>/i',
"",
$xml);
 
 1029                $xml = preg_replace(
'/<!DOCTYPE[^>]*>/i',
"",
$xml);
 
 1047                include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
 
 1072                        $a_dom = $a_dom->myDOMDocument;
 
 1074                foreach ($defs as $def)
 
 1077                        $cl = $def[
"pc_class"];
 
 1078                        $cl::handleCopiedContent($a_dom, $a_self_ass, $a_clone_mobs);
 
 1090                $path = 
"//InteractiveImage/MediaAlias";
 
 1095                include_once(
"./Services/Link/classes/class.ilInternalLink.php");
 
 1096                for ($i = 0; $i < count (
$res->nodeset); $i++)
 
 1098                        $or_id = 
$res->nodeset[$i]->get_attribute(
"OriginId");
 
 1103                        if (!($inst_id > 0))
 
 1107                                        include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 1112                                        $new_mob = $media_object->duplicate();
 
 1114                                        $res->nodeset[$i]->set_attribute(
"OriginId", 
"il__mob_".$new_mob->getId());
 
 1126                $path = 
"//MediaObject/MediaAlias";
 
 1131                include_once(
"./Services/Link/classes/class.ilInternalLink.php");
 
 1132                for ($i = 0; $i < count (
$res->nodeset); $i++)
 
 1134                        $or_id = 
$res->nodeset[$i]->get_attribute(
"OriginId");
 
 1139                        if (!($inst_id > 0))
 
 1143                                        include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 1148                                        $new_mob = $media_object->duplicate();
 
 1150                                        $res->nodeset[$i]->set_attribute(
"OriginId", 
"il__mob_".$new_mob->getId());
 
 1163                $path = 
"//Question";
 
 1168                include_once(
"./Services/Link/classes/class.ilInternalLink.php");
 
 1169                for ($i = 0; $i < count (
$res->nodeset); $i++)
 
 1171                        $qref = 
$res->nodeset[$i]->get_attribute(
"QRef");
 
 1176                        if (!($inst_id > 0))
 
 1180                                        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 1183                                        if (is_object($question) && $question->isComplete())
 
 1189                                                        $question->createPageObject();
 
 1194                                                $duplicate_id = $question->duplicate(
false);
 
 1195                                                $res->nodeset[$i]->set_attribute(
"QRef", 
"il__qst_".$duplicate_id);
 
 1211                $path = 
"//Question";
 
 1214                for ($i = 0; $i < count (
$res->nodeset); $i++)
 
 1216                        $parent_node = 
$res->nodeset[$i]->parent_node();
 
 1217                        $parent_node->unlink_node($parent_node);
 
 1233                $path = 
"//PageContent";
 
 1236                return count (
$res->nodeset);
 
 1243        function getXMLFromDom($a_incl_head = 
false, $a_append_mobs = 
false, $a_append_bib = 
false,
 
 1244                $a_append_str = 
"", $a_omit_pageobject_tag = 
false)
 
 1249                        return $this->dom->dump_mem(0, $this->encoding);
 
 1254                        if ($a_append_mobs || $a_append_bib || $a_append_link_info)
 
 1269                                return "<dummy>".$this->dom->dump_node($this->node).$mobs.$bibs.$trans.$a_append_str.
"</dummy>";
 
 1273                                if (is_object($this->dom))
 
 1275                                        if ($a_omit_pageobject_tag)
 
 1278                                                $childs = $this->node->child_nodes();
 
 1279                                                for($i = 0; $i < count($childs); $i++)
 
 1281                                                        $xml.= $this->dom->dump_node($childs[$i]);
 
 1287                                                $xml = $this->dom->dump_mem(0, $this->encoding);
 
 1288                                                $xml = preg_replace(
'/<\?xml[^>]*>/i',
"",
$xml);
 
 1289                                                $xml = preg_replace(
'/<!DOCTYPE[^>]*>/i',
"",
$xml);
 
 1313                        "ed_paste_clip", 
"ed_edit", 
"ed_edit_prop", 
"ed_delete", 
"ed_moveafter",
 
 1314                        "ed_movebefore", 
"ed_go", 
"ed_class", 
"ed_width", 
"ed_align_left",
 
 1315                        "ed_align_right", 
"ed_align_center", 
"ed_align_left_float",
 
 1316                        "ed_align_right_float", 
"ed_delete_item", 
"ed_new_item_before",
 
 1317                        "ed_new_item_after", 
"ed_copy_clip", 
"please_select", 
"ed_split_page",
 
 1318                        "ed_item_up", 
"ed_item_down", 
"ed_split_page_next",
"ed_enable",
 
 1319                        "de_activate", 
"ed_paste", 
"ed_edit_multiple", 
"ed_cut", 
"ed_copy", 
"ed_insert_templ",
 
 1320                        "ed_click_to_add_pg", 
"download");
 
 1323                include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
 
 1325                foreach ($defs as $def)
 
 1327                        $lang_vars[] = 
"pc_".$def[
"pc_type"];
 
 1328                        $lang_vars[] = 
"ed_insert_".$def[
"pc_type"];
 
 1331                        $cl = $def[
"pc_class"];
 
 1332                        $lvs = call_user_func($def[
"pc_class"].
'::getLangVars');
 
 1333                        foreach ($lvs as $lv)
 
 1339                foreach ($lang_vars as $lang_var)
 
 1353                $xml.= 
"<LV name=\"$var\" value=\"".$lng->txt(
"cont_".$var).
"\"/>";
 
 1362                        require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
 
 1364                        $path = 
"//Paragraph[1]";
 
 1366                        if (count(
$res->nodeset) > 0)
 
 1368                                $cont_node = 
$res->nodeset[0]->parent_node();
 
 1370                                $par->setNode($cont_node);
 
 1371                                return $par->getText();
 
 1386                if (is_object(
$node))
 
 1406                $this->contains_int_link = $a_contains_link;
 
 1426                $this->import_mode = $a_val;
 
 1442                if ($a_parse === 
true)
 
 1444                        $this->needs_parsing = 
true;
 
 1446                if ($a_parse === 
false)
 
 1448                        $this->needs_parsing = 
false;
 
 1461                $this->contains_question = $a_val;
 
 1471                return $this->contains_question;
 
 1485                $path = 
"//MediaObject/MediaAlias";
 
 1488                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1490                        $id_arr = explode(
"_", 
$res->nodeset[$i]->get_attribute(
"OriginId"));
 
 1491                        $mob_id = $id_arr[count($id_arr) - 1];
 
 1492                        $mob_ids[$mob_id] = $mob_id;
 
 1497                $path = 
"//InteractiveImage/MediaAlias";
 
 1499                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1501                        $id_arr = explode(
"_", 
$res->nodeset[$i]->get_attribute(
"OriginId"));
 
 1502                        $mob_id = $id_arr[count($id_arr) - 1];
 
 1503                        $mob_ids[$mob_id] = $mob_id;
 
 1508                $path = 
"//IntLink[@Type = 'MediaObject']";
 
 1511                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1513                        if ((
$res->nodeset[$i]->get_attribute(
"TargetFrame") == 
"") ||
 
 1516                                $target = 
$res->nodeset[$i]->get_attribute(
"Target");
 
 1517                                $id_arr = explode(
"_", 
$target);
 
 1518                                if (($id_arr[1] == IL_INST_ID) ||
 
 1519                                        (substr(
$target, 0, 4) == 
"il__"))
 
 1521                                        $mob_id = $id_arr[count($id_arr) - 1];
 
 1524                                                $mob_ids[$mob_id] = $mob_id;
 
 1542                $path = 
"//IntLink";
 
 1547                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1550                        if ($a_cnt_multiple)
 
 1552                                $add = 
":".$cnt_multiple;
 
 1554                        $target = 
$res->nodeset[$i]->get_attribute(
"Target");
 
 1555                        $type = 
$res->nodeset[$i]->get_attribute(
"Type");
 
 1556                        $targetframe = 
$res->nodeset[$i]->get_attribute(
"TargetFrame");
 
 1557                        $anchor = 
$res->nodeset[$i]->get_attribute(
"Anchor");
 
 1558                        $links[
$target.
":".$type.
":".$targetframe.
":".$anchor.$add] =
 
 1559                                array(
"Target" => 
$target, 
"Type" => $type,
 
 1560                                        "TargetFrame" => $targetframe, 
"Anchor" => $anchor);
 
 1563                        if ($type == 
"MediaObject" && $targetframe == 
"")
 
 1565                                if (substr(
$target, 0, 4) ==
"il__")
 
 1567                                        $id_arr = explode(
"_", 
$target);
 
 1568                                        $id = $id_arr[count($id_arr) - 1];
 
 1571                                        foreach($med_links as $key => $med_link)
 
 1573                                                $links[$key] = $med_link;
 
 1585                $path = 
"//MediaAlias";
 
 1588                require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
 
 1589                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1591                        $oid = 
$res->nodeset[$i]->get_attribute(
"OriginId");
 
 1592                        if (substr($oid, 0, 4) ==
"il__")
 
 1594                                $id_arr = explode(
"_", $oid);
 
 1595                                $id = $id_arr[count($id_arr) - 1];
 
 1598                                foreach($med_links as $key => $med_link)
 
 1600                                        $links[$key] = $med_link;
 
 1620                require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 1621                foreach($mob_ids as $mob_id => $dummy)
 
 1640                $path = 
"//MediaObject/MediaAlias[@OriginId='il__mob_$a_mob_id']";
 
 1642                $mal_node = 
$res->nodeset[$a_nr - 1];
 
 1643                $mob_node = $mal_node->parent_node();
 
 1645                return $this->dom->dump_node($mob_node);
 
 1658                libxml_disable_entity_loader(
false);
 
 1660                @$this->dom->validate(
$error);
 
 1683                $this->hier_ids = array();
 
 1684                $this->first_row_ids = array();
 
 1685                $this->first_col_ids = array();
 
 1686                $this->list_item_ids = array();
 
 1687                $this->file_item_ids = array();
 
 1694                foreach ($this->id_elements as $el)
 
 1696                        $path.= $sep.
"//".$el;
 
 1701                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1703                        $cnode = 
$res->nodeset[$i];
 
 1704                        $ctag = $cnode->node_name();
 
 1708                        while($cnode = $cnode->previous_sibling())
 
 1710                                if (($cnode->node_type() == XML_ELEMENT_NODE)
 
 1711                                        && $cnode->has_attribute(
"HierId"))
 
 1713                                        $sib_hier_id = $cnode->get_attribute(
"HierId");
 
 1719                        if ($sib_hier_id != 
"")         
 
 1721                                require_once(
"./Services/COPage/classes/class.ilPageContent.php");
 
 1723                                $res->nodeset[$i]->set_attribute(
"HierId", $node_hier_id);
 
 1724                                $this->hier_ids[] = $node_hier_id;
 
 1725                                if ($ctag == 
"TableData")
 
 1727                                        if (substr($par_hier_id,strlen($par_hier_id)-2) == 
"_1")
 
 1729                                                $this->first_row_ids[] = $node_hier_id;
 
 1732                                if ($ctag == 
"ListItem")
 
 1734                                        $this->list_item_ids[] = $node_hier_id;
 
 1736                                if ($ctag == 
"FileItem")
 
 1738                                        $this->file_item_ids[] = $node_hier_id;
 
 1744                                $cnode = 
$res->nodeset[$i];
 
 1746                                while($cnode = $cnode->parent_node())
 
 1748                                        if (($cnode->node_type() == XML_ELEMENT_NODE)
 
 1749                                                && $cnode->has_attribute(
"HierId"))
 
 1751                                                $par_hier_id = $cnode->get_attribute(
"HierId");
 
 1757                                if (($par_hier_id != 
"") && ($par_hier_id != 
"pg"))             
 
 1759                                        $node_hier_id = $par_hier_id.
"_1";
 
 1760                                        $res->nodeset[$i]->set_attribute(
"HierId", $node_hier_id);
 
 1761                                        $this->hier_ids[] = $node_hier_id;
 
 1762                                        if ($ctag == 
"TableData")
 
 1764                                                $this->first_col_ids[] = $node_hier_id;
 
 1765                                                if (substr($par_hier_id,strlen($par_hier_id)-2) == 
"_1")
 
 1767                                                        $this->first_row_ids[] = $node_hier_id;
 
 1770                                        if ($ctag == 
"ListItem")
 
 1772                                                $this->list_item_ids[] = $node_hier_id;
 
 1774                                        if ($ctag == 
"FileItem")
 
 1776                                                $this->file_item_ids[] = $node_hier_id;
 
 1782                                        $node_hier_id = 
"1";
 
 1783                                        $res->nodeset[$i]->set_attribute(
"HierId", $node_hier_id);
 
 1784                                        $this->hier_ids[] = $node_hier_id;
 
 1791                $path = 
"//PageObject";
 
 1793                for($i = 0; $i < count(
$res->nodeset); $i++)    
 
 1795                        $res->nodeset[$i]->set_attribute(
"HierId", 
"pg");
 
 1796                        $this->hier_ids[] = 
"pg";
 
 1806                return $this->hier_ids;
 
 1815                return $this->first_row_ids;
 
 1824                return $this->first_col_ids;
 
 1833                return $this->list_item_ids;
 
 1842                return $this->file_item_ids;
 
 1850                if(is_object($this->dom))
 
 1853                        $path = 
"//*[@HierId]";
 
 1855                        for($i = 0; $i < count(
$res->nodeset); $i++)    
 
 1857                                if (
$res->nodeset[$i]->has_attribute(
"HierId"))
 
 1859                                        $res->nodeset[$i]->remove_attribute(
"HierId");
 
 1871                if (!is_array($a_pc_ids) || count($a_pc_ids) == 0)
 
 1877                if(is_object($this->dom))
 
 1880                        $path = 
"//*[@PCID]";
 
 1882                        for($i = 0; $i < count(
$res->nodeset); $i++)    
 
 1884                                $pc_id = 
$res->nodeset[$i]->get_attribute(
"PCID");
 
 1885                                if (in_array($pc_id, $a_pc_ids))
 
 1887                                        $ret[$pc_id] = 
$res->nodeset[$i]->get_attribute(
"HierId");
 
 1903                $path = 
"//FileItem";
 
 1905                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1907                        $cnode = 
$res->nodeset[$i];
 
 1908                        $size_node = $this->dom->create_element(
"Size");
 
 1909                        $size_node = $cnode->append_child($size_node);
 
 1911                        $childs = $cnode->child_nodes();
 
 1913                        for($j = 0; $j < count($childs); $j++)
 
 1915                                if ($childs[$j]->node_name() == 
"Identifier")
 
 1917                                        if ($childs[$j]->has_attribute(
"Entry"))
 
 1919                                                $entry = $childs[$j]->get_attribute(
"Entry");
 
 1920                                                $entry_arr = explode(
"_", $entry);
 
 1921                                                $id = $entry_arr[count($entry_arr) - 1];
 
 1922                                                require_once(
"./Modules/File/classes/class.ilObjFile.php");
 
 1927                        $size_node->set_content(
$size);
 
 1942                $this->log->debug(
"start");
 
 1946                $path = 
"//IntLink";
 
 1948                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1950                        $target = 
$res->nodeset[$i]->get_attribute(
"Target");
 
 1951                        $type = 
$res->nodeset[$i]->get_attribute(
"Type");
 
 1953                        if ($a_link_map == 
null)
 
 1956                                $this->log->debug(
"no map, type: ".$type.
", target: ".
$target.
", new target: ".$new_target);
 
 1961                                $nt = explode(
"_", $a_link_map[
$target]);
 
 1962                                $new_target = 
false;
 
 1963                                if ($nt[1] == IL_INST_ID)
 
 1965                                        $new_target = 
"il__".$nt[2].
"_".$nt[3];
 
 1967                                $this->log->debug(
"map, type: ".$type.
", target: ".
$target.
", new target: ".$new_target);
 
 1969                        if ($new_target !== 
false)
 
 1971                                $res->nodeset[$i]->set_attribute(
"Target", $new_target);
 
 1977                                        IL_INST_ID > 0 && $type != 
"RepositoryItem")
 
 1982                                                $res->nodeset[$i]->set_attribute(
"Target", $new_target);
 
 1993                $path = 
"//MediaAlias";
 
 1997                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 1999                        $orig_id = 
$res->nodeset[$i]->get_attribute(
"OriginId");
 
 2000                        $id_arr = explode(
"_", $orig_id);
 
 2001                        $mob_id = $id_arr[count($id_arr) - 1];
 
 2018                $path = 
"//MediaAlias";
 
 2021                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 2024                        $old_id = 
$res->nodeset[$i]->get_attribute(
"OriginId");
 
 2025                        $old_id = explode(
"_", $old_id);
 
 2026                        $old_id = $old_id[count($old_id) - 1];
 
 2028                        if ($a_mapping[$old_id] > 0)
 
 2030                                $new_id = $a_mapping[$old_id];
 
 2031                                if ($a_reuse_existing_by_import)
 
 2035                                        $imp = explode(
"_", $import_id);
 
 2043                                        if ($import_id == 
"")
 
 2047                                                include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 2049                                                if (in_array($old_id, $med_of_def_lang))
 
 2056                                $res->nodeset[$i]->set_attribute(
"OriginId", 
"il__mob_".$new_id);
 
 2076                $path = 
"//InteractiveImage/MediaAlias";
 
 2079                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 2081                        $old_id = 
$res->nodeset[$i]->get_attribute(
"OriginId");
 
 2082                        if ($a_mapping[$old_id] > 0)
 
 2084                                $res->nodeset[$i]->set_attribute(
"OriginId", 
"il__mob_".$a_mapping[$old_id]);
 
 2104                $path = 
"//FileItem/Identifier";
 
 2107                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 2109                        $old_id = 
$res->nodeset[$i]->get_attribute(
"Entry");
 
 2110                        $old_id = explode(
"_", $old_id);
 
 2111                        $old_id = $old_id[count($old_id) - 1];
 
 2112                        if ($a_mapping[$old_id] > 0)
 
 2114                                $res->nodeset[$i]->set_attribute(
"Entry", 
"il__file_".$a_mapping[$old_id]);
 
 2132                $path = 
"//Question";
 
 2135                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 2137                        $qref = 
$res->nodeset[$i]->get_attribute(
"QRef");
 
 2139                        if (isset($a_mapping[$qref]))
 
 2141                                $res->nodeset[$i]->set_attribute(
"QRef", 
"il__qst_".$a_mapping[$qref][
"pool"]);
 
 2166                $path = 
"//IntLink";
 
 2168                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 2170                        $target = 
$res->nodeset[$i]->get_attribute(
"Target");
 
 2171                        $type = 
$res->nodeset[$i]->get_attribute(
"Type");
 
 2173                        if ($a_from_to[$obj_id] > 0 && is_int(strpos(
$target, 
"__")))
 
 2177                                        $res->nodeset[$i]->set_attribute(
"Target", 
"il__pg_".$a_from_to[$obj_id]);
 
 2182                                        $res->nodeset[$i]->set_attribute(
"Target", 
"il__st_".$a_from_to[$obj_id]);
 
 2192                $path = 
"//MediaAlias";
 
 2195                require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
 
 2196                require_once(
"Services/COPage/classes/class.ilMediaAliasItem.php");
 
 2198                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 2200                        $media_object_node = 
$res->nodeset[$i]->parent_node();
 
 2201                        $page_content_node = $media_object_node->parent_node();
 
 2202                        $c_hier_id = $page_content_node->get_attribute(
"HierId");
 
 2206                                $c_hier_id, 
"Standard");
 
 2207                        $areas = $std_alias_item->getMapAreas();
 
 2208                        $correction_needed = 
false;
 
 2209                        if (count($areas) > 0)
 
 2212                                foreach($areas as $area)
 
 2214                                        if ($area[
"Type"] == 
"PageObject" ||
 
 2215                                                $area[
"Type"] == 
"StructureObject")
 
 2217                                                $t = $area[
"Target"];
 
 2218                                                $tid = _extractObjIdOfTarget(
$t);
 
 2219                                                if ($a_from_to[$tid] > 0)
 
 2221                                                        $correction_needed = 
true;
 
 2232                                $oid = 
$res->nodeset[$i]->get_attribute(
"OriginId");
 
 2233                                if (substr($oid, 0, 4) ==
"il__")
 
 2235                                        $id_arr = explode(
"_", $oid);
 
 2236                                        $id = $id_arr[count($id_arr) - 1];
 
 2239                                        $med_item = $mob->getMediaItem(
"Standard");
 
 2240                                        $med_areas = $med_item->getMapAreas();
 
 2242                                        foreach($med_areas as $area)
 
 2244                                                $link_type = ($area->getLinkType() == 
"int")
 
 2249                                                        "Nr" => $area->getNr(),
 
 2250                                                        "Shape" => $area->getShape(),
 
 2251                                                        "Coords" => $area->getCoords(),
 
 2253                                                                "LinkType" => $link_type,
 
 2254                                                                "Href" => $area->getHref(),
 
 2255                                                                "Title" => $area->getTitle(),
 
 2256                                                                "Target" => $area->getTarget(),
 
 2257                                                                "Type" => $area->getType(),
 
 2258                                                                "TargetFrame" => $area->getTargetFrame()
 
 2262                                                if ($area->getType() == 
"PageObject" ||
 
 2263                                                        $area->getType() == 
"StructureObject")
 
 2265                                                        $t = $area->getTarget();
 
 2267                                                        if ($a_from_to[$tid] > 0)
 
 2269                                                                $correction_needed = 
true;
 
 2278                        if ($correction_needed)
 
 2281                                $std_alias_item->deleteAllMapAreas();
 
 2282                                foreach($areas as $area)
 
 2284                                        if ($area[
"Link"][
"LinkType"] == 
"IntLink")
 
 2286                                                $target = $area[
"Link"][
"Target"];
 
 2287                                                $type = $area[
"Link"][
"Type"];
 
 2289                                                if ($a_from_to[$obj_id] > 0)
 
 2293                                                                $area[
"Link"][
"Target"] = 
"il__pg_".$a_from_to[$obj_id];
 
 2297                                                                $area[
"Link"][
"Target"] = 
"il__st_".$a_from_to[$obj_id];
 
 2302                                        $std_alias_item->addMapArea($area[
"Shape"], $area[
"Coords"],
 
 2303                                                $area[
"Link"][
"Title"],
 
 2304                                                array(  
"Type" => $area[
"Link"][
"Type"],
 
 2305                                                                "TargetFrame" => $area[
"Link"][
"TargetFrame"],
 
 2306                                                                "Target" => $area[
"Link"][
"Target"],
 
 2307                                                                "Href" => $area[
"Link"][
"Href"],
 
 2308                                                                "LinkType" => $area[
"Link"][
"LinkType"],
 
 2326                include_once(
"./Services/Link/classes/class.ilInternalLink.php");
 
 2333                foreach($sources as $source)
 
 2336                        if ($source[
"type"] == 
"lm:pg")
 
 2339                                include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
 
 2340                                if (self::_exists(
"lm", $source[
"id"], $source[
"lang"]))
 
 2342                                        $page_obj = 
new ilLMPage($source[
"id"], 0, $source[
"lang"]);
 
 2343                                        if  (!$page_obj->page_not_found)
 
 2346                                                $page_obj->handleImportRepositoryLink($a_rep_import_id,
 
 2347                                                        $a_rep_type, $a_rep_ref_id);
 
 2349                                        $page_obj->update();
 
 2362                $path = 
"//IntLink";
 
 2365                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 2368                        $target = 
$res->nodeset[$i]->get_attribute(
"Target");
 
 2369                        $type = 
$res->nodeset[$i]->get_attribute(
"Type");
 
 2370                        if (
$target == $a_rep_import_id && $type == 
"RepositoryItem")
 
 2373                                $res->nodeset[$i]->set_attribute(
"Target",
 
 2374                                        "il__".$a_rep_type.
"_".$a_rep_ref_id);
 
 2391                $this->log->debug(
"Handle repository links...");
 
 2395                $path = 
"//IntLink";
 
 2397                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 2399                        $target = 
$res->nodeset[$i]->get_attribute(
"Target");
 
 2400                        $type = 
$res->nodeset[$i]->get_attribute(
"Type");
 
 2401                        $this->log->debug(
"Target: ".
$target);
 
 2403                        if ($type == 
"RepositoryItem" && ((
int) 
$t[1] == 0 || (
int) 
$t[1] == IL_INST_ID))
 
 2405                                if (isset($a_mapping[
$t[3]]))
 
 2408                                        $this->log->debug(
"... replace " . 
$t[3] . 
" with " . $a_mapping[
$t[3]] . 
".");
 
 2409                                        $res->nodeset[$i]->set_attribute(
"Target",
 
 2410                                                        "il__obj_" . $a_mapping[
$t[3]]);
 
 2412                                else if ($tree->isGrandChild($a_source_ref_id, 
$t[3]))
 
 2415                                        $this->log->debug(
"... remove links.");
 
 2416                                        if (
$res->nodeset[$i]->parent_node()->node_name() == 
"MapArea") 
 
 2418                                                $parent = 
$res->nodeset[$i]->parent_node();
 
 2419                                                $parent->unlink_node($parent);
 
 2423                                                $source_node = 
$res->nodeset[$i];
 
 2424                                                $new_node = $source_node->clone_node(
true);
 
 2425                                                $new_node->unlink_node($new_node);
 
 2426                                                $childs = $new_node->child_nodes();
 
 2427                                                for ($j = 0; $j < count($childs); $j++)
 
 2429                                                        $this->log->debug(
"... move node $j " . $childs[$j]->node_name() . 
" before " . $source_node->node_name());
 
 2430                                                        $source_node->insert_before($childs[$j], $source_node);
 
 2432                                                $source_node->unlink_node($source_node);
 
 2465                $ilDB->insert(
"page_object", array(
 
 2466                        "page_id" => array(
"integer", $this->
getId()),
 
 2467                        "parent_id" => array(
"integer", $this->
getParentId()),
 
 2469                        "content" => array(
"clob", $content),
 
 2471                        "create_user" => array(
"integer", 
$ilUser->getId()),
 
 2472                        "last_change_user" => array(
"integer", 
$ilUser->getId()),
 
 2473                        "active" => array(
"integer", (
int) $this->
getActive()),
 
 2477                        "inactive_elements" => array(
"integer", $iel),
 
 2478                        "int_links" => array(
"integer", $inl),
 
 2480                        "last_change" => array(
"timestamp", 
ilUtil::now())
 
 2501                $this->log->debug(
"ilPageObject, updateFromXML(): start, id: ".$this->
getId());
 
 2509                $this->log->debug(
"ilPageObject, updateFromXML(): content: ".substr($content, 0, 100));
 
 2517                $ilDB->update(
"page_object", array(
 
 2518                        "content" => array(
"clob", $content),
 
 2519                        "parent_id" => array(
"integer", $this->
getParentId()),
 
 2520                        "last_change_user" => array(
"integer", 
$ilUser->getId()),
 
 2521                        "last_change" => array(
"timestamp", 
ilUtil::now()),
 
 2522                        "active" => array(
"integer", $this->
getActive()),
 
 2525                        "inactive_elements" => array(
"integer", $iel),
 
 2526                        "int_links" => array(
"integer", $inl),
 
 2528                        "page_id" => array(
"integer", $this->
getId()),
 
 2536                $this->log->debug(
"ilPageObject, updateFromXML(): end");
 
 2547        protected final function __afterUpdate($a_domdoc, $a_xml, $a_creation = 
false, $a_empty = 
false)
 
 2550                if (!$a_creation || !$a_empty)
 
 2561                        include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
 
 2563                        foreach ($defs as $def)
 
 2566                                $cl = $def[
"pc_class"];
 
 2567                                call_user_func($def[
"pc_class"].
'::afterPageUpdate', $this, $a_domdoc, $a_xml, $a_creation);
 
 2593        function update($a_validate = 
true, $a_no_history = 
false)
 
 2597                $this->log->debug(
"ilPageObject, update(): start, id: ".$this->
getId());
 
 2622                        include_once(
"./Services/User/classes/class.ilUserUtil.php");
 
 2625                                1 => 
"nocontent#".
$lng->txt(
"cont_not_saved_edit_lock_expired").
"<br />".
 
 2626                                $lng->txt(
"obj_usr").
": ".
 
 2628                                $lng->txt(
"content_until").
": ".
 
 2635                        $this->log->debug(
"ilPageObject, update(): errors: ".print_r(
$errors, 
true));
 
 2652                        $old_set = 
$ilDB->query(
"SELECT * FROM page_object WHERE ".
 
 2653                                "page_id = ".
$ilDB->quote($this->getId(), 
"integer").
" AND ".
 
 2654                                "parent_type = ".$ilDB->quote($this->getParentType(), 
"text").
" AND ".
 
 2655                                "lang = ".$ilDB->quote($this->getLanguage(), 
"text"));
 
 2656                        $last_nr_set = 
$ilDB->query(
"SELECT max(nr) as mnr FROM page_history WHERE ".
 
 2657                                "page_id = ".
$ilDB->quote($this->getId(), 
"integer").
" AND ".
 
 2658                                "parent_type = ".$ilDB->quote($this->getParentType(), 
"text").
" AND ".
 
 2659                                "lang = ".$ilDB->quote($this->getLanguage(), 
"text"));
 
 2660                        $last_nr = 
$ilDB->fetchAssoc($last_nr_set);
 
 2661                        if ($old_rec = 
$ilDB->fetchAssoc($old_set))
 
 2665                                if (($content != $old_rec[
"content"] || 
$ilUser->getId() != $old_rec[
"last_change_user"]) &&
 
 2666                                        !$a_no_history && !$this->history_saved && 
$lm_set->get(
"page_history", 1))
 
 2668                                        if ($old_rec[
"content"] != 
"<PageObject></PageObject>")
 
 2670                                                $ilDB->manipulateF(
"DELETE FROM page_history WHERE ".
 
 2671                                                        "page_id = %s AND parent_type = %s AND hdate = %s AND lang = %s",
 
 2672                                                        array(
"integer", 
"text", 
"timestamp", 
"text"),
 
 2673                                                        array($old_rec[
"page_id"], $old_rec[
"parent_type"], $old_rec[
"last_change"], $old_rec[
"lang"]));
 
 2677                                                $last_c = $old_rec[
"last_change"];
 
 2683                                                $ilDB->insert(
"page_history", array(
 
 2684                                                        "page_id" =>            array(
"integer", $old_rec[
"page_id"]),
 
 2685                                                        "parent_type" =>        array(
"text", $old_rec[
"parent_type"]),
 
 2686                                                        "lang" =>       array(
"text", $old_rec[
"lang"]),
 
 2687                                                        "hdate" =>                      array(
"timestamp", $last_c),
 
 2688                                                        "parent_id" =>          array(
"integer", $old_rec[
"parent_id"]),
 
 2689                                                        "content" =>            array(
"clob", $old_rec[
"content"]),
 
 2690                                                        "user_id" =>            array(
"integer", $old_rec[
"last_change_user"]),
 
 2692                                                        "nr" =>                         array(
"integer", (
int) $last_nr[
"mnr"] + 1)
 
 2695                                                $old_content = $old_rec[
"content"];
 
 2696                                                $old_domdoc = 
new DOMDocument();
 
 2697                                                $old_nr = $last_nr[
"mnr"] + 1;
 
 2698                                                $old_domdoc->loadXML(
'<?xml version="1.0" encoding="UTF-8"?>'.$old_content);
 
 2703                                                $this->history_saved = 
true;            
 
 2707                                                $this->history_saved = 
true;            
 
 2712                        $em = (trim($content) == 
"<PageObject/>")
 
 2720                        $ilDB->update(
"page_object", array(
 
 2721                                "content" => array(
"clob", $content),
 
 2722                                "parent_id" => array(
"integer", $this->
getParentId()),
 
 2723                                "last_change_user" => array(
"integer", 
$ilUser->getId()),
 
 2724                                "last_change" => array(
"timestamp", 
ilUtil::now()),
 
 2725                                "is_empty" => array(
"integer", $em),
 
 2726                                "active" => array(
"integer", $this->
getActive()),
 
 2730                                "inactive_elements" => array(
"integer", $iel),
 
 2731                                "int_links" => array(
"integer", $inl),
 
 2733                                "page_id" => array(
"integer", $this->
getId()),
 
 2741                        $this->log->debug(
"ilPageObject, update(): updated and returning true, content: ".substr($this->
getXMLContent(), 0, 100));
 
 2762                $copg_logger->debug(
"ilPageObject: Delete called for ID '".$this->
getId().
"',".
 
 2764                        " hist nr: '".$this->old_nr.
"', ".
 
 2765                        " lang: '".$this->getLanguage().
"', " 
 2771                if (!$this->page_not_found)
 
 2776                include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 2778                foreach ($mobs2 as $m)
 
 2780                        if (!in_array($m, 
$mobs))
 
 2786                $copg_logger->debug(
"ilPageObject: ... found ".count(
$mobs).
" media objects.");
 
 2800                include_once(
"./Services/News/classes/class.ilNewsItem.php");
 
 2805                $ilDB->manipulate(
"DELETE FROM page_object ".
 
 2806                        "WHERE page_id = ".
$ilDB->quote($this->getId(), 
"integer").
 
 2807                        " AND parent_type= ".$ilDB->quote($this->getParentType(), 
"text"));
 
 2811                foreach (
$mobs as $mob_id)
 
 2813                        $copg_logger->debug(
"ilPageObject: ... processing mob ".$mob_id.
".");
 
 2817                                $copg_logger->debug(
"ilPageObject: ... type mismatch. Ignoring mob ".$mob_id.
".");
 
 2823                                $copg_logger->debug(
"ilPageObject: ... delete mob ".$mob_id.
".");
 
 2830                                $copg_logger->debug(
"ilPageObject: ... missing mob ".$mob_id.
".");
 
 2857                include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
 
 2859                foreach ($defs as $def)
 
 2862                        $cl = $def[
"pc_class"];
 
 2863                        call_user_func($def[
"pc_class"].
'::beforePageDelete', $this);
 
 2878                include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
 
 2880                foreach ($defs as $def)
 
 2883                        $cl = $def[
"pc_class"];
 
 2884                        call_user_func($def[
"pc_class"].
'::afterPageHistoryEntry', $this, $a_old_domdoc, $a_old_content, $a_old_nr);
 
 2898                $xpath = 
new DOMXPath($a_domdoc);
 
 2899                $path = 
"//Paragraph | //Section | //MediaAlias | //FileItem".
 
 2900                        " | //Table | //TableData | //Tabs | //List";
 
 2901                $nodes = $xpath->query(
$path);  
 
 2903                foreach($nodes as 
$node)
 
 2905                        switch (
$node->localName)
 
 2908                                        $sname = 
$node->getAttribute(
"Characteristic");
 
 2909                                        $stype = 
"text_block";
 
 2914                                        $sname = 
$node->getAttribute(
"Characteristic");
 
 2920                                        $sname = 
$node->getAttribute(
"Class");
 
 2921                                        $stype = 
"media_cont";
 
 2926                                        $sname = 
$node->getAttribute(
"Class");
 
 2927                                        $stype = 
"flist_li";
 
 2932                                        $sname = 
$node->getAttribute(
"Template");
 
 2935                                                $sname = 
$node->getAttribute(
"Class");
 
 2947                                        $sname = 
$node->getAttribute(
"Class");
 
 2948                                        $stype = 
"table_cell";
 
 2953                                        $sname = 
$node->getAttribute(
"Template");
 
 2956                                                if (
$node->getAttribute(
"Type") == 
"HorizontalAccordion")
 
 2958                                                        $stype = 
"haccordion";
 
 2960                                                if (
$node->getAttribute(
"Type") == 
"VerticalAccordion")
 
 2962                                                        $stype = 
"vaccordion";
 
 2969                                        $sname = 
$node->getAttribute(
"Class");
 
 2970                                        if (
$node->getAttribute(
"Type") == 
"Ordered")
 
 2981                        if ($sname != 
"" &&  $stype != 
"")
 
 2983                                $usages[$sname.
":".$stype.
":".$template] = array(
"sname" => $sname,
 
 2984                                        "stype" => $stype, 
"template" => $template);
 
 2991                foreach ($usages as $u)
 
 2993                        $id = 
$ilDB->nextId(
'page_style_usage');
 
 2995                        $ilDB->manipulate(
"INSERT INTO page_style_usage ".
 
 2996                                "(id, page_id, page_type, page_lang, page_nr, template, stype, sname) VALUES (".
 
 2998                            $ilDB->quote($this->getId(), 
"integer").
",".
 
 2999                                $ilDB->quote($this->getParentType(), 
"text").
",".
 
 3000                                $ilDB->quote($this->getLanguage(), 
"text").
",".
 
 3001                                $ilDB->quote($a_old_nr, 
"integer").
",".
 
 3002                                $ilDB->quote($u[
"template"], 
"integer").
",".
 
 3003                                $ilDB->quote($u[
"stype"], 
"text").
",".
 
 3004                                $ilDB->quote($u[
"sname"], 
"text").
 
 3019                if ($a_old_nr !== 
false)
 
 3021                        $and_old_nr = 
" AND page_nr = ".$ilDB->quote($a_old_nr, 
"integer");
 
 3024                $ilDB->manipulate(
"DELETE FROM page_style_usage WHERE ".
 
 3025                        " page_id = ".
$ilDB->quote($this->getId(), 
"integer").
 
 3026                        " AND page_type = ".$ilDB->quote($this->getParentType(), 
"text").
 
 3027                        " AND page_lang = ".$ilDB->quote($this->getLanguage(), 
"text").
 
 3040                include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 3041                include_once(
"./Modules/File/classes/class.ilObjFile.php");
 
 3058                include_once(
"./Services/Link/classes/class.ilInternalLink.php");
 
 3077                $xpath = 
new DOMXPath($a_domdoc);
 
 3078                $nodes = $xpath->query(
'//IntLink');
 
 3079                foreach($nodes as 
$node)
 
 3081                        $link_type = 
$node->getAttribute(
"Type");
 
 3085                                case "StructureObject":
 
 3093                                case "GlossaryItem":
 
 3101                                case "RepositoryItem":
 
 3123                        if (is_int(strpos(
$target, 
"__")))
 
 3158                $curr_node->unlink_node($curr_node);
 
 3175                if (!is_array($a_hids))
 
 3179                foreach($a_hids as $a_hid)
 
 3181                        $a_hid = explode(
":", $a_hid);
 
 3186                        if (!$this->
checkForTag(
"Question", $a_hid[0], $a_hid[1]) || $a_self_ass)
 
 3189                                if (is_object($curr_node))
 
 3191                                        $parent_node = $curr_node->parent_node();
 
 3192                                        if ($parent_node->node_name() != 
"TableRow")
 
 3194                                                $curr_node->unlink_node($curr_node);
 
 3225                if (!is_array($a_hids))
 
 3230                $time = 
date(
"Y-m-d H:i:s", time());
 
 3232                $hier_ids = array();
 
 3234                foreach($a_hids as $a_hid)
 
 3240                        $a_hid = explode(
":", $a_hid);
 
 3244                        foreach($hier_ids as 
$h)
 
 3246                                if(
$h.
"_" == substr($a_hid[0], 0, strlen(
$h) + 1))
 
 3248                                        $skip[] = $a_hid[0];
 
 3250                                if($a_hid[0].
"_" == substr(
$h, 0, strlen($a_hid[0]) + 1))
 
 3255                        $pc_id[$a_hid[0]] = $a_hid[1];
 
 3256                        if ($a_hid[0] != 
"")
 
 3258                                $hier_ids[$a_hid[0]] = $a_hid[0];
 
 3261                foreach ($skip as $s)
 
 3263                        unset($hier_ids[$s]);
 
 3265                include_once(
"./Services/COPage/classes/class.ilPageContent.php");
 
 3268                foreach($hier_ids as $hid)
 
 3271                        if (is_object($curr_node))
 
 3273                                if ($curr_node->node_name() == 
"PageContent")
 
 3275                                        $content = $this->dom->dump_node($curr_node);
 
 3277                                        $content = preg_replace(
'/PCID=\"[a-z0-9]*\"/i',
"",$content);
 
 3278                                        $content = preg_replace(
'/HierId=\"[a-z0-9_]*\"/i',
"",$content);
 
 3280                                        $ilUser->addToPCClipboard($content, $time, $nr);
 
 3285                include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
 
 3296                $a_hid = explode(
":", $a_hier_id);
 
 3297                $content = 
$ilUser->getPCClipboardContent();
 
 3301                for ($i = count($content) - 1; $i >= 0; $i--)
 
 3305                        $temp_dom = 
domxml_open_mem(
'<?xml version="1.0" encoding="UTF-8"?>'.$c,
 
 3306                                DOMXML_LOAD_PARSING, 
$error);
 
 3311                                $path = 
"//PageContent";
 
 3313                                if (count(
$res->nodeset) > 0)
 
 3315                                        $new_pc_node = 
$res->nodeset[0];
 
 3316                                        $cloned_pc_node = $new_pc_node->clone_node (
true);
 
 3317                                        $cloned_pc_node->unlink_node ($cloned_pc_node);
 
 3336                if (!is_array($a_hids))
 
 3340                $obj = & $this->content_obj;
 
 3342                foreach($a_hids as $a_hid)
 
 3344                        $a_hid = explode(
":", $a_hid);
 
 3346                        if (is_object($curr_node))
 
 3348                                if ($curr_node->node_name() == 
"PageContent")
 
 3351                                        if ($cont_obj->isEnabled ())
 
 3354                                                if (!$this->
checkForTag(
"Question", $a_hid[0], $a_hid[1]) || $a_self_ass)
 
 3356                                                        $cont_obj->disable();
 
 3361                                                $cont_obj->enable();
 
 3386                foreach ($hier_ids as $hier_id)
 
 3389                        if (!is_int(strpos($hier_id, 
"_")))
 
 3391                                if ($hier_id != 
"pg" && $hier_id >= $a_hid)
 
 3394                                        $curr_node->unlink_node($curr_node);
 
 3416                foreach ($hier_ids as $hier_id)
 
 3419                        if (!is_int(strpos($hier_id, 
"_")))
 
 3421                                if ($hier_id != 
"pg" && $hier_id < $a_hid)
 
 3424                                        $curr_node->unlink_node($curr_node);
 
 3444                $hier_ids = $a_source_page->getHierIds();
 
 3446                $copy_ids = array();
 
 3449                foreach ($hier_ids as $hier_id)
 
 3452                        if (!is_int(strpos($hier_id, 
"_")))
 
 3454                                if ($hier_id != 
"pg" && $hier_id >= $a_hid)
 
 3456                                        $copy_ids[] = $hier_id;
 
 3462                $parent_node = $a_target_page->getContentNode(
"pg");
 
 3463                $target_dom = $a_target_page->getDom();
 
 3464                $parent_childs = $parent_node->child_nodes();
 
 3465                $cnt_parent_childs = count($parent_childs);
 
 3467                $first_child = $parent_childs[0];
 
 3468                foreach($copy_ids as $copy_id)
 
 3470                        $source_node = $a_source_page->getContentNode($copy_id);
 
 3472                        $new_node = $source_node->clone_node(
true);
 
 3473                        $new_node->unlink_node($new_node);
 
 3475                        $source_node->unlink_node($source_node);
 
 3477                        if($cnt_parent_childs == 0)
 
 3479                                $new_node = $parent_node->append_child($new_node);
 
 3484                                $new_node = $first_child->insert_before($new_node, $first_child);
 
 3486                        $parent_childs = $parent_node->child_nodes();
 
 3491                $a_target_page->update();
 
 3492                $a_source_page->update();
 
 3504                $curr_name = $curr_node->node_name();
 
 3507                if (($curr_name == 
"TableData") || ($curr_name == 
"PageObject") ||
 
 3508                        ($curr_name == 
"ListItem") || ($curr_name == 
"Section")
 
 3509                        || ($curr_name == 
"Tab") || ($curr_name == 
"ContentPopup"))
 
 3514                $hid = $curr_node->get_attribute(
"HierId");
 
 3523                        $pos = explode(
"_", $a_pos);
 
 3524                        $target_pos = array_pop($pos);
 
 3525                        $parent_pos = implode($pos, 
"_");
 
 3529                        $parent_pos = $a_pos;
 
 3533                if($parent_pos != 
"")
 
 3539                        $parent_node = $this->
getNode();
 
 3543                $parent_childs = $parent_node->child_nodes();
 
 3544                $cnt_parent_childs = count($parent_childs);
 
 3550                                $new_node = $a_cont_obj->getNode();
 
 3554                                if($succ_node = $curr_node->next_sibling())
 
 3556                                        $new_node = $succ_node->insert_before($new_node, $succ_node);
 
 3561                                        $new_node = $parent_node->append_child($new_node);
 
 3563                                $a_cont_obj->setNode($new_node);
 
 3568                                $new_node = $a_cont_obj->getNode();
 
 3570                                $new_node = $succ_node->insert_before($new_node, $succ_node);
 
 3571                                $a_cont_obj->setNode($new_node);
 
 3577                                $new_node = $a_cont_obj->getNode();
 
 3578                                if($cnt_parent_childs == 0)
 
 3580                                        $new_node = $parent_node->append_child($new_node);
 
 3584                                        $new_node = $parent_childs[0]->insert_before($new_node, $parent_childs[0]);
 
 3586                                $a_cont_obj->setNode($new_node);
 
 3592                if (!$this->
getPageConfig()->getEnablePCType(
"PlaceHolder")) {
 
 3593                        $sub_nodes = $curr_node->child_nodes() ;
 
 3594                        foreach ( $sub_nodes as $sub_node ) {
 
 3595                                if ($sub_node->node_name() == 
"PlaceHolder") {
 
 3596                                        $curr_node->unlink_node();
 
 3609                $curr_name = $curr_node->node_name();
 
 3612                if (($curr_name == 
"TableData") || ($curr_name == 
"PageObject") ||
 
 3613                        ($curr_name == 
"ListItem") || ($curr_name == 
"Section")
 
 3614                        || ($curr_name == 
"Tab") || ($curr_name == 
"ContentPopup"))
 
 3619                $hid = $curr_node->get_attribute(
"HierId");
 
 3627                        $pos = explode(
"_", $a_pos);
 
 3628                        $target_pos = array_pop($pos);
 
 3629                        $parent_pos = implode($pos, 
"_");
 
 3633                        $parent_pos = $a_pos;
 
 3637                if($parent_pos != 
"")
 
 3643                        $parent_node = $this->
getNode();
 
 3647                $parent_childs = $parent_node->child_nodes();
 
 3648                $cnt_parent_childs = count($parent_childs);
 
 3655                                if($succ_node = $curr_node->next_sibling())
 
 3657                                        $a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
 
 3661                                        $a_cont_node = $parent_node->append_child($a_cont_node);
 
 3669                                $a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
 
 3676                                if($cnt_parent_childs == 0)
 
 3678                                        $a_cont_node = $parent_node->append_child($a_cont_node);
 
 3682                                        $a_cont_node = $parent_childs[0]->insert_before($a_cont_node, $parent_childs[0]);
 
 3695                if($a_source == $a_target)
 
 3702                $source_node = $content->getNode();
 
 3703                $clone_node = $source_node->clone_node(
true);
 
 3709                $content->setNode($clone_node);
 
 3721                if($a_source == $a_target)
 
 3728                $source_node = $content->getNode();
 
 3729                $clone_node = $source_node->clone_node(
true);
 
 3735                $content->setNode($clone_node);
 
 3762                $path = 
"//IntLink";
 
 3764                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 3766                        $target = 
$res->nodeset[$i]->get_attribute(
"Target");
 
 3767                        $type = 
$res->nodeset[$i]->get_attribute(
"Type");
 
 3769                        if (substr(
$target, 0, 4) == 
"il__")
 
 3775                                if ($a_res_ref_to_obj_id && $type == 
"RepositoryItem")
 
 3777                                        $id_arr = explode(
"_", 
$id);
 
 3796                                $new_target = 
"il_".$a_inst.
"_".
$id;
 
 3797                                $res->nodeset[$i]->set_attribute(
"Target", $new_target);
 
 3806                $path = 
"//MediaAlias";
 
 3808                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 3810                        $origin_id = 
$res->nodeset[$i]->get_attribute(
"OriginId");
 
 3811                        if (substr($origin_id, 0, 4) == 
"il__")
 
 3813                                $new_id = 
"il_".$a_inst.
"_".substr($origin_id, 4, strlen($origin_id) - 4);
 
 3814                                $res->nodeset[$i]->set_attribute(
"OriginId", $new_id);
 
 3821                $path = 
"//FileItem/Identifier";
 
 3823                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 3825                        $origin_id = 
$res->nodeset[$i]->get_attribute(
"Entry");
 
 3826                        if (substr($origin_id, 0, 4) == 
"il__")
 
 3828                                $new_id = 
"il_".$a_inst.
"_".substr($origin_id, 4, strlen($origin_id) - 4);
 
 3829                                $res->nodeset[$i]->set_attribute(
"Entry", $new_id);
 
 3836                $path = 
"//Question";
 
 3838                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 3840                        $qref = 
$res->nodeset[$i]->get_attribute(
"QRef");
 
 3842                        if (substr($qref, 0, 4) == 
"il__")
 
 3844                                $new_id = 
"il_".$a_inst.
"_".substr($qref, 4, strlen($qref) - 4);
 
 3846                                $res->nodeset[$i]->set_attribute(
"QRef", $new_id);
 
 3853                $path = 
"//ContentInclude";
 
 3855                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 3857                        $ci = 
$res->nodeset[$i]->get_attribute(
"InstId");
 
 3860                                $res->nodeset[$i]->set_attribute(
"InstId", $a_inst);
 
 3876                foreach ($this->id_elements as $el)
 
 3878                        $path.= $sep.
"//".$el.
"[not(@PCID)]";
 
 3880                        $path.= $sep.
"//".$el.
"[@PCID='']";
 
 3886                if (count (
$res->nodeset) > 0)
 
 3907                foreach ($this->id_elements as $el)
 
 3909                        $path.= $sep.
"//".$el.
"[@PCID]";
 
 3917                for ($i = 0; $i < count (
$res->nodeset); $i++)
 
 3920                        $pcids[] = 
$node->get_attribute(
"PCID");
 
 3939                foreach ($this->id_elements as $el)
 
 3941                        $path.= $sep.
"//".$el.
"[@PCID='".$a_pc_id.
"']";
 
 3948                return (count(
$res->nodeset) > 0);
 
 3959                if ($a_pc_ids === 
false)
 
 3963                $id = ilUtil::randomHash(10, $a_pc_ids);
 
 3980                foreach ($this->id_elements as $el)
 
 3982                        $path.= $sep.
"//".$el.
"[not(@PCID)]";
 
 3984                        $path.= $sep.
"//".$el.
"[@PCID='']";
 
 3990                for ($i = 0; $i < count (
$res->nodeset); $i++)
 
 3993                        $id = ilUtil::randomHash(10, $pcids);
 
 3996                        $res->nodeset[$i]->set_attribute(
"PCID", 
$id);
 
 4006                $this->addHierIds();
 
 4010                $path = 
"//PageContent";
 
 4015                require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
 
 4016                for ($i = 0; $i < count (
$res->nodeset); $i++)
 
 4018                        $hier_id = 
$res->nodeset[$i]->get_attribute(
"HierId");
 
 4019                        $pc_id = 
$res->nodeset[$i]->get_attribute(
"PCID");
 
 4020                        $dump = $mydom->dump_node(
$res->nodeset[$i]);
 
 4021                        if (($hpos = strpos($dump, 
' HierId="'.$hier_id.
'"')) > 0)
 
 4023                                $dump = substr($dump, 0, $hpos).
 
 4024                                        substr($dump, $hpos + strlen(
' HierId="'.$hier_id.
'"'));
 
 4027                        $childs = 
$res->nodeset[$i]->child_nodes();
 
 4029                        if ($childs[0] && $childs[0]->node_name() == 
"Paragraph")
 
 4031                                $content = $mydom->dump_node($childs[0]);
 
 4032                                $content = substr($content, strpos($content, 
">") + 1,
 
 4033                                        strrpos($content, 
"<") - (strpos($content, 
">") + 1));
 
 4041                                array(
"hier_id" => $hier_id, 
"hash" => md5($dump), 
"content" => $content);
 
 4057                $path = 
"//Question";
 
 4062                include_once(
"./Services/Link/classes/class.ilInternalLink.php");
 
 4063                for ($i = 0; $i < count (
$res->nodeset); $i++)
 
 4065                        $qref = 
$res->nodeset[$i]->get_attribute(
"QRef");
 
 4070                        if (!($inst_id > 0))
 
 4092                $path = 
"/descendant::Paragraph[position() = $par_id]";
 
 4096                if (count (
$res->nodeset) != 1)
 
 4097                        die (
"Should not happen");
 
 4099                $context_node = 
$res->nodeset[0];
 
 4103                $childs = $context_node->child_nodes();
 
 4105                for($j=0; $j<count($childs); $j++)
 
 4107                        $content .= $mydom->dump_node($childs[$j]);
 
 4110                $content = str_replace(
"<br />", 
"\n", $content);
 
 4111                $content = str_replace(
"<br/>", 
"\n", $content);
 
 4113                $plain_content = html_entity_decode($content);
 
 4131                $xsl = file_get_contents(
"./Services/COPage/xsl/page_fo.xsl");
 
 4132                $args = array( 
'/_xml' => 
$xml, 
'/_xsl' => $xsl );
 
 4138                $fo = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl",NULL,$args, 
$params);
 
 4141                $fo = str_replace(
"\n", 
"", $fo);
 
 4142                $fo = str_replace(
"<br/>", 
"<br>", $fo);
 
 4143                $fo = str_replace(
"<br>", 
"\n", $fo);
 
 4148                $fo = substr($fo, strpos($fo,
">") + 1);
 
 4154                $this->offline_handler = $handler;
 
 4181                $query = 
"SELECT * FROM page_object WHERE page_id = ".
 
 4182                        $ilDB->quote($a_id, 
"integer").
" AND ".
 
 4183                        " parent_type = ".$ilDB->quote($a_parent_type, 
"text").
" AND ".
 
 4184                        " lang = ".$ilDB->quote($a_lang, 
"text").
" AND ".
 
 4185                        " inactive_elements = ".$ilDB->quote(1, 
"integer");
 
 4204                if (strpos(
$a_content,  
" Enabled=\"False\""))
 
 4218                $h_query = 
"SELECT * FROM page_history ".
 
 4219                        " WHERE page_id = ".$ilDB->quote($this->
getId(), 
"integer").
 
 4220                        " AND parent_type = ".$ilDB->quote($this->
getParentType(), 
"text").
 
 4221                        " AND lang = ".$ilDB->quote($this->
getLanguage(), 
"text").
 
 4222                        " ORDER BY hdate DESC";
 
 4224                $hset = 
$ilDB->query($h_query);
 
 4225                $hentries = array();
 
 4227                while ($hrec = 
$ilDB->fetchAssoc($hset))
 
 4229                        $hrec[
"sortkey"] = (int) $hrec[
"nr"];
 
 4230                        $hrec[
"user"] = (int) $hrec[
"user_id"];
 
 4231                        $hentries[] = $hrec;
 
 4244                $res = 
$ilDB->queryF(
"SELECT * FROM page_history ".
 
 4245                        " WHERE page_id = %s ".
 
 4246                        " AND parent_type = %s ".
 
 4249                        array(
"integer", 
"text", 
"integer", 
"text"),
 
 4271                $and_nr = ($a_nr > 0)
 
 4272                        ? 
" AND nr < ".
$ilDB->quote((
int) $a_nr, 
"integer")
 
 4274                $res = 
$ilDB->query(
"SELECT MAX(nr) mnr FROM page_history ".
 
 4275                        " WHERE page_id = ".
$ilDB->quote($this->getId(), 
"integer").
 
 4276                        " AND parent_type = ".$ilDB->quote($this->
getParentType(), 
"text").
 
 4277                        " AND lang = ".$ilDB->quote($this->
getLanguage(), 
"text").
 
 4280                if (
$row[
"mnr"] > 0)
 
 4282                        $res = 
$ilDB->query(
"SELECT * FROM page_history ".
 
 4283                                " WHERE page_id = ".
$ilDB->quote($this->getId(), 
"integer").
 
 4284                                " AND parent_type = ".$ilDB->quote($this->
getParentType(), 
"text").
 
 4285                                " AND lang = ".$ilDB->quote($this->
getLanguage(), 
"text").
 
 4286                                " AND nr = ".$ilDB->quote((
int) 
$row[
"mnr"], 
"integer"));
 
 4292                $res = 
$ilDB->query(
"SELECT MIN(nr) mnr FROM page_history ".
 
 4293                        " WHERE page_id = ".
$ilDB->quote($this->getId(), 
"integer").
 
 4294                        " AND parent_type = ".$ilDB->quote($this->
getParentType(), 
"text").
 
 4295                        " AND lang = ".$ilDB->quote($this->
getLanguage(), 
"text").
 
 4296                        " AND nr > ".$ilDB->quote((
int) $a_nr, 
"integer"));
 
 4298                if (
$row[
"mnr"] > 0)
 
 4300                        $res = 
$ilDB->query(
"SELECT * FROM page_history ".
 
 4301                                " WHERE page_id = ".
$ilDB->quote($this->getId(), 
"integer").
 
 4302                                " AND parent_type = ".$ilDB->quote($this->
getParentType(), 
"text").
 
 4303                                " AND lang = ".$ilDB->quote($this->
getLanguage(), 
"text").
 
 4304                                " AND nr = ".$ilDB->quote((
int) 
$row[
"mnr"], 
"integer"));
 
 4312                        $res = 
$ilDB->query(
"SELECT * FROM page_history ".
 
 4313                                " WHERE page_id = ".
$ilDB->quote($this->getId(), 
"integer").
 
 4314                                " AND parent_type = ".$ilDB->quote($this->
getParentType(), 
"text").
 
 4315                                " AND lang = ".$ilDB->quote($this->
getLanguage(), 
"text").
 
 4316                                " AND nr = ".$ilDB->quote((
int) $a_nr, 
"integer"));
 
 4321                        $res = 
$ilDB->query(
"SELECT page_id, last_change hdate, parent_type, parent_id, last_change_user user_id, content, lang FROM page_object ".
 
 4322                                " WHERE page_id = ".
$ilDB->quote($this->getId(), 
"integer").
 
 4323                                " AND parent_type = ".$ilDB->quote($this->
getParentType(), 
"text").
 
 4324                                " AND lang = ".$ilDB->quote($this->
getLanguage(), 
"text"));
 
 4337                $rnode = 
$res->nodeset[0];
 
 4340                foreach($a_hashes as $pc_id => 
$h)
 
 4343                        if (
$h[
"change"] != 
"")
 
 4345                                $dc_node = $this->dom->create_element(
"DivClass");
 
 4346                                $dc_node->set_attribute(
"HierId", 
$h[
"hier_id"]);
 
 4347                                $dc_node->set_attribute(
"Class", 
"ilEdit".
$h[
"change"]);
 
 4348                                $dc_node = $rnode->append_child($dc_node);
 
 4363                include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
 
 4367                $l_hashes = $l_page->getPageContentsHashes();
 
 4368                $r_hashes = $r_page->getPageContentsHashes();
 
 4370                foreach ($l_hashes as $pc_id => 
$h)
 
 4372                        if (!isset($r_hashes[$pc_id]))
 
 4374                                $l_hashes[$pc_id][
"change"] = 
"Deleted";
 
 4378                                if ($l_hashes[$pc_id][
"hash"] != $r_hashes[$pc_id][
"hash"])
 
 4380                                        $l_hashes[$pc_id][
"change"] = 
"Modified";
 
 4381                                        $r_hashes[$pc_id][
"change"] = 
"Modified";
 
 4383                                        include_once(
"./Services/COPage/mediawikidiff/class.WordLevelDiff.php");
 
 4385                                        if ($l_hashes[$pc_id][
"content"] != 
"" &&
 
 4386                                                $r_hashes[$pc_id][
"content"] != 
"")
 
 4388                                                $new_left = str_replace(
"\n", 
"<br />", $l_hashes[$pc_id][
"content"]);
 
 4389                                                $new_right = str_replace(
"\n", 
"<br />", $r_hashes[$pc_id][
"content"]);
 
 4392                                                $new_left = $wldiff->orig();
 
 4393                                                $new_right = $wldiff->closing();
 
 4394                                                $l_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_left[0]);
 
 4395                                                $r_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_right[0]);
 
 4402                foreach ($r_hashes as $pc_id => 
$h)
 
 4404                        if (!isset($l_hashes[$pc_id]))
 
 4406                                $r_hashes[$pc_id][
"change"] = 
"New";
 
 4409                $l_page->addChangeDivClasses($l_hashes);
 
 4410                $r_page->addChangeDivClasses($r_hashes);
 
 4412                return array(
"l_page" => $l_page, 
"r_page" => $r_page,
 
 4413                        "l_changes" => $l_hashes, 
"r_changes" => $r_hashes);
 
 4423                $ilDB->manipulate(
"UPDATE page_object ".
 
 4424                        " SET view_cnt = view_cnt + 1 ".
 
 4425                        " WHERE page_id = ".
$ilDB->quote($this->getId(), 
"integer").
 
 4426                        " AND parent_type = ".$ilDB->quote($this->getParentType(), 
"text").
 
 4427                        " AND lang = ".$ilDB->quote($this->getLanguage(), 
"text"));
 
 4444                        $and_lang = 
" AND lang = ".$ilDB->quote($a_lang, 
"text");
 
 4447                $page_changes = array();
 
 4448                $limit_ts = 
date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
 
 4449                $q = 
"SELECT * FROM page_object ".
 
 4450                        " WHERE parent_id = ".$ilDB->quote($a_parent_id, 
"integer").
 
 4451                        " AND parent_type = ".$ilDB->quote($a_parent_type, 
"text").
 
 4452                        " AND last_change >= ".$ilDB->quote($limit_ts, 
"timestamp").$and_lang;
 
 4454                $set = 
$ilDB->query($q);
 
 4455                while($page = 
$ilDB->fetchAssoc($set))
 
 4457                        $page_changes[] = array(
 
 4458                                "date" => $page[
"last_change"],
 
 4459                                "id" => $page[
"page_id"],
 
 4460                                "lang" => $page[
"lang"],
 
 4462                                "user" => $page[
"last_change_user"]);
 
 4468                        $limit_ts = 
date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
 
 4469                        $and_str = 
" AND hdate >= ".$ilDB->quote($limit_ts, 
"timestamp").
" ";
 
 4472                $q = 
"SELECT * FROM page_history ".
 
 4473                        " WHERE parent_id = ".$ilDB->quote($a_parent_id, 
"integer").
 
 4474                        " AND parent_type = ".$ilDB->quote($a_parent_type, 
"text").
 
 4476                $set = 
$ilDB->query($q);
 
 4477                while ($page = 
$ilDB->fetchAssoc($set))
 
 4479                        $page_changes[] = array(
 
 4480                                "date" => $page[
"hdate"],
 
 4481                                "id" => $page[
"page_id"],
 
 4482                                "lang" => $page[
"lang"],
 
 4484                                "nr" => $page[
"nr"],
 
 4485                                "user" => $page[
"user_id"]);
 
 4490                return $page_changes;
 
 4500        static function getAllPages($a_parent_type, $a_parent_id, $a_lang = 
"-")
 
 4507                        $and_lang = 
" AND lang = ".$ilDB->quote($a_lang, 
"text");
 
 4510                $page_changes = array();
 
 4512                $q = 
"SELECT * FROM page_object ".
 
 4513                        " WHERE parent_id = ".$ilDB->quote($a_parent_id, 
"integer").
 
 4514                        " AND parent_type = ".$ilDB->quote($a_parent_type, 
"text").$and_lang;
 
 4515                $set = 
$ilDB->query($q);
 
 4517                while ($page = 
$ilDB->fetchAssoc($set))
 
 4519                        $key_add = ($a_lang == 
"")
 
 4522                        $pages[$page[
"page_id"].$key_add] = array(
 
 4523                                "date" => $page[
"last_change"],
 
 4524                                "id" => $page[
"page_id"],
 
 4525                                "lang" => $page[
"lang"],
 
 4526                                "user" => $page[
"last_change_user"]);
 
 4538        static function getNewPages($a_parent_type, $a_parent_id, $a_lang = 
"-")
 
 4545                        $and_lang = 
" AND lang = ".$ilDB->quote($a_lang, 
"text");
 
 4550                $q = 
"SELECT * FROM page_object ".
 
 4551                        " WHERE parent_id = ".$ilDB->quote($a_parent_id, 
"integer").
 
 4552                        " AND parent_type = ".$ilDB->quote($a_parent_type, 
"text").$and_lang.
 
 4553                        " ORDER BY created DESC";
 
 4554                $set = 
$ilDB->query($q);
 
 4555                while($page = 
$ilDB->fetchAssoc($set))
 
 4557                        if ($page[
"created"] != 
"")
 
 4560                                        "created" => $page[
"created"],
 
 4561                                        "id" => $page[
"page_id"],
 
 4562                                        "lang" => $page[
"lang"],
 
 4563                                        "user" => $page[
"create_user"],
 
 4584                        $and_lang = 
" AND lang = ".$ilDB->quote($a_lang, 
"text");
 
 4587                $contributors = array();
 
 4588                $set = 
$ilDB->queryF(
"SELECT last_change_user, lang, page_id FROM page_object ".
 
 4589                        " WHERE parent_id = %s AND parent_type = %s ".
 
 4590                        " AND last_change_user != %s".$and_lang,
 
 4591                        array(
"integer", 
"text", 
"integer"),
 
 4592                        array($a_parent_id, $a_parent_type, 0));
 
 4594                while ($page = 
$ilDB->fetchAssoc($set))
 
 4598                                $contributors[$page[
"last_change_user"]][$page[
"page_id"]][$page[
"lang"]] = 1;
 
 4602                                $contributors[$page[
"last_change_user"]][$page[
"page_id"]] = 1;
 
 4606                $set = 
$ilDB->queryF(
"SELECT count(*) as cnt, lang, page_id, user_id FROM page_history ".
 
 4607                        " WHERE parent_id = %s AND parent_type = %s AND user_id != %s ".$and_lang.
 
 4608                        " GROUP BY page_id, user_id, lang ",
 
 4609                        array(
"integer", 
"text", 
"integer"),
 
 4610                        array($a_parent_id, $a_parent_type, 0));
 
 4611                while ($hpage = 
$ilDB->fetchAssoc($set))
 
 4615                                $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]][$hpage[
"lang"]] =
 
 4616                                        $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]][$hpage[
"lang"]] + $hpage[
"cnt"];
 
 4620                                $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] =
 
 4621                                        $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] + $hpage[
"cnt"];
 
 4626                foreach ($contributors as $k => $co)
 
 4631                                $c[] = array(
"user_id" => $k, 
"pages" => $co,
 
 4632                                        "lastname" => $name[
"lastname"], 
"firstname" => $name[
"firstname"]);
 
 4652                        $and_lang = 
" AND lang = ".$ilDB->quote($a_lang, 
"text");
 
 4655                $contributors = array();
 
 4656                $set = 
$ilDB->queryF(
"SELECT last_change_user, lang FROM page_object ".
 
 4657                        " WHERE page_id = %s AND parent_type = %s ".
 
 4658                        " AND last_change_user != %s".$and_lang,
 
 4659                        array(
"integer", 
"text", 
"integer"),
 
 4660                        array($a_page_id, $a_parent_type, 0));
 
 4662                while ($page = 
$ilDB->fetchAssoc($set))
 
 4666                                $contributors[$page[
"last_change_user"]][$page[
"lang"]] = 1;
 
 4670                                $contributors[$page[
"last_change_user"]] = 1;
 
 4674                $set = 
$ilDB->queryF(
"SELECT count(*) as cnt, lang, page_id, user_id FROM page_history ".
 
 4675                        " WHERE page_id = %s AND parent_type = %s AND user_id != %s ".$and_lang.
 
 4676                        " GROUP BY user_id, page_id, lang ",
 
 4677                        array(
"integer", 
"text", 
"integer"),
 
 4678                        array($a_page_id, $a_parent_type, 0));
 
 4679                while ($hpage = 
$ilDB->fetchAssoc($set))
 
 4683                                $contributors[$hpage[
"user_id"]][$page[
"lang"]] =
 
 4684                                        $contributors[$hpage[
"user_id"]][$page[
"lang"]] + $hpage[
"cnt"];
 
 4688                                $contributors[$hpage[
"user_id"]] =
 
 4689                                        $contributors[$hpage[
"user_id"]] + $hpage[
"cnt"];
 
 4694                foreach ($contributors as $k => $co)
 
 4696                        include_once 
"Services/User/classes/class.ilObjUser.php";
 
 4698                        $c[] = array(
"user_id" => $k, 
"pages" => $co,
 
 4699                                "lastname" => $name[
"lastname"], 
"firstname" => $name[
"firstname"]);
 
 4712                $ilDB->update(
"page_object", array(
 
 4713                        "rendered_content" => array(
"clob", 
$a_content),
 
 4714                        "render_md5" => array(
"text", $a_md5),
 
 4715                        "rendered_time" => array(
"timestamp", 
ilUtil::now())
 
 4717                        "page_id" => array(
"integer", $this->
getId()),
 
 4734                $page_changes = array();
 
 4739                        $and_lang = 
" AND lang = ".$ilDB->quote($a_lang, 
"text");
 
 4742                $q = 
"SELECT * FROM page_object ".
 
 4743                        " WHERE parent_id = ".$ilDB->quote($a_parent_id, 
"integer").
 
 4744                        " AND parent_type = ".$ilDB->quote($a_parent_type, 
"text").
 
 4745                        " AND int_links = ".$ilDB->quote(1, 
"integer").$and_lang;
 
 4746                $set = 
$ilDB->query($q);
 
 4748                while ($page = 
$ilDB->fetchAssoc($set))
 
 4750                        $key_add = ($a_lang == 
"")
 
 4753                        $pages[$page[
"page_id"].$key_add] = array(
 
 4754                                "date" => $page[
"last_change"],
 
 4755                                "id" => $page[
"page_id"],
 
 4756                                "lang" => $page[
"lang"],
 
 4757                                "user" => $page[
"last_change_user"]);
 
 4798                                $link_type = 
"MediaObject";
 
 4799                                $a_id = 
"il__mob_".$a_id;
 
 4803                                $link_type = 
"PageObject";
 
 4804                                $a_id = 
"il__pg_".$a_id;
 
 4808                                $link_type = 
"GlossaryItem";
 
 4809                                $a_id = 
"il__git_".$a_id;
 
 4810                                $a_target = 
"Glossary";
 
 4815                if ($link_type == 
"" || $a_id == 
"")
 
 4818                        $path = 
"//PageObject/InitOpenedContent";
 
 4820                        if (count(
$res->nodeset) > 0)
 
 4822                                $res->nodeset[0]->unlink_node(
$res->nodeset[0]);
 
 4828                        $path = 
"//PageObject/InitOpenedContent";
 
 4830                        if (count(
$res->nodeset) > 0)
 
 4832                                $init_node = 
$res->nodeset[0];
 
 4833                                $childs = $init_node->child_nodes();
 
 4834                                for($i = 0; $i < count($childs); $i++)
 
 4836                                        if ($childs[$i]->node_name() == 
"IntLink")
 
 4838                                                $il_node = $childs[$i];
 
 4844                                $path = 
"//PageObject";
 
 4846                                $page_node = 
$res->nodeset[0];
 
 4847                                $init_node = $this->dom->create_element(
"InitOpenedContent");
 
 4848                                $init_node = $page_node->append_child($init_node);
 
 4849                                $il_node = $this->dom->create_element(
"IntLink");
 
 4850                                $il_node = $init_node->append_child($il_node);
 
 4852                        $il_node->set_attribute(
"Target", $a_id);
 
 4853                        $il_node->set_attribute(
"Type", $link_type);
 
 4854                        $il_node->set_attribute(
"TargetFrame", $a_target);
 
 4871                $path = 
"//PageObject/InitOpenedContent";
 
 4874                if (count(
$res->nodeset) > 0)
 
 4876                        $init_node = 
$res->nodeset[0];
 
 4877                        $childs = $init_node->child_nodes();
 
 4878                        for($i = 0; $i < count($childs); $i++)
 
 4880                                if ($childs[$i]->node_name() == 
"IntLink")
 
 4882                                        $il_node = $childs[$i];
 
 4886                if (!is_null($il_node))
 
 4888                        $id = $il_node->get_attribute(
"Target");
 
 4889                        $link_type = $il_node->get_attribute(
"Type");
 
 4890                        $target = $il_node->get_attribute(
"TargetFrame");
 
 4902                                case "GlossaryItem":
 
 4906                        include_once(
"./Services/Link/classes/class.ilInternalLink.php");
 
 4908                        return array(
"id" => 
$id, 
"type" => $type, 
"target" => 
$target);
 
 4937        function copy($a_id, $a_parent_type = 
"", $a_parent_id = 0, $a_clone_mobs = 
false)
 
 4939                if ($a_parent_type == 
"")
 
 4942                        if ($a_parent_id == 0)
 
 4948                include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
 
 4961                                $new_page_object->setParentId($a_parent_id);
 
 4962                                $new_page_object->setId($a_id);
 
 4964                        $new_page_object->setXMLContent($orig_page->copyXMLContent($a_clone_mobs));
 
 4965                        $new_page_object->setActive($orig_page->getActive());
 
 4966                        $new_page_object->setActivationStart($orig_page->getActivationStart());
 
 4967                        $new_page_object->setActivationEnd($orig_page->getActivationEnd());
 
 4970                                $new_page_object->buildDom();
 
 4971                                $new_page_object->update();
 
 4975                                $new_page_object->create();
 
 4992                $set = 
$ilDB->query(
"SELECT lang FROM page_object ".
 
 4993                        " WHERE page_id = ".
$ilDB->quote($a_id, 
"integer").
 
 4994                        " AND parent_type = ".$ilDB->quote($a_parent_type, 
"text")
 
 4997                while ($rec = 
$ilDB->fetchAssoc($set))
 
 4999                        $langs[] = $rec[
"lang"];
 
 5013                        0, 0, $a_target_lang);
 
 5014                $transl_page->setId($this->
getId());
 
 5016                $transl_page->setXMLContent($this->copyXMLContent());
 
 5017                $transl_page->setActive($this->
getActive());
 
 5020                $transl_page->create();
 
 5036                $min = (int) $aset->get(
"block_mode_minutes") ;
 
 5041                        $ilDB->manipulate(
"UPDATE page_object SET ".
 
 5042                                " edit_lock_user = ".
$ilDB->quote(
$ilUser->getId(), 
"integer").
",".
 
 5043                                " edit_lock_ts = ".$ilDB->quote($ts, 
"integer").
 
 5044                                " WHERE (edit_lock_user = ".$ilDB->quote(
$ilUser->getId(), 
"integer").
" OR ".
 
 5045                                " edit_lock_ts < ".$ilDB->quote(time() - ($min * 60), 
"integer").
") ".
 
 5046                                " AND page_id = ".
$ilDB->quote($this->getId(), 
"integer").
 
 5047                                " AND parent_type = ".$ilDB->quote($this->getParentType(), 
"text")
 
 5050                        $set = 
$ilDB->query(
"SELECT edit_lock_user FROM page_object ".
 
 5051                                " WHERE page_id = ".
$ilDB->quote($this->getId(), 
"integer").
 
 5052                                " AND parent_type = ".$ilDB->quote($this->getParentType(), 
"text")
 
 5054                        $rec = 
$ilDB->fetchAssoc($set);
 
 5055                        if ($rec[
"edit_lock_user"] != 
$ilUser->getId())
 
 5073                $min = (int) $aset->get(
"block_mode_minutes") ;
 
 5078                        $ilDB->manipulate(
"UPDATE page_object SET ".
 
 5079                                " edit_lock_user = ".
$ilDB->quote(
$ilUser->getId(), 
"integer").
",".
 
 5080                                " edit_lock_ts = 0".
 
 5081                                " WHERE edit_lock_user = ".$ilDB->quote(
$ilUser->getId(), 
"integer").
 
 5082                                " AND page_id = ".$ilDB->quote($this->getId(), 
"integer").
 
 5083                                " AND parent_type = ".$ilDB->quote($this->getParentType(), 
"text")
 
 5086                        $set = 
$ilDB->query(
"SELECT edit_lock_user FROM page_object ".
 
 5087                                " WHERE page_id = ".
$ilDB->quote($this->getId(), 
"integer").
 
 5088                                " AND parent_type = ".$ilDB->quote($this->getParentType(), 
"text")
 
 5090                        $rec = 
$ilDB->fetchAssoc($set);
 
 5091                        if ($rec[
"edit_lock_user"] != 
$ilUser->getId())
 
 5110                $min = (int) $aset->get(
"block_mode_minutes");
 
 5112                $set = 
$ilDB->query(
"SELECT edit_lock_user, edit_lock_ts FROM page_object ".
 
 5113                        " WHERE page_id = ".
$ilDB->quote($this->getId(), 
"integer").
 
 5114                        " AND parent_type = ".$ilDB->quote($this->
getParentType(), 
"text")
 
 5116                $rec = 
$ilDB->fetchAssoc($set);
 
 5117                $rec[
"edit_lock_until"] = $rec[
"edit_lock_ts"] + $min * 60;
 
 5134        public static function truncateHTML($a_text, $a_length = 100, $a_ending = 
'...', $a_exact = 
false, $a_consider_html = 
true) 
 
 5136                include_once 
"Services/Utilities/classes/class.ilStr.php";
 
 5138                if ($a_consider_html) 
 
 5141                        if(strlen(preg_replace(
'/<.*?>/', 
'', $a_text)) <= $a_length) 
 
 5147                        $total_length = strlen($a_ending);
 
 5148                        $open_tags = array();
 
 5150                        preg_match_all(
'/(<.+?>)?([^<>]*)/s', $a_text, $lines, PREG_SET_ORDER);
 
 5151                        foreach($lines as $line_matchings) 
 
 5154                                if(!empty($line_matchings[1])) 
 
 5157                                        if(preg_match(
'/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) 
 
 5162                                        else if(preg_match(
'/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) 
 
 5165                                                $pos = array_search($tag_matchings[1], $open_tags);
 
 5168                                                        unset($open_tags[$pos]);
 
 5172                                        else if (preg_match(
'/^<\s*([^\s>!]+).*?>$/s', $line_matchings[1], $tag_matchings)) 
 
 5175                                                array_unshift($open_tags, strtolower($tag_matchings[1]));
 
 5178                                        $truncate .= $line_matchings[1];
 
 5182                                $content_length = strlen(preg_replace(
'/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', 
' ', $line_matchings[2]));
 
 5183                                if($total_length+$content_length > $a_length) 
 
 5186                                        $left = $a_length - $total_length;
 
 5187                                        $entities_length = 0;
 
 5189                                        if(preg_match_all(
'/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, PREG_OFFSET_CAPTURE)) 
 
 5192                                                foreach($entities[0] as $entity) 
 
 5194                                                        if($entity[1]+1-$entities_length <= $left) 
 
 5197                                                                $entities_length += strlen($entity[0]);
 
 5215                                        $truncate .= $line_matchings[2];
 
 5216                                        $total_length += $content_length;
 
 5220                                if($total_length >= $a_length) 
 
 5228                        if(strlen($a_text) <= $a_length) 
 
 5240                if(!
sizeof($open_tags))
 
 5246                                $spacepos = strrpos($truncate, 
' ');
 
 5247                                if($spacepos !== 
false) 
 
 5257                $truncate .= $a_ending;                                         
 
 5259                if($a_consider_html) 
 
 5262                        foreach($open_tags as $tag) 
 
 5264                                $truncate .= 
'</'.$tag.
'>';
 
 5295                        $and_lang = 
" AND lang = ".$ilDB->quote($a_lang, 
"text");
 
 5299                $q = 
"SELECT last_change FROM page_object ".
 
 5300                        " WHERE parent_id = ".$ilDB->quote($a_parent_id, 
"integer").
 
 5301                        " AND parent_type = ".$ilDB->quote($a_parent_type, 
"text").$and_lang.
 
 5302                        " ORDER BY last_change DESC";
 
 5304                $set = 
$ilDB->query($q);
 
 5305                $rec = 
$ilDB->fetchAssoc($set);
 
 5307                return $rec[
"last_change"];
 
 5317                $file_obj_ids = array();
 
 5321                $path = 
"//FileItem/Identifier";
 
 5323                for($i = 0; $i < count(
$res->nodeset); $i++)
 
 5325                        $file_obj_ids[] = 
$res->nodeset[$i]->get_attribute(
"Entry");
 
 5328                return $file_obj_ids;
 
 5337                include_once(
"./Services/COPage/classes/class.ilPCResources.php");
 
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
An exception for terminatinating execution or to throw for unit testing.
static _instantiateQuestion($question_id)
Page not found exception.
static getPCDefinitions()
Get PC definitions.
static getPCDefinitionByName($a_pc_name)
Get PC definition by name.
static requirePCClassByName($a_name)
Get instance.
Unknown page content type exception.
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
static _after(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
static setAction($a_action)
static _deleteAllLinksOfSource($a_source_type, $a_source_id, $a_lang="-")
Delete all links of a given source.
static _extractObjIdOfTarget($a_target)
Extract object id out of target.
static _removeInstFromTarget($a_target)
Removes installation id from target string.
static _exists($a_type, $a_target)
Check if internal link refers to a valid target.
static _saveLink($a_source_type, $a_source_id, $a_target_type, $a_target_id, $a_target_inst=0, $a_source_lang="-")
save internal link information
static _getSourcesOfTarget($a_target_type, $a_target_id, $a_target_inst)
get all sources of a link target
static _getIdForImportId($a_type, $a_target)
Get current id for an import id.
static _extractInstOfTarget($a_target)
Extract installation id out of target.
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
Extension of ilPageObject for learning modules.
static getLogger($a_component_id)
Get component logger.
static deleteNewsOfContext($a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id=0, $a_context_sub_obj_type="")
Delete all news of a context.
static _lookupFileSize($a_id)
Lookups the file size of the file in bytes.
static _getFilesOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_usage_lang="-")
get all files of an object
static _lookupName($a_user_id)
lookup user name
static _lookupObjId($a_id)
static _lookupImportId($a_obj_id)
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static _getLastUpdateOfObjects($a_objs)
Get last update for a set of media objects.
static _lookupType($a_id, $a_reference=false)
lookup object type
static xml2output($a_text, $a_wysiwyg=false, $a_replace_lists=true)
Converts xml from DB to output in edit textarea.
static resolveResources(ilPageObject $page, $ref_mappings)
Resolve resources.
static incEdId($ed_id)
Increases an hierarchical editing id at lowest level (last number)
static sortHierIds($a_array)
Sort an array of Hier IDS in ascending order.
static getInstance($a_parent_type, $a_id=0, $a_old_nr=0, $a_lang="-")
Get page object instance.
static getConfigInstance($a_parent_type)
Get page config instance.
releasePageLock()
Release page lock.
stripHierIDs()
strip all hierarchical id attributes out of the dom tree
switchEnableMultiple($a_hids, $a_update=true, $a_self_ass=false)
(De-)activate elements
moveContentBefore($a_source, $a_target, $a_spcid="", $a_tpcid="")
move content object from position $a_source before position $a_target (both hierarchical content ids)
getEditLockInfo()
Get edit lock info.
getRenderedContent()
Get Rendered Content.
resolveResources($ref_mapping)
Resolve resources.
removeQuestions(&$temp_dom)
Remove questions from document.
setRenderedContent($a_renderedcontent)
Set Rendered Content.
getOfflineHandler()
Get offline handler.
__beforeDelete()
Before deletion handler (internal).
static truncateHTML($a_text, $a_length=100, $a_ending='...', $a_exact=false, $a_consider_html=true)
Truncate (html) string.
getRenderMd5()
Get Render MD5.
deleteStyleUsages($a_old_nr=0)
Delete style usages.
__construct($a_id=0, $a_old_nr=0, $a_lang="-")
Constructor @access public.
initPageConfig()
Init page config.
getLastChangeUser()
Get last change user.
containsIntLinks($a_content)
Check whether content contains internal links.
static getPageContributors($a_parent_type, $a_page_id, $a_lang="-")
Get all contributors for parent object.
registerOfflineHandler($handler)
static getNewPages($a_parent_type, $a_parent_id, $a_lang="-")
Get new pages.
static _existsAndNotEmpty($a_parent_type, $a_id, $a_lang="-")
Checks whether page exists and is not empty (may return true on some empty pages)
getFirstColumnIds()
get ids of all first table columns
setActivationEnd($a_activationend)
Set Activation End.
getHistoryInfo($a_nr)
Get information about a history entry, its predecessor and its successor.
saveInitialOpenedContent($a_type, $a_id, $a_target)
Save initial opened content.
addFileSizes()
add file sizes
deleteInternalLinks()
Delete internal links.
deleteContent($a_hid, $a_update=true, $a_pcid="")
delete content object with hierarchical id $a_hid
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
getLanguage()
Get language.
getPageConfig()
Get page config object.
setContainsIntLink($a_contains_link)
lm parser set this flag to true, if the page contains intern links (this method should only be called...
pasteContents($a_hier_id, $a_self_ass=false)
Paste contents from pc clipboard.
__afterHistoryEntry($a_old_domdoc, $a_old_content, $a_old_nr)
Before deletion handler (internal).
getEditLock()
Get page lock.
setImportMode($a_val)
Set import mode.
addUpdateListener(&$a_object, $a_method, $a_parameters="")
insertInstIntoIDs($a_inst, $a_res_ref_to_obj_id=true)
inserts installation id into ids (e.g.
afterUpdate()
After update.
setLanguage($a_val)
Set language.
newMobCopies($temp_dom)
Replaces media objects with copies.
getInitialOpenedContent()
Get initial opened content.
create()
create new page (with current xml data)
countPageContents()
Remove questions from document.
saveStyleUsage($a_domdoc, $a_old_nr=0)
Save all style class/template usages.
setActivationStart($a_activationstart)
Set Activation Start.
insertContentNode(&$a_cont_node, $a_pos, $a_mode=IL_INSERT_AFTER, $a_pcid="")
insert a content node before/after a sibling or as first child of a parent
deleteContentBeforeHierId($a_hid, $a_update=true)
delete content object with hierarchical id < $a_hid
increaseViewCnt()
Increase view cnt.
static _handleImportRepositoryLinks($a_rep_import_id, $a_rep_type, $a_rep_ref_id)
Change targest of repository links.
updateFromXML()
Updates page object with current xml content.
insertContent(&$a_cont_obj, $a_pos, $a_mode=IL_INSERT_AFTER, $a_pcid="")
insert a content node before/after a sibling or as first child of a parent
setRenderedTime($a_renderedtime)
Set Rendered Time.
getContainsQuestion()
Get contains question.
existsPCId($a_pc_id)
existsPCId
getActivationEnd()
Get Activation End.
deleteContentFromHierId($a_hid, $a_update=true)
delete content object with hierarchical id >= $a_hid
getXMLContent($a_incl_head=false)
get xml content of page
getLastUpdateOfIncludedElements()
Get last update of included elements (media objects and files).
afterConstructor()
After constructor.
static _lookupContainsDeactivatedElements($a_id, $a_parent_type, $a_lang="-")
lookup whether page contains deactivated elements
validateDom()
Validate the page content agains page DTD.
cutContents($a_hids)
Copy contents to clipboard and cut them from the page.
resolveFileItems($a_mapping)
Resolve file items (after import)
setLastChange($a_lastchange)
Set Last Change.
resolveMediaAliases($a_mapping, $a_reuse_existing_by_import=false)
Resolve media aliases (after import)
handleImportRepositoryLink($a_rep_import_id, $a_rep_type, $a_rep_ref_id)
static lookupParentId($a_id, $a_type)
Lookup parent id.
getHierIds()
get all hierarchical ids
resolveIntLinks($a_link_map=null)
Resolves all internal link targets of the page, if targets are available (after import)
appendLangVarXML(&$xml, $var)
containsIntLink()
returns true, if page was marked as containing an intern link (via setContainsIntLink) (this method s...
setShowActivationInfo($a_val)
Set show page activation info.
generatePcId($a_pc_ids=false)
Generate new pc id.
setRenderMd5($a_rendermd5)
Set Render MD5.
newQuestionCopies(&$temp_dom)
Replaces existing question content elements with new copies.
getActivationStart()
Get Activation Start.
getMultimediaXML()
get a xml string that contains all media object elements, that are referenced by any media alias in t...
getParentType()
Get parent type.
static _lookupActivationData($a_id, $a_parent_type, $a_lang="-")
Lookup activation data.
static lookupTranslations($a_parent_type, $a_id)
Lookup translations.
getContentObject($a_hier_id, $a_pc_id="")
Get a content object of the page.
saveInternalLinks($a_domdoc)
save internal links of page
handleRepositoryLinksOnCopy($a_mapping, $a_source_ref_id)
Handle repository links on copy process.
static getPagesWithLinks($a_parent_type, $a_parent_id, $a_lang="-")
Get all pages for parent object that contain internal links.
getPageContentsHashes()
Get page contents hashes.
getHistoryEntry($a_old_nr)
Get History Entry.
getContentTemplates()
Get content templates.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
static getAllPages($a_parent_type, $a_parent_id, $a_lang="-")
Get all pages for parent object.
setXMLContent($a_xml, $a_encoding="UTF-8")
set xml content of page, start with <PageObject...>, end with </PageObject>, comply with ILIAS DTD,...
setPageConfig($a_val)
Set page config object.
collectMediaObjects($a_inline_only=true)
get all media objects, that are referenced and used within the page
getAllFileObjIds()
Get all file object ids.
moveIntLinks($a_from_to)
Move internal links from one destination to another.
getFirstRowIds()
get ids of all first table rows
getMediaAliasElement($a_mob_id, $a_nr=1)
get complete media object (alias) element
getQuestionIds()
Get question ids.
checkPCIds()
Check, whether (all) page content hashes are set.
getDom()
Deprecated php4DomDocument.
getDomDoc()
Get dom doc (php5 dom document)
copy($a_id, $a_parent_type="", $a_parent_id=0, $a_clone_mobs=false)
Copy page.
copyXmlContent($a_clone_mobs=false)
Copy content of page; replace page components with copies where necessary (e.g.
getXMLFromDom($a_incl_head=false, $a_append_mobs=false, $a_append_bib=false, $a_append_str="", $a_omit_pageobject_tag=false)
get xml content of page from dom (use this, if any changes are made to the document)
getFO()
get fo page content
copyPageToTranslation($a_target_lang)
Copy page to translation.
setActive($a_active)
set activation
addHierIDs()
Add hierarchical ID (e.g.
checkForTag($a_content_tag, $a_hier_id, $a_pc_id="")
Get content node from dom.
insertPCIds()
Insert Page Content IDs.
containsDeactivatedElements($a_content)
Check whether content contains deactivated elements.
compareVersion($a_left, $a_right)
Compares to revisions of the page.
getAllPCIds()
Get all pc ids.
performAutomaticModifications()
Perform automatic modifications (may be overwritten by sub classes)
getFileItemIds()
get ids of all file items
getHistoryEntries()
Get History Entries.
static getParentObjectContributors($a_parent_type, $a_parent_id, $a_lang="-")
Get all contributors for parent object.
getLastChange()
Get Last Change.
getShowActivationInfo()
Get show page activation info.
resolveQuestionReferences($a_mapping)
Resolve all quesion references (after import)
bbCode2XML(&$a_content)
transforms bbCode to corresponding xml
& getContentNode($a_hier_id, $a_pc_id="")
Get content node from dom.
static getRecentChanges($a_parent_type, $a_parent_id, $a_period=30, $a_lang="")
Get recent pages changes for parent object.
handleCopiedContent($a_dom, $a_self_ass=true, $a_clone_mobs=false)
Handle copied content.
writeRenderedContent($a_content, $a_md5)
Write rendered content.
getLanguageVariablesXML()
Get language variables as XML.
needsImportParsing($a_parse="")
static preloadActivationDataByParentId($a_parent_id)
Preload activation data by Parent Id.
addChangeDivClasses($a_hashes)
getListItemIds()
get ids of all list items
static getLastChangeByParent($a_parent_type, $a_parent_id, $a_lang="")
Get all pages for parent object.
createFromXML()
Create new page object with current xml content.
newIIMCopies($temp_dom)
Replaces media objects in interactive images with copies of the interactive images.
__afterUpdate($a_domdoc, $a_xml, $a_creation=false, $a_empty=false)
After update event handler (internal).
static _writeActive($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation=true, $a_lang="-")
write activation status
getHierIdsForPCIds($a_pc_ids)
Get hier ids for a set of pc ids.
static _isScheduledActivation($a_id, $a_parent_type, $a_lang="-")
Check whether page is activated by time schedule.
copyContents($a_hids)
Copy contents to clipboard.
beforePageContentUpdate($a_page_content)
Before page content update.
update($a_validate=true, $a_no_history=false)
update complete page content in db (dom xml content is used)
static _writeParentId($a_parent_type, $a_pg_id, $a_par_id)
Write parent id.
getImportMode()
Get import mode.
appendXMLContent($a_xml)
append xml content to page setXMLContent must be called before and the same encoding must be used
deleteContents($a_hids, $a_update=true, $a_self_ass=false)
Delete multiple content objects.
getInternalLinks($a_cnt_multiple=false)
get all internal links that are used within the page
setContainsQuestion($a_val)
Set contains question.
moveContentAfter($a_source, $a_target, $a_spcid="", $a_tpcid="")
move content object from position $a_source before position $a_target (both hierarchical content ids)
getRenderedTime()
Get Rendered Time.
send_paragraph($par_id, $filename)
setLastChangeUser($a_val)
Set last change user.
resolveIIMMediaAliases($a_mapping)
Resolve iim media aliases (in ilContObjParse)
getActive($a_check_scheduled_activation=false)
get activation
setParagraphContent($a_hier_id, $a_content)
Set content of paragraph.
static _moveContentAfterHierId(&$a_source_page, &$a_target_page, $a_hid)
move content of hierarchical id >= $a_hid to other page
static _existsAndNotEmpty($a_parent_type, $a_id, $a_lang="-")
checks whether page exists and is not empty (may return true on some empty pages)
static shortenText($a_string, $a_start_pos, $a_num_bytes, $a_encoding='UTF-8')
Shorten text to the given number of bytes.
static getNamePresentation($a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false)
Default behaviour is:
static sortArray($array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static now()
Return current timestamp in Y-m-d H:i:s format.
const ILIAS_VERSION_NUMERIC
xpath_eval($xpath_context, $eval_str, $contextnode=null)
domxml_open_mem($str, $mode=0, &$error=NULL)
xpath_new_context($dom_document)
redirection script todo: (a better solution should control the processing via a xml file)
if(!is_array($argv)) $options