4define(
"IL_INSERT_BEFORE", 0);
5define(
"IL_INSERT_AFTER", 1);
6define(
"IL_INSERT_CHILD", 2);
132 final public function __construct($a_id = 0, $a_old_nr = 0, $a_lang =
"-")
135 $this->obj_definition =
$DIC[
"objDefinition"];
136 $this->db =
$DIC->database();
137 $this->
user = $DIC->user();
138 $this->lng =
$DIC->language();
139 $this->tree =
$DIC->repositoryTree();
146 $this->contains_int_link =
false;
147 $this->needs_parsing =
false;
148 $this->update_listeners = array();
149 $this->update_listener_cnt = 0;
150 $this->dom_builded =
false;
151 $this->page_not_found =
false;
152 $this->old_nr = $a_old_nr;
153 $this->encoding =
"UTF-8";
155 array(
"PageContent",
"TableRow",
"TableData",
"ListItem",
"FileItem",
156 "Section",
"Tab",
"ContentPopup",
"GridCell");
158 $this->show_page_act_info =
false;
190 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
222 $this->page_config = $a_val;
242 $this->rendermd5 = $a_rendermd5;
252 return $this->rendermd5;
262 $this->renderedcontent = $a_renderedcontent;
272 return $this->renderedcontent;
282 $this->renderedtime = $a_renderedtime;
292 return $this->renderedtime;
302 $this->lastchange = $a_lastchange;
312 return $this->lastchange;
322 $this->last_change_user = $a_val;
332 return $this->last_change_user;
342 $this->show_page_act_info = $a_val;
352 return $this->show_page_act_info;
361 if ($this->old_nr == 0) {
362 $query =
"SELECT * FROM page_object" .
363 " WHERE page_id = " . $this->db->quote($this->
id,
"integer") .
364 " AND parent_type=" . $this->db->quote($this->
getParentType(),
"text") .
365 " AND lang = " . $this->db->quote($this->
getLanguage(),
"text");
366 $pg_set = $this->db->query(
$query);
367 $this->page_record = $this->db->fetchAssoc($pg_set);
368 $this->
setActive($this->page_record[
"active"]);
373 $query =
"SELECT * FROM page_history" .
374 " WHERE page_id = " . $this->db->quote($this->
id,
"integer") .
375 " AND parent_type=" . $this->db->quote($this->
getParentType(),
"text") .
376 " AND nr = " . $this->db->quote((
int) $this->old_nr,
"integer") .
377 " AND lang = " . $this->db->quote($this->
getLanguage(),
"text");
378 $pg_set = $this->db->query(
$query);
379 $this->page_record = $this->db->fetchAssoc($pg_set);
381 if (!$this->page_record) {
382 include_once(
"./Services/COPage/exceptions/class.ilCOPageNotFoundException.php");
387 $this->xml = $this->page_record[
"content"];
388 $this->
setParentId($this->page_record[
"parent_id"]);
389 $this->last_change_user = $this->page_record[
"last_change_user"];
390 $this->create_user = $this->page_record[
"create_user"];
404 public static function _exists($a_parent_type, $a_id, $a_lang =
"", $a_no_cache =
false)
410 if (!$a_no_cache && isset(self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang])) {
411 return self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang];
416 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
419 $query =
"SELECT page_id FROM page_object WHERE page_id = " .
$db->quote($a_id,
"integer") .
" " .
420 "AND parent_type = " .
$db->quote($a_parent_type,
"text") . $and_lang;
422 if ($row =
$db->fetchAssoc($set)) {
423 self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang] =
true;
426 self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang] =
false;
440 include_once(
"./Services/COPage/classes/class.ilPageUtil.php");
446 if ($this->dom_builded && !$a_force) {
460 $path =
"//PageObject";
462 if (count(
$res->nodeset) == 1) {
464 $this->node =
$res->nodeset[0];
469 $this->dom_builded =
true;
499 return $this->dom->myDOMDocument;
521 $this->parent_id = $a_id;
532 $this->update_listeners[$cnt][
"object"] = $a_object;
533 $this->update_listeners[$cnt][
"method"] = $a_method;
534 $this->update_listeners[$cnt][
"parameters"] = $a_parameters;
535 $this->update_listener_cnt++;
541 $object = $this->update_listeners[
$i][
"object"];
542 $method = $this->update_listeners[
$i][
"method"];
543 $parameters = $this->update_listeners[
$i][
"parameters"];
544 $object->$method($parameters);
555 $this->active = $a_active;
563 public function getActive($a_check_scheduled_activation =
false)
565 if ($a_check_scheduled_activation && !$this->active) {
566 include_once(
"./Services/Calendar/classes/class.ilDateTime.php");
588 "SELECT page_id, parent_type, lang, active, activation_start, activation_end, show_activation_info FROM page_object " .
589 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer")
591 while ($rec =
$db->fetchAssoc($set)) {
592 self::$activation_data[$rec[
"page_id"] .
":" . $rec[
"parent_type"] .
":" . $rec[
"lang"]] = $rec;
600 public static function _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation =
false, $a_lang =
"-")
611 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
612 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
615 "SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s" .
616 " AND parent_type = %s AND lang = %s",
617 array(
"integer",
"text",
"text"),
618 array($a_id, $a_parent_type, $a_lang)
620 $rec =
$db->fetchAssoc($set);
626 if (!$rec[
"active"] && $a_check_scheduled_activation) {
627 if ($rec[
"n"] >= $rec[
"activation_start"] &&
628 $rec[
"n"] <= $rec[
"activation_end"]) {
633 return $rec[
"active"];
652 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
653 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
656 "SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s" .
657 " AND parent_type = %s AND lang = %s",
658 array(
"integer",
"text",
"text"),
659 array($a_id, $a_parent_type, $a_lang)
661 $rec =
$db->fetchAssoc($set);
664 if (!$rec[
"active"] && $rec[
"activation_start"] !=
"") {
674 public static function _writeActive($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation =
true, $a_lang =
"-")
685 if ($a_reset_scheduled_activation) {
686 $st =
$db->manipulateF(
687 "UPDATE page_object SET active = %s, activation_start = %s, " .
688 " activation_end = %s WHERE page_id = %s" .
689 " AND parent_type = %s AND lang = %s",
690 array(
"boolean",
"timestamp",
"timestamp",
"integer",
"text",
"text"),
691 array($a_active,
null,
null, $a_id, $a_parent_type, $a_lang)
694 $st =
$db->prepareManip(
695 "UPDATE page_object SET active = %s WHERE page_id = %s" .
696 " AND parent_type = %s AND lang = %s",
697 array(
"boolean",
"integer",
"text",
"text"),
698 array($a_active, $a_id, $a_parent_type, $a_lang)
717 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
718 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
721 "SELECT active, activation_start, activation_end, show_activation_info FROM page_object WHERE page_id = %s" .
722 " AND parent_type = %s AND lang = %s",
723 array(
"integer",
"text",
"text"),
724 array($a_id, $a_parent_type, $a_lang)
726 $rec =
$db->fetchAssoc($set);
742 $res =
$db->query(
"SELECT parent_id FROM page_object WHERE page_id = " .
$db->quote($a_id,
"integer") .
" " .
743 "AND parent_type=" .
$db->quote(
$a_type,
"text"));
745 return $rec[
"parent_id"];
757 "UPDATE page_object SET parent_id = %s WHERE page_id = %s" .
758 " AND parent_type = %s",
759 array(
"integer",
"integer",
"text"),
760 array($a_par_id, $a_pg_id, $a_parent_type)
771 if ($a_activationstart ==
"") {
772 $a_activationstart =
null;
774 $this->activationstart = $a_activationstart;
784 return $this->activationstart;
794 if ($a_activationend ==
"") {
795 $a_activationend =
null;
797 $this->activationend = $a_activationend;
807 return $this->activationend;
821 if (!is_object($cont_node)) {
824 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
825 $node_name = $cont_node->node_name();
826 if ($node_name ==
"PageObject") {
829 if ($node_name ==
"PageContent") {
830 $child_node = $cont_node->first_child();
831 $node_name = $child_node->node_name();
835 if ($node_name ==
"Table") {
836 if ($child_node->get_attribute(
"DataTable") ==
"y") {
837 require_once(
"./Services/COPage/classes/class.ilPCDataTable.php");
839 $tab->setNode($cont_node);
840 $tab->setHierId($a_hier_id);
842 require_once(
"./Services/COPage/classes/class.ilPCTable.php");
844 $tab->setNode($cont_node);
845 $tab->setHierId($a_hier_id);
847 $tab->setPcId($a_pc_id);
852 if ($node_name ==
"MediaObject") {
853 if (
$_GET[
"pgEdMediaMode"] !=
"") {
854 echo
"ilPageObject::error media";
859 require_once(
"./Services/COPage/classes/class.ilPCMediaObject.php");
861 $mal_node = $child_node->first_child();
863 $id_arr = explode(
"_", $mal_node->get_attribute(
"OriginId"));
864 $mob_id = $id_arr[count($id_arr) - 1];
873 $mob->readMediaObject($mob_id);
876 $mob->setNode($cont_node);
877 $mob->setHierId($a_hier_id);
878 $mob->setPcId($a_pc_id);
889 if (!is_array($pc_def)) {
890 include_once(
"./Services/COPage/exceptions/class.ilCOPageUnknownPCTypeException.php");
893 $pc_class =
"ilPC" . $pc_def[
"name"];
894 $pc_path =
"./" . $pc_def[
"component"] .
"/" . $pc_def[
"directory"] .
"/class." . $pc_class .
".php";
895 require_once($pc_path);
896 $pc =
new $pc_class($this);
897 $pc->setNode($cont_node);
898 $pc->setHierId($a_hier_id);
899 $pc->setPcId($a_pc_id);
912 if ($a_hier_id ==
"pg") {
916 if ($a_pc_id !=
"") {
917 $path =
"//*[@PCID = '$a_pc_id']";
919 if (count(
$res->nodeset) == 1) {
920 $cont_node =
$res->nodeset[0];
926 $path =
"//*[@HierId = '$a_hier_id']";
928 if (count(
$res->nodeset) == 1) {
929 $cont_node =
$res->nodeset[0];
941 public function checkForTag($a_content_tag, $a_hier_id, $a_pc_id =
"")
945 if ($a_pc_id !=
"") {
946 $path =
"//*[@PCID = '$a_pc_id']//" . $a_content_tag;
948 if (count(
$res->nodeset) > 0) {
954 $path =
"//*[@HierId = '$a_hier_id']//" . $a_content_tag;
956 if (count(
$res->nodeset) > 0) {
966 $path =
"//*[@HierId = '$a_hier_id']";
968 if (count(
$res->nodeset) == 1) {
992 $this->encoding = $a_encoding;
1004 $this->xml .= $a_xml;
1017 $enc_str = (!empty($this->encoding))
1018 ?
"encoding=\"" . $this->encoding .
"\""
1020 return "<?xml version=\"1.0\" $enc_str ?>" .
1021 "<!DOCTYPE PageObject SYSTEM \"" . ILIAS_ABSOLUTE_PATH .
"/xml/" . $this->cur_dtd .
"\">" .
1034 $xml = $this->getXmlContent();
1036 '<?xml version="1.0" encoding="UTF-8"?>' .
$xml,
1040 if (empty($error)) {
1043 $xml = $temp_dom->dump_mem(0, $this->encoding);
1044 $xml = preg_replace(
'/<\?xml[^>]*>/i',
"",
$xml);
1045 $xml = preg_replace(
'/<!DOCTYPE[^>]*>/i',
"",
$xml);
1069 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
1083 if ($a_clone_mobs) {
1089 $a_dom = $a_dom->myDOMDocument;
1091 foreach ($defs as $def) {
1093 $cl = $def[
"pc_class"];
1094 if ($cl ==
'ilPCPlugged') {
1096 ilPCPlugged::handleCopiedPluggedContent($this, $a_dom);
1098 $cl::handleCopiedContent($a_dom, $a_self_ass, $a_clone_mobs);
1110 public function handleDeleteContent($a_node =
null)
1112 if (!isset($a_node)) {
1114 $path =
"//PageContent";
1116 $nodes =
$res->nodeset;
1118 $nodes = array($a_node);
1121 require_once(
'Services/COPage/classes/class.ilPCPlugged.php');
1122 foreach ($nodes as
$node) {
1128 if (
$node->firstChild->nodeName ==
'Plugged') {
1129 ilPCPlugged::handleDeletedPluggedNode($this,
$node->firstChild);
1141 $path =
"//InteractiveImage/MediaAlias";
1146 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
1147 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1148 $or_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1153 if (!($inst_id > 0)) {
1155 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1160 $new_mob = $media_object->duplicate();
1162 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $new_mob->getId());
1174 $path =
"//MediaObject/MediaAlias";
1179 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
1180 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1181 $or_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1186 if (!($inst_id > 0)) {
1188 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1193 $new_mob = $media_object->duplicate();
1195 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $new_mob->getId());
1208 $path =
"//Question";
1213 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
1214 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1215 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
1220 if (!($inst_id > 0)) {
1222 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
1225 if (is_object($question) && $question->isComplete()) {
1229 $question->createPageObject();
1234 $duplicate_id = $question->duplicate(
false);
1235 $res->nodeset[
$i]->set_attribute(
"QRef",
"il__qst_" . $duplicate_id);
1251 $path =
"//Question";
1254 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1255 $parent_node =
$res->nodeset[
$i]->parent_node();
1256 $parent_node->unlink_node($parent_node);
1272 $path =
"//PageContent";
1275 return count(
$res->nodeset);
1283 $a_incl_head =
false,
1284 $a_append_mobs =
false,
1285 $a_append_bib =
false,
1287 $a_omit_pageobject_tag =
false
1291 return $this->dom->dump_mem(0, $this->encoding);
1294 if ($a_append_mobs || $a_append_bib || $a_append_link_info) {
1297 if ($a_append_mobs) {
1300 if ($a_append_bib) {
1306 return "<dummy>" . $this->dom->dump_node($this->node) .
$mobs . $bibs . $trans . $a_append_str .
"</dummy>";
1308 if (is_object($this->dom)) {
1309 if ($a_omit_pageobject_tag) {
1311 $childs = $this->node->child_nodes();
1312 for (
$i = 0;
$i < count($childs);
$i++) {
1313 $xml .= $this->dom->dump_node($childs[
$i]);
1317 $xml = $this->dom->dump_mem(0, $this->encoding);
1318 $xml = preg_replace(
'/<\?xml[^>]*>/i',
"",
$xml);
1319 $xml = preg_replace(
'/<!DOCTYPE[^>]*>/i',
"",
$xml);
1339 "ed_paste_clip",
"ed_edit",
"ed_edit_prop",
"ed_delete",
"ed_moveafter",
1340 "ed_movebefore",
"ed_go",
"ed_class",
"ed_width",
"ed_align_left",
1341 "ed_align_right",
"ed_align_center",
"ed_align_left_float",
1342 "ed_align_right_float",
"ed_delete_item",
"ed_new_item_before",
1343 "ed_new_item_after",
"ed_copy_clip",
"please_select",
"ed_split_page",
1344 "ed_item_up",
"ed_item_down",
"ed_split_page_next",
"ed_enable",
1345 "de_activate",
"ed_paste",
"ed_edit_multiple",
"ed_cut",
"ed_copy",
"ed_insert_templ",
1346 "ed_click_to_add_pg",
"download");
1349 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
1351 foreach ($defs as $def) {
1352 $lang_vars[] =
"pc_" . $def[
"pc_type"];
1353 $lang_vars[] =
"ed_insert_" . $def[
"pc_type"];
1356 $cl = $def[
"pc_class"];
1357 $lvs = call_user_func($def[
"pc_class"] .
'::getLangVars');
1358 foreach ($lvs as $lv) {
1363 foreach ($lang_vars as $lang_var) {
1373 $val = $this->lng->txt(
"cont_" . $var);
1374 $val = str_replace(
'"',
""", $val);
1375 $xml .=
"<LV name=\"$var\" value=\"" . $val .
"\"/>";
1383 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
1385 $path =
"//Paragraph[1]";
1387 if (count(
$res->nodeset) > 0) {
1388 $cont_node =
$res->nodeset[0]->parent_node();
1390 $par->setNode($cont_node);
1391 $text = $par->getText();
1408 if (is_object(
$node)) {
1427 $this->contains_int_link = $a_contains_link;
1447 $this->import_mode = $a_val;
1462 if ($a_parse ===
true) {
1463 $this->needs_parsing =
true;
1465 if ($a_parse ===
false) {
1466 $this->needs_parsing =
false;
1479 $this->contains_question = $a_val;
1489 return $this->contains_question;
1503 $path =
"//MediaObject/MediaAlias";
1506 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1507 $id_arr = explode(
"_",
$res->nodeset[
$i]->get_attribute(
"OriginId"));
1508 $mob_id = $id_arr[count($id_arr) - 1];
1509 $mob_ids[$mob_id] = $mob_id;
1514 $path =
"//InteractiveImage/MediaAlias";
1516 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1517 $id_arr = explode(
"_",
$res->nodeset[
$i]->get_attribute(
"OriginId"));
1518 $mob_id = $id_arr[count($id_arr) - 1];
1519 $mob_ids[$mob_id] = $mob_id;
1524 $path =
"//IntLink[@Type = 'MediaObject']";
1527 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1528 if ((
$res->nodeset[
$i]->get_attribute(
"TargetFrame") ==
"") ||
1529 (!$a_inline_only)) {
1530 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
1531 $id_arr = explode(
"_", $target);
1532 if (($id_arr[1] == IL_INST_ID) ||
1533 (substr($target, 0, 4) ==
"il__")) {
1534 $mob_id = $id_arr[count($id_arr) - 1];
1536 $mob_ids[$mob_id] = $mob_id;
1554 $path =
"//IntLink";
1559 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1561 if ($a_cnt_multiple) {
1562 $add =
":" . $cnt_multiple;
1564 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
1566 $targetframe =
$res->nodeset[
$i]->get_attribute(
"TargetFrame");
1567 $anchor =
$res->nodeset[
$i]->get_attribute(
"Anchor");
1568 $links[$target .
":" .
$type .
":" . $targetframe .
":" . $anchor . $add] =
1569 array(
"Target" => $target,
"Type" =>
$type,
1570 "TargetFrame" => $targetframe,
"Anchor" => $anchor);
1573 if (
$type ==
"MediaObject" && $targetframe ==
"") {
1574 if (substr($target, 0, 4) ==
"il__") {
1575 $id_arr = explode(
"_", $target);
1576 $id = $id_arr[count($id_arr) - 1];
1579 foreach ($med_links as $key => $med_link) {
1580 $links[$key] = $med_link;
1591 $path =
"//MediaAlias";
1594 require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
1595 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1596 $oid =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1597 if (substr($oid, 0, 4) ==
"il__") {
1598 $id_arr = explode(
"_", $oid);
1599 $id = $id_arr[count($id_arr) - 1];
1602 foreach ($med_links as $key => $med_link) {
1603 $links[$key] = $med_link;
1623 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1624 foreach ($mob_ids as $mob_id => $dummy) {
1627 $mobs_xml .= $mob_obj->getXML(
IL_MODE_OUTPUT, $a_inst = 0,
true);
1641 $path =
"//MediaObject/MediaAlias[@OriginId='il__mob_$a_mob_id']";
1643 $mal_node =
$res->nodeset[$a_nr - 1];
1644 $mob_node = $mal_node->parent_node();
1646 return $this->dom->dump_node($mob_node);
1659 libxml_disable_entity_loader(
false);
1661 @$this->dom->validate($error);
1684 $this->hier_ids = array();
1685 $this->first_row_ids = array();
1686 $this->first_col_ids = array();
1687 $this->list_item_ids = array();
1688 $this->file_item_ids = array();
1695 foreach ($this->id_elements as $el) {
1696 $path .= $sep .
"//" . $el;
1701 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1702 $cnode =
$res->nodeset[
$i];
1703 $ctag = $cnode->node_name();
1707 while ($cnode = $cnode->previous_sibling()) {
1708 if (($cnode->node_type() == XML_ELEMENT_NODE)
1709 && $cnode->has_attribute(
"HierId")) {
1710 $sib_hier_id = $cnode->get_attribute(
"HierId");
1716 if ($sib_hier_id !=
"") {
1717 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
1719 $res->nodeset[
$i]->set_attribute(
"HierId", $node_hier_id);
1720 $this->hier_ids[] = $node_hier_id;
1721 if ($ctag ==
"TableData") {
1722 if (substr($par_hier_id, strlen($par_hier_id) - 2) ==
"_1") {
1723 $this->first_row_ids[] = $node_hier_id;
1726 if ($ctag ==
"ListItem") {
1727 $this->list_item_ids[] = $node_hier_id;
1729 if ($ctag ==
"FileItem") {
1730 $this->file_item_ids[] = $node_hier_id;
1734 $cnode =
$res->nodeset[
$i];
1736 while ($cnode = $cnode->parent_node()) {
1737 if (($cnode->node_type() == XML_ELEMENT_NODE)
1738 && $cnode->has_attribute(
"HierId")) {
1739 $par_hier_id = $cnode->get_attribute(
"HierId");
1745 if (($par_hier_id !=
"") && ($par_hier_id !=
"pg")) {
1746 $node_hier_id = $par_hier_id .
"_1";
1747 $res->nodeset[
$i]->set_attribute(
"HierId", $node_hier_id);
1748 $this->hier_ids[] = $node_hier_id;
1749 if ($ctag ==
"TableData") {
1750 $this->first_col_ids[] = $node_hier_id;
1751 if (substr($par_hier_id, strlen($par_hier_id) - 2) ==
"_1") {
1752 $this->first_row_ids[] = $node_hier_id;
1755 if ($ctag ==
"ListItem") {
1756 $this->list_item_ids[] = $node_hier_id;
1758 if ($ctag ==
"FileItem") {
1759 $this->file_item_ids[] = $node_hier_id;
1762 $node_hier_id =
"1";
1763 $res->nodeset[
$i]->set_attribute(
"HierId", $node_hier_id);
1764 $this->hier_ids[] = $node_hier_id;
1771 $path =
"//PageObject";
1773 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1774 $res->nodeset[
$i]->set_attribute(
"HierId",
"pg");
1775 $this->hier_ids[] =
"pg";
1785 return $this->hier_ids;
1794 return $this->first_row_ids;
1803 return $this->first_col_ids;
1812 return $this->list_item_ids;
1821 return $this->file_item_ids;
1829 if (is_object($this->dom)) {
1831 $path =
"//*[@HierId]";
1833 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1834 if (
$res->nodeset[
$i]->has_attribute(
"HierId")) {
1835 $res->nodeset[
$i]->remove_attribute(
"HierId");
1847 if (!is_array($a_pc_ids) || count($a_pc_ids) == 0) {
1852 if (is_object($this->dom)) {
1854 $path =
"//*[@PCID]";
1856 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1857 $pc_id =
$res->nodeset[
$i]->get_attribute(
"PCID");
1858 if (in_array($pc_id, $a_pc_ids)) {
1859 $ret[$pc_id] =
$res->nodeset[
$i]->get_attribute(
"HierId");
1875 $path =
"//FileItem";
1877 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1878 $cnode =
$res->nodeset[
$i];
1879 $size_node = $this->dom->create_element(
"Size");
1880 $size_node = $cnode->append_child($size_node);
1882 $childs = $cnode->child_nodes();
1884 for ($j = 0; $j < count($childs); $j++) {
1885 if ($childs[$j]->node_name() ==
"Identifier") {
1886 if ($childs[$j]->has_attribute(
"Entry")) {
1887 $entry = $childs[$j]->get_attribute(
"Entry");
1888 $entry_arr = explode(
"_", $entry);
1889 $id = $entry_arr[count($entry_arr) - 1];
1890 require_once(
"./Modules/File/classes/class.ilObjFile.php");
1895 $size_node->set_content(
$size);
1910 $this->log->debug(
"start");
1914 $path =
"//IntLink";
1916 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1917 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
1920 if ($a_link_map ==
null) {
1922 $this->log->debug(
"no map, type: " .
$type .
", target: " . $target .
", new target: " . $new_target);
1925 $nt = explode(
"_", $a_link_map[$target]);
1926 $new_target =
false;
1927 if ($nt[1] == IL_INST_ID) {
1928 $new_target =
"il__" . $nt[2] .
"_" . $nt[3];
1930 $this->log->debug(
"map, type: " .
$type .
", target: " . $target .
", new target: " . $new_target);
1932 if ($new_target !==
false) {
1933 $res->nodeset[
$i]->set_attribute(
"Target", $new_target);
1937 IL_INST_ID > 0 &&
$type !=
"RepositoryItem") {
1940 $res->nodeset[
$i]->set_attribute(
"Target", $new_target);
1950 $path =
"//MediaAlias";
1954 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];
1974 $path =
"//MediaAlias";
1977 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1979 $old_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1980 $old_id = explode(
"_", $old_id);
1981 $old_id = $old_id[count($old_id) - 1];
1985 if ($a_mapping[$old_id] > 0) {
1986 $new_id = $a_mapping[$old_id];
1987 if ($a_reuse_existing_by_import) {
1990 $imp = explode(
"_", $import_id);
1998 if ($import_id ==
"" && $a_reuse_existing_by_import) {
2001 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2003 if (in_array($old_id, $med_of_def_lang)) {
2007 if ($new_id !=
"") {
2008 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $new_id);
2027 $path =
"//InteractiveImage/MediaAlias";
2030 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2031 $old_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
2032 if ($a_mapping[$old_id] > 0) {
2033 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $a_mapping[$old_id]);
2053 $path =
"//FileItem/Identifier";
2056 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2057 $old_id =
$res->nodeset[
$i]->get_attribute(
"Entry");
2058 $old_id = explode(
"_", $old_id);
2059 $old_id = $old_id[count($old_id) - 1];
2060 if ($a_mapping[$old_id] > 0) {
2061 $res->nodeset[
$i]->set_attribute(
"Entry",
"il__file_" . $a_mapping[$old_id]);
2079 $path =
"//Question";
2082 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2083 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
2085 if (isset($a_mapping[$qref])) {
2086 $res->nodeset[
$i]->set_attribute(
"QRef",
"il__qst_" . $a_mapping[$qref][
"pool"]);
2111 $path =
"//IntLink";
2113 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2114 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
2117 if ($a_from_to[$obj_id] > 0 && is_int(strpos($target,
"__"))) {
2119 $res->nodeset[
$i]->set_attribute(
"Target",
"il__pg_" . $a_from_to[$obj_id]);
2123 $res->nodeset[
$i]->set_attribute(
"Target",
"il__st_" . $a_from_to[$obj_id]);
2126 if (
$type ==
"PortfolioPage") {
2127 $res->nodeset[
$i]->set_attribute(
"Target",
"il__ppage_" . $a_from_to[$obj_id]);
2137 $path =
"//MediaAlias";
2140 require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
2141 require_once(
"Services/COPage/classes/class.ilMediaAliasItem.php");
2143 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2144 $media_object_node =
$res->nodeset[
$i]->parent_node();
2145 $page_content_node = $media_object_node->parent_node();
2146 $c_hier_id = $page_content_node->get_attribute(
"HierId");
2154 $areas = $std_alias_item->getMapAreas();
2155 $correction_needed =
false;
2156 if (count($areas) > 0) {
2158 foreach ($areas as $area) {
2159 if ($area[
"Type"] ==
"PageObject" ||
2160 $area[
"Type"] ==
"StructureObject") {
2161 $t = $area[
"Target"];
2162 $tid = _extractObjIdOfTarget($t);
2163 if ($a_from_to[$tid] > 0) {
2164 $correction_needed =
true;
2173 $oid =
$res->nodeset[
$i]->get_attribute(
"OriginId");
2174 if (substr($oid, 0, 4) ==
"il__") {
2175 $id_arr = explode(
"_", $oid);
2176 $id = $id_arr[count($id_arr) - 1];
2179 $med_item = $mob->getMediaItem(
"Standard");
2180 $med_areas = $med_item->getMapAreas();
2182 foreach ($med_areas as $area) {
2183 $link_type = ($area->getLinkType() ==
"int")
2188 "Nr" => $area->getNr(),
2189 "Shape" => $area->getShape(),
2190 "Coords" => $area->getCoords(),
2192 "LinkType" => $link_type,
2193 "Href" => $area->getHref(),
2194 "Title" => $area->getTitle(),
2195 "Target" => $area->getTarget(),
2196 "Type" => $area->getType(),
2197 "TargetFrame" => $area->getTargetFrame()
2201 if ($area->getType() ==
"PageObject" ||
2202 $area->getType() ==
"StructureObject") {
2203 $t = $area->getTarget();
2205 if ($a_from_to[$tid] > 0) {
2206 $correction_needed =
true;
2215 if ($correction_needed) {
2217 $std_alias_item->deleteAllMapAreas();
2218 foreach ($areas as $area) {
2219 if ($area[
"Link"][
"LinkType"] ==
"IntLink") {
2220 $target = $area[
"Link"][
"Target"];
2221 $type = $area[
"Link"][
"Type"];
2223 if ($a_from_to[$obj_id] > 0) {
2225 $area[
"Link"][
"Target"] =
"il__pg_" . $a_from_to[$obj_id];
2228 $area[
"Link"][
"Target"] =
"il__st_" . $a_from_to[$obj_id];
2233 $std_alias_item->addMapArea(
2236 $area[
"Link"][
"Title"],
2237 array(
"Type" => $area[
"Link"][
"Type"],
2238 "TargetFrame" => $area[
"Link"][
"TargetFrame"],
2239 "Target" => $area[
"Link"][
"Target"],
2240 "Href" => $area[
"Link"][
"Href"],
2241 "LinkType" => $area[
"Link"][
"LinkType"],
2260 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
2269 foreach ($sources as
$source) {
2271 if (
$source[
"type"] ==
"lm:pg") {
2273 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
2276 if (!$page_obj->page_not_found) {
2278 $page_obj->handleImportRepositoryLink(
2284 $page_obj->update();
2297 $path =
"//IntLink";
2300 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2302 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
2304 if ($target == $a_rep_import_id &&
$type ==
"RepositoryItem") {
2306 $res->nodeset[
$i]->set_attribute(
2308 "il__" . $a_rep_type .
"_" . $a_rep_ref_id
2326 $this->log->debug(
"Handle repository links...");
2330 $path =
"//IntLink";
2332 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2333 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
2335 $this->log->debug(
"Target: " . $target);
2336 $t = explode(
"_", $target);
2337 if (
$type ==
"RepositoryItem" && ((
int) $t[1] == 0 || (
int) $t[1] == IL_INST_ID)) {
2338 if (isset($a_mapping[$t[3]])) {
2340 $this->log->debug(
"... replace " . $t[3] .
" with " . $a_mapping[$t[3]] .
".");
2341 $res->nodeset[
$i]->set_attribute(
2343 "il__obj_" . $a_mapping[$t[3]]
2345 } elseif ($this->tree->isGrandChild($a_source_ref_id, $t[3])) {
2347 $this->log->debug(
"... remove links.");
2348 if (
$res->nodeset[
$i]->parent_node()->node_name() ==
"MapArea") {
2349 $parent =
$res->nodeset[
$i]->parent_node();
2350 $parent->unlink_node($parent);
2352 $source_node =
$res->nodeset[
$i];
2353 $new_node = $source_node->clone_node(
true);
2354 $new_node->unlink_node($new_node);
2355 $childs = $new_node->child_nodes();
2356 for ($j = 0; $j < count($childs); $j++) {
2357 $this->log->debug(
"... move node $j " . $childs[$j]->node_name() .
" before " . $source_node->node_name());
2358 $source_node->insert_before($childs[$j], $source_node);
2360 $source_node->unlink_node($source_node);
2370 $path =
"//ExtLink";
2372 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2373 $href =
$res->nodeset[
$i]->get_attribute(
"Href");
2374 $this->log->debug(
"Href: " . $href);
2376 $url = parse_url($href);
2379 $this->log->debug(
"Host: " .
$url[
"host"]);
2380 if (
$url[
"host"] !=
"" &&
$url[
"host"] != $ilias_url[
"host"]) {
2386 foreach (explode(
"&",
$url[
"query"]) as $p) {
2387 $p = explode(
"=", $p);
2388 $par[$p[0]] = $p[1];
2391 $target_client_id = $par[
"client_id"];
2392 if ($target_client_id !=
"" && $target_client_id != CLIENT_ID) {
2398 if (is_int(strpos($href,
"goto.php"))) {
2399 $t = explode(
"_", $par[
"target"]);
2400 if ($objDefinition->isRBACObject($t[0])) {
2401 $ref_id = (int) $t[1];
2404 } elseif (is_int(strpos($href,
"ilias.php"))) {
2405 $ref_id = (int) $par[
"ref_id"];
2410 if (isset($a_mapping[$ref_id])) {
2411 $new_ref_id = $a_mapping[$ref_id];
2414 if (is_int(strpos($href,
"goto.php"))) {
2415 $nt = str_replace(
$type .
"_" . $ref_id,
$type .
"_" . $new_ref_id, $par[
"target"]);
2416 $new_href = str_replace(
"target=" . $par[
"target"],
"target=" . $nt, $href);
2417 } elseif (is_int(strpos($href,
"ilias.php"))) {
2418 $new_href = str_replace(
"ref_id=" . $par[
"ref_id"],
"ref_id=" . $new_ref_id, $href);
2420 if ($new_href !=
"") {
2421 $this->log->debug(
"... ext link replace " . $href .
" with " . $new_href .
".");
2422 $res->nodeset[
$i]->set_attribute(
"Href", $new_href);
2424 } elseif (
$tree->isGrandChild($a_source_ref_id, $ref_id)) {
2426 $this->log->debug(
"... remove ext links.");
2427 if (
$res->nodeset[
$i]->parent_node()->node_name() ==
"MapArea") {
2428 $parent =
$res->nodeset[
$i]->parent_node();
2429 $parent->unlink_node($parent);
2431 $source_node =
$res->nodeset[
$i];
2432 $new_node = $source_node->clone_node(
true);
2433 $new_node->unlink_node($new_node);
2434 $childs = $new_node->child_nodes();
2435 for ($j = 0; $j < count($childs); $j++) {
2436 $this->log->debug(
"... move node $j " . $childs[$j]->node_name() .
" before " . $source_node->node_name());
2437 $source_node->insert_before($childs[$j], $source_node);
2439 $source_node->unlink_node($source_node);
2467 $this->db->insert(
"page_object", array(
2468 "page_id" => array(
"integer", $this->
getId()),
2469 "parent_id" => array(
"integer", $this->
getParentId()),
2471 "content" => array(
"clob", $content),
2473 "create_user" => array(
"integer", $this->
user->getId()),
2474 "last_change_user" => array(
"integer", $this->
user->getId()),
2475 "active" => array(
"integer", (
int) $this->
getActive()),
2479 "inactive_elements" => array(
"integer", $iel),
2480 "int_links" => array(
"integer", $inl),
2482 "last_change" => array(
"timestamp",
ilUtil::now()),
2483 "is_empty" => array(
"integer", $empty)
2501 $this->log->debug(
"ilPageObject, updateFromXML(): start, id: " . $this->
getId());
2505 $this->log->debug(
"ilPageObject, updateFromXML(): content: " . substr($content, 0, 100));
2513 $this->db->update(
"page_object", array(
2514 "content" => array(
"clob", $content),
2515 "parent_id" => array(
"integer", $this->
getParentId()),
2516 "last_change_user" => array(
"integer", $this->
user->getId()),
2517 "last_change" => array(
"timestamp",
ilUtil::now()),
2518 "active" => array(
"integer", $this->
getActive()),
2521 "inactive_elements" => array(
"integer", $iel),
2522 "int_links" => array(
"integer", $inl),
2524 "page_id" => array(
"integer", $this->
getId()),
2532 $this->log->debug(
"ilPageObject, updateFromXML(): end");
2543 final protected function __afterUpdate($a_domdoc, $a_xml, $a_creation =
false, $a_empty =
false)
2546 if (!$a_creation || !$a_empty) {
2556 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
2558 foreach ($defs as $def) {
2560 $cl = $def[
"pc_class"];
2561 call_user_func($def[
"pc_class"] .
'::afterPageUpdate', $this, $a_domdoc, $a_xml, $a_creation);
2587 public function update($a_validate =
true, $a_no_history =
false)
2589 $this->log->debug(
"ilPageObject, update(): start, id: " . $this->
getId());
2604 include_once(
"./Services/User/classes/class.ilUserUtil.php");
2607 1 =>
"nocontent#" . $this->lng->txt(
"cont_not_saved_edit_lock_expired") .
"<br />" .
2608 $this->lng->txt(
"obj_usr") .
": " .
2610 $this->lng->txt(
"content_until") .
": " .
2616 $this->log->debug(
"ilPageObject, update(): errors: " . print_r(
$errors,
true));
2632 $old_set = $this->db->query(
"SELECT * FROM page_object WHERE " .
2633 "page_id = " . $this->db->quote($this->getId(),
"integer") .
" AND " .
2634 "parent_type = " . $this->db->quote($this->getParentType(),
"text") .
" AND " .
2635 "lang = " . $this->db->quote($this->getLanguage(),
"text"));
2636 $last_nr_set = $this->db->query(
"SELECT max(nr) as mnr FROM page_history WHERE " .
2637 "page_id = " . $this->db->quote($this->getId(),
"integer") .
" AND " .
2638 "parent_type = " . $this->db->quote($this->getParentType(),
"text") .
" AND " .
2639 "lang = " . $this->db->quote($this->getLanguage(),
"text"));
2640 $last_nr = $this->db->fetchAssoc($last_nr_set);
2641 if ($old_rec = $this->db->fetchAssoc($old_set)) {
2644 if (($content != $old_rec[
"content"] || $this->
user->getId() != $old_rec[
"last_change_user"]) &&
2645 !$a_no_history && !$this->history_saved &&
$lm_set->get(
"page_history", 1)) {
2646 if ($old_rec[
"content"] !=
"<PageObject></PageObject>") {
2647 $this->db->manipulateF(
2648 "DELETE FROM page_history WHERE " .
2649 "page_id = %s AND parent_type = %s AND hdate = %s AND lang = %s",
2650 array(
"integer",
"text",
"timestamp",
"text"),
2651 array($old_rec[
"page_id"], $old_rec[
"parent_type"], $old_rec[
"last_change"], $old_rec[
"lang"])
2656 $last_c = $old_rec[
"last_change"];
2657 if ($last_c ==
"") {
2661 $this->db->insert(
"page_history", array(
2662 "page_id" => array(
"integer", $old_rec[
"page_id"]),
2663 "parent_type" => array(
"text", $old_rec[
"parent_type"]),
2664 "lang" => array(
"text", $old_rec[
"lang"]),
2665 "hdate" => array(
"timestamp", $last_c),
2666 "parent_id" => array(
"integer", $old_rec[
"parent_id"]),
2667 "content" => array(
"clob", $old_rec[
"content"]),
2668 "user_id" => array(
"integer", $old_rec[
"last_change_user"]),
2670 "nr" => array(
"integer", (
int) $last_nr[
"mnr"] + 1)
2673 $old_content = $old_rec[
"content"];
2674 $old_domdoc =
new DOMDocument();
2675 $old_nr = $last_nr[
"mnr"] + 1;
2676 $old_domdoc->loadXML(
'<?xml version="1.0" encoding="UTF-8"?>' . $old_content);
2681 $this->history_saved =
true;
2683 $this->history_saved =
true;
2688 $em = (trim($content) ==
"<PageObject/>")
2696 $this->db->update(
"page_object", array(
2697 "content" => array(
"clob", $content),
2698 "parent_id" => array(
"integer", $this->
getParentId()),
2699 "last_change_user" => array(
"integer", $this->
user->getId()),
2700 "last_change" => array(
"timestamp",
ilUtil::now()),
2701 "is_empty" => array(
"integer", $em),
2702 "active" => array(
"integer", $this->
getActive()),
2706 "inactive_elements" => array(
"integer", $iel),
2707 "int_links" => array(
"integer", $inl),
2709 "page_id" => array(
"integer", $this->
getId()),
2717 $this->log->debug(
"ilPageObject, update(): updated and returning true, content: " . substr($this->
getXMLContent(), 0, 100));
2731 public function delete()
2734 $copg_logger->debug(
2735 "ilPageObject: Delete called for ID '" . $this->
getId() .
"'," .
2737 " hist nr: '" . $this->old_nr .
"', " .
2744 if (!$this->page_not_found) {
2748 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2750 foreach ($mobs2 as $m) {
2751 if (!in_array($m,
$mobs)) {
2756 $copg_logger->debug(
"ilPageObject: ... found " . count(
$mobs) .
" media objects.");
2761 $this->handleDeleteContent();
2773 include_once(
"./Services/News/classes/class.ilNewsItem.php");
2782 $this->db->manipulate(
"DELETE FROM page_object " .
2783 "WHERE page_id = " . $this->db->quote($this->getId(),
"integer") .
2784 " AND parent_type= " . $this->db->quote($this->getParentType(),
"text"));
2787 foreach (
$mobs as $mob_id) {
2788 $copg_logger->debug(
"ilPageObject: ... processing mob " . $mob_id .
".");
2791 $copg_logger->debug(
"ilPageObject: ... type mismatch. Ignoring mob " . $mob_id .
".");
2796 $copg_logger->debug(
"ilPageObject: ... delete mob " . $mob_id .
".");
2801 $copg_logger->debug(
"ilPageObject: ... missing mob " . $mob_id .
".");
2814 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
2816 foreach ($defs as $def) {
2818 $cl = $def[
"pc_class"];
2819 call_user_func($def[
"pc_class"] .
'::beforePageDelete', $this);
2834 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
2836 foreach ($defs as $def) {
2838 $cl = $def[
"pc_class"];
2839 call_user_func($def[
"pc_class"] .
'::afterPageHistoryEntry', $this, $a_old_domdoc, $a_old_content, $a_old_nr);
2851 $xpath =
new DOMXPath($a_domdoc);
2852 $path =
"//Paragraph | //Section | //MediaAlias | //FileItem" .
2853 " | //Table | //TableData | //Tabs | //List";
2854 $nodes = $xpath->query($path);
2856 foreach ($nodes as
$node) {
2857 switch (
$node->localName) {
2859 $sname =
$node->getAttribute(
"Characteristic");
2860 $stype =
"text_block";
2865 $sname =
$node->getAttribute(
"Characteristic");
2871 $sname =
$node->getAttribute(
"Class");
2872 $stype =
"media_cont";
2877 $sname =
$node->getAttribute(
"Class");
2878 $stype =
"flist_li";
2883 $sname =
$node->getAttribute(
"Template");
2885 $sname =
$node->getAttribute(
"Class");
2895 $sname =
$node->getAttribute(
"Class");
2896 $stype =
"table_cell";
2901 $sname =
$node->getAttribute(
"Template");
2903 if (
$node->getAttribute(
"Type") ==
"HorizontalAccordion") {
2904 $stype =
"haccordion";
2906 if (
$node->getAttribute(
"Type") ==
"VerticalAccordion") {
2907 $stype =
"vaccordion";
2914 $sname =
$node->getAttribute(
"Class");
2915 if (
$node->getAttribute(
"Type") ==
"Ordered") {
2923 if ($sname !=
"" && $stype !=
"") {
2924 $usages[$sname .
":" . $stype .
":" . $template] = array(
"sname" => $sname,
2925 "stype" => $stype,
"template" => $template);
2932 foreach ($usages as $u) {
2933 $id = $this->db->nextId(
'page_style_usage');
2935 $this->db->manipulate(
"INSERT INTO page_style_usage " .
2936 "(id, page_id, page_type, page_lang, page_nr, template, stype, sname) VALUES (" .
2937 $this->db->quote(
$id,
"integer") .
"," .
2938 $this->db->quote($this->getId(),
"integer") .
"," .
2939 $this->db->quote($this->getParentType(),
"text") .
"," .
2940 $this->db->quote($this->getLanguage(),
"text") .
"," .
2941 $this->db->quote($a_old_nr,
"integer") .
"," .
2942 $this->db->quote($u[
"template"],
"integer") .
"," .
2943 $this->db->quote($u[
"stype"],
"text") .
"," .
2944 $this->db->quote($u[
"sname"],
"text") .
2957 if ($a_old_nr !==
false) {
2958 $and_old_nr =
" AND page_nr = " . $this->db->quote($a_old_nr,
"integer");
2961 $this->db->manipulate(
2962 "DELETE FROM page_style_usage WHERE " .
2963 " page_id = " . $this->db->quote($this->getId(),
"integer") .
2964 " AND page_type = " . $this->db->quote($this->getParentType(),
"text") .
2965 " AND page_lang = " . $this->db->quote($this->getLanguage(),
"text") .
2978 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2979 include_once(
"./Modules/File/classes/class.ilObjFile.php");
2988 $objs = array_merge(
$mobs, $files);
3000 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
3020 $xpath =
new DOMXPath($a_domdoc);
3021 $nodes = $xpath->query(
'//IntLink');
3022 foreach ($nodes as
$node) {
3023 $link_type =
$node->getAttribute(
"Type");
3025 switch ($link_type) {
3026 case "StructureObject":
3034 case "GlossaryItem":
3042 case "RepositoryItem":
3054 case "PortfolioPage":
3063 $target =
$node->getAttribute(
"Target");
3068 if (is_int(strpos($target,
"__"))) {
3105 $this->handleDeleteContent($curr_node);
3106 $curr_node->unlink_node($curr_node);
3122 if (!is_array($a_hids)) {
3125 foreach ($a_hids as $a_hid) {
3126 $a_hid = explode(
":", $a_hid);
3131 if (!$this->
checkForTag(
"Question", $a_hid[0], $a_hid[1]) || $a_self_ass) {
3133 if (is_object($curr_node)) {
3134 $parent_node = $curr_node->parent_node();
3135 if ($parent_node->node_name() !=
"TableRow") {
3136 $this->handleDeleteContent($curr_node);
3137 $curr_node->unlink_node($curr_node);
3167 if (!is_array($a_hids)) {
3171 $time = date(
"Y-m-d H:i:s", time());
3173 $hier_ids = array();
3175 foreach ($a_hids as $a_hid) {
3179 $a_hid = explode(
":", $a_hid);
3183 foreach ($hier_ids as $h) {
3184 if ($h .
"_" == substr($a_hid[0], 0, strlen($h) + 1)) {
3185 $skip[] = $a_hid[0];
3187 if ($a_hid[0] .
"_" == substr($h, 0, strlen($a_hid[0]) + 1)) {
3191 $pc_id[$a_hid[0]] = $a_hid[1];
3192 if ($a_hid[0] !=
"") {
3193 $hier_ids[$a_hid[0]] = $a_hid[0];
3196 foreach ($skip as $s) {
3197 unset($hier_ids[$s]);
3199 include_once(
"./Services/COPage/classes/class.ilPageContent.php");
3202 foreach ($hier_ids as $hid) {
3204 if (is_object($curr_node)) {
3205 if ($curr_node->node_name() ==
"PageContent") {
3206 $content = $this->dom->dump_node($curr_node);
3208 $content = preg_replace(
'/PCID=\"[a-z0-9]*\"/i',
"", $content);
3209 $content = preg_replace(
'/HierId=\"[a-z0-9_]*\"/i',
"", $content);
3211 $user->addToPCClipboard($content, $time, $nr);
3216 include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
3227 $a_hid = explode(
":", $a_hier_id);
3228 $content =
$user->getPCClipboardContent();
3232 for (
$i = count($content) - 1;
$i >= 0;
$i--) {
3235 '<?xml version="1.0" encoding="UTF-8"?>' .
$c,
3239 if (empty($error)) {
3242 $path =
"//PageContent";
3244 if (count(
$res->nodeset) > 0) {
3245 $new_pc_node =
$res->nodeset[0];
3246 $cloned_pc_node = $new_pc_node->clone_node(
true);
3247 $cloned_pc_node->unlink_node($cloned_pc_node);
3268 if (!is_array($a_hids)) {
3271 $obj = &$this->content_obj;
3273 foreach ($a_hids as $a_hid) {
3274 $a_hid = explode(
":", $a_hid);
3276 if (is_object($curr_node)) {
3277 if ($curr_node->node_name() ==
"PageContent") {
3279 if ($cont_obj->isEnabled()) {
3281 if (!$this->
checkForTag(
"Question", $a_hid[0], $a_hid[1]) || $a_self_ass) {
3282 $cont_obj->disable();
3285 $cont_obj->enable();
3309 foreach ($hier_ids as $hier_id) {
3311 if (!is_int(strpos($hier_id,
"_"))) {
3312 if ($hier_id !=
"pg" && $hier_id >= $a_hid) {
3314 $this->handleDeleteContent($curr_node);
3315 $curr_node->unlink_node($curr_node);
3336 foreach ($hier_ids as $hier_id) {
3338 if (!is_int(strpos($hier_id,
"_"))) {
3339 if ($hier_id !=
"pg" && $hier_id < $a_hid) {
3341 $this->handleDeleteContent($curr_node);
3342 $curr_node->unlink_node($curr_node);
3361 $hier_ids = $a_source_page->getHierIds();
3363 $copy_ids = array();
3366 foreach ($hier_ids as $hier_id) {
3368 if (!is_int(strpos($hier_id,
"_"))) {
3369 if ($hier_id !=
"pg" && $hier_id >= $a_hid) {
3370 $copy_ids[] = $hier_id;
3376 $parent_node = $a_target_page->getContentNode(
"pg");
3377 $target_dom = $a_target_page->getDom();
3378 $parent_childs = $parent_node->child_nodes();
3379 $cnt_parent_childs = count($parent_childs);
3381 $first_child = $parent_childs[0];
3382 foreach ($copy_ids as $copy_id) {
3383 $source_node = $a_source_page->getContentNode($copy_id);
3385 $new_node = $source_node->clone_node(
true);
3386 $new_node->unlink_node($new_node);
3388 $source_node->unlink_node($source_node);
3390 if ($cnt_parent_childs == 0) {
3391 $new_node = $parent_node->append_child($new_node);
3394 $new_node = $first_child->insert_before($new_node, $first_child);
3396 $parent_childs = $parent_node->child_nodes();
3401 $a_target_page->update();
3402 $a_source_page->update();
3412 $curr_name = $curr_node->node_name();
3415 if (($curr_name ==
"TableData") || ($curr_name ==
"PageObject") ||
3416 ($curr_name ==
"ListItem") || ($curr_name ==
"Section")
3417 || ($curr_name ==
"Tab") || ($curr_name ==
"ContentPopup")
3418 || ($curr_name ==
"GridCell")) {
3422 $hid = $curr_node->get_attribute(
"HierId");
3430 $pos = explode(
"_", $a_pos);
3431 $target_pos = array_pop($pos);
3432 $parent_pos = implode(
"_", $pos);
3435 $parent_pos = $a_pos;
3439 if ($parent_pos !=
"") {
3442 $parent_node = $this->
getNode();
3446 $parent_childs = $parent_node->child_nodes();
3447 $cnt_parent_childs = count($parent_childs);
3452 $new_node = $a_cont_obj->getNode();
3456 if ($succ_node = $curr_node->next_sibling()) {
3457 $new_node = $succ_node->insert_before($new_node, $succ_node);
3460 $new_node = $parent_node->append_child($new_node);
3462 $a_cont_obj->setNode($new_node);
3467 $new_node = $a_cont_obj->getNode();
3469 $new_node = $succ_node->insert_before($new_node, $succ_node);
3470 $a_cont_obj->setNode($new_node);
3476 $new_node = $a_cont_obj->getNode();
3477 if ($cnt_parent_childs == 0) {
3478 $new_node = $parent_node->append_child($new_node);
3480 $new_node = $parent_childs[0]->insert_before($new_node, $parent_childs[0]);
3482 $a_cont_obj->setNode($new_node);
3488 if (!$this->
getPageConfig()->getEnablePCType(
"PlaceHolder")) {
3489 $sub_nodes = $curr_node->child_nodes() ;
3490 foreach ($sub_nodes as $sub_node) {
3491 if ($sub_node->node_name() ==
"PlaceHolder") {
3492 $curr_node->unlink_node();
3505 $curr_name = $curr_node->node_name();
3508 if (($curr_name ==
"TableData") || ($curr_name ==
"PageObject") ||
3509 ($curr_name ==
"ListItem") || ($curr_name ==
"Section")
3510 || ($curr_name ==
"Tab") || ($curr_name ==
"ContentPopup")
3511 || ($curr_name ==
"GridCell")) {
3515 $hid = $curr_node->get_attribute(
"HierId");
3522 $pos = explode(
"_", $a_pos);
3523 $target_pos = array_pop($pos);
3524 $parent_pos = implode(
"_", $pos);
3527 $parent_pos = $a_pos;
3531 if ($parent_pos !=
"") {
3534 $parent_node = $this->
getNode();
3538 $parent_childs = $parent_node->child_nodes();
3539 $cnt_parent_childs = count($parent_childs);
3545 if ($succ_node = $curr_node->next_sibling()) {
3546 $a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
3548 $a_cont_node = $parent_node->append_child($a_cont_node);
3556 $a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
3563 if ($cnt_parent_childs == 0) {
3564 $a_cont_node = $parent_node->append_child($a_cont_node);
3566 $a_cont_node = $parent_childs[0]->insert_before($a_cont_node, $parent_childs[0]);
3579 if ($a_source == $a_target) {
3585 $source_node = $content->getNode();
3586 $clone_node = $source_node->clone_node(
true);
3592 $content->setNode($clone_node);
3603 if ($a_source == $a_target) {
3609 $source_node = $content->getNode();
3610 $clone_node = $source_node->clone_node(
true);
3616 $content->setNode($clone_node);
3643 $path =
"//IntLink";
3645 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3646 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
3649 if (substr($target, 0, 4) ==
"il__") {
3650 $id = substr($target, 4, strlen($target) - 4);
3654 if ($a_res_ref_to_obj_id &&
$type ==
"RepositoryItem") {
3655 $id_arr = explode(
"_",
$id);
3658 $ref_id = $id_arr[1];
3669 $id = $otype .
"_" . $obj_id .
"_" . $ref_id;
3673 $new_target =
"il_" . $a_inst .
"_" .
$id;
3674 $res->nodeset[
$i]->set_attribute(
"Target", $new_target);
3683 $path =
"//MediaAlias";
3685 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3686 $origin_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
3687 if (substr($origin_id, 0, 4) ==
"il__") {
3688 $new_id =
"il_" . $a_inst .
"_" . substr($origin_id, 4, strlen($origin_id) - 4);
3689 $res->nodeset[
$i]->set_attribute(
"OriginId", $new_id);
3696 $path =
"//FileItem/Identifier";
3698 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3699 $origin_id =
$res->nodeset[
$i]->get_attribute(
"Entry");
3700 if (substr($origin_id, 0, 4) ==
"il__") {
3701 $new_id =
"il_" . $a_inst .
"_" . substr($origin_id, 4, strlen($origin_id) - 4);
3702 $res->nodeset[
$i]->set_attribute(
"Entry", $new_id);
3709 $path =
"//Question";
3711 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3712 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
3714 if (substr($qref, 0, 4) ==
"il__") {
3715 $new_id =
"il_" . $a_inst .
"_" . substr($qref, 4, strlen($qref) - 4);
3717 $res->nodeset[
$i]->set_attribute(
"QRef", $new_id);
3724 $path =
"//ContentInclude";
3726 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3727 $ci =
$res->nodeset[
$i]->get_attribute(
"InstId");
3729 $res->nodeset[
$i]->set_attribute(
"InstId", $a_inst);
3744 foreach ($this->id_elements as $el) {
3745 $path .= $sep .
"//" . $el .
"[not(@PCID)]";
3747 $path .= $sep .
"//" . $el .
"[@PCID='']";
3753 if (count(
$res->nodeset) > 0) {
3773 foreach ($this->id_elements as $el) {
3774 $path .= $sep .
"//" . $el .
"[@PCID]";
3782 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3784 $pcids[] =
$node->get_attribute(
"PCID");
3803 foreach ($this->id_elements as $el) {
3804 $path .= $sep .
"//" . $el .
"[@PCID='" . $a_pc_id .
"']";
3811 return (count(
$res->nodeset) > 0);
3822 if ($a_pc_ids ===
false) {
3825 $id = ilUtil::randomHash(10, $a_pc_ids);
3842 foreach ($this->id_elements as $el) {
3843 $path .= $sep .
"//" . $el .
"[not(@PCID)]";
3845 $path .= $sep .
"//" . $el .
"[@PCID='']";
3851 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3853 $id = ilUtil::randomHash(10, $pcids);
3856 $res->nodeset[
$i]->set_attribute(
"PCID",
$id);
3866 $this->addHierIds();
3870 $path =
"//PageContent";
3875 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
3876 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3877 $hier_id =
$res->nodeset[
$i]->get_attribute(
"HierId");
3878 $pc_id =
$res->nodeset[
$i]->get_attribute(
"PCID");
3879 $dump = $mydom->dump_node(
$res->nodeset[
$i]);
3880 if (($hpos = strpos($dump,
' HierId="' . $hier_id .
'"')) > 0) {
3881 $dump = substr($dump, 0, $hpos) .
3882 substr($dump, $hpos + strlen(
' HierId="' . $hier_id .
'"'));
3885 $childs =
$res->nodeset[
$i]->child_nodes();
3887 if ($childs[0] && $childs[0]->node_name() ==
"Paragraph") {
3888 $content = $mydom->dump_node($childs[0]);
3891 strpos($content,
">") + 1,
3892 strrpos($content,
"<") - (strpos($content,
">") + 1)
3901 array(
"hier_id" => $hier_id,
"hash" => md5($dump),
"content" => $content);
3917 $path =
"//Question";
3922 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
3923 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3924 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
3929 if (!($inst_id > 0)) {
3949 $path =
"/descendant::Paragraph[position() = $par_id]";
3953 if (count(
$res->nodeset) != 1) {
3954 die(
"Should not happen");
3957 $context_node =
$res->nodeset[0];
3961 $childs = $context_node->child_nodes();
3963 for ($j = 0; $j < count($childs); $j++) {
3964 $content .= $mydom->dump_node($childs[$j]);
3967 $content = str_replace(
"<br />",
"\n", $content);
3968 $content = str_replace(
"<br/>",
"\n", $content);
3970 $plain_content = html_entity_decode($content);
3988 $xsl = file_get_contents(
"./Services/COPage/xsl/page_fo.xsl");
3989 $args = array(
'/_xml' =>
$xml,
'/_xsl' => $xsl );
3995 $fo = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl",
null, $args, $params);
3998 $fo = str_replace(
"\n",
"", $fo);
3999 $fo = str_replace(
"<br/>",
"<br>", $fo);
4000 $fo = str_replace(
"<br>",
"\n", $fo);
4005 $fo = substr($fo, strpos($fo,
">") + 1);
4012 $this->offline_handler = $handler;
4036 if ($a_lang ==
"") {
4040 $query =
"SELECT * FROM page_object WHERE page_id = " .
4041 $db->quote($a_id,
"integer") .
" AND " .
4042 " parent_type = " .
$db->quote($a_parent_type,
"text") .
" AND " .
4043 " lang = " .
$db->quote($a_lang,
"text") .
" AND " .
4044 " inactive_elements = " .
$db->quote(1,
"integer");
4062 if (strpos(
$a_content,
" Enabled=\"False\"")) {
4075 $h_query =
"SELECT * FROM page_history " .
4076 " WHERE page_id = " .
$db->quote($this->
getId(),
"integer") .
4079 " ORDER BY hdate DESC";
4081 $hset =
$db->query($h_query);
4082 $hentries = array();
4084 while ($hrec =
$db->fetchAssoc($hset)) {
4085 $hrec[
"sortkey"] = (int) $hrec[
"nr"];
4086 $hrec[
"user"] = (int) $hrec[
"user_id"];
4087 $hentries[] = $hrec;
4101 "SELECT * FROM page_history " .
4102 " WHERE page_id = %s " .
4103 " AND parent_type = %s " .
4106 array(
"integer",
"text",
"integer",
"text"),
4109 if ($hrec =
$db->fetchAssoc(
$res)) {
4128 $and_nr = ($a_nr > 0)
4129 ?
" AND nr < " .
$db->quote((
int) $a_nr,
"integer")
4131 $res =
$db->query(
"SELECT MAX(nr) mnr FROM page_history " .
4132 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4137 if ($row[
"mnr"] > 0) {
4138 $res =
$db->query(
"SELECT * FROM page_history " .
4139 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4142 " AND nr = " .
$db->quote((
int) $row[
"mnr"],
"integer"));
4144 $ret[
"previous"] = $row;
4148 $res =
$db->query(
"SELECT MIN(nr) mnr FROM page_history " .
4149 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4152 " AND nr > " .
$db->quote((
int) $a_nr,
"integer"));
4154 if ($row[
"mnr"] > 0) {
4155 $res =
$db->query(
"SELECT * FROM page_history " .
4156 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4159 " AND nr = " .
$db->quote((
int) $row[
"mnr"],
"integer"));
4161 $ret[
"next"] = $row;
4166 $res =
$db->query(
"SELECT * FROM page_history " .
4167 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4170 " AND nr = " .
$db->quote((
int) $a_nr,
"integer"));
4173 $res =
$db->query(
"SELECT page_id, last_change hdate, parent_type, parent_id, last_change_user user_id, content, lang FROM page_object " .
4174 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4179 $ret[
"current"] = $row;
4189 $rnode =
$res->nodeset[0];
4192 foreach ($a_hashes as $pc_id => $h) {
4194 if ($h[
"change"] !=
"") {
4195 $dc_node = $this->dom->create_element(
"DivClass");
4196 $dc_node->set_attribute(
"HierId", $h[
"hier_id"]);
4197 $dc_node->set_attribute(
"Class",
"ilEdit" . $h[
"change"]);
4198 $dc_node = $rnode->append_child($dc_node);
4213 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
4217 $l_hashes = $l_page->getPageContentsHashes();
4218 $r_hashes = $r_page->getPageContentsHashes();
4220 foreach ($l_hashes as $pc_id => $h) {
4221 if (!isset($r_hashes[$pc_id])) {
4222 $l_hashes[$pc_id][
"change"] =
"Deleted";
4224 if ($l_hashes[$pc_id][
"hash"] != $r_hashes[$pc_id][
"hash"]) {
4225 $l_hashes[$pc_id][
"change"] =
"Modified";
4226 $r_hashes[$pc_id][
"change"] =
"Modified";
4228 include_once(
"./Services/COPage/mediawikidiff/class.WordLevelDiff.php");
4230 if ($l_hashes[$pc_id][
"content"] !=
"" &&
4231 $r_hashes[$pc_id][
"content"] !=
"") {
4232 $new_left = str_replace(
"\n",
"<br />", $l_hashes[$pc_id][
"content"]);
4233 $new_right = str_replace(
"\n",
"<br />", $r_hashes[$pc_id][
"content"]);
4238 $new_left = $wldiff->orig();
4239 $new_right = $wldiff->closing();
4240 $l_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_left[0]);
4241 $r_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_right[0]);
4248 foreach ($r_hashes as $pc_id => $h) {
4249 if (!isset($l_hashes[$pc_id])) {
4250 $r_hashes[$pc_id][
"change"] =
"New";
4253 $l_page->addChangeDivClasses($l_hashes);
4254 $r_page->addChangeDivClasses($r_hashes);
4256 return array(
"l_page" => $l_page,
"r_page" => $r_page,
4257 "l_changes" => $l_hashes,
"r_changes" => $r_hashes);
4267 $db->manipulate(
"UPDATE page_object " .
4268 " SET view_cnt = view_cnt + 1 " .
4269 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4270 " AND parent_type = " .
$db->quote($this->getParentType(),
"text") .
4271 " AND lang = " .
$db->quote($this->getLanguage(),
"text"));
4281 public static function getRecentChanges($a_parent_type, $a_parent_id, $a_period = 30, $a_lang =
"")
4288 if ($a_lang !=
"") {
4289 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4292 $page_changes = array();
4293 $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
4294 $q =
"SELECT * FROM page_object " .
4295 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4296 " AND parent_type = " .
$db->quote($a_parent_type,
"text") .
4297 " AND last_change >= " .
$db->quote($limit_ts,
"timestamp") . $and_lang;
4299 $set =
$db->query($q);
4300 while ($page =
$db->fetchAssoc($set)) {
4301 $page_changes[] = array(
4302 "date" => $page[
"last_change"],
4303 "id" => $page[
"page_id"],
4304 "lang" => $page[
"lang"],
4306 "user" => $page[
"last_change_user"]);
4310 if ($a_period > 0) {
4311 $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
4312 $and_str =
" AND hdate >= " .
$db->quote($limit_ts,
"timestamp") .
" ";
4315 $q =
"SELECT * FROM page_history " .
4316 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4317 " AND parent_type = " .
$db->quote($a_parent_type,
"text") .
4318 $and_str . $and_lang;
4319 $set =
$db->query($q);
4320 while ($page =
$db->fetchAssoc($set)) {
4321 $page_changes[] = array(
4322 "date" => $page[
"hdate"],
4323 "id" => $page[
"page_id"],
4324 "lang" => $page[
"lang"],
4326 "nr" => $page[
"nr"],
4327 "user" => $page[
"user_id"]);
4332 return $page_changes;
4343 public static function getAllPages($a_parent_type, $a_parent_id, $a_lang =
"-")
4350 if ($a_lang !=
"") {
4351 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4354 $q =
"SELECT * FROM page_object " .
4355 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4356 " AND parent_type = " .
$db->quote($a_parent_type,
"text") . $and_lang;
4357 $set =
$db->query($q);
4359 while ($page =
$db->fetchAssoc($set)) {
4360 $key_add = ($a_lang ==
"")
4361 ?
":" . $page[
"lang"]
4363 $pages[$page[
"page_id"] . $key_add] = array(
4364 "date" => $page[
"last_change"],
4365 "id" => $page[
"page_id"],
4366 "lang" => $page[
"lang"],
4367 "user" => $page[
"last_change_user"]);
4379 public static function getNewPages($a_parent_type, $a_parent_id, $a_lang =
"-")
4386 if ($a_lang !=
"") {
4387 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4392 $q =
"SELECT * FROM page_object " .
4393 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4394 " AND parent_type = " .
$db->quote($a_parent_type,
"text") . $and_lang .
4395 " ORDER BY created DESC";
4396 $set =
$db->query($q);
4397 while ($page =
$db->fetchAssoc($set)) {
4398 if ($page[
"created"] !=
"") {
4400 "created" => $page[
"created"],
4401 "id" => $page[
"page_id"],
4402 "lang" => $page[
"lang"],
4403 "user" => $page[
"create_user"],
4424 if ($a_lang !=
"") {
4425 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4428 $contributors = array();
4430 "SELECT last_change_user, lang, page_id FROM page_object " .
4431 " WHERE parent_id = %s AND parent_type = %s " .
4432 " AND last_change_user != %s" . $and_lang,
4433 array(
"integer",
"text",
"integer"),
4434 array($a_parent_id, $a_parent_type, 0)
4437 while ($page =
$db->fetchAssoc($set)) {
4438 if ($a_lang ==
"") {
4439 $contributors[$page[
"last_change_user"]][$page[
"page_id"]][$page[
"lang"]] = 1;
4441 $contributors[$page[
"last_change_user"]][$page[
"page_id"]] = 1;
4446 "SELECT count(*) as cnt, lang, page_id, user_id FROM page_history " .
4447 " WHERE parent_id = %s AND parent_type = %s AND user_id != %s " . $and_lang .
4448 " GROUP BY page_id, user_id, lang ",
4449 array(
"integer",
"text",
"integer"),
4450 array($a_parent_id, $a_parent_type, 0)
4452 while ($hpage =
$db->fetchAssoc($set)) {
4453 if ($a_lang ==
"") {
4454 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]][$hpage[
"lang"]] =
4455 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]][$hpage[
"lang"]] + $hpage[
"cnt"];
4457 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] =
4458 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] + $hpage[
"cnt"];
4463 foreach ($contributors as $k => $co) {
4466 $c[] = array(
"user_id" => $k,
"pages" => $co,
4467 "lastname" =>
$name[
"lastname"],
"firstname" =>
$name[
"firstname"]);
4487 if ($a_lang !=
"") {
4488 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4491 $contributors = array();
4493 "SELECT last_change_user, lang FROM page_object " .
4494 " WHERE page_id = %s AND parent_type = %s " .
4495 " AND last_change_user != %s" . $and_lang,
4496 array(
"integer",
"text",
"integer"),
4497 array($a_page_id, $a_parent_type, 0)
4500 while ($page =
$db->fetchAssoc($set)) {
4501 if ($a_lang ==
"") {
4502 $contributors[$page[
"last_change_user"]][$page[
"lang"]] = 1;
4504 $contributors[$page[
"last_change_user"]] = 1;
4509 "SELECT count(*) as cnt, lang, page_id, user_id FROM page_history " .
4510 " WHERE page_id = %s AND parent_type = %s AND user_id != %s " . $and_lang .
4511 " GROUP BY user_id, page_id, lang ",
4512 array(
"integer",
"text",
"integer"),
4513 array($a_page_id, $a_parent_type, 0)
4515 while ($hpage =
$db->fetchAssoc($set)) {
4516 if ($a_lang ==
"") {
4517 $contributors[$hpage[
"user_id"]][$page[
"lang"]] =
4518 $contributors[$hpage[
"user_id"]][$page[
"lang"]] + $hpage[
"cnt"];
4520 $contributors[$hpage[
"user_id"]] =
4521 $contributors[$hpage[
"user_id"]] + $hpage[
"cnt"];
4526 foreach ($contributors as $k => $co) {
4527 include_once
"Services/User/classes/class.ilObjUser.php";
4529 $c[] = array(
"user_id" => $k,
"pages" => $co,
4530 "lastname" =>
$name[
"lastname"],
"firstname" =>
$name[
"firstname"]);
4545 $db->update(
"page_object", array(
4546 "rendered_content" => array(
"clob",
$a_content),
4547 "render_md5" => array(
"text", $a_md5),
4548 "rendered_time" => array(
"timestamp",
ilUtil::now())
4550 "page_id" => array(
"integer", $this->
getId()),
4570 if ($a_lang !=
"") {
4571 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4574 $q =
"SELECT * FROM page_object " .
4575 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4576 " AND parent_type = " .
$db->quote($a_parent_type,
"text") .
4577 " AND int_links = " .
$db->quote(1,
"integer") . $and_lang;
4578 $set =
$db->query($q);
4580 while ($page =
$db->fetchAssoc($set)) {
4581 $key_add = ($a_lang ==
"")
4582 ?
":" . $page[
"lang"]
4584 $pages[$page[
"page_id"] . $key_add] = array(
4585 "date" => $page[
"last_change"],
4586 "id" => $page[
"page_id"],
4587 "lang" => $page[
"lang"],
4588 "user" => $page[
"last_change_user"]);
4629 $link_type =
"MediaObject";
4630 $a_id =
"il__mob_" . $a_id;
4634 $link_type =
"PageObject";
4635 $a_id =
"il__pg_" . $a_id;
4639 $link_type =
"GlossaryItem";
4640 $a_id =
"il__git_" . $a_id;
4641 $a_target =
"Glossary";
4646 if ($link_type ==
"" || $a_id ==
"") {
4648 $path =
"//PageObject/InitOpenedContent";
4650 if (count(
$res->nodeset) > 0) {
4651 $res->nodeset[0]->unlink_node(
$res->nodeset[0]);
4655 $path =
"//PageObject/InitOpenedContent";
4657 if (count(
$res->nodeset) > 0) {
4658 $init_node =
$res->nodeset[0];
4659 $childs = $init_node->child_nodes();
4660 for (
$i = 0;
$i < count($childs);
$i++) {
4661 if ($childs[
$i]->node_name() ==
"IntLink") {
4662 $il_node = $childs[
$i];
4666 $path =
"//PageObject";
4668 $page_node =
$res->nodeset[0];
4669 $init_node = $this->dom->create_element(
"InitOpenedContent");
4670 $init_node = $page_node->append_child($init_node);
4671 $il_node = $this->dom->create_element(
"IntLink");
4672 $il_node = $init_node->append_child($il_node);
4674 $il_node->set_attribute(
"Target", $a_id);
4675 $il_node->set_attribute(
"Type", $link_type);
4676 $il_node->set_attribute(
"TargetFrame", $a_target);
4693 $path =
"//PageObject/InitOpenedContent";
4696 if (count(
$res->nodeset) > 0) {
4697 $init_node =
$res->nodeset[0];
4698 $childs = $init_node->child_nodes();
4699 for (
$i = 0;
$i < count($childs);
$i++) {
4700 if ($childs[
$i]->node_name() ==
"IntLink") {
4701 $il_node = $childs[
$i];
4705 if (!is_null($il_node)) {
4706 $id = $il_node->get_attribute(
"Target");
4707 $link_type = $il_node->get_attribute(
"Type");
4708 $target = $il_node->get_attribute(
"TargetFrame");
4710 switch ($link_type) {
4719 case "GlossaryItem":
4723 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
4725 return array(
"id" =>
$id,
"type" =>
$type,
"target" => $target);
4753 public function copy($a_id, $a_parent_type =
"", $a_parent_id = 0, $a_clone_mobs =
false)
4755 if ($a_parent_type ==
"") {
4757 if ($a_parent_id == 0) {
4762 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
4771 $new_page_object->setParentId($a_parent_id);
4772 $new_page_object->setId($a_id);
4774 $new_page_object->setXMLContent($orig_page->copyXMLContent($a_clone_mobs));
4775 $new_page_object->setActive($orig_page->getActive());
4776 $new_page_object->setActivationStart($orig_page->getActivationStart());
4777 $new_page_object->setActivationEnd($orig_page->getActivationEnd());
4779 $new_page_object->buildDom();
4780 $new_page_object->update();
4782 $new_page_object->create();
4801 "SELECT lang FROM page_object " .
4802 " WHERE page_id = " .
$db->quote($a_id,
"integer") .
4803 " AND parent_type = " .
$db->quote($a_parent_type,
"text")
4806 while ($rec =
$db->fetchAssoc($set)) {
4807 $langs[] = $rec[
"lang"];
4826 $transl_page->setId($this->
getId());
4828 $transl_page->setXMLContent($this->copyXMLContent());
4829 $transl_page->setActive($this->
getActive());
4832 $transl_page->create();
4852 "UPDATE page_object SET " .
4853 " edit_lock_user = " .
$db->quote(
$user->getId(),
"integer") .
"," .
4854 " edit_lock_ts = " .
$db->quote($ts,
"integer") .
4855 " WHERE (edit_lock_user = " .
$db->quote(
$user->getId(),
"integer") .
" OR " .
4856 " edit_lock_ts < " .
$db->quote(time() - ($min * 60),
"integer") .
") " .
4857 " AND page_id = " .
$db->quote($this->getId(),
"integer") .
4858 " AND parent_type = " .
$db->quote($this->getParentType(),
"text")
4862 "SELECT edit_lock_user FROM page_object " .
4863 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4864 " AND parent_type = " .
$db->quote($this->getParentType(),
"text")
4866 $rec =
$db->fetchAssoc($set);
4867 if ($rec[
"edit_lock_user"] !=
$user->getId()) {
4884 $min = (int) $aset->get(
"block_mode_minutes") ;
4889 "UPDATE page_object SET " .
4890 " edit_lock_user = " .
$db->quote(
$user->getId(),
"integer") .
"," .
4891 " edit_lock_ts = 0" .
4892 " WHERE edit_lock_user = " .
$db->quote(
$user->getId(),
"integer") .
4893 " AND page_id = " .
$db->quote($this->getId(),
"integer") .
4894 " AND parent_type = " .
$db->quote($this->getParentType(),
"text")
4898 "SELECT edit_lock_user FROM page_object " .
4899 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4900 " AND parent_type = " .
$db->quote($this->getParentType(),
"text")
4902 $rec =
$db->fetchAssoc($set);
4903 if ($rec[
"edit_lock_user"] !=
$user->getId()) {
4921 $min = (int) $aset->get(
"block_mode_minutes");
4924 "SELECT edit_lock_user, edit_lock_ts FROM page_object " .
4925 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4928 $rec =
$db->fetchAssoc($set);
4929 $rec[
"edit_lock_until"] = $rec[
"edit_lock_ts"] + $min * 60;
4946 public static function truncateHTML($a_text, $a_length = 100, $a_ending =
'...', $a_exact =
false, $a_consider_html =
true)
4948 include_once
"Services/Utilities/classes/class.ilStr.php";
4950 if ($a_consider_html) {
4952 if (strlen(preg_replace(
'/<.*?>/',
'', $a_text)) <= $a_length) {
4957 $total_length = strlen($a_ending);
4958 $open_tags = array();
4960 preg_match_all(
'/(<.+?>)?([^<>]*)/s', $a_text, $lines, PREG_SET_ORDER);
4961 foreach ($lines as $line_matchings) {
4963 if (!empty($line_matchings[1])) {
4965 if (preg_match(
'/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) {
4969 elseif (preg_match(
'/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) {
4971 $pos = array_search($tag_matchings[1], $open_tags);
4972 if ($pos !==
false) {
4973 unset($open_tags[$pos]);
4977 elseif (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) {
4989 $left = $a_length - $total_length;
4990 $entities_length = 0;
4992 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)) {
4994 foreach ($entities[0] as $entity) {
4995 if ($entity[1] + 1 - $entities_length <= $left) {
4997 $entities_length += strlen($entity[0]);
5011 $truncate .= $line_matchings[2];
5012 $total_length += $content_length;
5016 if ($total_length >= $a_length) {
5021 if (strlen($a_text) <= $a_length) {
5030 if (!
sizeof($open_tags)) {
5034 $spacepos = strrpos($truncate,
' ');
5035 if ($spacepos !==
false) {
5044 $truncate .= $a_ending;
5046 if ($a_consider_html) {
5048 foreach ($open_tags as $tag) {
5049 $truncate .=
'</' . $tag .
'>';
5080 if ($a_lang !=
"") {
5081 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
5085 $q =
"SELECT last_change FROM page_object " .
5086 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
5087 " AND parent_type = " .
$db->quote($a_parent_type,
"text") . $and_lang .
5088 " ORDER BY last_change DESC";
5090 $set =
$db->query($q);
5091 $rec =
$db->fetchAssoc($set);
5093 return $rec[
"last_change"];
5098 if ($this->
getPageConfig()->getEditLockSupport() ==
false) {
5103 $min = (int) $aset->get(
"block_mode_minutes") ;
5115 $file_obj_ids = array();
5119 $path =
"//FileItem/Identifier";
5121 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
5122 $file_obj_ids[] =
$res->nodeset[
$i]->get_attribute(
"Entry");
5125 return $file_obj_ids;
5134 include_once(
"./Services/COPage/classes/class.ilPCResources.php");
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, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
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 _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 _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 _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, $unmask=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.
getRepoObjId()
Get object id of repository object that contains this page, return 0 if page does not belong to a rep...
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.
getFO()
get fo page content
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)
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)
getEffectiveEditLockTime()
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, $a_ctrl_path="ilpublicuserprofilegui")
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)
const DOMXML_LOAD_PARSING
foreach($_POST as $key=> $value) $res