4 define(
"IL_INSERT_BEFORE", 0);
5 define(
"IL_INSERT_AFTER", 1);
6 define(
"IL_INSERT_CHILD", 2);
8 define (
"IL_CHAPTER_TITLE",
"st_title");
9 define (
"IL_PAGE_TITLE",
"pg_title");
10 define (
"IL_NO_HEADER",
"none");
52 function ilPageObject($a_parent_type, $a_id = 0, $a_old_nr = 0, $a_halt =
true)
56 require_once(
"./Services/COPage/syntax_highlight/php/Beautifier/Init.php");
57 require_once(
"./Services/COPage/syntax_highlight/php/Output/Output_css.php");
59 $this->parent_type = $a_parent_type;
63 $this->contains_int_link =
false;
64 $this->needs_parsing =
false;
65 $this->update_listeners = array();
66 $this->update_listener_cnt = 0;
67 $this->dom_builded =
false;
68 $this->halt_on_error = $a_halt;
69 $this->page_not_found =
false;
70 $this->old_nr = $a_old_nr;
71 $this->layout_mode =
false;
72 $this->encoding =
"UTF-8";
74 array(
"PageContent",
"TableRow",
"TableData",
"ListItem",
"FileItem",
75 "Section",
"Tab",
"ContentPopup");
87 $this->halt_on_error = $a_halt;
97 $this->rendermd5 = $a_rendermd5;
107 return $this->rendermd5;
117 $this->renderedcontent = $a_renderedcontent;
127 return $this->renderedcontent;
137 $this->renderedtime = $a_renderedtime;
147 return $this->renderedtime;
157 $this->lastchange = $a_lastchange;
167 return $this->lastchange;
177 $this->layout_mode = $a_layout_mode;
197 $this->last_change_user = $a_val;
207 return $this->last_change_user;
217 $ilBench->start(
"ContentPresentation",
"ilPageObject_read");
220 if ($this->old_nr == 0)
222 $query =
"SELECT * FROM page_object WHERE page_id = ".$ilDB->quote($this->
id,
"integer").
" ".
223 "AND parent_type=".$ilDB->quote($this->
getParentType(),
"text");
224 $pg_set = $this->ilias->db->query(
$query);
225 $this->page_record = $ilDB->fetchAssoc($pg_set);
226 $this->
setActive($this->page_record[
"active"]);
232 $query =
"SELECT * FROM page_history WHERE ".
233 "page_id = ".$ilDB->quote($this->
id,
"integer").
" ".
234 "AND parent_type=".$ilDB->quote($this->
getParentType(),
"text").
235 " AND nr = ".$ilDB->quote((
int) $this->old_nr,
"integer");
236 $pg_set = $ilDB->query(
$query);
237 $this->page_record = $ilDB->fetchAssoc($pg_set);
239 if (!$this->page_record)
241 if ($this->halt_on_error)
243 include_once(
"./Services/COPage/exceptions/class.ilCOPageNotFoundException.php");
251 $this->page_not_found =
true;
255 $this->xml = $this->page_record[
"content"];
256 $this->
setParentId($this->page_record[
"parent_id"]);
257 $this->last_change_user = $this->page_record[
"last_change_user"];
258 $this->create_user = $this->page_record[
"create_user"];
264 $ilBench->stop(
"ContentPresentation",
"ilPageObject_read");
273 static function _exists($a_parent_type, $a_id)
276 if (isset(self::$exists[$a_parent_type.
":".$a_id]))
278 return self::$exists[$a_parent_type.
":".$a_id];
281 $query =
"SELECT page_id FROM page_object WHERE page_id = ".$ilDB->quote($a_id,
"integer").
" ".
282 "AND parent_type= ".$ilDB->quote($a_parent_type,
"text");
283 $set = $ilDB->query(
$query);
284 if (
$row = $ilDB->fetchAssoc($set))
286 self::$exists[$a_parent_type.
":".$a_id] =
true;
291 self::$exists[$a_parent_type.
":".$a_id] =
false;
306 $query =
"SELECT page_id, is_empty FROM page_object WHERE page_id = ".$ilDB->quote($a_id,
"integer").
" ".
307 "AND parent_type= ".$ilDB->quote($a_parent_type,
"text");
309 $set = $ilDB->query(
$query);
310 if (
$row = $ilDB->fetchAssoc($set))
312 if (
$row[
"is_empty"] != 1)
324 if ($this->dom_builded && !$a_force)
331 $ilBench->start(
"ContentPresentation",
"ilPageObject_buildDom");
333 $ilBench->stop(
"ContentPresentation",
"ilPageObject_buildDom");
336 $path =
"//PageObject";
338 if (count(
$res->nodeset) == 1)
340 $this->node =&
$res->nodeset[0];
345 $this->dom_builded =
true;
380 $this->parent_id = $a_id;
390 $this->parent_type = $a_type;
401 $this->update_listeners[$cnt][
"object"] =& $a_object;
402 $this->update_listeners[$cnt][
"method"] = $a_method;
403 $this->update_listeners[$cnt][
"parameters"] = $a_parameters;
404 $this->update_listener_cnt++;
411 $object =& $this->update_listeners[$i][
"object"];
412 $method = $this->update_listeners[$i][
"method"];
413 $parameters = $this->update_listeners[$i][
"parameters"];
414 $object->$method($parameters);
425 $this->active = $a_active;
433 function getActive($a_check_scheduled_activation =
false)
435 if ($a_check_scheduled_activation && !$this->active)
437 include_once(
"./Services/Calendar/classes/class.ilDateTime.php");
446 return $this->active;
452 function _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation =
false)
456 $set = $ilDB->queryF(
"SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s".
457 " AND parent_type = %s",
458 array(
"integer",
"text"),
459 array($a_id, $a_parent_type));
460 $rec = $ilDB->fetchAssoc($set);
463 if (!$rec[
"active"] && $a_check_scheduled_activation)
465 if ($rec[
"n"] >= $rec[
"activation_start"] &&
466 $rec[
"n"] <= $rec[
"activation_end"])
472 return $rec[
"active"];
482 $set = $ilDB->queryF(
"SELECT active, activation_start, activation_end FROM page_object WHERE page_id = %s".
483 " AND parent_type = %s", array(
"integer",
"text"),
484 array($a_id, $a_parent_type));
485 $rec = $ilDB->fetchAssoc($set);
487 if (!$rec[
"active"] && $rec[
"activation_start"] !=
"")
498 function _writeActive($a_id, $a_parent_type, $a_active, $a_reset_scheduled_activation =
true)
502 if ($a_reset_scheduled_activation)
504 $st = $ilDB->manipulateF(
"UPDATE page_object SET active = %s, activation_start = %s, ".
505 " activation_end = %s WHERE page_id = %s".
506 " AND parent_type = %s", array(
"boolean",
"timestamp",
"timestamp",
"integer",
"text"),
507 array($a_active, null, null, $a_id, $a_parent_type));
511 $st = $ilDB->prepareManip(
"UPDATE page_object SET active = %s WHERE page_id = %s".
512 " AND parent_type = %s", array(
"boolean",
"integer",
"text"),
513 array($a_active, $a_id, $a_parent_type));
524 $res = $ilDB->query(
"SELECT parent_id FROM page_object WHERE page_id = ".$ilDB->quote($a_id,
"integer").
" ".
525 "AND parent_type=".$ilDB->quote($a_type,
"text"));
526 $rec = $ilDB->fetchAssoc(
$res);
527 return $rec[
"parent_id"];
537 $st = $ilDB->manipulateF(
"UPDATE page_object SET parent_id = %s WHERE page_id = %s".
538 " AND parent_type = %s", array(
"integer",
"integer",
"text"),
539 array($a_par_id, $a_pg_id, $a_parent_type));
549 $this->activationstart = $a_activationstart;
559 return $this->activationstart;
569 $this->activationend = $a_activationend;
579 return $this->activationend;
597 if (!is_object($cont_node))
601 switch($cont_node->node_name())
604 $child_node =& $cont_node->first_child();
606 switch($child_node->node_name())
609 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
611 $par->setNode($cont_node);
612 $par->setHierId($a_hier_id);
613 $par->setPcId($a_pc_id);
617 if ($child_node->get_attribute(
"DataTable") ==
"y")
619 require_once(
"./Services/COPage/classes/class.ilPCDataTable.php");
621 $tab->setNode($cont_node);
622 $tab->setHierId($a_hier_id);
626 require_once(
"./Services/COPage/classes/class.ilPCTable.php");
628 $tab->setNode($cont_node);
629 $tab->setHierId($a_hier_id);
631 $tab->setPcId($a_pc_id);
635 if (
$_GET[
"pgEdMediaMode"] !=
"") {echo
"ilPageObject::error media";
exit;}
638 require_once(
"./Services/COPage/classes/class.ilPCMediaObject.php");
640 $mal_node =& $child_node->first_child();
642 $id_arr = explode(
"_", $mal_node->get_attribute(
"OriginId"));
643 $mob_id = $id_arr[count($id_arr) - 1];
653 $mob->readMediaObject($mob_id);
656 $mob->setNode($cont_node);
657 $mob->setHierId($a_hier_id);
658 $mob->setPcId($a_pc_id);
662 require_once(
"./Services/COPage/classes/class.ilPCList.php");
664 $list->setNode($cont_node);
665 $list->setHierId($a_hier_id);
666 $list->setPcId($a_pc_id);
670 require_once(
"./Services/COPage/classes/class.ilPCFileList.php");
672 $file_list->setNode($cont_node);
673 $file_list->setHierId($a_hier_id);
674 $file_list->setPcId($a_pc_id);
679 require_once(
"./Services/COPage/classes/class.ilPCQuestion.php");
681 $pc_question->setNode($cont_node);
682 $pc_question->setHierId($a_hier_id);
683 $pc_question->setPcId($a_pc_id);
687 require_once(
"./Services/COPage/classes/class.ilPCSection.php");
689 $sec->setNode($cont_node);
690 $sec->setHierId($a_hier_id);
691 $sec->setPcId($a_pc_id);
695 require_once(
"./Services/COPage/classes/class.ilPCResources.php");
697 $res->setNode($cont_node);
698 $res->setHierId($a_hier_id);
699 $res->setPcId($a_pc_id);
702 case 'LoginPageElement':
703 include_once
'./Services/COPage/classes/class.ilPCLoginPageElements.php';
705 $res->setNode($cont_node);
706 $res->setHierId($a_hier_id);
707 $res->setPcId($a_pcid);
711 require_once(
"./Services/COPage/classes/class.ilPCMap.php");
712 $map =
new ilPCMap($this->dom);
713 $map->setNode($cont_node);
714 $map->setHierId($a_hier_id);
715 $map->setPcId($a_pc_id);
719 require_once(
"./Services/COPage/classes/class.ilPCTabs.php");
721 $map->setNode($cont_node);
722 $map->setHierId($a_hier_id);
723 $map->setPcId($a_pc_id);
727 require_once(
"./Services/COPage/classes/class.ilPCPlugged.php");
729 $plugged->setNode($cont_node);
730 $plugged->setHierId($a_hier_id);
731 $plugged->setPcId($a_pc_id);
736 require_once(
"./Services/COPage/classes/class.ilPCPlaceHolder.php");
738 $placeholder->setNode($cont_node);
739 $placeholder->setHierId($a_hier_id);
740 $placeholder->setPcId($a_pc_id);
743 case "ContentInclude":
744 require_once(
"./Services/COPage/classes/class.ilPCContentInclude.php");
746 $inc->setNode($cont_node);
747 $inc->setHierId($a_hier_id);
748 $inc->setPcId($a_pc_id);
751 case "InteractiveImage":
752 require_once(
"./Services/COPage/classes/class.ilPCInteractiveImage.php");
754 $iim->setNode($cont_node);
755 $iim->setHierId($a_hier_id);
756 $iim->setPcId($a_pc_id);
760 require_once(
"./Services/COPage/classes/class.ilPCProfile.php");
762 $prof->setNode($cont_node);
763 $prof->setHierId($a_hier_id);
764 $prof->setPcId($a_pc_id);
768 require_once(
"./Services/COPage/classes/class.ilPCVerification.php");
770 $vrfc->setNode($cont_node);
771 $vrfc->setHierId($a_hier_id);
772 $vrfc->setPcId($a_pc_id);
776 require_once(
"./Services/COPage/classes/class.ilPCBlog.php");
778 $blog->setNode($cont_node);
779 $blog->setHierId($a_hier_id);
780 $blog->setPcId($a_pc_id);
783 case "QuestionOverview":
784 require_once(
"./Services/COPage/classes/class.ilPCQuestionOverview.php");
786 $qover->setNode($cont_node);
787 $qover->setHierId($a_hier_id);
788 $qover->setPcId($a_pc_id);
792 require_once(
"./Services/COPage/classes/class.ilPCSkills.php");
794 $skill->setNode($cont_node);
795 $skill->setHierId($a_hier_id);
796 $skill->setPcId($a_pc_id);
802 require_once(
"./Services/COPage/classes/class.ilPCTableData.php");
804 $td->setNode($cont_node);
805 $td->setHierId($a_hier_id);
809 require_once(
"./Services/COPage/classes/class.ilPCListItem.php");
811 $td->setNode($cont_node);
812 $td->setHierId($a_hier_id);
816 require_once(
"./Services/COPage/classes/class.ilPCFileItem.php");
818 $file_item->setNode($cont_node);
819 $file_item->setHierId($a_hier_id);
841 if($a_hier_id ==
"pg")
850 $path =
"//*[@PCID = '$a_pc_id']";
852 if (count(
$res->nodeset) == 1)
854 $cont_node =&
$res->nodeset[0];
860 $path =
"//*[@HierId = '$a_hier_id']";
862 if (count(
$res->nodeset) == 1)
864 $cont_node =&
$res->nodeset[0];
882 $path =
"//*[@PCID = '$a_pc_id']//".$a_content_tag;
884 if (count(
$res->nodeset) > 0)
891 $path =
"//*[@HierId = '$a_hier_id']//".$a_content_tag;
893 if (count(
$res->nodeset) > 0)
904 $path =
"//*[@HierId = '$a_hier_id']";
906 if (count(
$res->nodeset) == 1)
929 $this->encoding = $a_encoding;
955 $enc_str = (!empty($this->encoding))
956 ?
"encoding=\"".$this->encoding.
"\""
958 return "<?xml version=\"1.0\" $enc_str ?>".
959 "<!DOCTYPE PageObject SYSTEM \"".ILIAS_ABSOLUTE_PATH.
"/xml/".$this->cur_dtd.
"\">".
974 $xml = $this->getXmlContent();
982 $xml = $temp_dom->dump_mem(0, $this->encoding);
983 $xml = eregi_replace(
"<\?xml[^>]*>",
"",
$xml);
984 $xml = eregi_replace(
"<!DOCTYPE[^>]*>",
"",
$xml);
1018 $path =
"//InteractiveImage/MediaAlias";
1023 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
1024 for ($i = 0; $i < count (
$res->nodeset); $i++)
1026 $or_id =
$res->nodeset[$i]->get_attribute(
"OriginId");
1031 if (!($inst_id > 0))
1035 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1040 $new_mob = $media_object->duplicate();
1042 $res->nodeset[$i]->set_attribute(
"OriginId",
"il__mob_".$new_mob->getId());
1056 $path =
"//Question";
1061 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
1062 for ($i = 0; $i < count (
$res->nodeset); $i++)
1064 $qref =
$res->nodeset[$i]->get_attribute(
"QRef");
1069 if (!($inst_id > 0))
1073 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
1080 $question->createPageObject();
1085 $duplicate_id = $question->duplicate(
false);
1086 $res->nodeset[$i]->set_attribute(
"QRef",
"il__qst_".$duplicate_id);
1101 $path =
"//Question";
1104 for ($i = 0; $i < count (
$res->nodeset); $i++)
1106 $parent_node =
$res->nodeset[$i]->parent_node();
1107 $parent_node->unlink_node($parent_node);
1121 $path =
"//PageContent";
1124 return count (
$res->nodeset);
1131 function getXMLFromDom($a_incl_head =
false, $a_append_mobs =
false, $a_append_bib =
false,
1132 $a_append_str =
"", $a_omit_pageobject_tag =
false)
1137 return $this->dom->dump_mem(0, $this->encoding);
1142 if ($a_append_mobs || $a_append_bib || $a_append_link_info)
1155 return "<dummy>".$this->dom->dump_node($this->node).$mobs.$bibs.$trans.$a_append_str.
"</dummy>";
1159 if (is_object($this->dom))
1161 if ($a_omit_pageobject_tag)
1164 $childs =& $this->node->child_nodes();
1165 for($i = 0; $i < count($childs); $i++)
1167 $xml.= $this->dom->dump_node($childs[$i]);
1173 $xml = $this->dom->dump_mem(0, $this->encoding);
1174 $xml = eregi_replace(
"<\?xml[^>]*>",
"",
$xml);
1175 $xml = eregi_replace(
"<!DOCTYPE[^>]*>",
"",
$xml);
1199 $lang_vars = array(
"ed_insert_par",
"ed_insert_code",
1200 "ed_insert_dtable",
"ed_insert_atable",
"ed_insert_media",
"ed_insert_list",
1201 "ed_insert_filelist",
"ed_paste_clip",
"ed_edit",
"ed_insert_section",
1202 "ed_edit_prop",
"ed_edit_files",
"ed_edit_data",
"ed_delete",
"ed_moveafter",
"ed_movebefore",
1203 "ed_go",
"ed_new_row_after",
"ed_new_row_before",
1204 "ed_new_col_after",
"ed_new_col_before",
"ed_delete_col",
1205 "ed_delete_row",
"ed_class",
"ed_width",
"ed_align_left",
1206 "ed_align_right",
"ed_align_center",
"ed_align_left_float",
1207 "ed_align_right_float",
"ed_delete_item",
"ed_new_item_before",
1208 "ed_new_item_after",
"ed_copy_clip",
"please_select",
"ed_split_page",
1209 "ed_item_up",
"ed_item_down",
"ed_row_up",
"ed_row_down",
1210 "ed_col_left",
"ed_col_right",
"ed_split_page_next",
"ed_enable",
1211 "de_activate",
"ed_insert_repobj",
"ed_insert_login_page_element",
"ed_insert_map",
"ed_insert_tabs",
1212 "ed_insert_pcqst",
"empty_question",
"ed_paste",
"question_placeh",
"media_placeh",
"text_placeh",
1213 "ed_insert_plach",
"question_placehl",
"media_placehl",
"text_placehl",
1214 "pc_flist",
"pc_par",
"pc_mob",
"pc_qst",
"pc_sec",
"pc_dtab",
"pc_tab",
1215 "pc_code",
"pc_vacc",
"pc_hacc",
"pc_res",
"pc_map",
"pc_list",
"ed_insert_incl",
"pc_incl",
1216 "pc_iim",
"ed_insert_iim",
"pc_prof",
"ed_insert_profile",
"pc_vrfc",
1217 "ed_insert_verification",
"pc_blog",
"ed_insert_blog",
"ed_edit_multiple",
"pc_qover",
"ed_insert_qover",
1218 "pc_skills",
"ed_insert_skills",
"ed_cut",
"ed_copy");
1220 foreach ($lang_vars as $lang_var)
1234 $xml.=
"<LV name=\"$var\" value=\"".$lng->txt(
"cont_".$var).
"\"/>";
1241 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
1243 $path =
"//Paragraph[1]";
1245 if (count(
$res->nodeset) > 0)
1247 $cont_node =&
$res->nodeset[0]->parent_node();
1249 $par->setNode($cont_node);
1250 return $par->getText();
1265 if (is_object(
$node))
1267 $node->set_content($a_content);
1282 $this->contains_int_link = $a_contains_link;
1297 if ($a_parse ===
true)
1299 $this->needs_parsing =
true;
1301 if ($a_parse ===
false)
1303 $this->needs_parsing =
false;
1315 $this->contains_question = $a_val;
1325 return $this->contains_question;
1340 $r = $ilias->db->query(
"SELECT * FROM object_reference WHERE ref_id=".
1341 $ilDB->quote(
$_GET[
"ref_id"],
'integer'));
1344 include_once(
"./classes/class.ilNestedSetXML.php");
1346 $bibs_xml = $nested->export(
$row[
"obj_id"],
"bib");
1361 $path =
"//MediaObject/MediaAlias";
1364 for($i = 0; $i < count(
$res->nodeset); $i++)
1366 $id_arr = explode(
"_",
$res->nodeset[$i]->get_attribute(
"OriginId"));
1367 $mob_id = $id_arr[count($id_arr) - 1];
1368 $mob_ids[$mob_id] = $mob_id;
1373 $path =
"//InteractiveImage/MediaAlias";
1375 for($i = 0; $i < count(
$res->nodeset); $i++)
1377 $id_arr = explode(
"_",
$res->nodeset[$i]->get_attribute(
"OriginId"));
1378 $mob_id = $id_arr[count($id_arr) - 1];
1379 $mob_ids[$mob_id] = $mob_id;
1384 $path =
"//IntLink[@Type = 'MediaObject']";
1387 for($i = 0; $i < count(
$res->nodeset); $i++)
1389 if ((
$res->nodeset[$i]->get_attribute(
"TargetFrame") ==
"") ||
1392 $target =
$res->nodeset[$i]->get_attribute(
"Target");
1393 $id_arr = explode(
"_", $target);
1394 if (($id_arr[1] == IL_INST_ID) ||
1395 (substr($target, 0, 4) ==
"il__"))
1397 $mob_id = $id_arr[count($id_arr) - 1];
1400 $mob_ids[$mob_id] = $mob_id;
1417 $path =
"//IntLink";
1422 for($i = 0; $i < count(
$res->nodeset); $i++)
1425 if ($a_cnt_multiple)
1427 $add =
":".$cnt_multiple;
1429 $target =
$res->nodeset[$i]->get_attribute(
"Target");
1430 $type =
$res->nodeset[$i]->get_attribute(
"Type");
1431 $targetframe =
$res->nodeset[$i]->get_attribute(
"TargetFrame");
1432 $anchor =
$res->nodeset[$i]->get_attribute(
"Anchor");
1433 $links[$target.
":".$type.
":".$targetframe.
":".$anchor.$add] =
1434 array(
"Target" => $target,
"Type" => $type,
1435 "TargetFrame" => $targetframe,
"Anchor" => $anchor);
1438 if ($type ==
"MediaObject" && $targetframe ==
"")
1440 if (substr($target, 0, 4) ==
"il__")
1442 $id_arr = explode(
"_", $target);
1443 $id = $id_arr[count($id_arr) - 1];
1446 foreach($med_links as $key => $med_link)
1448 $links[$key] = $med_link;
1460 $path =
"//MediaAlias";
1463 require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
1464 for($i = 0; $i < count(
$res->nodeset); $i++)
1466 $oid =
$res->nodeset[$i]->get_attribute(
"OriginId");
1467 if (substr($oid, 0, 4) ==
"il__")
1469 $id_arr = explode(
"_", $oid);
1470 $id = $id_arr[count($id_arr) - 1];
1473 foreach($med_links as $key => $med_link)
1475 $links[$key] = $med_link;
1495 $path =
"//FileItem/Identifier";
1502 $path =
"//FileItem/Identifier";
1505 $file_ids = array();
1506 for($i = 0; $i < count(
$res->nodeset); $i++)
1508 $id_arr = explode(
"_",
$res->nodeset[$i]->get_attribute(
"Entry"));
1509 $file_id = $id_arr[count($id_arr) - 1];
1510 $file_ids[$file_id] = $file_id;
1515 $path =
"//IntLink[@Type='File']";
1517 for($i = 0; $i < count(
$res->nodeset); $i++)
1519 $t =
$res->nodeset[$i]->get_attribute(
"Target");
1520 if (substr(
$t, 0, 9) ==
"il__dfile")
1522 $id_arr = explode(
"_",
$t);
1523 $file_id = $id_arr[count($id_arr) - 1];
1524 $file_ids[$file_id] = $file_id;
1541 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1542 foreach($mob_ids as $mob_id => $dummy)
1560 $path =
"//MediaObject/MediaAlias[@OriginId='il__mob_$a_mob_id']";
1562 $mal_node =&
$res->nodeset[$a_nr - 1];
1563 $mob_node =& $mal_node->parent_node();
1565 return $this->dom->dump_node($mob_node);
1576 $this->dom->validate($error);
1597 $this->hier_ids = array();
1598 $this->first_row_ids = array();
1599 $this->first_col_ids = array();
1600 $this->list_item_ids = array();
1601 $this->file_item_ids = array();
1608 foreach ($this->id_elements as $el)
1610 $path.= $sep.
"//".$el;
1615 for($i = 0; $i < count(
$res->nodeset); $i++)
1617 $cnode =
$res->nodeset[$i];
1618 $ctag = $cnode->node_name();
1622 while($cnode =& $cnode->previous_sibling())
1624 if (($cnode->node_type() == XML_ELEMENT_NODE)
1625 && $cnode->has_attribute(
"HierId"))
1627 $sib_hier_id = $cnode->get_attribute(
"HierId");
1633 if ($sib_hier_id !=
"")
1635 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
1637 $res->nodeset[$i]->set_attribute(
"HierId", $node_hier_id);
1638 $this->hier_ids[] = $node_hier_id;
1639 if ($ctag ==
"TableData")
1641 if (substr($par_hier_id,strlen($par_hier_id)-2) ==
"_1")
1643 $this->first_row_ids[] = $node_hier_id;
1646 if ($ctag ==
"ListItem")
1648 $this->list_item_ids[] = $node_hier_id;
1650 if ($ctag ==
"FileItem")
1652 $this->file_item_ids[] = $node_hier_id;
1658 $cnode =
$res->nodeset[$i];
1660 while($cnode =& $cnode->parent_node())
1662 if (($cnode->node_type() == XML_ELEMENT_NODE)
1663 && $cnode->has_attribute(
"HierId"))
1665 $par_hier_id = $cnode->get_attribute(
"HierId");
1671 if (($par_hier_id !=
"") && ($par_hier_id !=
"pg"))
1673 $node_hier_id = $par_hier_id.
"_1";
1674 $res->nodeset[$i]->set_attribute(
"HierId", $node_hier_id);
1675 $this->hier_ids[] = $node_hier_id;
1676 if ($ctag ==
"TableData")
1678 $this->first_col_ids[] = $node_hier_id;
1679 if (substr($par_hier_id,strlen($par_hier_id)-2) ==
"_1")
1681 $this->first_row_ids[] = $node_hier_id;
1684 if ($ctag ==
"ListItem")
1686 $this->list_item_ids[] = $node_hier_id;
1688 if ($ctag ==
"FileItem")
1690 $this->file_item_ids[] = $node_hier_id;
1696 $node_hier_id =
"1";
1697 $res->nodeset[$i]->set_attribute(
"HierId", $node_hier_id);
1698 $this->hier_ids[] = $node_hier_id;
1705 $path =
"//PageObject";
1707 for($i = 0; $i < count(
$res->nodeset); $i++)
1709 $res->nodeset[$i]->set_attribute(
"HierId",
"pg");
1710 $this->hier_ids[] =
"pg";
1720 return $this->hier_ids;
1728 return $this->first_row_ids;
1736 return $this->first_col_ids;
1744 return $this->list_item_ids;
1752 return $this->file_item_ids;
1760 if(is_object($this->dom))
1763 $path =
"//*[@HierId]";
1765 for($i = 0; $i < count(
$res->nodeset); $i++)
1767 if (
$res->nodeset[$i]->has_attribute(
"HierId"))
1769 $res->nodeset[$i]->remove_attribute(
"HierId");
1781 if (!is_array($a_pc_ids) || count($a_pc_ids) == 0)
1787 if(is_object($this->dom))
1790 $path =
"//*[@PCID]";
1792 for($i = 0; $i < count(
$res->nodeset); $i++)
1794 $pc_id =
$res->nodeset[$i]->get_attribute(
"PCID");
1795 if (in_array($pc_id, $a_pc_ids))
1797 $ret[$pc_id] =
$res->nodeset[$i]->get_attribute(
"HierId");
1812 $path =
"//FileItem";
1814 for($i = 0; $i < count(
$res->nodeset); $i++)
1816 $cnode =&
$res->nodeset[$i];
1817 $size_node =& $this->dom->create_element(
"Size");
1818 $size_node =& $cnode->append_child($size_node);
1820 $childs =& $cnode->child_nodes();
1822 for($j = 0; $j < count($childs); $j++)
1824 if ($childs[$j]->node_name() ==
"Identifier")
1826 if ($childs[$j]->has_attribute(
"Entry"))
1828 $entry = $childs[$j]->get_attribute(
"Entry");
1829 $entry_arr = explode(
"_", $entry);
1830 $id = $entry_arr[count($entry_arr) - 1];
1831 require_once(
"./Modules/File/classes/class.ilObjFile.php");
1836 $size_node->set_content(
$size);
1850 $path =
"//IntLink";
1852 for($i = 0; $i < count(
$res->nodeset); $i++)
1854 $target =
$res->nodeset[$i]->get_attribute(
"Target");
1855 $type =
$res->nodeset[$i]->get_attribute(
"Type");
1858 if ($new_target !==
false)
1860 $res->nodeset[$i]->set_attribute(
"Target", $new_target);
1865 IL_INST_ID > 0 && $type !=
"RepositoryItem")
1870 $res->nodeset[$i]->set_attribute(
"Target", $new_target);
1880 $path =
"//MediaAlias";
1884 for($i = 0; $i < count(
$res->nodeset); $i++)
1886 $orig_id =
$res->nodeset[$i]->get_attribute(
"OriginId");
1887 $id_arr = explode(
"_", $orig_id);
1888 $mob_id = $id_arr[count($id_arr) - 1];
1903 $path =
"//MediaAlias";
1906 for($i = 0; $i < count(
$res->nodeset); $i++)
1908 $old_id =
$res->nodeset[$i]->get_attribute(
"OriginId");
1909 $old_id = explode(
"_", $old_id);
1910 $old_id = $old_id[count($old_id) - 1];
1911 if ($a_mapping[$old_id] > 0)
1913 $res->nodeset[$i]->set_attribute(
"OriginId",
"il__mob_".$a_mapping[$old_id]);
1932 $path =
"//InteractiveImage/MediaAlias";
1935 for($i = 0; $i < count(
$res->nodeset); $i++)
1937 $old_id =
$res->nodeset[$i]->get_attribute(
"OriginId");
1938 if ($a_mapping[$old_id] > 0)
1940 $res->nodeset[$i]->set_attribute(
"OriginId",
"il__mob_".$a_mapping[$old_id]);
1959 $path =
"//FileItem/Identifier";
1962 for($i = 0; $i < count(
$res->nodeset); $i++)
1964 $old_id =
$res->nodeset[$i]->get_attribute(
"Entry");
1965 $old_id = explode(
"_", $old_id);
1966 $old_id = $old_id[count($old_id) - 1];
1967 if ($a_mapping[$old_id] > 0)
1969 $res->nodeset[$i]->set_attribute(
"Entry",
"il__file_".$a_mapping[$old_id]);
1986 $path =
"//Question";
1988 for($i = 0; $i < count(
$res->nodeset); $i++)
1990 $qref =
$res->nodeset[$i]->get_attribute(
"QRef");
1992 if (isset($a_mapping[$qref]))
1994 $res->nodeset[$i]->set_attribute(
"QRef",
"il__qst_".$a_mapping[$qref][
"pool"]);
2015 $path =
"//IntLink";
2017 for($i = 0; $i < count(
$res->nodeset); $i++)
2019 $target =
$res->nodeset[$i]->get_attribute(
"Target");
2020 $type =
$res->nodeset[$i]->get_attribute(
"Type");
2022 if ($a_from_to[$obj_id] > 0 && is_int(strpos($target,
"__")))
2026 $res->nodeset[$i]->set_attribute(
"Target",
"il__pg_".$a_from_to[$obj_id]);
2031 $res->nodeset[$i]->set_attribute(
"Target",
"il__st_".$a_from_to[$obj_id]);
2041 $path =
"//MediaAlias";
2044 require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
2045 require_once(
"Services/COPage/classes/class.ilMediaAliasItem.php");
2047 for($i = 0; $i < count(
$res->nodeset); $i++)
2049 $media_object_node =
$res->nodeset[$i]->parent_node();
2050 $page_content_node = $media_object_node->parent_node();
2051 $c_hier_id = $page_content_node->get_attribute(
"HierId");
2055 $c_hier_id,
"Standard");
2056 $areas = $std_alias_item->getMapAreas();
2057 $correction_needed =
false;
2058 if (count($areas) > 0)
2061 foreach($areas as $area)
2063 if ($area[
"Type"] ==
"PageObject" ||
2064 $area[
"Type"] ==
"StructureObject")
2066 $t = $area[
"Target"];
2067 $tid = _extractObjIdOfTarget(
$t);
2068 if ($a_from_to[$tid] > 0)
2070 $correction_needed =
true;
2081 $oid =
$res->nodeset[$i]->get_attribute(
"OriginId");
2082 if (substr($oid, 0, 4) ==
"il__")
2084 $id_arr = explode(
"_", $oid);
2085 $id = $id_arr[count($id_arr) - 1];
2088 $med_item = $mob->getMediaItem(
"Standard");
2089 $med_areas = $med_item->getMapAreas();
2091 foreach($med_areas as $area)
2093 $link_type = ($area->getLinkType() ==
"int")
2098 "Nr" => $area->getNr(),
2099 "Shape" => $area->getShape(),
2100 "Coords" => $area->getCoords(),
2102 "LinkType" => $link_type,
2103 "Href" => $area->getHref(),
2104 "Title" => $area->getTitle(),
2105 "Target" => $area->getTarget(),
2106 "Type" => $area->getType(),
2107 "TargetFrame" => $area->getTargetFrame()
2111 if ($area->getType() ==
"PageObject" ||
2112 $area->getType() ==
"StructureObject")
2114 $t = $area->getTarget();
2116 if ($a_from_to[$tid] > 0)
2118 $correction_needed =
true;
2127 if ($correction_needed)
2130 $std_alias_item->deleteAllMapAreas();
2131 foreach($areas as $area)
2133 if ($area[
"Link"][
"LinkType"] ==
"IntLink")
2135 $target = $area[
"Link"][
"Target"];
2136 $type = $area[
"Link"][
"Type"];
2138 if ($a_from_to[$obj_id] > 0)
2142 $area[
"Link"][
"Target"] =
"il__pg_".$a_from_to[$obj_id];
2146 $area[
"Link"][
"Target"] =
"il__st_".$a_from_to[$obj_id];
2151 $std_alias_item->addMapArea($area[
"Shape"], $area[
"Coords"],
2152 $area[
"Link"][
"Title"],
2153 array(
"Type" => $area[
"Link"][
"Type"],
2154 "TargetFrame" => $area[
"Link"][
"TargetFrame"],
2155 "Target" => $area[
"Link"][
"Target"],
2156 "Href" => $area[
"Link"][
"Href"],
2157 "LinkType" => $area[
"Link"][
"LinkType"],
2174 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
2181 foreach($sources as $source)
2184 if ($source[
"type"] ==
"lm:pg")
2187 $page_obj =
new ilPageObject(
"lm", $source[
"id"],
false);
2188 if (!$page_obj->page_not_found)
2191 $page_obj->handleImportRepositoryLink($a_rep_import_id,
2192 $a_rep_type, $a_rep_ref_id);
2194 $page_obj->update();
2205 $path =
"//IntLink";
2208 for($i = 0; $i < count(
$res->nodeset); $i++)
2211 $target =
$res->nodeset[$i]->get_attribute(
"Target");
2212 $type =
$res->nodeset[$i]->get_attribute(
"Type");
2213 if ($target == $a_rep_import_id && $type ==
"RepositoryItem")
2216 $res->nodeset[$i]->set_attribute(
"Target",
2217 "il__".$a_rep_type.
"_".$a_rep_ref_id);
2252 $ilDB->insert(
"page_object", array(
2253 "page_id" => array(
"integer", $this->
getId()),
2254 "parent_id" => array(
"integer", $this->
getParentId()),
2257 "create_user" => array(
"integer", $ilUser->getId()),
2258 "last_change_user" => array(
"integer", $ilUser->getId()),
2259 "active" => array(
"integer", $this->
getActive()),
2260 "inactive_elements" => array(
"integer", $iel),
2261 "int_links" => array(
"integer", $inl),
2263 "last_change" => array(
"timestamp",
ilUtil::now())
2304 $ilDB->update(
"page_object", array(
2306 "parent_id" => array(
"integer", $this->
getParentId()),
2307 "last_change_user" => array(
"integer", $ilUser->getId()),
2308 "last_change" => array(
"timestamp",
ilUtil::now()),
2309 "active" => array(
"integer", $this->
getActive()),
2312 "inactive_elements" => array(
"integer", $iel),
2313 "int_links" => array(
"integer", $inl),
2315 "page_id" => array(
"integer", $this->
getId()),
2337 function update($a_validate =
true, $a_no_history =
false, $skip_handle_usages =
false)
2370 $old_set = $ilDB->query(
"SELECT * FROM page_object WHERE ".
2371 "page_id = ".$ilDB->quote($this->getId(),
"integer").
" AND ".
2372 "parent_type = ".$ilDB->quote($this->getParentType(),
"text"));
2373 $last_nr_set = $ilDB->query(
"SELECT max(nr) as mnr FROM page_history WHERE ".
2374 "page_id = ".$ilDB->quote($this->getId(),
"integer").
" AND ".
2375 "parent_type = ".$ilDB->quote($this->getParentType(),
"text"));
2376 $last_nr = $ilDB->fetchAssoc($last_nr_set);
2377 if ($old_rec = $ilDB->fetchAssoc($old_set))
2380 if (($content != $old_rec[
"content"]) && !$a_no_history &&
2381 !$this->history_saved && !$this->layout_mode &&
2382 $lm_set->get(
"page_history", 1))
2384 if ($old_rec[
"content"] !=
"<PageObject></PageObject>")
2386 $ilDB->manipulateF(
"DELETE FROM page_history WHERE ".
2387 "page_id = %s AND parent_type = %s AND hdate = %s",
2388 array(
"integer",
"text",
"timestamp"),
2389 array($old_rec[
"page_id"], $old_rec[
"parent_type"], $old_rec[
"last_change"]));
2393 $last_c = $old_rec[
"last_change"];
2399 $ilDB->insert(
"page_history", array(
2400 "page_id" => array(
"integer", $old_rec[
"page_id"]),
2401 "parent_type" => array(
"text", $old_rec[
"parent_type"]),
2402 "hdate" => array(
"timestamp", $last_c),
2403 "parent_id" => array(
"integer", $old_rec[
"parent_id"]),
2404 "content" => array(
"clob", $old_rec[
"content"]),
2405 "user_id" => array(
"integer", $old_rec[
"last_change_user"]),
2407 "nr" => array(
"integer", (
int) $last_nr[
"mnr"] + 1)
2421 $this->
saveMobUsage($old_rec[
"content"], $last_nr[
"mnr"] + 1);
2423 $this->
saveFileUsage($old_rec[
"content"], $last_nr[
"mnr"] + 1);
2426 $this->history_saved =
true;
2430 $this->history_saved =
true;
2435 $em = (trim($content) ==
"<PageObject/>")
2455 $ilDB->update(
"page_object", array(
2456 "content" => array(
"clob", $content),
2457 "parent_id" => array(
"integer", $this->
getParentId()),
2458 "last_change_user" => array(
"integer", $ilUser->getId()),
2459 "last_change" => array(
"timestamp",
ilUtil::now()),
2460 "is_empty" => array(
"integer", $em),
2461 "active" => array(
"integer", $this->
getActive()),
2464 "inactive_elements" => array(
"integer", $iel),
2465 "int_links" => array(
"integer", $inl),
2467 "page_id" => array(
"integer", $this->
getId()),
2480 if (!$skip_handle_usages)
2483 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2488 foreach($mob_ids as $mob)
2493 $usages = $mob_obj->getUsages(
false);
2494 if (count($usages) == 0)
2502 include_once(
"./Modules/File/classes/class.ilObjFile.php");
2506 foreach($file_ids as
$file)
2510 $file_obj =
new ilObjFile($file,
false);
2511 $usages = $file_obj->getUsages();
2512 if (count($usages) == 0)
2514 if ($file_obj->getMode() ==
"filelist")
2516 $file_obj->delete();
2554 if (!$this->page_not_found)
2578 include_once(
"./Modules/File/classes/class.ilObjFile.php");
2582 include_once(
"./Services/News/classes/class.ilNewsItem.php");
2587 $ilDB->manipulate(
"DELETE FROM page_object ".
2588 "WHERE page_id = ".$ilDB->quote($this->getId(),
"integer").
2589 " AND parent_type= ".$ilDB->quote($this->getParentType(),
"text"));
2593 foreach (
$mobs as $mob_id)
2597 $GLOBALS[
'ilLog']->write(__METHOD__.
': Type mismatch. Ignoring mob with id: '.$mob_id);
2608 include_once(
"./Modules/File/classes/class.ilObjFile.php");
2609 foreach (
$files as $file_id)
2613 $file_obj =&
new ilObjFile($file_id,
false);
2614 $file_obj->delete();
2647 $keywords = array();
2653 for ($i=0; $i < count(
$res->nodeset); $i++)
2655 $k = trim(strip_tags(
$res->nodeset[$i]->get_content()));
2656 if (!in_array($k, $keywords))
2666 $meta_id = $this->
getId();
2668 include_once(
"./Services/MetaData/classes/class.ilMD.php");
2669 $md_obj =
new ilMD($meta_rep_id, $meta_id, $meta_type);
2670 $mkeywords = array();
2672 if(is_object($md_section = $md_obj->getGeneral()))
2674 foreach($ids = $md_section->getKeywordIds() as
$id)
2676 $md_key = $md_section->getKeyword(
$id);
2677 $mkeywords[] = strtolower($md_key->getKeyword());
2680 $lang = $md_key->getKeywordLanguageCode();
2686 foreach($ids = $md_section->getLanguageIds() as
$id)
2688 $md_lang = $md_section->getLanguage(
$id);
2691 $lang = $md_lang->getLanguageCode();
2695 foreach ($keywords as $k)
2697 if (!in_array(strtolower($k), $mkeywords))
2699 if (trim($k) !=
"" &&
$lang !=
"")
2701 $md_key = $md_section->addKeyword();
2706 $mkeywords[] = strtolower($k);
2723 $path =
"//MediaAlias";
2726 for ($i=0; $i < count(
$res->nodeset); $i++)
2728 $id_arr = explode(
"_",
$res->nodeset[$i]->get_attribute(
"OriginId"));
2729 $mob_id = $id_arr[count($id_arr) - 1];
2732 $usages[$mob_id] =
true;
2738 $path =
"//MediaObject/MetaData/General/Identifier";
2740 for ($i=0; $i < count(
$res->nodeset); $i++)
2742 $mob_entry =
$res->nodeset[$i]->get_attribute(
"Entry");
2743 $mob_arr = explode(
"_", $mob_entry);
2744 $mob_id = $mob_arr[count($mob_arr) - 1];
2747 $usages[$mob_id] =
true;
2753 $path =
"//IntLink[@Type='MediaObject']";
2755 for ($i=0; $i < count(
$res->nodeset); $i++)
2757 $mob_target =
$res->nodeset[$i]->get_attribute(
"Target");
2758 $mob_arr = explode(
"_", $mob_target);
2759 $mob_id = $mob_arr[count($mob_arr) - 1];
2762 $usages[$mob_id] =
true;
2766 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
2768 foreach($usages as $mob_id => $val)
2782 include_once(
"./Modules/File/classes/class.ilObjFile.php");
2784 foreach($file_ids as $file_id)
2795 include_once(
"./Services/COPage/classes/class.ilPageContentUsage.php");
2798 foreach($ci_ids as $ci_id)
2800 if ((
int) $ci_id[
"inst_id"] <= 0)
2817 $path =
"//ContentInclude";
2824 $path =
"//ContentInclude";
2828 for($i = 0; $i < count(
$res->nodeset); $i++)
2830 $type =
$res->nodeset[$i]->get_attribute(
"ContentType");
2831 $id =
$res->nodeset[$i]->get_attribute(
"ContentId");
2832 $inst_id =
$res->nodeset[$i]->get_attribute(
"InstId");
2833 $ci_ids[$type.
":".
$id.
":".$inst_id] = array(
2834 "type" => $type,
"id" =>
$id,
"inst_id" => $inst_id);
2845 include_once(
"./Services/COPage/classes/class.ilPageContentUsage.php");
2848 foreach($skl_ids as $skl_id)
2850 if ((
int) $skl_id[
"inst_id"] <= 0)
2878 for($i = 0; $i < count(
$res->nodeset); $i++)
2880 $user =
$res->nodeset[$i]->get_attribute(
"User");
2881 $id =
$res->nodeset[$i]->get_attribute(
"Id");
2882 $inst_id =
$res->nodeset[$i]->get_attribute(
"InstId");
2883 $skl_ids[$user.
":".
$id.
":".$inst_id] = array(
2884 "user" => $user,
"id" =>
$id,
"inst_id" => $inst_id);
2904 $path =
"//Paragraph | //Section | //MediaAlias | //FileItem".
2905 " | //Table | //TableData | //Tabs | //List";
2908 for ($i=0; $i < count(
$res->nodeset); $i++)
2910 switch (
$res->nodeset[$i]->node_name())
2913 $sname =
$res->nodeset[$i]->get_attribute(
"Characteristic");
2914 $stype =
"text_block";
2919 $sname =
$res->nodeset[$i]->get_attribute(
"Characteristic");
2925 $sname =
$res->nodeset[$i]->get_attribute(
"Class");
2926 $stype =
"media_cont";
2931 $sname =
$res->nodeset[$i]->get_attribute(
"Class");
2932 $stype =
"flist_li";
2937 $sname =
$res->nodeset[$i]->get_attribute(
"Template");
2940 $sname =
$res->nodeset[$i]->get_attribute(
"Class");
2952 $sname =
$res->nodeset[$i]->get_attribute(
"Class");
2953 $stype =
"table_cell";
2958 $sname =
$res->nodeset[$i]->get_attribute(
"Template");
2961 if (
$res->nodeset[$i]->get_attribute(
"Type") ==
"HorizontalAccordion")
2963 $stype =
"haccordion";
2965 if (
$res->nodeset[$i]->get_attribute(
"Type") ==
"VerticalAccordion")
2967 $stype =
"vaccordion";
2974 $sname =
$res->nodeset[$i]->get_attribute(
"Class");
2975 if (
$res->nodeset[$i]->get_attribute(
"Type") ==
"Ordered")
2986 if ($sname !=
"" && $stype !=
"")
2988 $usages[$sname.
":".$stype.
":".$template] = array(
"sname" => $sname,
2989 "stype" => $stype,
"template" => $template);
2993 $ilDB->manipulate(
"DELETE FROM page_style_usage WHERE ".
2994 " page_id = ".$ilDB->quote($this->getId(),
"integer").
2995 " AND page_type = ".$ilDB->quote($this->getParentType(),
"text").
2996 " AND page_nr = ".$ilDB->quote($a_old_nr,
"integer")
2999 foreach ($usages as $u)
3001 $ilDB->manipulate(
"INSERT INTO page_style_usage ".
3002 "(page_id, page_type, page_nr, template, stype, sname) VALUES (".
3003 $ilDB->quote($this->getId(),
"integer").
",".
3004 $ilDB->quote($this->getParentType(),
"text").
",".
3005 $ilDB->quote($a_old_nr,
"integer").
",".
3006 $ilDB->quote($u[
"template"],
"integer").
",".
3007 $ilDB->quote($u[
"stype"],
"text").
",".
3008 $ilDB->quote($u[
"sname"],
"text").
3019 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
3020 include_once(
"./Modules/File/classes/class.ilObjFile.php");
3042 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
3047 $path =
"//IntLink";
3049 for ($i=0; $i < count(
$res->nodeset); $i++)
3051 $link_type =
$res->nodeset[$i]->get_attribute(
"Type");
3055 case "StructureObject":
3063 case "GlossaryItem":
3071 case "RepositoryItem":
3080 $target =
$res->nodeset[$i]->get_attribute(
"Target");
3085 if (is_int(strpos($target,
"__")))
3104 $ilDB->manipulateF(
"DELETE FROM page_question WHERE page_parent_type = %s ".
3105 " AND page_id = %s", array(
"text",
"integer"),
3111 $path =
"//Question";
3114 for ($i=0; $i < count(
$res->nodeset); $i++)
3116 $q_ref =
$res->nodeset[$i]->get_attribute(
"QRef");
3119 if (!($inst_id > 0))
3124 $q_ids[$q_id] = $q_id;
3128 foreach($q_ids as $qid)
3130 $ilDB->manipulateF(
"INSERT INTO page_question (page_parent_type, page_id, question_id)".
3131 " VALUES (%s,%s,%s)",
3132 array(
"text",
"integer",
"integer"),
3144 $res = $ilDB->queryF(
"SELECT * FROM page_question WHERE page_parent_type = %s ".
3145 " AND page_id = %s",
3146 array(
"text",
"integer"),
3147 array($a_parent_type, $a_page_id));
3149 while ($rec = $ilDB->fetchAssoc(
$res))
3151 $q_ids[] = $rec[
"question_id"];
3173 for ($i=0; $i < count(
$res->nodeset); $i++)
3175 $name =
$res->nodeset[$i]->get_attribute(
"Name");
3176 if (trim($name) !=
"" && !in_array($name, $saved))
3192 $st = $ilDB->prepareManip(
"DELETE FROM page_anchor WHERE page_parent_type = ? ".
3193 " AND page_id = ?", array(
"text",
"integer"));
3194 $ilDB->execute($st, array($a_parent_type, $a_page_id));
3200 static function _saveAnchor($a_parent_type, $a_page_id, $a_anchor_name)
3204 $st = $ilDB->prepareManip(
"INSERT INTO page_anchor (page_parent_type, page_id, anchor_name) ".
3205 " VALUES (?,?,?) ", array(
"text",
"integer",
"text"));
3206 $ilDB->execute($st, array($a_parent_type, $a_page_id, $a_anchor_name));
3216 $st = $ilDB->prepare(
"SELECT * FROM page_anchor WHERE page_parent_type = ? ".
3217 " AND page_id = ?", array(
"text",
"integer"));
3218 $set = $ilDB->execute($st, array($a_parent_type, $a_page_id));
3220 while ($rec = $ilDB->fetchAssoc($set))
3222 $anchors[] = $rec[
"anchor_name"];
3245 $curr_node->unlink_node($curr_node);
3262 if (!is_array($a_hids))
3266 foreach($a_hids as $a_hid)
3268 $a_hid = explode(
":", $a_hid);
3272 if (!$this->
checkForTag(
"Question", $a_hid[0], $a_hid[1]) || $a_self_ass)
3275 if (is_object($curr_node))
3277 $parent_node = $curr_node->parent_node();
3278 if ($parent_node->node_name() !=
"TableRow")
3280 $curr_node->unlink_node($curr_node);
3311 if (!is_array($a_hids))
3316 $time = date(
"Y-m-d H:i:s", time());
3318 $hier_ids = array();
3320 foreach($a_hids as $a_hid)
3326 $a_hid = explode(
":", $a_hid);
3330 foreach($hier_ids as $h)
3332 if($h.
"_" == substr($a_hid[0], 0, strlen($h) + 1))
3334 $skip[] = $a_hid[0];
3336 if($a_hid[0].
"_" == substr($h, 0, strlen($a_hid[0]) + 1))
3341 $pc_id[$a_hid[0]] = $a_hid[1];
3342 if ($a_hid[0] !=
"")
3344 $hier_ids[$a_hid[0]] = $a_hid[0];
3347 foreach (
$skip as $s)
3349 unset($hier_ids[$s]);
3351 include_once(
"./Services/COPage/classes/class.ilPageContent.php");
3354 foreach($hier_ids as $hid)
3357 if (is_object($curr_node))
3359 if ($curr_node->node_name() ==
"PageContent")
3361 $content = $this->dom->dump_node($curr_node);
3363 $content = eregi_replace(
"PCID=\"[a-z0-9]*\"",
"",$content);
3364 $content = eregi_replace(
"HierId=\"[a-z0-9_]*\"",
"",$content);
3366 $ilUser->addToPCClipboard($content, $time, $nr);
3371 include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
3382 $a_hid = explode(
":", $a_hier_id);
3383 $content = $ilUser->getPCClipboardContent();
3387 for ($i = count($content) - 1; $i >= 0; $i--)
3391 $temp_dom =
domxml_open_mem(
'<?xml version="1.0" encoding="UTF-8"?>'.$c,
3397 $path =
"//PageContent";
3399 if (count(
$res->nodeset) > 0)
3401 $new_pc_node =
$res->nodeset[0];
3402 $cloned_pc_node = $new_pc_node->clone_node (
true);
3403 $cloned_pc_node->unlink_node ($cloned_pc_node);
3422 if (!is_array($a_hids))
3426 $obj = & $this->content_obj;
3428 foreach($a_hids as $a_hid)
3430 $a_hid = explode(
":", $a_hid);
3432 if (is_object($curr_node))
3434 if ($curr_node->node_name() ==
"PageContent")
3437 if ($cont_obj->isEnabled ())
3440 if (!$this->
checkForTag(
"Question", $a_hid[0], $a_hid[1]) || $a_self_ass)
3442 $cont_obj->disable();
3447 $cont_obj->enable();
3472 foreach ($hier_ids as $hier_id)
3475 if (!is_int(strpos($hier_id,
"_")))
3477 if ($hier_id !=
"pg" && $hier_id >= $a_hid)
3480 $curr_node->unlink_node($curr_node);
3502 foreach ($hier_ids as $hier_id)
3505 if (!is_int(strpos($hier_id,
"_")))
3507 if ($hier_id !=
"pg" && $hier_id < $a_hid)
3510 $curr_node->unlink_node($curr_node);
3530 $hier_ids = $a_source_page->getHierIds();
3532 $copy_ids = array();
3535 foreach ($hier_ids as $hier_id)
3538 if (!is_int(strpos($hier_id,
"_")))
3540 if ($hier_id !=
"pg" && $hier_id >= $a_hid)
3542 $copy_ids[] = $hier_id;
3548 $parent_node =& $a_target_page->getContentNode(
"pg");
3549 $target_dom =& $a_target_page->getDom();
3550 $parent_childs =& $parent_node->child_nodes();
3551 $cnt_parent_childs = count($parent_childs);
3553 $first_child =& $parent_childs[0];
3554 foreach($copy_ids as $copy_id)
3556 $source_node =& $a_source_page->getContentNode($copy_id);
3558 $new_node =& $source_node->clone_node(
true);
3559 $new_node->unlink_node($new_node);
3561 $source_node->unlink_node($source_node);
3563 if($cnt_parent_childs == 0)
3565 $new_node =& $parent_node->append_child($new_node);
3570 $new_node =& $first_child->insert_before($new_node, $first_child);
3572 $parent_childs =& $parent_node->child_nodes();
3577 $a_target_page->update();
3578 $a_source_page->update();
3590 $curr_name = $curr_node->node_name();
3591 if (($curr_name ==
"TableData") || ($curr_name ==
"PageObject") ||
3592 ($curr_name ==
"ListItem") || ($curr_name ==
"Section")
3593 || ($curr_name ==
"Tab") || ($curr_name ==
"ContentPopup"))
3598 $hid = $curr_node->get_attribute(
"HierId");
3607 $pos = explode(
"_", $a_pos);
3608 $target_pos = array_pop($pos);
3609 $parent_pos = implode($pos,
"_");
3613 $parent_pos = $a_pos;
3617 if($parent_pos !=
"")
3623 $parent_node =& $this->
getNode();
3627 $parent_childs =& $parent_node->child_nodes();
3628 $cnt_parent_childs = count($parent_childs);
3634 $new_node =& $a_cont_obj->getNode();
3638 if($succ_node =& $curr_node->next_sibling())
3640 $new_node =& $succ_node->insert_before($new_node, $succ_node);
3645 $new_node =& $parent_node->append_child($new_node);
3647 $a_cont_obj->setNode($new_node);
3652 $new_node =& $a_cont_obj->getNode();
3654 $new_node =& $succ_node->insert_before($new_node, $succ_node);
3655 $a_cont_obj->setNode($new_node);
3661 $new_node =& $a_cont_obj->getNode();
3662 if($cnt_parent_childs == 0)
3664 $new_node =& $parent_node->append_child($new_node);
3668 $new_node =& $parent_childs[0]->insert_before($new_node, $parent_childs[0]);
3670 $a_cont_obj->setNode($new_node);
3677 $sub_nodes = $curr_node->child_nodes() ;
3678 foreach ( $sub_nodes as $sub_node ) {
3679 if ($sub_node->node_name() ==
"PlaceHolder") {
3680 $curr_node->unlink_node();
3693 $curr_name = $curr_node->node_name();
3694 if (($curr_name ==
"TableData") || ($curr_name ==
"PageObject") ||
3695 ($curr_name ==
"ListItem") || ($curr_name ==
"Section")
3696 || ($curr_name ==
"Tab") || ($curr_name ==
"ContentPopup"))
3701 $hid = $curr_node->get_attribute(
"HierId");
3709 $pos = explode(
"_", $a_pos);
3710 $target_pos = array_pop($pos);
3711 $parent_pos = implode($pos,
"_");
3715 $parent_pos = $a_pos;
3719 if($parent_pos !=
"")
3725 $parent_node =& $this->
getNode();
3729 $parent_childs =& $parent_node->child_nodes();
3730 $cnt_parent_childs = count($parent_childs);
3737 if($succ_node = $curr_node->next_sibling())
3739 $a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
3743 $a_cont_node = $parent_node->append_child($a_cont_node);
3751 $a_cont_node = $succ_node->insert_before($a_cont_node, $succ_node);
3758 if($cnt_parent_childs == 0)
3760 $a_cont_node = $parent_node->append_child($a_cont_node);
3764 $a_cont_node = $parent_childs[0]->insert_before($a_cont_node, $parent_childs[0]);
3777 if($a_source == $a_target)
3784 $source_node =& $content->getNode();
3785 $clone_node =& $source_node->clone_node(
true);
3791 $content->setNode($clone_node);
3803 if($a_source == $a_target)
3810 $source_node =& $content->getNode();
3811 $clone_node =& $source_node->clone_node(
true);
3817 $content->setNode($clone_node);
3827 $a_content = eregi_replace(
"\[com\]",
"<Comment>",$a_content);
3828 $a_content = eregi_replace(
"\[\/com\]",
"</Comment>",$a_content);
3829 $a_content = eregi_replace(
"\[emp]",
"<Emph>",$a_content);
3830 $a_content = eregi_replace(
"\[\/emp\]",
"</Emph>",$a_content);
3831 $a_content = eregi_replace(
"\[str]",
"<Strong>",$a_content);
3832 $a_content = eregi_replace(
"\[\/str\]",
"</Strong>",$a_content);
3843 $path =
"//IntLink";
3845 for($i = 0; $i < count(
$res->nodeset); $i++)
3847 $target =
$res->nodeset[$i]->get_attribute(
"Target");
3848 $type =
$res->nodeset[$i]->get_attribute(
"Type");
3850 if (substr($target, 0, 4) ==
"il__")
3852 $id = substr($target, 4, strlen($target) - 4);
3855 if ($a_res_ref_to_obj_id && $type ==
"RepositoryItem")
3857 $id_arr = explode(
"_",
$id);
3862 $id = $otype.
"_".$obj_id;
3865 $new_target =
"il_".$a_inst.
"_".
$id;
3866 $res->nodeset[$i]->set_attribute(
"Target", $new_target);
3873 $path =
"//MediaAlias";
3875 for($i = 0; $i < count(
$res->nodeset); $i++)
3877 $origin_id =
$res->nodeset[$i]->get_attribute(
"OriginId");
3878 if (substr($origin_id, 0, 4) ==
"il__")
3880 $new_id =
"il_".$a_inst.
"_".substr($origin_id, 4, strlen($origin_id) - 4);
3881 $res->nodeset[$i]->set_attribute(
"OriginId", $new_id);
3888 $path =
"//FileItem/Identifier";
3890 for($i = 0; $i < count(
$res->nodeset); $i++)
3892 $origin_id =
$res->nodeset[$i]->get_attribute(
"Entry");
3893 if (substr($origin_id, 0, 4) ==
"il__")
3895 $new_id =
"il_".$a_inst.
"_".substr($origin_id, 4, strlen($origin_id) - 4);
3896 $res->nodeset[$i]->set_attribute(
"Entry", $new_id);
3903 $path =
"//Question";
3905 for($i = 0; $i < count(
$res->nodeset); $i++)
3907 $qref =
$res->nodeset[$i]->get_attribute(
"QRef");
3909 if (substr($qref, 0, 4) ==
"il__")
3911 $new_id =
"il_".$a_inst.
"_".substr($qref, 4, strlen($qref) - 4);
3913 $res->nodeset[$i]->set_attribute(
"QRef", $new_id);
3931 require_once(
"./Services/COPage/syntax_highlight/php/HFile/HFile_".$proglang.
".php");
3932 $classname =
"HFile_$proglang";
3933 $h_instance =
new $classname();
3934 if ($autoindent ==
"n") {
3935 $h_instance ->notrim = 1;
3936 $h_instance ->indent = array (
"");
3937 $h_instance ->unindent = array (
"");
3941 $a_text = $highlighter->highlight_text(html_entity_decode($a_text));
3947 return file_exists (
"Services/COPage/syntax_highlight/php/HFile/HFile_".$hfile_ext.
".php");
3958 $path =
"//Paragraph";
3960 for($i = 0; $i < count(
$res->nodeset); $i++)
3962 $context_node =
$res->nodeset[$i];
3963 $char = $context_node->get_attribute(
'Characteristic');
3965 if ($char !=
"Code")
3968 $n = $context_node->parent_node();
3969 $char = $context_node->get_attribute(
'Characteristic');
3970 $subchar = $context_node->get_attribute(
'SubCharacteristic');
3971 $showlinenumbers = $context_node->get_attribute(
'ShowLineNumbers');
3972 $downloadtitle = $context_node->get_attribute(
'DownloadTitle');
3973 $autoindent = $context_node->get_attribute(
'AutoIndent');
3978 $childs = $context_node->child_nodes();
3980 for($j=0; $j<count($childs); $j++)
3982 $content .= $this->dom->dump_node($childs[$j]);
3985 while ($context_node->has_child_nodes ())
3987 $node_del = $context_node->first_child ();
3988 $context_node->remove_child ($node_del);
3991 $content = str_replace(
"<br />",
"<br/>", utf8_decode($content) );
3992 $content = str_replace(
"<br/>",
"\n", $content);
3993 $rownums = count(split (
"\n",$content));
3995 $plain_content = html_entity_decode($content);
3996 $plain_content = preg_replace (
"/\&#x([1-9a-f]{2});?/ise",
"chr (base_convert (\\1, 16, 10))",$plain_content);
3997 $plain_content = preg_replace (
"/\&#(\d+);?/ise",
"chr (\\1)",$plain_content);
3998 $content = utf8_encode($this->
highlightText($plain_content, $subchar, $autoindent));
4000 $content = str_replace(
"&lt;",
"<", $content);
4001 $content = str_replace(
"&gt;",
">", $content);
4004 $rows =
"<tr valign=\"top\">";
4009 if (strcmp($showlinenumbers,
"y")==0)
4011 $linenumbers =
"<td nowrap=\"nowrap\" class=\"ilc_LineNumbers\" >";
4012 $linenumbers .=
"<pre class=\"ilc_Code\">";
4014 for ($j=0; $j < $rownums; $j++)
4016 $indentno = strlen($rownums) - strlen($j+1) + 2;
4017 $rownumeration = ($j+1);
4018 $linenumbers .=
"<span class=\"ilc_LineNumber\">$rownumeration</span>";
4019 if ($j < $rownums-1)
4021 $linenumbers .=
"\n";
4024 $linenumbers .=
"</pre>";
4025 $linenumbers .=
"</td>";
4028 $rows .= $linenumbers.
"<td class=\"ilc_Sourcecode\"><pre class=\"ilc_Code\">".$content.
"</pre></td>";
4033 $newcontent = str_replace(
"\n",
"<br/>",$rows);
4035 $newcontent = str_replace(
"<br/><br/>",
"<br/> <br/>",$newcontent);
4037 $newcontent = str_replace(
"<br/><br/>",
"<br/> <br/>",$newcontent);
4042 $newcontent = str_replace(
"{",
"{", $newcontent);
4043 $newcontent = str_replace(
"}",
"}", $newcontent);
4046 $a_output = str_replace(
"[[[[[Code;".($i + 1).
"]]]]]", $newcontent, $a_output);
4048 if ($outputmode !=
"presentation" && is_object($this->offline_handler)
4049 && trim($downloadtitle) !=
"")
4052 $this->offline_handler->handleCodeParagraph ($this->
id, $i + 1, $downloadtitle, $plain_content);
4069 foreach ($this->id_elements as $el)
4071 $path.= $sep.
"//".$el.
"[not(@PCID)]";
4078 if (count (
$res->nodeset) > 0)
4099 foreach ($this->id_elements as $el)
4101 $path.= $sep.
"//".$el.
"[@PCID]";
4109 for ($i = 0; $i < count (
$res->nodeset); $i++)
4112 $pcids[] =
$node->get_attribute(
"PCID");
4131 foreach ($this->id_elements as $el)
4133 $path.= $sep.
"//".$el.
"[@PCID='".$a_pc_id.
"']";
4140 return (count(
$res->nodeset) > 0);
4151 if ($a_pc_ids ===
false)
4155 $id = ilUtil::randomHash(10, $a_pc_ids);
4172 foreach ($this->id_elements as $el)
4174 $path.= $sep.
"//".$el.
"[not(@PCID)]";
4180 for ($i = 0; $i < count (
$res->nodeset); $i++)
4183 $id = ilUtil::randomHash(10, $pcids);
4186 $res->nodeset[$i]->set_attribute(
"PCID",
$id);
4196 $this->addHierIds();
4200 $path =
"//PageContent";
4205 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
4206 for ($i = 0; $i < count (
$res->nodeset); $i++)
4208 $hier_id =
$res->nodeset[$i]->get_attribute(
"HierId");
4209 $pc_id =
$res->nodeset[$i]->get_attribute(
"PCID");
4210 $dump = $mydom->dump_node(
$res->nodeset[$i]);
4211 if (($hpos = strpos($dump,
' HierId="'.$hier_id.
'"')) > 0)
4213 $dump = substr($dump, 0, $hpos).
4214 substr($dump, $hpos + strlen(
' HierId="'.$hier_id.
'"'));
4217 $childs =
$res->nodeset[$i]->child_nodes();
4219 if ($childs[0] && $childs[0]->node_name() ==
"Paragraph")
4221 $content = $mydom->dump_node($childs[0]);
4222 $content = substr($content, strpos($content,
">") + 1,
4223 strrpos($content,
"<") - (strpos($content,
">") + 1));
4231 array(
"hier_id" => $hier_id,
"hash" => md5($dump),
"content" => $content);
4246 $path =
"//Question";
4251 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
4252 for ($i = 0; $i < count (
$res->nodeset); $i++)
4254 $qref =
$res->nodeset[$i]->get_attribute(
"QRef");
4259 if (!($inst_id > 0))
4280 $path =
"/descendant::Paragraph[position() = $par_id]";
4284 if (count (
$res->nodeset) != 1)
4285 die (
"Should not happen");
4287 $context_node =
$res->nodeset[0];
4291 $childs = $context_node->child_nodes();
4293 for($j=0; $j<count($childs); $j++)
4295 $content .= $mydom->dump_node($childs[$j]);
4298 $content = str_replace(
"<br />",
"\n", $content);
4299 $content = str_replace(
"<br/>",
"\n", $content);
4301 $plain_content = html_entity_decode($content);
4318 $xsl = file_get_contents(
"./Services/COPage/xsl/page_fo.xsl");
4319 $args = array(
'/_xml' =>
$xml,
'/_xsl' => $xsl );
4325 $fo =
xslt_process($xh,
"arg:/_xml",
"arg:/_xsl",NULL,$args, $params);
4328 $fo = str_replace(
"\n",
"", $fo);
4329 $fo = str_replace(
"<br/>",
"<br>", $fo);
4330 $fo = str_replace(
"<br>",
"\n", $fo);
4335 $fo = substr($fo, strpos($fo,
">") + 1);
4341 $this->offline_handler = $handler;
4355 $query =
"SELECT * FROM page_object WHERE page_id = ".
4356 $ilDB->quote($a_id,
"integer").
" AND ".
4357 " parent_type = ".$ilDB->quote($a_parent_type,
"text").
" AND ".
4358 " inactive_elements = ".$ilDB->quote(1,
"integer");
4359 $obj_set = $ilDB->query(
$query);
4377 if (strpos($a_content,
" Enabled=\"False\""))
4391 $h_query =
"SELECT * FROM page_history ".
4392 " WHERE page_id = ".$ilDB->quote($this->
getId(),
"integer").
4393 " AND parent_type = ".$ilDB->quote($this->
getParentType(),
"text").
4394 " ORDER BY hdate DESC";
4396 $hset = $ilDB->query($h_query);
4397 $hentries = array();
4399 while ($hrec = $ilDB->fetchAssoc($hset))
4401 $hrec[
"sortkey"] = (int) $hrec[
"nr"];
4402 $hrec[
"user"] = (int) $hrec[
"user_id"];
4403 $hentries[] = $hrec;
4416 $res = $ilDB->queryF(
"SELECT * FROM page_history ".
4417 " WHERE page_id = %s ".
4418 " AND parent_type = %s ".
4420 array(
"integer",
"text",
"integer"),
4422 if ($hrec = $ilDB->fetchAssoc(
$res))
4442 $res = $ilDB->query(
"SELECT MAX(nr) mnr FROM page_history ".
4443 " WHERE page_id = ".$ilDB->quote($this->getId(),
"integer").
4444 " AND parent_type = ".$ilDB->quote($this->getParentType(),
"text").
4445 " AND nr < ".$ilDB->quote((
int) $a_nr,
"integer"));
4447 if (
$row[
"mnr"] > 0)
4449 $res = $ilDB->query(
"SELECT * FROM page_history ".
4450 " WHERE page_id = ".$ilDB->quote($this->getId(),
"integer").
4451 " AND parent_type = ".$ilDB->quote($this->getParentType(),
"text").
4452 " AND nr = ".$ilDB->quote((
int)
$row[
"mnr"],
"integer"));
4453 $row = $ilDB->fetchAssoc(
$res);
4458 $res = $ilDB->query(
"SELECT MIN(nr) mnr FROM page_history ".
4459 " WHERE page_id = ".$ilDB->quote($this->getId(),
"integer").
4460 " AND parent_type = ".$ilDB->quote($this->getParentType(),
"text").
4461 " AND nr > ".$ilDB->quote((
int) $a_nr,
"integer"));
4463 if (
$row[
"mnr"] > 0)
4465 $res = $ilDB->query(
"SELECT * FROM page_history ".
4466 " WHERE page_id = ".$ilDB->quote($this->getId(),
"integer").
4467 " AND parent_type = ".$ilDB->quote($this->getParentType(),
"text").
4468 " AND nr = ".$ilDB->quote((
int)
$row[
"mnr"],
"integer"));
4469 $row = $ilDB->fetchAssoc(
$res);
4474 $res = $ilDB->query(
"SELECT * FROM page_history ".
4475 " WHERE page_id = ".$ilDB->quote($this->getId(),
"integer").
4476 " AND parent_type = ".$ilDB->quote($this->getParentType(),
"text").
4477 " AND nr = ".$ilDB->quote((
int) $a_nr,
"integer"));
4489 $rnode =
$res->nodeset[0];
4492 foreach($a_hashes as $pc_id => $h)
4495 if ($h[
"change"] !=
"")
4498 $dc_node = $this->dom->create_element(
"DivClass");
4499 $dc_node->set_attribute(
"HierId", $h[
"hier_id"]);
4500 $dc_node->set_attribute(
"Class",
"ilEdit".$h[
"change"]);
4501 $dc_node = $rnode->append_child($dc_node);
4520 $l_hashes = $l_page->getPageContentsHashes();
4521 $r_hashes = $r_page->getPageContentsHashes();
4524 foreach ($l_hashes as $pc_id => $h)
4526 if (!isset($r_hashes[$pc_id]))
4528 $l_hashes[$pc_id][
"change"] =
"Deleted";
4532 if ($l_hashes[$pc_id][
"hash"] != $r_hashes[$pc_id][
"hash"])
4534 $l_hashes[$pc_id][
"change"] =
"Modified";
4535 $r_hashes[$pc_id][
"change"] =
"Modified";
4537 include_once(
"./Services/COPage/mediawikidiff/class.WordLevelDiff.php");
4539 if ($l_hashes[$pc_id][
"content"] !=
"" &&
4540 $r_hashes[$pc_id][
"content"] !=
"")
4542 $new_left = str_replace(
"\n",
"<br />", $l_hashes[$pc_id][
"content"]);
4543 $new_right = str_replace(
"\n",
"<br />", $r_hashes[$pc_id][
"content"]);
4546 $new_left = $wldiff->orig();
4547 $new_right = $wldiff->closing();
4548 $l_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_left[0]);
4549 $r_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_right[0]);
4556 foreach ($r_hashes as $pc_id => $h)
4558 if (!isset($l_hashes[$pc_id]))
4560 $r_hashes[$pc_id][
"change"] =
"New";
4564 $l_page->addChangeDivClasses($l_hashes);
4565 $r_page->addChangeDivClasses($r_hashes);
4567 return array(
"l_page" => $l_page,
"r_page" => $r_page,
4568 "l_changes" => $l_hashes,
"r_changes" => $r_hashes);
4578 $ilDB->manipulate(
"UPDATE page_object ".
4579 " SET view_cnt = view_cnt + 1 ".
4580 " WHERE page_id = ".$ilDB->quote($this->getId(),
"integer").
4581 " AND parent_type = ".$ilDB->quote($this->getParentType(),
"text"));
4596 $page_changes = array();
4597 $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
4598 $q =
"SELECT * FROM page_object ".
4599 " WHERE parent_id = ".$ilDB->quote($a_parent_id,
"integer").
4600 " AND parent_type = ".$ilDB->quote($a_parent_type,
"text").
4601 " AND last_change >= ".$ilDB->quote($limit_ts,
"timestamp");
4603 $set = $ilDB->query($q);
4604 while($page = $ilDB->fetchAssoc($set))
4606 $page_changes[] = array(
"date" => $page[
"last_change"],
4607 "id" => $page[
"page_id"],
"type" =>
"page",
4608 "user" => $page[
"last_change_user"]);
4614 $limit_ts = date(
'Y-m-d H:i:s', time() - ($a_period * 24 * 60 * 60));
4615 $and_str =
" AND hdate >= ".$ilDB->quote($limit_ts,
"timestamp").
" ";
4618 $q =
"SELECT * FROM page_history ".
4619 " WHERE parent_id = ".$ilDB->quote($a_parent_id,
"integer").
4620 " AND parent_type = ".$ilDB->quote($a_parent_type,
"text").
4622 $set = $ilDB->query($q);
4623 while ($page = $ilDB->fetchAssoc($set))
4625 $page_changes[] = array(
"date" => $page[
"hdate"],
4626 "id" => $page[
"page_id"],
"type" =>
"hist",
"nr" => $page[
"nr"],
4627 "user" => $page[
"user_id"]);
4632 return $page_changes;
4646 $page_changes = array();
4648 $q =
"SELECT * FROM page_object ".
4649 " WHERE parent_id = ".$ilDB->quote($a_parent_id,
"integer").
4650 " AND parent_type = ".$ilDB->quote($a_parent_type,
"text");
4651 $set = $ilDB->query($q);
4653 while ($page = $ilDB->fetchAssoc($set))
4655 $pages[$page[
"page_id"]] = array(
"date" => $page[
"last_change"],
4656 "id" => $page[
"page_id"],
"user" => $page[
"last_change_user"]);
4674 $q =
"SELECT * FROM page_object ".
4675 " WHERE parent_id = ".$ilDB->quote($a_parent_id,
"integer").
4676 " AND parent_type = ".$ilDB->quote($a_parent_type,
"text").
4677 " ORDER BY created DESC";
4678 $set = $ilDB->query($q);
4679 while($page = $ilDB->fetchAssoc($set))
4681 if ($page[
"created"] !=
"")
4683 $pages[] = array(
"created" => $page[
"created"],
4684 "id" => $page[
"page_id"],
4685 "user" => $page[
"create_user"],
4703 $contributors = array();
4704 $set = $ilDB->queryF(
"SELECT last_change_user FROM page_object ".
4705 " WHERE parent_id = %s AND parent_type = %s ".
4706 " AND last_change_user != %s",
4707 array(
"integer",
"text",
"integer"),
4708 array($a_parent_id, $a_parent_type, 0));
4710 while ($page = $ilDB->fetchAssoc($set))
4712 $contributors[$page[
"last_change_user"]][$page[
"page_id"]] = 1;
4715 $set = $ilDB->queryF(
"SELECT count(DISTINCT page_id, parent_type, hdate) as cnt, page_id, user_id FROM page_history ".
4716 " WHERE parent_id = %s AND parent_type = %s AND user_id != %s ".
4717 " GROUP BY page_id, user_id ",
4718 array(
"integer",
"text",
"integer"),
4719 array($a_parent_id, $a_parent_type, 0));
4720 while ($hpage = $ilDB->fetchAssoc($set))
4722 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] =
4723 $contributors[$hpage[
"user_id"]][$hpage[
"page_id"]] + $hpage[
"cnt"];
4727 foreach ($contributors as $k => $co)
4732 $c[] = array(
"user_id" => $k,
"pages" => $co,
4733 "lastname" => $name[
"lastname"],
"firstname" => $name[
"firstname"]);
4750 $contributors = array();
4751 $set = $ilDB->queryF(
"SELECT last_change_user FROM page_object ".
4752 " WHERE page_id = %s AND parent_type = %s ".
4753 " AND last_change_user != %s",
4754 array(
"integer",
"text",
"integer"),
4755 array($a_page_id, $a_parent_type, 0));
4757 while ($page = $ilDB->fetchAssoc($set))
4759 $contributors[$page[
"last_change_user"]] = 1;
4762 $set = $ilDB->queryF(
"SELECT count(*) as cnt, page_id, user_id FROM page_history ".
4763 " WHERE page_id = %s AND parent_type = %s AND user_id != %s ".
4764 " GROUP BY user_id, page_id ",
4765 array(
"integer",
"text",
"integer"),
4766 array($a_page_id, $a_parent_type, 0));
4767 while ($hpage = $ilDB->fetchAssoc($set))
4769 $contributors[$hpage[
"user_id"]] =
4770 $contributors[$hpage[
"user_id"]] + $hpage[
"cnt"];
4774 foreach ($contributors as $k => $co)
4777 $c[] = array(
"user_id" => $k,
"pages" => $co,
4778 "lastname" => $name[
"lastname"],
"firstname" => $name[
"firstname"]);
4791 $ilDB->update(
"page_object", array(
4792 "rendered_content" => array(
"clob", $a_content),
4793 "render_md5" => array(
"text", $a_md5),
4794 "rendered_time" => array(
"timestamp",
ilUtil::now())
4796 "page_id" => array(
"integer", $this->
getId()),
4818 $page_changes = array();
4820 $q =
"SELECT * FROM page_object ".
4821 " WHERE parent_id = ".$ilDB->quote($a_parent_id,
"integer").
4822 " AND parent_type = ".$ilDB->quote($a_parent_type,
"text").
4823 " AND int_links = ".$ilDB->quote(1,
"integer");
4824 $set = $ilDB->query($q);
4826 while ($page = $ilDB->fetchAssoc($set))
4828 $pages[$page[
"page_id"]] = array(
"date" => $page[
"last_change"],
4829 "id" => $page[
"page_id"],
"user" => $page[
"last_change_user"]);
4843 if (strpos($a_content,
"IntLink"))