19 define(
"IL_INSERT_BEFORE", 0);
20 define(
"IL_INSERT_AFTER", 1);
21 define(
"IL_INSERT_CHILD", 2);
110 $this->obj_definition = $DIC[
"objDefinition"];
111 $this->db = $DIC->database();
112 $this->
user = $DIC->user();
113 $this->
lng = $DIC->language();
114 $this->tree = $DIC->repositoryTree();
123 $this->contains_int_link =
false;
124 $this->needs_parsing =
false;
125 $this->update_listeners = array();
126 $this->update_listener_cnt = 0;
127 $this->dom_builded =
false;
128 $this->page_not_found =
false;
129 $this->old_nr = $a_old_nr;
130 $this->encoding =
"UTF-8";
143 $this->show_page_act_info =
false;
181 $this->page_config = $a_val;
186 $this->concrete_lang = $a_val;
201 $random = new \ilRandom();
202 return md5($random->int(1, 9999999) + str_replace(
" ",
"", (
string) microtime()));
207 $this->rendermd5 = $a_rendermd5;
217 $this->renderedcontent = $a_renderedcontent;
227 $this->renderedtime = $a_renderedtime;
237 $this->lastchange = $a_lastchange;
247 $this->last_change_user = $a_val;
257 $this->show_page_act_info = $a_val;
276 if ($this->old_nr == 0) {
277 $query =
"SELECT * FROM page_object" .
278 " WHERE page_id = " . $this->db->quote($this->
id,
"integer") .
279 " AND parent_type=" . $this->db->quote($this->
getParentType(),
"text") .
280 " AND lang = " . $this->db->quote($this->
getLanguage(),
"text");
281 $pg_set = $this->db->query(
$query);
282 if (!$this->page_record = $this->db->fetchAssoc($pg_set)) {
286 $this->
setActive($this->page_record[
"active"]);
291 $query =
"SELECT * FROM page_history" .
292 " WHERE page_id = " . $this->db->quote($this->
id,
"integer") .
293 " AND parent_type=" . $this->db->quote($this->
getParentType(),
"text") .
294 " AND nr = " . $this->db->quote($this->old_nr,
"integer") .
295 " AND lang = " . $this->db->quote($this->
getLanguage(),
"text");
296 $pg_set = $this->db->query(
$query);
297 $this->page_record = $this->db->fetchAssoc($pg_set);
299 if (!$this->page_record) {
303 $this->xml = $this->page_record[
"content"];
304 $this->
setParentId((
int) $this->page_record[
"parent_id"]);
305 $this->last_change_user = (
int) ($this->page_record[
"last_change_user"] ?? 0);
306 $this->create_user = (
int) ($this->page_record[
"create_user"] ?? 0);
308 $this->
setRenderMd5((
string) ($this->page_record[
"render_md5"] ??
""));
309 $this->
setRenderedTime((
string) ($this->page_record[
"rendered_time"] ??
""));
310 $this->
setLastChange((
string) ($this->page_record[
"last_change"] ??
""));
318 string $a_parent_type,
321 bool $a_no_cache =
false 325 $db = $DIC->database();
327 if (!$a_no_cache && isset(self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang])) {
328 return self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang];
333 $and_lang =
" AND lang = " . $db->
quote($a_lang,
"text");
336 $query =
"SELECT page_id FROM page_object WHERE page_id = " . $db->
quote($a_id,
"integer") .
" " .
337 "AND parent_type = " . $db->
quote($a_parent_type,
"text") . $and_lang;
340 self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang] =
true;
343 self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang] =
false;
352 string $a_parent_type,
364 if ($this->dom_builded && !$a_force) {
377 $path =
"//PageObject";
379 if (count(
$res->nodeset) == 1) {
380 $this->node =
$res->nodeset[0];
383 if (defined(
'DEVMODE') && DEVMODE) {
386 $this->log->error($mess);
391 $this->dom_builded =
true;
417 return $this->dom->myDOMDocument;
424 public function setId(
int $a_id): void
436 $this->parent_id = $a_id;
453 $this->update_listeners[$cnt][
"object"] = $a_object;
454 $this->update_listeners[$cnt][
"method"] = $a_method;
455 $this->update_listeners[$cnt][
"parameters"] = $a_parameters;
456 $this->update_listener_cnt++;
462 $object = $this->update_listeners[
$i][
"object"];
463 $method = $this->update_listeners[
$i][
"method"];
464 $parameters = $this->update_listeners[
$i][
"parameters"];
465 $object->$method($parameters);
471 $this->active = $a_active;
475 bool $a_check_scheduled_activation =
false 477 if ($a_check_scheduled_activation && !$this->active) {
495 $db = $DIC->database();
497 "SELECT page_id, parent_type, lang, active, activation_start, activation_end, show_activation_info FROM page_object " .
498 " WHERE parent_id = " . $db->
quote($a_parent_id,
"integer")
501 self::$activation_data[$rec[
"page_id"] .
":" . $rec[
"parent_type"] .
":" . $rec[
"lang"]] = $rec;
510 string $a_parent_type,
511 bool $a_check_scheduled_activation =
false,
516 $db = $DIC->database();
523 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
524 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
527 "SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s" .
528 " AND parent_type = %s AND lang = %s",
529 array(
"integer",
"text",
"text"),
530 array($a_id, $a_parent_type, $a_lang)
539 if (!$rec[
"active"] && $a_check_scheduled_activation) {
540 if ($rec[
"n"] >= $rec[
"activation_start"] &&
541 $rec[
"n"] <= $rec[
"activation_end"]) {
546 return (
bool) $rec[
"active"];
554 string $a_parent_type,
559 $db = $DIC->database();
568 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
569 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
572 "SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s" .
573 " AND parent_type = %s AND lang = %s",
574 array(
"integer",
"text",
"text"),
575 array($a_id, $a_parent_type, $a_lang)
580 if (!$rec[
"active"] && $rec[
"activation_start"] !=
"") {
592 string $a_parent_type,
597 $db = $DIC->database();
603 "UPDATE page_object SET active = %s, activation_start = %s, " .
604 " activation_end = %s WHERE page_id = %s" .
605 " AND parent_type = %s AND lang = %s",
606 array(
"int",
"timestamp",
"timestamp",
"integer",
"text",
"text"),
607 array((
int) $a_active, null, null, $a_id, $a_parent_type, $a_lang)
616 string $a_parent_type,
621 $db = $DIC->database();
628 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
629 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
632 "SELECT active, activation_start, activation_end, show_activation_info FROM page_object WHERE page_id = %s" .
633 " AND parent_type = %s AND lang = %s",
634 array(
"integer",
"text",
"text"),
635 array($a_id, $a_parent_type, $a_lang)
641 "activation_start" => null,
642 "activation_end" => null,
643 "show_activation_info" => 0
655 $db = $DIC->database();
657 $res = $db->
query(
"SELECT parent_id FROM page_object WHERE page_id = " . $db->
quote($a_id,
"integer") .
" " .
658 "AND parent_type=" . $db->
quote($a_type,
"text"));
660 return (
int) ($rec[
"parent_id"] ?? 0);
663 public static function _writeParentId(
string $a_parent_type,
int $a_pg_id,
int $a_par_id): void
667 $db = $DIC->database();
669 "UPDATE page_object SET parent_id = %s WHERE page_id = %s" .
670 " AND parent_type = %s",
671 array(
"integer",
"integer",
"text"),
672 array($a_par_id, $a_pg_id, $a_parent_type)
681 if ($a_activationstart ==
"") {
682 $a_activationstart = null;
684 $this->activationstart = $a_activationstart;
698 if ($a_activationend ==
"") {
699 $a_activationend = null;
701 $this->activationend = $a_activationend;
718 if (!is_object($cont_node)) {
721 $node_name = $cont_node->node_name();
722 if (in_array($node_name, [
"PageObject",
"TableRow"])) {
725 if ($node_name ==
"PageContent") {
726 $child_node = $cont_node->first_child();
727 $node_name = $child_node->node_name();
731 if ($node_name ==
"Table") {
732 if ($child_node->get_attribute(
"DataTable") ==
"y") {
737 $tab->setNode($cont_node);
738 $tab->setHierId($a_hier_id);
739 $tab->setPcId($a_pc_id);
744 if ($node_name ==
"MediaObject") {
745 $mal_node = $child_node->first_child();
747 $id_arr = explode(
"_", $mal_node->get_attribute(
"OriginId"));
748 $mob_id = $id_arr[count($id_arr) - 1];
757 $mob->readMediaObject($mob_id);
760 $mob->setNode($cont_node);
761 $mob->setHierId($a_hier_id);
762 $mob->setPcId($a_pc_id);
773 if (!is_array($pc_def)) {
776 $pc_class =
"ilPC" . $pc_def[
"name"];
777 $pc_path =
"./" . $pc_def[
"component"] .
"/" . $pc_def[
"directory"] .
"/class." . $pc_class .
".php";
778 require_once($pc_path);
779 $pc =
new $pc_class($this);
780 $pc->setNode($cont_node);
781 $pc->setHierId($a_hier_id);
782 $pc->setPcId($a_pc_id);
801 $node = $content_object->getNode();
804 if ($node->
node_name() ==
"PageContent") {
818 if ($a_hier_id ==
"pg") {
822 if ($a_pc_id !=
"") {
823 $path =
"//*[@PCID = '$a_pc_id']";
825 if (count(
$res->nodeset) == 1) {
826 $cont_node =
$res->nodeset[0];
832 $path =
"//*[@HierId = '$a_hier_id']";
834 if (count(
$res->nodeset) == 1) {
835 $cont_node =
$res->nodeset[0];
848 string $a_content_tag,
854 if ($a_pc_id !=
"") {
855 $path =
"//*[@PCID = '$a_pc_id']//" . $a_content_tag;
857 if (count(
$res->nodeset) > 0) {
863 $path =
"//*[@HierId = '$a_hier_id']//" . $a_content_tag;
865 if (count(
$res->nodeset) > 0) {
882 public function setXMLContent(
string $a_xml,
string $a_encoding =
"UTF-8"): void
884 $this->encoding = $a_encoding;
894 $this->xml .= $a_xml;
906 $enc_str = (!empty($this->encoding))
907 ?
"encoding=\"" . $this->encoding .
"\"" 909 return "<?xml version=\"1.0\" $enc_str ?>" .
910 "<!DOCTYPE PageObject SYSTEM \"" . ILIAS_ABSOLUTE_PATH .
"/xml/" . $this->cur_dtd .
"\">" .
923 bool $a_clone_mobs =
false,
924 int $a_new_parent_id = 0,
925 int $obj_copy_id = 0,
926 bool $self_ass =
true 930 '<?xml version="1.0" encoding="UTF-8"?>' . $xml,
935 $this->
handleCopiedContent($temp_dom, $self_ass, $a_clone_mobs, $a_new_parent_id, $obj_copy_id);
937 $xml = $temp_dom->dump_mem(0, $this->encoding);
938 $xml = preg_replace(
'/<\?xml[^>]*>/i',
"", $xml);
939 $xml = preg_replace(
'/<!DOCTYPE[^>]*>/i',
"", $xml);
957 bool $a_self_ass =
true,
958 bool $a_clone_mobs =
false,
959 int $new_parent_id = 0,
982 $dom = $a_dom->myDOMDocument;
984 foreach ($defs as $def) {
986 $cl = $def[
"pc_class"];
987 if ($cl ==
'ilPCPlugged') {
989 ilPCPlugged::handleCopiedPluggedContent($this, $dom);
991 $cl::handleCopiedContent($dom, $a_self_ass, $a_clone_mobs, $new_parent_id, $obj_copy_id);
1002 public function handleDeleteContent($a_node = null, $move_operation =
false):
void 1004 if (!isset($a_node)) {
1006 $path =
"//PageContent";
1008 $nodes =
$res->nodeset;
1010 $nodes = array($a_node);
1013 foreach ($nodes as $node) {
1015 $node = $node->myDOMNode;
1019 if ($node->firstChild->nodeName ==
'Plugged') {
1020 ilPCPlugged::handleDeletedPluggedNode($this, $node->firstChild, $move_operation);
1032 $path =
"//InteractiveImage/MediaAlias";
1037 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1038 $or_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1043 if (!($inst_id > 0)) {
1049 $new_mob = $media_object->duplicate();
1051 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $new_mob->getId());
1063 $path =
"//MediaObject/MediaAlias";
1068 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1069 $or_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1074 if (!($inst_id > 0)) {
1080 $new_mob = $media_object->duplicate();
1082 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $new_mob->getId());
1095 $path =
"//Question";
1100 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1101 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
1106 if (!($inst_id > 0)) {
1114 if (is_object($question) && $question->isComplete()) {
1118 $question->createPageObject();
1123 $duplicate_id = $question->duplicate(
false);
1124 $res->nodeset[
$i]->set_attribute(
"QRef",
"il__qst_" . $duplicate_id);
1137 $path =
"//Question";
1140 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1141 $parent_node =
$res->nodeset[
$i]->parent_node();
1142 $parent_node->unlink_node($parent_node);
1152 $path =
"//PageContent";
1155 return count(
$res->nodeset);
1163 bool $a_incl_head =
false,
1164 bool $a_append_mobs =
false,
1165 bool $a_append_bib =
false,
1166 string $a_append_str =
"",
1167 bool $a_omit_pageobject_tag =
false,
1172 return $this->dom->dump_mem(0, $this->encoding);
1175 if ($a_append_mobs || $a_append_bib) {
1178 if ($a_append_mobs) {
1181 if ($a_append_bib) {
1187 return "<dummy>" . $this->dom->dump_node($this->node) .
$mobs . $bibs . $trans . $a_append_str .
"</dummy>";
1189 if (is_object($this->dom)) {
1190 if ($a_omit_pageobject_tag) {
1192 $childs = $this->node->child_nodes();
1193 for (
$i = 0, $iMax = count($childs);
$i < $iMax;
$i++) {
1194 $xml .= $this->dom->dump_node($childs[
$i]);
1197 $xml = $this->dom->dump_mem(0, $this->encoding);
1198 $xml = preg_replace(
'/<\?xml[^>]*>/i',
"", $xml);
1199 $xml = preg_replace(
'/<!DOCTYPE[^>]*>/i',
"", $xml);
1231 "ed_align_left_float",
1232 "ed_align_right_float",
1234 "ed_new_item_before",
1235 "ed_new_item_after",
1241 "ed_split_page_next",
1249 "ed_click_to_add_pg",
1255 foreach ($defs as $def) {
1256 $lang_vars[] =
"pc_" . $def[
"pc_type"];
1257 $lang_vars[] =
"ed_insert_" . $def[
"pc_type"];
1260 $cl = $def[
"pc_class"];
1261 $lvs = call_user_func($def[
"pc_class"] .
'::getLangVars');
1262 foreach ($lvs as $lv) {
1269 $dummy_pc->setStyleId($style_id);
1270 foreach ([
"section",
"table",
"flist_li",
"list_u",
"list_o",
1271 "table",
"table_cell"] as
$type) {
1272 $dummy_pc->getCharacteristicsOfCurrentStyle([$type]);
1273 foreach ($dummy_pc->getCharacteristics() as $char =>
$txt) {
1274 $xml .=
"<LV name=\"char_" . $type .
"_" . $char .
"\" value=\"" .
$txt .
"\"/>";
1277 $type =
"media_cont";
1279 $dummy_pc->setStyleId($style_id);
1280 $dummy_pc->getCharacteristicsOfCurrentStyle([$type]);
1281 foreach ($dummy_pc->getCharacteristics() as $char =>
$txt) {
1282 $xml .=
"<LV name=\"char_" . $type .
"_" . $char .
"\" value=\"" .
$txt .
"\"/>";
1284 foreach ([
"text_block",
"heading1",
"heading2",
"heading3"] as $type) {
1286 $dummy_pc->setStyleId($style_id);
1287 $dummy_pc->getCharacteristicsOfCurrentStyle([$type]);
1288 foreach ($dummy_pc->getCharacteristics() as $char =>
$txt) {
1289 $xml .=
"<LV name=\"char_" . $type .
"_" . $char .
"\" value=\"" .
$txt .
"\"/>";
1292 foreach ($lang_vars as $lang_var) {
1301 $val = $this->
lng->txt(
"cont_" . $var);
1302 $val = str_replace(
'"',
""", $val);
1303 return "<LV name=\"$var\" value=\"" . $val .
"\"/>";
1312 $path =
"//Paragraph[1]";
1314 if (count(
$res->nodeset) > 0) {
1315 $cont_node =
$res->nodeset[0]->parent_node();
1317 $par->setNode($cont_node);
1318 $text = $par->getText();
1329 $path =
"//PageContent[@PCID='" . $pcid .
"']/Paragraph[1]";
1331 if (count(
$res->nodeset) > 0) {
1332 $cont_node =
$res->nodeset[0]->parent_node();
1334 $par->setNode($cont_node);
1347 if (is_object($node)) {
1363 $this->contains_int_link = $a_contains_link;
1378 $this->import_mode = $a_val;
1388 if ($a_parse ===
true) {
1389 $this->needs_parsing =
true;
1391 if ($a_parse ===
false) {
1392 $this->needs_parsing =
false;
1400 $this->contains_question = $a_val;
1419 $path =
"//MediaObject/MediaAlias";
1422 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1423 $id_arr = explode(
"_",
$res->nodeset[
$i]->get_attribute(
"OriginId"));
1424 $mob_id = $id_arr[count($id_arr) - 1];
1425 $mob_ids[$mob_id] = $mob_id;
1430 $path =
"//InteractiveImage/MediaAlias";
1432 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1433 $id_arr = explode(
"_",
$res->nodeset[
$i]->get_attribute(
"OriginId"));
1434 $mob_id = $id_arr[count($id_arr) - 1];
1435 $mob_ids[$mob_id] = $mob_id;
1440 $path =
"//IntLink[@Type = 'MediaObject']";
1443 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1444 if ((
$res->nodeset[
$i]->get_attribute(
"TargetFrame") ==
"") ||
1445 (!$a_inline_only)) {
1446 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
1447 $id_arr = explode(
"_", $target);
1449 (substr($target, 0, 4) ==
"il__")) {
1450 $mob_id = $id_arr[count($id_arr) - 1];
1452 $mob_ids[$mob_id] = $mob_id;
1470 $path =
"//IntLink";
1475 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1477 if ($a_cnt_multiple) {
1478 $add =
":" . $cnt_multiple;
1480 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
1482 $targetframe =
$res->nodeset[
$i]->get_attribute(
"TargetFrame");
1483 $anchor =
$res->nodeset[
$i]->get_attribute(
"Anchor");
1484 $links[$target .
":" .
$type .
":" . $targetframe .
":" . $anchor . $add] =
1485 array(
"Target" => $target,
1487 "TargetFrame" => $targetframe,
1492 if (
$type ==
"MediaObject" && $targetframe ==
"") {
1493 if (substr($target, 0, 4) ==
"il__") {
1494 $id_arr = explode(
"_", $target);
1495 $id = $id_arr[count($id_arr) - 1];
1498 foreach ($med_links as
$key => $med_link) {
1499 $links[
$key] = $med_link;
1510 $path =
"//MediaAlias";
1513 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1514 $oid =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1515 if (substr($oid, 0, 4) ==
"il__") {
1516 $id_arr = explode(
"_", $oid);
1517 $id = $id_arr[count($id_arr) - 1];
1520 foreach ($med_links as
$key => $med_link) {
1521 $links[
$key] = $med_link;
1541 foreach ($mob_ids as $mob_id => $dummy) {
1544 $mobs_xml .= $mob_obj->getXML(
IL_MODE_OUTPUT, $a_inst = 0,
true);
1557 $path =
"//MediaObject/MediaAlias[@OriginId='il__mob_$a_mob_id']";
1559 $mal_node =
$res->nodeset[$a_nr - 1];
1560 $mob_node = $mal_node->parent_node();
1562 return $this->dom->dump_node($mob_node);
1576 $this->dom->validate($error, $throw);
1594 $this->hier_ids = array();
1595 $this->first_row_ids = array();
1596 $this->first_col_ids = array();
1597 $this->list_item_ids = array();
1598 $this->file_item_ids = array();
1605 foreach ($this->id_elements as $el) {
1606 $path .= $sep .
"//" . $el;
1611 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1612 $cnode =
$res->nodeset[
$i];
1613 $ctag = $cnode->node_name();
1617 while ($cnode = $cnode->previous_sibling()) {
1618 if (($cnode->node_type() == XML_ELEMENT_NODE)
1619 && $cnode->has_attribute(
"HierId")) {
1620 $sib_hier_id = $cnode->get_attribute(
"HierId");
1626 if ($sib_hier_id !=
"") {
1628 $res->nodeset[
$i]->set_attribute(
"HierId", $node_hier_id);
1629 $this->hier_ids[] = $node_hier_id;
1630 if ($ctag ==
"TableData") {
1631 if (substr($node_hier_id, strlen($node_hier_id) - 2) ==
"_1") {
1632 $this->first_row_ids[] = $node_hier_id;
1635 if ($ctag ==
"ListItem") {
1636 $this->list_item_ids[] = $node_hier_id;
1638 if ($ctag ==
"FileItem") {
1639 $this->file_item_ids[] = $node_hier_id;
1643 $cnode =
$res->nodeset[
$i];
1645 while ($cnode = $cnode->parent_node()) {
1646 if (($cnode->node_type() == XML_ELEMENT_NODE)
1647 && $cnode->has_attribute(
"HierId")) {
1648 $par_hier_id = $cnode->get_attribute(
"HierId");
1654 if (($par_hier_id !=
"") && ($par_hier_id !=
"pg")) {
1655 $node_hier_id = $par_hier_id .
"_1";
1656 $res->nodeset[
$i]->set_attribute(
"HierId", $node_hier_id);
1657 $this->hier_ids[] = $node_hier_id;
1658 if ($ctag ==
"TableData") {
1659 $this->first_col_ids[] = $node_hier_id;
1660 if (substr($par_hier_id, strlen($par_hier_id) - 2) ==
"_1") {
1661 $this->first_row_ids[] = $node_hier_id;
1664 if ($ctag ==
"ListItem") {
1665 $this->list_item_ids[] = $node_hier_id;
1667 if ($ctag ==
"FileItem") {
1668 $this->file_item_ids[] = $node_hier_id;
1671 $node_hier_id =
"1";
1672 $res->nodeset[
$i]->set_attribute(
"HierId", $node_hier_id);
1673 $this->hier_ids[] = $node_hier_id;
1680 $path =
"//PageObject";
1682 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1683 $res->nodeset[
$i]->set_attribute(
"HierId",
"pg");
1684 $this->hier_ids[] =
"pg";
1738 if (is_object($this->dom)) {
1740 $path =
"//*[@HierId]";
1742 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1743 if (
$res->nodeset[
$i]->has_attribute(
"HierId")) {
1744 $res->nodeset[
$i]->remove_attribute(
"HierId");
1756 if (!is_array($a_pc_ids) || count($a_pc_ids) == 0) {
1761 if (is_object($this->dom)) {
1763 $path =
"//*[@PCID]";
1765 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1766 $pc_id =
$res->nodeset[
$i]->get_attribute(
"PCID");
1767 if (in_array($pc_id, $a_pc_ids)) {
1768 $ret[$pc_id] =
$res->nodeset[
$i]->get_attribute(
"HierId");
1780 return $hier_ids[$pcid] ??
"";
1788 if (!is_array($hier_ids) || count($hier_ids) == 0) {
1793 if (is_object($this->dom)) {
1795 $path =
"//*[@HierId]";
1797 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1798 $hier_id =
$res->nodeset[
$i]->get_attribute(
"HierId");
1799 if (in_array($hier_id, $hier_ids)) {
1800 $ret[$hier_id] =
$res->nodeset[
$i]->get_attribute(
"PCID");
1811 return ($hier_ids[$hier_id] ??
"");
1821 $path =
"//FileItem";
1823 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1824 $cnode =
$res->nodeset[
$i];
1825 $size_node = $this->dom->create_element(
"Size");
1826 $size_node = $cnode->append_child($size_node);
1828 $childs = $cnode->child_nodes();
1830 for ($j = 0, $jMax = count($childs); $j < $jMax; $j++) {
1831 if ($childs[$j]->node_name() ==
"Identifier") {
1832 if ($childs[$j]->has_attribute(
"Entry")) {
1833 $entry = $childs[$j]->get_attribute(
"Entry");
1834 $entry_arr = explode(
"_", $entry);
1835 $id = $entry_arr[count($entry_arr) - 1];
1837 $info = $info_repo->getByObjectId((
int) $id);
1838 $size = $info->getFileSize()->inBytes();
1844 $size_node->set_content($size);
1858 $this->log->debug(
"start");
1862 $path =
"//IntLink";
1864 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1865 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
1868 if ($a_link_map == null) {
1870 $this->log->debug(
"no map, type: " .
$type .
", target: " . $target .
", new target: " . $new_target);
1872 $nt = explode(
"_", $a_link_map[$target]);
1873 $new_target =
false;
1875 $new_target =
"il__" . $nt[2] .
"_" . $nt[3];
1877 $this->log->debug(
"map, type: " .
$type .
", target: " . $target .
", new target: " . $new_target);
1879 if ($new_target !==
false && !is_null($new_target)) {
1880 $res->nodeset[
$i]->set_attribute(
"Target", $new_target);
1887 $res->nodeset[
$i]->set_attribute(
"Target", $new_target);
1897 $path =
"//MediaAlias";
1901 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1902 $orig_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1903 $id_arr = explode(
"_", $orig_id);
1904 $mob_id = $id_arr[count($id_arr) - 1];
1917 bool $a_reuse_existing_by_import =
false 1921 $path =
"//MediaAlias";
1924 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1926 $old_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1927 $old_id = explode(
"_", $old_id);
1928 $old_id = $old_id[count($old_id) - 1];
1932 if (($a_mapping[$old_id] ?? 0) > 0) {
1933 $new_id = $a_mapping[$old_id];
1934 if ($a_reuse_existing_by_import) {
1937 $imp = explode(
"_", $import_id);
1945 if ($import_id ==
"" && $a_reuse_existing_by_import) {
1954 if (in_array($old_id, $med_of_def_lang)) {
1958 if ($new_id !=
"") {
1959 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $new_id);
1976 $path =
"//InteractiveImage/MediaAlias";
1979 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
1980 $old_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1981 if (($a_mapping[$old_id] ?? 0) > 0) {
1982 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $a_mapping[$old_id]);
2000 $path =
"//FileItem/Identifier";
2003 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
2004 $old_id =
$res->nodeset[
$i]->get_attribute(
"Entry");
2005 $old_id = explode(
"_", $old_id);
2006 $old_id = $old_id[count($old_id) - 1];
2007 if (($a_mapping[$old_id] ?? 0) > 0) {
2008 $res->nodeset[
$i]->set_attribute(
"Entry",
"il__file_" . $a_mapping[$old_id]);
2026 $path =
"//Question";
2029 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
2030 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
2032 if (isset($a_mapping[$qref])) {
2033 $res->nodeset[
$i]->set_attribute(
"QRef",
"il__qst_" . $a_mapping[$qref][
"pool"]);
2055 $path =
"//IntLink";
2057 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
2058 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
2061 if (($a_from_to[$obj_id] ?? 0) > 0 && is_int(strpos($target,
"__"))) {
2063 $res->nodeset[
$i]->set_attribute(
"Target",
"il__pg_" . $a_from_to[$obj_id]);
2067 $res->nodeset[
$i]->set_attribute(
"Target",
"il__st_" . $a_from_to[$obj_id]);
2070 if (
$type ==
"PortfolioPage") {
2071 $res->nodeset[
$i]->set_attribute(
"Target",
"il__ppage_" . $a_from_to[$obj_id]);
2074 if (
$type ==
"WikiPage") {
2075 $res->nodeset[
$i]->set_attribute(
"Target",
"il__wpage_" . $a_from_to[$obj_id]);
2085 $path =
"//MediaAlias";
2088 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
2089 $media_object_node =
$res->nodeset[
$i]->parent_node();
2090 $page_content_node = $media_object_node->parent_node();
2091 $c_hier_id = $page_content_node->get_attribute(
"HierId");
2099 $areas = $std_alias_item->getMapAreas();
2100 $correction_needed =
false;
2101 if (count($areas) > 0) {
2103 foreach ($areas as $area) {
2104 if ($area[
"Type"] ==
"PageObject" ||
2105 $area[
"Type"] ==
"StructureObject") {
2106 $t = $area[
"Target"];
2108 if ($a_from_to[$tid] > 0) {
2109 $correction_needed =
true;
2118 $oid =
$res->nodeset[
$i]->get_attribute(
"OriginId");
2119 if (substr($oid, 0, 4) ==
"il__") {
2120 $id_arr = explode(
"_", $oid);
2121 $id = $id_arr[count($id_arr) - 1];
2124 $med_item = $mob->getMediaItem(
"Standard");
2125 $med_areas = $med_item->getMapAreas();
2127 foreach ($med_areas as $area) {
2128 $link_type = ($area->getLinkType() ==
"int")
2133 "Nr" => $area->getNr(),
2134 "Shape" => $area->getShape(),
2135 "Coords" => $area->getCoords(),
2137 "LinkType" => $link_type,
2138 "Href" => $area->getHref(),
2139 "Title" => $area->getTitle(),
2140 "Target" => $area->getTarget(),
2141 "Type" => $area->getType(),
2142 "TargetFrame" => $area->getTargetFrame()
2146 if ($area->getType() ==
"PageObject" ||
2147 $area->getType() ==
"StructureObject") {
2148 $t = $area->getTarget();
2150 if ($a_from_to[$tid] > 0) {
2151 $correction_needed =
true;
2160 if ($correction_needed) {
2162 $std_alias_item->deleteAllMapAreas();
2163 foreach ($areas as $area) {
2164 if ($area[
"Link"][
"LinkType"] ==
"IntLink") {
2165 $target = $area[
"Link"][
"Target"];
2166 $type = $area[
"Link"][
"Type"];
2168 if ($a_from_to[$obj_id] > 0) {
2170 $area[
"Link"][
"Target"] =
"il__pg_" . $a_from_to[$obj_id];
2173 $area[
"Link"][
"Target"] =
"il__st_" . $a_from_to[$obj_id];
2178 $std_alias_item->addMapArea(
2181 $area[
"Link"][
"Title"],
2182 array(
"Type" => $area[
"Link"][
"Type"],
2183 "TargetFrame" => $area[
"Link"][
"TargetFrame"],
2184 "Target" => $area[
"Link"][
"Target"],
2185 "Href" => $area[
"Link"][
"Href"],
2186 "LinkType" => $area[
"Link"][
"LinkType"],
2202 string $a_rep_import_id,
2213 foreach ($sources as
$source) {
2214 if ($source[
"type"] ==
"lm:pg") {
2215 if (self::_exists(
"lm", $source[
"id"], $source[
"lang"])) {
2216 $page_obj =
new ilLMPage($source[
"id"], 0, $source[
"lang"]);
2217 if (!$page_obj->page_not_found) {
2218 $page_obj->handleImportRepositoryLink(
2224 $page_obj->update();
2232 string $a_rep_import_id,
2240 $path =
"//IntLink";
2243 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
2245 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
2247 if ($target == $a_rep_import_id &&
$type ==
"RepositoryItem") {
2249 $res->nodeset[
$i]->set_attribute(
2251 "il__" . $a_rep_type .
"_" . $a_rep_ref_id
2263 int $a_source_ref_id
2270 $this->log->debug(
"Handle repository links...");
2274 foreach ($defs as $def) {
2276 if (method_exists($def[
"pc_class"],
'afterRepositoryCopy')) {
2277 call_user_func($def[
"pc_class"] .
'::afterRepositoryCopy', $this, $a_mapping, $a_source_ref_id);
2284 $path =
"//IntLink";
2286 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
2287 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
2289 $this->log->debug(
"Target: " . $target);
2290 $t = explode(
"_", $target);
2291 if (
$type ==
"RepositoryItem" && ((
int) $t[1] == 0 || (
int) $t[1] ==
IL_INST_ID)) {
2292 if (isset($a_mapping[$t[3]])) {
2294 $this->log->debug(
"... replace " . $t[3] .
" with " . $a_mapping[$t[3]] .
".");
2295 $res->nodeset[
$i]->set_attribute(
2297 "il__obj_" . $a_mapping[$t[3]]
2299 } elseif ($this->tree->isGrandChild($a_source_ref_id, $t[3])) {
2301 $this->log->debug(
"... remove links.");
2302 if (
$res->nodeset[
$i]->parent_node()->node_name() ==
"MapArea") {
2303 $parent =
$res->nodeset[
$i]->parent_node();
2304 $parent->unlink_node($parent);
2306 $source_node =
$res->nodeset[
$i];
2307 $new_node = $source_node->clone_node(
true);
2308 $new_node->unlink_node($new_node);
2309 $childs = $new_node->child_nodes();
2310 for ($j = 0, $jMax = count($childs); $j < $jMax; $j++) {
2311 $this->log->debug(
"... move node $j " . $childs[$j]->node_name() .
" before " . $source_node->node_name());
2312 $source_node->insert_before($childs[$j], $source_node);
2314 $source_node->unlink_node($source_node);
2322 $ilias_url = parse_url(ILIAS_HTTP_PATH);
2324 $path =
"//ExtLink";
2326 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
2327 $href =
$res->nodeset[
$i]->get_attribute(
"Href");
2328 $this->log->debug(
"Href: " . $href);
2330 $url = parse_url($href);
2333 $this->log->debug(
"Host: " . (
$url[
"host"] ??
""));
2334 if ((
$url[
"host"] ??
"") !==
"" &&
$url[
"host"] !== $ilias_url[
"host"]) {
2340 if (substr($href, strlen($href) - 5) ===
".html") {
2344 substr(
$url[
"path"], 0, strlen(
$url[
"path"]) - 5)
2347 if (array_shift(
$parts) !==
"goto") {
2350 $par[
"client_id"] = array_shift(
$parts);
2351 $par[
"target"] = implode(
"_",
$parts);
2353 foreach (explode(
"&", (
$url[
"query"] ??
"")) as $p) {
2354 $p = explode(
"=", $p);
2355 if (isset($p[0]) && isset($p[1])) {
2356 $par[$p[0]] = $p[1];
2361 $target_client_id = $par[
"client_id"] ??
"";
2362 if ($target_client_id !=
"" && $target_client_id !=
CLIENT_ID) {
2368 if (is_int(strpos($href,
"ilias.php"))) {
2370 } elseif (isset($par[
"target"]) && $par[
"target"] !==
"") {
2371 $t = explode(
"_", $par[
"target"]);
2372 if ($objDefinition->isRBACObject($t[0] ??
"")) {
2374 $type = $t[0] ??
"";
2378 if (isset($a_mapping[
$ref_id])) {
2379 $new_ref_id = $a_mapping[
$ref_id];
2381 if (is_int(strpos($href,
"ilias.php"))) {
2382 $new_href = str_replace(
"ref_id=" . ($par[
"ref_id"] ??
""),
"ref_id=" . $new_ref_id, $href);
2384 $nt = str_replace(
$type .
"_" . $ref_id,
$type .
"_" . $new_ref_id, $par[
"target"]);
2385 $new_href = str_replace($par[
"target"], $nt, $href);
2387 if ($new_href !=
"") {
2388 $this->log->debug(
"... ext link replace " . $href .
" with " . $new_href .
".");
2389 $res->nodeset[
$i]->set_attribute(
"Href", $new_href);
2391 } elseif ($tree->
isGrandChild($a_source_ref_id, $ref_id)) {
2393 $this->log->debug(
"... remove ext links.");
2394 if (
$res->nodeset[
$i]->parent_node()->node_name() ==
"MapArea") {
2395 $parent =
$res->nodeset[
$i]->parent_node();
2396 $parent->unlink_node($parent);
2398 $source_node =
$res->nodeset[
$i];
2399 $new_node = $source_node->clone_node(
true);
2400 $new_node->unlink_node($new_node);
2401 $childs = $new_node->child_nodes();
2402 for ($j = 0, $jMax = count($childs); $j < $jMax; $j++) {
2403 $this->log->debug(
"... move node $j " . $childs[$j]->node_name() .
" before " . $source_node->node_name());
2404 $source_node->insert_before($childs[$j], $source_node);
2406 $source_node->unlink_node($source_node);
2427 $dom_doc = $this->getDomDoc();
2434 $this->db->insert(
"page_object", array(
2435 "page_id" => array(
"integer", $this->
getId()),
2436 "parent_id" => array(
"integer", $this->
getParentId()),
2438 "content" => array(
"clob", $content),
2440 "create_user" => array(
"integer", $this->
user->getId()),
2441 "last_change_user" => array(
"integer", $this->
user->getId()),
2442 "active" => array(
"integer", (
int) $this->
getActive()),
2446 "inactive_elements" => array(
"integer", $iel),
2447 "int_links" => array(
"integer", $inl),
2449 "last_change" => array(
"timestamp",
ilUtil::now()),
2450 "is_empty" => array(
"integer", $empty)
2466 $this->log->debug(
"ilPageObject, updateFromXML(): start, id: " . $this->
getId());
2470 $this->log->debug(
"ilPageObject, updateFromXML(): content: " . substr($content, 0, 100));
2473 $dom_doc = $this->getDomDoc();
2480 $this->db->update(
"page_object", array(
2481 "content" => array(
"clob", $content),
2482 "parent_id" => array(
"integer", $this->
getParentId()),
2483 "last_change_user" => array(
"integer", $this->
user->getId()),
2484 "last_change" => array(
"timestamp",
ilUtil::now()),
2485 "active" => array(
"integer", $this->
getActive()),
2488 "inactive_elements" => array(
"integer", $iel),
2489 "int_links" => array(
"integer", $inl),
2491 "page_id" => array(
"integer", $this->
getId()),
2499 $this->log->debug(
"ilPageObject, updateFromXML(): end");
2511 bool $a_creation =
false,
2512 bool $a_empty =
false 2515 if (!$a_creation || !$a_empty) {
2525 $this->reading_time_manager->saveTime($this);
2529 foreach ($defs as $def) {
2531 $cl = $def[
"pc_class"];
2532 call_user_func($def[
"pc_class"] .
'::afterPageUpdate', $this, $a_domdoc, $a_xml, $a_creation);
2556 public function update(
bool $a_validate =
true,
bool $a_no_history =
false)
2558 $this->log->debug(
"start..., id: " . $this->
getId());
2575 1 => $this->
lng->txt(
"cont_not_saved_edit_lock_expired") .
"<br />" .
2576 $this->
lng->txt(
"obj_usr") .
": " .
2578 $this->
lng->txt(
"content_until") .
": " .
2584 $this->log->debug(
"checking duplicate ids");
2586 $errors[0] = $this->
lng->txt(
"cont_could_not_save_duplicate_pc_ids") .
2591 $this->log->debug(
"ilPageObject, update(): errors: " . print_r(
$errors,
true));
2599 $this->log->debug(
"perform automatic modifications");
2604 $dom_doc = $this->getDomDoc();
2609 $old_set = $this->db->query(
"SELECT * FROM page_object WHERE " .
2610 "page_id = " . $this->db->quote($this->getId(),
"integer") .
" AND " .
2611 "parent_type = " . $this->db->quote($this->getParentType(),
"text") .
" AND " .
2612 "lang = " . $this->db->quote($this->getLanguage(),
"text"));
2613 $last_nr_set = $this->db->query(
"SELECT max(nr) as mnr FROM page_history WHERE " .
2614 "page_id = " . $this->db->quote($this->getId(),
"integer") .
" AND " .
2615 "parent_type = " . $this->db->quote($this->getParentType(),
"text") .
" AND " .
2616 "lang = " . $this->db->quote($this->getLanguage(),
"text"));
2617 $last_nr = $this->db->fetchAssoc($last_nr_set);
2618 if ($old_rec = $this->db->fetchAssoc($old_set)) {
2621 if (($content != $old_rec[
"content"] || $this->
user->getId() != $old_rec[
"last_change_user"]) &&
2622 !$a_no_history && !$this->history_saved &&
$lm_set->get(
"page_history", 1)) {
2623 if ($old_rec[
"content"] !=
"<PageObject></PageObject>") {
2624 $this->db->manipulateF(
2625 "DELETE FROM page_history WHERE " .
2626 "page_id = %s AND parent_type = %s AND hdate = %s AND lang = %s",
2627 array(
"integer",
"text",
"timestamp",
"text"),
2628 array($old_rec[
"page_id"],
2629 $old_rec[
"parent_type"],
2630 $old_rec[
"last_change"],
2636 $last_c = $old_rec[
"last_change"];
2637 if ($last_c ==
"") {
2641 $this->db->insert(
"page_history", array(
2642 "page_id" => array(
"integer", $old_rec[
"page_id"]),
2643 "parent_type" => array(
"text", $old_rec[
"parent_type"]),
2644 "lang" => array(
"text", $old_rec[
"lang"]),
2645 "hdate" => array(
"timestamp", $last_c),
2646 "parent_id" => array(
"integer", $old_rec[
"parent_id"]),
2647 "content" => array(
"clob", $old_rec[
"content"]),
2648 "user_id" => array(
"integer", $old_rec[
"last_change_user"]),
2650 "nr" => array(
"integer", (
int) $last_nr[
"mnr"] + 1)
2652 $old_content = $old_rec[
"content"];
2654 $old_nr = $last_nr[
"mnr"] + 1;
2655 $old_domdoc->loadXML(
'<?xml version="1.0" encoding="UTF-8"?>' . $old_content);
2658 $this->log->debug(
"calling __afterHistoryEntry $old_nr");
2663 $this->history_saved =
true;
2667 $em = (trim($content) ==
"<PageObject/>")
2672 $this->log->debug(
"checking deactivated elements");
2674 $this->log->debug(
"checking internal links");
2676 $this->db->update(
"page_object", array(
2677 "content" => array(
"clob", $content),
2678 "parent_id" => array(
"integer", $this->
getParentId()),
2679 "last_change_user" => array(
"integer", $this->
user->getId()),
2680 "last_change" => array(
"timestamp",
ilUtil::now()),
2681 "is_empty" => array(
"integer", $em),
2682 "active" => array(
"integer", $this->
getActive()),
2686 "inactive_elements" => array(
"integer", $iel),
2687 "int_links" => array(
"integer", $inl),
2689 "page_id" => array(
"integer", $this->
getId()),
2695 $this->log->debug(
"calling __afterUpdate()");
2699 "...ending, updated and returning true, content: " . substr(
2713 public function delete():
void 2716 $copg_logger->debug(
2717 "ilPageObject: Delete called for ID '" . $this->
getId() .
"'," .
2719 " hist nr: '" . $this->old_nr .
"', " .
2724 if (!$this->page_not_found) {
2729 foreach ($mobs2 as $m) {
2730 if (!in_array($m,
$mobs)) {
2735 $copg_logger->debug(
"ilPageObject: ... found " . count(
$mobs) .
" media objects.");
2740 $this->handleDeleteContent();
2760 $this->db->manipulate(
"DELETE FROM page_object " .
2761 "WHERE page_id = " . $this->db->quote($this->getId(),
"integer") .
2762 " AND parent_type= " . $this->db->quote($this->getParentType(),
"text"));
2765 foreach (
$mobs as $mob_id) {
2766 $copg_logger->debug(
"ilPageObject: ... processing mob " . $mob_id .
".");
2769 $copg_logger->debug(
"ilPageObject: ... type mismatch. Ignoring mob " . $mob_id .
".");
2774 $copg_logger->debug(
"ilPageObject: ... delete mob " . $mob_id .
".");
2779 $copg_logger->debug(
"ilPageObject: ... missing mob " . $mob_id .
".");
2793 foreach ($defs as $def) {
2795 $cl = $def[
"pc_class"];
2796 call_user_func($def[
"pc_class"] .
'::beforePageDelete', $this);
2811 string $a_old_content,
2819 foreach ($defs as $def) {
2821 $cl = $def[
"pc_class"];
2823 $def[
"pc_class"] .
'::afterPageHistoryEntry',
2844 $path =
"//Paragraph | //Section | //MediaAlias | //FileItem" .
2845 " | //Table | //TableData | //Tabs | //List";
2846 $nodes = $xpath->query(
$path);
2848 foreach ($nodes as $node) {
2849 switch ($node->localName) {
2851 $sname = $node->getAttribute(
"Characteristic");
2852 $stype =
"text_block";
2857 $sname = $node->getAttribute(
"Characteristic");
2863 $sname = $node->getAttribute(
"Class");
2864 $stype =
"media_cont";
2869 $sname = $node->getAttribute(
"Class");
2870 $stype =
"flist_li";
2875 $sname = $node->getAttribute(
"Template");
2877 $sname = $node->getAttribute(
"Class");
2887 $sname = $node->getAttribute(
"Class");
2888 $stype =
"table_cell";
2893 $sname = $node->getAttribute(
"Template");
2895 if ($node->getAttribute(
"Type") ==
"HorizontalAccordion") {
2896 $stype =
"haccordion";
2898 if ($node->getAttribute(
"Type") ==
"VerticalAccordion") {
2899 $stype =
"vaccordion";
2906 $sname = $node->getAttribute(
"Class");
2907 if ($node->getAttribute(
"Type") ==
"Ordered") {
2915 if ($sname !=
"" && $stype !=
"") {
2916 $usages[$sname .
":" . $stype .
":" . $template] = array(
"sname" => $sname,
2918 "template" => $template
2925 foreach ($usages as $u) {
2926 $id = $this->db->nextId(
'page_style_usage');
2927 $this->db->manipulate(
"INSERT INTO page_style_usage " .
2928 "(id, page_id, page_type, page_lang, page_nr, template, stype, sname) VALUES (" .
2929 $this->db->quote($id,
"integer") .
"," .
2930 $this->db->quote($this->
getId(),
"integer") .
"," .
2932 $this->db->quote($this->
getLanguage(),
"text") .
"," .
2933 $this->db->quote($a_old_nr,
"integer") .
"," .
2934 $this->db->quote($u[
"template"],
"integer") .
"," .
2935 $this->db->quote($u[
"stype"],
"text") .
"," .
2936 $this->db->quote(
ilStr::subStr($u[
"sname"], 0, 30),
"text") .
2947 if ($a_old_nr !== 0) {
2948 $and_old_nr =
" AND page_nr = " . $this->db->quote($a_old_nr,
"integer");
2951 $this->db->manipulate(
2952 "DELETE FROM page_style_usage WHERE " .
2953 " page_id = " . $this->db->quote($this->getId(),
"integer") .
2954 " AND page_type = " . $this->db->quote($this->getParentType(),
"text") .
2955 " AND page_lang = " . $this->db->quote($this->getLanguage(),
"text") .
2972 $files = ilObjFile::_getFilesOfObject(
2976 $objs = array_merge(
$mobs, $files);
3003 $nodes = $xpath->query(
'//IntLink');
3004 foreach ($nodes as $node) {
3005 $link_type = $node->getAttribute(
"Type");
3007 switch ($link_type) {
3008 case "StructureObject":
3016 case "GlossaryItem":
3024 case "RepositoryItem":
3036 case "PortfolioPage":
3045 $target = $node->getAttribute(
"Target");
3050 if (is_int(strpos($target,
"__"))) {
3072 public function create(
bool $a_import =
false): void
3085 bool $a_update =
true,
3086 string $a_pcid =
"",
3087 bool $move_operation =
false 3090 $this->handleDeleteContent($curr_node, $move_operation);
3091 $curr_node->unlink_node($curr_node);
3107 bool $a_update =
true,
3108 bool $a_self_ass =
false,
3109 bool $move_operation =
false 3111 if (!is_array($a_hids)) {
3114 foreach ($a_hids as $a_hid) {
3115 $a_hid = explode(
":", $a_hid);
3120 if (!$this->
checkForTag(
"Question", $a_hid[0], (
string) ($a_hid[1] ??
"")) || $a_self_ass) {
3121 $curr_node = $this->
getContentNode((
string) $a_hid[0], (
string) ($a_hid[1] ??
""));
3122 if (is_object($curr_node)) {
3123 $parent_node = $curr_node->parent_node();
3124 if ($parent_node->node_name() !=
"TableRow") {
3125 $this->handleDeleteContent($curr_node, $move_operation);
3126 $curr_node->unlink_node($curr_node);
3162 if (!is_array($a_hids)) {
3166 $time = date(
"Y-m-d H:i:s", time());
3168 $hier_ids = array();
3170 foreach ($a_hids as $a_hid) {
3174 $a_hid = explode(
":", $a_hid);
3178 foreach ($hier_ids as $h) {
3179 if ($h .
"_" == substr($a_hid[0], 0, strlen($h) + 1)) {
3180 $skip[] = $a_hid[0];
3182 if ($a_hid[0] .
"_" == substr($h, 0, strlen($a_hid[0]) + 1)) {
3186 $pc_id[$a_hid[0]] = $a_hid[1];
3187 if ($a_hid[0] !=
"") {
3188 $hier_ids[$a_hid[0]] = $a_hid[0];
3191 foreach ($skip as $s) {
3192 unset($hier_ids[$s]);
3196 foreach ($hier_ids as $hid) {
3198 if (is_object($curr_node)) {
3199 if ($curr_node->node_name() ==
"PageContent") {
3200 $content = $this->dom->dump_node($curr_node);
3202 $content = preg_replace(
'/PCID=\"[a-z0-9]*\"/i',
"", $content);
3203 $content = preg_replace(
'/HierId=\"[a-z0-9_]*\"/i',
"", $content);
3220 bool $a_self_ass =
false 3224 $a_hid = explode(
":", $a_hier_id);
3229 for (
$i = count($content) - 1;
$i >= 0;
$i--) {
3232 '<?xml version="1.0" encoding="UTF-8"?>' .
$c,
3236 if (empty($error)) {
3239 $path =
"//PageContent";
3241 if (count(
$res->nodeset) > 0) {
3242 $new_pc_node =
$res->nodeset[0];
3243 $cloned_pc_node = $new_pc_node->clone_node(
true);
3244 $cloned_pc_node->unlink_node($cloned_pc_node);
3268 bool $a_update =
true,
3269 bool $a_self_ass =
false 3271 if (!is_array($a_hids)) {
3275 foreach ($a_hids as $a_hid) {
3276 $a_hid = explode(
":", $a_hid);
3278 if (is_object($curr_node)) {
3279 if ($curr_node->node_name() ==
"PageContent") {
3281 if ($cont_obj->isEnabled()) {
3283 if (!$this->
checkForTag(
"Question", $a_hid[0], (
string) $a_hid[1]) || $a_self_ass) {
3284 $cont_obj->disable();
3287 $cont_obj->enable();
3310 bool $a_update =
true 3315 foreach ($hier_ids as $hier_id) {
3317 if (!is_int(strpos($hier_id,
"_"))) {
3318 if ($hier_id !=
"pg" && $hier_id >= $a_hid) {
3320 $this->handleDeleteContent($curr_node,
true);
3321 $curr_node->unlink_node($curr_node);
3342 bool $a_update =
true 3347 foreach ($hier_ids as $hier_id) {
3349 if (!is_int(strpos($hier_id,
"_"))) {
3350 if ($hier_id !=
"pg" && $hier_id < $a_hid) {
3352 $this->handleDeleteContent($curr_node,
true);
3353 $curr_node->unlink_node($curr_node);
3374 $copy_ids = array();
3377 foreach ($hier_ids as $hier_id) {
3379 if (!is_int(strpos($hier_id,
"_"))) {
3380 if ($hier_id !=
"pg" && $hier_id >= $a_hid) {
3381 $copy_ids[] = $hier_id;
3388 $target_dom = $a_target_page->
getDom();
3389 $parent_childs = $parent_node->child_nodes();
3390 $cnt_parent_childs = count($parent_childs);
3392 $first_child = $parent_childs[0];
3393 foreach ($copy_ids as $copy_id) {
3396 $new_node = $source_node->clone_node(
true);
3397 $new_node->unlink_node($new_node);
3399 $source_node->unlink_node($source_node);
3401 if ($cnt_parent_childs == 0) {
3402 $new_node = $parent_node->append_child($new_node);
3405 $new_node = $first_child->insert_before($new_node, $first_child);
3407 $parent_childs = $parent_node->child_nodes();
3412 $a_target_page->
update();
3413 $a_source_page->
update();
3423 string $a_pcid =
"",
3424 bool $remove_placeholder =
true 3426 if ($a_pcid ==
"" && $a_pos ==
"") {
3431 $curr_name = $curr_node->node_name();
3434 if (($curr_name ==
"TableData") || ($curr_name ==
"PageObject") ||
3435 ($curr_name ==
"ListItem") || ($curr_name ==
"Section")
3436 || ($curr_name ==
"Tab") || ($curr_name ==
"ContentPopup")
3437 || ($curr_name ==
"GridCell")) {
3441 $hid = $curr_node->get_attribute(
"HierId");
3449 $pos = explode(
"_", $a_pos);
3450 $target_pos = array_pop($pos);
3451 $parent_pos = implode(
"_", $pos);
3454 $parent_pos = $a_pos;
3458 if ($parent_pos !=
"") {
3461 $parent_node = $this->
getNode();
3465 $parent_childs = $parent_node->child_nodes();
3466 $cnt_parent_childs = count($parent_childs);
3471 $new_node = $a_cont_obj->
getNode();
3475 if ($succ_node = $curr_node->next_sibling()) {
3476 $new_node = $succ_node->insert_before($new_node, $succ_node);
3479 $new_node = $parent_node->append_child($new_node);
3481 $a_cont_obj->
setNode($new_node);
3486 $new_node = $a_cont_obj->
getNode();
3488 $new_node = $succ_node->insert_before($new_node, $succ_node);
3489 $a_cont_obj->
setNode($new_node);
3495 $new_node = $a_cont_obj->
getNode();
3496 if ($cnt_parent_childs == 0) {
3497 $new_node = $parent_node->append_child($new_node);
3499 $new_node = $parent_childs[0]->insert_before($new_node, $parent_childs[0]);
3501 $a_cont_obj->
setNode($new_node);
3507 if ($remove_placeholder && !$this->
getPageConfig()->getEnablePCType(
"PlaceHolder")) {
3508 $sub_nodes = $curr_node->child_nodes();
3509 foreach ($sub_nodes as $sub_node) {
3510 if ($sub_node->node_name() ==
"PlaceHolder") {
3511 $curr_node->unlink_node();
3528 $curr_name = $curr_node->node_name();
3530 if (($curr_name ==
"TableData") || ($curr_name ==
"PageObject") ||
3531 ($curr_name ==
"ListItem") || ($curr_name ==
"Section")
3532 || ($curr_name ==
"Tab") || ($curr_name ==
"ContentPopup")
3533 || ($curr_name ==
"GridCell")) {
3537 $hid = $curr_node->get_attribute(
"HierId");
3544 $pos = explode(
"_", $a_pos);
3545 $target_pos = array_pop($pos);
3546 $parent_pos = implode(
"_", $pos);
3549 $parent_pos = $a_pos;
3553 if ($parent_pos !=
"") {
3556 $parent_node = $this->
getNode();
3560 $parent_childs = $parent_node->child_nodes();
3561 $cnt_parent_childs = count($parent_childs);
3566 if ($succ_node = $curr_node->next_sibling()) {
3567 $a_cont_node = $succ_node->
insert_before($a_cont_node, $succ_node);
3569 $a_cont_node = $parent_node->
append_child($a_cont_node);
3577 $a_cont_node = $succ_node->
insert_before($a_cont_node, $succ_node);
3584 if ($cnt_parent_childs == 0) {
3585 $a_cont_node = $parent_node->
append_child($a_cont_node);
3587 $a_cont_node = $parent_childs[0]->
insert_before($a_cont_node, $parent_childs[0]);
3609 string $a_spcid =
"",
3610 string $a_tpcid =
"" 3612 if ($a_source == $a_target) {
3618 $source_node = $content->getNode();
3619 $clone_node = $source_node->clone_node(
true);
3625 $content->setNode($clone_node);
3645 string $a_spcid =
"",
3646 string $a_tpcid =
"" 3649 if ($a_source === $a_target) {
3655 $source_node = $content->getNode();
3656 $clone_node = $source_node->clone_node(
true);
3662 $content->setNode($clone_node);
3673 $a_content = preg_replace(
'/\[com\]/i',
"<Comment>", $a_content);
3674 $a_content = preg_replace(
'/\[\/com\]/i',
"</Comment>", $a_content);
3675 $a_content = preg_replace(
'/\[emp]/i',
"<Emph>", $a_content);
3676 $a_content = preg_replace(
'/\[\/emp\]/i',
"</Emph>", $a_content);
3677 $a_content = preg_replace(
'/\[str]/i',
"<Strong>", $a_content);
3678 $a_content = preg_replace(
'/\[\/str\]/i',
"</Strong>", $a_content);
3689 bool $a_res_ref_to_obj_id =
true 3693 $path =
"//IntLink";
3695 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
3696 $target =
$res->nodeset[
$i]->get_attribute(
"Target");
3699 if (substr($target, 0, 4) ==
"il__") {
3700 $id = substr($target, 4, strlen($target) - 4);
3704 if ($a_res_ref_to_obj_id &&
$type ==
"RepositoryItem") {
3705 $id_arr = explode(
"_", $id);
3719 $id = $otype .
"_" . $obj_id .
"_" .
$ref_id;
3723 $new_target =
"il_" . $a_inst .
"_" .
$id;
3724 $res->nodeset[
$i]->set_attribute(
"Target", $new_target);
3733 $path =
"//MediaAlias";
3735 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
3736 $origin_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
3737 if (substr($origin_id, 0, 4) ==
"il__") {
3738 $new_id =
"il_" . $a_inst .
"_" . substr($origin_id, 4, strlen($origin_id) - 4);
3739 $res->nodeset[
$i]->set_attribute(
"OriginId", $new_id);
3746 $path =
"//FileItem/Identifier";
3748 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
3749 $origin_id =
$res->nodeset[
$i]->get_attribute(
"Entry");
3750 if (substr($origin_id, 0, 4) ==
"il__") {
3751 $new_id =
"il_" . $a_inst .
"_" . substr($origin_id, 4, strlen($origin_id) - 4);
3752 $res->nodeset[
$i]->set_attribute(
"Entry", $new_id);
3759 $path =
"//Question";
3761 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
3762 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
3764 if (substr($qref, 0, 4) ==
"il__") {
3765 $new_id =
"il_" . $a_inst .
"_" . substr($qref, 4, strlen($qref) - 4);
3767 $res->nodeset[
$i]->set_attribute(
"QRef", $new_id);
3774 $path =
"//ContentInclude";
3776 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
3777 $ci =
$res->nodeset[
$i]->get_attribute(
"InstId");
3779 $res->nodeset[
$i]->set_attribute(
"InstId", $a_inst);
3794 foreach ($this->id_elements as $el) {
3795 $path .= $sep .
"//" . $el .
"[not(@PCID)]";
3797 $path .= $sep .
"//" . $el .
"[@PCID='']";
3803 if (count(
$res->nodeset) > 0) {
3820 foreach ($this->id_elements as $el) {
3821 $path .= $sep .
"//" . $el .
"[@PCID]";
3829 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
3830 $node =
$res->nodeset[
$i];
3839 return count($duplicates) > 0;
3855 foreach ($this->id_elements as $el) {
3856 $path .= $sep .
"//" . $el .
"[@PCID]";
3864 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
3865 $node =
$res->nodeset[
$i];
3868 if (isset($pcids[$pc_id])) {
3869 $duplicates[] = $pc_id;
3871 $pcids[$pc_id] = $pc_id;
3883 foreach ($this->id_elements as $el) {
3884 $path .= $sep .
"//" . $el .
"[@PCID='" . $a_pc_id .
"']";
3891 return (count(
$res->nodeset) > 0);
3896 $id = self::randomhash();
3910 foreach ($this->id_elements as $el) {
3911 $path .= $sep .
"//" . $el .
"[not(@PCID)]";
3913 $path .= $sep .
"//" . $el .
"[@PCID='']";
3919 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
3920 $id = self::randomhash();
3921 $res->nodeset[
$i]->set_attribute(
"PCID", $id);
3935 $path =
"//PageContent";
3940 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
3941 $hier_id =
$res->nodeset[
$i]->get_attribute(
"HierId");
3942 $pc_id =
$res->nodeset[
$i]->get_attribute(
"PCID");
3943 $dump = $mydom->dump_node(
$res->nodeset[
$i]);
3944 if (($hpos = strpos($dump,
' HierId="' . $hier_id .
'"')) > 0) {
3945 $dump = substr($dump, 0, $hpos) .
3946 substr($dump, $hpos + strlen(
' HierId="' . $hier_id .
'"'));
3949 $childs =
$res->nodeset[
$i]->child_nodes();
3951 if ($childs[0] && $childs[0]->node_name() ==
"Paragraph") {
3952 $content = $mydom->dump_node($childs[0]);
3955 strpos($content,
">") + 1,
3956 strrpos($content,
"<") - (strpos($content,
">") + 1)
3961 array(
"hier_id" => $hier_id,
"hash" => md5($dump),
"content" => $content);
3977 $path =
"//Question";
3982 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
3983 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
3987 if (!($inst_id > 0)) {
4007 $path =
"/descendant::Paragraph[position() = $par_id]";
4011 if (count(
$res->nodeset) != 1) {
4012 die(
"Should not happen");
4015 $context_node =
$res->nodeset[0];
4019 $childs = $context_node->child_nodes();
4021 for ($j = 0, $jMax = count($childs); $j < $jMax; $j++) {
4022 $content .= $mydom->dump_node($childs[$j]);
4025 $content = str_replace(
"<br />",
"\n", $content);
4026 $content = str_replace(
"<br/>",
"\n", $content);
4028 $plain_content = html_entity_decode($content);
4041 $xsl = file_get_contents(
"./Services/COPage/xsl/page_fo.xsl");
4042 $args = array(
'/_xml' => $xml,
'/_xsl' => $xsl);
4047 $fo = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl", null, $args,
$params);
4050 $fo = str_replace(
"\n",
"", $fo);
4051 $fo = str_replace(
"<br/>",
"<br>", $fo);
4052 $fo = str_replace(
"<br>",
"\n", $fo);
4057 $fo = substr($fo, strpos($fo,
">") + 1);
4064 $this->offline_handler = $handler;
4077 string $a_parent_type,
4078 string $a_lang =
"-" 4082 $db = $DIC->database();
4084 if ($a_lang ==
"") {
4088 $query =
"SELECT * FROM page_object WHERE page_id = " .
4089 $db->
quote($a_id,
"integer") .
" AND " .
4090 " parent_type = " . $db->
quote($a_parent_type,
"text") .
" AND " .
4091 " lang = " . $db->
quote($a_lang,
"text") .
" AND " .
4092 " inactive_elements = " . $db->
quote(1,
"integer");
4107 if (strpos($a_content,
" Enabled=\"False\"")) {
4120 $h_query =
"SELECT * FROM page_history " .
4121 " WHERE page_id = " . $db->
quote($this->
getId(),
"integer") .
4124 " ORDER BY hdate DESC";
4126 $hset = $db->
query($h_query);
4127 $hentries = array();
4130 $hrec[
"sortkey"] = (
int) $hrec[
"nr"];
4131 $hrec[
"user"] = (
int) $hrec[
"user_id"];
4132 $hentries[] = $hrec;
4146 "SELECT * FROM page_history " .
4147 " WHERE page_id = %s " .
4148 " AND parent_type = %s " .
4151 array(
"integer",
"text",
"integer",
"text"),
4171 $and_nr = ($a_nr > 0)
4172 ?
" AND nr < " . $db->
quote($a_nr,
"integer")
4174 $res = $db->
query(
"SELECT MAX(nr) mnr FROM page_history " .
4175 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
4176 " AND parent_type = " . $db->
quote($this->getParentType(),
"text") .
4177 " AND lang = " . $db->
quote($this->getLanguage(),
"text") .
4180 if ($row[
"mnr"] > 0) {
4181 $res = $db->
query(
"SELECT * FROM page_history " .
4182 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
4183 " AND parent_type = " . $db->
quote($this->getParentType(),
"text") .
4184 " AND lang = " . $db->
quote($this->getLanguage(),
"text") .
4185 " AND nr = " . $db->
quote((
int) $row[
"mnr"],
"integer"));
4187 $ret[
"previous"] = $row;
4191 $res = $db->
query(
"SELECT MIN(nr) mnr FROM page_history " .
4192 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
4193 " AND parent_type = " . $db->
quote($this->getParentType(),
"text") .
4194 " AND lang = " . $db->
quote($this->getLanguage(),
"text") .
4195 " AND nr > " . $db->
quote($a_nr,
"integer"));
4197 if ($row[
"mnr"] > 0) {
4198 $res = $db->
query(
"SELECT * FROM page_history " .
4199 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
4200 " AND parent_type = " . $db->
quote($this->getParentType(),
"text") .
4201 " AND lang = " . $db->
quote($this->getLanguage(),
"text") .
4202 " AND nr = " . $db->
quote((
int) $row[
"mnr"],
"integer"));
4204 $ret[
"next"] = $row;
4209 $res = $db->
query(
"SELECT * FROM page_history " .
4210 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
4211 " AND parent_type = " . $db->
quote($this->getParentType(),
"text") .
4212 " AND lang = " . $db->
quote($this->getLanguage(),
"text") .
4213 " AND nr = " . $db->
quote($a_nr,
"integer"));
4215 $res = $db->
query(
"SELECT page_id, last_change hdate, parent_type, parent_id, last_change_user user_id, content, lang FROM page_object " .
4216 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
4217 " AND parent_type = " . $db->
quote($this->getParentType(),
"text") .
4218 " AND lang = " . $db->
quote($this->getLanguage(),
"text"));
4221 $ret[
"current"] = $row;
4231 $rnode =
$res->nodeset[0];
4233 foreach ($a_hashes as $h) {
4234 if (($h[
"change"] ??
"") !=
"") {
4235 $dc_node = $this->dom->create_element(
"DivClass");
4236 $dc_node->set_attribute(
"HierId", $h[
"hier_id"]);
4237 $dc_node->set_attribute(
"Class",
"ilEdit" . $h[
"change"]);
4238 $dc_node = $rnode->append_child($dc_node);
4257 $l_hashes = $l_page->getPageContentsHashes();
4258 $r_hashes = $r_page->getPageContentsHashes();
4260 foreach ($l_hashes as $pc_id => $h) {
4261 if (!isset($r_hashes[$pc_id])) {
4262 $l_hashes[$pc_id][
"change"] =
"Deleted";
4264 if ($h[
"hash"] != $r_hashes[$pc_id][
"hash"]) {
4265 $l_hashes[$pc_id][
"change"] =
"Modified";
4266 $r_hashes[$pc_id][
"change"] =
"Modified";
4269 if ($l_hashes[$pc_id][
"content"] !=
"" &&
4270 $r_hashes[$pc_id][
"content"] !=
"") {
4271 $new_left = str_replace(
"\n",
"<br />", $l_hashes[$pc_id][
"content"]);
4272 $new_right = str_replace(
"\n",
"<br />", $r_hashes[$pc_id][
"content"]);
4277 $new_left = $wldiff->orig();
4278 $new_right = $wldiff->closing();
4279 $l_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_left[0]);
4280 $r_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_right[0]);
4287 foreach ($r_hashes as $pc_id => $h) {
4288 if (!isset($l_hashes[$pc_id])) {
4289 $r_hashes[$pc_id][
"change"] =
"New";
4292 $l_page->addChangeDivClasses($l_hashes);
4293 $r_page->addChangeDivClasses($r_hashes);
4295 return array(
"l_page" => $l_page,
4296 "r_page" => $r_page,
4297 "l_changes" => $l_hashes,
4298 "r_changes" => $r_hashes
4314 " SET view_cnt = view_cnt + 1 " .
4315 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
4316 " AND parent_type = " . $db->
quote($this->getParentType(),
"text") .
4317 " AND lang = " . $db->
quote($this->getLanguage(),
"text"));
4327 string $a_parent_type,
4334 $db = $DIC->database();
4337 if ($a_lang !=
"") {
4338 $and_lang =
" AND lang = " . $db->
quote($a_lang,
"text");
4341 $page_changes = array();
4342 $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
4343 $q =
"SELECT * FROM page_object " .
4344 " WHERE parent_id = " . $db->
quote($a_parent_id,
"integer") .
4345 " AND parent_type = " . $db->
quote($a_parent_type,
"text") .
4346 " AND last_change >= " . $db->
quote($limit_ts,
"timestamp") . $and_lang;
4348 $set = $db->
query($q);
4350 $page_changes[] = array(
4351 "date" => $page[
"last_change"],
4352 "id" => $page[
"page_id"],
4353 "lang" => $page[
"lang"],
4355 "user" => $page[
"last_change_user"]
4360 if ($a_period > 0) {
4361 $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
4362 $and_str =
" AND hdate >= " . $db->
quote($limit_ts,
"timestamp") .
" ";
4365 $q =
"SELECT * FROM page_history " .
4366 " WHERE parent_id = " . $db->
quote($a_parent_id,
"integer") .
4367 " AND parent_type = " . $db->
quote($a_parent_type,
"text") .
4368 $and_str . $and_lang;
4369 $set = $db->
query($q);
4371 $page_changes[] = array(
4372 "date" => $page[
"hdate"],
4373 "id" => $page[
"page_id"],
4374 "lang" => $page[
"lang"],
4376 "nr" => $page[
"nr"],
4377 "user" => $page[
"user_id"]
4383 return $page_changes;
4390 string $a_parent_type,
4392 string $a_lang =
"-" 4396 $db = $DIC->database();
4399 if ($a_lang !=
"") {
4400 $and_lang =
" AND lang = " . $db->
quote($a_lang,
"text");
4403 $q =
"SELECT * FROM page_object " .
4404 " WHERE parent_id = " . $db->
quote($a_parent_id,
"integer") .
4405 " AND parent_type = " . $db->
quote($a_parent_type,
"text") . $and_lang;
4406 $set = $db->
query($q);
4409 $key_add = ($a_lang ==
"")
4410 ?
":" . $page[
"lang"]
4412 $pages[$page[
"page_id"] . $key_add] = array(
4413 "date" => $page[
"last_change"],
4414 "id" => $page[
"page_id"],
4415 "lang" => $page[
"lang"],
4416 "user" => $page[
"last_change_user"]
4427 string $a_parent_type,
4429 string $a_lang =
"-" 4433 $db = $DIC->database();
4436 if ($a_lang !=
"") {
4437 $and_lang =
" AND lang = " . $db->
quote($a_lang,
"text");
4442 $q =
"SELECT * FROM page_object " .
4443 " WHERE parent_id = " . $db->
quote($a_parent_id,
"integer") .
4444 " AND parent_type = " . $db->
quote($a_parent_type,
"text") . $and_lang .
4445 " ORDER BY created DESC";
4446 $set = $db->
query($q);
4448 if ($page[
"created"] !=
"") {
4450 "created" => $page[
"created"],
4451 "id" => $page[
"page_id"],
4452 "lang" => $page[
"lang"],
4453 "user" => $page[
"create_user"],
4467 string $a_parent_type,
4469 string $a_lang =
"-" 4473 $db = $DIC->database();
4476 if ($a_lang !=
"") {
4477 $and_lang =
" AND lang = " . $db->
quote($a_lang,
"text");
4480 $contributors = array();
4482 "SELECT last_change_user, lang, page_id FROM page_object " .
4483 " WHERE parent_id = %s AND parent_type = %s " .
4484 " AND last_change_user != %s" . $and_lang,
4485 array(
"integer",
"text",
"integer"),
4486 array($a_parent_id, $a_parent_type, 0)
4490 if ($a_lang ==
"") {
4491 $contributors[$page[
"last_change_user"]][$page[
"page_id"]][$page[
"lang"]] = 1;
4493 $contributors[$page[
"last_change_user"]][$page[
"page_id"]] = 1;
4498 "SELECT count(*) as cnt, lang, page_id, user_id FROM page_history " .
4499 " WHERE parent_id = %s AND parent_type = %s AND user_id != %s " . $and_lang .
4500 " GROUP BY page_id, user_id, lang ",
4501 array(
"integer",
"text",
"integer"),
4502 array($a_parent_id, $a_parent_type, 0)
4505 if ($a_lang ==
"") {
4506 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]][$hpage[
"lang"]] =
4507 ($contributors[$hpage[
"user_id"]][$hpage[
"page_id"]][$hpage[
"lang"]] ?? 0) + $hpage[
"cnt"];
4509 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] =
4510 ($contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] ?? 0) + $hpage[
"cnt"];
4515 foreach ($contributors as $k => $co) {
4518 $c[] = array(
"user_id" => $k,
4520 "lastname" =>
$name[
"lastname"],
4521 "firstname" =>
$name[
"firstname"]
4533 string $a_parent_type,
4535 string $a_lang =
"-" 4539 $db = $DIC->database();
4542 if ($a_lang !=
"") {
4543 $and_lang =
" AND lang = " . $db->
quote($a_lang,
"text");
4546 $contributors = array();
4548 "SELECT last_change_user, lang FROM page_object " .
4549 " WHERE page_id = %s AND parent_type = %s " .
4550 " AND last_change_user != %s" . $and_lang,
4551 array(
"integer",
"text",
"integer"),
4552 array($a_page_id, $a_parent_type, 0)
4556 if ($a_lang ==
"") {
4557 $contributors[$page[
"last_change_user"]][$page[
"lang"]] = 1;
4559 $contributors[$page[
"last_change_user"]] = 1;
4564 "SELECT count(*) as cnt, lang, page_id, user_id FROM page_history " .
4565 " WHERE page_id = %s AND parent_type = %s AND user_id != %s " . $and_lang .
4566 " GROUP BY user_id, page_id, lang ",
4567 array(
"integer",
"text",
"integer"),
4568 array($a_page_id, $a_parent_type, 0)
4571 if ($a_lang ===
"") {
4572 $contributors[$hpage[
"user_id"]][$page[
"lang"]] =
4573 ($contributors[$hpage[
"user_id"]][$page[
"lang"]] ?? 0) + $hpage[
"cnt"];
4575 $contributors[$hpage[
"user_id"]] =
4576 ($contributors[$hpage[
"user_id"]] ?? 0) + $hpage[
"cnt"];
4581 foreach ($contributors as $k => $co) {
4583 $c[] = array(
"user_id" => $k,
4585 "lastname" =>
$name[
"lastname"],
4586 "firstname" =>
$name[
"firstname"]
4602 $db = $DIC->database();
4604 $db->
update(
"page_object", array(
4605 "rendered_content" => array(
"clob", $a_content),
4606 "render_md5" => array(
"text", $a_md5),
4607 "rendered_time" => array(
"timestamp",
ilUtil::now())
4609 "page_id" => array(
"integer", $this->
getId()),
4619 string $a_parent_type,
4621 string $a_lang =
"-" 4625 $db = $DIC->database();
4628 if ($a_lang !=
"") {
4629 $and_lang =
" AND lang = " . $db->
quote($a_lang,
"text");
4632 $q =
"SELECT * FROM page_object " .
4633 " WHERE parent_id = " . $db->
quote($a_parent_id,
"integer") .
4634 " AND parent_type = " . $db->
quote($a_parent_type,
"text") .
4635 " AND int_links = " . $db->
quote(1,
"integer") . $and_lang;
4636 $set = $db->
query($q);
4639 $key_add = ($a_lang ==
"")
4640 ?
":" . $page[
"lang"]
4642 $pages[$page[
"page_id"] . $key_add] = array(
4643 "date" => $page[
"last_change"],
4644 "id" => $page[
"page_id"],
4645 "lang" => $page[
"lang"],
4646 "user" => $page[
"last_change_user"]
4658 if (strpos($a_content,
"IntLink")) {
4687 $link_type =
"MediaObject";
4688 $a_id =
"il__mob_" . $a_id;
4692 $link_type =
"PageObject";
4693 $a_id =
"il__pg_" . $a_id;
4697 $link_type =
"GlossaryItem";
4698 $a_id =
"il__git_" . $a_id;
4699 $a_target =
"Glossary";
4705 $path =
"//PageObject/InitOpenedContent";
4707 if ($link_type ==
"" || $a_id ==
"") {
4708 if (count(
$res->nodeset) > 0) {
4709 $res->nodeset[0]->unlink_node(
$res->nodeset[0]);
4712 if (count(
$res->nodeset) > 0) {
4713 $init_node =
$res->nodeset[0];
4714 $childs = $init_node->child_nodes();
4715 for (
$i = 0, $iMax = count($childs);
$i < $iMax;
$i++) {
4716 if ($childs[
$i]->node_name() ==
"IntLink") {
4717 $il_node = $childs[
$i];
4721 $path =
"//PageObject";
4723 $page_node =
$res->nodeset[0];
4724 $init_node = $this->dom->create_element(
"InitOpenedContent");
4725 $init_node = $page_node->append_child($init_node);
4726 $il_node = $this->dom->create_element(
"IntLink");
4727 $il_node = $init_node->append_child($il_node);
4729 $il_node->set_attribute(
"Target", $a_id);
4730 $il_node->set_attribute(
"Type", $link_type);
4731 $il_node->set_attribute(
"TargetFrame", $a_target);
4746 $path =
"//PageObject/InitOpenedContent";
4749 if (count(
$res->nodeset) > 0) {
4750 $init_node =
$res->nodeset[0];
4751 $childs = $init_node->child_nodes();
4752 for (
$i = 0, $iMax = count($childs);
$i < $iMax;
$i++) {
4753 if ($childs[
$i]->node_name() ==
"IntLink") {
4754 $il_node = $childs[
$i];
4758 if (!is_null($il_node)) {
4759 $id = $il_node->get_attribute(
"Target");
4760 $link_type = $il_node->get_attribute(
"Type");
4761 $target = $il_node->get_attribute(
"TargetFrame");
4763 switch ($link_type) {
4772 case "GlossaryItem":
4777 return array(
"id" => $id,
"type" =>
$type,
"target" => $target);
4804 string $a_parent_type =
"",
4805 int $a_new_parent_id = 0,
4806 bool $a_clone_mobs =
false,
4807 int $obj_copy_id = 0
4809 if ($a_parent_type ==
"") {
4811 if ($a_new_parent_id == 0) {
4824 $new_page_object->setParentId($a_new_parent_id);
4825 $new_page_object->setId($a_id);
4827 $new_page_object->setXMLContent($orig_page->copyXMLContent($a_clone_mobs, $a_new_parent_id, $obj_copy_id));
4828 $new_page_object->setActive($orig_page->getActive());
4829 $new_page_object->setActivationStart($orig_page->getActivationStart());
4830 $new_page_object->setActivationEnd($orig_page->getActivationEnd());
4832 $new_page_object->buildDom();
4833 $new_page_object->update();
4835 $new_page_object->create(
false);
4844 string $a_parent_type,
4849 $db = $DIC->database();
4852 "SELECT lang FROM page_object " .
4853 " WHERE page_id = " . $db->
quote($a_id,
"integer") .
4854 " AND parent_type = " . $db->
quote($a_parent_type,
"text")
4858 $langs[] = $rec[
"lang"];
4867 string $a_target_lang
4875 $transl_page->setId($this->
getId());
4878 $transl_page->setActive($this->
getActive());
4881 $transl_page->create(
false);
4901 "UPDATE page_object SET " .
4902 " edit_lock_user = " . $db->
quote($user->
getId(),
"integer") .
"," .
4903 " edit_lock_ts = " . $db->
quote($ts,
"integer") .
4904 " WHERE (edit_lock_user = " . $db->
quote($user->
getId(),
"integer") .
" OR " .
4905 " edit_lock_ts < " . $db->
quote(time() - ($min * 60),
"integer") .
") " .
4906 " AND page_id = " . $db->
quote($this->
getId(),
"integer") .
4911 "SELECT edit_lock_user FROM page_object " .
4912 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
4913 " AND parent_type = " . $db->
quote($this->getParentType(),
"text")
4916 if ($rec[
"edit_lock_user"] != $user->
getId()) {
4933 $min = (
int) $aset->get(
"block_mode_minutes");
4938 "UPDATE page_object SET " .
4939 " edit_lock_user = " . $db->
quote($user->
getId(),
"integer") .
"," .
4940 " edit_lock_ts = 0" .
4941 " WHERE edit_lock_user = " . $db->
quote($user->
getId(),
"integer") .
4942 " AND page_id = " . $db->
quote($this->getId(),
"integer") .
4943 " AND parent_type = " . $db->
quote($this->getParentType(),
"text")
4947 "SELECT edit_lock_user FROM page_object " .
4948 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
4949 " AND parent_type = " . $db->
quote($this->getParentType(),
"text")
4952 if ($rec[
"edit_lock_user"] != $user->
getId()) {
4968 $min = (
int) $aset->get(
"block_mode_minutes");
4971 "SELECT edit_lock_user, edit_lock_ts FROM page_object " .
4972 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
4973 " AND parent_type = " . $db->
quote($this->getParentType(),
"text")
4976 $rec[
"edit_lock_until"] = $rec[
"edit_lock_ts"] + $min * 60;
4987 int $a_length = 100,
4988 string $a_ending =
'...',
4989 bool $a_exact =
false,
4990 bool $a_consider_html =
true 4993 if ($a_consider_html) {
4995 if (strlen(preg_replace(
'/<.*?>/',
'', $a_text)) <= $a_length) {
5000 $total_length = strlen($a_ending);
5001 $open_tags = array();
5003 preg_match_all(
'/(<.+?>)?([^<>]*)/s', $a_text, $lines, PREG_SET_ORDER);
5004 foreach ($lines as $line_matchings) {
5006 if (!empty($line_matchings[1])) {
5009 '/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is',
5014 elseif (preg_match(
'/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) {
5016 $pos = array_search($tag_matchings[1], $open_tags);
5017 if ($pos !==
false) {
5018 unset($open_tags[$pos]);
5021 elseif (preg_match(
'/^<\s*([^\s>!]+).*?>$/s', $line_matchings[1], $tag_matchings)) {
5023 array_unshift($open_tags, strtolower($tag_matchings[1]));
5026 $truncate .= $line_matchings[1];
5030 $content_length = strlen(preg_replace(
5031 '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i',
5035 if ($total_length + $content_length > $a_length) {
5037 $left = $a_length - $total_length;
5038 $entities_length = 0;
5041 '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i',
5047 foreach ($entities[0] as $entity) {
5048 if ($entity[1] + 1 - $entities_length <= $left) {
5050 $entities_length += strlen($entity[0]);
5064 $truncate .= $line_matchings[2];
5065 $total_length += $content_length;
5069 if ($total_length >= $a_length) {
5074 if (strlen($a_text) <= $a_length) {
5083 if (!count($open_tags)) {
5087 $spacepos = strrpos($truncate,
' ');
5088 if ($spacepos !==
false) {
5097 $truncate .= $a_ending;
5099 if ($a_consider_html) {
5101 foreach ($open_tags as $tag) {
5102 $truncate .=
'</' . $tag .
'>';
5122 string $a_parent_type,
5128 $db = $DIC->database();
5131 if ($a_lang !=
"") {
5132 $and_lang =
" AND lang = " . $db->
quote($a_lang,
"text");
5136 $q =
"SELECT last_change FROM page_object " .
5137 " WHERE parent_id = " . $db->
quote($a_parent_id,
"integer") .
5138 " AND parent_type = " . $db->
quote($a_parent_type,
"text") . $and_lang .
5139 " ORDER BY last_change DESC";
5141 $set = $db->
query($q);
5144 return $rec[
"last_change"];
5149 if ($this->
getPageConfig()->getEditLockSupport() ==
false) {
5154 $min = (
int) $aset->get(
"block_mode_minutes");
5164 $file_obj_ids = array();
5168 $path =
"//FileItem/Identifier";
5170 for (
$i = 0, $iMax = count(
$res->nodeset);
$i < $iMax;
$i++) {
5171 $file_obj_ids[] =
$res->nodeset[
$i]->get_attribute(
"Entry");
5174 return $file_obj_ids;
5204 $co_model = $co->getModel();
5205 if ($co_model !== null) {
5206 $model[$pc_id] = $co_model;
5226 if (is_array($targets)) {
5227 foreach ($targets as $t) {
5228 $tarr = explode(
":", $t);
5230 if (is_object($cont_obj) && $cont_obj->getType() ==
"par") {
5231 $cont_obj->setCharacteristic($char_par);
5233 if (is_object($cont_obj) && $cont_obj->getType() ==
"sec") {
5234 $cont_obj->setCharacteristic($char_sec);
5236 if (is_object($cont_obj) && $cont_obj->getType() ==
"media") {
5237 $cont_obj->setClass($char_med);
assignCharacteristic(array $targets, string $char_par, string $char_sec, string $char_med)
Assign characteristic.
xpath_eval(php4DOMXPath $xpath_context, string $eval_str, $contextnode=null)
getLastUpdateOfIncludedElements()
Get last update of included elements (media objects and files).
setRenderedContent(string $a_renderedcontent)
performAutomaticModifications()
Perform automatic modifications (may be overwritten by sub classes)
getActive(bool $a_check_scheduled_activation=false)
stripHierIDs()
strip all hierarchical id attributes out of the dom tree
addChangeDivClasses(array $a_hashes)
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
checkPCIds()
Check, whether (all) page content hashes are set.
static resolveResources(ilPageObject $page, array $ref_mappings)
static setAction(string $a_action)
cutContents(array $a_hids)
Copy contents to clipboard and cut them from the page.
increaseViewCnt()
Increase view cnt.
copyPageToTranslation(string $a_target_lang)
Copy page to translation.
getAllPCIds()
Get all pc ids.
getLangVarXML(string $var)
getPCModel()
Get page component model.
updateFromXML()
Updates page object with current xml content This function is currently (8 beta) called by: ...
getHistoryInfo(int $a_nr)
Get information about a history entry, its predecessor and its successor.
__beforeDelete()
Before deletion handler (internal).
releasePageLock()
Release page lock.
addFileSizes()
add file sizes
validateDom(bool $throw=false)
Validate the page content agains page DTD.
setContainsQuestion(bool $a_val)
resolveFileItems(array $a_mapping)
Resolve file items (after import)
setPageConfig(ilPageConfig $a_val)
newQuestionCopies(php4DOMDocument $temp_dom)
Replaces existing question content elements with new copies.
getDuplicatePCIds()
Get all duplicate PC Ids.
appendXMLContent(string $a_xml)
append xml content to page setXMLContent must be called before and the same encoding must be us...
buildDom(bool $a_force=false)
static getParentObjectContributors(string $a_parent_type, int $a_parent_id, string $a_lang="-")
Get all contributors for parent object.
create(bool $a_import=false)
create new page (with current xml data)
getFO()
get fo page content
getEffectiveEditLockTime()
manipulateF(string $query, array $types, array $values)
setImportMode(bool $a_val)
static deleteNewsOfContext(int $a_context_obj_id, string $a_context_obj_type, int $a_context_sub_obj_id=0, string $a_context_sub_obj_type="")
Delete all news of a context.
static getLogger(string $a_component_id)
Get component logger.
getHierIdForPcId(string $pcid)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static _getSourcesOfTarget(string $a_target_type, int $a_target_id, int $a_target_inst)
get all sources of a link target
static _removeInstFromTarget(string $a_target)
Removes installation id from target string.
static getPagesWithLinks(string $a_parent_type, int $a_parent_id, string $a_lang="-")
Get all pages for parent object that contain internal links.
deleteContentBeforeHierId(string $a_hid, bool $a_update=true)
delete content object with hierarchical id < $a_hid as part of the split page operation ...
static _isScheduledActivation(int $a_id, string $a_parent_type, string $a_lang="-")
Check whether page is activated by time schedule.
const ILIAS_VERSION_NUMERIC
newMobCopies(php4DOMDocument $temp_dom)
Replaces media objects with copies.
static _extractObjIdOfTarget(string $a_target)
Extract object id out of target.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS COPage ReadingTime ReadingTimeManager $reading_time_manager
if($clientAssertionType !='urn:ietf:params:oauth:client-assertion-type:jwt-bearer'|| $grantType !='client_credentials') $parts
fetchAssoc(ilDBStatement $statement)
static _before(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getContentNode(string $a_hier_id, string $a_pc_id="")
if(! $DIC->user() ->getId()||!ilLTIConsumerAccess::hasCustomProviderCreationAccess()) $params
getFirstColumnIds()
get ids of all first table columns
addToPCClipboard(string $a_content, string $a_time, int $a_nr)
Add a page content item to PC clipboard (should go to another class)
resolveIntLinks(array $a_link_map=null)
Resolves all internal link targets of the page, if targets are available (after import) ...
update(bool $a_validate=true, bool $a_no_history=false)
update complete page content in db (dom xml content is used)
update(string $table_name, array $values, array $where)
$where MUST contain existing columns only.
insertContentNode(php4DOMElement $a_cont_node, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="")
insert a content node before/after a sibling or as first child of a parent
static array $activation_data
static _existsAndNotEmpty(string $a_parent_type, int $a_id, string $a_lang="-")
Checks whether page exists and is not empty (may return true on some empty pages) ...
static _writeParentId(string $a_parent_type, int $a_pg_id, int $a_par_id)
getPCIdForHierId(string $hier_id)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static getPCDefinitions()
static _lookupName(int $a_user_id)
lookup user name
static xml2output(string $a_text, bool $a_wysiwyg=false, bool $a_replace_lists=true, bool $unmask=true)
Converts xml from DB to output in edit textarea.
removeQuestions(php4DOMDocument $temp_dom)
Remove questions from document.
static getPCDefinitionByName(string $a_pc_name)
Get PC definition by name.
saveStyleUsage(DOMDocument $a_domdoc, int $a_old_nr=0)
Save all style class/template usages.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
handleImportRepositoryLink(string $a_rep_import_id, string $a_rep_type, int $a_rep_ref_id)
getContentObjectForPcId(string $pcid)
Get content object for pc id.
copy(int $a_id, string $a_parent_type="", int $a_new_parent_id=0, bool $a_clone_mobs=false, int $obj_copy_id=0)
Copy page.
getQuestionIds()
Get question ids.
static getPageContributors(string $a_parent_type, int $a_page_id, string $a_lang="-")
Get all contributors for parent object.
static _lookupActivationData(int $a_id, string $a_parent_type, string $a_lang="-")
Lookup activation data.
getHistoryEntries()
Get History Entries.
quote($value, string $type)
newIIMCopies(php4DOMDocument $temp_dom)
Replaces media objects in interactive images with copies of the interactive images.
ilPageConfig $page_config
static subStr(string $a_str, int $a_start, ?int $a_length=null)
beforePageContentUpdate(ilPageContent $a_page_content)
Before page content update Note: This one is "work in progress", currently only text paragraphs call ...
preparePageForCompare(ilPageObject $page)
static deliverData(string $a_data, string $a_filename, string $mime="application/octet-stream")
static lookupTranslations(string $a_parent_type, int $a_id)
Lookup translations.
resolveIIMMediaAliases(array $a_mapping)
Resolve iim media aliases (in ilContObjParse)
static now()
Return current timestamp in Y-m-d H:i:s format.
getPageContentsHashes()
Get page contents hashes.
setLimit(int $limit, int $offset=0)
getInternalLinks(bool $a_cnt_multiple=false)
get all internal links that are used within the page
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
moveContentBefore(string $a_source, string $a_target, string $a_spcid="", string $a_tpcid="")
move content object from position $a_source before position $a_target (both hierarchical content ids)...
handleRepositoryLinksOnCopy(array $a_mapping, int $a_source_ref_id)
Handle repository links on copy process.
getFileItemIds()
get ids of all file items
static _saveLink(string $a_source_type, int $a_source_id, string $a_target_type, int $a_target_id, int $a_target_inst=0, string $a_source_lang="-")
save internal link information
deleteContent(string $a_hid, bool $a_update=true, string $a_pcid="", bool $move_operation=false)
delete content object with hierarchical id $a_hid
static _lookupObjId(int $ref_id)
isGrandChild(int $a_startnode_id, int $a_querynode_id)
checks if a node is in the path of an other node
static _extractInstOfTarget(string $a_target)
Extract installation id out of target.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setXMLContent(string $a_xml, string $a_encoding="UTF-8")
set xml content of page, start with <PageObject...>, end with </PageObject>, comply with ILIAS DTD...
deleteStyleUsages(int $a_old_nr=0)
Delete style usages.
static _lookupContainsDeactivatedElements(int $a_id, string $a_parent_type, string $a_lang="-")
lookup whether page contains deactivated elements
static shortenText(string $a_string, int $a_start_pos, int $a_num_bytes, string $a_encoding='UTF-8')
Shorten text to the given number of bytes.
xpath_new_context($dom_document)
parses the objects.xml it handles the xml-description of all ilias objects
resolveResources(array $ref_mapping)
Resolve resources.
static _lookupImportId(int $obj_id)
getHierIdsForPCIds(array $a_pc_ids)
Get hier ids for a set of pc ids.
saveInternalLinks(DOMDocument $a_domdoc)
save internal links of page
deleteContentFromHierId(string $a_hid, bool $a_update=true)
delete content object with hierarchical id >= $a_hid as part of a split page operation ...
static _exists(int $id, bool $reference=false, ?string $type=null)
checks if an object exists in object_data
static truncateHTML(string $a_text, int $a_length=100, string $a_ending='...', bool $a_exact=false, bool $a_consider_html=true)
Truncate (html) string.
getParentContentObjectForPcId(string $pcid)
Get parent content object for pc id.
static getNewPages(string $a_parent_type, int $a_parent_id, string $a_lang="-")
Get new pages.
static _existsAndNotEmpty(string $a_parent_type, int $a_id, string $a_lang="-")
checks whether page exists and is not empty (may return true on some empty pages) ...
copyXmlContent(bool $a_clone_mobs=false, int $a_new_parent_id=0, int $obj_copy_id=0, bool $self_ass=true)
Copy content of page; replace page components with copies where necessary (e.g.
containsIntLinks(string $a_content)
Check whether content contains internal links.
saveInitialOpenedContent(string $a_type, int $a_id, string $a_target)
Save initial opened content.
getXMLFromDom(bool $a_incl_head=false, bool $a_append_mobs=false, bool $a_append_bib=false, string $a_append_str="", bool $a_omit_pageobject_tag=false, int $style_id=0)
get xml content of page from dom (use this, if any changes are made to the document) ...
insertInstIntoIDs(string $a_inst, bool $a_res_ref_to_obj_id=true)
inserts installation id into ids (e.g.
domxml_open_mem($str, $mode=0, &$error=null)
setActivationStart(?string $a_activationstart)
static _after(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
writeRenderedContent(string $a_content, string $a_md5)
Write rendered content.
deleteInternalLinks()
Delete internal links.
static getRecentChanges(string $a_parent_type, int $a_parent_id, int $a_period=30, string $a_lang="")
Get recent pages changes for parent object.
static _exists(string $a_parent_type, int $a_id, string $a_lang="", bool $a_no_cache=false)
Checks whether page exists.
checkForTag(string $a_content_tag, string $a_hier_id, string $a_pc_id="")
Get content node from dom.
insertContent(ilPageContent $a_cont_obj, string $a_pos, int $a_mode=IL_INSERT_AFTER, string $a_pcid="", bool $remove_placeholder=true)
insert a content node before/after a sibling or as first child of a parent
static _deleteAllLinksOfSource(string $a_source_type, int $a_source_id, string $a_lang="-")
Delete all links of a given source.
getListItemIds()
get ids of all list items
resolveMediaAliases(array $a_mapping, bool $a_reuse_existing_by_import=false)
Resolve media aliases (after import)
getInitialOpenedContent()
Get initial opened content.
setActivationEnd(?string $a_activationend)
Set Activation End.
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
moveContentAfter(string $a_source, string $a_target, string $a_spcid="", string $a_tpcid="")
move content object from position $a_source before position $a_target (both hierarchical content ids)...
static _getIdForImportId(string $a_type, string $a_target)
Get current id for an import id.
getHistoryEntry(int $a_old_nr)
Get History Entry.
bbCode2XML(string &$a_content)
transforms bbCode to corresponding xml
deleteContents(array $a_hids, bool $a_update=true, bool $a_self_ass=false, bool $move_operation=false)
Delete multiple content objects.
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.
static sortHierIds(array $a_array)
Sort an array of Hier IDS in ascending order.
query(string $query)
Run a (read-only) Query on the database.
setLanguage(string $a_val)
Set language.
insert_before($newnode, $refnode)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static incEdId(string $ed_id)
Increases an hierarchical editing id at lowest level (last number)
ilObjectDefinition $obj_definition
switchEnableMultiple(array $a_hids, bool $a_update=true, bool $a_self_ass=false)
(De-)activate elements
static lookupParentId(int $a_id, string $a_type)
setConcreteLang(string $a_val)
getContentObject(string $a_hier_id, string $a_pc_id="")
Get a content object of the page.
static getLastChangeByParent(string $a_parent_type, int $a_parent_id, string $a_lang="")
Get all pages for parent object.
queryF(string $query, array $types, array $values)
getPCClipboardContent()
Add a page content item to PC clipboard (should go to another class)
getContentTemplates()
Get content templates.
insertPCIds()
Insert Page Content IDs.
static _writeActive(int $a_id, string $a_parent_type, bool $a_active)
write activation status
node_name($a_local=false)
getFirstRowIds()
get ids of all first table rows
addHierIDs()
Add hierarchical ID (e.g.
afterUpdate(DOMDocument $domdoc, string $xml)
After update.
setContainsIntLink(bool $a_contains_link)
lm parser set this flag to true, if the page contains intern links (this method should only be called...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static preloadActivationDataByParentId(int $a_parent_id)
Preload activation data by Parent Id.
setLastChange(string $a_lastchange)
static _instantiateQuestion(int $question_id)
getEditLockInfo()
Get edit lock info.
moveIntLinks(array $a_from_to)
Move internal links from one destination to another.
registerOfflineHandler(object $handler)
copyContents(array $a_hids)
Copy contents to clipboard.
__afterUpdate(DOMDocument $a_domdoc, string $a_xml, bool $a_creation=false, bool $a_empty=false)
After update event handler (internal).
__afterHistoryEntry(DOMDocument $a_old_domdoc, string $a_old_content, int $a_old_nr)
addUpdateListener(object $a_object, string $a_method, $a_parameters="")
getLanguageVariablesXML(int $style_id=0)
Get language variables as XML.
static _lookupType(int $a_obj_id, int $a_lm_id=0)
getMultimediaXML()
get a xml string that contains all media object elements, that are referenced by any media alias in t...
static getConfigInstance(string $a_parent_type)
Get page config instance.
collectMediaObjects(bool $a_inline_only=true)
get all media objects, that are referenced and used within the page
getEditLock()
Get page lock.
needsImportParsing(?bool $a_parse=null)
containsDeactivatedElements(string $a_content)
Check whether content contains deactivated elements.
__construct(int $a_id=0, int $a_old_nr=0, string $a_lang="-")
getXMLContent(bool $a_incl_head=false)
get xml content of page
compareVersion(int $a_left, int $a_right)
Compares to revisions of the page.
setParagraphContent(string $a_hier_id, string $a_content)
Set content of paragraph.
getHierIds()
get all hierarchical ids
getParagraphForPCID(string $pcid)
getPCIdsForHierIds(array $hier_ids)
Get hier ids for a set of pc ids.
handleCopiedContent(php4DOMDocument $a_dom, bool $a_self_ass=true, bool $a_clone_mobs=false, int $new_parent_id=0, int $obj_copy_id=0)
Handle copied content This function copies items, that must be copied, if page content is duplicated...
manipulate(string $query)
Run a (write) Query on the database.
static _lookupType(int $id, bool $reference=false)
getRepoObjId()
Get object id of repository object that contains this page, return 0 if page does not belong to a rep...
setNode(php4DOMElement $a_node)
Set xml node of page content.
getMediaAliasElement(int $a_mob_id, int $a_nr=1)
get complete media object (alias) element
setActive(bool $a_active)
static _handleImportRepositoryLinks(string $a_rep_import_id, string $a_rep_type, int $a_rep_ref_id)
Change targest of repository links.
existsPCId(string $a_pc_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
send_paragraph(string $par_id, string $filename)
getAllFileObjIds()
Get all file object ids.
static _getLastUpdateOfObjects(array $obj_ids)
static getInstance(string $a_parent_type, int $a_id=0, int $a_old_nr=0, string $a_lang="-")
Get page object instance.
setRenderMd5(string $a_rendermd5)
const DOMXML_LOAD_PARSING
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
pasteContents(string $a_hier_id, bool $a_self_ass=false)
Paste contents from pc clipboard.
setShowActivationInfo(bool $a_val)
const IL_INSERT_BEFORE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setRenderedTime(string $a_renderedtime)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAllPages(string $a_parent_type, int $a_parent_id, string $a_lang="-")
Get all pages for parent object.
static _exists(string $a_type, string $a_target)
Check if internal link refers to a valid target.
static sortArray(array $array, string $a_array_sortby_key, string $a_array_sortorder="asc", bool $a_numeric=false, bool $a_keep_keys=false)
Class ilPCParagraphGUI User Interface for Paragraph Editing.
setLastChangeUser(int $a_val)
resolveQuestionReferences(array $a_mapping)
Resolve all quesiont references (after import)
static _moveContentAfterHierId(ilPageObject $a_source_page, ilPageObject $a_target_page, string $a_hid)
move content of hierarchical id >= $a_hid to other page