4define(
"IL_INSERT_BEFORE", 0);
5define(
"IL_INSERT_AFTER", 1);
6define(
"IL_INSERT_CHILD", 2);
8define(
"IL_CHAPTER_TITLE",
"st_title");
9define(
"IL_PAGE_TITLE",
"pg_title");
10define(
"IL_NO_HEADER",
"none");
133 final public function __construct($a_id = 0, $a_old_nr = 0, $a_lang =
"-")
136 $this->obj_definition =
$DIC[
"objDefinition"];
137 $this->db =
$DIC->database();
138 $this->
user = $DIC->user();
139 $this->lng =
$DIC->language();
140 $this->tree =
$DIC->repositoryTree();
151 $this->contains_int_link =
false;
152 $this->needs_parsing =
false;
153 $this->update_listeners = array();
154 $this->update_listener_cnt = 0;
155 $this->dom_builded =
false;
156 $this->page_not_found =
false;
157 $this->old_nr = $a_old_nr;
158 $this->encoding =
"UTF-8";
160 array(
"PageContent",
"TableRow",
"TableData",
"ListItem",
"FileItem",
161 "Section",
"Tab",
"ContentPopup",
"GridCell");
163 $this->show_page_act_info =
false;
195 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
207 $this->language = $a_val;
227 $this->page_config = $a_val;
247 $this->rendermd5 = $a_rendermd5;
257 return $this->rendermd5;
267 $this->renderedcontent = $a_renderedcontent;
277 return $this->renderedcontent;
287 $this->renderedtime = $a_renderedtime;
297 return $this->renderedtime;
307 $this->lastchange = $a_lastchange;
317 return $this->lastchange;
327 $this->last_change_user = $a_val;
337 return $this->last_change_user;
347 $this->show_page_act_info = $a_val;
357 return $this->show_page_act_info;
366 if ($this->old_nr == 0) {
367 $query =
"SELECT * FROM page_object" .
368 " WHERE page_id = " . $this->db->quote($this->
id,
"integer") .
369 " AND parent_type=" . $this->db->quote($this->
getParentType(),
"text") .
370 " AND lang = " . $this->db->quote($this->
getLanguage(),
"text");
371 $pg_set = $this->db->query(
$query);
372 $this->page_record = $this->db->fetchAssoc($pg_set);
373 $this->
setActive($this->page_record[
"active"]);
378 $query =
"SELECT * FROM page_history" .
379 " WHERE page_id = " . $this->db->quote($this->
id,
"integer") .
380 " AND parent_type=" . $this->db->quote($this->
getParentType(),
"text") .
381 " AND nr = " . $this->db->quote((
int) $this->old_nr,
"integer") .
382 " AND lang = " . $this->db->quote($this->
getLanguage(),
"text");
383 $pg_set = $this->db->query(
$query);
384 $this->page_record = $this->db->fetchAssoc($pg_set);
386 if (!$this->page_record) {
387 include_once(
"./Services/COPage/exceptions/class.ilCOPageNotFoundException.php");
392 $this->xml = $this->page_record[
"content"];
393 $this->
setParentId($this->page_record[
"parent_id"]);
394 $this->last_change_user = $this->page_record[
"last_change_user"];
395 $this->create_user = $this->page_record[
"create_user"];
409 public static function _exists($a_parent_type, $a_id, $a_lang =
"", $a_no_cache =
false)
415 if (!$a_no_cache && isset(self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang])) {
416 return self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang];
421 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
424 $query =
"SELECT page_id FROM page_object WHERE page_id = " .
$db->quote($a_id,
"integer") .
" " .
425 "AND parent_type = " .
$db->quote($a_parent_type,
"text") . $and_lang;
427 if (
$row =
$db->fetchAssoc($set)) {
428 self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang] =
true;
431 self::$exists[$a_parent_type .
":" . $a_id .
":" . $a_lang] =
false;
445 include_once(
"./Services/COPage/classes/class.ilPageUtil.php");
451 if ($this->dom_builded && !$a_force) {
465 $path =
"//PageObject";
467 if (count(
$res->nodeset) == 1) {
469 $this->node =
$res->nodeset[0];
474 $this->dom_builded =
true;
504 return $this->dom->myDOMDocument;
526 $this->parent_id = $a_id;
537 $this->update_listeners[$cnt][
"object"] = $a_object;
538 $this->update_listeners[$cnt][
"method"] = $a_method;
539 $this->update_listeners[$cnt][
"parameters"] = $a_parameters;
540 $this->update_listener_cnt++;
546 $object = $this->update_listeners[
$i][
"object"];
547 $method = $this->update_listeners[
$i][
"method"];
548 $parameters = $this->update_listeners[
$i][
"parameters"];
549 $object->$method($parameters);
560 $this->active = $a_active;
568 public function getActive($a_check_scheduled_activation =
false)
570 if ($a_check_scheduled_activation && !$this->active) {
571 include_once(
"./Services/Calendar/classes/class.ilDateTime.php");
593 "SELECT page_id, parent_type, lang, active, activation_start, activation_end, show_activation_info FROM page_object " .
594 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer")
596 while ($rec =
$db->fetchAssoc($set)) {
597 self::$activation_data[$rec[
"page_id"] .
":" . $rec[
"parent_type"] .
":" . $rec[
"lang"]] = $rec;
605 public static function _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation =
false, $a_lang =
"-")
616 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
617 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
620 "SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s" .
621 " AND parent_type = %s AND lang = %s",
622 array(
"integer",
"text",
"text"),
623 array($a_id, $a_parent_type, $a_lang)
625 $rec =
$db->fetchAssoc($set);
631 if (!$rec[
"active"] && $a_check_scheduled_activation) {
632 if ($rec[
"n"] >= $rec[
"activation_start"] &&
633 $rec[
"n"] <= $rec[
"activation_end"]) {
638 return $rec[
"active"];
657 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
658 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
661 "SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s" .
662 " AND parent_type = %s AND lang = %s",
663 array(
"integer",
"text",
"text"),
664 array($a_id, $a_parent_type, $a_lang)
666 $rec =
$db->fetchAssoc($set);
669 if (!$rec[
"active"] && $rec[
"activation_start"] !=
"") {
679 public static function _writeActive($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation =
true, $a_lang =
"-")
690 if ($a_reset_scheduled_activation) {
691 $st =
$db->manipulateF(
692 "UPDATE page_object SET active = %s, activation_start = %s, " .
693 " activation_end = %s WHERE page_id = %s" .
694 " AND parent_type = %s AND lang = %s",
695 array(
"boolean",
"timestamp",
"timestamp",
"integer",
"text",
"text"),
696 array($a_active,
null,
null, $a_id, $a_parent_type, $a_lang)
699 $st =
$db->prepareManip(
700 "UPDATE page_object SET active = %s WHERE page_id = %s" .
701 " AND parent_type = %s AND lang = %s",
702 array(
"boolean",
"integer",
"text",
"text"),
703 array($a_active, $a_id, $a_parent_type, $a_lang)
722 if (isset(self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang])) {
723 $rec = self::$activation_data[$a_id .
":" . $a_parent_type .
":" . $a_lang];
726 "SELECT active, activation_start, activation_end, show_activation_info FROM page_object WHERE page_id = %s" .
727 " AND parent_type = %s AND lang = %s",
728 array(
"integer",
"text",
"text"),
729 array($a_id, $a_parent_type, $a_lang)
731 $rec =
$db->fetchAssoc($set);
747 $res =
$db->query(
"SELECT parent_id FROM page_object WHERE page_id = " .
$db->quote($a_id,
"integer") .
" " .
748 "AND parent_type=" .
$db->quote(
$a_type,
"text"));
750 return $rec[
"parent_id"];
762 "UPDATE page_object SET parent_id = %s WHERE page_id = %s" .
763 " AND parent_type = %s",
764 array(
"integer",
"integer",
"text"),
765 array($a_par_id, $a_pg_id, $a_parent_type)
776 if ($a_activationstart ==
"") {
777 $a_activationstart =
null;
779 $this->activationstart = $a_activationstart;
789 return $this->activationstart;
799 if ($a_activationend ==
"") {
800 $a_activationend =
null;
802 $this->activationend = $a_activationend;
812 return $this->activationend;
826 if (!is_object($cont_node)) {
829 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
830 $node_name = $cont_node->node_name();
831 if ($node_name ==
"PageObject") {
834 if ($node_name ==
"PageContent") {
835 $child_node = $cont_node->first_child();
836 $node_name = $child_node->node_name();
840 if ($node_name ==
"Table") {
841 if ($child_node->get_attribute(
"DataTable") ==
"y") {
842 require_once(
"./Services/COPage/classes/class.ilPCDataTable.php");
844 $tab->setNode($cont_node);
845 $tab->setHierId($a_hier_id);
847 require_once(
"./Services/COPage/classes/class.ilPCTable.php");
849 $tab->setNode($cont_node);
850 $tab->setHierId($a_hier_id);
852 $tab->setPcId($a_pc_id);
857 if ($node_name ==
"MediaObject") {
858 if (
$_GET[
"pgEdMediaMode"] !=
"") {
859 echo
"ilPageObject::error media";
864 require_once(
"./Services/COPage/classes/class.ilPCMediaObject.php");
866 $mal_node = $child_node->first_child();
868 $id_arr = explode(
"_", $mal_node->get_attribute(
"OriginId"));
869 $mob_id = $id_arr[count($id_arr) - 1];
878 $mob->readMediaObject($mob_id);
881 $mob->setNode($cont_node);
882 $mob->setHierId($a_hier_id);
883 $mob->setPcId($a_pc_id);
894 if (!is_array($pc_def)) {
895 include_once(
"./Services/COPage/exceptions/class.ilCOPageUnknownPCTypeException.php");
898 $pc_class =
"ilPC" . $pc_def[
"name"];
899 $pc_path =
"./" . $pc_def[
"component"] .
"/" . $pc_def[
"directory"] .
"/class." . $pc_class .
".php";
900 require_once($pc_path);
901 $pc =
new $pc_class($this);
902 $pc->setNode($cont_node);
903 $pc->setHierId($a_hier_id);
904 $pc->setPcId($a_pc_id);
917 if ($a_hier_id ==
"pg") {
921 if ($a_pc_id !=
"") {
922 $path =
"//*[@PCID = '$a_pc_id']";
924 if (count(
$res->nodeset) == 1) {
925 $cont_node =
$res->nodeset[0];
931 $path =
"//*[@HierId = '$a_hier_id']";
933 if (count(
$res->nodeset) == 1) {
934 $cont_node =
$res->nodeset[0];
946 public function checkForTag($a_content_tag, $a_hier_id, $a_pc_id =
"")
950 if ($a_pc_id !=
"") {
951 $path =
"//*[@PCID = '$a_pc_id']//" . $a_content_tag;
953 if (count(
$res->nodeset) > 0) {
959 $path =
"//*[@HierId = '$a_hier_id']//" . $a_content_tag;
961 if (count(
$res->nodeset) > 0) {
971 $path =
"//*[@HierId = '$a_hier_id']";
973 if (count(
$res->nodeset) == 1) {
997 $this->encoding = $a_encoding;
1009 $this->xml.= $a_xml;
1022 $enc_str = (!empty($this->encoding))
1023 ?
"encoding=\"" . $this->encoding .
"\""
1025 return "<?xml version=\"1.0\" $enc_str ?>" .
1026 "<!DOCTYPE PageObject SYSTEM \"" . ILIAS_ABSOLUTE_PATH .
"/xml/" . $this->cur_dtd .
"\">" .
1039 $xml = $this->getXmlContent();
1041 '<?xml version="1.0" encoding="UTF-8"?>' .
$xml,
1048 $xml = $temp_dom->dump_mem(0, $this->encoding);
1049 $xml = preg_replace(
'/<\?xml[^>]*>/i',
"",
$xml);
1050 $xml = preg_replace(
'/<!DOCTYPE[^>]*>/i',
"",
$xml);
1068 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
1082 if ($a_clone_mobs) {
1088 $a_dom = $a_dom->myDOMDocument;
1090 foreach ($defs as
$def) {
1092 $cl =
$def[
"pc_class"];
1093 if ($cl ==
'ilPCPlugged') {
1095 ilPCPlugged::handleCopiedPluggedContent($this, $a_dom);
1097 $cl::handleCopiedContent($a_dom, $a_self_ass, $a_clone_mobs);
1109 public function handleDeleteContent($a_node =
null)
1111 if (!isset($a_node)) {
1113 $path =
"//PageContent";
1115 $nodes =
$res->nodeset;
1117 $nodes = array($a_node);
1120 require_once(
'Services/COPage/classes/class.ilPCPlugged.php');
1121 foreach ($nodes as
$node) {
1127 if (
$node->firstChild->nodeName ==
'Plugged') {
1128 ilPCPlugged::handleDeletedPluggedNode($this,
$node->firstChild);
1140 $path =
"//InteractiveImage/MediaAlias";
1145 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
1146 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1147 $or_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1152 if (!($inst_id > 0)) {
1154 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1159 $new_mob = $media_object->duplicate();
1161 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $new_mob->getId());
1173 $path =
"//MediaObject/MediaAlias";
1178 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
1179 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1180 $or_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1185 if (!($inst_id > 0)) {
1187 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1192 $new_mob = $media_object->duplicate();
1194 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $new_mob->getId());
1207 $path =
"//Question";
1212 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
1213 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1214 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
1219 if (!($inst_id > 0)) {
1221 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
1224 if (is_object($question) && $question->isComplete()) {
1228 $question->createPageObject();
1233 $duplicate_id = $question->duplicate(
false);
1234 $res->nodeset[
$i]->set_attribute(
"QRef",
"il__qst_" . $duplicate_id);
1250 $path =
"//Question";
1253 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1254 $parent_node =
$res->nodeset[
$i]->parent_node();
1255 $parent_node->unlink_node($parent_node);
1271 $path =
"//PageContent";
1274 return count(
$res->nodeset);
1282 $a_incl_head =
false,
1283 $a_append_mobs =
false,
1284 $a_append_bib =
false,
1286 $a_omit_pageobject_tag =
false
1290 return $this->dom->dump_mem(0, $this->encoding);
1293 if ($a_append_mobs || $a_append_bib || $a_append_link_info) {
1296 if ($a_append_mobs) {
1299 if ($a_append_bib) {
1305 return "<dummy>" . $this->dom->dump_node($this->node) .
$mobs . $bibs . $trans . $a_append_str .
"</dummy>";
1307 if (is_object($this->dom)) {
1308 if ($a_omit_pageobject_tag) {
1310 $childs = $this->node->child_nodes();
1311 for (
$i = 0;
$i < count($childs);
$i++) {
1312 $xml.= $this->dom->dump_node($childs[
$i]);
1316 $xml = $this->dom->dump_mem(0, $this->encoding);
1317 $xml = preg_replace(
'/<\?xml[^>]*>/i',
"",
$xml);
1318 $xml = preg_replace(
'/<!DOCTYPE[^>]*>/i',
"",
$xml);
1338 "ed_paste_clip",
"ed_edit",
"ed_edit_prop",
"ed_delete",
"ed_moveafter",
1339 "ed_movebefore",
"ed_go",
"ed_class",
"ed_width",
"ed_align_left",
1340 "ed_align_right",
"ed_align_center",
"ed_align_left_float",
1341 "ed_align_right_float",
"ed_delete_item",
"ed_new_item_before",
1342 "ed_new_item_after",
"ed_copy_clip",
"please_select",
"ed_split_page",
1343 "ed_item_up",
"ed_item_down",
"ed_split_page_next",
"ed_enable",
1344 "de_activate",
"ed_paste",
"ed_edit_multiple",
"ed_cut",
"ed_copy",
"ed_insert_templ",
1345 "ed_click_to_add_pg",
"download");
1348 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
1350 foreach ($defs as
$def) {
1351 $lang_vars[] =
"pc_" .
$def[
"pc_type"];
1352 $lang_vars[] =
"ed_insert_" .
$def[
"pc_type"];
1355 $cl =
$def[
"pc_class"];
1356 $lvs = call_user_func(
$def[
"pc_class"] .
'::getLangVars');
1357 foreach ($lvs as $lv) {
1362 foreach ($lang_vars as $lang_var) {
1373 $xml.=
"<LV name=\"$var\" value=\"" . $this->lng->txt(
"cont_" . $var) .
"\"/>";
1381 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
1383 $path =
"//Paragraph[1]";
1385 if (count(
$res->nodeset) > 0) {
1386 $cont_node =
$res->nodeset[0]->parent_node();
1388 $par->setNode($cont_node);
1389 $text = $par->getText();
1406 if (is_object(
$node)) {
1425 $this->contains_int_link = $a_contains_link;
1445 $this->import_mode = $a_val;
1460 if ($a_parse ===
true) {
1461 $this->needs_parsing =
true;
1463 if ($a_parse ===
false) {
1464 $this->needs_parsing =
false;
1477 $this->contains_question = $a_val;
1487 return $this->contains_question;
1501 $path =
"//MediaObject/MediaAlias";
1504 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1505 $id_arr = explode(
"_",
$res->nodeset[
$i]->get_attribute(
"OriginId"));
1506 $mob_id = $id_arr[count($id_arr) - 1];
1507 $mob_ids[$mob_id] = $mob_id;
1512 $path =
"//InteractiveImage/MediaAlias";
1514 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1515 $id_arr = explode(
"_",
$res->nodeset[
$i]->get_attribute(
"OriginId"));
1516 $mob_id = $id_arr[count($id_arr) - 1];
1517 $mob_ids[$mob_id] = $mob_id;
1522 $path =
"//IntLink[@Type = 'MediaObject']";
1525 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1526 if ((
$res->nodeset[
$i]->get_attribute(
"TargetFrame") ==
"") ||
1527 (!$a_inline_only)) {
1529 $id_arr = explode(
"_",
$target);
1530 if (($id_arr[1] == IL_INST_ID) ||
1531 (substr(
$target, 0, 4) ==
"il__")) {
1532 $mob_id = $id_arr[count($id_arr) - 1];
1534 $mob_ids[$mob_id] = $mob_id;
1552 $path =
"//IntLink";
1557 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1559 if ($a_cnt_multiple) {
1560 $add =
":" . $cnt_multiple;
1564 $targetframe =
$res->nodeset[
$i]->get_attribute(
"TargetFrame");
1565 $anchor =
$res->nodeset[
$i]->get_attribute(
"Anchor");
1568 "TargetFrame" => $targetframe,
"Anchor" => $anchor);
1571 if (
$type ==
"MediaObject" && $targetframe ==
"") {
1572 if (substr(
$target, 0, 4) ==
"il__") {
1573 $id_arr = explode(
"_",
$target);
1574 $id = $id_arr[count($id_arr) - 1];
1577 foreach ($med_links as
$key => $med_link) {
1589 $path =
"//MediaAlias";
1592 require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
1593 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1594 $oid =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1595 if (substr($oid, 0, 4) ==
"il__") {
1596 $id_arr = explode(
"_", $oid);
1597 $id = $id_arr[count($id_arr) - 1];
1600 foreach ($med_links as
$key => $med_link) {
1621 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1622 foreach ($mob_ids as $mob_id => $dummy) {
1625 $mobs_xml .= $mob_obj->getXML(
IL_MODE_OUTPUT, $a_inst = 0,
true);
1639 $path =
"//MediaObject/MediaAlias[@OriginId='il__mob_$a_mob_id']";
1641 $mal_node =
$res->nodeset[$a_nr - 1];
1642 $mob_node = $mal_node->parent_node();
1644 return $this->dom->dump_node($mob_node);
1657 libxml_disable_entity_loader(
false);
1659 @$this->dom->validate(
$error);
1682 $this->hier_ids = array();
1683 $this->first_row_ids = array();
1684 $this->first_col_ids = array();
1685 $this->list_item_ids = array();
1686 $this->file_item_ids = array();
1693 foreach ($this->id_elements as $el) {
1694 $path.= $sep .
"//" . $el;
1699 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1700 $cnode =
$res->nodeset[
$i];
1701 $ctag = $cnode->node_name();
1705 while ($cnode = $cnode->previous_sibling()) {
1706 if (($cnode->node_type() == XML_ELEMENT_NODE)
1707 && $cnode->has_attribute(
"HierId")) {
1708 $sib_hier_id = $cnode->get_attribute(
"HierId");
1714 if ($sib_hier_id !=
"") {
1715 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
1717 $res->nodeset[
$i]->set_attribute(
"HierId", $node_hier_id);
1718 $this->hier_ids[] = $node_hier_id;
1719 if ($ctag ==
"TableData") {
1720 if (substr($par_hier_id, strlen($par_hier_id)-2) ==
"_1") {
1721 $this->first_row_ids[] = $node_hier_id;
1724 if ($ctag ==
"ListItem") {
1725 $this->list_item_ids[] = $node_hier_id;
1727 if ($ctag ==
"FileItem") {
1728 $this->file_item_ids[] = $node_hier_id;
1732 $cnode =
$res->nodeset[
$i];
1734 while ($cnode = $cnode->parent_node()) {
1735 if (($cnode->node_type() == XML_ELEMENT_NODE)
1736 && $cnode->has_attribute(
"HierId")) {
1737 $par_hier_id = $cnode->get_attribute(
"HierId");
1743 if (($par_hier_id !=
"") && ($par_hier_id !=
"pg")) {
1744 $node_hier_id = $par_hier_id .
"_1";
1745 $res->nodeset[
$i]->set_attribute(
"HierId", $node_hier_id);
1746 $this->hier_ids[] = $node_hier_id;
1747 if ($ctag ==
"TableData") {
1748 $this->first_col_ids[] = $node_hier_id;
1749 if (substr($par_hier_id, strlen($par_hier_id)-2) ==
"_1") {
1750 $this->first_row_ids[] = $node_hier_id;
1753 if ($ctag ==
"ListItem") {
1754 $this->list_item_ids[] = $node_hier_id;
1756 if ($ctag ==
"FileItem") {
1757 $this->file_item_ids[] = $node_hier_id;
1760 $node_hier_id =
"1";
1761 $res->nodeset[
$i]->set_attribute(
"HierId", $node_hier_id);
1762 $this->hier_ids[] = $node_hier_id;
1769 $path =
"//PageObject";
1771 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1772 $res->nodeset[
$i]->set_attribute(
"HierId",
"pg");
1773 $this->hier_ids[] =
"pg";
1783 return $this->hier_ids;
1792 return $this->first_row_ids;
1801 return $this->first_col_ids;
1810 return $this->list_item_ids;
1819 return $this->file_item_ids;
1827 if (is_object($this->dom)) {
1829 $path =
"//*[@HierId]";
1831 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1832 if (
$res->nodeset[
$i]->has_attribute(
"HierId")) {
1833 $res->nodeset[
$i]->remove_attribute(
"HierId");
1845 if (!is_array($a_pc_ids) || count($a_pc_ids) == 0) {
1850 if (is_object($this->dom)) {
1852 $path =
"//*[@PCID]";
1854 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1855 $pc_id =
$res->nodeset[
$i]->get_attribute(
"PCID");
1856 if (in_array($pc_id, $a_pc_ids)) {
1857 $ret[$pc_id] =
$res->nodeset[
$i]->get_attribute(
"HierId");
1873 $path =
"//FileItem";
1875 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1876 $cnode =
$res->nodeset[
$i];
1877 $size_node = $this->dom->create_element(
"Size");
1878 $size_node = $cnode->append_child($size_node);
1880 $childs = $cnode->child_nodes();
1882 for ($j = 0; $j < count($childs); $j++) {
1883 if ($childs[$j]->node_name() ==
"Identifier") {
1884 if ($childs[$j]->has_attribute(
"Entry")) {
1885 $entry = $childs[$j]->get_attribute(
"Entry");
1886 $entry_arr = explode(
"_", $entry);
1887 $id = $entry_arr[count($entry_arr) - 1];
1888 require_once(
"./Modules/File/classes/class.ilObjFile.php");
1893 $size_node->set_content(
$size);
1908 $this->log->debug(
"start");
1912 $path =
"//IntLink";
1914 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1918 if ($a_link_map ==
null) {
1920 $this->log->debug(
"no map, type: " .
$type .
", target: " .
$target .
", new target: " . $new_target);
1923 $nt = explode(
"_", $a_link_map[
$target]);
1924 $new_target =
false;
1925 if ($nt[1] == IL_INST_ID) {
1926 $new_target =
"il__" . $nt[2] .
"_" . $nt[3];
1928 $this->log->debug(
"map, type: " .
$type .
", target: " .
$target .
", new target: " . $new_target);
1930 if ($new_target !==
false) {
1931 $res->nodeset[
$i]->set_attribute(
"Target", $new_target);
1935 IL_INST_ID > 0 &&
$type !=
"RepositoryItem") {
1938 $res->nodeset[
$i]->set_attribute(
"Target", $new_target);
1948 $path =
"//MediaAlias";
1952 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1953 $orig_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1954 $id_arr = explode(
"_", $orig_id);
1955 $mob_id = $id_arr[count($id_arr) - 1];
1972 $path =
"//MediaAlias";
1975 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
1977 $old_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
1978 $old_id = explode(
"_", $old_id);
1979 $old_id = $old_id[count($old_id) - 1];
1983 if ($a_mapping[$old_id] > 0) {
1984 $new_id = $a_mapping[$old_id];
1985 if ($a_reuse_existing_by_import) {
1988 $imp = explode(
"_", $import_id);
1996 if ($import_id ==
"" && $a_reuse_existing_by_import) {
1999 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2001 if (in_array($old_id, $med_of_def_lang)) {
2005 if ($new_id !=
"") {
2006 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $new_id);
2025 $path =
"//InteractiveImage/MediaAlias";
2028 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2029 $old_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
2030 if ($a_mapping[$old_id] > 0) {
2031 $res->nodeset[
$i]->set_attribute(
"OriginId",
"il__mob_" . $a_mapping[$old_id]);
2051 $path =
"//FileItem/Identifier";
2054 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2055 $old_id =
$res->nodeset[
$i]->get_attribute(
"Entry");
2056 $old_id = explode(
"_", $old_id);
2057 $old_id = $old_id[count($old_id) - 1];
2058 if ($a_mapping[$old_id] > 0) {
2059 $res->nodeset[
$i]->set_attribute(
"Entry",
"il__file_" . $a_mapping[$old_id]);
2077 $path =
"//Question";
2080 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2081 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
2083 if (isset($a_mapping[$qref])) {
2084 $res->nodeset[
$i]->set_attribute(
"QRef",
"il__qst_" . $a_mapping[$qref][
"pool"]);
2109 $path =
"//IntLink";
2111 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2115 if ($a_from_to[$obj_id] > 0 && is_int(strpos(
$target,
"__"))) {
2117 $res->nodeset[
$i]->set_attribute(
"Target",
"il__pg_" . $a_from_to[$obj_id]);
2121 $res->nodeset[
$i]->set_attribute(
"Target",
"il__st_" . $a_from_to[$obj_id]);
2124 if (
$type ==
"PortfolioPage") {
2125 $res->nodeset[
$i]->set_attribute(
"Target",
"il__ppage_" . $a_from_to[$obj_id]);
2135 $path =
"//MediaAlias";
2138 require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
2139 require_once(
"Services/COPage/classes/class.ilMediaAliasItem.php");
2141 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2142 $media_object_node =
$res->nodeset[
$i]->parent_node();
2143 $page_content_node = $media_object_node->parent_node();
2144 $c_hier_id = $page_content_node->get_attribute(
"HierId");
2152 $areas = $std_alias_item->getMapAreas();
2153 $correction_needed =
false;
2154 if (count($areas) > 0) {
2156 foreach ($areas as $area) {
2157 if ($area[
"Type"] ==
"PageObject" ||
2158 $area[
"Type"] ==
"StructureObject") {
2159 $t = $area[
"Target"];
2160 $tid = _extractObjIdOfTarget(
$t);
2161 if ($a_from_to[$tid] > 0) {
2162 $correction_needed =
true;
2171 $oid =
$res->nodeset[
$i]->get_attribute(
"OriginId");
2172 if (substr($oid, 0, 4) ==
"il__") {
2173 $id_arr = explode(
"_", $oid);
2174 $id = $id_arr[count($id_arr) - 1];
2177 $med_item = $mob->getMediaItem(
"Standard");
2178 $med_areas = $med_item->getMapAreas();
2180 foreach ($med_areas as $area) {
2181 $link_type = ($area->getLinkType() ==
"int")
2186 "Nr" => $area->getNr(),
2187 "Shape" => $area->getShape(),
2188 "Coords" => $area->getCoords(),
2190 "LinkType" => $link_type,
2191 "Href" => $area->getHref(),
2192 "Title" => $area->getTitle(),
2193 "Target" => $area->getTarget(),
2194 "Type" => $area->getType(),
2195 "TargetFrame" => $area->getTargetFrame()
2199 if ($area->getType() ==
"PageObject" ||
2200 $area->getType() ==
"StructureObject") {
2201 $t = $area->getTarget();
2203 if ($a_from_to[$tid] > 0) {
2204 $correction_needed =
true;
2213 if ($correction_needed) {
2215 $std_alias_item->deleteAllMapAreas();
2216 foreach ($areas as $area) {
2217 if ($area[
"Link"][
"LinkType"] ==
"IntLink") {
2218 $target = $area[
"Link"][
"Target"];
2219 $type = $area[
"Link"][
"Type"];
2221 if ($a_from_to[$obj_id] > 0) {
2223 $area[
"Link"][
"Target"] =
"il__pg_" . $a_from_to[$obj_id];
2226 $area[
"Link"][
"Target"] =
"il__st_" . $a_from_to[$obj_id];
2231 $std_alias_item->addMapArea(
2234 $area[
"Link"][
"Title"],
2235 array(
"Type" => $area[
"Link"][
"Type"],
2236 "TargetFrame" => $area[
"Link"][
"TargetFrame"],
2237 "Target" => $area[
"Link"][
"Target"],
2238 "Href" => $area[
"Link"][
"Href"],
2239 "LinkType" => $area[
"Link"][
"LinkType"],
2258 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
2267 foreach ($sources as
$source) {
2269 if (
$source[
"type"] ==
"lm:pg") {
2271 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
2274 if (!$page_obj->page_not_found) {
2276 $page_obj->handleImportRepositoryLink(
2282 $page_obj->update();
2295 $path =
"//IntLink";
2298 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2302 if (
$target == $a_rep_import_id &&
$type ==
"RepositoryItem") {
2304 $res->nodeset[
$i]->set_attribute(
2306 "il__" . $a_rep_type .
"_" . $a_rep_ref_id
2324 $this->log->debug(
"Handle repository links...");
2328 $path =
"//IntLink";
2330 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2333 $this->log->debug(
"Target: " .
$target);
2335 if (
$type ==
"RepositoryItem" && ((
int)
$t[1] == 0 || (
int)
$t[1] == IL_INST_ID)) {
2336 if (isset($a_mapping[
$t[3]])) {
2338 $this->log->debug(
"... replace " .
$t[3] .
" with " . $a_mapping[
$t[3]] .
".");
2339 $res->nodeset[
$i]->set_attribute(
2341 "il__obj_" . $a_mapping[
$t[3]]
2343 } elseif ($this->tree->isGrandChild($a_source_ref_id,
$t[3])) {
2345 $this->log->debug(
"... remove links.");
2346 if (
$res->nodeset[
$i]->parent_node()->node_name() ==
"MapArea") {
2347 $parent =
$res->nodeset[
$i]->parent_node();
2348 $parent->unlink_node($parent);
2350 $source_node =
$res->nodeset[
$i];
2351 $new_node = $source_node->clone_node(
true);
2352 $new_node->unlink_node($new_node);
2353 $childs = $new_node->child_nodes();
2354 for ($j = 0; $j < count($childs); $j++) {
2355 $this->log->debug(
"... move node $j " . $childs[$j]->node_name() .
" before " . $source_node->node_name());
2356 $source_node->insert_before($childs[$j], $source_node);
2358 $source_node->unlink_node($source_node);
2366 $ilias_url = parse_url(ILIAS_HTTP_PATH);
2368 $path =
"//ExtLink";
2370 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
2371 $href =
$res->nodeset[
$i]->get_attribute(
"Href");
2372 $this->log->debug(
"Href: " . $href);
2374 $url = parse_url($href);
2377 $this->log->debug(
"Host: " .
$url[
"host"]);
2378 if (
$url[
"host"] !=
"" &&
$url[
"host"] != $ilias_url[
"host"]) {
2384 foreach (explode(
"&",
$url[
"query"]) as $p) {
2385 $p = explode(
"=", $p);
2386 $par[$p[0]] = $p[1];
2389 $target_client_id = $par[
"client_id"];
2390 if ($target_client_id !=
"" && $target_client_id != CLIENT_ID) {
2396 if (is_int(strpos($href,
"goto.php"))) {
2397 $t = explode(
"_", $par[
"target"]);
2398 if ($objDefinition->isRBACObject(
$t[0])) {
2399 $ref_id = (int)
$t[1];
2402 } elseif (is_int(strpos($href,
"ilias.php"))) {
2403 $ref_id = (int) $par[
"ref_id"];
2408 if (isset($a_mapping[$ref_id])) {
2409 $new_ref_id = $a_mapping[$ref_id];
2412 if (is_int(strpos($href,
"goto.php"))) {
2413 $nt = str_replace(
$type .
"_" . $ref_id,
$type .
"_" . $new_ref_id, $par[
"target"]);
2414 $new_href = str_replace(
"target=" . $par[
"target"],
"target=" . $nt, $href);
2415 } elseif (is_int(strpos($href,
"ilias.php"))) {
2416 $new_href = str_replace(
"ref_id=" . $par[
"ref_id"],
"ref_id=" . $new_ref_id, $href);
2418 if ($new_href !=
"") {
2419 $this->log->debug(
"... ext link replace " . $href .
" with " . $new_href .
".");
2420 $res->nodeset[
$i]->set_attribute(
"Href", $new_href);
2422 } elseif (
$tree->isGrandChild($a_source_ref_id, $ref_id)) {
2424 $this->log->debug(
"... remove ext links.");
2425 if (
$res->nodeset[
$i]->parent_node()->node_name() ==
"MapArea") {
2426 $parent =
$res->nodeset[
$i]->parent_node();
2427 $parent->unlink_node($parent);
2429 $source_node =
$res->nodeset[
$i];
2430 $new_node = $source_node->clone_node(
true);
2431 $new_node->unlink_node($new_node);
2432 $childs = $new_node->child_nodes();
2433 for ($j = 0; $j < count($childs); $j++) {
2434 $this->log->debug(
"... move node $j " . $childs[$j]->node_name() .
" before " . $source_node->node_name());
2435 $source_node->insert_before($childs[$j], $source_node);
2437 $source_node->unlink_node($source_node);
2465 $this->db->insert(
"page_object", array(
2466 "page_id" => array(
"integer", $this->
getId()),
2467 "parent_id" => array(
"integer", $this->
getParentId()),
2469 "content" => array(
"clob", $content),
2471 "create_user" => array(
"integer", $this->
user->getId()),
2472 "last_change_user" => array(
"integer", $this->
user->getId()),
2473 "active" => array(
"integer", (
int) $this->
getActive()),
2477 "inactive_elements" => array(
"integer", $iel),
2478 "int_links" => array(
"integer", $inl),
2480 "last_change" => array(
"timestamp",
ilUtil::now())
2498 $this->log->debug(
"ilPageObject, updateFromXML(): start, id: " . $this->
getId());
2502 $this->log->debug(
"ilPageObject, updateFromXML(): content: " . substr($content, 0, 100));
2510 $this->db->update(
"page_object", array(
2511 "content" => array(
"clob", $content),
2512 "parent_id" => array(
"integer", $this->
getParentId()),
2513 "last_change_user" => array(
"integer", $this->
user->getId()),
2514 "last_change" => array(
"timestamp",
ilUtil::now()),
2515 "active" => array(
"integer", $this->
getActive()),
2518 "inactive_elements" => array(
"integer", $iel),
2519 "int_links" => array(
"integer", $inl),
2521 "page_id" => array(
"integer", $this->
getId()),
2529 $this->log->debug(
"ilPageObject, updateFromXML(): end");
2540 final protected function __afterUpdate($a_domdoc, $a_xml, $a_creation =
false, $a_empty =
false)
2543 if (!$a_creation || !$a_empty) {
2553 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
2555 foreach ($defs as
$def) {
2557 $cl =
$def[
"pc_class"];
2558 call_user_func(
$def[
"pc_class"] .
'::afterPageUpdate', $this, $a_domdoc, $a_xml, $a_creation);
2584 public function update($a_validate =
true, $a_no_history =
false)
2586 $this->log->debug(
"ilPageObject, update(): start, id: " . $this->
getId());
2601 include_once(
"./Services/User/classes/class.ilUserUtil.php");
2604 1 =>
"nocontent#" . $this->lng->txt(
"cont_not_saved_edit_lock_expired") .
"<br />" .
2605 $this->lng->txt(
"obj_usr") .
": " .
2607 $this->lng->txt(
"content_until") .
": " .
2613 $this->log->debug(
"ilPageObject, update(): errors: " . print_r(
$errors,
true));
2629 $old_set = $this->db->query(
"SELECT * FROM page_object WHERE " .
2630 "page_id = " . $this->db->quote($this->getId(),
"integer") .
" AND " .
2631 "parent_type = " . $this->db->quote($this->getParentType(),
"text") .
" AND " .
2632 "lang = " . $this->db->quote($this->getLanguage(),
"text"));
2633 $last_nr_set = $this->db->query(
"SELECT max(nr) as mnr FROM page_history WHERE " .
2634 "page_id = " . $this->db->quote($this->getId(),
"integer") .
" AND " .
2635 "parent_type = " . $this->db->quote($this->getParentType(),
"text") .
" AND " .
2636 "lang = " . $this->db->quote($this->getLanguage(),
"text"));
2637 $last_nr = $this->db->fetchAssoc($last_nr_set);
2638 if ($old_rec = $this->db->fetchAssoc($old_set)) {
2641 if (($content != $old_rec[
"content"] || $this->
user->getId() != $old_rec[
"last_change_user"]) &&
2642 !$a_no_history && !$this->history_saved &&
$lm_set->get(
"page_history", 1)) {
2643 if ($old_rec[
"content"] !=
"<PageObject></PageObject>") {
2644 $this->db->manipulateF(
2645 "DELETE FROM page_history WHERE " .
2646 "page_id = %s AND parent_type = %s AND hdate = %s AND lang = %s",
2647 array(
"integer",
"text",
"timestamp",
"text"),
2648 array($old_rec[
"page_id"], $old_rec[
"parent_type"], $old_rec[
"last_change"], $old_rec[
"lang"])
2653 $last_c = $old_rec[
"last_change"];
2654 if ($last_c ==
"") {
2658 $this->db->insert(
"page_history", array(
2659 "page_id" => array(
"integer", $old_rec[
"page_id"]),
2660 "parent_type" => array(
"text", $old_rec[
"parent_type"]),
2661 "lang" => array(
"text", $old_rec[
"lang"]),
2662 "hdate" => array(
"timestamp", $last_c),
2663 "parent_id" => array(
"integer", $old_rec[
"parent_id"]),
2664 "content" => array(
"clob", $old_rec[
"content"]),
2665 "user_id" => array(
"integer", $old_rec[
"last_change_user"]),
2667 "nr" => array(
"integer", (
int) $last_nr[
"mnr"] + 1)
2670 $old_content = $old_rec[
"content"];
2671 $old_domdoc =
new DOMDocument();
2672 $old_nr = $last_nr[
"mnr"] + 1;
2673 $old_domdoc->loadXML(
'<?xml version="1.0" encoding="UTF-8"?>' . $old_content);
2678 $this->history_saved =
true;
2680 $this->history_saved =
true;
2685 $em = (trim($content) ==
"<PageObject/>")
2693 $this->db->update(
"page_object", array(
2694 "content" => array(
"clob", $content),
2695 "parent_id" => array(
"integer", $this->
getParentId()),
2696 "last_change_user" => array(
"integer", $this->
user->getId()),
2697 "last_change" => array(
"timestamp",
ilUtil::now()),
2698 "is_empty" => array(
"integer", $em),
2699 "active" => array(
"integer", $this->
getActive()),
2703 "inactive_elements" => array(
"integer", $iel),
2704 "int_links" => array(
"integer", $inl),
2706 "page_id" => array(
"integer", $this->
getId()),
2714 $this->log->debug(
"ilPageObject, update(): updated and returning true, content: " . substr($this->
getXMLContent(), 0, 100));
2728 public function delete()
2731 $copg_logger->debug(
2732 "ilPageObject: Delete called for ID '" . $this->
getId() .
"'," .
2734 " hist nr: '" . $this->old_nr .
"', " .
2741 if (!$this->page_not_found) {
2745 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2747 foreach ($mobs2 as
$m) {
2753 $copg_logger->debug(
"ilPageObject: ... found " . count(
$mobs) .
" media objects.");
2758 $this->handleDeleteContent();
2770 include_once(
"./Services/News/classes/class.ilNewsItem.php");
2779 $this->db->manipulate(
"DELETE FROM page_object " .
2780 "WHERE page_id = " . $this->db->quote($this->getId(),
"integer") .
2781 " AND parent_type= " . $this->db->quote($this->getParentType(),
"text"));
2784 foreach (
$mobs as $mob_id) {
2785 $copg_logger->debug(
"ilPageObject: ... processing mob " . $mob_id .
".");
2788 $copg_logger->debug(
"ilPageObject: ... type mismatch. Ignoring mob " . $mob_id .
".");
2793 $copg_logger->debug(
"ilPageObject: ... delete mob " . $mob_id .
".");
2798 $copg_logger->debug(
"ilPageObject: ... missing mob " . $mob_id .
".");
2811 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
2813 foreach ($defs as
$def) {
2815 $cl =
$def[
"pc_class"];
2816 call_user_func(
$def[
"pc_class"] .
'::beforePageDelete', $this);
2831 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
2833 foreach ($defs as
$def) {
2835 $cl =
$def[
"pc_class"];
2836 call_user_func(
$def[
"pc_class"] .
'::afterPageHistoryEntry', $this, $a_old_domdoc, $a_old_content, $a_old_nr);
2848 $xpath =
new DOMXPath($a_domdoc);
2849 $path =
"//Paragraph | //Section | //MediaAlias | //FileItem" .
2850 " | //Table | //TableData | //Tabs | //List";
2851 $nodes = $xpath->query(
$path);
2853 foreach ($nodes as
$node) {
2854 switch (
$node->localName) {
2856 $sname =
$node->getAttribute(
"Characteristic");
2857 $stype =
"text_block";
2862 $sname =
$node->getAttribute(
"Characteristic");
2868 $sname =
$node->getAttribute(
"Class");
2869 $stype =
"media_cont";
2874 $sname =
$node->getAttribute(
"Class");
2875 $stype =
"flist_li";
2880 $sname =
$node->getAttribute(
"Template");
2882 $sname =
$node->getAttribute(
"Class");
2892 $sname =
$node->getAttribute(
"Class");
2893 $stype =
"table_cell";
2898 $sname =
$node->getAttribute(
"Template");
2900 if (
$node->getAttribute(
"Type") ==
"HorizontalAccordion") {
2901 $stype =
"haccordion";
2903 if (
$node->getAttribute(
"Type") ==
"VerticalAccordion") {
2904 $stype =
"vaccordion";
2911 $sname =
$node->getAttribute(
"Class");
2912 if (
$node->getAttribute(
"Type") ==
"Ordered") {
2920 if ($sname !=
"" && $stype !=
"") {
2921 $usages[$sname .
":" . $stype .
":" .
$template] = array(
"sname" => $sname,
2922 "stype" => $stype,
"template" =>
$template);
2929 foreach ($usages as $u) {
2930 $id = $this->db->nextId(
'page_style_usage');
2932 $this->db->manipulate(
"INSERT INTO page_style_usage " .
2933 "(id, page_id, page_type, page_lang, page_nr, template, stype, sname) VALUES (" .
2934 $this->db->quote(
$id,
"integer") .
"," .
2935 $this->db->quote($this->getId(),
"integer") .
"," .
2936 $this->db->quote($this->getParentType(),
"text") .
"," .
2937 $this->db->quote($this->getLanguage(),
"text") .
"," .
2938 $this->db->quote($a_old_nr,
"integer") .
"," .
2939 $this->db->quote($u[
"template"],
"integer") .
"," .
2940 $this->db->quote($u[
"stype"],
"text") .
"," .
2941 $this->db->quote($u[
"sname"],
"text") .
2954 if ($a_old_nr !==
false) {
2955 $and_old_nr =
" AND page_nr = " . $this->db->quote($a_old_nr,
"integer");
2958 $this->db->manipulate(
2959 "DELETE FROM page_style_usage WHERE " .
2960 " page_id = " . $this->db->quote($this->getId(),
"integer") .
2961 " AND page_type = " . $this->db->quote($this->getParentType(),
"text") .
2962 " AND page_lang = " . $this->db->quote($this->getLanguage(),
"text") .
2975 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2976 include_once(
"./Modules/File/classes/class.ilObjFile.php");
2997 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
3017 $xpath =
new DOMXPath($a_domdoc);
3018 $nodes = $xpath->query(
'//IntLink');
3019 foreach ($nodes as
$node) {
3020 $link_type =
$node->getAttribute(
"Type");
3022 switch ($link_type) {
3023 case "StructureObject":
3031 case "GlossaryItem":
3039 case "RepositoryItem":
3051 case "PortfolioPage":
3065 if (is_int(strpos(
$target,
"__"))) {
3102 $this->handleDeleteContent($curr_node);
3103 $curr_node->unlink_node($curr_node);
3119 if (!is_array($a_hids)) {
3122 foreach ($a_hids as $a_hid) {
3123 $a_hid = explode(
":", $a_hid);
3128 if (!$this->
checkForTag(
"Question", $a_hid[0], $a_hid[1]) || $a_self_ass) {
3130 if (is_object($curr_node)) {
3131 $parent_node = $curr_node->parent_node();
3132 if ($parent_node->node_name() !=
"TableRow") {
3133 $this->handleDeleteContent($curr_node);
3134 $curr_node->unlink_node($curr_node);
3164 if (!is_array($a_hids)) {
3170 $hier_ids = array();
3172 foreach ($a_hids as $a_hid) {
3176 $a_hid = explode(
":", $a_hid);
3180 foreach ($hier_ids as
$h) {
3181 if (
$h .
"_" == substr($a_hid[0], 0, strlen(
$h) + 1)) {
3182 $skip[] = $a_hid[0];
3184 if ($a_hid[0] .
"_" == substr(
$h, 0, strlen($a_hid[0]) + 1)) {
3188 $pc_id[$a_hid[0]] = $a_hid[1];
3189 if ($a_hid[0] !=
"") {
3190 $hier_ids[$a_hid[0]] = $a_hid[0];
3193 foreach ($skip as
$s) {
3194 unset($hier_ids[
$s]);
3196 include_once(
"./Services/COPage/classes/class.ilPageContent.php");
3199 foreach ($hier_ids as $hid) {
3201 if (is_object($curr_node)) {
3202 if ($curr_node->node_name() ==
"PageContent") {
3203 $content = $this->dom->dump_node($curr_node);
3205 $content = preg_replace(
'/PCID=\"[a-z0-9]*\"/i',
"", $content);
3206 $content = preg_replace(
'/HierId=\"[a-z0-9_]*\"/i',
"", $content);
3208 $user->addToPCClipboard($content,
$time, $nr);
3213 include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
3224 $a_hid = explode(
":", $a_hier_id);
3225 $content =
$user->getPCClipboardContent();
3229 for (
$i = count($content) - 1;
$i >= 0;
$i--) {
3232 '<?xml version="1.0" encoding="UTF-8"?>' . $c,
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);
3265 if (!is_array($a_hids)) {
3268 $obj = &$this->content_obj;
3270 foreach ($a_hids as $a_hid) {
3271 $a_hid = explode(
":", $a_hid);
3273 if (is_object($curr_node)) {
3274 if ($curr_node->node_name() ==
"PageContent") {
3276 if ($cont_obj->isEnabled()) {
3278 if (!$this->
checkForTag(
"Question", $a_hid[0], $a_hid[1]) || $a_self_ass) {
3279 $cont_obj->disable();
3282 $cont_obj->enable();
3306 foreach ($hier_ids as $hier_id) {
3308 if (!is_int(strpos($hier_id,
"_"))) {
3309 if ($hier_id !=
"pg" && $hier_id >= $a_hid) {
3311 $this->handleDeleteContent($curr_node);
3312 $curr_node->unlink_node($curr_node);
3333 foreach ($hier_ids as $hier_id) {
3335 if (!is_int(strpos($hier_id,
"_"))) {
3336 if ($hier_id !=
"pg" && $hier_id < $a_hid) {
3338 $this->handleDeleteContent($curr_node);
3339 $curr_node->unlink_node($curr_node);
3358 $hier_ids = $a_source_page->getHierIds();
3360 $copy_ids = array();
3363 foreach ($hier_ids as $hier_id) {
3365 if (!is_int(strpos($hier_id,
"_"))) {
3366 if ($hier_id !=
"pg" && $hier_id >= $a_hid) {
3367 $copy_ids[] = $hier_id;
3373 $parent_node = $a_target_page->getContentNode(
"pg");
3374 $target_dom = $a_target_page->getDom();
3375 $parent_childs = $parent_node->child_nodes();
3376 $cnt_parent_childs = count($parent_childs);
3378 $first_child = $parent_childs[0];
3379 foreach ($copy_ids as $copy_id) {
3380 $source_node = $a_source_page->getContentNode($copy_id);
3382 $new_node = $source_node->clone_node(
true);
3383 $new_node->unlink_node($new_node);
3385 $source_node->unlink_node($source_node);
3387 if ($cnt_parent_childs == 0) {
3388 $new_node = $parent_node->append_child($new_node);
3391 $new_node = $first_child->insert_before($new_node, $first_child);
3393 $parent_childs = $parent_node->child_nodes();
3398 $a_target_page->update();
3399 $a_source_page->update();
3410 $curr_name = $curr_node->node_name();
3413 if (($curr_name ==
"TableData") || ($curr_name ==
"PageObject") ||
3414 ($curr_name ==
"ListItem") || ($curr_name ==
"Section")
3415 || ($curr_name ==
"Tab") || ($curr_name ==
"ContentPopup")
3416 || ($curr_name ==
"GridCell")) {
3420 $hid = $curr_node->get_attribute(
"HierId");
3428 $pos = explode(
"_", $a_pos);
3429 $target_pos = array_pop($pos);
3430 $parent_pos = implode($pos,
"_");
3433 $parent_pos = $a_pos;
3437 if ($parent_pos !=
"") {
3440 $parent_node = $this->
getNode();
3444 $parent_childs = $parent_node->child_nodes();
3445 $cnt_parent_childs = count($parent_childs);
3450 $new_node = $a_cont_obj->getNode();
3454 if ($succ_node = $curr_node->next_sibling()) {
3455 $new_node = $succ_node->insert_before($new_node, $succ_node);
3458 $new_node = $parent_node->append_child($new_node);
3460 $a_cont_obj->setNode($new_node);
3465 $new_node = $a_cont_obj->getNode();
3467 $new_node = $succ_node->insert_before($new_node, $succ_node);
3468 $a_cont_obj->setNode($new_node);
3474 $new_node = $a_cont_obj->getNode();
3475 if ($cnt_parent_childs == 0) {
3476 $new_node = $parent_node->append_child($new_node);
3478 $new_node = $parent_childs[0]->insert_before($new_node, $parent_childs[0]);
3480 $a_cont_obj->setNode($new_node);
3486 if (!$this->
getPageConfig()->getEnablePCType(
"PlaceHolder")) {
3487 $sub_nodes = $curr_node->child_nodes() ;
3488 foreach ($sub_nodes as $sub_node) {
3489 if ($sub_node->node_name() ==
"PlaceHolder") {
3490 $curr_node->unlink_node();
3503 $curr_name = $curr_node->node_name();
3506 if (($curr_name ==
"TableData") || ($curr_name ==
"PageObject") ||
3507 ($curr_name ==
"ListItem") || ($curr_name ==
"Section")
3508 || ($curr_name ==
"Tab") || ($curr_name ==
"ContentPopup")
3509 || ($curr_name ==
"GridCell")) {
3513 $hid = $curr_node->get_attribute(
"HierId");
3520 $pos = explode(
"_", $a_pos);
3521 $target_pos = array_pop($pos);
3522 $parent_pos = implode($pos,
"_");
3525 $parent_pos = $a_pos;
3529 if ($parent_pos !=
"") {
3532 $parent_node = $this->
getNode();
3536 $parent_childs = $parent_node->child_nodes();
3537 $cnt_parent_childs = count($parent_childs);
3543 if ($succ_node = $curr_node->next_sibling()) {
3544 $a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
3546 $a_cont_node = $parent_node->append_child($a_cont_node);
3554 $a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
3561 if ($cnt_parent_childs == 0) {
3562 $a_cont_node = $parent_node->append_child($a_cont_node);
3564 $a_cont_node = $parent_childs[0]->insert_before($a_cont_node, $parent_childs[0]);
3577 if ($a_source == $a_target) {
3583 $source_node = $content->getNode();
3584 $clone_node = $source_node->clone_node(
true);
3590 $content->setNode($clone_node);
3601 if ($a_source == $a_target) {
3607 $source_node = $content->getNode();
3608 $clone_node = $source_node->clone_node(
true);
3614 $content->setNode($clone_node);
3641 $path =
"//IntLink";
3643 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3647 if (substr(
$target, 0, 4) ==
"il__") {
3652 if ($a_res_ref_to_obj_id &&
$type ==
"RepositoryItem") {
3653 $id_arr = explode(
"_",
$id);
3656 $ref_id = $id_arr[1];
3667 $id = $otype .
"_" . $obj_id .
"_" . $ref_id;
3671 $new_target =
"il_" . $a_inst .
"_" .
$id;
3672 $res->nodeset[
$i]->set_attribute(
"Target", $new_target);
3681 $path =
"//MediaAlias";
3683 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3684 $origin_id =
$res->nodeset[
$i]->get_attribute(
"OriginId");
3685 if (substr($origin_id, 0, 4) ==
"il__") {
3686 $new_id =
"il_" . $a_inst .
"_" . substr($origin_id, 4, strlen($origin_id) - 4);
3687 $res->nodeset[
$i]->set_attribute(
"OriginId", $new_id);
3694 $path =
"//FileItem/Identifier";
3696 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3697 $origin_id =
$res->nodeset[
$i]->get_attribute(
"Entry");
3698 if (substr($origin_id, 0, 4) ==
"il__") {
3699 $new_id =
"il_" . $a_inst .
"_" . substr($origin_id, 4, strlen($origin_id) - 4);
3700 $res->nodeset[
$i]->set_attribute(
"Entry", $new_id);
3707 $path =
"//Question";
3709 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3710 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
3712 if (substr($qref, 0, 4) ==
"il__") {
3713 $new_id =
"il_" . $a_inst .
"_" . substr($qref, 4, strlen($qref) - 4);
3715 $res->nodeset[
$i]->set_attribute(
"QRef", $new_id);
3722 $path =
"//ContentInclude";
3724 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3725 $ci =
$res->nodeset[
$i]->get_attribute(
"InstId");
3727 $res->nodeset[
$i]->set_attribute(
"InstId", $a_inst);
3742 foreach ($this->id_elements as $el) {
3743 $path.= $sep .
"//" . $el .
"[not(@PCID)]";
3745 $path.= $sep .
"//" . $el .
"[@PCID='']";
3751 if (count(
$res->nodeset) > 0) {
3771 foreach ($this->id_elements as $el) {
3772 $path.= $sep .
"//" . $el .
"[@PCID]";
3780 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3782 $pcids[] =
$node->get_attribute(
"PCID");
3801 foreach ($this->id_elements as $el) {
3802 $path.= $sep .
"//" . $el .
"[@PCID='" . $a_pc_id .
"']";
3809 return (count(
$res->nodeset) > 0);
3820 if ($a_pc_ids ===
false) {
3823 $id = ilUtil::randomHash(10, $a_pc_ids);
3840 foreach ($this->id_elements as $el) {
3841 $path.= $sep .
"//" . $el .
"[not(@PCID)]";
3843 $path.= $sep .
"//" . $el .
"[@PCID='']";
3849 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3851 $id = ilUtil::randomHash(10, $pcids);
3854 $res->nodeset[
$i]->set_attribute(
"PCID",
$id);
3864 $this->addHierIds();
3868 $path =
"//PageContent";
3873 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
3874 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3875 $hier_id =
$res->nodeset[
$i]->get_attribute(
"HierId");
3876 $pc_id =
$res->nodeset[
$i]->get_attribute(
"PCID");
3877 $dump = $mydom->dump_node(
$res->nodeset[
$i]);
3878 if (($hpos = strpos($dump,
' HierId="' . $hier_id .
'"')) > 0) {
3879 $dump = substr($dump, 0, $hpos) .
3880 substr($dump, $hpos + strlen(
' HierId="' . $hier_id .
'"'));
3883 $childs =
$res->nodeset[
$i]->child_nodes();
3885 if ($childs[0] && $childs[0]->node_name() ==
"Paragraph") {
3886 $content = $mydom->dump_node($childs[0]);
3889 strpos($content,
">") + 1,
3890 strrpos($content,
"<") - (strpos($content,
">") + 1)
3899 array(
"hier_id" => $hier_id,
"hash" => md5($dump),
"content" => $content);
3915 $path =
"//Question";
3920 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
3921 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
3922 $qref =
$res->nodeset[
$i]->get_attribute(
"QRef");
3927 if (!($inst_id > 0)) {
3947 $path =
"/descendant::Paragraph[position() = $par_id]";
3951 if (count(
$res->nodeset) != 1) {
3952 die(
"Should not happen");
3955 $context_node =
$res->nodeset[0];
3959 $childs = $context_node->child_nodes();
3961 for ($j=0; $j<count($childs); $j++) {
3962 $content .= $mydom->dump_node($childs[$j]);
3965 $content = str_replace(
"<br />",
"\n", $content);
3966 $content = str_replace(
"<br/>",
"\n", $content);
3968 $plain_content = html_entity_decode($content);
3986 $xsl = file_get_contents(
"./Services/COPage/xsl/page_fo.xsl");
3987 $args = array(
'/_xml' =>
$xml,
'/_xsl' => $xsl );
3993 $fo = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl",
null, $args,
$params);
3996 $fo = str_replace(
"\n",
"", $fo);
3997 $fo = str_replace(
"<br/>",
"<br>", $fo);
3998 $fo = str_replace(
"<br>",
"\n", $fo);
4003 $fo = substr($fo, strpos($fo,
">") + 1);
4034 if ($a_lang ==
"") {
4038 $query =
"SELECT * FROM page_object WHERE page_id = " .
4039 $db->quote($a_id,
"integer") .
" AND " .
4040 " parent_type = " .
$db->quote($a_parent_type,
"text") .
" AND " .
4041 " lang = " .
$db->quote($a_lang,
"text") .
" AND " .
4042 " inactive_elements = " .
$db->quote(1,
"integer");
4060 if (strpos(
$a_content,
" Enabled=\"False\"")) {
4073 $h_query =
"SELECT * FROM page_history " .
4074 " WHERE page_id = " .
$db->quote($this->
getId(),
"integer") .
4077 " ORDER BY hdate DESC";
4079 $hset =
$db->query($h_query);
4080 $hentries = array();
4082 while ($hrec =
$db->fetchAssoc($hset)) {
4083 $hrec[
"sortkey"] = (int) $hrec[
"nr"];
4084 $hrec[
"user"] = (int) $hrec[
"user_id"];
4085 $hentries[] = $hrec;
4099 "SELECT * FROM page_history " .
4100 " WHERE page_id = %s " .
4101 " AND parent_type = %s " .
4104 array(
"integer",
"text",
"integer",
"text"),
4107 if ($hrec =
$db->fetchAssoc(
$res)) {
4126 $and_nr = ($a_nr > 0)
4127 ?
" AND nr < " .
$db->quote((
int) $a_nr,
"integer")
4129 $res =
$db->query(
"SELECT MAX(nr) mnr FROM page_history " .
4130 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4135 if (
$row[
"mnr"] > 0) {
4136 $res =
$db->query(
"SELECT * FROM page_history " .
4137 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4140 " AND nr = " .
$db->quote((
int)
$row[
"mnr"],
"integer"));
4146 $res =
$db->query(
"SELECT MIN(nr) mnr FROM page_history " .
4147 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4150 " AND nr > " .
$db->quote((
int) $a_nr,
"integer"));
4152 if (
$row[
"mnr"] > 0) {
4153 $res =
$db->query(
"SELECT * FROM page_history " .
4154 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4157 " AND nr = " .
$db->quote((
int)
$row[
"mnr"],
"integer"));
4164 $res =
$db->query(
"SELECT * FROM page_history " .
4165 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4168 " AND nr = " .
$db->quote((
int) $a_nr,
"integer"));
4171 $res =
$db->query(
"SELECT page_id, last_change hdate, parent_type, parent_id, last_change_user user_id, content, lang FROM page_object " .
4172 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4187 $rnode =
$res->nodeset[0];
4190 foreach ($a_hashes as $pc_id =>
$h) {
4192 if (
$h[
"change"] !=
"") {
4193 $dc_node = $this->dom->create_element(
"DivClass");
4194 $dc_node->set_attribute(
"HierId",
$h[
"hier_id"]);
4195 $dc_node->set_attribute(
"Class",
"ilEdit" .
$h[
"change"]);
4196 $dc_node = $rnode->append_child($dc_node);
4211 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
4215 $l_hashes = $l_page->getPageContentsHashes();
4216 $r_hashes = $r_page->getPageContentsHashes();
4218 foreach ($l_hashes as $pc_id =>
$h) {
4219 if (!isset($r_hashes[$pc_id])) {
4220 $l_hashes[$pc_id][
"change"] =
"Deleted";
4222 if ($l_hashes[$pc_id][
"hash"] != $r_hashes[$pc_id][
"hash"]) {
4223 $l_hashes[$pc_id][
"change"] =
"Modified";
4224 $r_hashes[$pc_id][
"change"] =
"Modified";
4226 include_once(
"./Services/COPage/mediawikidiff/class.WordLevelDiff.php");
4228 if ($l_hashes[$pc_id][
"content"] !=
"" &&
4229 $r_hashes[$pc_id][
"content"] !=
"") {
4230 $new_left = str_replace(
"\n",
"<br />", $l_hashes[$pc_id][
"content"]);
4231 $new_right = str_replace(
"\n",
"<br />", $r_hashes[$pc_id][
"content"]);
4236 $new_left = $wldiff->orig();
4237 $new_right = $wldiff->closing();
4238 $l_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_left[0]);
4239 $r_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_right[0]);
4246 foreach ($r_hashes as $pc_id =>
$h) {
4247 if (!isset($l_hashes[$pc_id])) {
4248 $r_hashes[$pc_id][
"change"] =
"New";
4251 $l_page->addChangeDivClasses($l_hashes);
4252 $r_page->addChangeDivClasses($r_hashes);
4254 return array(
"l_page" => $l_page,
"r_page" => $r_page,
4255 "l_changes" => $l_hashes,
"r_changes" => $r_hashes);
4265 $db->manipulate(
"UPDATE page_object " .
4266 " SET view_cnt = view_cnt + 1 " .
4267 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4268 " AND parent_type = " .
$db->quote($this->getParentType(),
"text") .
4269 " AND lang = " .
$db->quote($this->getLanguage(),
"text"));
4279 public static function getRecentChanges($a_parent_type, $a_parent_id, $a_period = 30, $a_lang =
"")
4286 if ($a_lang !=
"") {
4287 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4290 $page_changes = array();
4291 $limit_ts =
date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
4292 $q =
"SELECT * FROM page_object " .
4293 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4294 " AND parent_type = " .
$db->quote($a_parent_type,
"text") .
4295 " AND last_change >= " .
$db->quote($limit_ts,
"timestamp") . $and_lang;
4297 $set =
$db->query($q);
4298 while ($page =
$db->fetchAssoc($set)) {
4299 $page_changes[] = array(
4300 "date" => $page[
"last_change"],
4301 "id" => $page[
"page_id"],
4302 "lang" => $page[
"lang"],
4304 "user" => $page[
"last_change_user"]);
4308 if ($a_period > 0) {
4309 $limit_ts =
date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
4310 $and_str =
" AND hdate >= " .
$db->quote($limit_ts,
"timestamp") .
" ";
4313 $q =
"SELECT * FROM page_history " .
4314 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4315 " AND parent_type = " .
$db->quote($a_parent_type,
"text") .
4316 $and_str . $and_lang;
4317 $set =
$db->query($q);
4318 while ($page =
$db->fetchAssoc($set)) {
4319 $page_changes[] = array(
4320 "date" => $page[
"hdate"],
4321 "id" => $page[
"page_id"],
4322 "lang" => $page[
"lang"],
4324 "nr" => $page[
"nr"],
4325 "user" => $page[
"user_id"]);
4330 return $page_changes;
4341 public static function getAllPages($a_parent_type, $a_parent_id, $a_lang =
"-")
4348 if ($a_lang !=
"") {
4349 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4352 $q =
"SELECT * FROM page_object " .
4353 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4354 " AND parent_type = " .
$db->quote($a_parent_type,
"text") . $and_lang;
4355 $set =
$db->query($q);
4357 while ($page =
$db->fetchAssoc($set)) {
4358 $key_add = ($a_lang ==
"")
4359 ?
":" . $page[
"lang"]
4361 $pages[$page[
"page_id"] . $key_add] = array(
4362 "date" => $page[
"last_change"],
4363 "id" => $page[
"page_id"],
4364 "lang" => $page[
"lang"],
4365 "user" => $page[
"last_change_user"]);
4377 public static function getNewPages($a_parent_type, $a_parent_id, $a_lang =
"-")
4384 if ($a_lang !=
"") {
4385 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4390 $q =
"SELECT * FROM page_object " .
4391 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4392 " AND parent_type = " .
$db->quote($a_parent_type,
"text") . $and_lang .
4393 " ORDER BY created DESC";
4394 $set =
$db->query($q);
4395 while ($page =
$db->fetchAssoc($set)) {
4396 if ($page[
"created"] !=
"") {
4398 "created" => $page[
"created"],
4399 "id" => $page[
"page_id"],
4400 "lang" => $page[
"lang"],
4401 "user" => $page[
"create_user"],
4422 if ($a_lang !=
"") {
4423 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4426 $contributors = array();
4428 "SELECT last_change_user, lang, page_id FROM page_object " .
4429 " WHERE parent_id = %s AND parent_type = %s " .
4430 " AND last_change_user != %s" . $and_lang,
4431 array(
"integer",
"text",
"integer"),
4432 array($a_parent_id, $a_parent_type, 0)
4435 while ($page =
$db->fetchAssoc($set)) {
4436 if ($a_lang ==
"") {
4437 $contributors[$page[
"last_change_user"]][$page[
"page_id"]][$page[
"lang"]] = 1;
4439 $contributors[$page[
"last_change_user"]][$page[
"page_id"]] = 1;
4444 "SELECT count(*) as cnt, lang, page_id, user_id FROM page_history " .
4445 " WHERE parent_id = %s AND parent_type = %s AND user_id != %s " . $and_lang .
4446 " GROUP BY page_id, user_id, lang ",
4447 array(
"integer",
"text",
"integer"),
4448 array($a_parent_id, $a_parent_type, 0)
4450 while ($hpage =
$db->fetchAssoc($set)) {
4451 if ($a_lang ==
"") {
4452 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]][$hpage[
"lang"]] =
4453 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]][$hpage[
"lang"]] + $hpage[
"cnt"];
4455 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] =
4456 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] + $hpage[
"cnt"];
4461 foreach ($contributors as $k => $co) {
4464 $c[] = array(
"user_id" => $k,
"pages" => $co,
4465 "lastname" =>
$name[
"lastname"],
"firstname" =>
$name[
"firstname"]);
4485 if ($a_lang !=
"") {
4486 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4489 $contributors = array();
4491 "SELECT last_change_user, lang FROM page_object " .
4492 " WHERE page_id = %s AND parent_type = %s " .
4493 " AND last_change_user != %s" . $and_lang,
4494 array(
"integer",
"text",
"integer"),
4495 array($a_page_id, $a_parent_type, 0)
4498 while ($page =
$db->fetchAssoc($set)) {
4499 if ($a_lang ==
"") {
4500 $contributors[$page[
"last_change_user"]][$page[
"lang"]] = 1;
4502 $contributors[$page[
"last_change_user"]] = 1;
4507 "SELECT count(*) as cnt, lang, page_id, user_id FROM page_history " .
4508 " WHERE page_id = %s AND parent_type = %s AND user_id != %s " . $and_lang .
4509 " GROUP BY user_id, page_id, lang ",
4510 array(
"integer",
"text",
"integer"),
4511 array($a_page_id, $a_parent_type, 0)
4513 while ($hpage =
$db->fetchAssoc($set)) {
4514 if ($a_lang ==
"") {
4515 $contributors[$hpage[
"user_id"]][$page[
"lang"]] =
4516 $contributors[$hpage[
"user_id"]][$page[
"lang"]] + $hpage[
"cnt"];
4518 $contributors[$hpage[
"user_id"]] =
4519 $contributors[$hpage[
"user_id"]] + $hpage[
"cnt"];
4524 foreach ($contributors as $k => $co) {
4525 include_once
"Services/User/classes/class.ilObjUser.php";
4527 $c[] = array(
"user_id" => $k,
"pages" => $co,
4528 "lastname" =>
$name[
"lastname"],
"firstname" =>
$name[
"firstname"]);
4543 $db->update(
"page_object", array(
4544 "rendered_content" => array(
"clob",
$a_content),
4545 "render_md5" => array(
"text", $a_md5),
4546 "rendered_time" => array(
"timestamp",
ilUtil::now())
4548 "page_id" => array(
"integer", $this->
getId()),
4568 if ($a_lang !=
"") {
4569 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
4572 $q =
"SELECT * FROM page_object " .
4573 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
4574 " AND parent_type = " .
$db->quote($a_parent_type,
"text") .
4575 " AND int_links = " .
$db->quote(1,
"integer") . $and_lang;
4576 $set =
$db->query($q);
4578 while ($page =
$db->fetchAssoc($set)) {
4579 $key_add = ($a_lang ==
"")
4580 ?
":" . $page[
"lang"]
4582 $pages[$page[
"page_id"] . $key_add] = array(
4583 "date" => $page[
"last_change"],
4584 "id" => $page[
"page_id"],
4585 "lang" => $page[
"lang"],
4586 "user" => $page[
"last_change_user"]);
4627 $link_type =
"MediaObject";
4628 $a_id =
"il__mob_" . $a_id;
4632 $link_type =
"PageObject";
4633 $a_id =
"il__pg_" . $a_id;
4637 $link_type =
"GlossaryItem";
4638 $a_id =
"il__git_" . $a_id;
4639 $a_target =
"Glossary";
4644 if ($link_type ==
"" || $a_id ==
"") {
4646 $path =
"//PageObject/InitOpenedContent";
4648 if (count(
$res->nodeset) > 0) {
4649 $res->nodeset[0]->unlink_node(
$res->nodeset[0]);
4653 $path =
"//PageObject/InitOpenedContent";
4655 if (count(
$res->nodeset) > 0) {
4656 $init_node =
$res->nodeset[0];
4657 $childs = $init_node->child_nodes();
4658 for (
$i = 0;
$i < count($childs);
$i++) {
4659 if ($childs[
$i]->node_name() ==
"IntLink") {
4660 $il_node = $childs[
$i];
4664 $path =
"//PageObject";
4666 $page_node =
$res->nodeset[0];
4667 $init_node = $this->dom->create_element(
"InitOpenedContent");
4668 $init_node = $page_node->append_child($init_node);
4669 $il_node = $this->dom->create_element(
"IntLink");
4670 $il_node = $init_node->append_child($il_node);
4672 $il_node->set_attribute(
"Target", $a_id);
4673 $il_node->set_attribute(
"Type", $link_type);
4674 $il_node->set_attribute(
"TargetFrame", $a_target);
4691 $path =
"//PageObject/InitOpenedContent";
4694 if (count(
$res->nodeset) > 0) {
4695 $init_node =
$res->nodeset[0];
4696 $childs = $init_node->child_nodes();
4697 for (
$i = 0;
$i < count($childs);
$i++) {
4698 if ($childs[
$i]->node_name() ==
"IntLink") {
4699 $il_node = $childs[
$i];
4703 if (!is_null($il_node)) {
4704 $id = $il_node->get_attribute(
"Target");
4705 $link_type = $il_node->get_attribute(
"Type");
4706 $target = $il_node->get_attribute(
"TargetFrame");
4708 switch ($link_type) {
4717 case "GlossaryItem":
4721 include_once(
"./Services/Link/classes/class.ilInternalLink.php");
4751 public function copy($a_id, $a_parent_type =
"", $a_parent_id = 0, $a_clone_mobs =
false)
4753 if ($a_parent_type ==
"") {
4755 if ($a_parent_id == 0) {
4760 include_once(
"./Services/COPage/classes/class.ilPageObjectFactory.php");
4769 $new_page_object->setParentId($a_parent_id);
4770 $new_page_object->setId($a_id);
4772 $new_page_object->setXMLContent($orig_page->copyXMLContent($a_clone_mobs));
4773 $new_page_object->setActive($orig_page->getActive());
4774 $new_page_object->setActivationStart($orig_page->getActivationStart());
4775 $new_page_object->setActivationEnd($orig_page->getActivationEnd());
4777 $new_page_object->buildDom();
4778 $new_page_object->update();
4780 $new_page_object->create();
4799 "SELECT lang FROM page_object " .
4800 " WHERE page_id = " .
$db->quote($a_id,
"integer") .
4801 " AND parent_type = " .
$db->quote($a_parent_type,
"text")
4804 while ($rec =
$db->fetchAssoc($set)) {
4805 $langs[] = $rec[
"lang"];
4824 $transl_page->setId($this->
getId());
4826 $transl_page->setXMLContent($this->copyXMLContent());
4827 $transl_page->setActive($this->
getActive());
4830 $transl_page->create();
4850 "UPDATE page_object SET " .
4851 " edit_lock_user = " .
$db->quote(
$user->getId(),
"integer") .
"," .
4852 " edit_lock_ts = " .
$db->quote($ts,
"integer") .
4853 " WHERE (edit_lock_user = " .
$db->quote(
$user->getId(),
"integer") .
" OR " .
4854 " edit_lock_ts < " .
$db->quote(time() - ($min * 60),
"integer") .
") " .
4855 " AND page_id = " .
$db->quote($this->getId(),
"integer") .
4856 " AND parent_type = " .
$db->quote($this->getParentType(),
"text")
4860 "SELECT edit_lock_user FROM page_object " .
4861 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4862 " AND parent_type = " .
$db->quote($this->getParentType(),
"text")
4864 $rec =
$db->fetchAssoc($set);
4865 if ($rec[
"edit_lock_user"] !=
$user->getId()) {
4882 $min = (int) $aset->get(
"block_mode_minutes") ;
4887 "UPDATE page_object SET " .
4888 " edit_lock_user = " .
$db->quote(
$user->getId(),
"integer") .
"," .
4889 " edit_lock_ts = 0" .
4890 " WHERE edit_lock_user = " .
$db->quote(
$user->getId(),
"integer") .
4891 " AND page_id = " .
$db->quote($this->getId(),
"integer") .
4892 " AND parent_type = " .
$db->quote($this->getParentType(),
"text")
4896 "SELECT edit_lock_user FROM page_object " .
4897 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4898 " AND parent_type = " .
$db->quote($this->getParentType(),
"text")
4900 $rec =
$db->fetchAssoc($set);
4901 if ($rec[
"edit_lock_user"] !=
$user->getId()) {
4919 $min = (int) $aset->get(
"block_mode_minutes");
4922 "SELECT edit_lock_user, edit_lock_ts FROM page_object " .
4923 " WHERE page_id = " .
$db->quote($this->getId(),
"integer") .
4926 $rec =
$db->fetchAssoc($set);
4927 $rec[
"edit_lock_until"] = $rec[
"edit_lock_ts"] + $min * 60;
4944 public static function truncateHTML($a_text, $a_length = 100, $a_ending =
'...', $a_exact =
false, $a_consider_html =
true)
4946 include_once
"Services/Utilities/classes/class.ilStr.php";
4948 if ($a_consider_html) {
4950 if (strlen(preg_replace(
'/<.*?>/',
'', $a_text)) <= $a_length) {
4955 $total_length = strlen($a_ending);
4956 $open_tags = array();
4958 preg_match_all(
'/(<.+?>)?([^<>]*)/s', $a_text, $lines, PREG_SET_ORDER);
4959 foreach ($lines as $line_matchings) {
4961 if (!empty($line_matchings[1])) {
4963 if (preg_match(
'/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) {
4967 elseif (preg_match(
'/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) {
4969 $pos = array_search($tag_matchings[1], $open_tags);
4970 if ($pos !==
false) {
4971 unset($open_tags[$pos]);
4975 elseif (preg_match(
'/^<\s*([^\s>!]+).*?>$/s', $line_matchings[1], $tag_matchings)) {
4977 array_unshift($open_tags, strtolower($tag_matchings[1]));
4980 $truncate .= $line_matchings[1];
4984 $content_length = strlen(preg_replace(
'/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i',
' ', $line_matchings[2]));
4985 if ($total_length+$content_length > $a_length) {
4987 $left = $a_length - $total_length;
4988 $entities_length = 0;
4990 if (preg_match_all(
'/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, PREG_OFFSET_CAPTURE)) {
4992 foreach ($entities[0] as $entity) {
4993 if ($entity[1]+1-$entities_length <= $left) {
4995 $entities_length += strlen($entity[0]);
5009 $truncate .= $line_matchings[2];
5010 $total_length += $content_length;
5014 if ($total_length >= $a_length) {
5019 if (strlen($a_text) <= $a_length) {
5028 if (!
sizeof($open_tags)) {
5032 $spacepos = strrpos($truncate,
' ');
5033 if ($spacepos !==
false) {
5042 $truncate .= $a_ending;
5044 if ($a_consider_html) {
5046 foreach ($open_tags as
$tag) {
5047 $truncate .=
'</' .
$tag .
'>';
5078 if ($a_lang !=
"") {
5079 $and_lang =
" AND lang = " .
$db->quote($a_lang,
"text");
5083 $q =
"SELECT last_change FROM page_object " .
5084 " WHERE parent_id = " .
$db->quote($a_parent_id,
"integer") .
5085 " AND parent_type = " .
$db->quote($a_parent_type,
"text") . $and_lang .
5086 " ORDER BY last_change DESC";
5088 $set =
$db->query($q);
5089 $rec =
$db->fetchAssoc($set);
5091 return $rec[
"last_change"];
5096 if ($this->
getPageConfig()->getEditLockSupport() ==
false) {
5101 $min = (int) $aset->get(
"block_mode_minutes") ;
5113 $file_obj_ids = array();
5117 $path =
"//FileItem/Identifier";
5119 for (
$i = 0;
$i < count(
$res->nodeset);
$i++) {
5120 $file_obj_ids[] =
$res->nodeset[
$i]->get_attribute(
"Entry");
5123 return $file_obj_ids;
5132 include_once(
"./Services/COPage/classes/class.ilPCResources.php");
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
An exception for terminatinating execution or to throw for unit testing.
static _instantiateQuestion($question_id)
Page not found exception.
static getPCDefinitions()
Get PC definitions.
static getPCDefinitionByName($a_pc_name)
Get PC definition by name.
static requirePCClassByName($a_name)
Get instance.
Unknown page content type exception.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
@classDescription Date and time handling
static _after(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
static setAction($a_action)
static _saveLink( $a_source_type, $a_source_id, $a_target_type, $a_target_id, $a_target_inst=0, $a_source_lang="-")
save internal link information
static _deleteAllLinksOfSource($a_source_type, $a_source_id, $a_lang="-")
Delete all links of a given source.
static _extractObjIdOfTarget($a_target)
Extract object id out of target.
static _removeInstFromTarget($a_target)
Removes installation id from target string.
static _exists($a_type, $a_target)
Check if internal link refers to a valid target.
static _getSourcesOfTarget($a_target_type, $a_target_id, $a_target_inst)
get all sources of a link target
static _getIdForImportId($a_type, $a_target)
Get current id for an import id.
static _extractInstOfTarget($a_target)
Extract installation id out of target.
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
Extension of ilPageObject for learning modules.
static getLogger($a_component_id)
Get component logger.
static deleteNewsOfContext( $a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id=0, $a_context_sub_obj_type="")
Delete all news of a context.
static _lookupFileSize($a_id)
Lookups the file size of the file in bytes.
static _getFilesOfObject($a_type, $a_id, $a_usage_hist_nr=0, $a_usage_lang="-")
get all files of an object
static _lookupName($a_user_id)
lookup user name
static _lookupObjId($a_id)
static _lookupImportId($a_obj_id)
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static _getLastUpdateOfObjects($a_objs)
Get last update for a set of media objects.
static _lookupType($a_id, $a_reference=false)
lookup object type
static xml2output($a_text, $a_wysiwyg=false, $a_replace_lists=true, $unmask=true)
Converts xml from DB to output in edit textarea.
static resolveResources(ilPageObject $page, $ref_mappings)
Resolve resources.
static incEdId($ed_id)
Increases an hierarchical editing id at lowest level (last number)
static sortHierIds($a_array)
Sort an array of Hier IDS in ascending order.
static getInstance($a_parent_type, $a_id=0, $a_old_nr=0, $a_lang="-")
Get page object instance.
static getConfigInstance($a_parent_type)
Get page config instance.
releasePageLock()
Release page lock.
stripHierIDs()
strip all hierarchical id attributes out of the dom tree
switchEnableMultiple($a_hids, $a_update=true, $a_self_ass=false)
(De-)activate elements
moveContentBefore($a_source, $a_target, $a_spcid="", $a_tpcid="")
move content object from position $a_source before position $a_target (both hierarchical content ids)
getEditLockInfo()
Get edit lock info.
getRenderedContent()
Get Rendered Content.
resolveResources($ref_mapping)
Resolve resources.
removeQuestions(&$temp_dom)
Remove questions from document.
setRenderedContent($a_renderedcontent)
Set Rendered Content.
getOfflineHandler()
Get offline handler.
__beforeDelete()
Before deletion handler (internal).
static truncateHTML($a_text, $a_length=100, $a_ending='...', $a_exact=false, $a_consider_html=true)
Truncate (html) string.
getRenderMd5()
Get Render MD5.
deleteStyleUsages($a_old_nr=0)
Delete style usages.
__construct($a_id=0, $a_old_nr=0, $a_lang="-")
Constructor @access public.
initPageConfig()
Init page config.
getLastChangeUser()
Get last change user.
containsIntLinks($a_content)
Check whether content contains internal links.
static getPageContributors($a_parent_type, $a_page_id, $a_lang="-")
Get all contributors for parent object.
registerOfflineHandler($handler)
static getNewPages($a_parent_type, $a_parent_id, $a_lang="-")
Get new pages.
static _existsAndNotEmpty($a_parent_type, $a_id, $a_lang="-")
Checks whether page exists and is not empty (may return true on some empty pages)
getFirstColumnIds()
get ids of all first table columns
setActivationEnd($a_activationend)
Set Activation End.
getHistoryInfo($a_nr)
Get information about a history entry, its predecessor and its successor.
saveInitialOpenedContent($a_type, $a_id, $a_target)
Save initial opened content.
addFileSizes()
add file sizes
deleteInternalLinks()
Delete internal links.
deleteContent($a_hid, $a_update=true, $a_pcid="")
delete content object with hierarchical id $a_hid
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
getLanguage()
Get language.
getPageConfig()
Get page config object.
setContainsIntLink($a_contains_link)
lm parser set this flag to true, if the page contains intern links (this method should only be called...
pasteContents($a_hier_id, $a_self_ass=false)
Paste contents from pc clipboard.
__afterHistoryEntry($a_old_domdoc, $a_old_content, $a_old_nr)
Before deletion handler (internal).
getEditLock()
Get page lock.
setImportMode($a_val)
Set import mode.
addUpdateListener(&$a_object, $a_method, $a_parameters="")
insertInstIntoIDs($a_inst, $a_res_ref_to_obj_id=true)
inserts installation id into ids (e.g.
afterUpdate()
After update.
setLanguage($a_val)
Set language.
newMobCopies($temp_dom)
Replaces media objects with copies.
getInitialOpenedContent()
Get initial opened content.
create()
create new page (with current xml data)
countPageContents()
Remove questions from document.
saveStyleUsage($a_domdoc, $a_old_nr=0)
Save all style class/template usages.
setActivationStart($a_activationstart)
Set Activation Start.
insertContentNode(&$a_cont_node, $a_pos, $a_mode=IL_INSERT_AFTER, $a_pcid="")
insert a content node before/after a sibling or as first child of a parent
deleteContentBeforeHierId($a_hid, $a_update=true)
delete content object with hierarchical id < $a_hid
increaseViewCnt()
Increase view cnt.
static _handleImportRepositoryLinks($a_rep_import_id, $a_rep_type, $a_rep_ref_id)
Change targest of repository links.
updateFromXML()
Updates page object with current xml content.
insertContent(&$a_cont_obj, $a_pos, $a_mode=IL_INSERT_AFTER, $a_pcid="")
insert a content node before/after a sibling or as first child of a parent
setRenderedTime($a_renderedtime)
Set Rendered Time.
getContainsQuestion()
Get contains question.
existsPCId($a_pc_id)
existsPCId
getActivationEnd()
Get Activation End.
deleteContentFromHierId($a_hid, $a_update=true)
delete content object with hierarchical id >= $a_hid
getXMLContent($a_incl_head=false)
get xml content of page
getLastUpdateOfIncludedElements()
Get last update of included elements (media objects and files).
afterConstructor()
After constructor.
static _lookupContainsDeactivatedElements($a_id, $a_parent_type, $a_lang="-")
lookup whether page contains deactivated elements
validateDom()
Validate the page content agains page DTD.
cutContents($a_hids)
Copy contents to clipboard and cut them from the page.
resolveFileItems($a_mapping)
Resolve file items (after import)
setLastChange($a_lastchange)
Set Last Change.
resolveMediaAliases($a_mapping, $a_reuse_existing_by_import=false)
Resolve media aliases (after import)
handleImportRepositoryLink($a_rep_import_id, $a_rep_type, $a_rep_ref_id)
static lookupParentId($a_id, $a_type)
Lookup parent id.
getHierIds()
get all hierarchical ids
resolveIntLinks($a_link_map=null)
Resolves all internal link targets of the page, if targets are available (after import)
appendLangVarXML(&$xml, $var)
containsIntLink()
returns true, if page was marked as containing an intern link (via setContainsIntLink) (this method s...
setShowActivationInfo($a_val)
Set show page activation info.
generatePcId($a_pc_ids=false)
Generate new pc id.
setRenderMd5($a_rendermd5)
Set Render MD5.
newQuestionCopies(&$temp_dom)
Replaces existing question content elements with new copies.
getActivationStart()
Get Activation Start.
getMultimediaXML()
get a xml string that contains all media object elements, that are referenced by any media alias in t...
getParentType()
Get parent type.
static _lookupActivationData($a_id, $a_parent_type, $a_lang="-")
Lookup activation data.
static lookupTranslations($a_parent_type, $a_id)
Lookup translations.
getContentObject($a_hier_id, $a_pc_id="")
Get a content object of the page.
saveInternalLinks($a_domdoc)
save internal links of page
handleRepositoryLinksOnCopy($a_mapping, $a_source_ref_id)
Handle repository links on copy process.
static getPagesWithLinks($a_parent_type, $a_parent_id, $a_lang="-")
Get all pages for parent object that contain internal links.
getPageContentsHashes()
Get page contents hashes.
getHistoryEntry($a_old_nr)
Get History Entry.
getContentTemplates()
Get content templates.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
static getAllPages($a_parent_type, $a_parent_id, $a_lang="-")
Get all pages for parent object.
setXMLContent($a_xml, $a_encoding="UTF-8")
set xml content of page, start with <PageObject...>, end with </PageObject>, comply with ILIAS DTD,...
setPageConfig($a_val)
Set page config object.
collectMediaObjects($a_inline_only=true)
get all media objects, that are referenced and used within the page
getAllFileObjIds()
Get all file object ids.
moveIntLinks($a_from_to)
Move internal links from one destination to another.
getFirstRowIds()
get ids of all first table rows
getMediaAliasElement($a_mob_id, $a_nr=1)
get complete media object (alias) element
getQuestionIds()
Get question ids.
checkPCIds()
Check, whether (all) page content hashes are set.
getDom()
Deprecated php4DomDocument.
getDomDoc()
Get dom doc (php5 dom document)
copy($a_id, $a_parent_type="", $a_parent_id=0, $a_clone_mobs=false)
Copy page.
copyXmlContent($a_clone_mobs=false)
Copy content of page; replace page components with copies where necessary (e.g.
getFO()
get fo page content
getXMLFromDom( $a_incl_head=false, $a_append_mobs=false, $a_append_bib=false, $a_append_str="", $a_omit_pageobject_tag=false)
get xml content of page from dom (use this, if any changes are made to the document)
copyPageToTranslation($a_target_lang)
Copy page to translation.
setActive($a_active)
set activation
addHierIDs()
Add hierarchical ID (e.g.
checkForTag($a_content_tag, $a_hier_id, $a_pc_id="")
Get content node from dom.
insertPCIds()
Insert Page Content IDs.
containsDeactivatedElements($a_content)
Check whether content contains deactivated elements.
compareVersion($a_left, $a_right)
Compares to revisions of the page.
getAllPCIds()
Get all pc ids.
performAutomaticModifications()
Perform automatic modifications (may be overwritten by sub classes)
getEffectiveEditLockTime()
getFileItemIds()
get ids of all file items
getHistoryEntries()
Get History Entries.
static getParentObjectContributors($a_parent_type, $a_parent_id, $a_lang="-")
Get all contributors for parent object.
getLastChange()
Get Last Change.
getShowActivationInfo()
Get show page activation info.
resolveQuestionReferences($a_mapping)
Resolve all quesion references (after import)
bbCode2XML(&$a_content)
transforms bbCode to corresponding xml
& getContentNode($a_hier_id, $a_pc_id="")
Get content node from dom.
static getRecentChanges($a_parent_type, $a_parent_id, $a_period=30, $a_lang="")
Get recent pages changes for parent object.
handleCopiedContent($a_dom, $a_self_ass=true, $a_clone_mobs=false)
Handle copied content.
writeRenderedContent($a_content, $a_md5)
Write rendered content.
getLanguageVariablesXML()
Get language variables as XML.
needsImportParsing($a_parse="")
static preloadActivationDataByParentId($a_parent_id)
Preload activation data by Parent Id.
addChangeDivClasses($a_hashes)
getListItemIds()
get ids of all list items
static getLastChangeByParent($a_parent_type, $a_parent_id, $a_lang="")
Get all pages for parent object.
createFromXML()
Create new page object with current xml content.
newIIMCopies($temp_dom)
Replaces media objects in interactive images with copies of the interactive images.
__afterUpdate($a_domdoc, $a_xml, $a_creation=false, $a_empty=false)
After update event handler (internal).
static _writeActive($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation=true, $a_lang="-")
write activation status
getHierIdsForPCIds($a_pc_ids)
Get hier ids for a set of pc ids.
static _isScheduledActivation($a_id, $a_parent_type, $a_lang="-")
Check whether page is activated by time schedule.
copyContents($a_hids)
Copy contents to clipboard.
beforePageContentUpdate($a_page_content)
Before page content update.
update($a_validate=true, $a_no_history=false)
update complete page content in db (dom xml content is used)
static _writeParentId($a_parent_type, $a_pg_id, $a_par_id)
Write parent id.
getImportMode()
Get import mode.
appendXMLContent($a_xml)
append xml content to page setXMLContent must be called before and the same encoding must be used
deleteContents($a_hids, $a_update=true, $a_self_ass=false)
Delete multiple content objects.
getInternalLinks($a_cnt_multiple=false)
get all internal links that are used within the page
setContainsQuestion($a_val)
Set contains question.
moveContentAfter($a_source, $a_target, $a_spcid="", $a_tpcid="")
move content object from position $a_source before position $a_target (both hierarchical content ids)
getRenderedTime()
Get Rendered Time.
send_paragraph($par_id, $filename)
setLastChangeUser($a_val)
Set last change user.
resolveIIMMediaAliases($a_mapping)
Resolve iim media aliases (in ilContObjParse)
getActive($a_check_scheduled_activation=false)
get activation
setParagraphContent($a_hier_id, $a_content)
Set content of paragraph.
static _moveContentAfterHierId(&$a_source_page, &$a_target_page, $a_hid)
move content of hierarchical id >= $a_hid to other page
static _existsAndNotEmpty($a_parent_type, $a_id, $a_lang="-")
checks whether page exists and is not empty (may return true on some empty pages)
static shortenText($a_string, $a_start_pos, $a_num_bytes, $a_encoding='UTF-8')
Shorten text to the given number of bytes.
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static now()
Return current timestamp in Y-m-d H:i:s format.
const ILIAS_VERSION_NUMERIC
xpath_eval($xpath_context, $eval_str, $contextnode=null)
domxml_open_mem($str, $mode=0, &$error=null)
xpath_new_context($dom_document)
const DOMXML_LOAD_PARSING
if(function_exists( 'posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
foreach($_POST as $key=> $value) $res
catch(Exception $e) if(isset( $_POST[ 'cancel'])) if(isset($_POST['continue'])) $cfg