5 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
6 require_once(
"./Services/COPage/classes/class.ilPageObject.php");
8 define (
"IL_CHAPTER_TITLE",
"st_title");
9 define (
"IL_PAGE_TITLE",
"pg_title");
10 define (
"IL_NO_HEADER",
"none");
46 $ilBench->start(
"ContentPresentation",
"ilLMPageObject_Constructor");
53 $this->is_alias =
false;
54 $this->contains_int_link =
false;
55 $this->mobs_contained = array();
56 $this->files_contained = array();
57 $this->halt_on_error = $a_halt;
64 $ilBench->stop(
"ContentPresentation",
"ilLMPageObject_Constructor");
69 if(is_object($this->page_object))
71 unset($this->page_object);
82 $ilBench->start(
"ContentPresentation",
"ilLMPageObject_read");
85 $this->page_object =&
new ilPageObject($this->content_object->getType(),
88 $ilBench->stop(
"ContentPresentation",
"ilLMPageObject_read");
94 if(!is_object($this->page_object))
96 $this->page_object =&
new ilPageObject($this->content_object->getType());
99 $this->page_object->setParentId($this->
getLMId());
100 $this->page_object->create($a_upload);
103 function delete($a_delete_meta_data =
true)
106 $this->page_object->delete();
117 $lm_page->setTitle($this->
getTitle());
118 $lm_page->setLMId($a_target_lm->getId());
119 $lm_page->setType($this->
getType());
121 $lm_page->setImportId(
"il__pg_".$this->
getId());
122 $lm_page->create(
true);
125 include_once(
"Services/MetaData/classes/class.ilMD.php");
127 $new_md = $md->cloneMD($a_target_lm->getId(), $lm_page->getId(), $this->
getType());
130 $page = $lm_page->getPageObject();
131 $page->setXMLContent($this->page_object->copyXMLContent());
145 $lm_page->setTitle($this->
getTitle());
146 $lm_page->setLMId($a_cont_obj->getId());
147 $lm_page->setImportId(
"il__pg_".$this->
getId());
148 $lm_page->setType($this->
getType());
150 $lm_page->create(
true);
151 $a_copied_nodes[$this->
getId()] = $lm_page->getId();
154 include_once(
"Services/MetaData/classes/class.ilMD.php");
156 $new_md =& $md->cloneMD($a_cont_obj->getId(), $lm_page->getId(), $this->
getType());
159 $page =& $lm_page->getPageObject();
160 $page->setXMLContent($this->page_object->getXMLContent());
174 function _splitPage($a_page_id, $a_pg_parent_type, $a_hier_id)
182 include_once (
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
187 include_once (
"./Modules/LearningModule/classes/class.ilObjDlBook.php");
196 $lm_page->setTitle($source_lm_page->getTitle());
197 $lm_page->setLMId($source_lm_page->getLMId());
198 $lm_page->setType($source_lm_page->getType());
199 $lm_page->setDescription($source_lm_page->getDescription());
200 $lm_page->create(
true);
203 include_once(
"Services/MetaData/classes/class.ilMD.php");
204 $md =
new ilMD($source_lm_page->getLMId(), $a_page_id, $source_lm_page->getType());
205 $new_md =& $md->
cloneMD($source_lm_page->getLMId(), $lm_page->getId(), $source_lm_page->getType());
208 $source_page =& $source_lm_page->getPageObject();
209 $page =& $lm_page->getPageObject();
210 $page->setXMLContent($source_page->getXMLContent());
214 $tree =
new ilTree($cont_obj->getId());
216 $tree->setTreeTablePK(
"lm_id");
217 if ($tree->isInTree($source_lm_page->getId()))
219 $parent_node = $tree->getParentNodeData($source_lm_page->getId());
220 $tree->insertNode($lm_page->getId(), $parent_node[
"child"], $source_lm_page->getId());
225 $page->deleteContentBeforeHierId($a_hier_id);
228 $source_page->buildDom();
229 $source_page->addHierIds();
230 $source_page->deleteContentFromHierId($a_hier_id);
251 include_once (
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
256 include_once (
"./Modules/LearningModule/classes/class.ilObjDlBook.php");
260 $tree =
new ilTree($cont_obj->getId());
262 $tree->setTreeTablePK(
"lm_id");
265 $source_page =& $source_lm_page->getPageObject();
268 $succ = $tree->fetchSuccessorNode($a_page_id,
"pg");
269 if ($succ[
"child"] > 0)
272 $target_page =& $target_lm_page->getPageObject();
273 $target_page->buildDom();
274 $target_page->addHierIds();
277 $source_page->buildDom();
278 $source_page->addHierIds();
282 return $succ[
"child"];
295 $this->page_object =& $a_page_obj;
328 $this->is_alias = $a_is_alias;
339 return $this->origin_id = $a_id;
363 foreach($pages as $page)
365 $ids[] = $page[
"obj_id"];
370 foreach($pages as $page)
372 if (is_array($linked_pages[$page[
"obj_id"]]))
387 $a_include_numbers =
false, $a_time_scheduled_activation =
false)
392 $query =
"SELECT * FROM lm_data WHERE obj_id = ".
393 $ilDB->quote($a_pg_id,
"integer");
394 $pg_set = $ilDB->query(
$query);
395 $pg_rec = $ilDB->fetchAssoc($pg_set);
402 $tree =
new ilTree($pg_rec[
"lm_id"]);
403 $tree->setTableNames(
'lm_tree',
'lm_data');
404 $tree->setTreeTablePK(
"lm_id");
409 return $nr.$pg_rec[
"title"];
412 if ($tree->isInTree($pg_rec[
"obj_id"]))
414 $pred_node = $tree->fetchPredecessorNode($pg_rec[
"obj_id"],
"st");
415 $childs = $tree->getChildsByType($pred_node[
"obj_id"],
"pg");
417 if(count($childs) > 1)
420 foreach($childs as $child)
422 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
426 if ($child[
"type"] !=
"pg" ||
$active)
430 if($child[
"obj_id"] == $pg_rec[
"obj_id"])
437 $cnt_str =
" (".$cur_cnt.
"/".$cnt.
")";
440 require_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
444 $a_include_numbers).$cnt_str;
449 return $pg_rec[
"title"];
459 function exportXML(&$a_xml_writer, $a_mode =
"normal", $a_inst = 0)
464 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
470 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML_Meta");
472 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML_Meta");
475 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML_PageContent");
477 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML_PageContent");
482 $attrs[
"OriginId"] =
"il_".$a_inst.
483 "_pg_".$this->getId();
484 $a_xml_writer->xmlElement(
"PageAlias", $attrs);
491 $a_xml_writer->xmlEndTag(
"PageObject");
500 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
503 $attrs[
"OriginId"] =
"il_".$a_inst.
505 $a_xml_writer->xmlElement(
"PageAlias", $attrs);
507 $a_xml_writer->xmlEndTag(
"PageObject");
519 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
521 $md2xml->setExportMode(
true);
522 $md2xml->startExport();
523 $a_xml_writer->appendXML($md2xml->getXML());
528 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
530 $a_value =
"il_".IL_INST_ID.
"_pg_".$this->
getId();
550 $this->page_object->buildDom();
551 $this->page_object->insertInstIntoIDs($a_inst);
552 $this->mobs_contained = $this->page_object->collectMediaObjects(
false);
553 $this->files_contained = $this->page_object->collectFileItems();
555 $xml = $this->page_object->getXMLFromDom(
false,
false,
false,
"",
true);
556 $xml = str_replace(
"&",
"&", $xml);
557 $a_xml_writer->appendXML($xml);
559 $this->page_object->freeDom();
580 return $this->mobs_contained;
590 return $this->files_contained;
609 $attrs[
"font-family"] =
"Times";
610 $attrs[
"font-size"] =
"14pt";
611 $a_xml_writer->xmlElement(
"fo:block", $attrs,
$title);
615 $this->page_object->buildDom();
616 $fo = $this->page_object->getFO();
617 $a_xml_writer->appendXML($fo);
629 $a_order_dir, $a_offset, $a_limit)
631 global
$ilDB, $rbacreview;
635 $count_query =
"SELECT count(pq.question_id) cnt ";
638 $query =
"SELECT pq.page_id, pq.question_id ";
640 $from =
" FROM page_question pq JOIN lm_tree t ON (t.lm_id = ".$ilDB->quote($a_lm_id,
"integer").
641 " AND pq.page_id = t.child and pq.page_parent_type = ".$ilDB->quote(
"lm",
"text").
") ".
642 " WHERE t.lm_id = ".$ilDB->quote($a_lm_id,
"integer");
643 $count_query.= $from;
648 $set = $ilDB->query($count_query);
650 if ($rec = $ilDB->fetchAssoc($set))
655 $offset = (int) $a_offset;
656 $limit = (int) $a_limit;
657 $ilDB->setLimit($limit, $offset);
660 $set = $ilDB->query(
$query);
662 while($rec = $ilDB->fetchAssoc($set))
666 return array(
"cnt" => $cnt,
"set" =>
$result);