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());
119 $lm_page->setLMId($a_target_lm->getId());
120 $lm_page->setType($this->
getType());
122 $lm_page->setImportId(
"il__pg_".$this->
getId());
123 $lm_page->create(
true);
128 if (trim($exp_id) !=
"")
137 include_once(
"Services/MetaData/classes/class.ilMD.php");
139 $new_md = $md->cloneMD($a_target_lm->getId(), $lm_page->getId(), $this->
getType());
153 $page = $lm_page->getPageObject();
154 $page->setXMLContent($this->page_object->copyXMLContent());
155 $page->setActive($this->page_object->getActive());
156 $page->setActivationStart($this->page_object->getActivationStart());
157 $page->setActivationEnd($this->page_object->getActivationEnd());
171 $lm_page->setTitle($this->
getTitle());
172 $lm_page->setLMId($a_cont_obj->getId());
173 $lm_page->setImportId(
"il__pg_".$this->
getId());
174 $lm_page->setType($this->
getType());
176 $lm_page->create(
true);
177 $a_copied_nodes[$this->
getId()] = $lm_page->getId();
180 include_once(
"Services/MetaData/classes/class.ilMD.php");
182 $new_md =& $md->cloneMD($a_cont_obj->getId(), $lm_page->getId(), $this->
getType());
185 $page =& $lm_page->getPageObject();
186 $page->setXMLContent($this->page_object->getXMLContent());
200 function _splitPage($a_page_id, $a_pg_parent_type, $a_hier_id)
208 include_once (
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
213 include_once (
"./Modules/LearningModule/classes/class.ilObjDlBook.php");
222 $lm_page->setTitle($source_lm_page->getTitle());
223 $lm_page->setLMId($source_lm_page->getLMId());
224 $lm_page->setType($source_lm_page->getType());
225 $lm_page->setDescription($source_lm_page->getDescription());
226 $lm_page->create(
true);
229 include_once(
"Services/MetaData/classes/class.ilMD.php");
230 $md =
new ilMD($source_lm_page->getLMId(), $a_page_id, $source_lm_page->getType());
231 $new_md =& $md->
cloneMD($source_lm_page->getLMId(), $lm_page->getId(), $source_lm_page->getType());
234 $source_page =& $source_lm_page->getPageObject();
235 $page =& $lm_page->getPageObject();
236 $page->setXMLContent($source_page->getXMLContent());
240 $tree =
new ilTree($cont_obj->getId());
242 $tree->setTreeTablePK(
"lm_id");
243 if ($tree->isInTree($source_lm_page->getId()))
245 $parent_node = $tree->getParentNodeData($source_lm_page->getId());
246 $tree->insertNode($lm_page->getId(), $parent_node[
"child"], $source_lm_page->getId());
251 $page->deleteContentBeforeHierId($a_hier_id);
254 $source_page->buildDom();
255 $source_page->addHierIds();
256 $source_page->deleteContentFromHierId($a_hier_id);
277 include_once (
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
282 include_once (
"./Modules/LearningModule/classes/class.ilObjDlBook.php");
286 $tree =
new ilTree($cont_obj->getId());
288 $tree->setTreeTablePK(
"lm_id");
291 $source_page =& $source_lm_page->getPageObject();
294 $succ = $tree->fetchSuccessorNode($a_page_id,
"pg");
295 if ($succ[
"child"] > 0)
298 $target_page =& $target_lm_page->getPageObject();
299 $target_page->buildDom();
300 $target_page->addHierIds();
303 $source_page->buildDom();
304 $source_page->addHierIds();
308 return $succ[
"child"];
321 $this->page_object =& $a_page_obj;
354 $this->is_alias = $a_is_alias;
365 return $this->origin_id = $a_id;
389 foreach($pages as $page)
391 $ids[] = $page[
"obj_id"];
396 foreach($pages as $page)
398 if (is_array($linked_pages[$page[
"obj_id"]]))
413 $a_include_numbers =
false, $a_time_scheduled_activation =
false,
414 $a_force_content =
false)
419 $query =
"SELECT * FROM lm_data WHERE obj_id = ".
420 $ilDB->quote($a_pg_id,
"integer");
421 $pg_set = $ilDB->query(
$query);
422 $pg_rec = $ilDB->fetchAssoc($pg_set);
429 $tree =
new ilTree($pg_rec[
"lm_id"]);
430 $tree->setTableNames(
'lm_tree',
'lm_data');
431 $tree->setTreeTablePK(
"lm_id");
436 return $nr.$pg_rec[
"title"];
439 if ($tree->isInTree($pg_rec[
"obj_id"]))
441 $pred_node = $tree->fetchPredecessorNode($pg_rec[
"obj_id"],
"st");
442 $childs = $tree->getChildsByType($pred_node[
"obj_id"],
"pg");
444 if(count($childs) > 1)
447 foreach($childs as $child)
449 include_once(
"./Services/COPage/classes/class.ilPageObject.php");
456 if ($act_data[
"show_activation_info"] &&
463 if ($child[
"type"] !=
"pg" ||
$active)
467 if($child[
"obj_id"] == $pg_rec[
"obj_id"])
474 $cnt_str =
" (".$cur_cnt.
"/".$cnt.
")";
477 require_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
481 $a_include_numbers).$cnt_str;
486 return $pg_rec[
"title"];
496 function exportXML(&$a_xml_writer, $a_mode =
"normal", $a_inst = 0)
501 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
507 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML_Meta");
509 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML_Meta");
512 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML_PageContent");
514 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML_PageContent");
519 $attrs[
"OriginId"] =
"il_".$a_inst.
520 "_pg_".$this->getId();
521 $a_xml_writer->xmlElement(
"PageAlias", $attrs);
528 $a_xml_writer->xmlEndTag(
"PageObject");
537 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
540 $attrs[
"OriginId"] =
"il_".$a_inst.
542 $a_xml_writer->xmlElement(
"PageAlias", $attrs);
544 $a_xml_writer->xmlEndTag(
"PageObject");
556 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
558 $md2xml->setExportMode(
true);
559 $md2xml->startExport();
560 $a_xml_writer->appendXML($md2xml->getXML());
565 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
567 $a_value =
"il_".IL_INST_ID.
"_pg_".$this->
getId();
587 $this->page_object->buildDom();
588 $this->page_object->insertInstIntoIDs($a_inst);
589 $this->mobs_contained = $this->page_object->collectMediaObjects(
false);
590 $this->files_contained = $this->page_object->collectFileItems();
592 $xml = $this->page_object->getXMLFromDom(
false,
false,
false,
"",
true);
593 $xml = str_replace(
"&",
"&", $xml);
594 $a_xml_writer->appendXML($xml);
596 $this->page_object->freeDom();
617 return $this->mobs_contained;
627 return $this->files_contained;
646 $attrs[
"font-family"] =
"Times";
647 $attrs[
"font-size"] =
"14pt";
648 $a_xml_writer->xmlElement(
"fo:block", $attrs,
$title);
652 $this->page_object->buildDom();
653 $fo = $this->page_object->getFO();
654 $a_xml_writer->appendXML($fo);
666 $a_order_dir, $a_offset, $a_limit)
668 global $ilDB, $rbacreview;
672 $count_query =
"SELECT count(pq.question_id) cnt ";
675 $query =
"SELECT pq.page_id, pq.question_id ";
677 $from =
" FROM page_question pq JOIN lm_tree t ON (t.lm_id = ".$ilDB->quote($a_lm_id,
"integer").
678 " AND pq.page_id = t.child and pq.page_parent_type = ".$ilDB->quote(
"lm",
"text").
") ".
679 " WHERE t.lm_id = ".$ilDB->quote($a_lm_id,
"integer");
680 $count_query.= $from;
685 $set = $ilDB->query($count_query);
687 if ($rec = $ilDB->fetchAssoc($set))
692 $offset = (int) $a_offset;
693 $limit = (int) $a_limit;
694 $ilDB->setLimit($limit, $offset);
697 $set = $ilDB->query(
$query);
699 while($rec = $ilDB->fetchAssoc($set))
703 return array(
"cnt" => $cnt,
"set" =>
$result);