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");
74 final public function ilPageObject($a_id = 0, $a_old_nr = 0, $a_lang =
"-")
79 require_once(
"./Services/COPage/syntax_highlight/php/Beautifier/Init.php");
80 require_once(
"./Services/COPage/syntax_highlight/php/Output/Output_css.php");
87 $this->contains_int_link =
false;
88 $this->needs_parsing =
false;
89 $this->update_listeners = array();
90 $this->update_listener_cnt = 0;
91 $this->dom_builded =
false;
92 $this->page_not_found =
false;
93 $this->old_nr = $a_old_nr;
94 $this->encoding =
"UTF-8";
96 array(
"PageContent",
"TableRow",
"TableData",
"ListItem",
"FileItem",
97 "Section",
"Tab",
"ContentPopup");
136 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
148 $this->language = $a_val;
168 $this->page_config = $a_val;
178 return $this->page_config;
188 $this->rendermd5 = $a_rendermd5;
198 return $this->rendermd5;
208 $this->renderedcontent = $a_renderedcontent;
218 return $this->renderedcontent;
228 $this->renderedtime = $a_renderedtime;
238 return $this->renderedtime;
248 $this->lastchange = $a_lastchange;
258 return $this->lastchange;
268 $this->last_change_user = $a_val;
278 return $this->last_change_user;
288 $this->show_page_act_info = $a_val;
298 return $this->show_page_act_info;
309 if ($this->old_nr == 0)
311 $query =
"SELECT * FROM page_object".
312 " WHERE page_id = ".$ilDB->quote($this->
id,
"integer").
313 " AND parent_type=".$ilDB->quote($this->
getParentType(),
"text").
314 " AND lang = ".$ilDB->quote($this->
getLanguage(),
"text");
316 $this->page_record =
$ilDB->fetchAssoc($pg_set);
317 $this->
setActive($this->page_record[
"active"]);
324 $query =
"SELECT * FROM page_history".
325 " WHERE page_id = ".$ilDB->quote($this->
id,
"integer").
326 " AND parent_type=".$ilDB->quote($this->
getParentType(),
"text").
327 " AND nr = ".$ilDB->quote((
int) $this->old_nr,
"integer").
328 " AND lang = ".$ilDB->quote($this->
getLanguage(),
"text");
330 $this->page_record =
$ilDB->fetchAssoc($pg_set);
332 if (!$this->page_record)
334 include_once(
"./Services/COPage/exceptions/class.ilCOPageNotFoundException.php");
339 $this->xml = $this->page_record[
"content"];
340 $this->
setParentId($this->page_record[
"parent_id"]);
341 $this->last_change_user = $this->page_record[
"last_change_user"];
342 $this->create_user = $this->page_record[
"create_user"];
357 static function _exists($a_parent_type, $a_id, $a_lang =
"")
360 if (isset(self::$exists[$a_parent_type.
":".$a_id.
":".$a_lang]))
362 return self::$exists[$a_parent_type.
":".$a_id.
":".$a_lang];
368 $and_lang =
" AND lang = ".$ilDB->quote($a_lang,
"text");
371 $query =
"SELECT page_id FROM page_object WHERE page_id = ".$ilDB->quote($a_id,
"integer").
" ".
372 "AND parent_type = ".$ilDB->quote($a_parent_type,
"text").$and_lang;
376 self::$exists[$a_parent_type.
":".$a_id.
":".$a_lang] =
true;
381 self::$exists[$a_parent_type.
":".$a_id.
":".$a_lang] =
false;
397 include_once(
"./Services/COPage/classes/class.ilPageUtil.php");
404 if ($this->dom_builded && !$a_force)
414 $path =
"//PageObject";
416 if (count(
$res->nodeset) == 1)
418 $this->node =&
$res->nodeset[0];
423 $this->dom_builded =
true;
456 return $this->dom->myDOMDocument;
478 $this->parent_id = $a_id;
489 $this->update_listeners[$cnt][
"object"] =& $a_object;
490 $this->update_listeners[$cnt][
"method"] = $a_method;
491 $this->update_listeners[$cnt][
"parameters"] = $a_parameters;
492 $this->update_listener_cnt++;
499 $object =& $this->update_listeners[$i][
"object"];
500 $method = $this->update_listeners[$i][
"method"];
501 $parameters = $this->update_listeners[$i][
"parameters"];
502 $object->$method($parameters);
513 $this->active = $a_active;
521 function getActive($a_check_scheduled_activation =
false)
523 if ($a_check_scheduled_activation && !$this->active)
525 include_once(
"./Services/Calendar/classes/class.ilDateTime.php");
534 return $this->active;
546 $set =
$ilDB->query(
"SELECT page_id, parent_type, lang, active, activation_start, activation_end, show_activation_info FROM page_object ".
547 " WHERE parent_id = ".
$ilDB->quote($a_parent_id,
"integer")
549 while ($rec =
$ilDB->fetchAssoc($set))
551 self::$activation_data[$rec[
"page_id"].
":".$rec[
"parent_type"].
":".$rec[
"lang"]] = $rec;
559 static function _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation =
false, $a_lang =
"-")
569 if (isset(self::$activation_data[$a_id.
":".$a_parent_type.
":".$a_lang]))
571 $rec = self::$activation_data[$a_id.
":".$a_parent_type.
":".$a_lang];
575 $set =
$ilDB->queryF(
"SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s".
576 " AND parent_type = %s AND lang = %s",
577 array(
"integer",
"text",
"text"),
578 array($a_id, $a_parent_type, $a_lang));
579 $rec =
$ilDB->fetchAssoc($set);
585 if (!$rec[
"active"] && $a_check_scheduled_activation)
587 if ($rec[
"n"] >= $rec[
"activation_start"] &&
588 $rec[
"n"] <= $rec[
"activation_end"])
594 return $rec[
"active"];
612 if (isset(self::$activation_data[$a_id.
":".$a_parent_type.
":".$a_lang]))
614 $rec = self::$activation_data[$a_id.
":".$a_parent_type.
":".$a_lang];
618 $set =
$ilDB->queryF(
"SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s".
619 " AND parent_type = %s AND lang = %s", array(
"integer",
"text",
"text"),
620 array($a_id, $a_parent_type, $a_lang));
621 $rec =
$ilDB->fetchAssoc($set);
624 if (!$rec[
"active"] && $rec[
"activation_start"] !=
"")
635 function _writeActive($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation =
true, $a_lang =
"-")
645 if ($a_reset_scheduled_activation)
647 $st =
$ilDB->manipulateF(
"UPDATE page_object SET active = %s, activation_start = %s, ".
648 " activation_end = %s WHERE page_id = %s".
649 " AND parent_type = %s AND lang = %s", array(
"boolean",
"timestamp",
"timestamp",
"integer",
"text",
"text"),
650 array($a_active,
null,
null, $a_id, $a_parent_type, $a_lang));
654 $st =
$ilDB->prepareManip(
"UPDATE page_object SET active = %s WHERE page_id = %s".
655 " AND parent_type = %s AND lang = %s", array(
"boolean",
"integer",
"text",
"text"),
656 array($a_active, $a_id, $a_parent_type, $a_lang));
673 if (isset(self::$activation_data[$a_id.
":".$a_parent_type.
":".$a_lang]))
675 $rec = self::$activation_data[$a_id.
":".$a_parent_type.
":".$a_lang];
679 $set =
$ilDB->queryF(
"SELECT active, activation_start, activation_end, show_activation_info FROM page_object WHERE page_id = %s".
680 " AND parent_type = %s AND lang = %s",
681 array(
"integer",
"text",
"text"),
682 array($a_id, $a_parent_type, $a_lang));
683 $rec =
$ilDB->fetchAssoc($set);
697 $res =
$ilDB->query(
"SELECT parent_id FROM page_object WHERE page_id = ".
$ilDB->quote($a_id,
"integer").
" ".
698 "AND parent_type=".$ilDB->quote($a_type,
"text"));
700 return $rec[
"parent_id"];
710 $st =
$ilDB->manipulateF(
"UPDATE page_object SET parent_id = %s WHERE page_id = %s".
711 " AND parent_type = %s", array(
"integer",
"integer",
"text"),
712 array($a_par_id, $a_pg_id, $a_parent_type));
722 $this->activationstart = $a_activationstart;
732 return $this->activationstart;
742 $this->activationend = $a_activationend;
752 return $this->activationend;
766 if (!is_object($cont_node))
770 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
771 $node_name = $cont_node->node_name();
772 if ($node_name ==
"PageObject")
776 if ($node_name ==
"PageContent")
778 $child_node = $cont_node->first_child();
779 $node_name = $child_node->node_name();
783 if ($node_name ==
"Table")
785 if ($child_node->get_attribute(
"DataTable") ==
"y")
787 require_once(
"./Services/COPage/classes/class.ilPCDataTable.php");
789 $tab->setNode($cont_node);
790 $tab->setHierId($a_hier_id);
794 require_once(
"./Services/COPage/classes/class.ilPCTable.php");
796 $tab->setNode($cont_node);
797 $tab->setHierId($a_hier_id);
799 $tab->setPcId($a_pc_id);
804 if ($node_name ==
"MediaObject")
806 if (
$_GET[
"pgEdMediaMode"] !=
"") {echo
"ilPageObject::error media";
exit;}
809 require_once(
"./Services/COPage/classes/class.ilPCMediaObject.php");
811 $mal_node =& $child_node->first_child();
813 $id_arr = explode(
"_", $mal_node->get_attribute(
"OriginId"));
814 $mob_id = $id_arr[count($id_arr) - 1];
824 $mob->readMediaObject($mob_id);
827 $mob->setNode($cont_node);
828 $mob->setHierId($a_hier_id);
829 $mob->setPcId($a_pc_id);
840 if (!is_array($pc_def))
842 include_once(
"./Services/COPage/exceptions/class.ilCOPageUnknownPCTypeException.php");
845 $pc_class =
"ilPC".$pc_def[
"name"];
846 $pc_path =
"./".$pc_def[
"component"].
"/".$pc_def[
"directory"].
"/class.".$pc_class.
".php";
847 require_once($pc_path);
848 $pc =
new $pc_class($this);
849 $pc->setNode($cont_node);
850 $pc->setHierId($a_hier_id);
851 $pc->setPcId($a_pc_id);
864 if($a_hier_id ==
"pg")
873 $path =
"//*[@PCID = '$a_pc_id']";
875 if (count(
$res->nodeset) == 1)
877 $cont_node =&
$res->nodeset[0];
883 $path =
"//*[@HierId = '$a_hier_id']";
885 if (count(
$res->nodeset) == 1)
887 $cont_node =&
$res->nodeset[0];
905 $path =
"//*[@PCID = '$a_pc_id']//".$a_content_tag;
907 if (count(
$res->nodeset) > 0)
914 $path =
"//*[@HierId = '$a_hier_id']//".$a_content_tag;
916 if (count(
$res->nodeset) > 0)
927 $path =
"//*[@HierId = '$a_hier_id']";
929 if (count(
$res->nodeset) == 1)
952 $this->encoding = $a_encoding;
978 $enc_str = (!empty($this->encoding))
979 ?
"encoding=\"".$this->encoding.
"\""
981 return "<?xml version=\"1.0\" $enc_str ?>".
982 "<!DOCTYPE PageObject SYSTEM \"".ILIAS_ABSOLUTE_PATH.
"/xml/".$this->cur_dtd.
"\">".
997 $xml = $this->getXmlContent();
1004 $xml = $temp_dom->dump_mem(0, $this->encoding);
1005 $xml = eregi_replace(
"<\?xml[^>]*>",
"",
$xml);
1006 $xml = eregi_replace(
"<!DOCTYPE[^>]*>",
"",
$xml);
1024 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
1049 $a_dom = $a_dom->myDOMDocument;
1051 foreach ($defs as $def)
1054 $cl = $def[
"pc_class"];
1055 $cl::handleCopiedContent($a_dom, $a_self_ass, $a_clone_mobs);
1067 $path =
"//InteractiveImage/MediaAlias";
1072 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
1073 for ($i = 0; $i < count (
$res->nodeset); $i++)
1075 $or_id =
$res->nodeset[$i]->get_attribute(
"OriginId");
1080 if (!($inst_id > 0))
1084 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1089 $new_mob = $media_object->duplicate();
1091 $res->nodeset[$i]->set_attribute(
"OriginId",
"il__mob_".$new_mob->getId());
1103 $path =
"//MediaObject/MediaAlias";
1108 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
1109 for ($i = 0; $i < count (
$res->nodeset); $i++)
1111 $or_id =
$res->nodeset[$i]->get_attribute(
"OriginId");
1116 if (!($inst_id > 0))
1120 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1125 $new_mob = $media_object->duplicate();
1127 $res->nodeset[$i]->set_attribute(
"OriginId",
"il__mob_".$new_mob->getId());
1140 $path =
"//Question";
1145 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
1146 for ($i = 0; $i < count (
$res->nodeset); $i++)
1148 $qref =
$res->nodeset[$i]->get_attribute(
"QRef");
1153 if (!($inst_id > 0))
1157 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
1160 if (is_object($question))
1166 $question->createPageObject();
1171 $duplicate_id = $question->duplicate(
false);
1172 $res->nodeset[$i]->set_attribute(
"QRef",
"il__qst_".$duplicate_id);
1188 $path =
"//Question";
1191 for ($i = 0; $i < count (
$res->nodeset); $i++)
1193 $parent_node =
$res->nodeset[$i]->parent_node();
1194 $parent_node->unlink_node($parent_node);
1210 $path =
"//PageContent";
1213 return count (
$res->nodeset);
1220 function getXMLFromDom($a_incl_head =
false, $a_append_mobs =
false, $a_append_bib =
false,
1221 $a_append_str =
"", $a_omit_pageobject_tag =
false)
1226 return $this->dom->dump_mem(0, $this->encoding);
1231 if ($a_append_mobs || $a_append_bib || $a_append_link_info)
1245 return "<dummy>".$this->dom->dump_node($this->node).$mobs.$bibs.$trans.$a_append_str.
"</dummy>";
1249 if (is_object($this->dom))
1251 if ($a_omit_pageobject_tag)
1254 $childs =& $this->node->child_nodes();
1255 for($i = 0; $i < count($childs); $i++)
1257 $xml.= $this->dom->dump_node($childs[$i]);
1263 $xml = $this->dom->dump_mem(0, $this->encoding);
1264 $xml = eregi_replace(
"<\?xml[^>]*>",
"",
$xml);
1265 $xml = eregi_replace(
"<!DOCTYPE[^>]*>",
"",
$xml);
1290 "ed_paste_clip",
"ed_edit",
"ed_edit_prop",
"ed_delete",
"ed_moveafter",
1291 "ed_movebefore",
"ed_go",
"ed_class",
"ed_width",
"ed_align_left",
1292 "ed_align_right",
"ed_align_center",
"ed_align_left_float",
1293 "ed_align_right_float",
"ed_delete_item",
"ed_new_item_before",
1294 "ed_new_item_after",
"ed_copy_clip",
"please_select",
"ed_split_page",
1295 "ed_item_up",
"ed_item_down",
"ed_split_page_next",
"ed_enable",
1296 "de_activate",
"ed_paste",
"ed_edit_multiple",
"ed_cut",
"ed_copy",
"ed_insert_templ",
1297 "ed_click_to_add_pg",
"download");
1300 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
1302 foreach ($defs as $def)
1304 $lang_vars[] =
"pc_".$def[
"pc_type"];
1305 $lang_vars[] =
"ed_insert_".$def[
"pc_type"];
1308 $cl = $def[
"pc_class"];
1309 $lvs = call_user_func($def[
"pc_class"].
'::getLangVars');
1310 foreach ($lvs as $lv)
1316 foreach ($lang_vars as $lang_var)
1330 $xml.=
"<LV name=\"$var\" value=\"".$lng->txt(
"cont_".$var).
"\"/>";
1339 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
1341 $path =
"//Paragraph[1]";
1343 if (count(
$res->nodeset) > 0)
1345 $cont_node =&
$res->nodeset[0]->parent_node();
1347 $par->setNode($cont_node);
1348 return $par->getText();
1363 if (is_object(
$node))
1365 $node->set_content($a_content);
1383 $this->contains_int_link = $a_contains_link;
1403 $this->import_mode = $a_val;
1419 if ($a_parse ===
true)
1421 $this->needs_parsing =
true;
1423 if ($a_parse ===
false)
1425 $this->needs_parsing =
false;
1438 $this->contains_question = $a_val;
1448 return $this->contains_question;
1462 $path =
"//MediaObject/MediaAlias";
1465 for($i = 0; $i < count(
$res->nodeset); $i++)
1467 $id_arr = explode(
"_",
$res->nodeset[$i]->get_attribute(
"OriginId"));
1468 $mob_id = $id_arr[count($id_arr) - 1];
1469 $mob_ids[$mob_id] = $mob_id;
1474 $path =
"//InteractiveImage/MediaAlias";
1476 for($i = 0; $i < count(
$res->nodeset); $i++)
1478 $id_arr = explode(
"_",
$res->nodeset[$i]->get_attribute(
"OriginId"));
1479 $mob_id = $id_arr[count($id_arr) - 1];
1480 $mob_ids[$mob_id] = $mob_id;
1485 $path =
"//IntLink[@Type = 'MediaObject']";
1488 for($i = 0; $i < count(
$res->nodeset); $i++)
1490 if ((
$res->nodeset[$i]->get_attribute(
"TargetFrame") ==
"") ||
1493 $target =
$res->nodeset[$i]->get_attribute(
"Target");
1494 $id_arr = explode(
"_", $target);
1495 if (($id_arr[1] == IL_INST_ID) ||
1496 (substr($target, 0, 4) ==
"il__"))
1498 $mob_id = $id_arr[count($id_arr) - 1];
1501 $mob_ids[$mob_id] = $mob_id;
1519 $path =
"//IntLink";
1524 for($i = 0; $i < count(
$res->nodeset); $i++)
1527 if ($a_cnt_multiple)
1529 $add =
":".$cnt_multiple;
1531 $target =
$res->nodeset[$i]->get_attribute(
"Target");
1532 $type =
$res->nodeset[$i]->get_attribute(
"Type");
1533 $targetframe =
$res->nodeset[$i]->get_attribute(
"TargetFrame");
1534 $anchor =
$res->nodeset[$i]->get_attribute(
"Anchor");
1535 $links[$target.
":".$type.
":".$targetframe.
":".$anchor.$add] =
1536 array(
"Target" => $target,
"Type" => $type,
1537 "TargetFrame" => $targetframe,
"Anchor" => $anchor);
1540 if ($type ==
"MediaObject" && $targetframe ==
"")
1542 if (substr($target, 0, 4) ==
"il__")
1544 $id_arr = explode(
"_", $target);
1545 $id = $id_arr[count($id_arr) - 1];
1548 foreach($med_links as $key => $med_link)
1550 $links[$key] = $med_link;
1562 $path =
"//MediaAlias";
1565 require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
1566 for($i = 0; $i < count(
$res->nodeset); $i++)
1568 $oid =
$res->nodeset[$i]->get_attribute(
"OriginId");
1569 if (substr($oid, 0, 4) ==
"il__")
1571 $id_arr = explode(
"_", $oid);
1572 $id = $id_arr[count($id_arr) - 1];
1575 foreach($med_links as $key => $med_link)
1577 $links[$key] = $med_link;
1597 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1598 foreach($mob_ids as $mob_id => $dummy)
1617 $path =
"//MediaObject/MediaAlias[@OriginId='il__mob_$a_mob_id']";
1619 $mal_node =&
$res->nodeset[$a_nr - 1];
1620 $mob_node =& $mal_node->parent_node();
1622 return $this->dom->dump_node($mob_node);
1635 libxml_disable_entity_loader(
false);
1637 @$this->dom->validate($error);
1660 $this->hier_ids = array();
1661 $this->first_row_ids = array();
1662 $this->first_col_ids = array();
1663 $this->list_item_ids = array();
1664 $this->file_item_ids = array();
1671 foreach ($this->id_elements as $el)
1673 $path.= $sep.
"//".$el;
1678 for($i = 0; $i < count(
$res->nodeset); $i++)
1680 $cnode =
$res->nodeset[$i];
1681 $ctag = $cnode->node_name();
1685 while($cnode =& $cnode->previous_sibling())
1687 if (($cnode->node_type() == XML_ELEMENT_NODE)
1688 && $cnode->has_attribute(
"HierId"))
1690 $sib_hier_id = $cnode->get_attribute(
"HierId");
1696 if ($sib_hier_id !=
"")
1698 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
1700 $res->nodeset[$i]->set_attribute(
"HierId", $node_hier_id);
1701 $this->hier_ids[] = $node_hier_id;
1702 if ($ctag ==
"TableData")
1704 if (substr($par_hier_id,strlen($par_hier_id)-2) ==
"_1")
1706 $this->first_row_ids[] = $node_hier_id;
1709 if ($ctag ==
"ListItem")
1711 $this->list_item_ids[] = $node_hier_id;
1713 if ($ctag ==
"FileItem")
1715 $this->file_item_ids[] = $node_hier_id;
1721 $cnode =
$res->nodeset[$i];
1723 while($cnode =& $cnode->parent_node())
1725 if (($cnode->node_type() == XML_ELEMENT_NODE)
1726 && $cnode->has_attribute(
"HierId"))
1728 $par_hier_id = $cnode->get_attribute(
"HierId");
1734 if (($par_hier_id !=
"") && ($par_hier_id !=
"pg"))
1736 $node_hier_id = $par_hier_id.
"_1";
1737 $res->nodeset[$i]->set_attribute(
"HierId", $node_hier_id);
1738 $this->hier_ids[] = $node_hier_id;
1739 if ($ctag ==
"TableData")
1741 $this->first_col_ids[] = $node_hier_id;
1742 if (substr($par_hier_id,strlen($par_hier_id)-2) ==
"_1")
1744 $this->first_row_ids[] = $node_hier_id;
1747 if ($ctag ==
"ListItem")
1749 $this->list_item_ids[] = $node_hier_id;
1751 if ($ctag ==
"FileItem")
1753 $this->file_item_ids[] = $node_hier_id;
1759 $node_hier_id =
"1";
1760 $res->nodeset[$i]->set_attribute(
"HierId", $node_hier_id);
1761 $this->hier_ids[] = $node_hier_id;
1768 $path =
"//PageObject";
1770 for($i = 0; $i < count(
$res->nodeset); $i++)
1772 $res->nodeset[$i]->set_attribute(
"HierId",
"pg");
1773 $this->hier_ids[] =
"pg";
1783 return $this->hier_ids;
1792 return $this->first_row_ids;
1801 return $this->first_col_ids;
1810 return $this->list_item_ids;
1819 return $this->file_item_ids;
1827 if(is_object($this->dom))
1830 $path =
"//*[@HierId]";
1832 for($i = 0; $i < count(
$res->nodeset); $i++)
1834 if (
$res->nodeset[$i]->has_attribute(
"HierId"))
1836 $res->nodeset[$i]->remove_attribute(
"HierId");
1848 if (!is_array($a_pc_ids) || count($a_pc_ids) == 0)
1854 if(is_object($this->dom))
1857 $path =
"//*[@PCID]";
1859 for($i = 0; $i < count(
$res->nodeset); $i++)
1861 $pc_id =
$res->nodeset[$i]->get_attribute(
"PCID");
1862 if (in_array($pc_id, $a_pc_ids))
1864 $ret[$pc_id] =
$res->nodeset[$i]->get_attribute(
"HierId");
1880 $path =
"//FileItem";
1882 for($i = 0; $i < count(
$res->nodeset); $i++)
1884 $cnode =&
$res->nodeset[$i];
1885 $size_node =& $this->dom->create_element(
"Size");
1886 $size_node =& $cnode->append_child($size_node);
1888 $childs =& $cnode->child_nodes();
1890 for($j = 0; $j < count($childs); $j++)
1892 if ($childs[$j]->node_name() ==
"Identifier")
1894 if ($childs[$j]->has_attribute(
"Entry"))
1896 $entry = $childs[$j]->get_attribute(
"Entry");
1897 $entry_arr = explode(
"_", $entry);
1898 $id = $entry_arr[count($entry_arr) - 1];
1899 require_once(
"./Modules/File/classes/class.ilObjFile.php");
1904 $size_node->set_content(
$size);
1919 $path =
"//IntLink";
1921 for($i = 0; $i < count(
$res->nodeset); $i++)
1923 $target =
$res->nodeset[$i]->get_attribute(
"Target");
1924 $type =
$res->nodeset[$i]->get_attribute(
"Type");
1927 if ($new_target !==
false)
1929 $res->nodeset[$i]->set_attribute(
"Target", $new_target);
1934 IL_INST_ID > 0 && $type !=
"RepositoryItem")
1939 $res->nodeset[$i]->set_attribute(
"Target", $new_target);
1949 $path =
"//MediaAlias";
1953 for($i = 0; $i < count(
$res->nodeset); $i++)
1955 $orig_id =
$res->nodeset[$i]->get_attribute(
"OriginId");
1956 $id_arr = explode(
"_", $orig_id);
1957 $mob_id = $id_arr[count($id_arr) - 1];
1973 $path =
"//MediaAlias";
1976 for($i = 0; $i < count(
$res->nodeset); $i++)
1978 $old_id =
$res->nodeset[$i]->get_attribute(
"OriginId");
1979 $old_id = explode(
"_", $old_id);
1980 $old_id = $old_id[count($old_id) - 1];
1981 if ($a_mapping[$old_id] > 0)
1983 $res->nodeset[$i]->set_attribute(
"OriginId",
"il__mob_".$a_mapping[$old_id]);
2003 $path =
"//InteractiveImage/MediaAlias";
2006 for($i = 0; $i < count(
$res->nodeset); $i++)
2008 $old_id =
$res->nodeset[$i]->get_attribute(
"OriginId");
2009 if ($a_mapping[$old_id] > 0)
2011 $res->nodeset[$i]->set_attribute(
"OriginId",
"il__mob_".$a_mapping[$old_id]);
2031 $path =
"//FileItem/Identifier";
2034 for($i = 0; $i < count(
$res->nodeset); $i++)
2036 $old_id =
$res->nodeset[$i]->get_attribute(
"Entry");
2037 $old_id = explode(
"_", $old_id);
2038 $old_id = $old_id[count($old_id) - 1];
2039 if ($a_mapping[$old_id] > 0)
2041 $res->nodeset[$i]->set_attribute(
"Entry",
"il__file_".$a_mapping[$old_id]);
2059 $path =
"//Question";
2061 for($i = 0; $i < count(
$res->nodeset); $i++)
2063 $qref =
$res->nodeset[$i]->get_attribute(
"QRef");
2065 if (isset($a_mapping[$qref]))
2067 $res->nodeset[$i]->set_attribute(
"QRef",
"il__qst_".$a_mapping[$qref][
"pool"]);
2089 $path =
"//IntLink";
2091 for($i = 0; $i < count(
$res->nodeset); $i++)
2093 $target =
$res->nodeset[$i]->get_attribute(
"Target");
2094 $type =
$res->nodeset[$i]->get_attribute(
"Type");
2096 if ($a_from_to[$obj_id] > 0 && is_int(strpos($target,
"__")))
2100 $res->nodeset[$i]->set_attribute(
"Target",
"il__pg_".$a_from_to[$obj_id]);
2105 $res->nodeset[$i]->set_attribute(
"Target",
"il__st_".$a_from_to[$obj_id]);
2115 $path =
"//MediaAlias";
2118 require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
2119 require_once(
"Services/COPage/classes/class.ilMediaAliasItem.php");
2121 for($i = 0; $i < count(
$res->nodeset); $i++)
2123 $media_object_node =
$res->nodeset[$i]->parent_node();
2124 $page_content_node = $media_object_node->parent_node();
2125 $c_hier_id = $page_content_node->get_attribute(
"HierId");
2129 $c_hier_id,
"Standard");
2130 $areas = $std_alias_item->getMapAreas();
2131 $correction_needed =
false;
2132 if (count($areas) > 0)
2135 foreach($areas as $area)
2137 if ($area[
"Type"] ==
"PageObject" ||
2138 $area[
"Type"] ==
"StructureObject")
2140 $t = $area[
"Target"];
2141 $tid = _extractObjIdOfTarget(
$t);
2142 if ($a_from_to[$tid] > 0)
2144 $correction_needed =
true;
2155 $oid =
$res->nodeset[$i]->get_attribute(
"OriginId");
2156 if (substr($oid, 0, 4) ==
"il__")
2158 $id_arr = explode(
"_", $oid);
2159 $id = $id_arr[count($id_arr) - 1];
2162 $med_item = $mob->getMediaItem(
"Standard");
2163 $med_areas = $med_item->getMapAreas();
2165 foreach($med_areas as $area)
2167 $link_type = ($area->getLinkType() ==
"int")
2172 "Nr" => $area->getNr(),
2173 "Shape" => $area->getShape(),
2174 "Coords" => $area->getCoords(),
2176 "LinkType" => $link_type,
2177 "Href" => $area->getHref(),
2178 "Title" => $area->getTitle(),
2179 "Target" => $area->getTarget(),
2180 "Type" => $area->getType(),
2181 "TargetFrame" => $area->getTargetFrame()
2185 if ($area->getType() ==
"PageObject" ||
2186 $area->getType() ==
"StructureObject")
2188 $t = $area->getTarget();
2190 if ($a_from_to[$tid] > 0)
2192 $correction_needed =
true;
2201 if ($correction_needed)
2204 $std_alias_item->deleteAllMapAreas();
2205 foreach($areas as $area)
2207 if ($area[
"Link"][
"LinkType"] ==
"IntLink")
2209 $target = $area[
"Link"][
"Target"];
2210 $type = $area[
"Link"][
"Type"];
2212 if ($a_from_to[$obj_id] > 0)
2216 $area[
"Link"][
"Target"] =
"il__pg_".$a_from_to[$obj_id];
2220 $area[
"Link"][
"Target"] =
"il__st_".$a_from_to[$obj_id];
2225 $std_alias_item->addMapArea($area[
"Shape"], $area[
"Coords"],
2226 $area[
"Link"][
"Title"],
2227 array(
"Type" => $area[
"Link"][
"Type"],
2228 "TargetFrame" => $area[
"Link"][
"TargetFrame"],
2229 "Target" => $area[
"Link"][
"Target"],
2230 "Href" => $area[
"Link"][
"Href"],
2231 "LinkType" => $area[
"Link"][
"LinkType"],
2249 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
2256 foreach($sources as $source)
2259 if ($source[
"type"] ==
"lm:pg")
2262 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
2263 if (self::_exists(
"lm", $source[
"id"], $source[
"lang"]))
2265 $page_obj =
new ilLMPage($source[
"id"], 0, $source[
"lang"]);
2266 if (!$page_obj->page_not_found)
2269 $page_obj->handleImportRepositoryLink($a_rep_import_id,
2270 $a_rep_type, $a_rep_ref_id);
2272 $page_obj->update();
2285 $path =
"//IntLink";
2288 for($i = 0; $i < count(
$res->nodeset); $i++)
2291 $target =
$res->nodeset[$i]->get_attribute(
"Target");
2292 $type =
$res->nodeset[$i]->get_attribute(
"Type");
2293 if ($target == $a_rep_import_id && $type ==
"RepositoryItem")
2296 $res->nodeset[$i]->set_attribute(
"Target",
2297 "il__".$a_rep_type.
"_".$a_rep_ref_id);
2327 $ilDB->insert(
"page_object", array(
2328 "page_id" => array(
"integer", $this->
getId()),
2329 "parent_id" => array(
"integer", $this->
getParentId()),
2331 "content" => array(
"clob", $content),
2333 "create_user" => array(
"integer",
$ilUser->getId()),
2334 "last_change_user" => array(
"integer",
$ilUser->getId()),
2335 "active" => array(
"integer", $this->
getActive()),
2336 "inactive_elements" => array(
"integer", $iel),
2337 "int_links" => array(
"integer", $inl),
2339 "last_change" => array(
"timestamp",
ilUtil::now())
2371 $ilDB->update(
"page_object", array(
2372 "content" => array(
"clob", $content),
2373 "parent_id" => array(
"integer", $this->
getParentId()),
2374 "last_change_user" => array(
"integer",
$ilUser->getId()),
2375 "last_change" => array(
"timestamp",
ilUtil::now()),
2376 "active" => array(
"integer", $this->
getActive()),
2379 "inactive_elements" => array(
"integer", $iel),
2380 "int_links" => array(
"integer", $inl),
2382 "page_id" => array(
"integer", $this->
getId()),
2399 protected final function __afterUpdate($a_domdoc, $a_xml, $a_creation =
false, $a_empty =
false)
2402 if (!$a_creation || !$a_empty)
2413 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
2415 foreach ($defs as $def)
2418 $cl = $def[
"pc_class"];
2419 call_user_func($def[
"pc_class"].
'::afterPageUpdate', $this, $a_domdoc, $a_xml, $a_creation);
2445 function update($a_validate =
true, $a_no_history =
false)
2472 include_once(
"./Services/User/classes/class.ilUserUtil.php");
2475 1 =>
"nocontent#".
$lng->txt(
"cont_not_saved_edit_lock_expired").
"<br />".
2476 $lng->txt(
"obj_usr").
": ".
2478 $lng->txt(
"content_until").
": ".
2497 $old_set =
$ilDB->query(
"SELECT * FROM page_object WHERE ".
2498 "page_id = ".
$ilDB->quote($this->getId(),
"integer").
" AND ".
2499 "parent_type = ".$ilDB->quote($this->getParentType(),
"text").
" AND ".
2500 "lang = ".$ilDB->quote($this->getLanguage(),
"text"));
2501 $last_nr_set =
$ilDB->query(
"SELECT max(nr) as mnr FROM page_history WHERE ".
2502 "page_id = ".
$ilDB->quote($this->getId(),
"integer").
" AND ".
2503 "parent_type = ".$ilDB->quote($this->getParentType(),
"text").
" AND ".
2504 "lang = ".$ilDB->quote($this->getLanguage(),
"text"));
2505 $last_nr =
$ilDB->fetchAssoc($last_nr_set);
2506 if ($old_rec =
$ilDB->fetchAssoc($old_set))
2510 if (($content != $old_rec[
"content"] ||
$ilUser->getId() != $old_rec[
"last_change_user"]) &&
2511 !$a_no_history && !$this->history_saved &&
$lm_set->get(
"page_history", 1))
2513 if ($old_rec[
"content"] !=
"<PageObject></PageObject>")
2515 $ilDB->manipulateF(
"DELETE FROM page_history WHERE ".
2516 "page_id = %s AND parent_type = %s AND hdate = %s AND lang = %s",
2517 array(
"integer",
"text",
"timestamp",
"text"),
2518 array($old_rec[
"page_id"], $old_rec[
"parent_type"], $old_rec[
"last_change"], $old_rec[
"lang"]));
2522 $last_c = $old_rec[
"last_change"];
2528 $ilDB->insert(
"page_history", array(
2529 "page_id" => array(
"integer", $old_rec[
"page_id"]),
2530 "parent_type" => array(
"text", $old_rec[
"parent_type"]),
2531 "lang" => array(
"text", $old_rec[
"lang"]),
2532 "hdate" => array(
"timestamp", $last_c),
2533 "parent_id" => array(
"integer", $old_rec[
"parent_id"]),
2534 "content" => array(
"clob", $old_rec[
"content"]),
2535 "user_id" => array(
"integer", $old_rec[
"last_change_user"]),
2537 "nr" => array(
"integer", (
int) $last_nr[
"mnr"] + 1)
2540 $old_content = $old_rec[
"content"];
2541 $old_domdoc =
new DOMDocument();
2542 $old_nr = $last_nr[
"mnr"] + 1;
2543 $old_domdoc->loadXML(
'<?xml version="1.0" encoding="UTF-8"?>'.$old_content);
2548 $this->history_saved =
true;
2552 $this->history_saved =
true;
2557 $em = (trim($content) ==
"<PageObject/>")
2565 $ilDB->update(
"page_object", array(
2566 "content" => array(
"clob", $content),
2567 "parent_id" => array(
"integer", $this->
getParentId()),
2568 "last_change_user" => array(
"integer",
$ilUser->getId()),
2569 "last_change" => array(
"timestamp",
ilUtil::now()),
2570 "is_empty" => array(
"integer", $em),
2571 "active" => array(
"integer", $this->
getActive()),
2575 "inactive_elements" => array(
"integer", $iel),
2576 "int_links" => array(
"integer", $inl),
2578 "page_id" => array(
"integer", $this->
getId()),
2607 if (!$this->page_not_found)
2612 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2614 foreach ($mobs2 as $m)
2616 if (!in_array($m,
$mobs))
2634 include_once(
"./Services/News/classes/class.ilNewsItem.php");
2639 $ilDB->manipulate(
"DELETE FROM page_object ".
2640 "WHERE page_id = ".
$ilDB->quote($this->getId(),
"integer").
2641 " AND parent_type= ".$ilDB->quote($this->getParentType(),
"text"));
2645 foreach (
$mobs as $mob_id)
2649 $GLOBALS[
'ilLog']->write(__METHOD__.
': Type mismatch. Ignoring mob with id: '.$mob_id);
2683 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
2685 foreach ($defs as $def)
2688 $cl = $def[
"pc_class"];
2689 call_user_func($def[
"pc_class"].
'::beforePageDelete', $this);
2704 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
2706 foreach ($defs as $def)
2709 $cl = $def[
"pc_class"];
2710 call_user_func($def[
"pc_class"].
'::afterPageHistoryEntry', $this, $a_old_domdoc, $a_old_content, $a_old_nr);
2724 $xpath =
new DOMXPath($a_domdoc);
2725 $path =
"//Paragraph | //Section | //MediaAlias | //FileItem".
2726 " | //Table | //TableData | //Tabs | //List";
2727 $nodes = $xpath->query(
$path);
2729 foreach($nodes as
$node)
2731 switch (
$node->localName)
2734 $sname =
$node->getAttribute(
"Characteristic");
2735 $stype =
"text_block";
2740 $sname =
$node->getAttribute(
"Characteristic");
2746 $sname =
$node->getAttribute(
"Class");
2747 $stype =
"media_cont";
2752 $sname =
$node->getAttribute(
"Class");
2753 $stype =
"flist_li";
2758 $sname =
$node->getAttribute(
"Template");
2761 $sname =
$node->getAttribute(
"Class");
2773 $sname =
$node->getAttribute(
"Class");
2774 $stype =
"table_cell";
2779 $sname =
$node->getAttribute(
"Template");
2782 if (
$node->getAttribute(
"Type") ==
"HorizontalAccordion")
2784 $stype =
"haccordion";
2786 if (
$node->getAttribute(
"Type") ==
"VerticalAccordion")
2788 $stype =
"vaccordion";
2795 $sname =
$node->getAttribute(
"Class");
2796 if (
$node->getAttribute(
"Type") ==
"Ordered")
2807 if ($sname !=
"" && $stype !=
"")
2809 $usages[$sname.
":".$stype.
":".$template] = array(
"sname" => $sname,
2810 "stype" => $stype,
"template" => $template);
2817 foreach ($usages as $u)
2819 $ilDB->manipulate(
"INSERT INTO page_style_usage ".
2820 "(page_id, page_type, page_lang, page_nr, template, stype, sname) VALUES (".
2821 $ilDB->quote($this->getId(),
"integer").
",".
2822 $ilDB->quote($this->getParentType(),
"text").
",".
2823 $ilDB->quote($this->getLanguage(),
"text").
",".
2824 $ilDB->quote($a_old_nr,
"integer").
",".
2825 $ilDB->quote($u[
"template"],
"integer").
",".
2826 $ilDB->quote($u[
"stype"],
"text").
",".
2827 $ilDB->quote($u[
"sname"],
"text").
2842 if ($a_old_nr !==
false)
2844 $and_old_nr =
" AND page_nr = ".$ilDB->quote($a_old_nr,
"integer");
2847 $ilDB->manipulate(
"DELETE FROM page_style_usage WHERE ".
2848 " page_id = ".
$ilDB->quote($this->getId(),
"integer").
2849 " AND page_type = ".$ilDB->quote($this->getParentType(),
"text").
2850 " AND page_lang = ".$ilDB->quote($this->getLanguage(),
"text").
2863 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2864 include_once(
"./Modules/File/classes/class.ilObjFile.php");
2869 $objs = array_merge(
$mobs, $files);
2881 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
2900 $xpath =
new DOMXPath($a_domdoc);
2901 $nodes = $xpath->query(
'//IntLink');
2902 foreach($nodes as
$node)
2904 $link_type =
$node->getAttribute(
"Type");
2908 case "StructureObject":
2916 case "GlossaryItem":
2924 case "RepositoryItem":
2937 $target =
$node->getAttribute(
"Target");
2942 if (is_int(strpos($target,
"__")))
2977 $curr_node->unlink_node($curr_node);
2994 if (!is_array($a_hids))
2998 foreach($a_hids as $a_hid)
3000 $a_hid = explode(
":", $a_hid);
3005 if (!$this->
checkForTag(
"Question", $a_hid[0], $a_hid[1]) || $a_self_ass)
3008 if (is_object($curr_node))
3010 $parent_node = $curr_node->parent_node();
3011 if ($parent_node->node_name() !=
"TableRow")
3013 $curr_node->unlink_node($curr_node);
3044 if (!is_array($a_hids))
3049 $time = date(
"Y-m-d H:i:s", time());
3051 $hier_ids = array();
3053 foreach($a_hids as $a_hid)
3059 $a_hid = explode(
":", $a_hid);
3063 foreach($hier_ids as $h)
3065 if($h.
"_" == substr($a_hid[0], 0, strlen($h) + 1))
3067 $skip[] = $a_hid[0];
3069 if($a_hid[0].
"_" == substr($h, 0, strlen($a_hid[0]) + 1))
3074 $pc_id[$a_hid[0]] = $a_hid[1];
3075 if ($a_hid[0] !=
"")
3077 $hier_ids[$a_hid[0]] = $a_hid[0];
3080 foreach ($skip as $s)
3082 unset($hier_ids[$s]);
3084 include_once(
"./Services/COPage/classes/class.ilPageContent.php");
3087 foreach($hier_ids as $hid)
3090 if (is_object($curr_node))
3092 if ($curr_node->node_name() ==
"PageContent")
3094 $content = $this->dom->dump_node($curr_node);
3096 $content = eregi_replace(
"PCID=\"[a-z0-9]*\"",
"",$content);
3097 $content = eregi_replace(
"HierId=\"[a-z0-9_]*\"",
"",$content);
3099 $ilUser->addToPCClipboard($content, $time, $nr);
3104 include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
3115 $a_hid = explode(
":", $a_hier_id);
3116 $content =
$ilUser->getPCClipboardContent();
3120 for ($i = count($content) - 1; $i >= 0; $i--)
3124 $temp_dom =
domxml_open_mem(
'<?xml version="1.0" encoding="UTF-8"?>'.$c,
3130 $path =
"//PageContent";
3132 if (count(
$res->nodeset) > 0)
3134 $new_pc_node =
$res->nodeset[0];
3135 $cloned_pc_node = $new_pc_node->clone_node (
true);
3136 $cloned_pc_node->unlink_node ($cloned_pc_node);
3155 if (!is_array($a_hids))
3159 $obj = & $this->content_obj;
3161 foreach($a_hids as $a_hid)
3163 $a_hid = explode(
":", $a_hid);
3165 if (is_object($curr_node))
3167 if ($curr_node->node_name() ==
"PageContent")
3170 if ($cont_obj->isEnabled ())
3173 if (!$this->
checkForTag(
"Question", $a_hid[0], $a_hid[1]) || $a_self_ass)
3175 $cont_obj->disable();
3180 $cont_obj->enable();
3205 foreach ($hier_ids as $hier_id)
3208 if (!is_int(strpos($hier_id,
"_")))
3210 if ($hier_id !=
"pg" && $hier_id >= $a_hid)
3213 $curr_node->unlink_node($curr_node);
3235 foreach ($hier_ids as $hier_id)
3238 if (!is_int(strpos($hier_id,
"_")))
3240 if ($hier_id !=
"pg" && $hier_id < $a_hid)
3243 $curr_node->unlink_node($curr_node);
3263 $hier_ids = $a_source_page->getHierIds();
3265 $copy_ids = array();
3268 foreach ($hier_ids as $hier_id)
3271 if (!is_int(strpos($hier_id,
"_")))
3273 if ($hier_id !=
"pg" && $hier_id >= $a_hid)
3275 $copy_ids[] = $hier_id;
3281 $parent_node =& $a_target_page->getContentNode(
"pg");
3282 $target_dom =& $a_target_page->getDom();
3283 $parent_childs =& $parent_node->child_nodes();
3284 $cnt_parent_childs = count($parent_childs);
3286 $first_child =& $parent_childs[0];
3287 foreach($copy_ids as $copy_id)
3289 $source_node =& $a_source_page->getContentNode($copy_id);
3291 $new_node =& $source_node->clone_node(
true);
3292 $new_node->unlink_node($new_node);
3294 $source_node->unlink_node($source_node);
3296 if($cnt_parent_childs == 0)
3298 $new_node =& $parent_node->append_child($new_node);
3303 $new_node =& $first_child->insert_before($new_node, $first_child);
3305 $parent_childs =& $parent_node->child_nodes();
3310 $a_target_page->update();
3311 $a_source_page->update();
3323 $curr_name = $curr_node->node_name();
3326 if (($curr_name ==
"TableData") || ($curr_name ==
"PageObject") ||
3327 ($curr_name ==
"ListItem") || ($curr_name ==
"Section")
3328 || ($curr_name ==
"Tab") || ($curr_name ==
"ContentPopup"))
3333 $hid = $curr_node->get_attribute(
"HierId");
3342 $pos = explode(
"_", $a_pos);
3343 $target_pos = array_pop($pos);
3344 $parent_pos = implode($pos,
"_");
3348 $parent_pos = $a_pos;
3352 if($parent_pos !=
"")
3358 $parent_node =& $this->
getNode();
3362 $parent_childs =& $parent_node->child_nodes();
3363 $cnt_parent_childs = count($parent_childs);
3369 $new_node =& $a_cont_obj->getNode();
3373 if($succ_node =& $curr_node->next_sibling())
3375 $new_node =& $succ_node->insert_before($new_node, $succ_node);
3380 $new_node =& $parent_node->append_child($new_node);
3382 $a_cont_obj->setNode($new_node);
3387 $new_node =& $a_cont_obj->getNode();
3389 $new_node =& $succ_node->insert_before($new_node, $succ_node);
3390 $a_cont_obj->setNode($new_node);
3396 $new_node =& $a_cont_obj->getNode();
3397 if($cnt_parent_childs == 0)
3399 $new_node =& $parent_node->append_child($new_node);
3403 $new_node =& $parent_childs[0]->insert_before($new_node, $parent_childs[0]);
3405 $a_cont_obj->setNode($new_node);
3411 if (!$this->
getPageConfig()->getEnablePCType(
"PlaceHolder")) {
3412 $sub_nodes = $curr_node->child_nodes() ;
3413 foreach ( $sub_nodes as $sub_node ) {
3414 if ($sub_node->node_name() ==
"PlaceHolder") {
3415 $curr_node->unlink_node();
3428 $curr_name = $curr_node->node_name();
3431 if (($curr_name ==
"TableData") || ($curr_name ==
"PageObject") ||
3432 ($curr_name ==
"ListItem") || ($curr_name ==
"Section")
3433 || ($curr_name ==
"Tab") || ($curr_name ==
"ContentPopup"))
3438 $hid = $curr_node->get_attribute(
"HierId");
3446 $pos = explode(
"_", $a_pos);
3447 $target_pos = array_pop($pos);
3448 $parent_pos = implode($pos,
"_");
3452 $parent_pos = $a_pos;
3456 if($parent_pos !=
"")
3462 $parent_node =& $this->
getNode();
3466 $parent_childs =& $parent_node->child_nodes();
3467 $cnt_parent_childs = count($parent_childs);
3474 if($succ_node = $curr_node->next_sibling())
3476 $a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
3480 $a_cont_node = $parent_node->append_child($a_cont_node);
3488 $a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
3495 if($cnt_parent_childs == 0)
3497 $a_cont_node = $parent_node->append_child($a_cont_node);
3501 $a_cont_node = $parent_childs[0]->insert_before($a_cont_node, $parent_childs[0]);
3514 if($a_source == $a_target)
3521 $source_node =& $content->getNode();
3522 $clone_node =& $source_node->clone_node(
true);
3528 $content->setNode($clone_node);
3540 if($a_source == $a_target)
3547 $source_node =& $content->getNode();
3548 $clone_node =& $source_node->clone_node(
true);
3554 $content->setNode($clone_node);
3565 $a_content = eregi_replace(
"\[com\]",
"<Comment>",$a_content);
3566 $a_content = eregi_replace(
"\[\/com\]",
"</Comment>",$a_content);
3567 $a_content = eregi_replace(
"\[emp]",
"<Emph>",$a_content);
3568 $a_content = eregi_replace(
"\[\/emp\]",
"</Emph>",$a_content);
3569 $a_content = eregi_replace(
"\[str]",
"<Strong>",$a_content);
3570 $a_content = eregi_replace(
"\[\/str\]",
"</Strong>",$a_content);
3581 $path =
"//IntLink";
3583 for($i = 0; $i < count(
$res->nodeset); $i++)
3585 $target =
$res->nodeset[$i]->get_attribute(
"Target");
3586 $type =
$res->nodeset[$i]->get_attribute(
"Type");
3588 if (substr($target, 0, 4) ==
"il__")
3590 $id = substr($target, 4, strlen($target) - 4);
3594 if ($a_res_ref_to_obj_id && $type ==
"RepositoryItem")
3596 $id_arr = explode(
"_",
$id);
3615 $new_target =
"il_".$a_inst.
"_".
$id;
3616 $res->nodeset[$i]->set_attribute(
"Target", $new_target);
3625 $path =
"//MediaAlias";
3627 for($i = 0; $i < count(
$res->nodeset); $i++)
3629 $origin_id =
$res->nodeset[$i]->get_attribute(
"OriginId");
3630 if (substr($origin_id, 0, 4) ==
"il__")
3632 $new_id =
"il_".$a_inst.
"_".substr($origin_id, 4, strlen($origin_id) - 4);
3633 $res->nodeset[$i]->set_attribute(
"OriginId", $new_id);
3640 $path =
"//FileItem/Identifier";
3642 for($i = 0; $i < count(
$res->nodeset); $i++)
3644 $origin_id =
$res->nodeset[$i]->get_attribute(
"Entry");
3645 if (substr($origin_id, 0, 4) ==
"il__")
3647 $new_id =
"il_".$a_inst.
"_".substr($origin_id, 4, strlen($origin_id) - 4);
3648 $res->nodeset[$i]->set_attribute(
"Entry", $new_id);
3655 $path =
"//Question";
3657 for($i = 0; $i < count(
$res->nodeset); $i++)
3659 $qref =
$res->nodeset[$i]->get_attribute(
"QRef");
3661 if (substr($qref, 0, 4) ==
"il__")
3663 $new_id =
"il_".$a_inst.
"_".substr($qref, 4, strlen($qref) - 4);
3665 $res->nodeset[$i]->set_attribute(
"QRef", $new_id);
3681 foreach ($this->id_elements as $el)
3683 $path.= $sep.
"//".$el.
"[not(@PCID)]";
3685 $path.= $sep.
"//".$el.
"[@PCID='']";
3691 if (count (
$res->nodeset) > 0)
3712 foreach ($this->id_elements as $el)
3714 $path.= $sep.
"//".$el.
"[@PCID]";
3722 for ($i = 0; $i < count (
$res->nodeset); $i++)
3725 $pcids[] =
$node->get_attribute(
"PCID");
3744 foreach ($this->id_elements as $el)
3746 $path.= $sep.
"//".$el.
"[@PCID='".$a_pc_id.
"']";
3753 return (count(
$res->nodeset) > 0);
3764 if ($a_pc_ids ===
false)
3768 $id = ilUtil::randomHash(10, $a_pc_ids);
3785 foreach ($this->id_elements as $el)
3787 $path.= $sep.
"//".$el.
"[not(@PCID)]";
3789 $path.= $sep.
"//".$el.
"[@PCID='']";
3795 for ($i = 0; $i < count (
$res->nodeset); $i++)
3798 $id = ilUtil::randomHash(10, $pcids);
3801 $res->nodeset[$i]->set_attribute(
"PCID",
$id);
3811 $this->addHierIds();
3815 $path =
"//PageContent";
3820 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
3821 for ($i = 0; $i < count (
$res->nodeset); $i++)
3823 $hier_id =
$res->nodeset[$i]->get_attribute(
"HierId");
3824 $pc_id =
$res->nodeset[$i]->get_attribute(
"PCID");
3825 $dump = $mydom->dump_node(
$res->nodeset[$i]);
3826 if (($hpos = strpos($dump,
' HierId="'.$hier_id.
'"')) > 0)
3828 $dump = substr($dump, 0, $hpos).
3829 substr($dump, $hpos + strlen(
' HierId="'.$hier_id.
'"'));
3832 $childs =
$res->nodeset[$i]->child_nodes();
3834 if ($childs[0] && $childs[0]->node_name() ==
"Paragraph")
3836 $content = $mydom->dump_node($childs[0]);
3837 $content = substr($content, strpos($content,
">") + 1,
3838 strrpos($content,
"<") - (strpos($content,
">") + 1));
3846 array(
"hier_id" => $hier_id,
"hash" => md5($dump),
"content" => $content);
3862 $path =
"//Question";
3867 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
3868 for ($i = 0; $i < count (
$res->nodeset); $i++)
3870 $qref =
$res->nodeset[$i]->get_attribute(
"QRef");
3875 if (!($inst_id > 0))
3897 $path =
"/descendant::Paragraph[position() = $par_id]";
3901 if (count (
$res->nodeset) != 1)
3902 die (
"Should not happen");
3904 $context_node =
$res->nodeset[0];
3908 $childs = $context_node->child_nodes();
3910 for($j=0; $j<count($childs); $j++)
3912 $content .= $mydom->dump_node($childs[$j]);
3915 $content = str_replace(
"<br />",
"\n", $content);
3916 $content = str_replace(
"<br/>",
"\n", $content);
3918 $plain_content = html_entity_decode($content);
3936 $xsl = file_get_contents(
"./Services/COPage/xsl/page_fo.xsl");
3937 $args = array(
'/_xml' =>
$xml,
'/_xsl' => $xsl );
3943 $fo = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl",NULL,$args, $params);
3946 $fo = str_replace(
"\n",
"", $fo);
3947 $fo = str_replace(
"<br/>",
"<br>", $fo);
3948 $fo = str_replace(
"<br>",
"\n", $fo);
3953 $fo = substr($fo, strpos($fo,
">") + 1);
3959 $this->offline_handler = $handler;
3986 $query =
"SELECT * FROM page_object WHERE page_id = ".
3987 $ilDB->quote($a_id,
"integer").
" AND ".
3988 " parent_type = ".$ilDB->quote($a_parent_type,
"text").
" AND ".
3989 " lang = ".$ilDB->quote($a_lang,
"text").
" AND ".
3990 " inactive_elements = ".$ilDB->quote(1,
"integer");
4009 if (strpos($a_content,
" Enabled=\"False\""))
4023 $h_query =
"SELECT * FROM page_history ".
4024 " WHERE page_id = ".$ilDB->quote($this->
getId(),
"integer").
4025 " AND parent_type = ".$ilDB->quote($this->
getParentType(),
"text").
4026 " AND lang = ".$ilDB->quote($this->
getLanguage(),
"text").
4027 " ORDER BY hdate DESC";
4029 $hset =
$ilDB->query($h_query);
4030 $hentries = array();
4032 while ($hrec =
$ilDB->fetchAssoc($hset))
4034 $hrec[
"sortkey"] = (int) $hrec[
"nr"];
4035 $hrec[
"user"] = (int) $hrec[
"user_id"];
4036 $hentries[] = $hrec;
4049 $res =
$ilDB->queryF(
"SELECT * FROM page_history ".
4050 " WHERE page_id = %s ".
4051 " AND parent_type = %s ".
4054 array(
"integer",
"text",
"integer",
"text"),
4076 $and_nr = ($a_nr > 0)
4077 ?
" AND nr < ".
$ilDB->quote((
int) $a_nr,
"integer")
4079 $res =
$ilDB->query(
"SELECT MAX(nr) mnr FROM page_history ".
4080 " WHERE page_id = ".
$ilDB->quote($this->getId(),
"integer").
4081 " AND parent_type = ".$ilDB->quote($this->
getParentType(),
"text").
4082 " AND lang = ".$ilDB->quote($this->
getLanguage(),
"text").
4085 if (
$row[
"mnr"] > 0)
4087 $res =
$ilDB->query(
"SELECT * FROM page_history ".
4088 " WHERE page_id = ".
$ilDB->quote($this->getId(),
"integer").
4089 " AND parent_type = ".$ilDB->quote($this->
getParentType(),
"text").
4090 " AND lang = ".$ilDB->quote($this->
getLanguage(),
"text").
4091 " AND nr = ".$ilDB->quote((
int)
$row[
"mnr"],
"integer"));
4097 $res =
$ilDB->query(
"SELECT MIN(nr) mnr FROM page_history ".
4098 " WHERE page_id = ".
$ilDB->quote($this->getId(),
"integer").
4099 " AND parent_type = ".$ilDB->quote($this->
getParentType(),
"text").
4100 " AND lang = ".$ilDB->quote($this->
getLanguage(),
"text").
4101 " AND nr > ".$ilDB->quote((
int) $a_nr,
"integer"));
4103 if (
$row[
"mnr"] > 0)
4105 $res =
$ilDB->query(
"SELECT * FROM page_history ".
4106 " WHERE page_id = ".
$ilDB->quote($this->getId(),
"integer").
4107 " AND parent_type = ".$ilDB->quote($this->
getParentType(),
"text").
4108 " AND lang = ".$ilDB->quote($this->
getLanguage(),
"text").
4109 " AND nr = ".$ilDB->quote((
int)
$row[
"mnr"],
"integer"));
4117 $res =
$ilDB->query(
"SELECT * FROM page_history ".
4118 " WHERE page_id = ".
$ilDB->quote($this->getId(),
"integer").
4119 " AND parent_type = ".$ilDB->quote($this->
getParentType(),
"text").
4120 " AND lang = ".$ilDB->quote($this->
getLanguage(),
"text").
4121 " AND nr = ".$ilDB->quote((
int) $a_nr,
"integer"));
4126 $res =
$ilDB->query(
"SELECT page_id, last_change hdate, parent_type, parent_id, last_change_user user_id, content, lang FROM page_object ".
4127 " WHERE page_id = ".
$ilDB->quote($this->getId(),
"integer").
4128 " AND parent_type = ".$ilDB->quote($this->
getParentType(),
"text").
4129 " AND lang = ".$ilDB->quote($this->
getLanguage(),
"text"));
4142 $rnode =
$res->nodeset[0];
4145 foreach($a_hashes as $pc_id => $h)
4148 if ($h[
"change"] !=
"")
4150 $dc_node = $this->dom->create_element(
"DivClass");
4151 $dc_node->set_attribute(
"HierId", $h[
"hier_id"]);
4152 $dc_node->set_attribute(
"Class",
"ilEdit".$h[
"change"]);
4153 $dc_node = $rnode->append_child($dc_node);
4168 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
4172 $l_hashes = $l_page->getPageContentsHashes();
4173 $r_hashes = $r_page->getPageContentsHashes();
4175 foreach ($l_hashes as $pc_id => $h)
4177 if (!isset($r_hashes[$pc_id]))
4179 $l_hashes[$pc_id][
"change"] =
"Deleted";
4183 if ($l_hashes[$pc_id][
"hash"] != $r_hashes[$pc_id][
"hash"])
4185 $l_hashes[$pc_id][
"change"] =
"Modified";
4186 $r_hashes[$pc_id][
"change"] =
"Modified";
4188 include_once(
"./Services/COPage/mediawikidiff/class.WordLevelDiff.php");
4190 if ($l_hashes[$pc_id][
"content"] !=
"" &&
4191 $r_hashes[$pc_id][
"content"] !=
"")
4193 $new_left = str_replace(
"\n",
"<br />", $l_hashes[$pc_id][
"content"]);
4194 $new_right = str_replace(
"\n",
"<br />", $r_hashes[$pc_id][
"content"]);
4197 $new_left = $wldiff->orig();
4198 $new_right = $wldiff->closing();
4199 $l_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_left[0]);
4200 $r_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_right[0]);
4207 foreach ($r_hashes as $pc_id => $h)
4209 if (!isset($l_hashes[$pc_id]))
4211 $r_hashes[$pc_id][
"change"] =
"New";
4214 $l_page->addChangeDivClasses($l_hashes);
4215 $r_page->addChangeDivClasses($r_hashes);
4217 return array(
"l_page" => $l_page,
"r_page" => $r_page,
4218 "l_changes" => $l_hashes,
"r_changes" => $r_hashes);
4228 $ilDB->manipulate(
"UPDATE page_object ".
4229 " SET view_cnt = view_cnt + 1 ".
4230 " WHERE page_id = ".
$ilDB->quote($this->getId(),
"integer").
4231 " AND parent_type = ".$ilDB->quote($this->getParentType(),
"text").
4232 " AND lang = ".$ilDB->quote($this->getLanguage(),
"text"));
4249 $and_lang =
" AND lang = ".$ilDB->quote($a_lang,
"text");
4252 $page_changes = array();
4253 $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
4254 $q =
"SELECT * FROM page_object ".
4255 " WHERE parent_id = ".$ilDB->quote($a_parent_id,
"integer").
4256 " AND parent_type = ".$ilDB->quote($a_parent_type,
"text").
4257 " AND last_change >= ".$ilDB->quote($limit_ts,
"timestamp").$and_lang;
4259 $set =
$ilDB->query($q);
4260 while($page =
$ilDB->fetchAssoc($set))
4262 $page_changes[] = array(
4263 "date" => $page[
"last_change"],
4264 "id" => $page[
"page_id"],
4265 "lang" => $page[
"lang"],
4267 "user" => $page[
"last_change_user"]);
4273 $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
4274 $and_str =
" AND hdate >= ".$ilDB->quote($limit_ts,
"timestamp").
" ";
4277 $q =
"SELECT * FROM page_history ".
4278 " WHERE parent_id = ".$ilDB->quote($a_parent_id,
"integer").
4279 " AND parent_type = ".$ilDB->quote($a_parent_type,
"text").
4281 $set =
$ilDB->query($q);
4282 while ($page =
$ilDB->fetchAssoc($set))
4284 $page_changes[] = array(
4285 "date" => $page[
"hdate"],
4286 "id" => $page[
"page_id"],
4287 "lang" => $page[
"lang"],
4289 "nr" => $page[
"nr"],
4290 "user" => $page[
"user_id"]);
4295 return $page_changes;
4305 static function getAllPages($a_parent_type, $a_parent_id, $a_lang =
"-")
4312 $and_lang =
" AND lang = ".$ilDB->quote($a_lang,
"text");
4315 $page_changes = array();
4317 $q =
"SELECT * FROM page_object ".
4318 " WHERE parent_id = ".$ilDB->quote($a_parent_id,
"integer").
4319 " AND parent_type = ".$ilDB->quote($a_parent_type,
"text").$and_lang;
4320 $set =
$ilDB->query($q);
4322 while ($page =
$ilDB->fetchAssoc($set))
4324 $key_add = ($a_lang ==
"")
4327 $pages[$page[
"page_id"].$key_add] = array(
4328 "date" => $page[
"last_change"],
4329 "id" => $page[
"page_id"],
4330 "lang" => $page[
"lang"],
4331 "user" => $page[
"last_change_user"]);
4343 static function getNewPages($a_parent_type, $a_parent_id, $a_lang =
"-")
4350 $and_lang =
" AND lang = ".$ilDB->quote($a_lang,
"text");
4355 $q =
"SELECT * FROM page_object ".
4356 " WHERE parent_id = ".$ilDB->quote($a_parent_id,
"integer").
4357 " AND parent_type = ".$ilDB->quote($a_parent_type,
"text").$and_lang.
4358 " ORDER BY created DESC";
4359 $set =
$ilDB->query($q);
4360 while($page =
$ilDB->fetchAssoc($set))
4362 if ($page[
"created"] !=
"")
4365 "created" => $page[
"created"],
4366 "id" => $page[
"page_id"],
4367 "lang" => $page[
"lang"],
4368 "user" => $page[
"create_user"],
4389 $and_lang =
" AND lang = ".$ilDB->quote($a_lang,
"text");
4392 $contributors = array();
4393 $set =
$ilDB->queryF(
"SELECT last_change_user, lang, page_id FROM page_object ".
4394 " WHERE parent_id = %s AND parent_type = %s ".
4395 " AND last_change_user != %s".$and_lang,
4396 array(
"integer",
"text",
"integer"),
4397 array($a_parent_id, $a_parent_type, 0));
4399 while ($page =
$ilDB->fetchAssoc($set))
4403 $contributors[$page[
"last_change_user"]][$page[
"page_id"]][$page[
"lang"]] = 1;
4407 $contributors[$page[
"last_change_user"]][$page[
"page_id"]] = 1;
4411 $set =
$ilDB->queryF(
"SELECT count(DISTINCT page_id, parent_type, hdate, lang) as cnt, lang, page_id, user_id FROM page_history ".
4412 " WHERE parent_id = %s AND parent_type = %s AND user_id != %s ".$and_lang.
4413 " GROUP BY page_id, user_id, lang ",
4414 array(
"integer",
"text",
"integer"),
4415 array($a_parent_id, $a_parent_type, 0));
4416 while ($hpage =
$ilDB->fetchAssoc($set))
4420 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]][$hpage[
"lang"]] =
4421 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]][$hpage[
"lang"]] + $hpage[
"cnt"];
4425 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] =
4426 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] + $hpage[
"cnt"];
4431 foreach ($contributors as $k => $co)
4436 $c[] = array(
"user_id" => $k,
"pages" => $co,
4437 "lastname" => $name[
"lastname"],
"firstname" => $name[
"firstname"]);
4457 $and_lang =
" AND lang = ".$ilDB->quote($a_lang,
"text");
4460 $contributors = array();
4461 $set =
$ilDB->queryF(
"SELECT last_change_user, lang FROM page_object ".
4462 " WHERE page_id = %s AND parent_type = %s ".
4463 " AND last_change_user != %s".$and_lang,
4464 array(
"integer",
"text",
"integer"),
4465 array($a_page_id, $a_parent_type, 0));
4467 while ($page =
$ilDB->fetchAssoc($set))
4471 $contributors[$page[
"last_change_user"]][$page[
"lang"]] = 1;
4475 $contributors[$page[
"last_change_user"]] = 1;
4479 $set =
$ilDB->queryF(
"SELECT count(DISTINCT page_id, parent_type, hdate, lang) as cnt, lang, page_id, user_id FROM page_history ".
4480 " WHERE page_id = %s AND parent_type = %s AND user_id != %s ".$and_lang.
4481 " GROUP BY user_id, page_id, lang ",
4482 array(
"integer",
"text",
"integer"),
4483 array($a_page_id, $a_parent_type, 0));
4484 while ($hpage =
$ilDB->fetchAssoc($set))
4488 $contributors[$hpage[
"user_id"]][$page[
"lang"]] =
4489 $contributors[$hpage[
"user_id"]][$page[
"lang"]] + $hpage[
"cnt"];
4493 $contributors[$hpage[
"user_id"]] =
4494 $contributors[$hpage[
"user_id"]] + $hpage[
"cnt"];
4499 foreach ($contributors as $k => $co)
4502 $c[] = array(
"user_id" => $k,
"pages" => $co,
4503 "lastname" => $name[
"lastname"],
"firstname" => $name[
"firstname"]);
4516 $ilDB->update(
"page_object", array(
4517 "rendered_content" => array(
"clob", $a_content),
4518 "render_md5" => array(
"text", $a_md5),
4519 "rendered_time" => array(
"timestamp",
ilUtil::now())
4521 "page_id" => array(
"integer", $this->
getId()),
4538 $page_changes = array();
4543 $and_lang =
" AND lang = ".$ilDB->quote($a_lang,
"text");
4546 $q =
"SELECT * FROM page_object ".
4547 " WHERE parent_id = ".$ilDB->quote($a_parent_id,
"integer").
4548 " AND parent_type = ".$ilDB->quote($a_parent_type,
"text").
4549 " AND int_links = ".$ilDB->quote(1,
"integer").$and_lang;
4550 $set =
$ilDB->query($q);
4552 while ($page =
$ilDB->fetchAssoc($set))
4554 $key_add = ($a_lang ==
"")
4557 $pages[$page[
"page_id"].$key_add] = array(
4558 "date" => $page[
"last_change"],
4559 "id" => $page[
"page_id"],
4560 "lang" => $page[
"lang"],
4561 "user" => $page[
"last_change_user"]);
4575 if (strpos($a_content,
"IntLink"))
4602 $link_type =
"MediaObject";
4603 $a_id =
"il__mob_".$a_id;
4607 $link_type =
"PageObject";
4608 $a_id =
"il__pg_".$a_id;
4612 $link_type =
"GlossaryItem";
4613 $a_id =
"il__git_".$a_id;
4614 $a_target =
"Glossary";
4619 if ($link_type ==
"" || $a_id ==
"")
4622 $path =
"//PageObject/InitOpenedContent";
4624 if (count(
$res->nodeset) > 0)
4626 $res->nodeset[0]->unlink_node(
$res->nodeset[0]);
4632 $path =
"//PageObject/InitOpenedContent";
4634 if (count(
$res->nodeset) > 0)
4636 $init_node =
$res->nodeset[0];
4637 $childs = $init_node->child_nodes();
4638 for($i = 0; $i < count($childs); $i++)
4640 if ($childs[$i]->node_name() ==
"IntLink")
4642 $il_node = $childs[$i];
4648 $path =
"//PageObject";
4650 $page_node =
$res->nodeset[0];
4651 $init_node = $this->dom->create_element(
"InitOpenedContent");
4652 $init_node = $page_node->append_child($init_node);
4653 $il_node = $this->dom->create_element(
"IntLink");
4654 $il_node = $init_node->append_child($il_node);
4656 $il_node->set_attribute(
"Target", $a_id);
4657 $il_node->set_attribute(
"Type", $link_type);
4658 $il_node->set_attribute(
"TargetFrame", $a_target);
4675 $path =
"//PageObject/InitOpenedContent";
4678 if (count(
$res->nodeset) > 0)
4680 $init_node =
$res->nodeset[0];
4681 $childs = $init_node->child_nodes();
4682 for($i = 0; $i < count($childs); $i++)
4684 if ($childs[$i]->node_name() ==
"IntLink")
4686 $il_node = $childs[$i];
4690 if (!is_null($il_node))
4692 $id = $il_node->get_attribute(
"Target");
4693 $link_type = $il_node->get_attribute(
"Type");
4694 $target = $il_node->get_attribute(
"TargetFrame");
4706 case "GlossaryItem":
4710 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
4712 return array(
"id" =>
$id,
"type" => $type,
"target" => $target);
4741 function copy($a_id, $a_parent_type =
"", $a_parent_id = 0, $a_clone_mobs =
false)
4743 if ($a_parent_type ==
"")
4746 if ($a_parent_id == 0)
4752 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
4765 $new_page_object->setParentId($a_parent_id);
4766 $new_page_object->setId($a_id);
4768 $new_page_object->setXMLContent($orig_page->copyXMLContent($a_clone_mobs));
4769 $new_page_object->setActive($orig_page->getActive());
4770 $new_page_object->setActivationStart($orig_page->getActivationStart());
4771 $new_page_object->setActivationEnd($orig_page->getActivationEnd());
4774 $new_page_object->buildDom();
4775 $new_page_object->update();
4779 $new_page_object->create();
4796 $set =
$ilDB->query(
"SELECT lang FROM page_object ".
4797 " WHERE page_id = ".
$ilDB->quote($a_id,
"integer").
4798 " AND parent_type = ".$ilDB->quote($a_parent_type,
"text")
4801 while ($rec =
$ilDB->fetchAssoc($set))
4803 $langs[] = $rec[
"lang"];
4817 0, 0, $a_target_lang);
4818 $transl_page->setId($this->
getId());
4820 $transl_page->setXMLContent($this->copyXMLContent());
4821 $transl_page->setActive($this->
getActive());
4824 $transl_page->create();
4840 $min = (int) $aset->get(
"block_mode_minutes") ;
4845 $ilDB->manipulate(
"UPDATE page_object SET ".
4846 " edit_lock_user = ".
$ilDB->quote(
$ilUser->getId(),
"integer").
",".
4847 " edit_lock_ts = ".$ilDB->quote($ts,
"integer").
4848 " WHERE (edit_lock_user = ".$ilDB->quote(
$ilUser->getId(),
"integer").
" OR ".
4849 " edit_lock_ts < ".$ilDB->quote(time() - ($min * 60),
"integer").
") ".
4850 " AND page_id = ".
$ilDB->quote($this->getId(),
"integer").
4851 " AND parent_type = ".$ilDB->quote($this->getParentType(),
"text")
4854 $set =
$ilDB->query(
"SELECT edit_lock_user FROM page_object ".
4855 " WHERE page_id = ".
$ilDB->quote($this->getId(),
"integer").
4856 " AND parent_type = ".$ilDB->quote($this->getParentType(),
"text")
4858 $rec =
$ilDB->fetchAssoc($set);
4859 if ($rec[
"edit_lock_user"] !=
$ilUser->getId())
4877 $min = (int) $aset->get(
"block_mode_minutes") ;
4882 $ilDB->manipulate(
"UPDATE page_object SET ".
4883 " edit_lock_user = ".
$ilDB->quote(
$ilUser->getId(),
"integer").
",".
4884 " edit_lock_ts = 0".
4885 " WHERE edit_lock_user = ".$ilDB->quote(
$ilUser->getId(),
"integer").
4886 " AND page_id = ".$ilDB->quote($this->getId(),
"integer").
4887 " AND parent_type = ".$ilDB->quote($this->getParentType(),
"text")
4890 $set =
$ilDB->query(
"SELECT edit_lock_user FROM page_object ".
4891 " WHERE page_id = ".
$ilDB->quote($this->getId(),
"integer").
4892 " AND parent_type = ".$ilDB->quote($this->getParentType(),
"text")
4894 $rec =
$ilDB->fetchAssoc($set);
4895 if ($rec[
"edit_lock_user"] !=
$ilUser->getId())
4914 $min = (int) $aset->get(
"block_mode_minutes");
4916 $set =
$ilDB->query(
"SELECT edit_lock_user, edit_lock_ts FROM page_object ".
4917 " WHERE page_id = ".
$ilDB->quote($this->getId(),
"integer").
4918 " AND parent_type = ".$ilDB->quote($this->
getParentType(),
"text")
4920 $rec =
$ilDB->fetchAssoc($set);
4921 $rec[
"edit_lock_until"] = $rec[
"edit_lock_ts"] + $min * 60;
4938 public static function truncateHTML($a_text, $a_length = 100, $a_ending =
'...', $a_exact =
false, $a_consider_html =
true)
4940 include_once
"Services/Utilities/classes/class.ilStr.php";
4942 if ($a_consider_html)
4945 if(strlen(preg_replace(
'/<.*?>/',
'', $a_text)) <= $a_length)
4951 $total_length = strlen($a_ending);
4952 $open_tags = array();
4954 preg_match_all(
'/(<.+?>)?([^<>]*)/s', $a_text, $lines, PREG_SET_ORDER);
4955 foreach($lines as $line_matchings)
4958 if(!empty($line_matchings[1]))
4961 if(preg_match(
'/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1]))
4966 else if(preg_match(
'/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings))
4969 $pos = array_search($tag_matchings[1], $open_tags);
4972 unset($open_tags[$pos]);
4976 else if (preg_match(
'/^<\s*([^\s>!]+).*?>$/s', $line_matchings[1], $tag_matchings))
4979 array_unshift($open_tags, strtolower($tag_matchings[1]));
4982 $truncate .= $line_matchings[1];
4986 $content_length = strlen(preg_replace(
'/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i',
' ', $line_matchings[2]));
4987 if($total_length+$content_length > $a_length)
4990 $left = $a_length - $total_length;
4991 $entities_length = 0;
4993 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))
4996 foreach($entities[0] as $entity)
4998 if($entity[1]+1-$entities_length <= $left)
5001 $entities_length += strlen($entity[0]);
5019 $truncate .= $line_matchings[2];
5020 $total_length += $content_length;
5024 if($total_length >= $a_length)
5032 if(strlen($a_text) <= $a_length)
5044 if(!
sizeof($open_tags))
5050 $spacepos = strrpos($truncate,
' ');
5051 if($spacepos !==
false)
5061 $truncate .= $a_ending;
5063 if($a_consider_html)
5066 foreach($open_tags as $tag)
5068 $truncate .=
'</'.$tag.
'>';
5092 $file_obj_ids = array();
5096 $path =
"//FileItem/Identifier";
5098 for($i = 0; $i < count(
$res->nodeset); $i++)
5100 $file_obj_ids[] =
$res->nodeset[$i]->get_attribute(
"Entry");
5103 return $file_obj_ids;
static _instantiateQuestion($question_id)
Page not found exception.
getPCDefinitions()
Get PC definitions.
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.
_exists($a_type, $a_target)
Check if internal link refers to a valid target.
_saveLink($a_source_type, $a_source_id, $a_target_type, $a_target_id, $a_target_inst=0, $a_source_lang="-")
save internal link information
_extractObjIdOfTarget($a_target)
Extract object id out of target.
_deleteAllLinksOfSource($a_source_type, $a_source_id, $a_lang="-")
Delete all links of a given source.
_extractInstOfTarget($a_target)
Extract installation id out of target.
_removeInstFromTarget($a_target)
Removes installation id from target string.
_getIdForImportId($a_type, $a_target)
Get current id for an import id.
_getSourcesOfTarget($a_target_type, $a_target_id, $a_target_inst)
get all sources of a link target
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
Extension of ilPageObject for learning modules.
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.
_getFilesOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_usage_lang="-")
get all files of an object
_lookupFileSize($a_id)
Lookups the file size of the file in bytes.
static _lookupName($a_user_id)
lookup user name
static _lookupObjId($a_id)
_getLastUpdateOfObjects($a_objs)
Get last update for a set of media objects.
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
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 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.
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.
initPageConfig()
Init page config.
resolveIntLinks()
Resolves all internal link targets of the page, if targets are available (after import)
getLastChangeUser()
Get last change user.
_moveContentAfterHierId(&$a_source_page, &$a_target_page, $a_hid)
move content of hierarchical id >= $a_hid to other page
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
static _exists($a_parent_type, $a_id, $a_lang="")
Checks whether page exists.
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.
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
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 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
static getPagesWithLinks($a_parent_type, $a_parent_id, $a_lang="-")
Get all pages for parent object that contain internal links.
_writeParentId($a_parent_type, $a_pg_id, $a_par_id)
Write parent id.
getPageContentsHashes()
Get page contents hashes.
getHistoryEntry($a_old_nr)
Get History Entry.
getContentTemplates()
Get content templates.
_writeActive($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation=true, $a_lang="-")
write activation status
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
ilPageObject($a_id=0, $a_old_nr=0, $a_lang="-")
Constructor @access public.
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.
resolveMediaAliases($a_mapping)
Resolve media aliases (after import)
addChangeDivClasses($a_hashes)
getListItemIds()
get ids of all list items
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).
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)
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.
_lookupActivationData($a_id, $a_parent_type, $a_lang="-")
Lookup activation data.
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.
_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)
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 DOMXML_LOAD_VALIDATING
const DOMXML_LOAD_PARSING
const ILIAS_VERSION_NUMERIC
domxml_open_mem($str, $mode=DOMXML_LOAD_PARSING, &$error=NULL)
xpath_eval($xpath_context, $eval_str, $contextnode=null)
xpath_new_context($dom_document)
redirection script todo: (a better solution should control the processing via a xml file)