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)
411 $query =
"SELECT * FROM lm_data WHERE obj_id = ".$ilDB->quote($a_pg_id);
412 $pg_set = $ilDB->query($query);
420 $tree =
new ilTree($pg_rec[
"lm_id"]);
421 $tree->setTableNames(
'lm_tree',
'lm_data');
422 $tree->setTreeTablePK(
"lm_id");
427 return $nr.$pg_rec[
"title"];
430 if ($tree->isInTree($pg_rec[
"obj_id"]))
432 $pred_node = $tree->fetchPredecessorNode($pg_rec[
"obj_id"],
"st");
433 $childs = $tree->getChildsByType($pred_node[
"obj_id"],
"pg");
435 if(count($childs) > 1)
438 foreach($childs as $child)
444 if($child[
"obj_id"] == $pg_rec[
"obj_id"])
451 $cnt_str =
" (".$cur_cnt.
"/".$cnt.
")";
454 require_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
458 $a_include_numbers).$cnt_str;
463 return $pg_rec[
"title"];
473 function exportXML(&$a_xml_writer, $a_mode =
"normal", $a_inst = 0)
478 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
484 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML_Meta");
486 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML_Meta");
489 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML_PageContent");
491 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML_PageContent");
496 $attrs[
"OriginId"] =
"il_".$a_inst.
497 "_pg_".$this->getId();
498 $a_xml_writer->xmlElement(
"PageAlias", $attrs);
505 $a_xml_writer->xmlEndTag(
"PageObject");
514 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
517 $attrs[
"OriginId"] =
"il_".$a_inst.
519 $a_xml_writer->xmlElement(
"PageAlias", $attrs);
521 $a_xml_writer->xmlEndTag(
"PageObject");
533 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
535 $md2xml->setExportMode(
true);
536 $md2xml->startExport();
537 $a_xml_writer->appendXML($md2xml->getXML());
542 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
544 $a_value =
"il_".IL_INST_ID.
"_pg_".$this->
getId();
564 $this->page_object->buildDom();
565 $this->page_object->insertInstIntoIDs($a_inst);
566 $this->mobs_contained = $this->page_object->collectMediaObjects(
false);
567 $this->files_contained = $this->page_object->collectFileItems();
568 $xml = $this->page_object->getXMLFromDom(
false,
false,
false,
"",
true);
569 $xml = str_replace(
"&",
"&", $xml);
570 $a_xml_writer->appendXML($xml);
572 $this->page_object->freeDom();
582 return $this->mobs_contained;
592 return $this->files_contained;
611 $attrs[
"font-family"] =
"Times";
612 $attrs[
"font-size"] =
"14pt";
613 $a_xml_writer->xmlElement(
"fo:block", $attrs,
$title);
617 $this->page_object->buildDom();
618 $fo = $this->page_object->getFO();
619 $a_xml_writer->appendXML($fo);