24 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
25 require_once(
"./Services/COPage/classes/class.ilPageObject.php");
27 define (
"IL_CHAPTER_TITLE",
"st_title");
28 define (
"IL_PAGE_TITLE",
"pg_title");
29 define (
"IL_NO_HEADER",
"none");
65 $ilBench->start(
"ContentPresentation",
"ilLMPageObject_Constructor");
72 $this->is_alias =
false;
73 $this->contains_int_link =
false;
74 $this->mobs_contained = array();
75 $this->files_contained = array();
76 $this->halt_on_error = $a_halt;
83 $ilBench->stop(
"ContentPresentation",
"ilLMPageObject_Constructor");
88 if(is_object($this->page_object))
90 unset($this->page_object);
101 $ilBench->start(
"ContentPresentation",
"ilLMPageObject_read");
104 $this->page_object =&
new ilPageObject($this->content_object->getType(),
107 $ilBench->stop(
"ContentPresentation",
"ilLMPageObject_read");
113 if(!is_object($this->page_object))
115 $this->page_object =&
new ilPageObject($this->content_object->getType());
118 $this->page_object->setParentId($this->
getLMId());
119 $this->page_object->create($a_upload);
122 function delete($a_delete_meta_data =
true)
125 $this->page_object->delete();
136 $lm_page->setTitle($this->
getTitle());
137 $lm_page->setLMId($a_target_lm->getId());
138 $lm_page->setType($this->
getType());
140 $lm_page->setImportId(
"il__pg_".$this->
getId());
141 $lm_page->create(
true);
144 include_once(
"Services/MetaData/classes/class.ilMD.php");
146 $new_md = $md->cloneMD($a_target_lm->getId(), $lm_page->getId(), $this->
getType());
149 $page = $lm_page->getPageObject();
150 $page->setXMLContent($this->page_object->getXMLContent());
164 $lm_page->setTitle($this->
getTitle());
165 $lm_page->setLMId($a_cont_obj->getId());
166 $lm_page->setImportId(
"il__pg_".$this->
getId());
167 $lm_page->setType($this->
getType());
169 $lm_page->create(
true);
170 $a_copied_nodes[$this->
getId()] = $lm_page->getId();
173 include_once(
"Services/MetaData/classes/class.ilMD.php");
175 $new_md =& $md->cloneMD($a_cont_obj->getId(), $lm_page->getId(), $this->
getType());
178 $page =& $lm_page->getPageObject();
179 $page->setXMLContent($this->page_object->getXMLContent());
193 function _splitPage($a_page_id, $a_pg_parent_type, $a_hier_id)
201 include_once (
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
206 include_once (
"./Modules/LearningModule/classes/class.ilObjDlBook.php");
215 $lm_page->setTitle($source_lm_page->getTitle());
216 $lm_page->setLMId($source_lm_page->getLMId());
217 $lm_page->setType($source_lm_page->getType());
218 $lm_page->setDescription($source_lm_page->getDescription());
219 $lm_page->create(
true);
222 include_once(
"Services/MetaData/classes/class.ilMD.php");
223 $md =
new ilMD($source_lm_page->getLMId(), $a_page_id, $source_lm_page->getType());
224 $new_md =& $md->
cloneMD($source_lm_page->getLMId(), $lm_page->getId(), $source_lm_page->getType());
227 $source_page =& $source_lm_page->getPageObject();
228 $page =& $lm_page->getPageObject();
229 $page->setXMLContent($source_page->getXMLContent());
233 $tree =
new ilTree($cont_obj->getId());
235 $tree->setTreeTablePK(
"lm_id");
236 if ($tree->isInTree($source_lm_page->getId()))
238 $parent_node = $tree->getParentNodeData($source_lm_page->getId());
239 $tree->insertNode($lm_page->getId(), $parent_node[
"child"], $source_lm_page->getId());
244 $page->deleteContentBeforeHierId($a_hier_id);
247 $source_page->buildDom();
248 $source_page->addHierIds();
249 $source_page->deleteContentFromHierId($a_hier_id);
270 include_once (
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
275 include_once (
"./Modules/LearningModule/classes/class.ilObjDlBook.php");
279 $tree =
new ilTree($cont_obj->getId());
281 $tree->setTreeTablePK(
"lm_id");
284 $source_page =& $source_lm_page->getPageObject();
287 $succ = $tree->fetchSuccessorNode($a_page_id,
"pg");
288 if ($succ[
"child"] > 0)
291 $target_page =& $target_lm_page->getPageObject();
292 $target_page->buildDom();
293 $target_page->addHierIds();
296 $source_page->buildDom();
297 $source_page->addHierIds();
301 return $succ[
"child"];
314 $this->page_object =& $a_page_obj;
347 $this->is_alias = $a_is_alias;
358 return $this->origin_id = $a_id;
382 foreach($pages as $page)
384 $ids[] = $page[
"obj_id"];
389 foreach($pages as $page)
391 if (is_array($linked_pages[$page[
"obj_id"]]))
406 $a_include_numbers =
false, $a_time_scheduled_activation =
false)
411 $query =
"SELECT * FROM lm_data WHERE obj_id = ".
412 $ilDB->quote($a_pg_id,
"integer");
413 $pg_set = $ilDB->query(
$query);
414 $pg_rec = $ilDB->fetchAssoc($pg_set);
421 $tree =
new ilTree($pg_rec[
"lm_id"]);
422 $tree->setTableNames(
'lm_tree',
'lm_data');
423 $tree->setTreeTablePK(
"lm_id");
428 return $nr.$pg_rec[
"title"];
431 if ($tree->isInTree($pg_rec[
"obj_id"]))
433 $pred_node = $tree->fetchPredecessorNode($pg_rec[
"obj_id"],
"st");
434 $childs = $tree->getChildsByType($pred_node[
"obj_id"],
"pg");
436 if(count($childs) > 1)
439 foreach($childs as $child)
441 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
445 if ($child[
"type"] !=
"pg" ||
$active)
449 if($child[
"obj_id"] == $pg_rec[
"obj_id"])
456 $cnt_str =
" (".$cur_cnt.
"/".$cnt.
")";
459 require_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
463 $a_include_numbers).$cnt_str;
468 return $pg_rec[
"title"];
478 function exportXML(&$a_xml_writer, $a_mode =
"normal", $a_inst = 0)
483 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
489 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML_Meta");
491 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML_Meta");
494 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML_PageContent");
496 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML_PageContent");
501 $attrs[
"OriginId"] =
"il_".$a_inst.
502 "_pg_".$this->getId();
503 $a_xml_writer->xmlElement(
"PageAlias", $attrs);
510 $a_xml_writer->xmlEndTag(
"PageObject");
519 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
522 $attrs[
"OriginId"] =
"il_".$a_inst.
524 $a_xml_writer->xmlElement(
"PageAlias", $attrs);
526 $a_xml_writer->xmlEndTag(
"PageObject");
538 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
540 $md2xml->setExportMode(
true);
541 $md2xml->startExport();
542 $a_xml_writer->appendXML($md2xml->getXML());
547 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
549 $a_value =
"il_".IL_INST_ID.
"_pg_".$this->
getId();
569 $this->page_object->buildDom();
570 $this->page_object->insertInstIntoIDs($a_inst);
571 $this->mobs_contained = $this->page_object->collectMediaObjects(
false);
572 $this->files_contained = $this->page_object->collectFileItems();
573 $xml = $this->page_object->getXMLFromDom(
false,
false,
false,
"",
true);
574 $xml = str_replace(
"&",
"&", $xml);
575 $a_xml_writer->appendXML($xml);
577 $this->page_object->freeDom();
587 return $this->mobs_contained;
597 return $this->files_contained;
616 $attrs[
"font-family"] =
"Times";
617 $attrs[
"font-size"] =
"14pt";
618 $a_xml_writer->xmlElement(
"fo:block", $attrs,
$title);
622 $this->page_object->buildDom();
623 $fo = $this->page_object->getFO();
624 $a_xml_writer->appendXML($fo);