5 require_once(
"./Modules/LearningModule/classes/class.ilLMObject.php");
6 require_once(
"./Modules/LearningModule/classes/class.ilLMPage.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");
52 $this->is_alias =
false;
53 $this->contains_int_link =
false;
54 $this->mobs_contained = array();
55 $this->files_contained = array();
56 $this->halt_on_error = $a_halt;
63 $ilBench->stop(
"ContentPresentation",
"ilLMPageObject_Constructor");
68 if(is_object($this->page_object))
70 unset($this->page_object);
81 $this->page_object =
new ilLMPage($this->
id, 0);
87 if(!is_object($this->page_object))
91 $this->page_object->setId($this->
getId());
92 $this->page_object->setParentId($this->
getLMId());
93 $this->page_object->create($a_upload);
96 function delete($a_delete_meta_data =
true)
99 $this->page_object->delete();
110 $lm_page->setTitle($this->
getTitle());
112 $lm_page->setLMId($a_target_lm->getId());
113 $lm_page->setType($this->
getType());
115 $lm_page->setImportId(
"il__pg_".$this->
getId());
116 $lm_page->create(
true);
121 if (trim($exp_id) !=
"")
130 include_once(
"Services/MetaData/classes/class.ilMD.php");
132 $new_md = $md->cloneMD($a_target_lm->getId(), $lm_page->getId(), $this->
getType());
146 $page = $lm_page->getPageObject();
147 $this->page_object->copy($page->getId(), $page->getParentType(), $page->getParentId());
157 include_once(
"./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
170 $lm_page->setTitle($this->
getTitle());
171 $lm_page->setLMId($a_cont_obj->getId());
172 $lm_page->setImportId(
"il__pg_".$this->
getId());
173 $lm_page->setType($this->
getType());
175 $lm_page->create(
true);
176 $a_copied_nodes[$this->
getId()] = $lm_page->getId();
179 include_once(
"Services/MetaData/classes/class.ilMD.php");
181 $new_md =& $md->cloneMD($a_cont_obj->getId(), $lm_page->getId(), $this->
getType());
184 $page =& $lm_page->getPageObject();
185 $page->setXMLContent($this->page_object->getXMLContent());
199 function _splitPage($a_page_id, $a_pg_parent_type, $a_hier_id)
207 include_once (
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
212 include_once (
"./Modules/LearningModule/classes/class.ilObjDlBook.php");
221 $lm_page->setTitle($source_lm_page->getTitle());
222 $lm_page->setLMId($source_lm_page->getLMId());
223 $lm_page->setType($source_lm_page->getType());
224 $lm_page->setDescription($source_lm_page->getDescription());
225 $lm_page->create(
true);
229 $source_page = $source_lm_page->getPageObject();
230 $page = $lm_page->getPageObject();
231 $page->setXMLContent($source_page->copyXMLContent());
233 $page->buildDom(
true);
238 include_once(
"Services/MetaData/classes/class.ilMD.php");
239 $md =
new ilMD($source_lm_page->getLMId(), $a_page_id, $source_lm_page->getType());
240 $md->
cloneMD($source_lm_page->getLMId(), $lm_page->getId(), $source_lm_page->getType());
243 $tree =
new ilTree($cont_obj->getId());
245 $tree->setTreeTablePK(
"lm_id");
246 if ($tree->isInTree($source_lm_page->getId()))
248 $parent_node = $tree->getParentNodeData($source_lm_page->getId());
249 $tree->insertNode($lm_page->getId(), $parent_node[
"child"], $source_lm_page->getId());
254 $page->deleteContentBeforeHierId($a_hier_id);
258 $source_page->buildDom();
259 $source_page->addHierIds();
260 $source_page->deleteContentFromHierId($a_hier_id);
281 include_once (
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
286 include_once (
"./Modules/LearningModule/classes/class.ilObjDlBook.php");
290 $tree =
new ilTree($cont_obj->getId());
292 $tree->setTreeTablePK(
"lm_id");
295 $source_page =& $source_lm_page->getPageObject();
298 $succ = $tree->fetchSuccessorNode($a_page_id,
"pg");
299 if ($succ[
"child"] > 0)
302 $target_page =& $target_lm_page->getPageObject();
303 $target_page->buildDom();
304 $target_page->addHierIds();
307 $source_page->buildDom();
308 $source_page->addHierIds();
312 return $succ[
"child"];
325 $this->page_object =& $a_page_obj;
358 $this->is_alias = $a_is_alias;
369 return $this->origin_id = $a_id;
393 foreach($pages as $page)
395 $ids[] = $page[
"obj_id"];
400 foreach($pages as $page)
402 if (is_array($linked_pages[$page[
"obj_id"]]))
417 $a_include_numbers =
false, $a_time_scheduled_activation =
false,
418 $a_force_content =
false, $a_lm_id = 0, $a_lang =
"-")
439 include_once(
"./Services/Object/classes/class.ilObjectTranslation.php");
441 $languages = $ot->getLanguages();
443 if ($a_lang !=
"-" && $ot->getContentActivated() && isset($languages[$a_lang]))
445 include_once(
"./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
447 if ($lmobjtrans->getTitle() !=
"")
449 $title = $lmobjtrans->getTitle();
458 include_once(
"./Modules/LearningModule/classes/class.ilLMTree.php");
461 if ($tree->isInTree($a_pg_id))
463 $pred_node = $tree->fetchPredecessorNode($a_pg_id,
"st");
464 $childs = $tree->getChildsByType($pred_node[
"obj_id"],
"pg");
466 if(count($childs) > 1)
469 foreach($childs as $child)
471 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
478 if ($act_data[
"show_activation_info"] &&
485 if ($child[
"type"] !=
"pg" ||
$active)
489 if($child[
"obj_id"] == $a_pg_id)
496 $cnt_str =
" (".$cur_cnt.
"/".$cnt.
")";
499 require_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
503 $a_include_numbers,
false, 0, $a_lang).$cnt_str;
519 function exportXML(&$a_xml_writer, $a_mode =
"normal", $a_inst = 0)
524 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
530 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML_Meta");
532 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML_Meta");
535 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML_PageContent");
537 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML_PageContent");
542 $attrs[
"OriginId"] =
"il_".$a_inst.
543 "_pg_".$this->getId();
544 $a_xml_writer->xmlElement(
"PageAlias", $attrs);
551 $a_xml_writer->xmlEndTag(
"PageObject");
560 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
563 $attrs[
"OriginId"] =
"il_".$a_inst.
565 $a_xml_writer->xmlElement(
"PageAlias", $attrs);
567 $a_xml_writer->xmlEndTag(
"PageObject");
579 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
581 $md2xml->setExportMode(
true);
582 $md2xml->startExport();
583 $a_xml_writer->appendXML($md2xml->getXML());
588 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
590 $a_value =
"il_".IL_INST_ID.
"_pg_".$this->
getId();
609 $this->page_object->buildDom();
610 $this->page_object->insertInstIntoIDs($a_inst);
611 $this->mobs_contained = $this->page_object->collectMediaObjects(
false);
613 include_once(
"./Services/COPage/classes/class.ilPCFileList.php");
616 $xml = $this->page_object->getXMLFromDom(
false,
false,
false,
"",
true);
617 $xml = str_replace(
"&",
"&", $xml);
618 $a_xml_writer->appendXML($xml);
620 $this->page_object->freeDom();
630 include_once(
"./Services/COPage/classes/class.ilPCQuestion.php");
642 return $this->mobs_contained;
652 return $this->files_contained;
671 $attrs[
"font-family"] =
"Times";
672 $attrs[
"font-size"] =
"14pt";
673 $a_xml_writer->xmlElement(
"fo:block", $attrs,
$title);
677 $this->page_object->buildDom();
678 $fo = $this->page_object->getFO();
679 $a_xml_writer->appendXML($fo);
691 $a_order_dir, $a_offset, $a_limit)
693 global $ilDB, $rbacreview;
697 $count_query =
"SELECT count(pq.question_id) cnt ";
700 $query =
"SELECT pq.page_id, pq.question_id ";
702 $from =
" FROM page_question pq JOIN lm_tree t ON (t.lm_id = ".$ilDB->quote($a_lm_id,
"integer").
703 " AND pq.page_id = t.child and pq.page_parent_type = ".$ilDB->quote(
"lm",
"text").
") ".
704 " WHERE t.lm_id = ".$ilDB->quote($a_lm_id,
"integer");
705 $count_query.= $from;
710 $set = $ilDB->query($count_query);
712 if ($rec = $ilDB->fetchAssoc($set))
717 $offset = (int) $a_offset;
718 $limit = (int) $a_limit;
719 $ilDB->setLimit($limit, $offset);
722 $set = $ilDB->query(
$query);
724 while($rec = $ilDB->fetchAssoc($set))
728 return array(
"cnt" => $cnt,
"set" =>
$result);