19 define(
"IL_INSERT_BEFORE", 0);
20 define(
"IL_INSERT_AFTER", 1);
21 define(
"IL_INSERT_CHILD", 2);
53 protected \ILIAS\COPage\Link\LinkManager
$link;
113 $this->obj_definition = $DIC[
"objDefinition"];
114 $this->db = $DIC->database();
115 $this->
user = $DIC->user();
116 $this->
lng = $DIC->language();
117 $this->tree = $DIC->repositoryTree();
126 $this->contains_int_link =
false;
127 $this->needs_parsing =
false;
128 $this->update_listeners = array();
129 $this->update_listener_cnt = 0;
130 $this->dom_builded =
false;
131 $this->page_not_found =
false;
132 $this->old_nr = $a_old_nr;
133 $this->encoding =
"UTF-8";
146 $this->show_page_act_info =
false;
154 $domain = $DIC->copage()
157 $this->content_id_manager = $domain
159 $this->page_manager = $domain->page();
160 $this->pc_service = $domain->pc();
161 $this->pc_definition = $domain->pc()->definition();
162 $this->
link = $domain->link();
163 $this->style_manager = $domain->style();
164 $this->dom_util = $domain->domUtil();
168 \
ILIAS\COPage\ID\ContentIdManager $content_id_manager
201 $this->page_config = $a_val;
206 $this->concrete_lang = $a_val;
221 $this->rendermd5 = $a_rendermd5;
231 $this->renderedcontent = $a_renderedcontent;
241 $this->renderedtime = $a_renderedtime;
251 $this->lastchange = $a_lastchange;
261 $this->last_change_user = $a_val;
271 $this->show_page_act_info = $a_val;
290 if ($this->old_nr == 0) {
291 $query =
"SELECT * FROM page_object" .
292 " WHERE page_id = " . $this->db->quote($this->
id,
"integer") .
293 " AND parent_type=" . $this->db->quote($this->
getParentType(),
"text") .
294 " AND lang = " . $this->db->quote($this->
getLanguage(),
"text");
295 $pg_set = $this->db->query($query);
296 if (!$this->page_record = $this->db->fetchAssoc($pg_set)) {
300 $this->
setActive($this->page_record[
"active"]);
305 $query =
"SELECT * FROM page_history" .
306 " WHERE page_id = " . $this->db->quote($this->
id,
"integer") .
307 " AND parent_type=" . $this->db->quote($this->
getParentType(),
"text") .
308 " AND nr = " . $this->db->quote($this->old_nr,
"integer") .
309 " AND lang = " . $this->db->quote($this->
getLanguage(),
"text");
310 $pg_set = $this->db->query($query);
311 $this->page_record = $this->db->fetchAssoc($pg_set);
313 if (!$this->page_record) {
317 $this->xml = $this->page_record[
"content"];
318 $this->
setParentId((
int) $this->page_record[
"parent_id"]);
319 $this->last_change_user = (
int) ($this->page_record[
"last_change_user"] ?? 0);
320 $this->create_user = (
int) ($this->page_record[
"create_user"] ?? 0);
322 $this->
setRenderMd5((
string) ($this->page_record[
"render_md5"] ??
""));
323 $this->
setRenderedTime((
string) ($this->page_record[
"rendered_time"] ??
""));
324 $this->
setLastChange((
string) ($this->page_record[
"last_change"] ??
""));
332 string $a_parent_type,
335 bool $a_no_cache =
false 339 $db = $DIC->database();
341 if (!$a_no_cache && isset(self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang])) {
342 return self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang];
347 $and_lang =
" AND lang = " . $db->
quote($a_lang,
"text");
350 $query =
"SELECT page_id FROM page_object WHERE page_id = " . $db->
quote($a_id,
"integer") .
" " .
351 "AND parent_type = " . $db->
quote($a_parent_type,
"text") . $and_lang;
352 $set = $db->
query($query);
354 self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang] =
true;
357 self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang] =
false;
366 string $a_parent_type,
378 if ($this->dom_builded && !$a_force) {
385 $this->dom = $this->dom_util->docFromString($this->
getXMLContent(
true), $error);
386 $path =
"//PageObject";
387 if (is_null($this->dom)) {
391 $nodes = $this->dom_util->path($this->dom,
$path);
392 if (count($nodes) == 1) {
393 $this->node = $nodes->item(0);
400 $this->dom_builded =
true;
420 public function setId(
int $a_id): void
432 $this->parent_id = $a_id;
449 $this->update_listeners[$cnt][
"object"] = $a_object;
450 $this->update_listeners[$cnt][
"method"] = $a_method;
451 $this->update_listeners[$cnt][
"parameters"] = $a_parameters;
452 $this->update_listener_cnt++;
458 $object = $this->update_listeners[$i][
"object"];
459 $method = $this->update_listeners[$i][
"method"];
460 $parameters = $this->update_listeners[$i][
"parameters"];
461 $object->$method($parameters);
467 $this->active = $a_active;
471 bool $a_check_scheduled_activation =
false 473 if ($a_check_scheduled_activation && !$this->active) {
491 $db = $DIC->database();
493 "SELECT page_id, parent_type, lang, active, activation_start, activation_end, show_activation_info FROM page_object " .
494 " WHERE parent_id = " . $db->
quote($a_parent_id,
"integer")
497 self::$activation_data[$rec[
"page_id"] .
":" . $rec[
"parent_type"] .
":" . $rec[
"lang"]] = $rec;
506 string $a_parent_type,
507 bool $a_check_scheduled_activation =
false,
512 $db = $DIC->database();
519 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
520 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
523 "SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s" .
524 " AND parent_type = %s AND lang = %s",
525 array(
"integer",
"text",
"text"),
526 array($a_id, $a_parent_type, $a_lang)
535 if (!$rec[
"active"] && $a_check_scheduled_activation) {
536 if ($rec[
"n"] >= $rec[
"activation_start"] &&
537 $rec[
"n"] <= $rec[
"activation_end"]) {
542 return (
bool) $rec[
"active"];
550 string $a_parent_type,
555 $db = $DIC->database();
564 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
565 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
568 "SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s" .
569 " AND parent_type = %s AND lang = %s",
570 array(
"integer",
"text",
"text"),
571 array($a_id, $a_parent_type, $a_lang)
576 if (!$rec[
"active"] && $rec[
"activation_start"] !=
"") {
588 string $a_parent_type,
593 $db = $DIC->database();
599 "UPDATE page_object SET active = %s, activation_start = %s, " .
600 " activation_end = %s WHERE page_id = %s" .
601 " AND parent_type = %s AND lang = %s",
602 array(
"int",
"timestamp",
"timestamp",
"integer",
"text",
"text"),
603 array((
int) $a_active, null, null, $a_id, $a_parent_type, $a_lang)
612 string $a_parent_type,
617 $db = $DIC->database();
624 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
625 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
628 "SELECT active, activation_start, activation_end, show_activation_info FROM page_object WHERE page_id = %s" .
629 " AND parent_type = %s AND lang = %s",
630 array(
"integer",
"text",
"text"),
631 array($a_id, $a_parent_type, $a_lang)
637 "activation_start" => null,
638 "activation_end" => null,
639 "show_activation_info" => 0
651 $db = $DIC->database();
653 $res = $db->
query(
"SELECT parent_id FROM page_object WHERE page_id = " . $db->
quote($a_id,
"integer") .
" " .
654 "AND parent_type=" . $db->
quote($a_type,
"text"));
656 return (
int) ($rec[
"parent_id"] ?? 0);
659 public static function _writeParentId(
string $a_parent_type,
int $a_pg_id,
int $a_par_id): void
663 $db = $DIC->database();
665 "UPDATE page_object SET parent_id = %s WHERE page_id = %s" .
666 " AND parent_type = %s",
667 array(
"integer",
"integer",
"text"),
668 array($a_par_id, $a_pg_id, $a_parent_type)
677 if ($a_activationstart ==
"") {
678 $a_activationstart = null;
680 $this->activationstart = $a_activationstart;
694 if ($a_activationend ==
"") {
695 $a_activationend = null;
697 $this->activationend = $a_activationend;
712 $node = $this->page_manager->content($this->
getDomDoc())->getContentDomNode(
717 $this->log->debug(
"getContentObject: " .
" $a_hier_id, $a_pc_id, " . $node->nodeName);
719 $this->log->debug(
"no node found: " .
" $a_hier_id, $a_pc_id ");
721 return $this->pc_service->getByNode($node, $this);
739 $node = $content_object->getDomNode();
740 $node = $node->parentNode;
742 if ($node->nodeName ==
"PageContent") {
743 $pcid = $node->getAttribute(
"PCID");
748 $node = $node->parentNode;
755 $cm = $this->page_manager->content($this->
getDomDoc());
756 return $cm->getContentDomNode($a_hier_id, $a_pc_id);
770 public function setXMLContent(
string $a_xml,
string $a_encoding =
"UTF-8"): void
772 $this->encoding = $a_encoding;
782 $this->xml .= $a_xml;
794 $enc_str = (!empty($this->encoding))
795 ?
"encoding=\"" . $this->encoding .
"\"" 797 return "<?xml version=\"1.0\" $enc_str ?>" .
798 "<!DOCTYPE PageObject SYSTEM \"" . $this->
getIliasAbsolutePath() .
"/xml/" . $this->cur_dtd .
"\">" .
807 return ILIAS_ABSOLUTE_PATH;
816 bool $a_clone_mobs =
false,
817 int $a_new_parent_id = 0,
818 int $obj_copy_id = 0,
819 bool $self_ass =
true 821 $cm = $this->page_manager->contentFromXml($this->
getXMLContent());
822 return $cm->copyXmlContent(
842 $pm = $this->page_manager->content($this->
getDomDoc());
843 $pm->handleDeleteContent($this, $a_node, $move_operation);
851 bool $a_incl_head =
false,
852 bool $a_append_mobs =
false,
853 bool $a_append_bib =
false,
854 string $a_append_str =
"",
855 bool $a_omit_pageobject_tag =
false,
860 return $this->dom_util->dump($this->node);
863 if ($a_append_mobs || $a_append_bib) {
866 if ($a_append_mobs) {
875 return "<dummy>" . $this->dom_util->dump($this->node) . $mobs . $bibs . $trans . $a_append_str .
"</dummy>";
877 if (is_object($this->dom)) {
878 if ($a_omit_pageobject_tag) {
880 foreach ($this->node->childNodes as $child) {
881 $xml .= $this->dom_util->dump($child);
884 $xml = $this->dom_util->dump($this->node);
885 $xml = preg_replace(
'/<\?xml[^>]*>/i',
"", $xml);
886 $xml = preg_replace(
'/<!DOCTYPE[^>]*>/i',
"", $xml);
918 "ed_align_left_float",
919 "ed_align_right_float",
921 "ed_new_item_before",
928 "ed_split_page_next",
936 "ed_click_to_add_pg",
941 $defs = $this->pc_definition->getPCDefinitions();
942 foreach ($defs as $def) {
943 $lang_vars[] =
"pc_" . $def[
"pc_type"];
944 $lang_vars[] =
"ed_insert_" . $def[
"pc_type"];
946 $cl = $def[
"pc_class"];
947 $lvs = call_user_func($def[
"pc_class"] .
'::getLangVars');
948 foreach ($lvs as $lv) {
955 $dummy_pc->setStyleId($style_id);
956 foreach ([
"section",
"table",
"flist_li",
"list_u",
"list_o",
957 "table",
"table_cell"] as $type) {
958 $dummy_pc->getCharacteristicsOfCurrentStyle([$type]);
959 foreach ($dummy_pc->getCharacteristics() as $char =>
$txt) {
960 $xml .=
"<LV name=\"char_" . $type .
"_" . $char .
"\" value=\"" .
$txt .
"\"/>";
963 $type =
"media_cont";
965 $dummy_pc->setStyleId($style_id);
966 $dummy_pc->getCharacteristicsOfCurrentStyle([$type]);
967 foreach ($dummy_pc->getCharacteristics() as $char =>
$txt) {
968 $xml .=
"<LV name=\"char_" . $type .
"_" . $char .
"\" value=\"" .
$txt .
"\"/>";
970 foreach ([
"text_block",
"heading1",
"heading2",
"heading3"] as $type) {
972 $dummy_pc->setStyleId($style_id);
973 $dummy_pc->getCharacteristicsOfCurrentStyle([$type]);
974 foreach ($dummy_pc->getCharacteristics() as $char =>
$txt) {
975 $xml .=
"<LV name=\"char_" . $type .
"_" . $char .
"\" value=\"" .
$txt .
"\"/>";
978 foreach ($lang_vars as $lang_var) {
987 $val = $this->
lng->txt(
"cont_" . $var);
988 $val = str_replace(
'"',
""", $val);
989 return "<LV name=\"$var\" value=\"" . $val .
"\"/>";
994 return $this->pc_service->paragraph()->getFirstParagraphText($this);
999 return $this->pc_service->paragraph()->getParagraphForPCID($this, $pcid);
1012 $this->contains_int_link = $a_contains_link;
1027 $this->import_mode = $a_val;
1037 if ($a_parse ===
true) {
1038 $this->needs_parsing =
true;
1040 if ($a_parse ===
false) {
1041 $this->needs_parsing =
false;
1049 $this->contains_question = $a_val;
1064 $mob_manager = $this->pc_service->mediaObject();
1065 return $mob_manager->collectMediaObjects($this->
getDomDoc(), $a_inline_only);
1082 $mob_manager = $this->pc_service->mediaObject();
1083 return $mob_manager->getMultimediaXML($this->
getDomDoc());
1091 $mob_manager = $this->pc_service->mediaObject();
1092 return $mob_manager->getMediaAliasElement(
1110 $this->dom_util->validate($this->dom, $error, $throw);
1119 $this->content_id_manager->addHierIDsToDom();
1124 return $this->content_id_manager->getHierIds();
1129 $this->content_id_manager->stripHierIDsFromDom();
1134 $this->content_id_manager->stripPCIDs();
1142 return $this->content_id_manager->getHierIdsForPCIds($a_pc_ids);
1147 return $this->content_id_manager->getHierIdForPcId($pcid);
1155 return $this->content_id_manager->getPCIdsForHierIds($hier_ids);
1160 return $this->content_id_manager->getPCIdForHierId($hier_id);
1168 $this->pc_service->fileList()->addFileSizes($this->
getDomDoc());
1177 return $this->
link->resolveIntLinks($this->
getDomDoc(), $a_link_map);
1186 bool $a_reuse_existing_by_import =
false 1188 return $this->pc_service->mediaObject()->resolveMediaAliases(
1191 $a_reuse_existing_by_import
1201 return $this->pc_service->interactiveImage()->resolveIIMMediaAliases(
1213 return $this->pc_service->fileList()->resolveFileItems(
1225 $qm = $this->pc_service->question();
1226 return $qm->resolveQuestionReferences(
1241 return $this->
link->moveIntLinks(
1253 int $a_source_ref_id
1258 $this->log->debug(
"Handle repository links...");
1260 $defs = $this->pc_definition->getPCDefinitions();
1261 foreach ($defs as $def) {
1262 if (method_exists($def[
"pc_class"],
'afterRepositoryCopy')) {
1263 call_user_func($def[
"pc_class"] .
'::afterRepositoryCopy', $this, $a_mapping, $a_source_ref_id);
1267 $this->
link->handleRepositoryLinksOnCopy($this->
getDomDoc(), $a_mapping, $a_source_ref_id, $tree);
1294 $this->db->insert(
"page_object", array(
1295 "page_id" => array(
"integer", $this->
getId()),
1296 "parent_id" => array(
"integer", $this->
getParentId()),
1298 "content" => array(
"clob", $content),
1300 "create_user" => array(
"integer", $this->
user->getId()),
1301 "last_change_user" => array(
"integer", $this->
user->getId()),
1302 "active" => array(
"integer", (
int) $this->
getActive()),
1306 "inactive_elements" => array(
"integer", $iel),
1307 "int_links" => array(
"integer", $inl),
1309 "last_change" => array(
"timestamp",
ilUtil::now()),
1310 "is_empty" => array(
"integer", $empty)
1325 $this->log->debug(
"ilPageObject, updateFromXML(): start, id: " . $this->
getId());
1329 $this->log->debug(
"ilPageObject, updateFromXML(): content: " . substr($content, 0, 100));
1339 $this->db->update(
"page_object", array(
1340 "content" => array(
"clob", $content),
1341 "parent_id" => array(
"integer", $this->
getParentId()),
1342 "last_change_user" => array(
"integer", $this->
user->getId()),
1343 "last_change" => array(
"timestamp",
ilUtil::now()),
1344 "active" => array(
"integer", $this->
getActive()),
1347 "inactive_elements" => array(
"integer", $iel),
1348 "int_links" => array(
"integer", $inl),
1350 "page_id" => array(
"integer", $this->
getId()),
1358 $this->log->debug(
"ilPageObject, updateFromXML(): end");
1370 bool $a_creation =
false,
1371 bool $a_empty =
false 1374 if (!$a_creation || !$a_empty) {
1384 $this->reading_time_manager->saveTime($this);
1387 $defs = $this->pc_definition->getPCDefinitions();
1388 foreach ($defs as $def) {
1389 $cl = $def[
"pc_class"];
1390 call_user_func($def[
"pc_class"] .
'::afterPageUpdate', $this, $a_domdoc, $a_xml, $a_creation);
1414 public function update(
bool $a_validate =
true,
bool $a_no_history =
false)
1416 $this->log->debug(
"start..., id: " . $this->
getId());
1426 $this->log->debug($this->dom_util->dump($this->getDomDoc()->documentElement));
1432 $errors[0] = array(0 => 0,
1433 1 => $this->
lng->txt(
"cont_not_saved_edit_lock_expired") .
"<br />" .
1434 $this->
lng->txt(
"obj_usr") .
": " .
1436 $this->
lng->txt(
"content_until") .
": " .
1442 $this->log->debug(
"checking duplicate ids");
1444 $errors[0] = $this->
lng->txt(
"cont_could_not_save_duplicate_pc_ids") .
1448 if (!empty($errors)) {
1449 $this->log->debug(
"ilPageObject, update(): errors: " . print_r($errors,
true));
1453 if (empty($errors)) {
1457 $this->log->debug(
"perform automatic modifications");
1467 $old_set = $this->db->query(
"SELECT * FROM page_object WHERE " .
1468 "page_id = " . $this->db->quote($this->getId(),
"integer") .
" AND " .
1469 "parent_type = " . $this->db->quote($this->getParentType(),
"text") .
" AND " .
1470 "lang = " . $this->db->quote($this->getLanguage(),
"text"));
1471 $last_nr_set = $this->db->query(
"SELECT max(nr) as mnr FROM page_history WHERE " .
1472 "page_id = " . $this->db->quote($this->getId(),
"integer") .
" AND " .
1473 "parent_type = " . $this->db->quote($this->getParentType(),
"text") .
" AND " .
1474 "lang = " . $this->db->quote($this->getLanguage(),
"text"));
1475 $last_nr = $this->db->fetchAssoc($last_nr_set);
1476 if ($old_rec = $this->db->fetchAssoc($old_set)) {
1479 if (($content != $old_rec[
"content"] || $this->
user->getId() != $old_rec[
"last_change_user"]) &&
1480 !$a_no_history && !$this->history_saved &&
$lm_set->get(
"page_history", 1)) {
1481 if ($old_rec[
"content"] !=
"<PageObject></PageObject>") {
1482 $this->db->manipulateF(
1483 "DELETE FROM page_history WHERE " .
1484 "page_id = %s AND parent_type = %s AND hdate = %s AND lang = %s",
1485 array(
"integer",
"text",
"timestamp",
"text"),
1486 array($old_rec[
"page_id"],
1487 $old_rec[
"parent_type"],
1488 $old_rec[
"last_change"],
1495 $last_c = $old_rec[
"last_change"];
1496 if ($last_c ==
"") {
1500 $this->db->insert(
"page_history", array(
1501 "page_id" => array(
"integer", $old_rec[
"page_id"]),
1502 "parent_type" => array(
"text", $old_rec[
"parent_type"]),
1503 "lang" => array(
"text", $old_rec[
"lang"]),
1504 "hdate" => array(
"timestamp", $last_c),
1505 "parent_id" => array(
"integer", $old_rec[
"parent_id"]),
1506 "content" => array(
"clob", $old_rec[
"content"]),
1507 "user_id" => array(
"integer", $old_rec[
"last_change_user"]),
1509 "nr" => array(
"integer", (
int) $last_nr[
"mnr"] + 1)
1512 $old_content = $old_rec[
"content"];
1514 $old_nr = $last_nr[
"mnr"] + 1;
1515 $old_domdoc->loadXML(
'<?xml version="1.0" encoding="UTF-8"?>' . $old_content);
1518 $this->log->debug(
"calling __afterHistoryEntry");
1523 $this->history_saved =
true;
1527 $em = (trim($content) ==
"<PageObject/>")
1532 $this->log->debug(
"checking deactivated elements");
1534 $this->log->debug(
"checking internal links");
1538 $this->lastchange = $now;
1539 $this->db->update(
"page_object", array(
1540 "content" => array(
"clob", $content),
1541 "parent_id" => array(
"integer", $this->
getParentId()),
1542 "last_change_user" => array(
"integer", $this->
user->getId()),
1543 "last_change" => array(
"timestamp", $now),
1544 "is_empty" => array(
"integer", $em),
1545 "active" => array(
"integer", $this->
getActive()),
1549 "inactive_elements" => array(
"integer", $iel),
1550 "int_links" => array(
"integer", $inl),
1552 "page_id" => array(
"integer", $this->
getId()),
1558 $this->log->debug(
"calling __afterUpdate()");
1562 "...ending, updated and returning true, content: " . substr(
1576 public function delete():
void 1579 $copg_logger->debug(
1580 "ilPageObject: Delete called for ID '" . $this->
getId() .
"'," .
1582 " hist nr: '" . $this->old_nr .
"', " .
1587 if (!$this->page_not_found) {
1598 foreach ($mobs2 as $m) {
1599 if (!in_array($m, $mobs)) {
1604 $copg_logger->debug(
"ilPageObject: ... found " . count($mobs) .
" media objects.");
1632 ?
" AND lang = " . $this->db->quote($this->
getLanguage(),
"text")
1634 $this->db->manipulate(
"DELETE FROM page_object " .
1635 "WHERE page_id = " . $this->db->quote($this->getId(),
"integer") .
1636 " AND parent_type= " . $this->db->quote($this->getParentType(),
"text") . $and);
1639 foreach ($mobs as $mob_id) {
1640 $copg_logger->debug(
"ilPageObject: ... processing mob " . $mob_id .
".");
1643 $copg_logger->debug(
"ilPageObject: ... type mismatch. Ignoring mob " . $mob_id .
".");
1648 $copg_logger->debug(
"ilPageObject: ... delete mob " . $mob_id .
".");
1653 $copg_logger->debug(
"ilPageObject: ... missing mob " . $mob_id .
".");
1662 return !in_array($this->
getLanguage(), [
"",
"-"]);
1671 $defs = $this->pc_definition->getPCDefinitions();
1672 foreach ($defs as $def) {
1673 $cl = $def[
"pc_class"];
1674 call_user_func($def[
"pc_class"] .
'::beforePageDelete', $this);
1689 string $a_old_content,
1696 $defs = $this->pc_definition->getPCDefinitions();
1697 foreach ($defs as $def) {
1698 $cl = $def[
"pc_class"];
1700 $def[
"pc_class"] .
'::afterPageHistoryEntry',
1716 $this->style_manager->saveStyleUsage(
1728 $this->style_manager->deleteStyleUsages($this, $a_old_nr);
1742 $files = ilObjFile::_getFilesOfObject(
1746 $objs = array_merge($mobs, $files);
1755 $this->
link->deleteInternalLinks($this);
1765 $this->
link->saveInternalLinks(
1774 public function create(
bool $a_import =
false): void
1787 bool $a_update =
true,
1788 string $a_pcid =
"",
1789 bool $move_operation =
false 1791 $pm = $this->page_manager->content($this->
getDomDoc());
1792 $pm->deleteContent($this, $a_hid, $a_pcid, $move_operation);
1808 bool $a_update =
true,
1809 bool $a_self_ass =
false,
1810 bool $move_operation =
false 1812 $pm = $this->page_manager->content($this->
getDomDoc());
1813 $pm->deleteContents($this, $a_hids, $a_self_ass, $move_operation);
1841 $cm = $this->page_manager->content($this->
getDomDoc());
1842 $cm->copyContents($a_hids, $this->
user);
1852 bool $a_self_ass =
false 1855 $cm = $this->page_manager->content($this->
getDomDoc());
1874 bool $a_update =
true,
1875 bool $a_self_ass =
false 1877 $cm = $this->page_manager->content($this->
getDomDoc());
1878 $cm->switchEnableMultiple($this, $a_hids, $a_self_ass);
1892 string $a_pcid =
"",
1893 bool $remove_placeholder =
true 1895 $cm = $this->page_manager->content($this->
getDomDoc());
1901 $remove_placeholder,
1915 $cm = $this->page_manager->content($this->
getDomDoc());
1916 $cm->insertContentNode(
1940 string $a_spcid =
"",
1941 string $a_tpcid =
"" 1943 $cm = $this->page_manager->content($this->
getDomDoc());
1944 $cm->moveContentAfter(
1962 bool $a_res_ref_to_obj_id =
true 1964 $cm = $this->page_manager->content($this->
getDomDoc());
1965 $cm->insertInstIntoIDs($a_inst, $a_res_ref_to_obj_id);
1973 return $this->content_id_manager->checkPCIds();
1981 return $this->content_id_manager->getAllPCIds();
1986 return $this->content_id_manager->hasDuplicatePCIds();
1995 return $this->content_id_manager->getDuplicatePCIds();
2000 return $this->content_id_manager->generatePCId();
2008 $this->content_id_manager->insertPCIds();
2015 $this->pc_service->paragraph()->send(
2037 string $a_parent_type,
2038 string $a_lang =
"-" 2042 $db = $DIC->database();
2044 if ($a_lang ==
"") {
2048 $query =
"SELECT * FROM page_object WHERE page_id = " .
2049 $db->
quote($a_id,
"integer") .
" AND " .
2050 " parent_type = " . $db->
quote($a_parent_type,
"text") .
" AND " .
2051 " lang = " . $db->
quote($a_lang,
"text") .
" AND " .
2052 " inactive_elements = " . $db->
quote(1,
"integer");
2053 $obj_set = $db->
query($query);
2067 if (strpos($a_content,
" Enabled=\"False\"")) {
2080 $h_query =
"SELECT * FROM page_history " .
2081 " WHERE page_id = " . $db->
quote($this->
getId(),
"integer") .
2084 " ORDER BY hdate DESC";
2086 $hset = $db->
query($h_query);
2087 $hentries = array();
2090 $hrec[
"sortkey"] = (
int) $hrec[
"nr"];
2091 $hrec[
"user"] = (
int) $hrec[
"user_id"];
2092 $hentries[] = $hrec;
2106 "SELECT * FROM page_history " .
2107 " WHERE page_id = %s " .
2108 " AND parent_type = %s " .
2111 array(
"integer",
"text",
"integer",
"text"),
2131 $and_nr = ($a_nr > 0)
2132 ?
" AND nr < " . $db->
quote($a_nr,
"integer")
2134 $res = $db->
query(
"SELECT MAX(nr) mnr FROM page_history " .
2135 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
2136 " AND parent_type = " . $db->
quote($this->getParentType(),
"text") .
2137 " AND lang = " . $db->
quote($this->getLanguage(),
"text") .
2140 if ($row[
"mnr"] > 0) {
2141 $res = $db->
query(
"SELECT * FROM page_history " .
2142 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
2143 " AND parent_type = " . $db->
quote($this->getParentType(),
"text") .
2144 " AND lang = " . $db->
quote($this->getLanguage(),
"text") .
2145 " AND nr = " . $db->
quote((
int) $row[
"mnr"],
"integer"));
2147 $ret[
"previous"] = $row;
2151 $res = $db->
query(
"SELECT MIN(nr) mnr FROM page_history " .
2152 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
2153 " AND parent_type = " . $db->
quote($this->getParentType(),
"text") .
2154 " AND lang = " . $db->
quote($this->getLanguage(),
"text") .
2155 " AND nr > " . $db->
quote($a_nr,
"integer"));
2157 if ($row[
"mnr"] > 0) {
2158 $res = $db->
query(
"SELECT * FROM page_history " .
2159 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
2160 " AND parent_type = " . $db->
quote($this->getParentType(),
"text") .
2161 " AND lang = " . $db->
quote($this->getLanguage(),
"text") .
2162 " AND nr = " . $db->
quote((
int) $row[
"mnr"],
"integer"));
2164 $ret[
"next"] = $row;
2169 $res = $db->
query(
"SELECT * FROM page_history " .
2170 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
2171 " AND parent_type = " . $db->
quote($this->getParentType(),
"text") .
2172 " AND lang = " . $db->
quote($this->getLanguage(),
"text") .
2173 " AND nr = " . $db->
quote($a_nr,
"integer"));
2175 $res = $db->
query(
"SELECT page_id, last_change hdate, parent_type, parent_id, last_change_user user_id, content, lang FROM page_object " .
2176 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
2177 " AND parent_type = " . $db->
quote($this->getParentType(),
"text") .
2178 " AND lang = " . $db->
quote($this->getLanguage(),
"text"));
2181 $ret[
"current"] = $row;
2198 " SET view_cnt = view_cnt + 1 " .
2199 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
2200 " AND parent_type = " . $db->
quote($this->getParentType(),
"text") .
2201 " AND lang = " . $db->
quote($this->getLanguage(),
"text"));
2211 string $a_parent_type,
2218 $db = $DIC->database();
2221 if ($a_lang !=
"") {
2222 $and_lang =
" AND lang = " . $db->
quote($a_lang,
"text");
2225 $page_changes = array();
2226 $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
2227 $q =
"SELECT * FROM page_object " .
2228 " WHERE parent_id = " . $db->
quote($a_parent_id,
"integer") .
2229 " AND parent_type = " . $db->
quote($a_parent_type,
"text") .
2230 " AND last_change >= " . $db->
quote($limit_ts,
"timestamp") . $and_lang;
2234 $page_changes[] = array(
2235 "date" => $page[
"last_change"],
2236 "id" => $page[
"page_id"],
2237 "lang" => $page[
"lang"],
2239 "user" => $page[
"last_change_user"]
2244 if ($a_period > 0) {
2245 $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
2246 $and_str =
" AND hdate >= " . $db->
quote($limit_ts,
"timestamp") .
" ";
2249 $q =
"SELECT * FROM page_history " .
2250 " WHERE parent_id = " . $db->
quote($a_parent_id,
"integer") .
2251 " AND parent_type = " . $db->
quote($a_parent_type,
"text") .
2252 $and_str . $and_lang;
2255 $page_changes[] = array(
2256 "date" => $page[
"hdate"],
2257 "id" => $page[
"page_id"],
2258 "lang" => $page[
"lang"],
2260 "nr" => $page[
"nr"],
2261 "user" => $page[
"user_id"]
2267 return $page_changes;
2274 string $a_parent_type,
2276 string $a_lang =
"-" 2280 $db = $DIC->database();
2283 if ($a_lang !=
"") {
2284 $and_lang =
" AND lang = " . $db->
quote($a_lang,
"text");
2287 $q =
"SELECT * FROM page_object " .
2288 " WHERE parent_id = " . $db->
quote($a_parent_id,
"integer") .
2289 " AND parent_type = " . $db->
quote($a_parent_type,
"text") . $and_lang;
2293 $key_add = ($a_lang ==
"")
2294 ?
":" . $page[
"lang"]
2296 $pages[$page[
"page_id"] . $key_add] = array(
2297 "date" => $page[
"last_change"],
2298 "id" => $page[
"page_id"],
2299 "lang" => $page[
"lang"],
2300 "user" => $page[
"last_change_user"]
2311 string $a_parent_type,
2313 string $a_lang =
"-" 2317 $db = $DIC->database();
2320 if ($a_lang !=
"") {
2321 $and_lang =
" AND lang = " . $db->
quote($a_lang,
"text");
2326 $q =
"SELECT * FROM page_object " .
2327 " WHERE parent_id = " . $db->
quote($a_parent_id,
"integer") .
2328 " AND parent_type = " . $db->
quote($a_parent_type,
"text") . $and_lang .
2329 " ORDER BY created DESC";
2332 if ($page[
"created"] !=
"") {
2334 "created" => $page[
"created"],
2335 "id" => $page[
"page_id"],
2336 "lang" => $page[
"lang"],
2337 "user" => $page[
"create_user"],
2351 string $a_parent_type,
2353 string $a_lang =
"-" 2357 $db = $DIC->database();
2360 if ($a_lang !=
"") {
2361 $and_lang =
" AND lang = " . $db->
quote($a_lang,
"text");
2364 $contributors = array();
2366 "SELECT last_change_user, lang, page_id FROM page_object " .
2367 " WHERE parent_id = %s AND parent_type = %s " .
2368 " AND last_change_user != %s" . $and_lang,
2369 array(
"integer",
"text",
"integer"),
2370 array($a_parent_id, $a_parent_type, 0)
2374 if ($a_lang ==
"") {
2375 $contributors[$page[
"last_change_user"]][$page[
"page_id"]][$page[
"lang"]] = 1;
2377 $contributors[$page[
"last_change_user"]][$page[
"page_id"]] = 1;
2382 "SELECT count(*) as cnt, lang, page_id, user_id FROM page_history " .
2383 " WHERE parent_id = %s AND parent_type = %s AND user_id != %s " . $and_lang .
2384 " GROUP BY page_id, user_id, lang ",
2385 array(
"integer",
"text",
"integer"),
2386 array($a_parent_id, $a_parent_type, 0)
2389 if ($a_lang ==
"") {
2390 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]][$hpage[
"lang"]] =
2391 ($contributors[$hpage[
"user_id"]][$hpage[
"page_id"]][$hpage[
"lang"]] ?? 0) + $hpage[
"cnt"];
2393 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] =
2394 ($contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] ?? 0) + $hpage[
"cnt"];
2399 foreach ($contributors as $k => $co) {
2402 $c[] = array(
"user_id" => $k,
2404 "lastname" => $name[
"lastname"],
2405 "firstname" => $name[
"firstname"]
2417 string $a_parent_type,
2419 string $a_lang =
"-" 2423 $db = $DIC->database();
2426 if ($a_lang !=
"") {
2427 $and_lang =
" AND lang = " . $db->
quote($a_lang,
"text");
2430 $contributors = array();
2432 "SELECT last_change_user, lang FROM page_object " .
2433 " WHERE page_id = %s AND parent_type = %s " .
2434 " AND last_change_user != %s" . $and_lang,
2435 array(
"integer",
"text",
"integer"),
2436 array($a_page_id, $a_parent_type, 0)
2440 if ($a_lang ==
"") {
2441 $contributors[$page[
"last_change_user"]][$page[
"lang"]] = 1;
2443 $contributors[$page[
"last_change_user"]] = 1;
2448 "SELECT count(*) as cnt, lang, page_id, user_id FROM page_history " .
2449 " WHERE page_id = %s AND parent_type = %s AND user_id != %s " . $and_lang .
2450 " GROUP BY user_id, page_id, lang ",
2451 array(
"integer",
"text",
"integer"),
2452 array($a_page_id, $a_parent_type, 0)
2455 if ($a_lang ===
"") {
2456 $contributors[$hpage[
"user_id"]][$page[
"lang"]] =
2457 ($contributors[$hpage[
"user_id"]][$page[
"lang"]] ?? 0) + $hpage[
"cnt"];
2459 $contributors[$hpage[
"user_id"]] =
2460 ($contributors[$hpage[
"user_id"]] ?? 0) + $hpage[
"cnt"];
2465 foreach ($contributors as $k => $co) {
2467 $c[] = array(
"user_id" => $k,
2469 "lastname" => $name[
"lastname"],
2470 "firstname" => $name[
"firstname"]
2486 $db = $DIC->database();
2488 $db->
update(
"page_object", array(
2489 "rendered_content" => array(
"clob", $a_content),
2490 "render_md5" => array(
"text", $a_md5),
2491 "rendered_time" => array(
"timestamp",
ilUtil::now())
2493 "page_id" => array(
"integer", $this->
getId()),
2503 string $a_parent_type,
2505 string $a_lang =
"-" 2509 $db = $DIC->database();
2512 if ($a_lang !=
"") {
2513 $and_lang =
" AND lang = " . $db->
quote($a_lang,
"text");
2516 $q =
"SELECT * FROM page_object " .
2517 " WHERE parent_id = " . $db->
quote($a_parent_id,
"integer") .
2518 " AND parent_type = " . $db->
quote($a_parent_type,
"text") .
2519 " AND int_links = " . $db->
quote(1,
"integer") . $and_lang;
2523 $key_add = ($a_lang ==
"")
2524 ?
":" . $page[
"lang"]
2526 $pages[$page[
"page_id"] . $key_add] = array(
2527 "date" => $page[
"last_change"],
2528 "id" => $page[
"page_id"],
2529 "lang" => $page[
"lang"],
2530 "user" => $page[
"last_change_user"]
2542 if (strpos($a_content,
"IntLink")) {
2558 return $this->page_manager->content($this->
getDomDoc());
2570 $cm->setInitialOpenedContent($a_type, $a_id, $a_target);
2580 return $cm->getInitialOpenedContent();
2603 string $a_parent_type =
"",
2604 int $a_new_parent_id = 0,
2605 bool $a_clone_mobs =
false,
2606 int $obj_copy_id = 0,
2607 bool $overwrite_existing =
true 2609 if ($a_parent_type ==
"") {
2611 if ($a_new_parent_id == 0) {
2620 if (!$overwrite_existing) {
2627 $new_page_object->setParentId($a_new_parent_id);
2628 $new_page_object->setId($a_id);
2630 $new_page_object->setXMLContent($orig_page->copyXMLContent($a_clone_mobs, $a_new_parent_id, $obj_copy_id));
2631 $new_page_object->setActive($orig_page->getActive());
2632 $new_page_object->setActivationStart($orig_page->getActivationStart());
2633 $new_page_object->setActivationEnd($orig_page->getActivationEnd());
2636 $new_page_object->buildDom();
2637 $new_page_object->update();
2639 $new_page_object->create(
false);
2653 string $a_parent_type,
2658 $db = $DIC->database();
2661 "SELECT lang FROM page_object " .
2662 " WHERE page_id = " . $db->
quote($a_id,
"integer") .
2663 " AND parent_type = " . $db->
quote($a_parent_type,
"text")
2667 $langs[] = $rec[
"lang"];
2676 string $a_target_lang
2685 $transl_page->create(
false);
2690 $transl_page->setId($this->
getId());
2693 $transl_page->setActive($this->
getActive());
2716 "UPDATE page_object SET " .
2717 " edit_lock_user = " . $db->
quote($user->
getId(),
"integer") .
"," .
2718 " edit_lock_ts = " . $db->
quote($ts,
"integer") .
2719 " WHERE (edit_lock_user = " . $db->
quote($user->
getId(),
"integer") .
" OR " .
2720 " edit_lock_ts < " . $db->
quote(time() - ($min * 60),
"integer") .
") " .
2721 " AND page_id = " . $db->
quote($this->
getId(),
"integer") .
2726 "SELECT edit_lock_user FROM page_object " .
2727 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
2728 " AND parent_type = " . $db->
quote($this->getParentType(),
"text")
2731 if ($rec[
"edit_lock_user"] != $user->
getId()) {
2748 $min = (
int) $aset->get(
"block_mode_minutes");
2753 "UPDATE page_object SET " .
2754 " edit_lock_user = " . $db->
quote($user->
getId(),
"integer") .
"," .
2755 " edit_lock_ts = 0" .
2756 " WHERE edit_lock_user = " . $db->
quote($user->
getId(),
"integer") .
2757 " AND page_id = " . $db->
quote($this->getId(),
"integer") .
2758 " AND parent_type = " . $db->
quote($this->getParentType(),
"text")
2762 "SELECT edit_lock_user FROM page_object " .
2763 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
2764 " AND parent_type = " . $db->
quote($this->getParentType(),
"text")
2767 if ($rec[
"edit_lock_user"] != $user->
getId()) {
2783 $min = (
int) $aset->get(
"block_mode_minutes");
2786 "SELECT edit_lock_user, edit_lock_ts FROM page_object " .
2787 " WHERE page_id = " . $db->
quote($this->getId(),
"integer") .
2788 " AND parent_type = " . $db->
quote($this->getParentType(),
"text")
2791 $rec[
"edit_lock_until"] = $rec[
"edit_lock_ts"] + $min * 60;
2802 int $a_length = 100,
2803 string $a_ending =
'...',
2804 bool $a_exact =
false,
2805 bool $a_consider_html =
true 2808 if ($a_consider_html) {
2810 if (strlen(preg_replace(
'/<.*?>/',
'', $a_text)) <= $a_length) {
2815 $total_length = strlen($a_ending);
2816 $open_tags = array();
2818 preg_match_all(
'/(<.+?>)?([^<>]*)/s', $a_text, $lines, PREG_SET_ORDER);
2819 foreach ($lines as $line_matchings) {
2821 if (!empty($line_matchings[1])) {
2824 '/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is',
2829 elseif (preg_match(
'/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) {
2831 $pos = array_search($tag_matchings[1], $open_tags);
2832 if ($pos !==
false) {
2833 unset($open_tags[$pos]);
2836 elseif (preg_match(
'/^<\s*([^\s>!]+).*?>$/s', $line_matchings[1], $tag_matchings)) {
2838 array_unshift($open_tags, strtolower($tag_matchings[1]));
2841 $truncate .= $line_matchings[1];
2845 $content_length = strlen(preg_replace(
2846 '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i',
2850 if ($total_length + $content_length > $a_length) {
2852 $left = $a_length - $total_length;
2853 $entities_length = 0;
2856 '/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i',
2862 foreach ($entities[0] as $entity) {
2863 if ($entity[1] + 1 - $entities_length <= $left) {
2865 $entities_length += strlen($entity[0]);
2879 $truncate .= $line_matchings[2];
2880 $total_length += $content_length;
2884 if ($total_length >= $a_length) {
2889 if (strlen($a_text) <= $a_length) {
2898 if (!count($open_tags)) {
2902 $spacepos = strrpos($truncate,
' ');
2903 if ($spacepos !==
false) {
2912 $truncate .= $a_ending;
2914 if ($a_consider_html) {
2916 foreach ($open_tags as $tag) {
2917 $truncate .=
'</' . $tag .
'>';
2937 string $a_parent_type,
2943 $db = $DIC->database();
2946 if ($a_lang !=
"") {
2947 $and_lang =
" AND lang = " . $db->
quote($a_lang,
"text");
2951 $q =
"SELECT last_change FROM page_object " .
2952 " WHERE parent_id = " . $db->
quote($a_parent_id,
"integer") .
2953 " AND parent_type = " . $db->
quote($a_parent_type,
"text") . $and_lang .
2954 " ORDER BY last_change DESC";
2959 return $rec[
"last_change"];
2964 if ($this->
getPageConfig()->getEditLockSupport() ==
false) {
2969 $min = (
int) $aset->get(
"block_mode_minutes");
3014 foreach ($this->pc_definition->getPCDefinitions() as $def) {
3015 $model_provider = $this->pc_definition->getPCModelProviderByName($def[
"name"]);
3016 if ($config->getEnablePCType($def[
"name"]) || $def[
"name"] ===
"PlaceHolder") {
3017 if (!is_null($model_provider)) {
3018 foreach ($model_provider->getModels(
3021 ) as $pc_id => $co_model) {
3022 $model[$pc_id] = $co_model;
3043 if (is_array($targets)) {
3044 foreach ($targets as $t) {
3045 $tarr = explode(
":", $t);
3047 if (is_object($cont_obj) && $cont_obj->getType() ==
"par") {
3048 $cont_obj->setCharacteristic($char_par);
3050 if (is_object($cont_obj) && $cont_obj->getType() ==
"sec") {
3051 $cont_obj->setCharacteristic($char_sec);
3053 if (is_object($cont_obj) && $cont_obj->getType() ==
"media") {
3054 $cont_obj->setClass($char_med);
assignCharacteristic(array $targets, string $char_par, string $char_sec, string $char_med)
Assign characteristic.
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)
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)
cutContents(array $a_hids)
Copy contents to clipboard and cut them from the page.
getContentDomNode(string $a_hier_id, string $a_pc_id="")
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)
setCopyProperties(ilPageObject $new_page)
ILIAS COPage ID ContentIdManager $content_id_manager
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)
setTranslationProperties(self $transl_page)
getEffectiveEditLockTime()
manipulateF(string $query, array $types, array $values)
ILIAS COPage PC DomainService $pc_service
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 getPagesWithLinks(string $a_parent_type, int $a_parent_id, string $a_lang="-")
Get all pages for parent object that contain internal links.
static _isScheduledActivation(int $a_id, string $a_parent_type, string $a_lang="-")
Check whether page is activated by time schedule.
const ILIAS_VERSION_NUMERIC
getDomNodeForPCId(string $pc_id)
ILIAS COPage ReadingTime ReadingTimeManager $reading_time_manager
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...
setContentIdManager(\ILIAS\COPage\ID\ContentIdManager $content_id_manager)
Class ChatMainBarProvider .
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.
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 _lookupName(int $a_user_id)
lookup user 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...
getContentObjectForPcId(string $pcid)
Get content object for pc id.
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)
getDomDoc()
Get dom doc (DOMDocument)
ilPageConfig $page_config
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 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.
setLimit(int $limit, int $offset=0)
Content object of ilPageObject (see ILIAS DTD).
handleRepositoryLinksOnCopy(array $a_mapping, int $a_source_ref_id)
Handle repository links on copy process.
deleteContent(string $a_hid, bool $a_update=true, string $a_pcid="", bool $move_operation=false)
delete content object with hierarchical id $a_hid
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.
insertContentNode(DOMNode $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
parses the objects.xml it handles the xml-description of all ilias objects
resolveResources(array $ref_mapping)
Resolve resources.
getHierIdsForPCIds(array $a_pc_ids)
Get hier ids for a set of pc ids.
ILIAS COPage Link LinkManager $link
saveInternalLinks(DOMDocument $a_domdoc)
save internal links of page
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.
getInternalLinks()
get all internal links that are used within the page
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.
ILIAS COPage PC PCDefinition $pc_definition
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:
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.
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.
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
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)...
getHistoryEntry(int $a_old_nr)
Get History Entry.
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.
ILIAS COPage Dom DomUtil $dom_util
query(string $query)
Run a (read-only) Query on the database.
setLanguage(string $a_val)
Set language.
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)
getContentTemplates()
Get content templates.
insertPCIds()
Insert Page Content IDs.
static _writeActive(int $a_id, string $a_parent_type, bool $a_active)
write activation status
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)
getEditLockInfo()
Get edit lock info.
moveIntLinks(array $a_from_to)
Move internal links from one destination to another.
sendParagraph(string $par_id, string $filename)
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.
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.
link(string $caption, string $href, bool $new_viewport=false)
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
copy(int $a_id, string $a_parent_type="", int $a_new_parent_id=0, bool $a_clone_mobs=false, int $obj_copy_id=0, bool $overwrite_existing=true)
Copy page.
getParagraphForPCID(string $pcid)
getPCIdsForHierIds(array $hier_ids)
Get hier ids for a set of pc ids.
manipulate(string $query)
Run a (write) Query on the database.
static _lookupType(int $id, bool $reference=false)
handleDeleteContent(?DOMNode $a_node=null, $move_operation=false)
Handle content before deletion This currently treats only plugged content If no node is given...
getRepoObjId()
Get object id of repository object that contains this page, return 0 if page does not belong to a rep...
ILIAS COPage Style StyleManager $style_manager
getMediaAliasElement(int $a_mob_id, int $a_nr=1)
get complete media object (alias) element
setActive(bool $a_active)
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)
ILIAS COPage Page PageManager $page_manager
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)
setRenderedTime(string $a_renderedtime)
static getAllPages(string $a_parent_type, int $a_parent_id, string $a_lang="-")
Get all pages for parent object.
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)