4 define(
"IL_INSERT_BEFORE", 0);
5 define(
"IL_INSERT_AFTER", 1);
6 define(
"IL_INSERT_CHILD", 2);
8 define(
"IL_CHAPTER_TITLE",
"st_title");
9 define(
"IL_PAGE_TITLE",
"pg_title");
10 define(
"IL_NO_HEADER",
"none");
135 final public function __construct($a_id = 0, $a_old_nr = 0, $a_lang =
"-")
138 $this->obj_definition = $DIC[
"objDefinition"];
139 $this->db = $DIC->database();
140 $this->
user = $DIC->user();
141 $this->lng = $DIC->language();
142 $this->tree = $DIC->repositoryTree();
149 $this->contains_int_link =
false;
150 $this->needs_parsing =
false;
151 $this->update_listeners = array();
152 $this->update_listener_cnt = 0;
153 $this->dom_builded =
false;
154 $this->page_not_found =
false;
155 $this->old_nr = $a_old_nr;
156 $this->encoding =
"UTF-8";
158 array(
"PageContent",
"TableRow",
"TableData",
"ListItem",
"FileItem",
159 "Section",
"Tab",
"ContentPopup",
"GridCell");
161 $this->show_page_act_info =
false;
193 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
225 $this->page_config = $a_val;
245 $this->rendermd5 = $a_rendermd5;
255 return $this->rendermd5;
265 $this->renderedcontent = $a_renderedcontent;
275 return $this->renderedcontent;
285 $this->renderedtime = $a_renderedtime;
295 return $this->renderedtime;
305 $this->lastchange = $a_lastchange;
315 return $this->lastchange;
325 $this->last_change_user = $a_val;
335 return $this->last_change_user;
345 $this->show_page_act_info = $a_val;
355 return $this->show_page_act_info;
364 if ($this->old_nr == 0) {
365 $query =
"SELECT * FROM page_object" .
366 " WHERE page_id = " . $this->db->quote($this->
id,
"integer") .
367 " AND parent_type=" . $this->db->quote($this->
getParentType(),
"text") .
368 " AND lang = " . $this->db->quote($this->
getLanguage(),
"text");
369 $pg_set = $this->db->query(
$query);
370 $this->page_record = $this->db->fetchAssoc($pg_set);
371 $this->
setActive($this->page_record[
"active"]);
376 $query =
"SELECT * FROM page_history" .
377 " WHERE page_id = " . $this->db->quote($this->
id,
"integer") .
378 " AND parent_type=" . $this->db->quote($this->
getParentType(),
"text") .
379 " AND nr = " . $this->db->quote((
int) $this->old_nr,
"integer") .
380 " AND lang = " . $this->db->quote($this->
getLanguage(),
"text");
381 $pg_set = $this->db->query(
$query);
382 $this->page_record = $this->db->fetchAssoc($pg_set);
384 if (!$this->page_record) {
385 include_once(
"./Services/COPage/exceptions/class.ilCOPageNotFoundException.php");
390 $this->xml = $this->page_record[
"content"];
391 $this->
setParentId($this->page_record[
"parent_id"]);
392 $this->last_change_user = $this->page_record[
"last_change_user"];
393 $this->create_user = $this->page_record[
"create_user"];
407 public static function _exists($a_parent_type, $a_id, $a_lang =
"", $a_no_cache =
false)
411 $db = $DIC->database();
413 if (!$a_no_cache && isset(self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang])) {
414 return self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang];
419 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
422 $query =
"SELECT page_id FROM page_object WHERE page_id = " .
$db->quote($a_id,
"integer") .
" " .
423 "AND parent_type = " .
$db->quote($a_parent_type,
"text") . $and_lang;
425 if (
$row =
$db->fetchAssoc($set)) {
426 self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang] =
true;
429 self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang] =
false;
443 include_once(
"./Services/COPage/classes/class.ilPageUtil.php");
449 if ($this->dom_builded && !$a_force) {
463 $path =
"//PageObject";
465 if (count(
$res->nodeset) == 1) {
467 $this->node =
$res->nodeset[0];
472 $this->dom_builded =
true;
502 return $this->dom->myDOMDocument;
524 $this->parent_id = $a_id;
535 $this->update_listeners[$cnt][
"object"] = $a_object;
536 $this->update_listeners[$cnt][
"method"] = $a_method;
537 $this->update_listeners[$cnt][
"parameters"] = $a_parameters;
538 $this->update_listener_cnt++;
544 $object = $this->update_listeners[
$i][
"object"];
545 $method = $this->update_listeners[
$i][
"method"];
546 $parameters = $this->update_listeners[
$i][
"parameters"];
547 $object->$method($parameters);
558 $this->active = $a_active;
566 public function getActive($a_check_scheduled_activation =
false)
568 if ($a_check_scheduled_activation && !$this->active) {
569 include_once(
"./Services/Calendar/classes/class.ilDateTime.php");
589 $db = $DIC->database();
591 "SELECT page_id, parent_type, lang, active, activation_start, activation_end, show_activation_info FROM page_object " .
592 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer")
594 while ($rec =
$db->fetchAssoc($set)) {
595 self::$activation_data[$rec[
"page_id"] .
":" . $rec[
"parent_type"] .
":" . $rec[
"lang"]] = $rec;
603 public static function _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation =
false, $a_lang =
"-")
607 $db = $DIC->database();
614 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
615 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
618 "SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s" .
619 " AND parent_type = %s AND lang = %s",
620 array(
"integer",
"text",
"text"),
621 array($a_id, $a_parent_type, $a_lang)
623 $rec =
$db->fetchAssoc($set);
629 if (!$rec[
"active"] && $a_check_scheduled_activation) {
630 if ($rec[
"n"] >= $rec[
"activation_start"] &&
631 $rec[
"n"] <= $rec[
"activation_end"]) {
636 return $rec[
"active"];
646 $db = $DIC->database();
655 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
656 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
659 "SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s" .
660 " AND parent_type = %s AND lang = %s",
661 array(
"integer",
"text",
"text"),
662 array($a_id, $a_parent_type, $a_lang)
664 $rec =
$db->fetchAssoc($set);
667 if (!$rec[
"active"] && $rec[
"activation_start"] !=
"") {
677 public static function _writeActive($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation =
true, $a_lang =
"-")
681 $db = $DIC->database();
688 if ($a_reset_scheduled_activation) {
689 $st =
$db->manipulateF(
690 "UPDATE page_object SET active = %s, activation_start = %s, " .
691 " activation_end = %s WHERE page_id = %s" .
692 " AND parent_type = %s AND lang = %s",
693 array(
"boolean",
"timestamp",
"timestamp",
"integer",
"text",
"text"),
694 array($a_active, null, null, $a_id, $a_parent_type, $a_lang)
697 $st =
$db->prepareManip(
698 "UPDATE page_object SET active = %s WHERE page_id = %s" .
699 " AND parent_type = %s AND lang = %s",
700 array(
"boolean",
"integer",
"text",
"text"),
701 array($a_active, $a_id, $a_parent_type, $a_lang)
713 $db = $DIC->database();
720 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
721 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
724 "SELECT active, activation_start, activation_end, show_activation_info FROM page_object WHERE page_id = %s" .
725 " AND parent_type = %s AND lang = %s",
726 array(
"integer",
"text",
"text"),
727 array($a_id, $a_parent_type, $a_lang)
729 $rec =
$db->fetchAssoc($set);
743 $db = $DIC->database();
745 $res =
$db->query(
"SELECT parent_id FROM page_object WHERE page_id = " .
$db->quote($a_id,
"integer") .
" " .
746 "AND parent_type=" .
$db->quote(
$a_type,
"text"));
748 return $rec[
"parent_id"];
758 $db = $DIC->database();
760 "UPDATE page_object SET parent_id = %s WHERE page_id = %s" .
761 " AND parent_type = %s",
762 array(
"integer",
"integer",
"text"),
763 array($a_par_id, $a_pg_id, $a_parent_type)
774 if ($a_activationstart ==
"") {
775 $a_activationstart = null;
777 $this->activationstart = $a_activationstart;
787 return $this->activationstart;
797 if ($a_activationend ==
"") {
798 $a_activationend = null;
800 $this->activationend = $a_activationend;
810 return $this->activationend;
824 if (!is_object($cont_node)) {
827 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
828 $node_name = $cont_node->node_name();
829 if ($node_name ==
"PageObject") {
832 if ($node_name ==
"PageContent") {
833 $child_node = $cont_node->first_child();
834 $node_name = $child_node->node_name();
838 if ($node_name ==
"Table") {
839 if ($child_node->get_attribute(
"DataTable") ==
"y") {
840 require_once(
"./Services/COPage/classes/class.ilPCDataTable.php");
842 $tab->setNode($cont_node);
843 $tab->setHierId($a_hier_id);
845 require_once(
"./Services/COPage/classes/class.ilPCTable.php");
847 $tab->setNode($cont_node);
848 $tab->setHierId($a_hier_id);
850 $tab->setPcId($a_pc_id);
855 if ($node_name ==
"MediaObject") {
856 if (
$_GET[
"pgEdMediaMode"] !=
"") {
857 echo "ilPageObject::error media";
862 require_once(
"./Services/COPage/classes/class.ilPCMediaObject.php");
864 $mal_node = $child_node->first_child();
866 $id_arr = explode(
"_", $mal_node->get_attribute(
"OriginId"));
867 $mob_id = $id_arr[count($id_arr) - 1];
876 $mob->readMediaObject($mob_id);
879 $mob->setNode($cont_node);
880 $mob->setHierId($a_hier_id);
881 $mob->setPcId($a_pc_id);
892 if (!is_array($pc_def)) {
893 include_once(
"./Services/COPage/exceptions/class.ilCOPageUnknownPCTypeException.php");
896 $pc_class =
"ilPC" . $pc_def[
"name"];
897 $pc_path =
"./" . $pc_def[
"component"] .
"/" . $pc_def[
"directory"] .
"/class." . $pc_class .
".php";
898 require_once($pc_path);
899 $pc =
new $pc_class($this);
900 $pc->setNode($cont_node);
901 $pc->setHierId($a_hier_id);
902 $pc->setPcId($a_pc_id);
915 if ($a_hier_id ==
"pg") {
919 if ($a_pc_id !=
"") {
920 $path =
"//*[@PCID = '$a_pc_id']";
922 if (count(
$res->nodeset) == 1) {
923 $cont_node =
$res->nodeset[0];
929 $path =
"//*[@HierId = '$a_hier_id']";
931 if (count(
$res->nodeset) == 1) {
932 $cont_node =
$res->nodeset[0];
944 public function checkForTag($a_content_tag, $a_hier_id, $a_pc_id =
"")
948 if ($a_pc_id !=
"") {
949 $path =
"//*[@PCID = '$a_pc_id']//" . $a_content_tag;
951 if (count(
$res->nodeset) > 0) {
957 $path =
"//*[@HierId = '$a_hier_id']//" . $a_content_tag;
959 if (count(
$res->nodeset) > 0) {
969 $path =
"//*[@HierId = '$a_hier_id']";
971 if (count(
$res->nodeset) == 1) {
995 $this->encoding = $a_encoding;
1007 $this->xml .= $a_xml;
1020 $enc_str = (!empty($this->encoding))
1021 ?
"encoding=\"" . $this->encoding .
"\"" 1023 return "<?xml version=\"1.0\" $enc_str ?>" .
1024 "<!DOCTYPE PageObject SYSTEM \"" . ILIAS_ABSOLUTE_PATH .
"/xml/" . $this->cur_dtd .
"\">" .
1037 $xml = $this->getXmlContent();
1039 '<?xml version="1.0" encoding="UTF-8"?>' .
$xml,
1043 if (empty($error)) {
1046 $xml = $temp_dom->dump_mem(0, $this->encoding);
1047 $xml = preg_replace(
'/<\?xml[^>]*>/i',
"",
$xml);
1048 $xml = preg_replace(
'/<!DOCTYPE[^>]*>/i',
"",
$xml);
1066 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
1080 if ($a_clone_mobs) {
1086 $a_dom = $a_dom->myDOMDocument;
1088 foreach ($defs as
$def) {
1090 $cl = $def[
"pc_class"];
1091 if ($cl ==
'ilPCPlugged') {
1093 ilPCPlugged::handleCopiedPluggedContent($this, $a_dom);
1095 $cl::handleCopiedContent($a_dom, $a_self_ass, $a_clone_mobs);
1107 public function handleDeleteContent($a_node = null)
1109 if (!isset($a_node)) {
1111 $path =
"//PageContent";
1118 require_once(
'Services/COPage/classes/class.ilPCPlugged.php');
1121 $node = $node->myDOMNode;
1125 if ($node->firstChild->nodeName ==
'Plugged') {
1126 ilPCPlugged::handleDeletedPluggedNode($this, $node->firstChild);
1138 $path =
"//InteractiveImage/MediaAlias";
1143 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
1144 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1145 $or_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1150 if (!($inst_id > 0)) {
1152 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1157 $new_mob = $media_object->duplicate();
1159 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $new_mob->getId());
1171 $path =
"//MediaObject/MediaAlias";
1176 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
1177 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1178 $or_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1183 if (!($inst_id > 0)) {
1185 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1190 $new_mob = $media_object->duplicate();
1192 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $new_mob->getId());
1205 $path =
"//Question";
1210 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
1211 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1212 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
1217 if (!($inst_id > 0)) {
1219 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
1222 if (is_object($question) && $question->isComplete()) {
1226 $question->createPageObject();
1231 $duplicate_id = $question->duplicate(
false);
1232 $res->nodeset[
$i]->set_attribute(
"QRef",
"il__qst_" . $duplicate_id);
1248 $path =
"//Question";
1251 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1252 $parent_node =
$res->nodeset[
$i]->parent_node();
1253 $parent_node->unlink_node($parent_node);
1269 $path =
"//PageContent";
1272 return count(
$res->nodeset);
1280 $a_incl_head =
false,
1281 $a_append_mobs =
false,
1282 $a_append_bib =
false,
1284 $a_omit_pageobject_tag =
false 1288 return $this->dom->dump_mem(0, $this->encoding);
1291 if ($a_append_mobs || $a_append_bib || $a_append_link_info) {
1294 if ($a_append_mobs) {
1297 if ($a_append_bib) {
1303 return "<dummy>" . $this->dom->dump_node($this->node) .
$mobs . $bibs . $trans . $a_append_str .
"</dummy>";
1305 if (is_object($this->dom)) {
1306 if ($a_omit_pageobject_tag) {
1308 $childs = $this->node->child_nodes();
1309 for (
$i = 0;
$i < count($childs);
$i++) {
1310 $xml .= $this->dom->dump_node($childs[
$i]);
1314 $xml = $this->dom->dump_mem(0, $this->encoding);
1315 $xml = preg_replace(
'/<\?xml[^>]*>/i',
"",
$xml);
1316 $xml = preg_replace(
'/<!DOCTYPE[^>]*>/i',
"",
$xml);
1336 "ed_paste_clip",
"ed_edit",
"ed_edit_prop",
"ed_delete",
"ed_moveafter",
1337 "ed_movebefore",
"ed_go",
"ed_class",
"ed_width",
"ed_align_left",
1338 "ed_align_right",
"ed_align_center",
"ed_align_left_float",
1339 "ed_align_right_float",
"ed_delete_item",
"ed_new_item_before",
1340 "ed_new_item_after",
"ed_copy_clip",
"please_select",
"ed_split_page",
1341 "ed_item_up",
"ed_item_down",
"ed_split_page_next",
"ed_enable",
1342 "de_activate",
"ed_paste",
"ed_edit_multiple",
"ed_cut",
"ed_copy",
"ed_insert_templ",
1343 "ed_click_to_add_pg",
"download");
1346 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
1348 foreach ($defs as
$def) {
1349 $lang_vars[] =
"pc_" . $def[
"pc_type"];
1350 $lang_vars[] =
"ed_insert_" . $def[
"pc_type"];
1353 $cl = $def[
"pc_class"];
1354 $lvs = call_user_func($def[
"pc_class"] .
'::getLangVars');
1355 foreach ($lvs as $lv) {
1360 foreach ($lang_vars as $lang_var) {
1370 $val = $this->lng->txt(
"cont_" . $var);
1371 $val = str_replace(
'"',
""", $val);
1372 $xml .=
"<LV name=\"$var\" value=\"" . $val .
"\"/>";
1380 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
1382 $path =
"//Paragraph[1]";
1384 if (count(
$res->nodeset) > 0) {
1385 $cont_node =
$res->nodeset[0]->parent_node();
1387 $par->setNode($cont_node);
1388 $text = $par->getText();
1405 if (is_object(
$node)) {
1424 $this->contains_int_link = $a_contains_link;
1444 $this->import_mode = $a_val;
1459 if ($a_parse ===
true) {
1460 $this->needs_parsing =
true;
1462 if ($a_parse ===
false) {
1463 $this->needs_parsing =
false;
1476 $this->contains_question = $a_val;
1486 return $this->contains_question;
1500 $path =
"//MediaObject/MediaAlias";
1503 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1504 $id_arr = explode(
"_",
$res->nodeset[
$i]->get_attribute(
"OriginId"));
1505 $mob_id = $id_arr[count($id_arr) - 1];
1506 $mob_ids[$mob_id] = $mob_id;
1511 $path =
"//InteractiveImage/MediaAlias";
1513 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1514 $id_arr = explode(
"_",
$res->nodeset[
$i]->get_attribute(
"OriginId"));
1515 $mob_id = $id_arr[count($id_arr) - 1];
1516 $mob_ids[$mob_id] = $mob_id;
1521 $path =
"//IntLink[@Type = 'MediaObject']";
1524 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1525 if ((
$res->nodeset[
$i]->get_attribute(
"TargetFrame") ==
"") ||
1526 (!$a_inline_only)) {
1528 $id_arr = explode(
"_",
$target);
1529 if (($id_arr[1] == IL_INST_ID) ||
1530 (substr(
$target, 0, 4) ==
"il__")) {
1531 $mob_id = $id_arr[count($id_arr) - 1];
1533 $mob_ids[$mob_id] = $mob_id;
1551 $path =
"//IntLink";
1556 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1558 if ($a_cnt_multiple) {
1559 $add =
":" . $cnt_multiple;
1563 $targetframe =
$res->nodeset[
$i]->get_attribute(
"TargetFrame");
1564 $anchor =
$res->nodeset[
$i]->get_attribute(
"Anchor");
1567 "TargetFrame" => $targetframe,
"Anchor" => $anchor);
1570 if (
$type ==
"MediaObject" && $targetframe ==
"") {
1571 if (substr(
$target, 0, 4) ==
"il__") {
1572 $id_arr = explode(
"_",
$target);
1573 $id = $id_arr[count($id_arr) - 1];
1576 foreach ($med_links as
$key => $med_link) {
1588 $path =
"//MediaAlias";
1591 require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
1592 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1593 $oid =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1594 if (substr($oid, 0, 4) ==
"il__") {
1595 $id_arr = explode(
"_", $oid);
1596 $id = $id_arr[count($id_arr) - 1];
1599 foreach ($med_links as
$key => $med_link) {
1620 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1621 foreach ($mob_ids as $mob_id => $dummy) {
1624 $mobs_xml .= $mob_obj->getXML(
IL_MODE_OUTPUT, $a_inst = 0,
true);
1638 $path =
"//MediaObject/MediaAlias[@OriginId='il__mob_$a_mob_id']";
1640 $mal_node =
$res->nodeset[$a_nr - 1];
1641 $mob_node = $mal_node->parent_node();
1643 return $this->dom->dump_node($mob_node);
1656 libxml_disable_entity_loader(
false);
1658 @$this->dom->validate($error);
1681 $this->hier_ids = array();
1682 $this->first_row_ids = array();
1683 $this->first_col_ids = array();
1684 $this->list_item_ids = array();
1685 $this->file_item_ids = array();
1692 foreach ($this->id_elements as $el) {
1693 $path .= $sep .
"//" . $el;
1698 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1699 $cnode =
$res->nodeset[
$i];
1700 $ctag = $cnode->node_name();
1704 while ($cnode = $cnode->previous_sibling()) {
1705 if (($cnode->node_type() == XML_ELEMENT_NODE)
1706 && $cnode->has_attribute(
"HierId")) {
1707 $sib_hier_id = $cnode->get_attribute(
"HierId");
1713 if ($sib_hier_id !=
"") {
1714 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
1716 $res->nodeset[
$i]->set_attribute(
"HierId", $node_hier_id);
1717 $this->hier_ids[] = $node_hier_id;
1718 if ($ctag ==
"TableData") {
1719 if (substr($par_hier_id, strlen($par_hier_id) - 2) ==
"_1") {
1720 $this->first_row_ids[] = $node_hier_id;
1723 if ($ctag ==
"ListItem") {
1724 $this->list_item_ids[] = $node_hier_id;
1726 if ($ctag ==
"FileItem") {
1727 $this->file_item_ids[] = $node_hier_id;
1731 $cnode =
$res->nodeset[
$i];
1733 while ($cnode = $cnode->parent_node()) {
1734 if (($cnode->node_type() == XML_ELEMENT_NODE)
1735 && $cnode->has_attribute(
"HierId")) {
1736 $par_hier_id = $cnode->get_attribute(
"HierId");
1742 if (($par_hier_id !=
"") && ($par_hier_id !=
"pg")) {
1743 $node_hier_id = $par_hier_id .
"_1";
1744 $res->nodeset[
$i]->set_attribute(
"HierId", $node_hier_id);
1745 $this->hier_ids[] = $node_hier_id;
1746 if ($ctag ==
"TableData") {
1747 $this->first_col_ids[] = $node_hier_id;
1748 if (substr($par_hier_id, strlen($par_hier_id) - 2) ==
"_1") {
1749 $this->first_row_ids[] = $node_hier_id;
1752 if ($ctag ==
"ListItem") {
1753 $this->list_item_ids[] = $node_hier_id;
1755 if ($ctag ==
"FileItem") {
1756 $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++) {
1771 $res->nodeset[
$i]->set_attribute(
"HierId",
"pg");
1772 $this->hier_ids[] =
"pg";
1782 return $this->hier_ids;
1791 return $this->first_row_ids;
1800 return $this->first_col_ids;
1809 return $this->list_item_ids;
1818 return $this->file_item_ids;
1826 if (is_object($this->dom)) {
1828 $path =
"//*[@HierId]";
1830 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1831 if (
$res->nodeset[
$i]->has_attribute(
"HierId")) {
1832 $res->nodeset[
$i]->remove_attribute(
"HierId");
1844 if (!is_array($a_pc_ids) || count($a_pc_ids) == 0) {
1849 if (is_object($this->dom)) {
1851 $path =
"//*[@PCID]";
1853 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1854 $pc_id =
$res->nodeset[
$i]->get_attribute(
"PCID");
1855 if (in_array($pc_id, $a_pc_ids)) {
1856 $ret[$pc_id] =
$res->nodeset[
$i]->get_attribute(
"HierId");
1872 $path =
"//FileItem";
1874 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1875 $cnode =
$res->nodeset[
$i];
1876 $size_node = $this->dom->create_element(
"Size");
1877 $size_node = $cnode->append_child($size_node);
1879 $childs = $cnode->child_nodes();
1881 for ($j = 0; $j < count($childs); $j++) {
1882 if ($childs[$j]->node_name() ==
"Identifier") {
1883 if ($childs[$j]->has_attribute(
"Entry")) {
1884 $entry = $childs[$j]->get_attribute(
"Entry");
1885 $entry_arr = explode(
"_", $entry);
1886 $id = $entry_arr[count($entry_arr) - 1];
1887 require_once(
"./Modules/File/classes/class.ilObjFile.php");
1892 $size_node->set_content(
$size);
1907 $this->log->debug(
"start");
1911 $path =
"//IntLink";
1913 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1917 if ($a_link_map == null) {
1919 $this->log->debug(
"no map, type: " .
$type .
", target: " .
$target .
", new target: " . $new_target);
1922 $nt = explode(
"_", $a_link_map[
$target]);
1923 $new_target =
false;
1924 if ($nt[1] == IL_INST_ID) {
1925 $new_target =
"il__" . $nt[2] .
"_" . $nt[3];
1927 $this->log->debug(
"map, type: " .
$type .
", target: " . $target .
", new target: " . $new_target);
1929 if ($new_target !==
false) {
1930 $res->nodeset[
$i]->set_attribute(
"Target", $new_target);
1934 IL_INST_ID > 0 &&
$type !=
"RepositoryItem") {
1937 $res->nodeset[
$i]->set_attribute(
"Target", $new_target);
1947 $path =
"//MediaAlias";
1951 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1952 $orig_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1953 $id_arr = explode(
"_", $orig_id);
1954 $mob_id = $id_arr[count($id_arr) - 1];
1971 $path =
"//MediaAlias";
1974 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1976 $old_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1977 $old_id = explode(
"_", $old_id);
1978 $old_id = $old_id[count($old_id) - 1];
1982 if ($a_mapping[$old_id] > 0) {
1983 $new_id = $a_mapping[$old_id];
1984 if ($a_reuse_existing_by_import) {
1987 $imp = explode(
"_", $import_id);
1995 if ($import_id ==
"" && $a_reuse_existing_by_import) {
1998 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2000 if (in_array($old_id, $med_of_def_lang)) {
2004 if ($new_id !=
"") {
2005 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $new_id);
2024 $path =
"//InteractiveImage/MediaAlias";
2027 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2028 $old_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
2029 if ($a_mapping[$old_id] > 0) {
2030 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $a_mapping[$old_id]);
2050 $path =
"//FileItem/Identifier";
2053 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2054 $old_id =
$res->nodeset[
$i]->get_attribute(
"Entry");
2055 $old_id = explode(
"_", $old_id);
2056 $old_id = $old_id[count($old_id) - 1];
2057 if ($a_mapping[$old_id] > 0) {
2058 $res->nodeset[
$i]->set_attribute(
"Entry",
"il__file_" . $a_mapping[$old_id]);
2076 $path =
"//Question";
2079 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2080 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
2082 if (isset($a_mapping[$qref])) {
2083 $res->nodeset[
$i]->set_attribute(
"QRef",
"il__qst_" . $a_mapping[$qref][
"pool"]);
2108 $path =
"//IntLink";
2110 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2114 if ($a_from_to[$obj_id] > 0 && is_int(strpos(
$target,
"__"))) {
2116 $res->nodeset[
$i]->set_attribute(
"Target",
"il__pg_" . $a_from_to[$obj_id]);
2120 $res->nodeset[
$i]->set_attribute(
"Target",
"il__st_" . $a_from_to[$obj_id]);
2123 if (
$type ==
"PortfolioPage") {
2124 $res->nodeset[
$i]->set_attribute(
"Target",
"il__ppage_" . $a_from_to[$obj_id]);
2134 $path =
"//MediaAlias";
2137 require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
2138 require_once(
"Services/COPage/classes/class.ilMediaAliasItem.php");
2140 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2141 $media_object_node =
$res->nodeset[
$i]->parent_node();
2142 $page_content_node = $media_object_node->parent_node();
2143 $c_hier_id = $page_content_node->get_attribute(
"HierId");
2151 $areas = $std_alias_item->getMapAreas();
2152 $correction_needed =
false;
2153 if (count($areas) > 0) {
2155 foreach ($areas as $area) {
2156 if ($area[
"Type"] ==
"PageObject" ||
2157 $area[
"Type"] ==
"StructureObject") {
2158 $t = $area[
"Target"];
2159 $tid = _extractObjIdOfTarget(
$t);
2160 if ($a_from_to[$tid] > 0) {
2161 $correction_needed =
true;
2170 $oid =
$res->nodeset[
$i]->get_attribute(
"OriginId");
2171 if (substr($oid, 0, 4) ==
"il__") {
2172 $id_arr = explode(
"_", $oid);
2173 $id = $id_arr[count($id_arr) - 1];
2176 $med_item = $mob->getMediaItem(
"Standard");
2177 $med_areas = $med_item->getMapAreas();
2179 foreach ($med_areas as $area) {
2180 $link_type = ($area->getLinkType() ==
"int")
2185 "Nr" => $area->getNr(),
2186 "Shape" => $area->getShape(),
2187 "Coords" => $area->getCoords(),
2189 "LinkType" => $link_type,
2190 "Href" => $area->getHref(),
2191 "Title" => $area->getTitle(),
2192 "Target" => $area->getTarget(),
2193 "Type" => $area->getType(),
2194 "TargetFrame" => $area->getTargetFrame()
2198 if ($area->getType() ==
"PageObject" ||
2199 $area->getType() ==
"StructureObject") {
2200 $t = $area->getTarget();
2202 if ($a_from_to[$tid] > 0) {
2203 $correction_needed =
true;
2212 if ($correction_needed) {
2214 $std_alias_item->deleteAllMapAreas();
2215 foreach ($areas as $area) {
2216 if ($area[
"Link"][
"LinkType"] ==
"IntLink") {
2217 $target = $area[
"Link"][
"Target"];
2218 $type = $area[
"Link"][
"Type"];
2220 if ($a_from_to[$obj_id] > 0) {
2222 $area[
"Link"][
"Target"] =
"il__pg_" . $a_from_to[$obj_id];
2225 $area[
"Link"][
"Target"] =
"il__st_" . $a_from_to[$obj_id];
2230 $std_alias_item->addMapArea(
2233 $area[
"Link"][
"Title"],
2234 array(
"Type" => $area[
"Link"][
"Type"],
2235 "TargetFrame" => $area[
"Link"][
"TargetFrame"],
2236 "Target" => $area[
"Link"][
"Target"],
2237 "Href" => $area[
"Link"][
"Href"],
2238 "LinkType" => $area[
"Link"][
"LinkType"],
2257 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
2266 foreach ($sources as
$source) {
2268 if ($source[
"type"] ==
"lm:pg") {
2270 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
2271 if (self::_exists(
"lm", $source[
"id"], $source[
"lang"])) {
2272 $page_obj =
new ilLMPage($source[
"id"], 0, $source[
"lang"]);
2273 if (!$page_obj->page_not_found) {
2275 $page_obj->handleImportRepositoryLink(
2281 $page_obj->update();
2294 $path =
"//IntLink";
2297 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2301 if (
$target == $a_rep_import_id &&
$type ==
"RepositoryItem") {
2303 $res->nodeset[
$i]->set_attribute(
2305 "il__" . $a_rep_type .
"_" . $a_rep_ref_id
2323 $this->log->debug(
"Handle repository links...");
2327 $path =
"//IntLink";
2329 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2332 $this->log->debug(
"Target: " .
$target);
2334 if (
$type ==
"RepositoryItem" && ((
int)
$t[1] == 0 || (
int)
$t[1] == IL_INST_ID)) {
2335 if (isset($a_mapping[
$t[3]])) {
2337 $this->log->debug(
"... replace " . $t[3] .
" with " . $a_mapping[$t[3]] .
".");
2338 $res->nodeset[
$i]->set_attribute(
2340 "il__obj_" . $a_mapping[$t[3]]
2342 } elseif ($this->tree->isGrandChild($a_source_ref_id, $t[3])) {
2344 $this->log->debug(
"... remove links.");
2345 if (
$res->nodeset[
$i]->parent_node()->node_name() ==
"MapArea") {
2346 $parent =
$res->nodeset[
$i]->parent_node();
2347 $parent->unlink_node($parent);
2349 $source_node =
$res->nodeset[
$i];
2350 $new_node = $source_node->clone_node(
true);
2351 $new_node->unlink_node($new_node);
2352 $childs = $new_node->child_nodes();
2353 for ($j = 0; $j < count($childs); $j++) {
2354 $this->log->debug(
"... move node $j " . $childs[$j]->node_name() .
" before " . $source_node->node_name());
2355 $source_node->insert_before($childs[$j], $source_node);
2357 $source_node->unlink_node($source_node);
2365 $ilias_url = parse_url(ILIAS_HTTP_PATH);
2367 $path =
"//ExtLink";
2369 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2370 $href =
$res->nodeset[
$i]->get_attribute(
"Href");
2371 $this->log->debug(
"Href: " . $href);
2373 $url = parse_url($href);
2376 $this->log->debug(
"Host: " .
$url[
"host"]);
2377 if (
$url[
"host"] !=
"" &&
$url[
"host"] != $ilias_url[
"host"]) {
2383 foreach (explode(
"&",
$url[
"query"]) as $p) {
2384 $p = explode(
"=", $p);
2385 $par[$p[0]] = $p[1];
2388 $target_client_id = $par[
"client_id"];
2389 if ($target_client_id !=
"" && $target_client_id != CLIENT_ID) {
2395 if (is_int(strpos($href,
"goto.php"))) {
2396 $t = explode(
"_", $par[
"target"]);
2397 if ($objDefinition->isRBACObject(
$t[0])) {
2398 $ref_id = (int)
$t[1];
2401 } elseif (is_int(strpos($href,
"ilias.php"))) {
2402 $ref_id = (int) $par[
"ref_id"];
2407 if (isset($a_mapping[$ref_id])) {
2408 $new_ref_id = $a_mapping[$ref_id];
2411 if (is_int(strpos($href,
"goto.php"))) {
2412 $nt = str_replace(
$type .
"_" . $ref_id,
$type .
"_" . $new_ref_id, $par[
"target"]);
2413 $new_href = str_replace(
"target=" . $par[
"target"],
"target=" . $nt, $href);
2414 } elseif (is_int(strpos($href,
"ilias.php"))) {
2415 $new_href = str_replace(
"ref_id=" . $par[
"ref_id"],
"ref_id=" . $new_ref_id, $href);
2417 if ($new_href !=
"") {
2418 $this->log->debug(
"... ext link replace " . $href .
" with " . $new_href .
".");
2419 $res->nodeset[
$i]->set_attribute(
"Href", $new_href);
2421 } elseif (
$tree->isGrandChild($a_source_ref_id, $ref_id)) {
2423 $this->log->debug(
"... remove ext links.");
2424 if (
$res->nodeset[
$i]->parent_node()->node_name() ==
"MapArea") {
2425 $parent =
$res->nodeset[
$i]->parent_node();
2426 $parent->unlink_node($parent);
2428 $source_node =
$res->nodeset[
$i];
2429 $new_node = $source_node->clone_node(
true);
2430 $new_node->unlink_node($new_node);
2431 $childs = $new_node->child_nodes();
2432 for ($j = 0; $j < count($childs); $j++) {
2433 $this->log->debug(
"... move node $j " . $childs[$j]->node_name() .
" before " . $source_node->node_name());
2434 $source_node->insert_before($childs[$j], $source_node);
2436 $source_node->unlink_node($source_node);
2464 $this->db->insert(
"page_object", array(
2465 "page_id" => array(
"integer", $this->
getId()),
2466 "parent_id" => array(
"integer", $this->
getParentId()),
2468 "content" => array(
"clob", $content),
2470 "create_user" => array(
"integer", $this->
user->getId()),
2471 "last_change_user" => array(
"integer", $this->
user->getId()),
2472 "active" => array(
"integer", (
int) $this->
getActive()),
2476 "inactive_elements" => array(
"integer", $iel),
2477 "int_links" => array(
"integer", $inl),
2479 "last_change" => array(
"timestamp",
ilUtil::now())
2497 $this->log->debug(
"ilPageObject, updateFromXML(): start, id: " . $this->
getId());
2501 $this->log->debug(
"ilPageObject, updateFromXML(): content: " . substr($content, 0, 100));
2509 $this->db->update(
"page_object", array(
2510 "content" => array(
"clob", $content),
2511 "parent_id" => array(
"integer", $this->
getParentId()),
2512 "last_change_user" => array(
"integer", $this->
user->getId()),
2513 "last_change" => array(
"timestamp",
ilUtil::now()),
2514 "active" => array(
"integer", $this->
getActive()),
2517 "inactive_elements" => array(
"integer", $iel),
2518 "int_links" => array(
"integer", $inl),
2520 "page_id" => array(
"integer", $this->
getId()),
2528 $this->log->debug(
"ilPageObject, updateFromXML(): end");
2539 final protected function __afterUpdate($a_domdoc, $a_xml, $a_creation =
false, $a_empty =
false)
2542 if (!$a_creation || !$a_empty) {
2552 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
2554 foreach ($defs as
$def) {
2556 $cl = $def[
"pc_class"];
2557 call_user_func($def[
"pc_class"] .
'::afterPageUpdate', $this, $a_domdoc, $a_xml, $a_creation);
2583 public function update($a_validate =
true, $a_no_history =
false)
2585 $this->log->debug(
"ilPageObject, update(): start, id: " . $this->
getId());
2600 include_once(
"./Services/User/classes/class.ilUserUtil.php");
2603 1 =>
"nocontent#" . $this->lng->txt(
"cont_not_saved_edit_lock_expired") .
"<br />" .
2604 $this->lng->txt(
"obj_usr") .
": " .
2606 $this->lng->txt(
"content_until") .
": " .
2612 $this->log->debug(
"ilPageObject, update(): errors: " . print_r(
$errors,
true));
2628 $old_set = $this->db->query(
"SELECT * FROM page_object WHERE " .
2629 "page_id = " . $this->db->quote($this->getId(),
"integer") .
" AND " .
2630 "parent_type = " . $this->db->quote($this->getParentType(),
"text") .
" AND " .
2631 "lang = " . $this->db->quote($this->getLanguage(),
"text"));
2632 $last_nr_set = $this->db->query(
"SELECT max(nr) as mnr FROM page_history 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 = $this->db->fetchAssoc($last_nr_set);
2637 if ($old_rec = $this->db->fetchAssoc($old_set)) {
2640 if (($content != $old_rec[
"content"] || $this->
user->getId() != $old_rec[
"last_change_user"]) &&
2641 !$a_no_history && !$this->history_saved &&
$lm_set->get(
"page_history", 1)) {
2642 if ($old_rec[
"content"] !=
"<PageObject></PageObject>") {
2643 $this->db->manipulateF(
2644 "DELETE FROM page_history WHERE " .
2645 "page_id = %s AND parent_type = %s AND hdate = %s AND lang = %s",
2646 array(
"integer",
"text",
"timestamp",
"text"),
2647 array($old_rec[
"page_id"], $old_rec[
"parent_type"], $old_rec[
"last_change"], $old_rec[
"lang"])
2652 $last_c = $old_rec[
"last_change"];
2653 if ($last_c ==
"") {
2657 $this->db->insert(
"page_history", array(
2658 "page_id" => array(
"integer", $old_rec[
"page_id"]),
2659 "parent_type" => array(
"text", $old_rec[
"parent_type"]),
2660 "lang" => array(
"text", $old_rec[
"lang"]),
2661 "hdate" => array(
"timestamp", $last_c),
2662 "parent_id" => array(
"integer", $old_rec[
"parent_id"]),
2663 "content" => array(
"clob", $old_rec[
"content"]),
2664 "user_id" => array(
"integer", $old_rec[
"last_change_user"]),
2666 "nr" => array(
"integer", (
int) $last_nr[
"mnr"] + 1)
2669 $old_content = $old_rec[
"content"];
2671 $old_nr = $last_nr[
"mnr"] + 1;
2672 $old_domdoc->loadXML(
'<?xml version="1.0" encoding="UTF-8"?>' . $old_content);
2677 $this->history_saved =
true;
2679 $this->history_saved =
true;
2684 $em = (trim($content) ==
"<PageObject/>")
2692 $this->db->update(
"page_object", array(
2693 "content" => array(
"clob", $content),
2694 "parent_id" => array(
"integer", $this->
getParentId()),
2695 "last_change_user" => array(
"integer", $this->
user->getId()),
2696 "last_change" => array(
"timestamp",
ilUtil::now()),
2697 "is_empty" => array(
"integer", $em),
2698 "active" => array(
"integer", $this->
getActive()),
2702 "inactive_elements" => array(
"integer", $iel),
2703 "int_links" => array(
"integer", $inl),
2705 "page_id" => array(
"integer", $this->
getId()),
2713 $this->log->debug(
"ilPageObject, update(): updated and returning true, content: " . substr($this->
getXMLContent(), 0, 100));
2727 public function delete()
2730 $copg_logger->debug(
2731 "ilPageObject: Delete called for ID '" . $this->
getId() .
"'," .
2733 " hist nr: '" . $this->old_nr .
"', " .
2740 if (!$this->page_not_found) {
2744 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2746 foreach ($mobs2 as
$m) {
2747 if (!in_array($m,
$mobs)) {
2752 $copg_logger->debug(
"ilPageObject: ... found " . count(
$mobs) .
" media objects.");
2757 $this->handleDeleteContent();
2769 include_once(
"./Services/News/classes/class.ilNewsItem.php");
2778 $this->db->manipulate(
"DELETE FROM page_object " .
2779 "WHERE page_id = " . $this->db->quote($this->getId(),
"integer") .
2780 " AND parent_type= " . $this->db->quote($this->getParentType(),
"text"));
2783 foreach (
$mobs as $mob_id) {
2784 $copg_logger->debug(
"ilPageObject: ... processing mob " . $mob_id .
".");
2787 $copg_logger->debug(
"ilPageObject: ... type mismatch. Ignoring mob " . $mob_id .
".");
2792 $copg_logger->debug(
"ilPageObject: ... delete mob " . $mob_id .
".");
2797 $copg_logger->debug(
"ilPageObject: ... missing mob " . $mob_id .
".");
2810 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
2812 foreach ($defs as
$def) {
2814 $cl = $def[
"pc_class"];
2815 call_user_func($def[
"pc_class"] .
'::beforePageDelete', $this);
2830 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
2832 foreach ($defs as
$def) {
2834 $cl = $def[
"pc_class"];
2835 call_user_func($def[
"pc_class"] .
'::afterPageHistoryEntry', $this, $a_old_domdoc, $a_old_content, $a_old_nr);
2848 $path =
"//Paragraph | //Section | //MediaAlias | //FileItem" .
2849 " | //Table | //TableData | //Tabs | //List";
2853 switch ($node->localName) {
2855 $sname = $node->getAttribute(
"Characteristic");
2856 $stype =
"text_block";
2861 $sname = $node->getAttribute(
"Characteristic");
2867 $sname = $node->getAttribute(
"Class");
2868 $stype =
"media_cont";
2873 $sname = $node->getAttribute(
"Class");
2874 $stype =
"flist_li";
2879 $sname = $node->getAttribute(
"Template");
2881 $sname = $node->getAttribute(
"Class");
2891 $sname = $node->getAttribute(
"Class");
2892 $stype =
"table_cell";
2897 $sname = $node->getAttribute(
"Template");
2899 if ($node->getAttribute(
"Type") ==
"HorizontalAccordion") {
2900 $stype =
"haccordion";
2902 if ($node->getAttribute(
"Type") ==
"VerticalAccordion") {
2903 $stype =
"vaccordion";
2910 $sname = $node->getAttribute(
"Class");
2911 if ($node->getAttribute(
"Type") ==
"Ordered") {
2919 if ($sname !=
"" && $stype !=
"") {
2920 $usages[$sname .
":" . $stype .
":" .
$template] = array(
"sname" => $sname,
2921 "stype" => $stype,
"template" =>
$template);
2928 foreach ($usages as $u) {
2929 $id = $this->db->nextId(
'page_style_usage');
2931 $this->db->manipulate(
"INSERT INTO page_style_usage " .
2932 "(id, page_id, page_type, page_lang, page_nr, template, stype, sname) VALUES (" .
2933 $this->db->quote(
$id,
"integer") .
"," .
2934 $this->db->quote($this->
getId(),
"integer") .
"," .
2936 $this->db->quote($this->
getLanguage(),
"text") .
"," .
2937 $this->db->quote($a_old_nr,
"integer") .
"," .
2938 $this->db->quote($u[
"template"],
"integer") .
"," .
2939 $this->db->quote($u[
"stype"],
"text") .
"," .
2940 $this->db->quote($u[
"sname"],
"text") .
2953 if ($a_old_nr !==
false) {
2954 $and_old_nr =
" AND page_nr = " . $this->db->quote($a_old_nr,
"integer");
2957 $this->db->manipulate(
2958 "DELETE FROM page_style_usage WHERE " .
2959 " page_id = " . $this->db->quote($this->getId(),
"integer") .
2960 " AND page_type = " . $this->db->quote($this->getParentType(),
"text") .
2961 " AND page_lang = " . $this->db->quote($this->getLanguage(),
"text") .
2974 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2975 include_once(
"./Modules/File/classes/class.ilObjFile.php");
2996 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
3017 $nodes = $xpath->query(
'//IntLink');
3019 $link_type = $node->getAttribute(
"Type");
3021 switch ($link_type) {
3022 case "StructureObject":
3030 case "GlossaryItem":
3038 case "RepositoryItem":
3050 case "PortfolioPage":
3059 $target = $node->getAttribute(
"Target");
3064 if (is_int(strpos(
$target,
"__"))) {
3101 $this->handleDeleteContent($curr_node);
3102 $curr_node->unlink_node($curr_node);
3118 if (!is_array($a_hids)) {
3121 foreach ($a_hids as $a_hid) {
3122 $a_hid = explode(
":", $a_hid);
3127 if (!$this->
checkForTag(
"Question", $a_hid[0], $a_hid[1]) || $a_self_ass) {
3129 if (is_object($curr_node)) {
3130 $parent_node = $curr_node->parent_node();
3131 if ($parent_node->node_name() !=
"TableRow") {
3132 $this->handleDeleteContent($curr_node);
3133 $curr_node->unlink_node($curr_node);
3163 if (!is_array($a_hids)) {
3167 $time = date(
"Y-m-d H:i:s", time());
3169 $hier_ids = array();
3171 foreach ($a_hids as $a_hid) {
3175 $a_hid = explode(
":", $a_hid);
3179 foreach ($hier_ids as
$h) {
3180 if ($h .
"_" == substr($a_hid[0], 0, strlen($h) + 1)) {
3181 $skip[] = $a_hid[0];
3183 if ($a_hid[0] .
"_" == substr($h, 0, strlen($a_hid[0]) + 1)) {
3187 $pc_id[$a_hid[0]] = $a_hid[1];
3188 if ($a_hid[0] !=
"") {
3189 $hier_ids[$a_hid[0]] = $a_hid[0];
3192 foreach ($skip as
$s) {
3193 unset($hier_ids[$s]);
3195 include_once(
"./Services/COPage/classes/class.ilPageContent.php");
3198 foreach ($hier_ids as $hid) {
3200 if (is_object($curr_node)) {
3201 if ($curr_node->node_name() ==
"PageContent") {
3202 $content = $this->dom->dump_node($curr_node);
3204 $content = preg_replace(
'/PCID=\"[a-z0-9]*\"/i',
"", $content);
3205 $content = preg_replace(
'/HierId=\"[a-z0-9_]*\"/i',
"", $content);
3207 $user->addToPCClipboard($content,
$time, $nr);
3212 include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
3223 $a_hid = explode(
":", $a_hier_id);
3224 $content =
$user->getPCClipboardContent();
3228 for (
$i = count($content) - 1;
$i >= 0;
$i--) {
3231 '<?xml version="1.0" encoding="UTF-8"?>' .
$c,
3235 if (empty($error)) {
3238 $path =
"//PageContent";
3240 if (count(
$res->nodeset) > 0) {
3241 $new_pc_node =
$res->nodeset[0];
3242 $cloned_pc_node = $new_pc_node->clone_node(
true);
3243 $cloned_pc_node->unlink_node($cloned_pc_node);
3264 if (!is_array($a_hids)) {
3267 $obj = &$this->content_obj;
3269 foreach ($a_hids as $a_hid) {
3270 $a_hid = explode(
":", $a_hid);
3272 if (is_object($curr_node)) {
3273 if ($curr_node->node_name() ==
"PageContent") {
3275 if ($cont_obj->isEnabled()) {
3277 if (!$this->
checkForTag(
"Question", $a_hid[0], $a_hid[1]) || $a_self_ass) {
3278 $cont_obj->disable();
3281 $cont_obj->enable();
3305 foreach ($hier_ids as $hier_id) {
3307 if (!is_int(strpos($hier_id,
"_"))) {
3308 if ($hier_id !=
"pg" && $hier_id >= $a_hid) {
3310 $this->handleDeleteContent($curr_node);
3311 $curr_node->unlink_node($curr_node);
3332 foreach ($hier_ids as $hier_id) {
3334 if (!is_int(strpos($hier_id,
"_"))) {
3335 if ($hier_id !=
"pg" && $hier_id < $a_hid) {
3337 $this->handleDeleteContent($curr_node);
3338 $curr_node->unlink_node($curr_node);
3357 $hier_ids = $a_source_page->getHierIds();
3359 $copy_ids = array();
3362 foreach ($hier_ids as $hier_id) {
3364 if (!is_int(strpos($hier_id,
"_"))) {
3365 if ($hier_id !=
"pg" && $hier_id >= $a_hid) {
3366 $copy_ids[] = $hier_id;
3372 $parent_node = $a_target_page->getContentNode(
"pg");
3373 $target_dom = $a_target_page->getDom();
3374 $parent_childs = $parent_node->child_nodes();
3375 $cnt_parent_childs = count($parent_childs);
3377 $first_child = $parent_childs[0];
3378 foreach ($copy_ids as $copy_id) {
3379 $source_node = $a_source_page->getContentNode($copy_id);
3381 $new_node = $source_node->clone_node(
true);
3382 $new_node->unlink_node($new_node);
3384 $source_node->unlink_node($source_node);
3386 if ($cnt_parent_childs == 0) {
3387 $new_node = $parent_node->append_child($new_node);
3390 $new_node = $first_child->insert_before($new_node, $first_child);
3392 $parent_childs = $parent_node->child_nodes();
3397 $a_target_page->update();
3398 $a_source_page->update();
3409 $curr_name = $curr_node->node_name();
3412 if (($curr_name ==
"TableData") || ($curr_name ==
"PageObject") ||
3413 ($curr_name ==
"ListItem") || ($curr_name ==
"Section")
3414 || ($curr_name ==
"Tab") || ($curr_name ==
"ContentPopup")
3415 || ($curr_name ==
"GridCell")) {
3419 $hid = $curr_node->get_attribute(
"HierId");
3427 $pos = explode(
"_", $a_pos);
3428 $target_pos = array_pop($pos);
3429 $parent_pos = implode($pos,
"_");
3432 $parent_pos = $a_pos;
3436 if ($parent_pos !=
"") {
3439 $parent_node = $this->
getNode();
3443 $parent_childs = $parent_node->child_nodes();
3444 $cnt_parent_childs = count($parent_childs);
3449 $new_node = $a_cont_obj->getNode();
3453 if ($succ_node = $curr_node->next_sibling()) {
3454 $new_node = $succ_node->insert_before($new_node, $succ_node);
3457 $new_node = $parent_node->append_child($new_node);
3459 $a_cont_obj->setNode($new_node);
3464 $new_node = $a_cont_obj->getNode();
3466 $new_node = $succ_node->insert_before($new_node, $succ_node);
3467 $a_cont_obj->setNode($new_node);
3473 $new_node = $a_cont_obj->getNode();
3474 if ($cnt_parent_childs == 0) {
3475 $new_node = $parent_node->append_child($new_node);
3477 $new_node = $parent_childs[0]->insert_before($new_node, $parent_childs[0]);
3479 $a_cont_obj->setNode($new_node);
3485 if (!$this->
getPageConfig()->getEnablePCType(
"PlaceHolder")) {
3486 $sub_nodes = $curr_node->child_nodes() ;
3487 foreach ($sub_nodes as $sub_node) {
3488 if ($sub_node->node_name() ==
"PlaceHolder") {
3489 $curr_node->unlink_node();
3502 $curr_name = $curr_node->node_name();
3505 if (($curr_name ==
"TableData") || ($curr_name ==
"PageObject") ||
3506 ($curr_name ==
"ListItem") || ($curr_name ==
"Section")
3507 || ($curr_name ==
"Tab") || ($curr_name ==
"ContentPopup")
3508 || ($curr_name ==
"GridCell")) {
3512 $hid = $curr_node->get_attribute(
"HierId");
3519 $pos = explode(
"_", $a_pos);
3520 $target_pos = array_pop($pos);
3521 $parent_pos = implode($pos,
"_");
3524 $parent_pos = $a_pos;
3528 if ($parent_pos !=
"") {
3531 $parent_node = $this->
getNode();
3535 $parent_childs = $parent_node->child_nodes();
3536 $cnt_parent_childs = count($parent_childs);
3542 if ($succ_node = $curr_node->next_sibling()) {
3543 $a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
3545 $a_cont_node = $parent_node->append_child($a_cont_node);
3553 $a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
3560 if ($cnt_parent_childs == 0) {
3561 $a_cont_node = $parent_node->append_child($a_cont_node);
3563 $a_cont_node = $parent_childs[0]->insert_before($a_cont_node, $parent_childs[0]);
3576 if ($a_source == $a_target) {
3582 $source_node = $content->getNode();
3583 $clone_node = $source_node->clone_node(
true);
3589 $content->setNode($clone_node);
3600 if ($a_source == $a_target) {
3606 $source_node = $content->getNode();
3607 $clone_node = $source_node->clone_node(
true);
3613 $content->setNode($clone_node);
3640 $path =
"//IntLink";
3642 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3646 if (substr(
$target, 0, 4) ==
"il__") {
3651 if ($a_res_ref_to_obj_id &&
$type ==
"RepositoryItem") {
3652 $id_arr = explode(
"_",
$id);
3655 $ref_id = $id_arr[1];
3666 $id = $otype .
"_" . $obj_id .
"_" . $ref_id;
3670 $new_target =
"il_" . $a_inst .
"_" .
$id;
3671 $res->nodeset[
$i]->set_attribute(
"Target", $new_target);
3680 $path =
"//MediaAlias";
3682 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3683 $origin_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
3684 if (substr($origin_id, 0, 4) ==
"il__") {
3685 $new_id =
"il_" . $a_inst .
"_" . substr($origin_id, 4, strlen($origin_id) - 4);
3686 $res->nodeset[
$i]->set_attribute(
"OriginId", $new_id);
3693 $path =
"//FileItem/Identifier";
3695 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3696 $origin_id =
$res->nodeset[
$i]->get_attribute(
"Entry");
3697 if (substr($origin_id, 0, 4) ==
"il__") {
3698 $new_id =
"il_" . $a_inst .
"_" . substr($origin_id, 4, strlen($origin_id) - 4);
3699 $res->nodeset[
$i]->set_attribute(
"Entry", $new_id);
3706 $path =
"//Question";
3708 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3709 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
3711 if (substr($qref, 0, 4) ==
"il__") {
3712 $new_id =
"il_" . $a_inst .
"_" . substr($qref, 4, strlen($qref) - 4);
3714 $res->nodeset[
$i]->set_attribute(
"QRef", $new_id);
3721 $path =
"//ContentInclude";
3723 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3724 $ci =
$res->nodeset[
$i]->get_attribute(
"InstId");
3726 $res->nodeset[
$i]->set_attribute(
"InstId", $a_inst);
3741 foreach ($this->id_elements as $el) {
3742 $path .= $sep .
"//" . $el .
"[not(@PCID)]";
3744 $path .= $sep .
"//" . $el .
"[@PCID='']";
3750 if (count(
$res->nodeset) > 0) {
3770 foreach ($this->id_elements as $el) {
3771 $path .= $sep .
"//" . $el .
"[@PCID]";
3779 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3781 $pcids[] =
$node->get_attribute(
"PCID");
3800 foreach ($this->id_elements as $el) {
3801 $path .= $sep .
"//" . $el .
"[@PCID='" . $a_pc_id .
"']";
3808 return (count(
$res->nodeset) > 0);
3819 if ($a_pc_ids ===
false) {
3822 $id = ilUtil::randomHash(10, $a_pc_ids);
3839 foreach ($this->id_elements as $el) {
3840 $path .= $sep .
"//" . $el .
"[not(@PCID)]";
3842 $path .= $sep .
"//" . $el .
"[@PCID='']";
3848 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3850 $id = ilUtil::randomHash(10, $pcids);
3853 $res->nodeset[
$i]->set_attribute(
"PCID",
$id);
3863 $this->addHierIds();
3867 $path =
"//PageContent";
3872 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
3873 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3874 $hier_id =
$res->nodeset[
$i]->get_attribute(
"HierId");
3875 $pc_id =
$res->nodeset[
$i]->get_attribute(
"PCID");
3876 $dump = $mydom->dump_node(
$res->nodeset[
$i]);
3877 if (($hpos = strpos($dump,
' HierId="' . $hier_id .
'"')) > 0) {
3878 $dump = substr($dump, 0, $hpos) .
3879 substr($dump, $hpos + strlen(
' HierId="' . $hier_id .
'"'));
3882 $childs =
$res->nodeset[
$i]->child_nodes();
3884 if ($childs[0] && $childs[0]->node_name() ==
"Paragraph") {
3885 $content = $mydom->dump_node($childs[0]);
3888 strpos($content,
">") + 1,
3889 strrpos($content,
"<") - (strpos($content,
">") + 1)
3898 array(
"hier_id" => $hier_id,
"hash" => md5($dump),
"content" => $content);
3914 $path =
"//Question";
3919 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
3920 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3921 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
3926 if (!($inst_id > 0)) {
3946 $path =
"/descendant::Paragraph[position() = $par_id]";
3950 if (count(
$res->nodeset) != 1) {
3951 die(
"Should not happen");
3954 $context_node =
$res->nodeset[0];
3958 $childs = $context_node->child_nodes();
3960 for ($j = 0; $j < count($childs); $j++) {
3961 $content .= $mydom->dump_node($childs[$j]);
3964 $content = str_replace(
"<br />",
"\n", $content);
3965 $content = str_replace(
"<br/>",
"\n", $content);
3967 $plain_content = html_entity_decode($content);
3985 $xsl = file_get_contents(
"./Services/COPage/xsl/page_fo.xsl");
3986 $args = array(
'/_xml' =>
$xml,
'/_xsl' => $xsl );
3992 $fo = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl", null, $args,
$params);
3995 $fo = str_replace(
"\n",
"", $fo);
3996 $fo = str_replace(
"<br/>",
"<br>", $fo);
3997 $fo = str_replace(
"<br>",
"\n", $fo);
4002 $fo = substr($fo, strpos($fo,
">") + 1);
4031 $db = $DIC->database();
4033 if ($a_lang ==
"") {
4037 $query =
"SELECT * FROM page_object WHERE page_id = " .
4038 $db->quote($a_id,
"integer") .
" AND " .
4039 " parent_type = " .
$db->quote($a_parent_type,
"text") .
" AND " .
4040 " lang = " .
$db->quote($a_lang,
"text") .
" AND " .
4041 " inactive_elements = " .
$db->quote(1,
"integer");
4059 if (strpos(
$a_content,
" Enabled=\"False\"")) {
4072 $h_query =
"SELECT * FROM page_history " .
4073 " WHERE page_id = " .
$db->quote($this->
getId(),
"integer") .
4076 " ORDER BY hdate DESC";
4078 $hset =
$db->query($h_query);
4079 $hentries = array();
4081 while ($hrec =
$db->fetchAssoc($hset)) {
4082 $hrec[
"sortkey"] = (int) $hrec[
"nr"];
4083 $hrec[
"user"] = (int) $hrec[
"user_id"];
4084 $hentries[] = $hrec;
4098 "SELECT * FROM page_history " .
4099 " WHERE page_id = %s " .
4100 " AND parent_type = %s " .
4103 array(
"integer",
"text",
"integer",
"text"),
4106 if ($hrec =
$db->fetchAssoc(
$res)) {
4125 $and_nr = ($a_nr > 0)
4126 ?
" AND nr < " .
$db->quote((
int) $a_nr,
"integer")
4128 $res =
$db->query(
"SELECT MAX(nr) mnr FROM page_history " .
4129 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4130 " AND parent_type = " .
$db->quote($this->getParentType(),
"text") .
4131 " AND lang = " .
$db->quote($this->getLanguage(),
"text") .
4134 if (
$row[
"mnr"] > 0) {
4135 $res =
$db->query(
"SELECT * FROM page_history " .
4136 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4137 " AND parent_type = " .
$db->quote($this->getParentType(),
"text") .
4138 " AND lang = " .
$db->quote($this->getLanguage(),
"text") .
4139 " AND nr = " .
$db->quote((
int)
$row[
"mnr"],
"integer"));
4145 $res =
$db->query(
"SELECT MIN(nr) mnr FROM page_history " .
4146 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4147 " AND parent_type = " .
$db->quote($this->getParentType(),
"text") .
4148 " AND lang = " .
$db->quote($this->getLanguage(),
"text") .
4149 " AND nr > " .
$db->quote((
int) $a_nr,
"integer"));
4151 if (
$row[
"mnr"] > 0) {
4152 $res =
$db->query(
"SELECT * FROM page_history " .
4153 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4154 " AND parent_type = " .
$db->quote($this->getParentType(),
"text") .
4155 " AND lang = " .
$db->quote($this->getLanguage(),
"text") .
4156 " AND nr = " .
$db->quote((
int)
$row[
"mnr"],
"integer"));
4163 $res =
$db->query(
"SELECT * FROM page_history " .
4164 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4165 " AND parent_type = " .
$db->quote($this->getParentType(),
"text") .
4166 " AND lang = " .
$db->quote($this->getLanguage(),
"text") .
4167 " AND nr = " .
$db->quote((
int) $a_nr,
"integer"));
4170 $res =
$db->query(
"SELECT page_id, last_change hdate, parent_type, parent_id, last_change_user user_id, content, lang FROM page_object " .
4171 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4172 " AND parent_type = " .
$db->quote($this->getParentType(),
"text") .
4173 " AND lang = " .
$db->quote($this->getLanguage(),
"text"));
4186 $rnode =
$res->nodeset[0];
4189 foreach ($a_hashes as $pc_id =>
$h) {
4191 if (
$h[
"change"] !=
"") {
4192 $dc_node = $this->dom->create_element(
"DivClass");
4193 $dc_node->set_attribute(
"HierId",
$h[
"hier_id"]);
4194 $dc_node->set_attribute(
"Class",
"ilEdit" .
$h[
"change"]);
4195 $dc_node = $rnode->append_child($dc_node);
4210 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
4214 $l_hashes = $l_page->getPageContentsHashes();
4215 $r_hashes = $r_page->getPageContentsHashes();
4217 foreach ($l_hashes as $pc_id =>
$h) {
4218 if (!isset($r_hashes[$pc_id])) {
4219 $l_hashes[$pc_id][
"change"] =
"Deleted";
4221 if ($l_hashes[$pc_id][
"hash"] != $r_hashes[$pc_id][
"hash"]) {
4222 $l_hashes[$pc_id][
"change"] =
"Modified";
4223 $r_hashes[$pc_id][
"change"] =
"Modified";
4225 include_once(
"./Services/COPage/mediawikidiff/class.WordLevelDiff.php");
4227 if ($l_hashes[$pc_id][
"content"] !=
"" &&
4228 $r_hashes[$pc_id][
"content"] !=
"") {
4229 $new_left = str_replace(
"\n",
"<br />", $l_hashes[$pc_id][
"content"]);
4230 $new_right = str_replace(
"\n",
"<br />", $r_hashes[$pc_id][
"content"]);
4235 $new_left = $wldiff->orig();
4236 $new_right = $wldiff->closing();
4237 $l_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_left[0]);
4238 $r_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_right[0]);
4245 foreach ($r_hashes as $pc_id =>
$h) {
4246 if (!isset($l_hashes[$pc_id])) {
4247 $r_hashes[$pc_id][
"change"] =
"New";
4250 $l_page->addChangeDivClasses($l_hashes);
4251 $r_page->addChangeDivClasses($r_hashes);
4253 return array(
"l_page" => $l_page,
"r_page" => $r_page,
4254 "l_changes" => $l_hashes,
"r_changes" => $r_hashes);
4264 $db->manipulate(
"UPDATE page_object " .
4265 " SET view_cnt = view_cnt + 1 " .
4266 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4267 " AND parent_type = " .
$db->quote($this->getParentType(),
"text") .
4268 " AND lang = " .
$db->quote($this->getLanguage(),
"text"));
4278 public static function getRecentChanges($a_parent_type, $a_parent_id, $a_period = 30, $a_lang =
"")
4282 $db = $DIC->database();
4285 if ($a_lang !=
"") {
4286 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4289 $page_changes = array();
4290 $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
4291 $q =
"SELECT * FROM page_object " .
4292 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4293 " AND parent_type = " .
$db->quote($a_parent_type,
"text") .
4294 " AND last_change >= " .
$db->quote($limit_ts,
"timestamp") . $and_lang;
4296 $set =
$db->query($q);
4297 while ($page =
$db->fetchAssoc($set)) {
4298 $page_changes[] = array(
4299 "date" => $page[
"last_change"],
4300 "id" => $page[
"page_id"],
4301 "lang" => $page[
"lang"],
4303 "user" => $page[
"last_change_user"]);
4307 if ($a_period > 0) {
4308 $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
4309 $and_str =
" AND hdate >= " .
$db->quote($limit_ts,
"timestamp") .
" ";
4312 $q =
"SELECT * FROM page_history " .
4313 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4314 " AND parent_type = " .
$db->quote($a_parent_type,
"text") .
4315 $and_str . $and_lang;
4316 $set =
$db->query($q);
4317 while ($page =
$db->fetchAssoc($set)) {
4318 $page_changes[] = array(
4319 "date" => $page[
"hdate"],
4320 "id" => $page[
"page_id"],
4321 "lang" => $page[
"lang"],
4323 "nr" => $page[
"nr"],
4324 "user" => $page[
"user_id"]);
4329 return $page_changes;
4340 public static function getAllPages($a_parent_type, $a_parent_id, $a_lang =
"-")
4344 $db = $DIC->database();
4347 if ($a_lang !=
"") {
4348 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4351 $q =
"SELECT * FROM page_object " .
4352 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4353 " AND parent_type = " .
$db->quote($a_parent_type,
"text") . $and_lang;
4354 $set =
$db->query($q);
4356 while ($page =
$db->fetchAssoc($set)) {
4357 $key_add = ($a_lang ==
"")
4358 ?
":" . $page[
"lang"]
4360 $pages[$page[
"page_id"] . $key_add] = array(
4361 "date" => $page[
"last_change"],
4362 "id" => $page[
"page_id"],
4363 "lang" => $page[
"lang"],
4364 "user" => $page[
"last_change_user"]);
4376 public static function getNewPages($a_parent_type, $a_parent_id, $a_lang =
"-")
4380 $db = $DIC->database();
4383 if ($a_lang !=
"") {
4384 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4389 $q =
"SELECT * FROM page_object " .
4390 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4391 " AND parent_type = " .
$db->quote($a_parent_type,
"text") . $and_lang .
4392 " ORDER BY created DESC";
4393 $set =
$db->query($q);
4394 while ($page =
$db->fetchAssoc($set)) {
4395 if ($page[
"created"] !=
"") {
4397 "created" => $page[
"created"],
4398 "id" => $page[
"page_id"],
4399 "lang" => $page[
"lang"],
4400 "user" => $page[
"create_user"],
4418 $db = $DIC->database();
4421 if ($a_lang !=
"") {
4422 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4425 $contributors = array();
4427 "SELECT last_change_user, lang, page_id FROM page_object " .
4428 " WHERE parent_id = %s AND parent_type = %s " .
4429 " AND last_change_user != %s" . $and_lang,
4430 array(
"integer",
"text",
"integer"),
4431 array($a_parent_id, $a_parent_type, 0)
4434 while ($page =
$db->fetchAssoc($set)) {
4435 if ($a_lang ==
"") {
4436 $contributors[$page[
"last_change_user"]][$page[
"page_id"]][$page[
"lang"]] = 1;
4438 $contributors[$page[
"last_change_user"]][$page[
"page_id"]] = 1;
4443 "SELECT count(*) as cnt, lang, page_id, user_id FROM page_history " .
4444 " WHERE parent_id = %s AND parent_type = %s AND user_id != %s " . $and_lang .
4445 " GROUP BY page_id, user_id, lang ",
4446 array(
"integer",
"text",
"integer"),
4447 array($a_parent_id, $a_parent_type, 0)
4449 while ($hpage =
$db->fetchAssoc($set)) {
4450 if ($a_lang ==
"") {
4451 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]][$hpage[
"lang"]] =
4452 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]][$hpage[
"lang"]] + $hpage[
"cnt"];
4454 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] =
4455 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] + $hpage[
"cnt"];
4460 foreach ($contributors as $k => $co) {
4463 $c[] = array(
"user_id" => $k,
"pages" => $co,
4464 "lastname" =>
$name[
"lastname"],
"firstname" =>
$name[
"firstname"]);
4481 $db = $DIC->database();
4484 if ($a_lang !=
"") {
4485 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4488 $contributors = array();
4490 "SELECT last_change_user, lang FROM page_object " .
4491 " WHERE page_id = %s AND parent_type = %s " .
4492 " AND last_change_user != %s" . $and_lang,
4493 array(
"integer",
"text",
"integer"),
4494 array($a_page_id, $a_parent_type, 0)
4497 while ($page =
$db->fetchAssoc($set)) {
4498 if ($a_lang ==
"") {
4499 $contributors[$page[
"last_change_user"]][$page[
"lang"]] = 1;
4501 $contributors[$page[
"last_change_user"]] = 1;
4506 "SELECT count(*) as cnt, lang, page_id, user_id FROM page_history " .
4507 " WHERE page_id = %s AND parent_type = %s AND user_id != %s " . $and_lang .
4508 " GROUP BY user_id, page_id, lang ",
4509 array(
"integer",
"text",
"integer"),
4510 array($a_page_id, $a_parent_type, 0)
4512 while ($hpage =
$db->fetchAssoc($set)) {
4513 if ($a_lang ==
"") {
4514 $contributors[$hpage[
"user_id"]][$page[
"lang"]] =
4515 $contributors[$hpage[
"user_id"]][$page[
"lang"]] + $hpage[
"cnt"];
4517 $contributors[$hpage[
"user_id"]] =
4518 $contributors[$hpage[
"user_id"]] + $hpage[
"cnt"];
4523 foreach ($contributors as $k => $co) {
4524 include_once
"Services/User/classes/class.ilObjUser.php";
4526 $c[] = array(
"user_id" => $k,
"pages" => $co,
4527 "lastname" =>
$name[
"lastname"],
"firstname" =>
$name[
"firstname"]);
4540 $db = $DIC->database();
4542 $db->update(
"page_object", array(
4543 "rendered_content" => array(
"clob",
$a_content),
4544 "render_md5" => array(
"text", $a_md5),
4545 "rendered_time" => array(
"timestamp",
ilUtil::now())
4547 "page_id" => array(
"integer", $this->
getId()),
4564 $db = $DIC->database();
4567 if ($a_lang !=
"") {
4568 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4571 $q =
"SELECT * FROM page_object " .
4572 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4573 " AND parent_type = " .
$db->quote($a_parent_type,
"text") .
4574 " AND int_links = " .
$db->quote(1,
"integer") . $and_lang;
4575 $set =
$db->query($q);
4577 while ($page =
$db->fetchAssoc($set)) {
4578 $key_add = ($a_lang ==
"")
4579 ?
":" . $page[
"lang"]
4581 $pages[$page[
"page_id"] . $key_add] = array(
4582 "date" => $page[
"last_change"],
4583 "id" => $page[
"page_id"],
4584 "lang" => $page[
"lang"],
4585 "user" => $page[
"last_change_user"]);
4626 $link_type =
"MediaObject";
4627 $a_id =
"il__mob_" . $a_id;
4631 $link_type =
"PageObject";
4632 $a_id =
"il__pg_" . $a_id;
4636 $link_type =
"GlossaryItem";
4637 $a_id =
"il__git_" . $a_id;
4638 $a_target =
"Glossary";
4643 if ($link_type ==
"" || $a_id ==
"") {
4645 $path =
"//PageObject/InitOpenedContent";
4647 if (count(
$res->nodeset) > 0) {
4648 $res->nodeset[0]->unlink_node(
$res->nodeset[0]);
4652 $path =
"//PageObject/InitOpenedContent";
4654 if (count(
$res->nodeset) > 0) {
4655 $init_node =
$res->nodeset[0];
4656 $childs = $init_node->child_nodes();
4657 for (
$i = 0;
$i < count($childs);
$i++) {
4658 if ($childs[
$i]->node_name() ==
"IntLink") {
4659 $il_node = $childs[
$i];
4663 $path =
"//PageObject";
4665 $page_node =
$res->nodeset[0];
4666 $init_node = $this->dom->create_element(
"InitOpenedContent");
4667 $init_node = $page_node->append_child($init_node);
4668 $il_node = $this->dom->create_element(
"IntLink");
4669 $il_node = $init_node->append_child($il_node);
4671 $il_node->set_attribute(
"Target", $a_id);
4672 $il_node->set_attribute(
"Type", $link_type);
4673 $il_node->set_attribute(
"TargetFrame", $a_target);
4690 $path =
"//PageObject/InitOpenedContent";
4693 if (count(
$res->nodeset) > 0) {
4694 $init_node =
$res->nodeset[0];
4695 $childs = $init_node->child_nodes();
4696 for (
$i = 0;
$i < count($childs);
$i++) {
4697 if ($childs[
$i]->node_name() ==
"IntLink") {
4698 $il_node = $childs[
$i];
4702 if (!is_null($il_node)) {
4703 $id = $il_node->get_attribute(
"Target");
4704 $link_type = $il_node->get_attribute(
"Type");
4705 $target = $il_node->get_attribute(
"TargetFrame");
4707 switch ($link_type) {
4716 case "GlossaryItem":
4720 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
4750 public function copy($a_id, $a_parent_type =
"", $a_parent_id = 0, $a_clone_mobs =
false)
4752 if ($a_parent_type ==
"") {
4754 if ($a_parent_id == 0) {
4759 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
4768 $new_page_object->setParentId($a_parent_id);
4769 $new_page_object->setId($a_id);
4771 $new_page_object->setXMLContent($orig_page->copyXMLContent($a_clone_mobs));
4772 $new_page_object->setActive($orig_page->getActive());
4773 $new_page_object->setActivationStart($orig_page->getActivationStart());
4774 $new_page_object->setActivationEnd($orig_page->getActivationEnd());
4776 $new_page_object->buildDom();
4777 $new_page_object->update();
4779 $new_page_object->create();
4795 $db = $DIC->database();
4798 "SELECT lang FROM page_object " .
4799 " WHERE page_id = " .
$db->quote($a_id,
"integer") .
4800 " AND parent_type = " .
$db->quote($a_parent_type,
"text")
4803 while ($rec =
$db->fetchAssoc($set)) {
4804 $langs[] = $rec[
"lang"];
4823 $transl_page->setId($this->
getId());
4825 $transl_page->setXMLContent($this->copyXMLContent());
4826 $transl_page->setActive($this->
getActive());
4829 $transl_page->create();
4849 "UPDATE page_object SET " .
4850 " edit_lock_user = " .
$db->quote(
$user->getId(),
"integer") .
"," .
4851 " edit_lock_ts = " .
$db->quote($ts,
"integer") .
4852 " WHERE (edit_lock_user = " .
$db->quote(
$user->getId(),
"integer") .
" OR " .
4853 " edit_lock_ts < " .
$db->quote(time() - ($min * 60),
"integer") .
") " .
4854 " AND page_id = " .
$db->quote($this->
getId(),
"integer") .
4859 "SELECT edit_lock_user FROM page_object " .
4860 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4861 " AND parent_type = " .
$db->quote($this->getParentType(),
"text")
4863 $rec =
$db->fetchAssoc($set);
4864 if ($rec[
"edit_lock_user"] !=
$user->getId()) {
4881 $min = (int) $aset->get(
"block_mode_minutes") ;
4886 "UPDATE page_object SET " .
4887 " edit_lock_user = " .
$db->quote(
$user->getId(),
"integer") .
"," .
4888 " edit_lock_ts = 0" .
4889 " WHERE edit_lock_user = " .
$db->quote(
$user->getId(),
"integer") .
4890 " AND page_id = " .
$db->quote($this->getId(),
"integer") .
4891 " AND parent_type = " .
$db->quote($this->getParentType(),
"text")
4895 "SELECT edit_lock_user FROM page_object " .
4896 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4897 " AND parent_type = " .
$db->quote($this->getParentType(),
"text")
4899 $rec =
$db->fetchAssoc($set);
4900 if ($rec[
"edit_lock_user"] !=
$user->getId()) {
4918 $min = (int) $aset->get(
"block_mode_minutes");
4921 "SELECT edit_lock_user, edit_lock_ts FROM page_object " .
4922 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4923 " AND parent_type = " .
$db->quote($this->getParentType(),
"text")
4925 $rec =
$db->fetchAssoc($set);
4926 $rec[
"edit_lock_until"] = $rec[
"edit_lock_ts"] + $min * 60;
4943 public static function truncateHTML($a_text, $a_length = 100, $a_ending =
'...', $a_exact =
false, $a_consider_html =
true)
4945 include_once
"Services/Utilities/classes/class.ilStr.php";
4947 if ($a_consider_html) {
4949 if (strlen(preg_replace(
'/<.*?>/',
'', $a_text)) <= $a_length) {
4954 $total_length = strlen($a_ending);
4955 $open_tags = array();
4957 preg_match_all(
'/(<.+?>)?([^<>]*)/s', $a_text, $lines, PREG_SET_ORDER);
4958 foreach ($lines as $line_matchings) {
4960 if (!empty($line_matchings[1])) {
4962 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 elseif (preg_match(
'/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) {
4968 $pos = array_search($tag_matchings[1], $open_tags);
4969 if ($pos !==
false) {
4970 unset($open_tags[$pos]);
4974 elseif (preg_match(
'/^<\s*([^\s>!]+).*?>$/s', $line_matchings[1], $tag_matchings)) {
4976 array_unshift($open_tags, strtolower($tag_matchings[1]));
4979 $truncate .= $line_matchings[1];
4983 $content_length = strlen(preg_replace(
'/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i',
' ', $line_matchings[2]));
4984 if ($total_length + $content_length > $a_length) {
4986 $left = $a_length - $total_length;
4987 $entities_length = 0;
4989 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)) {
4991 foreach ($entities[0] as $entity) {
4992 if ($entity[1] + 1 - $entities_length <= $left) {
4994 $entities_length += strlen($entity[0]);
5008 $truncate .= $line_matchings[2];
5009 $total_length += $content_length;
5013 if ($total_length >= $a_length) {
5018 if (strlen($a_text) <= $a_length) {
5027 if (!
sizeof($open_tags)) {
5031 $spacepos = strrpos($truncate,
' ');
5032 if ($spacepos !==
false) {
5041 $truncate .= $a_ending;
5043 if ($a_consider_html) {
5045 foreach ($open_tags as
$tag) {
5046 $truncate .=
'</' . $tag .
'>';
5074 $db = $DIC->database();
5077 if ($a_lang !=
"") {
5078 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
5082 $q =
"SELECT last_change FROM page_object " .
5083 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
5084 " AND parent_type = " .
$db->quote($a_parent_type,
"text") . $and_lang .
5085 " ORDER BY last_change DESC";
5087 $set =
$db->query($q);
5088 $rec =
$db->fetchAssoc($set);
5090 return $rec[
"last_change"];
5095 if ($this->
getPageConfig()->getEditLockSupport() ==
false) {
5100 $min = (int) $aset->get(
"block_mode_minutes") ;
5112 $file_obj_ids = array();
5116 $path =
"//FileItem/Identifier";
5118 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
5119 $file_obj_ids[] =
$res->nodeset[
$i]->get_attribute(
"Entry");
5122 return $file_obj_ids;
5131 include_once(
"./Services/COPage/classes/class.ilPCResources.php");
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
getLastUpdateOfIncludedElements()
Get last update of included elements (media objects and files).
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static _lookupName($a_user_id)
lookup user name
performAutomaticModifications()
Perform automatic modifications (may be overwritten by sub classes)
removeQuestions(&$temp_dom)
Remove questions from document.
appendXMLContent($a_xml)
append xml content to page setXMLContent must be called before and the same encoding must be used ...
stripHierIDs()
strip all hierarchical id attributes out of the dom tree
static shortenText($a_string, $a_start_pos, $a_num_bytes, $a_encoding='UTF-8')
Shorten text to the given number of bytes.
checkPCIds()
Check, whether (all) page content hashes are set.
increaseViewCnt()
Increase view cnt.
getAllPCIds()
Get all pc ids.
generatePcId($a_pc_ids=false)
Generate new pc id.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static incEdId($ed_id)
Increases an hierarchical editing id at lowest level (last number)
static _existsAndNotEmpty($a_parent_type, $a_id, $a_lang="-")
Checks whether page exists and is not empty (may return true on some empty pages) ...
updateFromXML()
Updates page object with current xml content.
__beforeDelete()
Before deletion handler (internal).
releasePageLock()
Release page lock.
addFileSizes()
add file sizes
static getPCDefinitionByName($a_pc_name)
Get PC definition by name.
getInternalLinks($a_cnt_multiple=false)
get all internal links that are used within the page
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) ...
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
static _removeInstFromTarget($a_target)
Removes installation id from target string.
copyPageToTranslation($a_target_lang)
Copy page to translation.
getFO()
get fo page content
getEffectiveEditLockTime()
getLanguage()
Get language.
needsImportParsing($a_parse="")
const ILIAS_VERSION_NUMERIC
__afterUpdate($a_domdoc, $a_xml, $a_creation=false, $a_empty=false)
After update event handler (internal).
setImportMode($a_val)
Set import mode.
deleteContentFromHierId($a_hid, $a_update=true)
delete content object with hierarchical id >= $a_hid
xpath_new_context($dom_document)
setActive($a_active)
set activation
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data
existsPCId($a_pc_id)
existsPCId
static sortHierIds($a_array)
Sort an array of Hier IDS in ascending order.
Page not found exception.
resolveIIMMediaAliases($a_mapping)
Resolve iim media aliases (in ilContObjParse)
getFirstColumnIds()
get ids of all first table columns
static _extractInstOfTarget($a_target)
Extract installation id out of target.
handleCopiedContent($a_dom, $a_self_ass=true, $a_clone_mobs=false)
Handle copied content.
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.
getMediaAliasElement($a_mob_id, $a_nr=1)
get complete media object (alias) element
create()
create new page (with current xml data)
static getPagesWithLinks($a_parent_type, $a_parent_id, $a_lang="-")
Get all pages for parent object that contain internal links.
setParagraphContent($a_hier_id, $a_content)
Set content of paragraph.
deleteContents($a_hids, $a_update=true, $a_self_ass=false)
Delete multiple content objects.
domxml_open_mem($str, $mode=0, &$error=null)
setActivationEnd($a_activationend)
Set Activation End.
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.
setActivationStart($a_activationstart)
Set Activation Start.
copyXmlContent($a_clone_mobs=false)
Copy content of page; replace page components with copies where necessary (e.g.
static _extractObjIdOfTarget($a_target)
Extract object id out of target.
xpath_eval($xpath_context, $eval_str, $contextnode=null)
newIIMCopies($temp_dom)
Replaces media objects in interactive images with copies of the interactive images.
static getPCDefinitions()
Get PC definitions.
static getAllPages($a_parent_type, $a_parent_id, $a_lang="-")
Get all pages for parent object.
static getPageContributors($a_parent_type, $a_page_id, $a_lang="-")
Get all contributors for parent object.
send_paragraph($par_id, $filename)
pasteContents($a_hier_id, $a_self_ass=false)
Paste contents from pc clipboard.
setShowActivationInfo($a_val)
Set show page activation info.
resolveIntLinks($a_link_map=null)
Resolves all internal link targets of the page, if targets are available (after import) ...
static _getIdForImportId($a_type, $a_target)
Get current id for an import id.
getQuestionIds()
Get question ids.
getHistoryEntries()
Get History Entries.
static getLastChangeByParent($a_parent_type, $a_parent_id, $a_lang="")
Get all pages for parent object.
getDomDoc()
Get dom doc (php5 dom document)
static requirePCClassByName($a_name)
Get instance.
moveContentAfter($a_source, $a_target, $a_spcid="", $a_tpcid="")
move content object from position $a_source before position $a_target (both hierarchical content ids)...
checkForTag($a_content_tag, $a_hier_id, $a_pc_id="")
Get content node from dom.
registerOfflineHandler($handler)
static _moveContentAfterHierId(&$a_source_page, &$a_target_page, $a_hid)
move content of hierarchical id >= $a_hid to other page
static now()
Return current timestamp in Y-m-d H:i:s format.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
static xml2output($a_text, $a_wysiwyg=false, $a_replace_lists=true, $unmask=true)
Converts xml from DB to output in edit textarea.
getPageContentsHashes()
Get page contents hashes.
__afterHistoryEntry($a_old_domdoc, $a_old_content, $a_old_nr)
Before deletion handler (internal).
getContentObject($a_hier_id, $a_pc_id="")
Get a content object of the page.
handleRepositoryLinksOnCopy($a_mapping, $a_source_ref_id)
Handle repository links on copy process.
getFileItemIds()
get ids of all file items
getRenderMd5()
Get Render MD5.
static getConfigInstance($a_parent_type)
Get page config instance.
static lookupParentId($a_id, $a_type)
Lookup parent id.
newMobCopies($temp_dom)
Replaces media objects with copies.
moveIntLinks($a_from_to)
Move internal links from one destination to another.
setRenderedContent($a_renderedcontent)
Set Rendered Content.
compareVersion($a_left, $a_right)
Compares to revisions of the page.
addUpdateListener(&$a_object, $a_method, $a_parameters="")
collectMediaObjects($a_inline_only=true)
get all media objects, that are referenced and used within the page
__construct($a_id=0, $a_old_nr=0, $a_lang="-")
Constructor public.
moveContentBefore($a_source, $a_target, $a_spcid="", $a_tpcid="")
move content object from position $a_source before position $a_target (both hierarchical content ids)...
foreach($_POST as $key=> $value) $res
static _existsAndNotEmpty($a_parent_type, $a_id, $a_lang="-")
checks whether page exists and is not empty (may return true on some empty pages) ...
getXMLContent($a_incl_head=false)
get xml content of page
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static _writeParentId($a_parent_type, $a_pg_id, $a_par_id)
Write parent id.
beforePageContentUpdate($a_page_content)
Before page content update.
deleteInternalLinks()
Delete internal links.
static _writeActive($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation=true, $a_lang="-")
write activation status
getActive($a_check_scheduled_activation=false)
get activation
getLastChange()
Get Last Change.
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
getListItemIds()
get ids of all list items
getInitialOpenedContent()
Get initial opened content.
resolveFileItems($a_mapping)
Resolve file items (after import)
static _lookupObjId($a_id)
resolveQuestionReferences($a_mapping)
Resolve all quesion references (after import)
containsIntLink()
returns true, if page was marked as containing an intern link (via setContainsIntLink) (this method s...
createFromXML()
Create new page object with current xml content.
setRenderedTime($a_renderedtime)
Set Rendered Time.
getRenderedContent()
Get Rendered Content.
static getParentObjectContributors($a_parent_type, $a_parent_id, $a_lang="-")
Get all contributors for parent object.
getImportMode()
Get import mode.
getActivationStart()
Get Activation Start.
catch(Exception $e) if(isset($_POST['cancel'])) if(isset($_POST['continue'])) $cfg
setPageConfig($a_val)
Set page config object.
static _exists($a_type, $a_target)
Check if internal link refers to a valid target.
appendLangVarXML(&$xml, $var)
static getRecentChanges($a_parent_type, $a_parent_id, $a_period=30, $a_lang="")
Get recent pages changes for parent object.
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
Unknown page content type exception.
static _getSourcesOfTarget($a_target_type, $a_target_id, $a_target_inst)
get all sources of a link target
static _handleImportRepositoryLinks($a_rep_import_id, $a_rep_type, $a_rep_ref_id)
Change targest of repository links.
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:
getOfflineHandler()
Get offline handler.
getShowActivationInfo()
Get show page activation info.
static _lookupImportId($a_obj_id)
static _getFilesOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_usage_lang="-")
get all files of an object
update($a_validate=true, $a_no_history=false)
update complete page content in db (dom xml content is used)
static _lookupType($a_id, $a_reference=false)
lookup object type
setRenderMd5($a_rendermd5)
Set Render MD5.
static _lookupContainsDeactivatedElements($a_id, $a_parent_type, $a_lang="-")
lookup whether page contains deactivated elements
static _isScheduledActivation($a_id, $a_parent_type, $a_lang="-")
Check whether page is activated by time schedule.
containsIntLinks($a_content)
Check whether content contains internal links.
static _instantiateQuestion($question_id)
deleteContentBeforeHierId($a_hid, $a_update=true)
delete content object with hierarchical id < $a_hid
getContentTemplates()
Get content templates.
insertPCIds()
Insert Page Content IDs.
getFirstRowIds()
get ids of all first table rows
getLanguageVariablesXML()
Get language variables as XML.
addHierIDs()
Add hierarchical ID (e.g.
getLastChangeUser()
Get last change user.
insertInstIntoIDs($a_inst, $a_res_ref_to_obj_id=true)
inserts installation id into ids (e.g.
static truncateHTML($a_text, $a_length=100, $a_ending='...', $a_exact=false, $a_consider_html=true)
Truncate (html) string.
saveInitialOpenedContent($a_type, $a_id, $a_target)
Save initial opened content.
saveStyleUsage($a_domdoc, $a_old_nr=0)
Save all style class/template usages.
setContainsQuestion($a_val)
Set contains question.
handleImportRepositoryLink($a_rep_import_id, $a_rep_type, $a_rep_ref_id)
afterConstructor()
After constructor.
static _lookupFileSize($a_id)
Lookups the file size of the file in bytes.
static _lookupActivationData($a_id, $a_parent_type, $a_lang="-")
Lookup activation data.
static getInstance($a_parent_type, $a_id=0, $a_old_nr=0, $a_lang="-")
Get page object instance.
static _getLastUpdateOfObjects($a_objs)
Get last update for a set of media objects.
getDom()
Deprecated php4DomDocument.
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.
setLastChange($a_lastchange)
Set Last Change.
getHistoryEntry($a_old_nr)
Get History Entry.
getEditLockInfo()
Get edit lock info.
bbCode2XML(&$a_content)
transforms bbCode to corresponding xml
setLanguage($a_val)
Set language.
setXMLContent($a_xml, $a_encoding="UTF-8")
set xml content of page, start with <PageObject...>, end with </PageObject>, comply with ILIAS DTD...
newQuestionCopies(&$temp_dom)
Replaces existing question content elements with new copies.
setLastChangeUser($a_val)
Set last change user.
writeRenderedContent($a_content, $a_md5)
Write rendered content.
initPageConfig()
Init page config.
getPageConfig()
Get page config object.
static lookupTranslations($a_parent_type, $a_id)
Lookup translations.
const DOMXML_LOAD_PARSING
getMultimediaXML()
get a xml string that contains all media object elements, that are referenced by any media alias in t...
static preloadActivationDataByParentId($a_parent_id)
Preload activation data by Parent Id.
containsDeactivatedElements($a_content)
Check whether content contains deactivated elements.
resolveMediaAliases($a_mapping, $a_reuse_existing_by_import=false)
Resolve media aliases (after import)
getEditLock()
Get page lock.
setContainsIntLink($a_contains_link)
lm parser set this flag to true, if the page contains intern links (this method should only be called...
switchEnableMultiple($a_hids, $a_update=true, $a_self_ass=false)
(De-)activate elements
static _deleteAllLinksOfSource($a_source_type, $a_source_id, $a_lang="-")
Delete all links of a given source.
copyContents($a_hids)
Copy contents to clipboard.
getHistoryInfo($a_nr)
Get information about a history entry, its predecessor and its successor.
countPageContents()
Remove questions from document.
static getLogger($a_component_id)
Get component logger.
getHierIds()
get all hierarchical ids
saveInternalLinks($a_domdoc)
save internal links of page
afterUpdate()
After update.
getRenderedTime()
Get Rendered Time.
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
& getContentNode($a_hier_id, $a_pc_id="")
Get content node from dom.
getActivationEnd()
Get Activation End.
getRepoObjId()
Get object id of repository object that contains this page, return 0 if page does not belong to a rep...
static setAction($a_action)
resolveResources($ref_mapping)
Resolve resources.
static getNewPages($a_parent_type, $a_parent_id, $a_lang="-")
Get new pages.
getHierIdsForPCIds($a_pc_ids)
Get hier ids for a set of pc ids.
copy($a_id, $a_parent_type="", $a_parent_id=0, $a_clone_mobs=false)
Copy page.
static resolveResources(ilPageObject $page, $ref_mappings)
Resolve resources.
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Extension of ilPageObject for learning modules.
getContainsQuestion()
Get contains question.
getAllFileObjIds()
Get all file object ids.
getParentType()
Get parent type.
deleteStyleUsages($a_old_nr=0)
Delete style usages.
validateDom()
Validate the page content agains page DTD.
cutContents($a_hids)
Copy contents to clipboard and cut them from the page.
deleteContent($a_hid, $a_update=true, $a_pcid="")
delete content object with hierarchical id $a_hid
addChangeDivClasses($a_hashes)