24 require_once(
"./Services/COPage/classes/class.ilPageContent.php");
25 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
26 require_once(
"./Services/COPage/syntax_highlight/php/Beautifier/Init.php");
27 require_once(
"./Services/COPage/syntax_highlight/php/Output/Output_css.php");
30 define(
"IL_INSERT_BEFORE", 0);
31 define(
"IL_INSERT_AFTER", 1);
32 define(
"IL_INSERT_CHILD", 2);
34 define (
"IL_CHAPTER_TITLE",
"st_title");
35 define (
"IL_PAGE_TITLE",
"pg_title");
36 define (
"IL_NO_HEADER",
"none");
75 function ilPageObject($a_parent_type, $a_id = 0, $a_old_nr = 0, $a_halt =
true)
79 $this->parent_type = $a_parent_type;
83 $this->contains_int_link =
false;
84 $this->needs_parsing =
false;
85 $this->update_listeners = array();
86 $this->update_listener_cnt = 0;
87 $this->dom_builded =
false;
88 $this->halt_on_error = $a_halt;
89 $this->page_not_found =
false;
90 $this->old_nr = $a_old_nr;
91 $this->encoding =
"UTF-8";
93 array(
"PageContent",
"TableRow",
"TableData",
"ListItem",
"FileItem",
104 $this->halt_on_error = $a_halt;
114 $this->rendermd5 = $a_rendermd5;
124 return $this->rendermd5;
134 $this->renderedcontent = $a_renderedcontent;
144 return $this->renderedcontent;
154 $this->renderedtime = $a_renderedtime;
164 return $this->renderedtime;
174 $this->lastchange = $a_lastchange;
184 return $this->lastchange;
194 $ilBench->start(
"ContentPresentation",
"ilPageObject_read");
195 if ($this->old_nr == 0)
197 $query =
"SELECT * FROM page_object WHERE page_id = ".$ilDB->quote($this->
id).
" ".
199 $pg_set = $this->ilias->db->query($query);
204 $query =
"SELECT * FROM page_history WHERE page_id = ".$ilDB->quote($this->
id).
" ".
206 " AND nr = ".$ilDB->quote($this->old_nr);
207 $pg_set = $this->ilias->db->query($query);
210 if (!$this->page_record)
212 if ($this->halt_on_error)
214 echo
"Error: Page ".$this->id.
" is not in database".
215 " (parent type ".$this->getParentType().
").";
exit;
219 $this->page_not_found =
true;
223 $this->xml = $this->page_record[
"content"];
224 $this->
setParentId($this->page_record[
"parent_id"]);
225 $this->last_change_user = $this->page_record[
"last_change_user"];
226 $this->create_user = $this->page_record[
"create_user"];
232 $ilBench->stop(
"ContentPresentation",
"ilPageObject_read");
245 $query =
"SELECT * FROM page_object WHERE page_id = ".$ilDB->quote($a_id).
" ".
246 "AND parent_type= ".$ilDB->quote($a_parent_type);
248 $set = $ilDB->query($query);
264 if ($this->dom_builded && !$a_force)
271 $ilBench->start(
"ContentPresentation",
"ilPageObject_buildDom");
273 $ilBench->stop(
"ContentPresentation",
"ilPageObject_buildDom");
276 $path =
"//PageObject";
278 if (count(
$res->nodeset) == 1)
280 $this->node =&
$res->nodeset[0];
285 $this->dom_builded =
true;
320 $this->parent_id = $a_id;
330 $this->parent_type = $a_type;
341 $this->update_listeners[$cnt][
"object"] =& $a_object;
342 $this->update_listeners[$cnt][
"method"] = $a_method;
343 $this->update_listeners[$cnt][
"parameters"] = $a_parameters;
344 $this->update_listener_cnt++;
351 $object =& $this->update_listeners[$i][
"object"];
352 $method = $this->update_listeners[$i][
"method"];
353 $parameters = $this->update_listeners[$i][
"parameters"];
354 $object->$method($parameters);
365 if (!is_object($cont_node))
369 switch($cont_node->node_name())
372 $child_node =& $cont_node->first_child();
374 switch($child_node->node_name())
377 require_once(
"./Services/COPage/classes/class.ilPCParagraph.php");
379 $par->setNode($cont_node);
380 $par->setHierId($a_hier_id);
381 $par->setPcId($a_pc_id);
385 if ($child_node->get_attribute(
"DataTable") ==
"y")
387 require_once(
"./Services/COPage/classes/class.ilPCDataTable.php");
389 $tab->setNode($cont_node);
390 $tab->setHierId($a_hier_id);
394 require_once(
"./Services/COPage/classes/class.ilPCTable.php");
396 $tab->setNode($cont_node);
397 $tab->setHierId($a_hier_id);
399 $tab->setPcId($a_pc_id);
403 if (
$_GET[
"pgEdMediaMode"] !=
"") {echo
"ilPageObject::error media";
exit;}
406 require_once(
"./Services/COPage/classes/class.ilPCMediaObject.php");
408 $mal_node =& $child_node->first_child();
410 $id_arr = explode(
"_", $mal_node->get_attribute(
"OriginId"));
411 $mob_id = $id_arr[count($id_arr) - 1];
421 $mob->readMediaObject($mob_id);
424 $mob->setNode($cont_node);
425 $mob->setHierId($a_hier_id);
426 $mob->setPcId($a_pc_id);
430 require_once(
"./Services/COPage/classes/class.ilPCList.php");
432 $list->setNode($cont_node);
433 $list->setHierId($a_hier_id);
434 $list->setPcId($a_pc_id);
438 require_once(
"./Services/COPage/classes/class.ilPCFileList.php");
440 $file_list->setNode($cont_node);
441 $file_list->setHierId($a_hier_id);
442 $file_list->setPcId($a_pc_id);
447 require_once(
"./Services/COPage/classes/class.ilPCQuestion.php");
449 $pc_question->setNode($cont_node);
450 $pc_question->setHierId($a_hier_id);
451 $pc_question->setPcId($a_pc_id);
455 require_once(
"./Services/COPage/classes/class.ilPCSection.php");
457 $sec->setNode($cont_node);
458 $sec->setHierId($a_hier_id);
459 $sec->setPcId($a_pc_id);
463 require_once(
"./Services/COPage/classes/class.ilPCResources.php");
465 $res->setNode($cont_node);
466 $res->setHierId($a_hier_id);
467 $res->setPcId($a_pc_id);
471 require_once(
"./Services/COPage/classes/class.ilPCMap.php");
472 $map =
new ilPCMap($this->dom);
473 $map->setNode($cont_node);
474 $map->setHierId($a_hier_id);
475 $map->setPcId($a_pc_id);
479 require_once(
"./Services/COPage/classes/class.ilPCTabs.php");
481 $map->setNode($cont_node);
482 $map->setHierId($a_hier_id);
483 $map->setPcId($a_pc_id);
487 require_once(
"./Services/COPage/classes/class.ilPCPlugged.php");
489 $plugged->setNode($cont_node);
490 $plugged->setHierId($a_hier_id);
491 $plugged->setPcId($a_pc_id);
498 require_once(
"./Services/COPage/classes/class.ilPCTableData.php");
500 $td->setNode($cont_node);
501 $td->setHierId($a_hier_id);
505 require_once(
"./Services/COPage/classes/class.ilPCListItem.php");
507 $td->setNode($cont_node);
508 $td->setHierId($a_hier_id);
512 require_once(
"./Services/COPage/classes/class.ilPCFileItem.php");
514 $file_item->setNode($cont_node);
515 $file_item->setHierId($a_hier_id);
519 require_once(
"./Services/COPage/classes/class.ilPCTab.php");
521 $tab->setNode($cont_node);
522 $tab->setHierId($a_hier_id);
531 if($a_hier_id ==
"pg")
540 $path =
"//*[@PCID = '$a_pc_id']";
542 if (count(
$res->nodeset) == 1)
544 $cont_node =&
$res->nodeset[0];
550 $path =
"//*[@HierId = '$a_hier_id']";
552 if (count(
$res->nodeset) == 1)
554 $cont_node =&
$res->nodeset[0];
564 $path =
"//*[@HierId = '$a_hier_id']";
566 if (count(
$res->nodeset) == 1)
589 $this->encoding = $a_encoding;
615 $enc_str = (!empty($this->encoding))
616 ?
"encoding=\"".$this->encoding.
"\""
618 return "<?xml version=\"1.0\" $enc_str ?>".
619 "<!DOCTYPE PageObject SYSTEM \"".ILIAS_ABSOLUTE_PATH.
"/xml/".$this->cur_dtd.
"\">".
632 function getXMLFromDom($a_incl_head =
false, $a_append_mobs =
false, $a_append_bib =
false,
633 $a_append_str =
"", $a_omit_pageobject_tag =
false)
638 return $this->dom->dump_mem(0, $this->encoding);
643 if ($a_append_mobs || $a_append_bib || $a_append_link_info)
656 return "<dummy>".$this->dom->dump_node($this->node).$mobs.$bibs.$trans.$a_append_str.
"</dummy>";
660 if (is_object($this->dom))
662 if ($a_omit_pageobject_tag)
665 $childs =& $this->node->child_nodes();
666 for($i = 0; $i < count($childs); $i++)
668 $xml.= $this->dom->dump_node($childs[$i]);
674 $xml = $this->dom->dump_mem(0, $this->encoding);
675 $xml = eregi_replace(
"<\?xml[^>]*>",
"",
$xml);
676 $xml = eregi_replace(
"<!DOCTYPE[^>]*>",
"",
$xml);
700 $lang_vars = array(
"ed_insert_par",
"ed_insert_code",
701 "ed_insert_dtable",
"ed_insert_atable",
"ed_insert_media",
"ed_insert_list",
702 "ed_insert_filelist",
"ed_paste_clip",
"ed_edit",
"ed_insert_section",
703 "ed_edit_prop",
"ed_edit_data",
"ed_delete",
"ed_moveafter",
"ed_movebefore",
704 "ed_go",
"ed_new_row_after",
"ed_new_row_before",
705 "ed_new_col_after",
"ed_new_col_before",
"ed_delete_col",
706 "ed_delete_row",
"ed_class",
"ed_width",
"ed_align_left",
707 "ed_align_right",
"ed_align_center",
"ed_align_left_float",
708 "ed_align_right_float",
"ed_delete_item",
"ed_new_item_before",
709 "ed_new_item_after",
"ed_copy_clip",
"please_select",
"ed_split_page",
710 "ed_item_up",
"ed_item_down",
"ed_row_up",
"ed_row_down",
711 "ed_col_left",
"ed_col_right",
"ed_split_page_next",
"ed_enable",
712 "de_activate",
"ed_insert_repobj",
"ed_insert_map",
"ed_insert_tabs");
714 foreach ($lang_vars as $lang_var)
728 $xml.=
"<LV name=\"$var\" value=\"".$lng->txt(
"cont_".$var).
"\"/>";
734 $path =
"//Paragraph[1]";
736 if (count(
$res->nodeset) > 0)
738 $cont_node =&
$res->nodeset[0]->parent_node();
740 $par->setNode($cont_node);
741 return $par->getText();
758 if (is_object(
$node))
760 $node->set_content($a_content);
775 $this->contains_int_link = $a_contains_link;
790 if ($a_parse ===
true)
792 $this->needs_parsing =
true;
794 if ($a_parse ===
false)
796 $this->needs_parsing =
false;
813 $r = $ilias->db->query(
"SELECT * FROM object_reference WHERE ref_id=".
814 $ilDB->quote(
$_GET[
"ref_id"]));
817 include_once(
"./classes/class.ilNestedSetXML.php");
819 $bibs_xml = $nested->export($row[
"obj_id"],
"bib");
834 $path =
"//MediaObject/MediaAlias";
837 for($i = 0; $i < count(
$res->nodeset); $i++)
839 $id_arr = explode(
"_",
$res->nodeset[$i]->get_attribute(
"OriginId"));
840 $mob_id = $id_arr[count($id_arr) - 1];
841 $mob_ids[$mob_id] = $mob_id;
846 $path =
"//IntLink[@Type = 'MediaObject']";
849 for($i = 0; $i < count(
$res->nodeset); $i++)
851 if ((
$res->nodeset[$i]->get_attribute(
"TargetFrame") ==
"") ||
854 $target =
$res->nodeset[$i]->get_attribute(
"Target");
855 $id_arr = explode(
"_", $target);
856 if (($id_arr[1] == IL_INST_ID) ||
857 (substr($target, 0, 4) ==
"il__"))
859 $mob_id = $id_arr[count($id_arr) - 1];
862 $mob_ids[$mob_id] = $mob_id;
883 for($i = 0; $i < count(
$res->nodeset); $i++)
885 $target =
$res->nodeset[$i]->get_attribute(
"Target");
886 $type =
$res->nodeset[$i]->get_attribute(
"Type");
887 $targetframe =
$res->nodeset[$i]->get_attribute(
"TargetFrame");
888 $links[$target.
":".$type.
":".$targetframe] =
889 array(
"Target" => $target,
"Type" => $type,
890 "TargetFrame" => $targetframe);
893 if ($type ==
"MediaObject" && $targetframe ==
"")
895 if (substr($target, 0, 4) ==
"il__")
897 $id_arr = explode(
"_", $target);
898 $id = $id_arr[count($id_arr) - 1];
901 foreach($med_links as $key => $med_link)
903 $links[$key] = $med_link;
914 $path =
"//MediaAlias";
917 require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
918 for($i = 0; $i < count(
$res->nodeset); $i++)
920 $oid =
$res->nodeset[$i]->get_attribute(
"OriginId");
921 if (substr($oid, 0, 4) ==
"il__")
923 $id_arr = explode(
"_", $oid);
924 $id = $id_arr[count($id_arr) - 1];
927 foreach($med_links as $key => $med_link)
929 $links[$key] = $med_link;
948 $path =
"//FileItem/Identifier";
955 $path =
"//FileItem/Identifier";
959 for($i = 0; $i < count(
$res->nodeset); $i++)
961 $id_arr = explode(
"_",
$res->nodeset[$i]->get_attribute(
"Entry"));
962 $file_id = $id_arr[count($id_arr) - 1];
963 $file_ids[$file_id] = $file_id;
979 require_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
980 foreach($mob_ids as $mob_id => $dummy)
997 $path =
"//MediaObject/MediaAlias[@OriginId='il__mob_$a_mob_id']";
999 $mal_node =&
$res->nodeset[$a_nr - 1];
1000 $mob_node =& $mal_node->parent_node();
1002 return $this->dom->dump_node($mob_node);
1013 $this->dom->validate($error);
1034 $this->hier_ids = array();
1035 $this->first_row_ids = array();
1036 $this->first_col_ids = array();
1037 $this->list_item_ids = array();
1038 $this->file_item_ids = array();
1045 foreach ($this->id_elements as $el)
1047 $path.= $sep.
"//".$el;
1052 for($i = 0; $i < count(
$res->nodeset); $i++)
1054 $cnode =
$res->nodeset[$i];
1055 $ctag = $cnode->node_name();
1059 while($cnode =& $cnode->previous_sibling())
1061 if (($cnode->node_type() == XML_ELEMENT_NODE)
1062 && $cnode->has_attribute(
"HierId"))
1064 $sib_hier_id = $cnode->get_attribute(
"HierId");
1070 if ($sib_hier_id !=
"")
1073 $res->nodeset[$i]->set_attribute(
"HierId", $node_hier_id);
1074 $this->hier_ids[] = $node_hier_id;
1075 if ($ctag ==
"TableData")
1077 if (substr($par_hier_id,strlen($par_hier_id)-2) ==
"_1")
1079 $this->first_row_ids[] = $node_hier_id;
1082 if ($ctag ==
"ListItem")
1084 $this->list_item_ids[] = $node_hier_id;
1086 if ($ctag ==
"FileItem")
1088 $this->file_item_ids[] = $node_hier_id;
1094 $cnode =
$res->nodeset[$i];
1096 while($cnode =& $cnode->parent_node())
1098 if (($cnode->node_type() == XML_ELEMENT_NODE)
1099 && $cnode->has_attribute(
"HierId"))
1101 $par_hier_id = $cnode->get_attribute(
"HierId");
1107 if (($par_hier_id !=
"") && ($par_hier_id !=
"pg"))
1109 $node_hier_id = $par_hier_id.
"_1";
1110 $res->nodeset[$i]->set_attribute(
"HierId", $node_hier_id);
1111 $this->hier_ids[] = $node_hier_id;
1112 if ($ctag ==
"TableData")
1114 $this->first_col_ids[] = $node_hier_id;
1115 if (substr($par_hier_id,strlen($par_hier_id)-2) ==
"_1")
1117 $this->first_row_ids[] = $node_hier_id;
1120 if ($ctag ==
"ListItem")
1122 $this->list_item_ids[] = $node_hier_id;
1124 if ($ctag ==
"FileItem")
1126 $this->file_item_ids[] = $node_hier_id;
1132 $node_hier_id =
"1";
1133 $res->nodeset[$i]->set_attribute(
"HierId", $node_hier_id);
1134 $this->hier_ids[] = $node_hier_id;
1141 $path =
"//PageObject";
1143 for($i = 0; $i < count(
$res->nodeset); $i++)
1145 $res->nodeset[$i]->set_attribute(
"HierId",
"pg");
1146 $this->hier_ids[] =
"pg";
1156 return $this->hier_ids;
1164 return $this->first_row_ids;
1172 return $this->first_col_ids;
1180 return $this->list_item_ids;
1188 return $this->file_item_ids;
1196 if(is_object($this->dom))
1199 $path =
"//*[@HierId]";
1201 for($i = 0; $i < count(
$res->nodeset); $i++)
1203 if (
$res->nodeset[$i]->has_attribute(
"HierId"))
1205 $res->nodeset[$i]->remove_attribute(
"HierId");
1218 $path =
"//FileItem";
1220 for($i = 0; $i < count(
$res->nodeset); $i++)
1222 $cnode =&
$res->nodeset[$i];
1223 $size_node =& $this->dom->create_element(
"Size");
1224 $size_node =& $cnode->append_child($size_node);
1226 $childs =& $cnode->child_nodes();
1228 for($j = 0; $j < count($childs); $j++)
1230 if ($childs[$j]->node_name() ==
"Identifier")
1232 if ($childs[$j]->has_attribute(
"Entry"))
1234 $entry = $childs[$j]->get_attribute(
"Entry");
1235 $entry_arr = explode(
"_", $entry);
1236 $id = $entry_arr[count($entry_arr) - 1];
1237 require_once(
"./Modules/File/classes/class.ilObjFile.php");
1242 $size_node->set_content(
$size);
1256 $path =
"//IntLink";
1258 for($i = 0; $i < count(
$res->nodeset); $i++)
1260 $target =
$res->nodeset[$i]->get_attribute(
"Target");
1261 $type =
$res->nodeset[$i]->get_attribute(
"Type");
1264 if ($new_target !==
false)
1266 $res->nodeset[$i]->set_attribute(
"Target", $new_target);
1271 IL_INST_ID > 0 && $type !=
"RepositoryItem")
1276 $res->nodeset[$i]->set_attribute(
"Target", $new_target);
1286 $path =
"//MediaAlias";
1290 for($i = 0; $i < count(
$res->nodeset); $i++)
1292 $orig_id =
$res->nodeset[$i]->get_attribute(
"OriginId");
1293 $id_arr = explode(
"_", $orig_id);
1294 $mob_id = $id_arr[count($id_arr) - 1];
1311 $path =
"//IntLink";
1313 for($i = 0; $i < count(
$res->nodeset); $i++)
1315 $target =
$res->nodeset[$i]->get_attribute(
"Target");
1316 $type =
$res->nodeset[$i]->get_attribute(
"Type");
1318 if ($a_from_to[$obj_id] > 0 && is_int(strpos($target,
"__")))
1322 $res->nodeset[$i]->set_attribute(
"Target",
"il__pg_".$a_from_to[$obj_id]);
1326 $res->nodeset[$i]->set_attribute(
"Target",
"il__st_".$a_from_to[$obj_id]);
1335 $path =
"//MediaAlias";
1338 require_once(
"Services/MediaObjects/classes/class.ilMediaItem.php");
1339 require_once(
"Services/COPage/classes/class.ilMediaAliasItem.php");
1341 for($i = 0; $i < count(
$res->nodeset); $i++)
1343 $media_object_node =
$res->nodeset[$i]->parent_node();
1344 $page_content_node = $media_object_node->parent_node();
1345 $c_hier_id = $page_content_node->get_attribute(
"HierId");
1349 $c_hier_id,
"Standard");
1350 $areas = $std_alias_item->getMapAreas();
1351 $correction_needed =
false;
1352 if (count($areas) > 0)
1355 foreach($areas as $area)
1357 if ($area[
"Type"] ==
"PageObject" ||
1358 $area[
"Type"] ==
"StructureObject")
1360 $t = $area[
"Target"];
1361 $tid = _extractObjIdOfTarget(
$t);
1362 if ($a_from_to[$tid] > 0)
1364 $correction_needed =
true;
1375 $oid =
$res->nodeset[$i]->get_attribute(
"OriginId");
1376 if (substr($oid, 0, 4) ==
"il__")
1378 $id_arr = explode(
"_", $oid);
1379 $id = $id_arr[count($id_arr) - 1];
1382 $med_item = $mob->getMediaItem(
"Standard");
1383 $med_areas = $med_item->getMapAreas();
1385 foreach($med_areas as $area)
1387 $link_type = ($area->getLinkType() ==
"int")
1392 "Nr" => $area->getNr(),
1393 "Shape" => $area->getShape(),
1394 "Coords" => $area->getCoords(),
1396 "LinkType" => $link_type,
1397 "Href" => $area->getHref(),
1398 "Title" => $area->getTitle(),
1399 "Target" => $area->getTarget(),
1400 "Type" => $area->getType(),
1401 "TargetFrame" => $area->getTargetFrame()
1405 if ($area->getType() ==
"PageObject" ||
1406 $area->getType() ==
"StructureObject")
1408 $t = $area->getTarget();
1410 if ($a_from_to[$tid] > 0)
1412 $correction_needed =
true;
1421 if ($correction_needed)
1423 $std_alias_item->deleteAllMapAreas();
1424 foreach($areas as $area)
1426 if ($area[
"Link"][
"LinkType"] ==
"IntLink")
1428 $target = $area[
"Link"][
"Target"];
1429 $type = $area[
"Link"][
"Type"];
1431 if ($a_from_to[$obj_id] > 0)
1435 $area[
"Link"][
"Target"] =
"il__pg_".$a_from_to[$obj_id];
1439 $area[
"Link"][
"Target"] =
"il__st_".$a_from_to[$obj_id];
1444 $std_alias_item->addMapArea($area[
"Shape"], $area[
"Coords"],
1445 $area[
"Link"][
"Title"],
1446 array(
"Type" => $area[
"Link"][
"Type"],
1447 "TargetFrame" => $area[
"Link"][
"TargetFrame"],
1448 "Target" => $area[
"Link"][
"Target"],
1449 "Href" => $area[
"Link"][
"Href"],
1450 "LinkType" => $area[
"Link"][
"LinkType"],
1466 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
1473 foreach($sources as $source)
1476 if ($source[
"type"] ==
"lm:pg")
1479 $page_obj =
new ilPageObject(
"lm", $source[
"id"],
false);
1480 if (!$page_obj->page_not_found)
1483 $page_obj->handleImportRepositoryLink($a_rep_import_id,
1484 $a_rep_type, $a_rep_ref_id);
1486 $page_obj->update();
1497 $path =
"//IntLink";
1500 for($i = 0; $i < count(
$res->nodeset); $i++)
1503 $target =
$res->nodeset[$i]->get_attribute(
"Target");
1504 $type =
$res->nodeset[$i]->get_attribute(
"Type");
1505 if ($target == $a_rep_import_id && $type ==
"RepositoryItem")
1508 $res->nodeset[$i]->set_attribute(
"Target",
1509 "il__".$a_rep_type.
"_".$a_rep_ref_id);
1520 global
$lng, $ilDB, $ilUser;
1529 $query =
"INSERT INTO page_object (page_id, parent_id, content, parent_type, create_user, last_change_user, created, last_change) VALUES ".
1530 "(".$ilDB->quote($this->
getId()).
",".
1534 ", ".$ilDB->quote($ilUser->getId()).
1535 ", ".$ilDB->quote($ilUser->getId()).
1538 if(!$this->ilias->db->checkQuerySize($query))
1540 $this->ilias->raiseError($lng->txt(
"check_max_allowed_packet_size"),$this->ilias->error_obj->MESSAGE);
1544 $this->ilias->db->query($query);
1562 global
$lng, $ilDB, $ilUser;
1568 $query =
"UPDATE page_object ".
1570 ", parent_id = ".$ilDB->quote($this->
getParentId()).
" ".
1571 ", last_change_user = ".$ilDB->quote($ilUser->getId()).
" ".
1572 ", last_change = now() ".
1573 "WHERE page_id = ".$ilDB->quote($this->getId()).
" AND parent_type=".
1574 $ilDB->quote($this->getParentType());
1576 if(!$this->ilias->db->checkQuerySize($query))
1578 $this->ilias->raiseError($lng->txt(
"check_max_allowed_packet_size"),$this->ilias->error_obj->MESSAGE);
1581 $this->ilias->db->query($query);
1589 function update($a_validate =
true, $a_no_history =
false)
1616 $old_set = $ilDB->query(
"SELECT * FROM page_object WHERE ".
1617 "page_id = ".$ilDB->quote($this->getId()).
" AND ".
1618 "parent_type = ".$ilDB->quote($this->getParentType()));
1619 $last_nr_set = $ilDB->query(
"SELECT max(nr) as mnr FROM page_history WHERE ".
1620 "page_id = ".$ilDB->quote($this->getId()).
" AND ".
1621 "parent_type = ".$ilDB->quote($this->getParentType()));
1626 if (($content != $old_rec[
"content"]) && !$a_no_history &&
1629 if ($old_rec[
"content"] !=
"<PageObject></PageObject>")
1631 $h_query =
"REPLACE INTO page_history ".
1632 "(page_id, parent_type, hdate, parent_id, content, user, ilias_version, nr) VALUES (".
1633 $ilDB->quote($old_rec[
"page_id"]).
",".
1634 $ilDB->quote($old_rec[
"parent_type"]).
",".
1635 $ilDB->quote($old_rec[
"last_change"]).
",".
1636 $ilDB->quote($old_rec[
"parent_id"]).
",".
1637 $ilDB->quote($old_rec[
"content"]).
",".
1638 $ilDB->quote($old_rec[
"last_change_user"]).
",".
1640 $ilDB->quote($last_nr[
"mnr"] + 1).
")";
1642 $ilDB->query($h_query);
1643 $this->
saveMobUsage($old_rec[
"content"], $last_nr[
"mnr"] + 1);
1644 $this->
saveFileUsage($old_rec[
"content"], $last_nr[
"mnr"] + 1);
1645 $this->history_saved =
true;
1649 $this->history_saved =
true;
1654 $query =
"UPDATE page_object ".
1655 "SET content = ".$ilDB->quote($content).
" ".
1656 ", parent_id= ".$ilDB->quote($this->
getParentId()).
" ".
1657 ", last_change_user= ".$ilDB->quote($ilUser->getId()).
" ".
1658 ", last_change = now() ".
1659 " WHERE page_id = ".$ilDB->quote($this->getId()).
1660 " AND parent_type= ".$ilDB->quote($this->getParentType());
1661 if(!$this->ilias->db->checkQuerySize($query))
1663 $this->ilias->raiseError($lng->txt(
"check_max_allowed_packet_size"),$this->ilias->error_obj->MESSAGE);
1667 $this->ilias->db->query($query);
1670 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1674 foreach($mob_ids as $mob)
1679 $usages = $mob_obj->getUsages();
1680 if (count($usages) == 0)
1688 include_once(
"./Modules/File/classes/class.ilObjFile.php");
1692 foreach($file_ids as
$file)
1696 $file_obj =
new ilObjFile($file,
false);
1697 $usages = $file_obj->getUsages();
1698 if (count($usages) == 0)
1700 $file_obj->delete();
1728 if (!$this->page_not_found)
1742 include_once(
"./Modules/File/classes/class.ilObjFile.php");
1746 $query =
"DELETE FROM page_object ".
1747 "WHERE page_id = ".$ilDB->quote($this->
getId()).
1749 $this->ilias->db->query($query);
1752 foreach (
$mobs as $mob_id)
1756 $GLOBALS[
'ilLog']->write(__METHOD__.
': Type mismatch. Ignoring mob with id: '.$mob_id);
1767 include_once(
"./Modules/File/classes/class.ilObjFile.php");
1768 foreach (
$files as $file_id)
1772 $file_obj =&
new ilObjFile($file_id,
false);
1773 $file_obj->delete();
1791 $path =
"//MediaAlias";
1794 for ($i=0; $i < count(
$res->nodeset); $i++)
1796 $id_arr = explode(
"_",
$res->nodeset[$i]->get_attribute(
"OriginId"));
1797 $mob_id = $id_arr[count($id_arr) - 1];
1800 $usages[$mob_id] =
true;
1806 $path =
"//MediaObject/MetaData/General/Identifier";
1808 for ($i=0; $i < count(
$res->nodeset); $i++)
1810 $mob_entry =
$res->nodeset[$i]->get_attribute(
"Entry");
1811 $mob_arr = explode(
"_", $mob_entry);
1812 $mob_id = $mob_arr[count($mob_arr) - 1];
1815 $usages[$mob_id] =
true;
1821 $path =
"//IntLink[@Type='MediaObject']";
1823 for ($i=0; $i < count(
$res->nodeset); $i++)
1825 $mob_target =
$res->nodeset[$i]->get_attribute(
"Target");
1826 $mob_arr = explode(
"_", $mob_target);
1827 $mob_id = $mob_arr[count($mob_arr) - 1];
1830 $usages[$mob_id] =
true;
1834 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1836 foreach($usages as $mob_id => $val)
1848 include_once(
"./Modules/File/classes/class.ilObjFile.php");
1850 foreach($file_ids as $file_id)
1862 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
1863 include_once(
"./Modules/File/classes/class.ilObjFile.php");
1883 include_once(
"./Services/COPage/classes/class.ilInternalLink.php");
1888 $path =
"//IntLink";
1890 for ($i=0; $i < count(
$res->nodeset); $i++)
1892 $link_type =
$res->nodeset[$i]->get_attribute(
"Type");
1896 case "StructureObject":
1904 case "GlossaryItem":
1912 case "RepositoryItem":
1917 $target =
$res->nodeset[$i]->get_attribute(
"Target");
1922 if (is_int(strpos($target,
"__")))
1959 $curr_node->unlink_node($curr_node);
1975 if (!is_array($a_hids))
1979 foreach($a_hids as $a_hid)
1981 $a_hid = explode(
":", $a_hid);
1984 if (is_object($curr_node))
1986 $parent_node = $curr_node->parent_node();
1987 if ($parent_node->node_name() !=
"TableRow")
1989 $curr_node->unlink_node($curr_node);
2005 if (!is_array($a_hids))
2009 $obj = & $this->content_obj;
2011 foreach($a_hids as $a_hid)
2013 $a_hid = explode(
":", $a_hid);
2016 if (is_object($curr_node))
2018 if ($curr_node->node_name() ==
"PageContent")
2021 if ($cont_obj->isEnabled ())
2022 $cont_obj->disable ();
2024 $cont_obj->enable ();
2048 foreach ($hier_ids as $hier_id)
2051 if (!is_int(strpos($hier_id,
"_")))
2053 if ($hier_id !=
"pg" && $hier_id >= $a_hid)
2056 $curr_node->unlink_node($curr_node);
2078 foreach ($hier_ids as $hier_id)
2081 if (!is_int(strpos($hier_id,
"_")))
2083 if ($hier_id !=
"pg" && $hier_id < $a_hid)
2086 $curr_node->unlink_node($curr_node);
2106 $hier_ids = $a_source_page->getHierIds();
2108 $copy_ids = array();
2111 foreach ($hier_ids as $hier_id)
2114 if (!is_int(strpos($hier_id,
"_")))
2116 if ($hier_id !=
"pg" && $hier_id >= $a_hid)
2118 $copy_ids[] = $hier_id;
2124 $parent_node =& $a_target_page->getContentNode(
"pg");
2125 $target_dom =& $a_target_page->getDom();
2126 $parent_childs =& $parent_node->child_nodes();
2127 $cnt_parent_childs = count($parent_childs);
2129 $first_child =& $parent_childs[0];
2130 foreach($copy_ids as $copy_id)
2132 $source_node =& $a_source_page->getContentNode($copy_id);
2134 $new_node =& $source_node->clone_node(
true);
2135 $new_node->unlink_node($new_node);
2137 $source_node->unlink_node($source_node);
2139 if($cnt_parent_childs == 0)
2141 $new_node =& $parent_node->append_child($new_node);
2146 $new_node =& $first_child->insert_before($new_node, $first_child);
2148 $parent_childs =& $parent_node->child_nodes();
2153 $a_target_page->update();
2154 $a_source_page->update();
2165 $curr_name = $curr_node->node_name();
2166 if (($curr_name ==
"TableData") || ($curr_name ==
"PageObject") ||
2167 ($curr_name ==
"ListItem") || ($curr_name ==
"Section")
2168 || ($curr_name ==
"Tab"))
2173 $hid = $curr_node->get_attribute(
"HierId");
2182 $pos = explode(
"_", $a_pos);
2183 $target_pos = array_pop($pos);
2184 $parent_pos = implode($pos,
"_");
2188 $parent_pos = $a_pos;
2192 if($parent_pos !=
"")
2198 $parent_node =& $this->
getNode();
2202 $parent_childs =& $parent_node->child_nodes();
2203 $cnt_parent_childs = count($parent_childs);
2209 $new_node =& $a_cont_obj->getNode();
2213 if($succ_node =& $curr_node->next_sibling())
2215 $new_node =& $succ_node->insert_before($new_node, $succ_node);
2220 $new_node =& $parent_node->append_child($new_node);
2222 $a_cont_obj->setNode($new_node);
2227 $new_node =& $a_cont_obj->getNode();
2229 $new_node =& $succ_node->insert_before($new_node, $succ_node);
2230 $a_cont_obj->setNode($new_node);
2236 $new_node =& $a_cont_obj->getNode();
2237 if($cnt_parent_childs == 0)
2239 $new_node =& $parent_node->append_child($new_node);
2243 $new_node =& $parent_childs[0]->insert_before($new_node, $parent_childs[0]);
2245 $a_cont_obj->setNode($new_node);
2259 if($a_source == $a_target)
2266 $source_node =& $content->getNode();
2267 $clone_node =& $source_node->clone_node(
true);
2273 $content->setNode($clone_node);
2285 if($a_source == $a_target)
2292 $source_node =& $content->getNode();
2293 $clone_node =& $source_node->clone_node(
true);
2299 $content->setNode($clone_node);
2309 $a_content = eregi_replace(
"\[com\]",
"<Comment>",$a_content);
2310 $a_content = eregi_replace(
"\[\/com\]",
"</Comment>",$a_content);
2311 $a_content = eregi_replace(
"\[emp]",
"<Emph>",$a_content);
2312 $a_content = eregi_replace(
"\[\/emp\]",
"</Emph>",$a_content);
2313 $a_content = eregi_replace(
"\[str]",
"<Strong>",$a_content);
2314 $a_content = eregi_replace(
"\[\/str\]",
"</Strong>",$a_content);
2325 $path =
"//IntLink";
2327 for($i = 0; $i < count(
$res->nodeset); $i++)
2329 $target =
$res->nodeset[$i]->get_attribute(
"Target");
2330 $type =
$res->nodeset[$i]->get_attribute(
"Type");
2332 if (substr($target, 0, 4) ==
"il__")
2334 $id = substr($target, 4, strlen($target) - 4);
2337 if ($a_res_ref_to_obj_id && $type ==
"RepositoryItem")
2339 $id_arr = explode(
"_",
$id);
2344 $id = $otype.
"_".$obj_id;
2347 $new_target =
"il_".$a_inst.
"_".
$id;
2348 $res->nodeset[$i]->set_attribute(
"Target", $new_target);
2355 $path =
"//MediaAlias";
2357 for($i = 0; $i < count(
$res->nodeset); $i++)
2359 $origin_id =
$res->nodeset[$i]->get_attribute(
"OriginId");
2360 if (substr($origin_id, 0, 4) ==
"il__")
2362 $new_id =
"il_".$a_inst.
"_".substr($origin_id, 4, strlen($origin_id) - 4);
2363 $res->nodeset[$i]->set_attribute(
"OriginId", $new_id);
2370 $path =
"//FileItem/Identifier";
2372 for($i = 0; $i < count(
$res->nodeset); $i++)
2374 $origin_id =
$res->nodeset[$i]->get_attribute(
"Entry");
2375 if (substr($origin_id, 0, 4) ==
"il__")
2377 $new_id =
"il_".$a_inst.
"_".substr($origin_id, 4, strlen($origin_id) - 4);
2378 $res->nodeset[$i]->set_attribute(
"Entry", $new_id);
2385 $path =
"//Question";
2387 for($i = 0; $i < count(
$res->nodeset); $i++)
2389 $qref =
$res->nodeset[$i]->get_attribute(
"QRef");
2391 if (substr($qref, 0, 4) ==
"il__")
2393 $new_id =
"il_".$a_inst.
"_".substr($qref, 4, strlen($qref) - 4);
2395 $res->nodeset[$i]->set_attribute(
"QRef", $new_id);
2413 require_once(
"./Services/COPage/syntax_highlight/php/HFile/HFile_".$proglang.
".php");
2414 $classname =
"HFile_$proglang";
2415 $h_instance =
new $classname();
2416 if ($autoindent ==
"n") {
2417 $h_instance ->notrim = 1;
2418 $h_instance ->indent = array (
"");
2419 $h_instance ->unindent = array (
"");
2423 $a_text = $highlighter->highlight_text(html_entity_decode($a_text));
2429 return file_exists (
"Services/COPage/syntax_highlight/php/HFile/HFile_".$hfile_ext.
".php");
2440 $path =
"//Paragraph";
2442 for($i = 0; $i < count(
$res->nodeset); $i++)
2444 $context_node =
$res->nodeset[$i];
2445 $char = $context_node->get_attribute(
'Characteristic');
2447 if ($char !=
"Code")
2450 $n = $context_node->parent_node();
2451 $char = $context_node->get_attribute(
'Characteristic');
2452 $subchar = $context_node->get_attribute(
'SubCharacteristic');
2453 $showlinenumbers = $context_node->get_attribute(
'ShowLineNumbers');
2454 $downloadtitle = $context_node->get_attribute(
'DownloadTitle');
2455 $autoindent = $context_node->get_attribute(
'AutoIndent');
2460 $childs = $context_node->child_nodes();
2462 for($j=0; $j<count($childs); $j++)
2464 $content .= $this->dom->dump_node($childs[$j]);
2467 while ($context_node->has_child_nodes ())
2469 $node_del = $context_node->first_child ();
2470 $context_node->remove_child ($node_del);
2473 $content = str_replace(
"<br />",
"<br/>", utf8_decode($content) );
2474 $content = str_replace(
"<br/>",
"\n", $content);
2475 $rownums = count(split (
"\n",$content));
2477 $plain_content = html_entity_decode($content);
2478 $plain_content = preg_replace (
"/\&#x([1-9a-f]{2});?/ise",
"chr (base_convert (\\1, 16, 10))",$plain_content);
2479 $plain_content = preg_replace (
"/\&#(\d+);?/ise",
"chr (\\1)",$plain_content);
2480 $content = utf8_encode($this->
highlightText($plain_content, $subchar, $autoindent));
2482 $content = str_replace(
"&lt;",
"<", $content);
2483 $content = str_replace(
"&gt;",
">", $content);
2486 $rows =
"<TR valign=\"top\">";
2491 if (strcmp($showlinenumbers,
"y")==0)
2493 $linenumbers =
"<TD nowrap=\"nowrap\" class=\"ilc_LineNumbers\" >";
2494 $linenumbers .=
"<PRE class=\"ilc_Code\">";
2496 for ($j=0; $j < $rownums; $j++)
2498 $indentno = strlen($rownums) - strlen($j+1) + 2;
2499 $rownumeration = ($j+1);
2500 $linenumbers .=
"<span class=\"ilc_LineNumber\">$rownumeration</span>";
2501 if ($j < $rownums-1)
2503 $linenumbers .=
"\n";
2506 $linenumbers .=
"</PRE>";
2507 $linenumbers .=
"</TD>";
2510 $rows .= $linenumbers.
"<TD class=\"ilc_Sourcecode\"><PRE class=\"ilc_Code\">".$content.
"</PRE></TD>";
2515 $newcontent = str_replace(
"\n",
"<br/>",$rows);
2517 $newcontent = str_replace(
"<br/><br/>",
"<br/> <br/>",$newcontent);
2519 $newcontent = str_replace(
"<br/><br/>",
"<br/> <br/>",$newcontent);
2523 $a_output = str_replace(
"[[[[[Code;".($i + 1).
"]]]]]", $newcontent, $a_output);
2525 if ($outputmode !=
"presentation" && is_object($this->offline_handler)
2526 && trim($downloadtitle) !=
"")
2529 $this->offline_handler->handleCodeParagraph ($this->
id, $i + 1, $downloadtitle, $plain_content);
2546 foreach ($this->id_elements as $el)
2548 $path.= $sep.
"//".$el.
"[not(@PCID)]";
2555 if (count (
$res->nodeset) > 0)
2573 foreach ($this->id_elements as $el)
2575 $path.= $sep.
"//".$el.
"[@PCID]";
2583 for ($i = 0; $i < count (
$res->nodeset); $i++)
2586 $pcids[] =
$node->get_attribute(
"PCID");
2591 foreach ($this->id_elements as $el)
2593 $path.= $sep.
"//".$el.
"[not(@PCID)]";
2599 for ($i = 0; $i < count (
$res->nodeset); $i++)
2602 $id = ilUtil::randomHash(10, $pcids);
2605 $res->nodeset[$i]->set_attribute(
"PCID",
$id);
2615 $this->addHierIds();
2619 $path =
"//PageContent";
2624 for ($i = 0; $i < count (
$res->nodeset); $i++)
2626 $hier_id =
$res->nodeset[$i]->get_attribute(
"HierId");
2627 $pc_id =
$res->nodeset[$i]->get_attribute(
"PCID");
2628 $dump = $mydom->dump_node(
$res->nodeset[$i]);
2629 if (($hpos = strpos($dump,
' HierId="'.$hier_id.
'"')) > 0)
2631 $dump = substr($dump, 0, $hpos).
2632 substr($dump, $hpos + strlen(
' HierId="'.$hier_id.
'"'));
2635 $childs =
$res->nodeset[$i]->child_nodes();
2637 if ($childs[0] && $childs[0]->node_name() ==
"Paragraph")
2639 $content = $mydom->dump_node($childs[0]);
2640 $content = substr($content, strpos($content,
">") + 1,
2641 strrpos($content,
"<") - (strpos($content,
">") + 1));
2649 array(
"hier_id" => $hier_id,
"hash" => md5($dump),
"content" => $content);
2665 $path =
"/descendant::Paragraph[position() = $par_id]";
2669 if (count (
$res->nodeset) != 1)
2670 die (
"Should not happen");
2672 $context_node =
$res->nodeset[0];
2676 $childs = $context_node->child_nodes();
2678 for($j=0; $j<count($childs); $j++)
2680 $content .= $mydom->dump_node($childs[$j]);
2683 $content = str_replace(
"<br />",
"\n", $content);
2684 $content = str_replace(
"<br/>",
"\n", $content);
2686 $plain_content = html_entity_decode($content);
2703 $xsl = file_get_contents(
"./Services/COPage/xsl/page_fo.xsl");
2704 $args = array(
'/_xml' =>
$xml,
'/_xsl' => $xsl );
2710 $fo =
xslt_process($xh,
"arg:/_xml",
"arg:/_xsl",NULL,$args, $params);
2713 $fo = str_replace(
"\n",
"", $fo);
2714 $fo = str_replace(
"<br/>",
"<br>", $fo);
2715 $fo = str_replace(
"<br>",
"\n", $fo);
2720 $fo = substr($fo, strpos($fo,
">") + 1);
2726 $this->offline_handler = $handler;
2736 $query =
"SELECT * FROM page_object WHERE page_id = ".
2737 $ilDB->quote($a_id).
" AND ".
2738 " parent_type = ".$ilDB->quote($a_parent_type).
" AND ".
2739 " content LIKE '% Enabled=\"False\"%'";
2740 $obj_set = $ilDB->query($query);
2757 $h_query =
"SELECT * FROM page_history ".
2758 " WHERE page_id = ".$ilDB->quote($this->
getId()).
2760 " ORDER BY hdate DESC";
2762 $hset = $ilDB->query($h_query);
2763 $hentries = array();
2767 $hrec[
"sortkey"] = $hrec[
"nr"];
2768 $hentries[] = $hrec;
2781 $st = $ilDB->prepare(
"SELECT * FROM page_history ".
2782 " WHERE page_id = ? ".
2783 " AND parent_type = ? ".
2784 " AND nr = ?", array(
"integer",
"text",
"integer"));
2785 $res = $ilDB->execute($st,
2787 if ($hrec = $ilDB->fetchAssoc(
$res))
2807 $st = $ilDB->prepare(
"SELECT MAX(nr) mnr FROM page_history ".
2808 " WHERE page_id = ".$ilDB->quote($this->getId()).
2809 " AND parent_type = ".$ilDB->quote($this->getParentType()).
2810 " AND nr < ?", array(
"integer"));
2811 $res = $ilDB->execute($st, array($a_nr));
2812 $row = $ilDB->fetchAssoc(
$res);
2813 if ($row[
"mnr"] > 0)
2815 $st = $ilDB->prepare(
"SELECT * FROM page_history ".
2816 " WHERE page_id = ".$ilDB->quote($this->getId()).
2817 " AND parent_type = ".$ilDB->quote($this->getParentType()).
2818 " AND nr = ?", array(
"integer"));
2819 $res = $ilDB->execute($st, array($row[
"mnr"]));
2820 $row = $ilDB->fetchAssoc(
$res);
2821 $ret[
"previous"] = $row;
2825 $st = $ilDB->prepare(
"SELECT MIN(nr) mnr FROM page_history ".
2826 " WHERE page_id = ".$ilDB->quote($this->getId()).
2827 " AND parent_type = ".$ilDB->quote($this->getParentType()).
2828 " AND nr > ?", array(
"integer"));
2829 $res = $ilDB->execute($st, array($a_nr));
2830 $row = $ilDB->fetchAssoc(
$res);
2831 if ($row[
"mnr"] > 0)
2833 $st = $ilDB->prepare(
"SELECT * FROM page_history ".
2834 " WHERE page_id = ".$ilDB->quote($this->getId()).
2835 " AND parent_type = ".$ilDB->quote($this->getParentType()).
2836 " AND nr = ?", array(
"integer"));
2837 $res = $ilDB->execute($st, array($row[
"mnr"]));
2838 $row = $ilDB->fetchAssoc(
$res);
2839 $ret[
"next"] = $row;
2843 $st = $ilDB->prepare(
"SELECT * FROM page_history ".
2844 " WHERE page_id = ".$ilDB->quote($this->getId()).
2845 " AND parent_type = ".$ilDB->quote($this->getParentType()).
2846 " AND nr = ?", array(
"integer"));
2847 $res = $ilDB->execute($st, array($a_nr));
2848 $row = $ilDB->fetchAssoc(
$res);
2849 $ret[
"current"] = $row;
2888 $rnode =
$res->nodeset[0];
2891 foreach($a_hashes as $pc_id => $h)
2894 if ($h[
"change"] !=
"")
2897 $dc_node = $this->dom->create_element(
"DivClass");
2898 $dc_node->set_attribute(
"HierId", $h[
"hier_id"]);
2899 $dc_node->set_attribute(
"Class",
"ilEdit".$h[
"change"]);
2900 $dc_node = $rnode->append_child($dc_node);
2919 $l_hashes = $l_page->getPageContentsHashes();
2920 $r_hashes = $r_page->getPageContentsHashes();
2923 foreach ($l_hashes as $pc_id => $h)
2925 if (!isset($r_hashes[$pc_id]))
2927 $l_hashes[$pc_id][
"change"] =
"Deleted";
2931 if ($l_hashes[$pc_id][
"hash"] != $r_hashes[$pc_id][
"hash"])
2933 $l_hashes[$pc_id][
"change"] =
"Modified";
2934 $r_hashes[$pc_id][
"change"] =
"Modified";
2936 include_once(
"./Services/COPage/mediawikidiff/class.WordLevelDiff.php");
2938 if ($l_hashes[$pc_id][
"content"] !=
"" &&
2939 $r_hashes[$pc_id][
"content"] !=
"")
2941 $new_left = str_replace(
"\n",
"<br />", $l_hashes[$pc_id][
"content"]);
2942 $new_right = str_replace(
"\n",
"<br />", $r_hashes[$pc_id][
"content"]);
2945 $new_left = $wldiff->orig();
2946 $new_right = $wldiff->closing();
2947 $l_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_left[0]);
2948 $r_page->setParagraphContent($l_hashes[$pc_id][
"hier_id"], $new_right[0]);
2955 foreach ($r_hashes as $pc_id => $h)
2957 if (!isset($l_hashes[$pc_id]))
2959 $r_hashes[$pc_id][
"change"] =
"New";
2963 $l_page->addChangeDivClasses($l_hashes);
2964 $r_page->addChangeDivClasses($r_hashes);
2966 return array(
"l_page" => $l_page,
"r_page" => $r_page,
2967 "l_changes" => $l_hashes,
"r_changes" => $r_hashes);
2977 $q =
"UPDATE page_object ".
2978 " SET view_cnt = view_cnt + 1 ".
2979 " WHERE page_id = ".$ilDB->quote($this->
getId()).
2995 $page_changes = array();
2996 $q =
"SELECT * FROM page_object ".
2997 " WHERE parent_id = ".$ilDB->quote($a_parent_id).
2998 " AND parent_type = ".$ilDB->quote($a_parent_type).
2999 " AND (TO_DAYS(now()) - TO_DAYS(last_change)) <= ".((int)$a_period);
3000 $set = $ilDB->query($q);
3003 $page_changes[] = array(
"date" => $page[
"last_change"],
3004 "id" => $page[
"page_id"],
"type" =>
"page",
3005 "user" => $page[
"last_change_user"]);
3008 $q =
"SELECT * FROM page_history ".
3009 " WHERE parent_id = ".$ilDB->quote($a_parent_id).
3010 " AND parent_type = ".$ilDB->quote($a_parent_type).
3011 " AND (TO_DAYS(now()) - TO_DAYS(hdate)) <= ".((int)$a_period);
3012 $set = $ilDB->query($q);
3015 $page_changes[] = array(
"date" => $page[
"hdate"],
3016 "id" => $page[
"page_id"],
"type" =>
"hist",
"nr" => $page[
"nr"],
3017 "user" => $page[
"user"]);
3022 return $page_changes;
3036 $page_changes = array();
3038 $q =
"SELECT * FROM page_object ".
3039 " WHERE parent_id = ".$ilDB->quote($a_parent_id).
3040 " AND parent_type = ".$ilDB->quote($a_parent_type);
3041 $set = $ilDB->query($q);
3045 $pages[$page[
"page_id"]] = array(
"date" => $page[
"last_change"],
3046 "id" => $page[
"page_id"],
"user" => $page[
"last_change_user"]);
3064 $q =
"SELECT * FROM page_object ".
3065 " WHERE parent_id = ".$ilDB->quote($a_parent_id).
3066 " AND parent_type = ".$ilDB->quote($a_parent_type).
3067 " ORDER BY created DESC";
3068 $set = $ilDB->query($q);
3071 if ($page[
"created"] !=
"0000-00-00 00:00:00")
3073 $pages[] = array(
"created" => $page[
"created"],
3074 "id" => $page[
"page_id"],
3075 "user" => $page[
"create_user"],
3093 $contributors = array();
3094 $st = $ilDB->prepare(
"SELECT last_change_user FROM page_object ".
3095 " WHERE parent_id = ? AND parent_type = ? ".
3096 " AND last_change_user != ?",
3097 array(
"integer",
"text",
"integer"));
3098 $set = $ilDB->execute($st, array($a_parent_id, $a_parent_type, 0));
3100 while ($page = $ilDB->fetchAssoc($set))
3102 $contributors[$page[
"last_change_user"]][$page[
"page_id"]] = 1;
3105 $st = $ilDB->prepare(
"SELECT count(*) as cnt, page_id, user FROM page_history ".
3106 " WHERE parent_id = ? AND parent_type = ? AND user != ? ".
3107 " GROUP BY page_id, user ",
3108 array(
"integer",
"text",
"integer"));
3109 $set = $ilDB->execute($st, array($a_parent_id, $a_parent_type, 0));
3110 while ($hpage = $ilDB->fetchAssoc($set))
3112 $contributors[$hpage[
"user"]][$hpage[
"page_id"]] =
3113 $contributors[$hpage[
"user"]][$hpage[
"page_id"]] + $hpage[
"cnt"];
3117 foreach ($contributors as $k => $co)
3120 $c[] = array(
"user_id" => $k,
"pages" => $co,
3121 "lastname" => $name[
"lastname"],
"firstname" => $name[
"firstname"]);
3137 $contributors = array();
3138 $st = $ilDB->prepare(
"SELECT last_change_user FROM page_object ".
3139 " WHERE page_id = ? AND parent_type = ? ".
3140 " AND last_change_user != ?",
3141 array(
"integer",
"text",
"integer"));
3142 $set = $ilDB->execute($st, array($a_page_id, $a_parent_type, 0));
3144 while ($page = $ilDB->fetchAssoc($set))
3146 $contributors[$page[
"last_change_user"]] = 1;
3149 $st = $ilDB->prepare(
"SELECT count(*) as cnt, page_id, user FROM page_history ".
3150 " WHERE page_id = ? AND parent_type = ? AND user != ? ".
3152 array(
"integer",
"text",
"integer"));
3153 $set = $ilDB->execute($st, array($a_page_id, $a_parent_type, 0));
3154 while ($hpage = $ilDB->fetchAssoc($set))
3156 $contributors[$hpage[
"user"]] =
3157 $contributors[$hpage[
"user"]] + $hpage[
"cnt"];
3161 foreach ($contributors as $k => $co)
3164 $c[] = array(
"user_id" => $k,
"pages" => $co,
3165 "lastname" => $name[
"lastname"],
"firstname" => $name[
"firstname"]);
3178 $st = $ilDB->prepareManip(
"UPDATE page_object ".
3179 " SET rendered_content = ?, render_md5 = ?, rendered_time = now()".
3180 " WHERE page_id = ? AND parent_type = ?",
3181 array(
"text",
"text",
"integer",
"text"));
3182 $r = $ilDB->execute($st,
3197 $page_changes = array();
3199 $q =
"SELECT * FROM page_object ".
3200 " WHERE parent_id = ".$ilDB->quote($a_parent_id).
3201 " AND parent_type = ".$ilDB->quote($a_parent_type).
3202 " AND content LIKE '%IntLink%'";
3203 $set = $ilDB->query($q);
3207 $pages[$page[
"page_id"]] = array(
"date" => $page[
"last_change"],
3208 "id" => $page[
"page_id"],
"user" => $page[
"last_change_user"]);