4define(
"IL_INSERT_BEFORE", 0);
5define(
"IL_INSERT_AFTER", 1);
6define(
"IL_INSERT_CHILD", 2);
129 final public function __construct($a_id = 0, $a_old_nr = 0, $a_lang =
"-")
132 $this->obj_definition =
$DIC[
"objDefinition"];
133 $this->db =
$DIC->database();
134 $this->
user = $DIC->user();
135 $this->lng =
$DIC->language();
136 $this->tree =
$DIC->repositoryTree();
143 $this->contains_int_link =
false;
144 $this->needs_parsing =
false;
145 $this->update_listeners = array();
146 $this->update_listener_cnt = 0;
147 $this->dom_builded =
false;
148 $this->page_not_found =
false;
149 $this->old_nr = $a_old_nr;
150 $this->encoding =
"UTF-8";
163 $this->show_page_act_info =
false;
192 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
217 $this->concrete_lang = $a_val;
232 $this->page_config = $a_val;
250 $this->rendermd5 = $a_rendermd5;
259 return $this->rendermd5;
268 $this->renderedcontent = $a_renderedcontent;
277 return $this->renderedcontent;
286 $this->renderedtime = $a_renderedtime;
295 return $this->renderedtime;
304 $this->lastchange = $a_lastchange;
313 return $this->lastchange;
322 $this->last_change_user = $a_val;
331 return $this->last_change_user;
340 $this->show_page_act_info = $a_val;
349 return $this->show_page_act_info;
358 if ($this->old_nr == 0) {
359 $query =
"SELECT * FROM page_object" .
360 " WHERE page_id = " . $this->db->quote($this->
id,
"integer") .
361 " AND parent_type=" . $this->db->quote($this->
getParentType(),
"text") .
362 " AND lang = " . $this->db->quote($this->
getLanguage(),
"text");
363 $pg_set = $this->db->query(
$query);
364 $this->page_record = $this->db->fetchAssoc($pg_set);
365 $this->
setActive($this->page_record[
"active"]);
370 $query =
"SELECT * FROM page_history" .
371 " WHERE page_id = " . $this->db->quote($this->
id,
"integer") .
372 " AND parent_type=" . $this->db->quote($this->
getParentType(),
"text") .
373 " AND nr = " . $this->db->quote((
int) $this->old_nr,
"integer") .
374 " AND lang = " . $this->db->quote($this->
getLanguage(),
"text");
375 $pg_set = $this->db->query(
$query);
376 $this->page_record = $this->db->fetchAssoc($pg_set);
378 if (!$this->page_record) {
379 include_once(
"./Services/COPage/exceptions/class.ilCOPageNotFoundException.php");
384 $this->xml = $this->page_record[
"content"];
385 $this->
setParentId($this->page_record[
"parent_id"]);
386 $this->last_change_user = $this->page_record[
"last_change_user"];
387 $this->create_user = $this->page_record[
"create_user"];
400 public static function _exists($a_parent_type, $a_id, $a_lang =
"", $a_no_cache =
false)
406 if (!$a_no_cache && isset(self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang])) {
407 return self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang];
412 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
415 $query =
"SELECT page_id FROM page_object WHERE page_id = " .
$db->quote($a_id,
"integer") .
" " .
416 "AND parent_type = " .
$db->quote($a_parent_type,
"text") . $and_lang;
418 if ($row =
$db->fetchAssoc($set)) {
419 self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang] =
true;
422 self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang] =
false;
435 include_once(
"./Services/COPage/classes/class.ilPageUtil.php");
441 if ($this->dom_builded && !$a_force) {
455 $path =
"//PageObject";
457 if (count(
$res->nodeset) == 1) {
459 $this->node =
$res->nodeset[0];
464 $this->dom_builded =
true;
493 return $this->dom->myDOMDocument;
514 $this->parent_id = $a_id;
525 $this->update_listeners[$cnt][
"object"] = $a_object;
526 $this->update_listeners[$cnt][
"method"] = $a_method;
527 $this->update_listeners[$cnt][
"parameters"] = $a_parameters;
528 $this->update_listener_cnt++;
534 $object = $this->update_listeners[
$i][
"object"];
535 $method = $this->update_listeners[
$i][
"method"];
536 $parameters = $this->update_listeners[
$i][
"parameters"];
537 $object->$method($parameters);
547 $this->active = $a_active;
554 public function getActive($a_check_scheduled_activation =
false)
556 if ($a_check_scheduled_activation && !$this->active) {
557 include_once(
"./Services/Calendar/classes/class.ilDateTime.php");
578 "SELECT page_id, parent_type, lang, active, activation_start, activation_end, show_activation_info FROM page_object " .
579 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer")
581 while ($rec =
$db->fetchAssoc($set)) {
582 self::$activation_data[$rec[
"page_id"] .
":" . $rec[
"parent_type"] .
":" . $rec[
"lang"]] = $rec;
589 public static function _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation =
false, $a_lang =
"-")
600 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
601 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
604 "SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s" .
605 " AND parent_type = %s AND lang = %s",
606 array(
"integer",
"text",
"text"),
607 array($a_id, $a_parent_type, $a_lang)
609 $rec =
$db->fetchAssoc($set);
614 if (!$rec[
"active"] && $a_check_scheduled_activation) {
615 if ($rec[
"n"] >= $rec[
"activation_start"] &&
616 $rec[
"n"] <= $rec[
"activation_end"]) {
621 return $rec[
"active"];
640 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
641 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
644 "SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s" .
645 " AND parent_type = %s AND lang = %s",
646 array(
"integer",
"text",
"text"),
647 array($a_id, $a_parent_type, $a_lang)
649 $rec =
$db->fetchAssoc($set);
652 if (!$rec[
"active"] && $rec[
"activation_start"] !=
"") {
666 $a_reset_scheduled_activation =
true,
678 if ($a_reset_scheduled_activation) {
679 $st =
$db->manipulateF(
680 "UPDATE page_object SET active = %s, activation_start = %s, " .
681 " activation_end = %s WHERE page_id = %s" .
682 " AND parent_type = %s AND lang = %s",
683 array(
"boolean",
"timestamp",
"timestamp",
"integer",
"text",
"text"),
684 array($a_active,
null,
null, $a_id, $a_parent_type, $a_lang)
687 $st =
$db->prepareManip(
688 "UPDATE page_object SET active = %s WHERE page_id = %s" .
689 " AND parent_type = %s AND lang = %s",
690 array(
"boolean",
"integer",
"text",
"text"),
691 array($a_active, $a_id, $a_parent_type, $a_lang)
710 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
711 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
714 "SELECT active, activation_start, activation_end, show_activation_info FROM page_object WHERE page_id = %s" .
715 " AND parent_type = %s AND lang = %s",
716 array(
"integer",
"text",
"text"),
717 array($a_id, $a_parent_type, $a_lang)
719 $rec =
$db->fetchAssoc($set);
734 $res =
$db->query(
"SELECT parent_id FROM page_object WHERE page_id = " .
$db->quote($a_id,
"integer") .
" " .
735 "AND parent_type=" .
$db->quote($a_type,
"text"));
737 return $rec[
"parent_id"];
749 "UPDATE page_object SET parent_id = %s WHERE page_id = %s" .
750 " AND parent_type = %s",
751 array(
"integer",
"integer",
"text"),
752 array($a_par_id, $a_pg_id, $a_parent_type)
762 if ($a_activationstart ==
"") {
763 $a_activationstart =
null;
765 $this->activationstart = $a_activationstart;
774 return $this->activationstart;
783 if ($a_activationend ==
"") {
784 $a_activationend =
null;
786 $this->activationend = $a_activationend;
795 return $this->activationend;
807 if (!is_object($cont_node)) {
810 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
811 $node_name = $cont_node->node_name();
812 if (in_array($node_name, [
"PageObject",
"TableRow"])) {
815 if ($node_name ==
"PageContent") {
816 $child_node = $cont_node->first_child();
817 $node_name = $child_node->node_name();
821 if ($node_name ==
"Table") {
822 if ($child_node->get_attribute(
"DataTable") ==
"y") {
823 require_once(
"./Services/COPage/classes/class.ilPCDataTable.php");
825 $tab->setNode($cont_node);
826 $tab->setHierId($a_hier_id);
828 require_once(
"./Services/COPage/classes/class.ilPCTable.php");
830 $tab->setNode($cont_node);
831 $tab->setHierId($a_hier_id);
833 $tab->setPcId($a_pc_id);
838 if ($node_name ==
"MediaObject") {
839 if (
$_GET[
"pgEdMediaMode"] !=
"") {
840 echo
"ilPageObject::error media";
845 require_once(
"./Services/COPage/classes/class.ilPCMediaObject.php");
847 $mal_node = $child_node->first_child();
849 $id_arr = explode(
"_", $mal_node->get_attribute(
"OriginId"));
850 $mob_id = $id_arr[count($id_arr) - 1];
864 $mob->readMediaObject($mob_id);
867 $mob->setNode($cont_node);
868 $mob->setHierId($a_hier_id);
869 $mob->setPcId($a_pc_id);
880 if (!is_array($pc_def)) {
881 include_once(
"./Services/COPage/exceptions/class.ilCOPageUnknownPCTypeException.php");
884 $pc_class =
"ilPC" . $pc_def[
"name"];
885 $pc_path =
"./" . $pc_def[
"component"] .
"/" . $pc_def[
"directory"] .
"/class." . $pc_class .
".php";
886 require_once($pc_path);
887 $pc =
new $pc_class($this);
888 $pc->setNode($cont_node);
889 $pc->setHierId($a_hier_id);
890 $pc->setPcId($a_pc_id);
914 $node = $content_object->getNode();
917 if (
$node->node_name() ==
"PageContent") {
918 $pcid =
$node->get_attribute(
"PCID");
937 if ($a_hier_id ==
"pg") {
941 if ($a_pc_id !=
"") {
942 $path =
"//*[@PCID = '$a_pc_id']";
944 if (count(
$res->nodeset) == 1) {
945 $cont_node =
$res->nodeset[0];
951 $path =
"//*[@HierId = '$a_hier_id']";
953 if (count(
$res->nodeset) == 1) {
954 $cont_node =
$res->nodeset[0];
966 public function checkForTag($a_content_tag, $a_hier_id, $a_pc_id =
"")
970 if ($a_pc_id !=
"") {
971 $path =
"//*[@PCID = '$a_pc_id']//" . $a_content_tag;
973 if (count(
$res->nodeset) > 0) {
979 $path =
"//*[@HierId = '$a_hier_id']//" . $a_content_tag;
981 if (count(
$res->nodeset) > 0) {
991 $path =
"//*[@HierId = '$a_hier_id']";
993 if (count(
$res->nodeset) == 1) {
1014 $this->encoding = $a_encoding;
1015 $this->xml = $a_xml;
1025 $this->xml .= $a_xml;
1037 $enc_str = (!empty($this->encoding))
1038 ?
"encoding=\"" . $this->encoding .
"\""
1040 return "<?xml version=\"1.0\" $enc_str ?>" .
1041 "<!DOCTYPE PageObject SYSTEM \"" . ILIAS_ABSOLUTE_PATH .
"/xml/" . $this->cur_dtd .
"\">" .
1054 $xml = $this->getXmlContent();
1056 '<?xml version="1.0" encoding="UTF-8"?>' .
$xml,
1060 if (empty($error)) {
1063 $xml = $temp_dom->dump_mem(0, $this->encoding);
1064 $xml = preg_replace(
'/<\?xml[^>]*>/i',
"",
$xml);
1065 $xml = preg_replace(
'/<!DOCTYPE[^>]*>/i',
"",
$xml);
1086 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
1100 if ($a_clone_mobs) {
1106 $a_dom = $a_dom->myDOMDocument;
1108 foreach ($defs as $def) {
1110 $cl = $def[
"pc_class"];
1111 if ($cl ==
'ilPCPlugged') {
1113 ilPCPlugged::handleCopiedPluggedContent($this, $a_dom);
1115 $cl::handleCopiedContent($a_dom, $a_self_ass, $a_clone_mobs);
1126 public function handleDeleteContent($a_node =
null)
1128 if (!isset($a_node)) {
1130 $path =
"//PageContent";
1132 $nodes =
$res->nodeset;
1134 $nodes = array($a_node);
1137 require_once(
'Services/COPage/classes/class.ilPCPlugged.php');
1138 foreach ($nodes as
$node) {
1144 if (
$node->firstChild->nodeName ==
'Plugged') {
1145 ilPCPlugged::handleDeletedPluggedNode($this,
$node->firstChild);
1157 $path =
"//InteractiveImage/MediaAlias";
1162 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
1163 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1164 $or_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1169 if (!($inst_id > 0)) {
1171 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1176 $new_mob = $media_object->duplicate();
1178 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $new_mob->getId());
1190 $path =
"//MediaObject/MediaAlias";
1195 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
1196 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1197 $or_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1202 if (!($inst_id > 0)) {
1204 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1209 $new_mob = $media_object->duplicate();
1211 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $new_mob->getId());
1224 $path =
"//Question";
1229 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
1230 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1231 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
1236 if (!($inst_id > 0)) {
1238 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
1241 if (is_object($question) && $question->isComplete()) {
1245 $question->createPageObject();
1250 $duplicate_id = $question->duplicate(
false);
1251 $res->nodeset[
$i]->set_attribute(
"QRef",
"il__qst_" . $duplicate_id);
1266 $path =
"//Question";
1269 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1270 $parent_node =
$res->nodeset[
$i]->parent_node();
1271 $parent_node->unlink_node($parent_node);
1286 $path =
"//PageContent";
1289 return count(
$res->nodeset);
1297 $a_incl_head =
false,
1298 $a_append_mobs =
false,
1299 $a_append_bib =
false,
1301 $a_omit_pageobject_tag =
false,
1306 return $this->dom->dump_mem(0, $this->encoding);
1309 if ($a_append_mobs || $a_append_bib || $a_append_link_info) {
1312 if ($a_append_mobs) {
1315 if ($a_append_bib) {
1321 return "<dummy>" . $this->dom->dump_node($this->node) .
$mobs . $bibs . $trans . $a_append_str .
"</dummy>";
1323 if (is_object($this->dom)) {
1324 if ($a_omit_pageobject_tag) {
1326 $childs = $this->node->child_nodes();
1327 for (
$i = 0;
$i < count($childs);
$i++) {
1328 $xml .= $this->dom->dump_node($childs[
$i]);
1332 $xml = $this->dom->dump_mem(0, $this->encoding);
1333 $xml = preg_replace(
'/<\?xml[^>]*>/i',
"",
$xml);
1334 $xml = preg_replace(
'/<!DOCTYPE[^>]*>/i',
"",
$xml);
1366 "ed_align_left_float",
1367 "ed_align_right_float",
1369 "ed_new_item_before",
1370 "ed_new_item_after",
1376 "ed_split_page_next",
1384 "ed_click_to_add_pg",
1389 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
1391 foreach ($defs as $def) {
1392 $lang_vars[] =
"pc_" . $def[
"pc_type"];
1393 $lang_vars[] =
"ed_insert_" . $def[
"pc_type"];
1396 $cl = $def[
"pc_class"];
1397 $lvs = call_user_func($def[
"pc_class"] .
'::getLangVars');
1398 foreach ($lvs as $lv) {
1405 $dummy_pc->setStyleId($style_id);
1406 foreach ([
"section",
"table",
"flist_li",
"list_u",
"list_o",
1407 "table",
"table_cell"] as
$type) {
1408 $dummy_pc->getCharacteristicsOfCurrentStyle(
$type);
1409 foreach ($dummy_pc->getCharacteristics() as $char =>
$txt) {
1410 $xml .=
"<LV name=\"char_" .
$type .
"_" . $char .
"\" value=\"" .
$txt .
"\"/>";
1413 $type =
"media_cont";
1415 $dummy_pc->setStyleId($style_id);
1416 $dummy_pc->getCharacteristicsOfCurrentStyle(
$type);
1417 foreach ($dummy_pc->getCharacteristics() as $char =>
$txt) {
1418 $xml .=
"<LV name=\"char_" .
$type .
"_" . $char .
"\" value=\"" .
$txt .
"\"/>";
1420 foreach ([
"text_block",
"heading1",
"heading2",
"heading3"] as
$type) {
1422 $dummy_pc->setStyleId($style_id);
1423 $dummy_pc->getCharacteristicsOfCurrentStyle(
$type);
1424 foreach ($dummy_pc->getCharacteristics() as $char =>
$txt) {
1425 $xml .=
"<LV name=\"char_" .
$type .
"_" . $char .
"\" value=\"" .
$txt .
"\"/>";
1428 foreach ($lang_vars as $lang_var) {
1437 $val = $this->lng->txt(
"cont_" . $var);
1438 $val = str_replace(
'"',
""", $val);
1439 $xml .=
"<LV name=\"$var\" value=\"" . $val .
"\"/>";
1447 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
1449 $path =
"//Paragraph[1]";
1451 if (count(
$res->nodeset) > 0) {
1452 $cont_node =
$res->nodeset[0]->parent_node();
1454 $par->setNode($cont_node);
1455 $text = $par->getText();
1466 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
1468 $path =
"//PageContent[@PCID='" . $pcid .
"']/Paragraph[1]";
1470 if (count(
$res->nodeset) > 0) {
1471 $cont_node =
$res->nodeset[0]->parent_node();
1473 $par->setNode($cont_node);
1489 if (is_object(
$node)) {
1490 $node->set_content($a_content);
1505 $this->contains_int_link = $a_contains_link;
1524 $this->import_mode = $a_val;
1538 if ($a_parse ===
true) {
1539 $this->needs_parsing =
true;
1541 if ($a_parse ===
false) {
1542 $this->needs_parsing =
false;
1554 $this->contains_question = $a_val;
1563 return $this->contains_question;
1577 $path =
"//MediaObject/MediaAlias";
1580 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1581 $id_arr = explode(
"_",
$res->nodeset[
$i]->get_attribute(
"OriginId"));
1582 $mob_id = $id_arr[count($id_arr) - 1];
1583 $mob_ids[$mob_id] = $mob_id;
1588 $path =
"//InteractiveImage/MediaAlias";
1590 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1591 $id_arr = explode(
"_",
$res->nodeset[
$i]->get_attribute(
"OriginId"));
1592 $mob_id = $id_arr[count($id_arr) - 1];
1593 $mob_ids[$mob_id] = $mob_id;
1598 $path =
"//IntLink[@Type = 'MediaObject']";
1601 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1602 if ((
$res->nodeset[
$i]->get_attribute(
"TargetFrame") ==
"") ||
1603 (!$a_inline_only)) {
1604 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
1605 $id_arr = explode(
"_", $target);
1607 (substr($target, 0, 4) ==
"il__")) {
1608 $mob_id = $id_arr[count($id_arr) - 1];
1610 $mob_ids[$mob_id] = $mob_id;
1628 $path =
"//IntLink";
1633 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1635 if ($a_cnt_multiple) {
1636 $add =
":" . $cnt_multiple;
1638 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
1640 $targetframe =
$res->nodeset[
$i]->get_attribute(
"TargetFrame");
1641 $anchor =
$res->nodeset[
$i]->get_attribute(
"Anchor");
1642 $links[$target .
":" .
$type .
":" . $targetframe .
":" . $anchor . $add] =
1643 array(
"Target" => $target,
1645 "TargetFrame" => $targetframe,
1650 if (
$type ==
"MediaObject" && $targetframe ==
"") {
1651 if (substr($target, 0, 4) ==
"il__") {
1652 $id_arr = explode(
"_", $target);
1653 $id = $id_arr[count($id_arr) - 1];
1656 foreach ($med_links as $key => $med_link) {
1657 $links[$key] = $med_link;
1668 $path =
"//MediaAlias";
1671 require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
1672 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1673 $oid =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1674 if (substr($oid, 0, 4) ==
"il__") {
1675 $id_arr = explode(
"_", $oid);
1676 $id = $id_arr[count($id_arr) - 1];
1679 foreach ($med_links as $key => $med_link) {
1680 $links[$key] = $med_link;
1700 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1701 foreach ($mob_ids as $mob_id => $dummy) {
1704 $mobs_xml .= $mob_obj->getXML(
IL_MODE_OUTPUT, $a_inst = 0,
true);
1718 $path =
"//MediaObject/MediaAlias[@OriginId='il__mob_$a_mob_id']";
1720 $mal_node =
$res->nodeset[$a_nr - 1];
1721 $mob_node = $mal_node->parent_node();
1723 return $this->dom->dump_node($mob_node);
1735 libxml_disable_entity_loader(
false);
1738 $this->dom->validate($error, $throw);
1758 $this->hier_ids = array();
1759 $this->first_row_ids = array();
1760 $this->first_col_ids = array();
1761 $this->list_item_ids = array();
1762 $this->file_item_ids = array();
1769 foreach ($this->id_elements as $el) {
1770 $path .= $sep .
"//" . $el;
1775 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1776 $cnode =
$res->nodeset[
$i];
1777 $ctag = $cnode->node_name();
1781 while ($cnode = $cnode->previous_sibling()) {
1782 if (($cnode->node_type() == XML_ELEMENT_NODE)
1783 && $cnode->has_attribute(
"HierId")) {
1784 $sib_hier_id = $cnode->get_attribute(
"HierId");
1790 if ($sib_hier_id !=
"") {
1791 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
1793 $res->nodeset[
$i]->set_attribute(
"HierId", $node_hier_id);
1794 $this->hier_ids[] = $node_hier_id;
1795 if ($ctag ==
"TableData") {
1796 if (substr($par_hier_id, strlen($par_hier_id) - 2) ==
"_1") {
1797 $this->first_row_ids[] = $node_hier_id;
1800 if ($ctag ==
"ListItem") {
1801 $this->list_item_ids[] = $node_hier_id;
1803 if ($ctag ==
"FileItem") {
1804 $this->file_item_ids[] = $node_hier_id;
1808 $cnode =
$res->nodeset[
$i];
1810 while ($cnode = $cnode->parent_node()) {
1811 if (($cnode->node_type() == XML_ELEMENT_NODE)
1812 && $cnode->has_attribute(
"HierId")) {
1813 $par_hier_id = $cnode->get_attribute(
"HierId");
1819 if (($par_hier_id !=
"") && ($par_hier_id !=
"pg")) {
1820 $node_hier_id = $par_hier_id .
"_1";
1821 $res->nodeset[
$i]->set_attribute(
"HierId", $node_hier_id);
1822 $this->hier_ids[] = $node_hier_id;
1823 if ($ctag ==
"TableData") {
1824 $this->first_col_ids[] = $node_hier_id;
1825 if (substr($par_hier_id, strlen($par_hier_id) - 2) ==
"_1") {
1826 $this->first_row_ids[] = $node_hier_id;
1829 if ($ctag ==
"ListItem") {
1830 $this->list_item_ids[] = $node_hier_id;
1832 if ($ctag ==
"FileItem") {
1833 $this->file_item_ids[] = $node_hier_id;
1836 $node_hier_id =
"1";
1837 $res->nodeset[
$i]->set_attribute(
"HierId", $node_hier_id);
1838 $this->hier_ids[] = $node_hier_id;
1845 $path =
"//PageObject";
1847 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1848 $res->nodeset[
$i]->set_attribute(
"HierId",
"pg");
1849 $this->hier_ids[] =
"pg";
1859 return $this->hier_ids;
1868 return $this->first_row_ids;
1877 return $this->first_col_ids;
1886 return $this->list_item_ids;
1895 return $this->file_item_ids;
1903 if (is_object($this->dom)) {
1905 $path =
"//*[@HierId]";
1907 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1908 if (
$res->nodeset[
$i]->has_attribute(
"HierId")) {
1909 $res->nodeset[
$i]->remove_attribute(
"HierId");
1921 if (!is_array($a_pc_ids) || count($a_pc_ids) == 0) {
1926 if (is_object($this->dom)) {
1928 $path =
"//*[@PCID]";
1930 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1931 $pc_id =
$res->nodeset[
$i]->get_attribute(
"PCID");
1932 if (in_array($pc_id, $a_pc_ids)) {
1933 $ret[$pc_id] =
$res->nodeset[
$i]->get_attribute(
"HierId");
1945 return $hier_ids[$pcid];
1953 if (!is_array($hier_ids) || count($hier_ids) == 0) {
1958 if (is_object($this->dom)) {
1960 $path =
"//*[@HierId]";
1962 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1963 $hier_id =
$res->nodeset[
$i]->get_attribute(
"HierId");
1964 if (in_array($hier_id, $hier_ids)) {
1965 $ret[$hier_id] =
$res->nodeset[
$i]->get_attribute(
"PCID");
1976 return $hier_ids[$hier_id];
1986 $path =
"//FileItem";
1988 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1989 $cnode =
$res->nodeset[
$i];
1990 $size_node = $this->dom->create_element(
"Size");
1991 $size_node = $cnode->append_child($size_node);
1993 $childs = $cnode->child_nodes();
1995 for ($j = 0; $j < count($childs); $j++) {
1996 if ($childs[$j]->node_name() ==
"Identifier") {
1997 if ($childs[$j]->has_attribute(
"Entry")) {
1998 $entry = $childs[$j]->get_attribute(
"Entry");
1999 $entry_arr = explode(
"_", $entry);
2000 $id = $entry_arr[count($entry_arr) - 1];
2001 require_once(
"./Modules/File/classes/class.ilObjFile.php");
2006 $size_node->set_content(
$size);
2021 $this->log->debug(
"start");
2025 $path =
"//IntLink";
2027 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2028 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
2031 if ($a_link_map ==
null) {
2033 $this->log->debug(
"no map, type: " .
$type .
", target: " . $target .
", new target: " . $new_target);
2035 $nt = explode(
"_", $a_link_map[$target]);
2036 $new_target =
false;
2038 $new_target =
"il__" . $nt[2] .
"_" . $nt[3];
2040 $this->log->debug(
"map, type: " .
$type .
", target: " . $target .
", new target: " . $new_target);
2042 if ($new_target !==
false) {
2043 $res->nodeset[
$i]->set_attribute(
"Target", $new_target);
2050 $res->nodeset[
$i]->set_attribute(
"Target", $new_target);
2060 $path =
"//MediaAlias";
2064 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2065 $orig_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
2066 $id_arr = explode(
"_", $orig_id);
2067 $mob_id = $id_arr[count($id_arr) - 1];
2083 $path =
"//MediaAlias";
2086 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2088 $old_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
2089 $old_id = explode(
"_", $old_id);
2090 $old_id = $old_id[count($old_id) - 1];
2094 if ($a_mapping[$old_id] > 0) {
2095 $new_id = $a_mapping[$old_id];
2096 if ($a_reuse_existing_by_import) {
2099 $imp = explode(
"_", $import_id);
2107 if ($import_id ==
"" && $a_reuse_existing_by_import) {
2110 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2117 if (in_array($old_id, $med_of_def_lang)) {
2121 if ($new_id !=
"") {
2122 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $new_id);
2140 $path =
"//InteractiveImage/MediaAlias";
2143 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2144 $old_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
2145 if ($a_mapping[$old_id] > 0) {
2146 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $a_mapping[$old_id]);
2165 $path =
"//FileItem/Identifier";
2168 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2169 $old_id =
$res->nodeset[
$i]->get_attribute(
"Entry");
2170 $old_id = explode(
"_", $old_id);
2171 $old_id = $old_id[count($old_id) - 1];
2172 if ($a_mapping[$old_id] > 0) {
2173 $res->nodeset[
$i]->set_attribute(
"Entry",
"il__file_" . $a_mapping[$old_id]);
2191 $path =
"//Question";
2194 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2195 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
2197 if (isset($a_mapping[$qref])) {
2198 $res->nodeset[
$i]->set_attribute(
"QRef",
"il__qst_" . $a_mapping[$qref][
"pool"]);
2221 $path =
"//IntLink";
2223 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2224 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
2227 if ($a_from_to[$obj_id] > 0 && is_int(strpos($target,
"__"))) {
2229 $res->nodeset[
$i]->set_attribute(
"Target",
"il__pg_" . $a_from_to[$obj_id]);
2233 $res->nodeset[
$i]->set_attribute(
"Target",
"il__st_" . $a_from_to[$obj_id]);
2236 if (
$type ==
"PortfolioPage") {
2237 $res->nodeset[
$i]->set_attribute(
"Target",
"il__ppage_" . $a_from_to[$obj_id]);
2240 if (
$type ==
"WikiPage") {
2241 $res->nodeset[
$i]->set_attribute(
"Target",
"il__wpage_" . $a_from_to[$obj_id]);
2251 $path =
"//MediaAlias";
2254 require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
2255 require_once(
"Services/COPage/classes/class.ilMediaAliasItem.php");
2257 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2258 $media_object_node =
$res->nodeset[
$i]->parent_node();
2259 $page_content_node = $media_object_node->parent_node();
2260 $c_hier_id = $page_content_node->get_attribute(
"HierId");
2268 $areas = $std_alias_item->getMapAreas();
2269 $correction_needed =
false;
2270 if (count($areas) > 0) {
2272 foreach ($areas as $area) {
2273 if ($area[
"Type"] ==
"PageObject" ||
2274 $area[
"Type"] ==
"StructureObject") {
2275 $t = $area[
"Target"];
2276 $tid = _extractObjIdOfTarget($t);
2277 if ($a_from_to[$tid] > 0) {
2278 $correction_needed =
true;
2287 $oid =
$res->nodeset[
$i]->get_attribute(
"OriginId");
2288 if (substr($oid, 0, 4) ==
"il__") {
2289 $id_arr = explode(
"_", $oid);
2290 $id = $id_arr[count($id_arr) - 1];
2293 $med_item = $mob->getMediaItem(
"Standard");
2294 $med_areas = $med_item->getMapAreas();
2296 foreach ($med_areas as $area) {
2297 $link_type = ($area->getLinkType() ==
"int")
2302 "Nr" => $area->getNr(),
2303 "Shape" => $area->getShape(),
2304 "Coords" => $area->getCoords(),
2306 "LinkType" => $link_type,
2307 "Href" => $area->getHref(),
2308 "Title" => $area->getTitle(),
2309 "Target" => $area->getTarget(),
2310 "Type" => $area->getType(),
2311 "TargetFrame" => $area->getTargetFrame()
2315 if ($area->getType() ==
"PageObject" ||
2316 $area->getType() ==
"StructureObject") {
2317 $t = $area->getTarget();
2319 if ($a_from_to[$tid] > 0) {
2320 $correction_needed =
true;
2329 if ($correction_needed) {
2331 $std_alias_item->deleteAllMapAreas();
2332 foreach ($areas as $area) {
2333 if ($area[
"Link"][
"LinkType"] ==
"IntLink") {
2334 $target = $area[
"Link"][
"Target"];
2335 $type = $area[
"Link"][
"Type"];
2337 if ($a_from_to[$obj_id] > 0) {
2339 $area[
"Link"][
"Target"] =
"il__pg_" . $a_from_to[$obj_id];
2342 $area[
"Link"][
"Target"] =
"il__st_" . $a_from_to[$obj_id];
2347 $std_alias_item->addMapArea(
2350 $area[
"Link"][
"Title"],
2351 array(
"Type" => $area[
"Link"][
"Type"],
2352 "TargetFrame" => $area[
"Link"][
"TargetFrame"],
2353 "Target" => $area[
"Link"][
"Target"],
2354 "Href" => $area[
"Link"][
"Href"],
2355 "LinkType" => $area[
"Link"][
"LinkType"],
2373 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
2382 foreach ($sources as
$source) {
2384 if (
$source[
"type"] ==
"lm:pg") {
2386 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
2389 if (!$page_obj->page_not_found) {
2391 $page_obj->handleImportRepositoryLink(
2397 $page_obj->update();
2410 $path =
"//IntLink";
2413 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2415 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
2417 if ($target == $a_rep_import_id &&
$type ==
"RepositoryItem") {
2419 $res->nodeset[
$i]->set_attribute(
2421 "il__" . $a_rep_type .
"_" . $a_rep_ref_id
2439 $this->log->debug(
"Handle repository links...");
2443 $path =
"//IntLink";
2445 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2446 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
2448 $this->log->debug(
"Target: " . $target);
2449 $t = explode(
"_", $target);
2450 if (
$type ==
"RepositoryItem" && ((
int) $t[1] == 0 || (
int) $t[1] ==
IL_INST_ID)) {
2451 if (isset($a_mapping[$t[3]])) {
2453 $this->log->debug(
"... replace " . $t[3] .
" with " . $a_mapping[$t[3]] .
".");
2454 $res->nodeset[
$i]->set_attribute(
2456 "il__obj_" . $a_mapping[$t[3]]
2458 } elseif ($this->tree->isGrandChild($a_source_ref_id, $t[3])) {
2460 $this->log->debug(
"... remove links.");
2461 if (
$res->nodeset[
$i]->parent_node()->node_name() ==
"MapArea") {
2462 $parent =
$res->nodeset[
$i]->parent_node();
2463 $parent->unlink_node($parent);
2465 $source_node =
$res->nodeset[
$i];
2466 $new_node = $source_node->clone_node(
true);
2467 $new_node->unlink_node($new_node);
2468 $childs = $new_node->child_nodes();
2469 for ($j = 0; $j < count($childs); $j++) {
2470 $this->log->debug(
"... move node $j " . $childs[$j]->node_name() .
" before " . $source_node->node_name());
2471 $source_node->insert_before($childs[$j], $source_node);
2473 $source_node->unlink_node($source_node);
2481 $ilias_url = parse_url(ILIAS_HTTP_PATH);
2483 $path =
"//ExtLink";
2485 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2486 $href =
$res->nodeset[
$i]->get_attribute(
"Href");
2487 $this->log->debug(
"Href: " . $href);
2489 $url = parse_url($href);
2492 $this->log->debug(
"Host: " .
$url[
"host"]);
2493 if (
$url[
"host"] !=
"" &&
$url[
"host"] != $ilias_url[
"host"]) {
2499 if (substr($href, strlen($href) - 5) ===
".html") {
2503 substr(
$url[
"path"], 0, strlen(
$url[
"path"]) - 5)
2506 if (array_shift($parts) !==
"goto") {
2509 $par[
"client_id"] = array_shift($parts);
2510 $par[
"target"] = implode(
"_", $parts);
2512 foreach (explode(
"&",
$url[
"query"]) as $p) {
2513 $p = explode(
"=", $p);
2514 $par[$p[0]] = $p[1];
2518 $target_client_id = $par[
"client_id"];
2519 if ($target_client_id !=
"" && $target_client_id !=
CLIENT_ID) {
2525 if (is_int(strpos($href,
"ilias.php"))) {
2526 $ref_id = (int) $par[
"ref_id"];
2527 } elseif ($par[
"target"] !==
"") {
2528 $t = explode(
"_", $par[
"target"]);
2529 if ($objDefinition->isRBACObject($t[0])) {
2530 $ref_id = (int) $t[1];
2535 if (isset($a_mapping[$ref_id])) {
2536 $new_ref_id = $a_mapping[$ref_id];
2538 if (is_int(strpos($href,
"ilias.php"))) {
2539 $new_href = str_replace(
"ref_id=" . $par[
"ref_id"],
"ref_id=" . $new_ref_id, $href);
2541 $nt = str_replace(
$type .
"_" . $ref_id,
$type .
"_" . $new_ref_id, $par[
"target"]);
2542 $new_href = str_replace($par[
"target"], $nt, $href);
2544 if ($new_href !=
"") {
2545 $this->log->debug(
"... ext link replace " . $href .
" with " . $new_href .
".");
2546 $res->nodeset[
$i]->set_attribute(
"Href", $new_href);
2548 } elseif (
$tree->isGrandChild($a_source_ref_id, $ref_id)) {
2550 $this->log->debug(
"... remove ext links.");
2551 if (
$res->nodeset[
$i]->parent_node()->node_name() ==
"MapArea") {
2552 $parent =
$res->nodeset[
$i]->parent_node();
2553 $parent->unlink_node($parent);
2555 $source_node =
$res->nodeset[
$i];
2556 $new_node = $source_node->clone_node(
true);
2557 $new_node->unlink_node($new_node);
2558 $childs = $new_node->child_nodes();
2559 for ($j = 0; $j < count($childs); $j++) {
2560 $this->log->debug(
"... move node $j " . $childs[$j]->node_name() .
" before " . $source_node->node_name());
2561 $source_node->insert_before($childs[$j], $source_node);
2563 $source_node->unlink_node($source_node);
2592 $this->db->insert(
"page_object", array(
2593 "page_id" => array(
"integer", $this->
getId()),
2594 "parent_id" => array(
"integer", $this->
getParentId()),
2596 "content" => array(
"clob", $content),
2598 "create_user" => array(
"integer", $this->
user->getId()),
2599 "last_change_user" => array(
"integer", $this->
user->getId()),
2600 "active" => array(
"integer", (
int) $this->
getActive()),
2604 "inactive_elements" => array(
"integer", $iel),
2605 "int_links" => array(
"integer", $inl),
2607 "last_change" => array(
"timestamp",
ilUtil::now()),
2608 "is_empty" => array(
"integer", $empty)
2624 $this->log->debug(
"ilPageObject, updateFromXML(): start, id: " . $this->
getId());
2628 $this->log->debug(
"ilPageObject, updateFromXML(): content: " . substr($content, 0, 100));
2637 $this->db->update(
"page_object", array(
2638 "content" => array(
"clob", $content),
2639 "parent_id" => array(
"integer", $this->
getParentId()),
2640 "last_change_user" => array(
"integer", $this->
user->getId()),
2641 "last_change" => array(
"timestamp",
ilUtil::now()),
2642 "active" => array(
"integer", $this->
getActive()),
2645 "inactive_elements" => array(
"integer", $iel),
2646 "int_links" => array(
"integer", $inl),
2648 "page_id" => array(
"integer", $this->
getId()),
2656 $this->log->debug(
"ilPageObject, updateFromXML(): end");
2666 final protected function __afterUpdate($a_domdoc, $a_xml, $a_creation =
false, $a_empty =
false)
2669 if (!$a_creation || !$a_empty) {
2679 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
2681 foreach ($defs as $def) {
2683 $cl = $def[
"pc_class"];
2684 call_user_func($def[
"pc_class"] .
'::afterPageUpdate', $this, $a_domdoc, $a_xml, $a_creation);
2707 public function update($a_validate =
true, $a_no_history =
false)
2709 $this->log->debug(
"start..., id: " . $this->
getId());
2724 include_once(
"./Services/User/classes/class.ilUserUtil.php");
2727 1 => $this->lng->txt(
"cont_not_saved_edit_lock_expired") .
"<br />" .
2728 $this->lng->txt(
"obj_usr") .
": " .
2730 $this->lng->txt(
"content_until") .
": " .
2736 $this->log->debug(
"checking duplicate ids");
2738 $errors[0] = $this->lng->txt(
"cont_could_not_save_duplicate_pc_ids") .
2743 $this->log->debug(
"ilPageObject, update(): errors: " . print_r(
$errors,
true));
2751 $this->log->debug(
"perform automatic modifications");
2761 $old_set = $this->db->query(
"SELECT * FROM page_object WHERE " .
2762 "page_id = " . $this->db->quote($this->getId(),
"integer") .
" AND " .
2763 "parent_type = " . $this->db->quote($this->getParentType(),
"text") .
" AND " .
2764 "lang = " . $this->db->quote($this->getLanguage(),
"text"));
2765 $last_nr_set = $this->db->query(
"SELECT max(nr) as mnr FROM page_history WHERE " .
2766 "page_id = " . $this->db->quote($this->getId(),
"integer") .
" AND " .
2767 "parent_type = " . $this->db->quote($this->getParentType(),
"text") .
" AND " .
2768 "lang = " . $this->db->quote($this->getLanguage(),
"text"));
2769 $last_nr = $this->db->fetchAssoc($last_nr_set);
2770 if ($old_rec = $this->db->fetchAssoc($old_set)) {
2773 if (($content != $old_rec[
"content"] || $this->
user->getId() != $old_rec[
"last_change_user"]) &&
2774 !$a_no_history && !$this->history_saved &&
$lm_set->get(
"page_history", 1)) {
2775 if ($old_rec[
"content"] !=
"<PageObject></PageObject>") {
2776 $this->db->manipulateF(
2777 "DELETE FROM page_history WHERE " .
2778 "page_id = %s AND parent_type = %s AND hdate = %s AND lang = %s",
2779 array(
"integer",
"text",
"timestamp",
"text"),
2780 array($old_rec[
"page_id"],
2781 $old_rec[
"parent_type"],
2782 $old_rec[
"last_change"],
2789 $last_c = $old_rec[
"last_change"];
2790 if ($last_c ==
"") {
2794 $this->db->insert(
"page_history", array(
2795 "page_id" => array(
"integer", $old_rec[
"page_id"]),
2796 "parent_type" => array(
"text", $old_rec[
"parent_type"]),
2797 "lang" => array(
"text", $old_rec[
"lang"]),
2798 "hdate" => array(
"timestamp", $last_c),
2799 "parent_id" => array(
"integer", $old_rec[
"parent_id"]),
2800 "content" => array(
"clob", $old_rec[
"content"]),
2801 "user_id" => array(
"integer", $old_rec[
"last_change_user"]),
2803 "nr" => array(
"integer", (
int) $last_nr[
"mnr"] + 1)
2806 $old_content = $old_rec[
"content"];
2807 $old_domdoc =
new DOMDocument();
2808 $old_nr = $last_nr[
"mnr"] + 1;
2809 $old_domdoc->loadXML(
'<?xml version="1.0" encoding="UTF-8"?>' . $old_content);
2812 $this->log->debug(
"calling __afterHistoryEntry");
2815 $this->history_saved =
true;
2817 $this->history_saved =
true;
2822 $em = (trim($content) ==
"<PageObject/>")
2827 $this->log->debug(
"checking deactivated elements");
2829 $this->log->debug(
"checking internal links");
2832 $this->db->update(
"page_object", array(
2833 "content" => array(
"clob", $content),
2834 "parent_id" => array(
"integer", $this->
getParentId()),
2835 "last_change_user" => array(
"integer", $this->
user->getId()),
2836 "last_change" => array(
"timestamp",
ilUtil::now()),
2837 "is_empty" => array(
"integer", $em),
2838 "active" => array(
"integer", $this->
getActive()),
2842 "inactive_elements" => array(
"integer", $iel),
2843 "int_links" => array(
"integer", $inl),
2845 "page_id" => array(
"integer", $this->
getId()),
2851 $this->log->debug(
"calling __afterUpdate()");
2855 "...ending, updated and returning true, content: " . substr(
2872 public function delete()
2875 $copg_logger->debug(
2876 "ilPageObject: Delete called for ID '" . $this->
getId() .
"'," .
2878 " hist nr: '" . $this->old_nr .
"', " .
2885 if (!$this->page_not_found) {
2889 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2891 foreach ($mobs2 as $m) {
2892 if (!in_array($m,
$mobs)) {
2897 $copg_logger->debug(
"ilPageObject: ... found " . count(
$mobs) .
" media objects.");
2902 $this->handleDeleteContent();
2914 include_once(
"./Services/News/classes/class.ilNewsItem.php");
2923 $this->db->manipulate(
"DELETE FROM page_object " .
2924 "WHERE page_id = " . $this->db->quote($this->getId(),
"integer") .
2925 " AND parent_type= " . $this->db->quote($this->getParentType(),
"text"));
2928 foreach (
$mobs as $mob_id) {
2929 $copg_logger->debug(
"ilPageObject: ... processing mob " . $mob_id .
".");
2932 $copg_logger->debug(
"ilPageObject: ... type mismatch. Ignoring mob " . $mob_id .
".");
2937 $copg_logger->debug(
"ilPageObject: ... delete mob " . $mob_id .
".");
2942 $copg_logger->debug(
"ilPageObject: ... missing mob " . $mob_id .
".");
2954 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
2956 foreach ($defs as $def) {
2958 $cl = $def[
"pc_class"];
2959 call_user_func($def[
"pc_class"] .
'::beforePageDelete', $this);
2973 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
2975 foreach ($defs as $def) {
2977 $cl = $def[
"pc_class"];
2979 $def[
"pc_class"] .
'::afterPageHistoryEntry',
2995 $xpath =
new DOMXPath($a_domdoc);
2996 $path =
"//Paragraph | //Section | //MediaAlias | //FileItem" .
2997 " | //Table | //TableData | //Tabs | //List";
2998 $nodes = $xpath->query($path);
3000 foreach ($nodes as
$node) {
3001 switch (
$node->localName) {
3003 $sname =
$node->getAttribute(
"Characteristic");
3004 $stype =
"text_block";
3009 $sname =
$node->getAttribute(
"Characteristic");
3015 $sname =
$node->getAttribute(
"Class");
3016 $stype =
"media_cont";
3021 $sname =
$node->getAttribute(
"Class");
3022 $stype =
"flist_li";
3027 $sname =
$node->getAttribute(
"Template");
3029 $sname =
$node->getAttribute(
"Class");
3039 $sname =
$node->getAttribute(
"Class");
3040 $stype =
"table_cell";
3045 $sname =
$node->getAttribute(
"Template");
3047 if (
$node->getAttribute(
"Type") ==
"HorizontalAccordion") {
3048 $stype =
"haccordion";
3050 if (
$node->getAttribute(
"Type") ==
"VerticalAccordion") {
3051 $stype =
"vaccordion";
3058 $sname =
$node->getAttribute(
"Class");
3059 if (
$node->getAttribute(
"Type") ==
"Ordered") {
3067 if ($sname !=
"" && $stype !=
"") {
3068 $usages[$sname .
":" . $stype .
":" . $template] = array(
"sname" => $sname,
3070 "template" => $template
3077 foreach ($usages as $u) {
3078 $id = $this->db->nextId(
'page_style_usage');
3080 $this->db->manipulate(
"INSERT INTO page_style_usage " .
3081 "(id, page_id, page_type, page_lang, page_nr, template, stype, sname) VALUES (" .
3082 $this->db->quote(
$id,
"integer") .
"," .
3083 $this->db->quote($this->getId(),
"integer") .
"," .
3084 $this->db->quote($this->getParentType(),
"text") .
"," .
3085 $this->db->quote($this->getLanguage(),
"text") .
"," .
3086 $this->db->quote($a_old_nr,
"integer") .
"," .
3087 $this->db->quote($u[
"template"],
"integer") .
"," .
3088 $this->db->quote($u[
"stype"],
"text") .
"," .
3089 $this->db->quote($u[
"sname"],
"text") .
3101 if ($a_old_nr !==
false) {
3102 $and_old_nr =
" AND page_nr = " . $this->db->quote($a_old_nr,
"integer");
3105 $this->db->manipulate(
3106 "DELETE FROM page_style_usage WHERE " .
3107 " page_id = " . $this->db->quote($this->getId(),
"integer") .
3108 " AND page_type = " . $this->db->quote($this->getParentType(),
"text") .
3109 " AND page_lang = " . $this->db->quote($this->getLanguage(),
"text") .
3122 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
3123 include_once(
"./Modules/File/classes/class.ilObjFile.php");
3128 $files = ilObjFile::_getFilesOfObject(
3132 $objs = array_merge(
$mobs, $files);
3143 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
3162 $xpath =
new DOMXPath($a_domdoc);
3163 $nodes = $xpath->query(
'//IntLink');
3164 foreach ($nodes as
$node) {
3165 $link_type =
$node->getAttribute(
"Type");
3167 switch ($link_type) {
3168 case "StructureObject":
3176 case "GlossaryItem":
3184 case "RepositoryItem":
3196 case "PortfolioPage":
3205 $target =
$node->getAttribute(
"Target");
3210 if (is_int(strpos($target,
"__"))) {
3246 $this->handleDeleteContent($curr_node);
3247 $curr_node->unlink_node($curr_node);
3261 if (!is_array($a_hids)) {
3264 foreach ($a_hids as $a_hid) {
3265 $a_hid = explode(
":", $a_hid);
3270 if (!$this->
checkForTag(
"Question", $a_hid[0], $a_hid[1]) || $a_self_ass) {
3272 if (is_object($curr_node)) {
3273 $parent_node = $curr_node->parent_node();
3274 if ($parent_node->node_name() !=
"TableRow") {
3275 $this->handleDeleteContent($curr_node);
3276 $curr_node->unlink_node($curr_node);
3305 if (!is_array($a_hids)) {
3309 $time = date(
"Y-m-d H:i:s", time());
3311 $hier_ids = array();
3313 foreach ($a_hids as $a_hid) {
3317 $a_hid = explode(
":", $a_hid);
3321 foreach ($hier_ids as $h) {
3322 if ($h .
"_" == substr($a_hid[0], 0, strlen($h) + 1)) {
3323 $skip[] = $a_hid[0];
3325 if ($a_hid[0] .
"_" == substr($h, 0, strlen($a_hid[0]) + 1)) {
3329 $pc_id[$a_hid[0]] = $a_hid[1];
3330 if ($a_hid[0] !=
"") {
3331 $hier_ids[$a_hid[0]] = $a_hid[0];
3334 foreach ($skip as $s) {
3335 unset($hier_ids[$s]);
3337 include_once(
"./Services/COPage/classes/class.ilPageContent.php");
3340 foreach ($hier_ids as $hid) {
3342 if (is_object($curr_node)) {
3343 if ($curr_node->node_name() ==
"PageContent") {
3344 $content = $this->dom->dump_node($curr_node);
3346 $content = preg_replace(
'/PCID=\"[a-z0-9]*\"/i',
"", $content);
3347 $content = preg_replace(
'/HierId=\"[a-z0-9_]*\"/i',
"", $content);
3349 $user->addToPCClipboard($content, $time, $nr);
3354 include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
3365 $a_hid = explode(
":", $a_hier_id);
3366 $content =
$user->getPCClipboardContent();
3370 for (
$i = count($content) - 1;
$i >= 0;
$i--) {
3373 '<?xml version="1.0" encoding="UTF-8"?>' .
$c,
3377 if (empty($error)) {
3380 $path =
"//PageContent";
3382 if (count(
$res->nodeset) > 0) {
3383 $new_pc_node =
$res->nodeset[0];
3384 $cloned_pc_node = $new_pc_node->clone_node(
true);
3385 $cloned_pc_node->unlink_node($cloned_pc_node);
3405 if (!is_array($a_hids)) {
3409 foreach ($a_hids as $a_hid) {
3410 $a_hid = explode(
":", $a_hid);
3412 if (is_object($curr_node)) {
3413 if ($curr_node->node_name() ==
"PageContent") {
3415 if ($cont_obj->isEnabled()) {
3417 if (!$this->
checkForTag(
"Question", $a_hid[0], $a_hid[1]) || $a_self_ass) {
3418 $cont_obj->disable();
3421 $cont_obj->enable();
3444 foreach ($hier_ids as $hier_id) {
3446 if (!is_int(strpos($hier_id,
"_"))) {
3447 if ($hier_id !=
"pg" && $hier_id >= $a_hid) {
3449 $this->handleDeleteContent($curr_node);
3450 $curr_node->unlink_node($curr_node);
3470 foreach ($hier_ids as $hier_id) {
3472 if (!is_int(strpos($hier_id,
"_"))) {
3473 if ($hier_id !=
"pg" && $hier_id < $a_hid) {
3475 $this->handleDeleteContent($curr_node);
3476 $curr_node->unlink_node($curr_node);
3493 $hier_ids = $a_source_page->getHierIds();
3495 $copy_ids = array();
3498 foreach ($hier_ids as $hier_id) {
3500 if (!is_int(strpos($hier_id,
"_"))) {
3501 if ($hier_id !=
"pg" && $hier_id >= $a_hid) {
3502 $copy_ids[] = $hier_id;
3508 $parent_node = $a_target_page->getContentNode(
"pg");
3509 $target_dom = $a_target_page->getDom();
3510 $parent_childs = $parent_node->child_nodes();
3511 $cnt_parent_childs = count($parent_childs);
3513 $first_child = $parent_childs[0];
3514 foreach ($copy_ids as $copy_id) {
3515 $source_node = $a_source_page->getContentNode($copy_id);
3517 $new_node = $source_node->clone_node(
true);
3518 $new_node->unlink_node($new_node);
3520 $source_node->unlink_node($source_node);
3522 if ($cnt_parent_childs == 0) {
3523 $new_node = $parent_node->append_child($new_node);
3526 $new_node = $first_child->insert_before($new_node, $first_child);
3528 $parent_childs = $parent_node->child_nodes();
3533 $a_target_page->update();
3534 $a_source_page->update();
3542 if ($a_pcid ==
"" && $a_pos ==
"") {
3547 $curr_name = $curr_node->node_name();
3550 if (($curr_name ==
"TableData") || ($curr_name ==
"PageObject") ||
3551 ($curr_name ==
"ListItem") || ($curr_name ==
"Section")
3552 || ($curr_name ==
"Tab") || ($curr_name ==
"ContentPopup")
3553 || ($curr_name ==
"GridCell")) {
3557 $hid = $curr_node->get_attribute(
"HierId");
3565 $pos = explode(
"_", $a_pos);
3566 $target_pos = array_pop($pos);
3567 $parent_pos = implode(
"_", $pos);
3570 $parent_pos = $a_pos;
3574 if ($parent_pos !=
"") {
3577 $parent_node = $this->
getNode();
3581 $parent_childs = $parent_node->child_nodes();
3582 $cnt_parent_childs = count($parent_childs);
3587 $new_node = $a_cont_obj->getNode();
3591 if ($succ_node = $curr_node->next_sibling()) {
3592 $new_node = $succ_node->insert_before($new_node, $succ_node);
3595 $new_node = $parent_node->append_child($new_node);
3597 $a_cont_obj->setNode($new_node);
3602 $new_node = $a_cont_obj->getNode();
3604 $new_node = $succ_node->insert_before($new_node, $succ_node);
3605 $a_cont_obj->setNode($new_node);
3611 $new_node = $a_cont_obj->getNode();
3612 if ($cnt_parent_childs == 0) {
3613 $new_node = $parent_node->append_child($new_node);
3615 $new_node = $parent_childs[0]->insert_before($new_node, $parent_childs[0]);
3617 $a_cont_obj->setNode($new_node);
3623 if ($remove_placeholder && !$this->
getPageConfig()->getEnablePCType(
"PlaceHolder")) {
3624 $sub_nodes = $curr_node->child_nodes();
3625 foreach ($sub_nodes as $sub_node) {
3626 if ($sub_node->node_name() ==
"PlaceHolder") {
3627 $curr_node->unlink_node();
3640 $curr_name = $curr_node->node_name();
3642 if (($curr_name ==
"TableData") || ($curr_name ==
"PageObject") ||
3643 ($curr_name ==
"ListItem") || ($curr_name ==
"Section")
3644 || ($curr_name ==
"Tab") || ($curr_name ==
"ContentPopup")
3645 || ($curr_name ==
"GridCell")) {
3649 $hid = $curr_node->get_attribute(
"HierId");
3656 $pos = explode(
"_", $a_pos);
3657 $target_pos = array_pop($pos);
3658 $parent_pos = implode(
"_", $pos);
3661 $parent_pos = $a_pos;
3665 if ($parent_pos !=
"") {
3668 $parent_node = $this->
getNode();
3672 $parent_childs = $parent_node->child_nodes();
3673 $cnt_parent_childs = count($parent_childs);
3678 if ($succ_node = $curr_node->next_sibling()) {
3679 $a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
3681 $a_cont_node = $parent_node->append_child($a_cont_node);
3689 $a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
3696 if ($cnt_parent_childs == 0) {
3697 $a_cont_node = $parent_node->append_child($a_cont_node);
3699 $a_cont_node = $parent_childs[0]->insert_before($a_cont_node, $parent_childs[0]);
3712 if ($a_source == $a_target) {
3718 $source_node = $content->getNode();
3719 $clone_node = $source_node->clone_node(
true);
3725 $content->setNode($clone_node);
3736 if ($a_source == $a_target) {
3742 $source_node = $content->getNode();
3743 $clone_node = $source_node->clone_node(
true);
3749 $content->setNode($clone_node);
3760 $a_content = preg_replace(
'/\[com\]/i',
"<Comment>", $a_content);
3761 $a_content = preg_replace(
'/\[\/com\]/i',
"</Comment>", $a_content);
3762 $a_content = preg_replace(
'/\[emp]/i',
"<Emph>", $a_content);
3763 $a_content = preg_replace(
'/\[\/emp\]/i',
"</Emph>", $a_content);
3764 $a_content = preg_replace(
'/\[str]/i',
"<Strong>", $a_content);
3765 $a_content = preg_replace(
'/\[\/str\]/i',
"</Strong>", $a_content);
3776 $path =
"//IntLink";
3778 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3779 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
3782 if (substr($target, 0, 4) ==
"il__") {
3783 $id = substr($target, 4, strlen($target) - 4);
3787 if ($a_res_ref_to_obj_id &&
$type ==
"RepositoryItem") {
3788 $id_arr = explode(
"_",
$id);
3791 $ref_id = $id_arr[1];
3802 $id = $otype .
"_" . $obj_id .
"_" . $ref_id;
3806 $new_target =
"il_" . $a_inst .
"_" .
$id;
3807 $res->nodeset[
$i]->set_attribute(
"Target", $new_target);
3816 $path =
"//MediaAlias";
3818 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3819 $origin_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
3820 if (substr($origin_id, 0, 4) ==
"il__") {
3821 $new_id =
"il_" . $a_inst .
"_" . substr($origin_id, 4, strlen($origin_id) - 4);
3822 $res->nodeset[
$i]->set_attribute(
"OriginId", $new_id);
3829 $path =
"//FileItem/Identifier";
3831 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3832 $origin_id =
$res->nodeset[
$i]->get_attribute(
"Entry");
3833 if (substr($origin_id, 0, 4) ==
"il__") {
3834 $new_id =
"il_" . $a_inst .
"_" . substr($origin_id, 4, strlen($origin_id) - 4);
3835 $res->nodeset[
$i]->set_attribute(
"Entry", $new_id);
3842 $path =
"//Question";
3844 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3845 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
3847 if (substr($qref, 0, 4) ==
"il__") {
3848 $new_id =
"il_" . $a_inst .
"_" . substr($qref, 4, strlen($qref) - 4);
3850 $res->nodeset[
$i]->set_attribute(
"QRef", $new_id);
3857 $path =
"//ContentInclude";
3859 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3860 $ci =
$res->nodeset[
$i]->get_attribute(
"InstId");
3862 $res->nodeset[
$i]->set_attribute(
"InstId", $a_inst);
3877 foreach ($this->id_elements as $el) {
3878 $path .= $sep .
"//" . $el .
"[not(@PCID)]";
3880 $path .= $sep .
"//" . $el .
"[@PCID='']";
3886 if (count(
$res->nodeset) > 0) {
3905 foreach ($this->id_elements as $el) {
3906 $path .= $sep .
"//" . $el .
"[@PCID]";
3914 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3916 $pcids[] =
$node->get_attribute(
"PCID");
3929 return count($duplicates) > 0;
3945 foreach ($this->id_elements as $el) {
3946 $path .= $sep .
"//" . $el .
"[@PCID]";
3954 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3956 $pc_id =
$node->get_attribute(
"PCID");
3958 if (isset($pcids[$pc_id])) {
3959 $duplicates[] = $pc_id;
3961 $pcids[$pc_id] = $pc_id;
3980 foreach ($this->id_elements as $el) {
3981 $path .= $sep .
"//" . $el .
"[@PCID='" . $a_pc_id .
"']";
3988 return (count(
$res->nodeset) > 0);
3998 if ($a_pc_ids ===
false) {
4001 $id = ilUtil::randomHash(10, $a_pc_ids);
4017 foreach ($this->id_elements as $el) {
4018 $path .= $sep .
"//" . $el .
"[not(@PCID)]";
4020 $path .= $sep .
"//" . $el .
"[@PCID='']";
4026 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
4028 $id = ilUtil::randomHash(10, $pcids);
4031 $res->nodeset[
$i]->set_attribute(
"PCID",
$id);
4041 $this->addHierIds();
4045 $path =
"//PageContent";
4050 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
4051 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
4052 $hier_id =
$res->nodeset[
$i]->get_attribute(
"HierId");
4053 $pc_id =
$res->nodeset[
$i]->get_attribute(
"PCID");
4054 $dump = $mydom->dump_node(
$res->nodeset[
$i]);
4055 if (($hpos = strpos($dump,
' HierId="' . $hier_id .
'"')) > 0) {
4056 $dump = substr($dump, 0, $hpos) .
4057 substr($dump, $hpos + strlen(
' HierId="' . $hier_id .
'"'));
4060 $childs =
$res->nodeset[
$i]->child_nodes();
4062 if ($childs[0] && $childs[0]->node_name() ==
"Paragraph") {
4063 $content = $mydom->dump_node($childs[0]);
4066 strpos($content,
">") + 1,
4067 strrpos($content,
"<") - (strpos($content,
">") + 1)
4076 array(
"hier_id" => $hier_id,
"hash" => md5($dump),
"content" => $content);
4092 $path =
"//Question";
4097 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
4098 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
4099 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
4104 if (!($inst_id > 0)) {
4121 $path =
"/descendant::Paragraph[position() = $par_id]";
4125 if (count(
$res->nodeset) != 1) {
4126 die(
"Should not happen");
4129 $context_node =
$res->nodeset[0];
4133 $childs = $context_node->child_nodes();
4135 for ($j = 0; $j < count($childs); $j++) {
4136 $content .= $mydom->dump_node($childs[$j]);
4139 $content = str_replace(
"<br />",
"\n", $content);
4140 $content = str_replace(
"<br/>",
"\n", $content);
4142 $plain_content = html_entity_decode($content);
4160 $xsl = file_get_contents(
"./Services/COPage/xsl/page_fo.xsl");
4161 $args = array(
'/_xml' =>
$xml,
'/_xsl' => $xsl);
4166 $fo = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl",
null, $args, $params);
4169 $fo = str_replace(
"\n",
"", $fo);
4170 $fo = str_replace(
"<br/>",
"<br>", $fo);
4171 $fo = str_replace(
"<br>",
"\n", $fo);
4176 $fo = substr($fo, strpos($fo,
">") + 1);
4183 $this->offline_handler = $handler;
4205 if ($a_lang ==
"") {
4209 $query =
"SELECT * FROM page_object WHERE page_id = " .
4210 $db->quote($a_id,
"integer") .
" AND " .
4211 " parent_type = " .
$db->quote($a_parent_type,
"text") .
" AND " .
4212 " lang = " .
$db->quote($a_lang,
"text") .
" AND " .
4213 " inactive_elements = " .
$db->quote(1,
"integer");
4230 if (strpos($a_content,
" Enabled=\"False\"")) {
4243 $h_query =
"SELECT * FROM page_history " .
4244 " WHERE page_id = " .
$db->quote($this->
getId(),
"integer") .
4247 " ORDER BY hdate DESC";
4249 $hset =
$db->query($h_query);
4250 $hentries = array();
4252 while ($hrec =
$db->fetchAssoc($hset)) {
4253 $hrec[
"sortkey"] = (int) $hrec[
"nr"];
4254 $hrec[
"user"] = (int) $hrec[
"user_id"];
4255 $hentries[] = $hrec;
4269 "SELECT * FROM page_history " .
4270 " WHERE page_id = %s " .
4271 " AND parent_type = %s " .
4274 array(
"integer",
"text",
"integer",
"text"),
4277 if ($hrec =
$db->fetchAssoc(
$res)) {
4294 $and_nr = ($a_nr > 0)
4295 ?
" AND nr < " .
$db->quote((
int) $a_nr,
"integer")
4297 $res =
$db->query(
"SELECT MAX(nr) mnr FROM page_history " .
4298 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4303 if ($row[
"mnr"] > 0) {
4304 $res =
$db->query(
"SELECT * FROM page_history " .
4305 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4308 " AND nr = " .
$db->quote((
int) $row[
"mnr"],
"integer"));
4310 $ret[
"previous"] = $row;
4314 $res =
$db->query(
"SELECT MIN(nr) mnr FROM page_history " .
4315 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4318 " AND nr > " .
$db->quote((
int) $a_nr,
"integer"));
4320 if ($row[
"mnr"] > 0) {
4321 $res =
$db->query(
"SELECT * FROM page_history " .
4322 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4325 " AND nr = " .
$db->quote((
int) $row[
"mnr"],
"integer"));
4327 $ret[
"next"] = $row;
4332 $res =
$db->query(
"SELECT * FROM page_history " .
4333 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4336 " AND nr = " .
$db->quote((
int) $a_nr,
"integer"));
4339 $res =
$db->query(
"SELECT page_id, last_change hdate, parent_type, parent_id, last_change_user user_id, content, lang FROM page_object " .
4340 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4345 $ret[
"current"] = $row;
4355 $rnode =
$res->nodeset[0];
4358 foreach ($a_hashes as $pc_id => $h) {
4360 if ($h[
"change"] !=
"") {
4361 $dc_node = $this->dom->create_element(
"DivClass");
4362 $dc_node->set_attribute(
"HierId", $h[
"hier_id"]);
4363 $dc_node->set_attribute(
"Class",
"ilEdit" . $h[
"change"]);
4364 $dc_node = $rnode->append_child($dc_node);
4378 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
4382 $l_hashes = $l_page->getPageContentsHashes();
4383 $r_hashes = $r_page->getPageContentsHashes();
4385 foreach ($l_hashes as $pc_id => $h) {
4386 if (!isset($r_hashes[$pc_id])) {
4387 $l_hashes[$pc_id][
"change"] =
"Deleted";
4389 if ($l_hashes[$pc_id][
"hash"] != $r_hashes[$pc_id][
"hash"]) {
4390 $l_hashes[$pc_id][
"change"] =
"Modified";
4391 $r_hashes[$pc_id][
"change"] =
"Modified";
4393 include_once(
"./Services/COPage/mediawikidiff/class.WordLevelDiff.php");
4395 if ($l_hashes[$pc_id][
"content"] !=
"" &&
4396 $r_hashes[$pc_id][
"content"] !=
"") {
4397 $new_left = str_replace(
"\n",
"<br />", $l_hashes[$pc_id][
"content"]);
4398 $new_right = str_replace(
"\n",
"<br />", $r_hashes[$pc_id][
"content"]);
4403 $new_left = $wldiff->orig();
4404 $new_right = $wldiff->closing();
4405 $l_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_left[0]);
4406 $r_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_right[0]);
4413 foreach ($r_hashes as $pc_id => $h) {
4414 if (!isset($l_hashes[$pc_id])) {
4415 $r_hashes[$pc_id][
"change"] =
"New";
4418 $l_page->addChangeDivClasses($l_hashes);
4419 $r_page->addChangeDivClasses($r_hashes);
4421 return array(
"l_page" => $l_page,
4422 "r_page" => $r_page,
4423 "l_changes" => $l_hashes,
4424 "r_changes" => $r_hashes
4435 $db->manipulate(
"UPDATE page_object " .
4436 " SET view_cnt = view_cnt + 1 " .
4437 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4438 " AND parent_type = " .
$db->quote($this->getParentType(),
"text") .
4439 " AND lang = " .
$db->quote($this->getLanguage(),
"text"));
4448 public static function getRecentChanges($a_parent_type, $a_parent_id, $a_period = 30, $a_lang =
"")
4455 if ($a_lang !=
"") {
4456 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4459 $page_changes = array();
4460 $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
4461 $q =
"SELECT * FROM page_object " .
4462 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4463 " AND parent_type = " .
$db->quote($a_parent_type,
"text") .
4464 " AND last_change >= " .
$db->quote($limit_ts,
"timestamp") . $and_lang;
4466 $set =
$db->query($q);
4467 while ($page =
$db->fetchAssoc($set)) {
4468 $page_changes[] = array(
4469 "date" => $page[
"last_change"],
4470 "id" => $page[
"page_id"],
4471 "lang" => $page[
"lang"],
4473 "user" => $page[
"last_change_user"]
4478 if ($a_period > 0) {
4479 $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
4480 $and_str =
" AND hdate >= " .
$db->quote($limit_ts,
"timestamp") .
" ";
4483 $q =
"SELECT * FROM page_history " .
4484 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4485 " AND parent_type = " .
$db->quote($a_parent_type,
"text") .
4486 $and_str . $and_lang;
4487 $set =
$db->query($q);
4488 while ($page =
$db->fetchAssoc($set)) {
4489 $page_changes[] = array(
4490 "date" => $page[
"hdate"],
4491 "id" => $page[
"page_id"],
4492 "lang" => $page[
"lang"],
4494 "nr" => $page[
"nr"],
4495 "user" => $page[
"user_id"]
4501 return $page_changes;
4511 public static function getAllPages($a_parent_type, $a_parent_id, $a_lang =
"-")
4518 if ($a_lang !=
"") {
4519 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4522 $q =
"SELECT * FROM page_object " .
4523 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4524 " AND parent_type = " .
$db->quote($a_parent_type,
"text") . $and_lang;
4525 $set =
$db->query($q);
4527 while ($page =
$db->fetchAssoc($set)) {
4528 $key_add = ($a_lang ==
"")
4529 ?
":" . $page[
"lang"]
4531 $pages[$page[
"page_id"] . $key_add] = array(
4532 "date" => $page[
"last_change"],
4533 "id" => $page[
"page_id"],
4534 "lang" => $page[
"lang"],
4535 "user" => $page[
"last_change_user"]
4547 public static function getNewPages($a_parent_type, $a_parent_id, $a_lang =
"-")
4554 if ($a_lang !=
"") {
4555 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4560 $q =
"SELECT * FROM page_object " .
4561 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4562 " AND parent_type = " .
$db->quote($a_parent_type,
"text") . $and_lang .
4563 " ORDER BY created DESC";
4564 $set =
$db->query($q);
4565 while ($page =
$db->fetchAssoc($set)) {
4566 if ($page[
"created"] !=
"") {
4568 "created" => $page[
"created"],
4569 "id" => $page[
"page_id"],
4570 "lang" => $page[
"lang"],
4571 "user" => $page[
"create_user"],
4591 if ($a_lang !=
"") {
4592 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4595 $contributors = array();
4597 "SELECT last_change_user, lang, page_id FROM page_object " .
4598 " WHERE parent_id = %s AND parent_type = %s " .
4599 " AND last_change_user != %s" . $and_lang,
4600 array(
"integer",
"text",
"integer"),
4601 array($a_parent_id, $a_parent_type, 0)
4604 while ($page =
$db->fetchAssoc($set)) {
4605 if ($a_lang ==
"") {
4606 $contributors[$page[
"last_change_user"]][$page[
"page_id"]][$page[
"lang"]] = 1;
4608 $contributors[$page[
"last_change_user"]][$page[
"page_id"]] = 1;
4613 "SELECT count(*) as cnt, lang, page_id, user_id FROM page_history " .
4614 " WHERE parent_id = %s AND parent_type = %s AND user_id != %s " . $and_lang .
4615 " GROUP BY page_id, user_id, lang ",
4616 array(
"integer",
"text",
"integer"),
4617 array($a_parent_id, $a_parent_type, 0)
4619 while ($hpage =
$db->fetchAssoc($set)) {
4620 if ($a_lang ==
"") {
4621 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]][$hpage[
"lang"]] =
4622 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]][$hpage[
"lang"]] + $hpage[
"cnt"];
4624 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] =
4625 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] + $hpage[
"cnt"];
4630 foreach ($contributors as $k => $co) {
4633 $c[] = array(
"user_id" => $k,
4635 "lastname" =>
$name[
"lastname"],
4636 "firstname" =>
$name[
"firstname"]
4656 if ($a_lang !=
"") {
4657 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4660 $contributors = array();
4662 "SELECT last_change_user, lang FROM page_object " .
4663 " WHERE page_id = %s AND parent_type = %s " .
4664 " AND last_change_user != %s" . $and_lang,
4665 array(
"integer",
"text",
"integer"),
4666 array($a_page_id, $a_parent_type, 0)
4669 while ($page =
$db->fetchAssoc($set)) {
4670 if ($a_lang ==
"") {
4671 $contributors[$page[
"last_change_user"]][$page[
"lang"]] = 1;
4673 $contributors[$page[
"last_change_user"]] = 1;
4678 "SELECT count(*) as cnt, lang, page_id, user_id FROM page_history " .
4679 " WHERE page_id = %s AND parent_type = %s AND user_id != %s " . $and_lang .
4680 " GROUP BY user_id, page_id, lang ",
4681 array(
"integer",
"text",
"integer"),
4682 array($a_page_id, $a_parent_type, 0)
4684 while ($hpage =
$db->fetchAssoc($set)) {
4685 if ($a_lang ==
"") {
4686 $contributors[$hpage[
"user_id"]][$page[
"lang"]] =
4687 $contributors[$hpage[
"user_id"]][$page[
"lang"]] + $hpage[
"cnt"];
4689 $contributors[$hpage[
"user_id"]] =
4690 $contributors[$hpage[
"user_id"]] + $hpage[
"cnt"];
4695 foreach ($contributors as $k => $co) {
4696 include_once
"Services/User/classes/class.ilObjUser.php";
4698 $c[] = array(
"user_id" => $k,
4700 "lastname" =>
$name[
"lastname"],
4701 "firstname" =>
$name[
"firstname"]
4717 $db->update(
"page_object", array(
4718 "rendered_content" => array(
"clob", $a_content),
4719 "render_md5" => array(
"text", $a_md5),
4720 "rendered_time" => array(
"timestamp",
ilUtil::now())
4722 "page_id" => array(
"integer", $this->
getId()),
4741 if ($a_lang !=
"") {
4742 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4745 $q =
"SELECT * FROM page_object " .
4746 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4747 " AND parent_type = " .
$db->quote($a_parent_type,
"text") .
4748 " AND int_links = " .
$db->quote(1,
"integer") . $and_lang;
4749 $set =
$db->query($q);
4751 while ($page =
$db->fetchAssoc($set)) {
4752 $key_add = ($a_lang ==
"")
4753 ?
":" . $page[
"lang"]
4755 $pages[$page[
"page_id"] . $key_add] = array(
4756 "date" => $page[
"last_change"],
4757 "id" => $page[
"page_id"],
4758 "lang" => $page[
"lang"],
4759 "user" => $page[
"last_change_user"]
4773 if (strpos($a_content,
"IntLink")) {
4799 $link_type =
"MediaObject";
4800 $a_id =
"il__mob_" . $a_id;
4804 $link_type =
"PageObject";
4805 $a_id =
"il__pg_" . $a_id;
4809 $link_type =
"GlossaryItem";
4810 $a_id =
"il__git_" . $a_id;
4811 $a_target =
"Glossary";
4816 if ($link_type ==
"" || $a_id ==
"") {
4818 $path =
"//PageObject/InitOpenedContent";
4820 if (count(
$res->nodeset) > 0) {
4821 $res->nodeset[0]->unlink_node(
$res->nodeset[0]);
4825 $path =
"//PageObject/InitOpenedContent";
4827 if (count(
$res->nodeset) > 0) {
4828 $init_node =
$res->nodeset[0];
4829 $childs = $init_node->child_nodes();
4830 for (
$i = 0;
$i < count($childs);
$i++) {
4831 if ($childs[
$i]->node_name() ==
"IntLink") {
4832 $il_node = $childs[
$i];
4836 $path =
"//PageObject";
4838 $page_node =
$res->nodeset[0];
4839 $init_node = $this->dom->create_element(
"InitOpenedContent");
4840 $init_node = $page_node->append_child($init_node);
4841 $il_node = $this->dom->create_element(
"IntLink");
4842 $il_node = $init_node->append_child($il_node);
4844 $il_node->set_attribute(
"Target", $a_id);
4845 $il_node->set_attribute(
"Type", $link_type);
4846 $il_node->set_attribute(
"TargetFrame", $a_target);
4861 $path =
"//PageObject/InitOpenedContent";
4864 if (count(
$res->nodeset) > 0) {
4865 $init_node =
$res->nodeset[0];
4866 $childs = $init_node->child_nodes();
4867 for (
$i = 0;
$i < count($childs);
$i++) {
4868 if ($childs[
$i]->node_name() ==
"IntLink") {
4869 $il_node = $childs[
$i];
4873 if (!is_null($il_node)) {
4874 $id = $il_node->get_attribute(
"Target");
4875 $link_type = $il_node->get_attribute(
"Type");
4876 $target = $il_node->get_attribute(
"TargetFrame");
4878 switch ($link_type) {
4887 case "GlossaryItem":
4891 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
4893 return array(
"id" =>
$id,
"type" =>
$type,
"target" => $target);
4918 public function copy($a_id, $a_parent_type =
"", $a_parent_id = 0, $a_clone_mobs =
false)
4920 if ($a_parent_type ==
"") {
4922 if ($a_parent_id == 0) {
4927 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
4936 $new_page_object->setParentId($a_parent_id);
4937 $new_page_object->setId($a_id);
4939 $new_page_object->setXMLContent($orig_page->copyXMLContent($a_clone_mobs));
4940 $new_page_object->setActive($orig_page->getActive());
4941 $new_page_object->setActivationStart($orig_page->getActivationStart());
4942 $new_page_object->setActivationEnd($orig_page->getActivationEnd());
4944 $new_page_object->buildDom();
4945 $new_page_object->update();
4947 $new_page_object->create();
4965 "SELECT lang FROM page_object " .
4966 " WHERE page_id = " .
$db->quote($a_id,
"integer") .
4967 " AND parent_type = " .
$db->quote($a_parent_type,
"text")
4970 while ($rec =
$db->fetchAssoc($set)) {
4971 $langs[] = $rec[
"lang"];
4988 $transl_page->setId($this->
getId());
4990 $transl_page->setXMLContent($this->copyXMLContent());
4991 $transl_page->setActive($this->
getActive());
4994 $transl_page->create();
5014 "UPDATE page_object SET " .
5015 " edit_lock_user = " .
$db->quote(
$user->getId(),
"integer") .
"," .
5016 " edit_lock_ts = " .
$db->quote($ts,
"integer") .
5017 " WHERE (edit_lock_user = " .
$db->quote(
$user->getId(),
"integer") .
" OR " .
5018 " edit_lock_ts < " .
$db->quote(time() - ($min * 60),
"integer") .
") " .
5019 " AND page_id = " .
$db->quote($this->getId(),
"integer") .
5020 " AND parent_type = " .
$db->quote($this->getParentType(),
"text")
5024 "SELECT edit_lock_user FROM page_object " .
5025 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
5026 " AND parent_type = " .
$db->quote($this->getParentType(),
"text")
5028 $rec =
$db->fetchAssoc($set);
5029 if ($rec[
"edit_lock_user"] !=
$user->getId()) {
5046 $min = (int) $aset->get(
"block_mode_minutes");
5051 "UPDATE page_object SET " .
5052 " edit_lock_user = " .
$db->quote(
$user->getId(),
"integer") .
"," .
5053 " edit_lock_ts = 0" .
5054 " WHERE edit_lock_user = " .
$db->quote(
$user->getId(),
"integer") .
5055 " AND page_id = " .
$db->quote($this->getId(),
"integer") .
5056 " AND parent_type = " .
$db->quote($this->getParentType(),
"text")
5060 "SELECT edit_lock_user FROM page_object " .
5061 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
5062 " AND parent_type = " .
$db->quote($this->getParentType(),
"text")
5064 $rec =
$db->fetchAssoc($set);
5065 if ($rec[
"edit_lock_user"] !=
$user->getId()) {
5082 $min = (int) $aset->get(
"block_mode_minutes");
5085 "SELECT edit_lock_user, edit_lock_ts FROM page_object " .
5086 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
5089 $rec =
$db->fetchAssoc($set);
5090 $rec[
"edit_lock_until"] = $rec[
"edit_lock_ts"] + $min * 60;
5110 $a_consider_html =
true
5112 include_once
"Services/Utilities/classes/class.ilStr.php";
5114 if ($a_consider_html) {
5116 if (strlen(preg_replace(
'/<.*?>/',
'', $a_text)) <= $a_length) {
5121 $total_length = strlen($a_ending);
5122 $open_tags = array();
5124 preg_match_all(
'/(<.+?>)?([^<>]*)/s', $a_text, $lines, PREG_SET_ORDER);
5125 foreach ($lines as $line_matchings) {
5127 if (!empty($line_matchings[1])) {
5130 '/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is',
5135 elseif (preg_match(
'/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) {
5137 $pos = array_search($tag_matchings[1], $open_tags);
5138 if ($pos !==
false) {
5139 unset($open_tags[$pos]);
5142 elseif (preg_match(
'/^<\s*([^\s>!]+).*?>$/s', $line_matchings[1], $tag_matchings)) {
5144 array_unshift($open_tags, strtolower($tag_matchings[1]));
5147 $truncate .= $line_matchings[1];
5151 $content_length = strlen(preg_replace(
5152 '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i',
5156 if ($total_length + $content_length > $a_length) {
5158 $left = $a_length - $total_length;
5159 $entities_length = 0;
5162 '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i',
5168 foreach ($entities[0] as $entity) {
5169 if ($entity[1] + 1 - $entities_length <= $left) {
5171 $entities_length += strlen($entity[0]);
5185 $truncate .= $line_matchings[2];
5186 $total_length += $content_length;
5190 if ($total_length >= $a_length) {
5195 if (strlen($a_text) <= $a_length) {
5204 if (!
sizeof($open_tags)) {
5208 $spacepos = strrpos($truncate,
' ');
5209 if ($spacepos !==
false) {
5218 $truncate .= $a_ending;
5220 if ($a_consider_html) {
5222 foreach ($open_tags as $tag) {
5223 $truncate .=
'</' . $tag .
'>';
5252 if ($a_lang !=
"") {
5253 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
5257 $q =
"SELECT last_change FROM page_object " .
5258 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
5259 " AND parent_type = " .
$db->quote($a_parent_type,
"text") . $and_lang .
5260 " ORDER BY last_change DESC";
5262 $set =
$db->query($q);
5263 $rec =
$db->fetchAssoc($set);
5265 return $rec[
"last_change"];
5270 if ($this->
getPageConfig()->getEditLockSupport() ==
false) {
5275 $min = (int) $aset->get(
"block_mode_minutes");
5286 $file_obj_ids = array();
5290 $path =
"//FileItem/Identifier";
5292 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
5293 $file_obj_ids[] =
$res->nodeset[
$i]->get_attribute(
"Entry");
5296 return $file_obj_ids;
5305 include_once(
"./Services/COPage/classes/class.ilPCResources.php");
5328 if ($co !==
null && $co !==
false) {
5329 $co_model = $co->getModel();
5330 if ($co_model !==
null) {
5331 $model[$pc_id] = $co_model;
5343 if (is_array($targets)) {
5344 foreach ($targets as $t) {
5345 $tarr = explode(
":", $t);
5347 if (is_object($cont_obj) && $cont_obj->getType() ==
"par") {
5348 $cont_obj->setCharacteristic($char_par);
5350 if (is_object($cont_obj) && $cont_obj->getType() ==
"sec") {
5351 $cont_obj->setCharacteristic($char_sec);
5353 if (is_object($cont_obj) && $cont_obj->getType() ==
"media") {
5354 $cont_obj->setClass($char_med);
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)
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.
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
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.
hasDuplicatePCIds()
Get all pc ids.
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).
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.
static _writeActive( $a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation=true, $a_lang="-")
write activation status
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.
static truncateHTML( $a_text, $a_length=100, $a_ending='...', $a_exact=false, $a_consider_html=true)
Truncate (html) string.
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.
getParentContentObjectForPcId($pcid)
Get parent content object for pc id.
addUpdateListener(&$a_object, $a_method, $a_parameters="")
insertInstIntoIDs($a_inst, $a_res_ref_to_obj_id=true)
inserts installation id into ids (e.g.
getXMLFromDom( $a_incl_head=false, $a_append_mobs=false, $a_append_bib=false, $a_append_str="", $a_omit_pageobject_tag=false, $style_id=0)
get xml content of page from dom (use this, if any changes are made to the document)
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
getDuplicatePCIds()
Get all duplicate PC Ids.
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 This function is currently (4.4.0 alpha) called by:
getPCModel()
Get page component model.
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
cutContents($a_hids)
Copy contents to clipboard and cut them from the page.
getPCIdForHierId($hier_id)
getLanguageVariablesXML($style_id=0)
Get language variables as XML.
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...
getPCIdsForHierIds($hier_ids)
Get hier ids for a set of pc ids.
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.
getParagraphForPCID($pcid)
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.
getContentObjectForPcId($pcid)
Get content object for pc id.
getFO()
get fo page content
copyPageToTranslation($a_target_lang)
Copy page to translation.
setActive($a_active)
set activation
addHierIDs()
Add hierarchical ID (e.g.
checkForTag($a_content_tag, $a_hier_id, $a_pc_id="")
Get content node from dom.
validateDom(bool $throw=false)
Validate the page content agains page DTD.
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 This function copies items, that must be copied, if page content is duplicated.
assignCharacteristic($targets, $char_par, $char_sec, $char_med)
Assign characteristic.
writeRenderedContent($a_content, $a_md5)
Write rendered content.
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).
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 Note: This one is "work in progress", currently only text paragraphs call ...
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
insertContent(&$a_cont_obj, $a_pos, $a_mode=IL_INSERT_AFTER, $a_pcid="", bool $remove_placeholder=true)
insert a content node before/after a sibling or as first child of a parent
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