48 $this->contains_int_link =
false;
49 $this->mobs_contained = array();
50 $this->files_contained = array();
51 $this->halt_on_error = $a_halt;
58 public function read(): void
61 $this->page_object =
new ilLMPage($this->
id, 0);
65 bool $a_upload =
false,
66 bool $a_omit_page_object_creation =
false,
69 parent::create($a_upload);
70 if ($a_omit_page_object_creation) {
73 if (!is_object($this->page_object)) {
76 $this->page_object->setId($this->
getId());
77 $this->page_object->setParentId($this->
getLMId());
78 if ($a_layout_id == 0) {
79 $this->page_object->create(
false);
81 $this->page_object->createWithLayoutId($a_layout_id);
85 public function delete(
bool $a_delete_meta_data =
true):
void 87 parent::delete($a_delete_meta_data);
88 $this->page_object->delete();
97 $lm_page->setTitle($this->
getTitle());
100 $lm_page->setLMId($a_target_lm->
getId());
101 $lm_page->setType($this->
getType());
103 $lm_page->setImportId(
"il__pg_" . $this->
getId());
104 $lm_page->create(
true);
109 if (trim($exp_id) !=
"") {
117 $new_md = $md->cloneMD($a_target_lm->
getId(), $lm_page->getId(), $this->
getType());
124 $a_target_lm->
getId(),
131 $page = $lm_page->getPageObject();
132 $this->page_object->copy($page->getId(), $page->getParentType(), $page->getParentId());
146 array &$a_copied_nodes
150 $lm_page->setTitle($this->
getTitle());
152 $lm_page->setLMId($a_cont_obj->
getId());
153 $lm_page->setImportId(
"il__pg_" . $this->
getId());
154 $lm_page->setType($this->
getType());
156 $lm_page->create(
true);
157 $a_copied_nodes[$this->
getId()] = $lm_page->getId();
161 $new_md = $md->cloneMD($a_cont_obj->
getId(), $lm_page->getId(), $this->
getType());
164 $page = $lm_page->getPageObject();
165 $page->setXMLContent($this->page_object->getXMLContent());
180 string $a_pg_parent_type,
191 $lm_page->setTitle($source_lm_page->getTitle());
192 $lm_page->setLMId($source_lm_page->getLMId());
193 $lm_page->setType($source_lm_page->getType());
194 $lm_page->setDescription($source_lm_page->getDescription());
195 $lm_page->create(
true);
199 $source_page = $source_lm_page->getPageObject();
200 $page = $lm_page->getPageObject();
201 $page->setXMLContent($source_page->copyXmlContent());
202 $page->buildDom(
true);
206 $md =
new ilMD($source_lm_page->getLMId(), $a_page_id, $source_lm_page->getType());
207 $md->
cloneMD($source_lm_page->getLMId(), $lm_page->getId(), $source_lm_page->getType());
210 $tree =
new ilTree($cont_obj->getId());
211 $tree->setTableNames(
'lm_tree',
'lm_data');
212 $tree->setTreeTablePK(
"lm_id");
213 if ($tree->isInTree($source_lm_page->getId())) {
214 $parent_node = $tree->getParentNodeData($source_lm_page->getId());
215 $tree->insertNode($lm_page->getId(), $parent_node[
"child"], $source_lm_page->getId());
220 $page->deleteContentBeforeHierId($a_hier_id);
224 $source_page->buildDom();
225 $source_page->addHierIDs();
226 $source_page->deleteContentFromHierId($a_hier_id);
240 string $a_pg_parent_type,
247 $tree =
new ilTree($cont_obj->getId());
248 $tree->setTableNames(
'lm_tree',
'lm_data');
249 $tree->setTreeTablePK(
"lm_id");
252 $source_page = $source_lm_page->getPageObject();
255 $succ = $tree->fetchSuccessorNode($a_page_id,
"pg");
256 if ($succ[
"child"] > 0) {
258 $target_page = $target_lm_page->getPageObject();
259 $target_page->buildDom();
260 $target_page->addHierIDs();
263 $source_page->buildDom();
264 $source_page->addHierIDs();
268 return (
int) $succ[
"child"];
279 $this->page_object = $a_page_obj;
291 public function setId(
int $a_id): void
316 foreach ($pages as $page) {
317 if (isset($linked_pages[$page[
"obj_id"]])) {
331 string $a_mode = self::CHAPTER_TITLE,
332 bool $a_include_numbers =
false,
333 bool $a_time_scheduled_activation =
false,
334 bool $a_force_content =
false,
336 string $a_lang =
"-",
337 bool $a_include_short =
false 339 if ($a_mode == self::NO_HEADER && !$a_force_content) {
355 if ($a_include_short) {
364 $languages = $ot->getLanguages();
366 if ($a_lang !=
"-" && $ot->getContentActivated()) {
369 if ($a_include_short) {
370 $trans_title = trim($lmobjtrans->getShortTitle());
372 if ($trans_title ==
"") {
373 $trans_title = $lmobjtrans->getTitle();
375 if ($trans_title ==
"") {
377 $trans_title = $lmobjtrans->
getTitle();
379 if ($trans_title !=
"") {
384 if ($a_mode == self::PAGE_TITLE) {
390 if ($tree->isInTree($a_pg_id)) {
391 $pred_node = $tree->fetchPredecessorNode($a_pg_id,
"st");
392 $childs = $tree->getChildsByType($pred_node[
"obj_id"],
"pg");
394 if (count($childs) > 1) {
396 foreach ($childs as $child) {
400 $a_time_scheduled_activation
405 if ($act_data[
"show_activation_info"] &&
411 if ($child[
"type"] !=
"pg" ||
$active) {
414 if ($child[
"obj_id"] == $a_pg_id) {
419 $cnt_str =
" (" . $cur_cnt .
"/" . $cnt .
")";
423 $pred_node[
"obj_id"],
442 string $a_mode =
"normal",
459 $attrs[
"OriginId"] =
"il_" . $a_inst .
460 "_pg_" . $this->
getId();
461 $a_xml_writer->
xmlElement(
"PageAlias", $attrs);
479 $attrs[
"OriginId"] =
"il_" . $a_inst .
481 $a_xml_writer->
xmlElement(
"PageAlias", $attrs);
490 $md2xml->setExportMode(
true);
491 $md2xml->startExport();
492 $a_xml_writer->
appendXML($md2xml->getXML());
500 if ($a_tag ==
"Identifier" && $a_param ==
"Entry") {
511 $this->page_object->buildDom();
512 $this->page_object->insertInstIntoIDs($a_inst);
513 $this->mobs_contained = $this->page_object->collectMediaObjects(
false);
515 $xml = $this->page_object->getXMLFromDom(
false,
false,
false,
"",
true);
516 $xml = str_replace(
"&",
"&", $xml);
519 $this->page_object->freeDom();
529 $this->content_object->getType(),
561 $attrs[
"font-family"] =
"Times";
562 $attrs[
"font-size"] =
"14pt";
567 $this->page_object->buildDom();
568 $fo = $this->page_object->getFO();
577 string $a_order_field,
584 $ilDB = $DIC->database();
587 $count_query =
"SELECT count(pq.question_id) cnt ";
590 $query =
"SELECT pq.page_id, pq.question_id ";
592 $from =
" FROM page_question pq JOIN lm_tree t ON (t.lm_id = " .
$ilDB->quote($a_lm_id,
"integer") .
593 " AND pq.page_id = t.child and pq.page_parent_type = " .
$ilDB->quote(
"lm",
"text") .
") " .
594 " WHERE t.lm_id = " .
$ilDB->quote($a_lm_id,
"integer");
595 $count_query .= $from;
599 $set =
$ilDB->query($count_query);
601 if ($rec =
$ilDB->fetchAssoc($set)) {
608 $ilDB->setLimit($limit, $offset);
614 while ($rec =
$ilDB->fetchAssoc($set)) {
617 return array(
"cnt" => $cnt,
"set" => $result);
633 $lng = $DIC->language();
641 $parent_id = $lm_tree->getParentId($node_id);
644 $parent_id = $node_id;
649 for (
$i = 1;
$i <= $num;
$i++) {
652 $page->setLMId($lm->getId());
653 $page->create(
false,
false, $layout_id);
655 $page_ids[] = $page->getId();
657 $page_ids = array_reverse($page_ids);
static _lookupActive(int $a_id, string $a_parent_type, bool $a_check_scheduled_activation=false, string $a_lang="-")
lookup activation status
static queryQuestionsOfLearningModule(int $a_lm_id, string $a_order_field, string $a_order_dir, int $a_offset, int $a_limit)
Get questions of learning module.
static _getPresentationTitle(int $a_st_id, string $a_mode=self::CHAPTER_TITLE, bool $a_include_numbers=false, bool $a_time_scheduled_activation=false, bool $a_force_content=false, int $a_lm_id=0, string $a_lang="-", bool $a_include_short=false)
static _exportXMLAlias(ilXmlWriter $a_xml_writer, int $a_id, int $a_inst=0)
export page alias to xml
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getPagesWithLinks(string $a_parent_type, int $a_parent_id, string $a_lang="-")
Get all pages for parent object that contain internal links.
getPageObject()
get assigned page object
static getExportId(int $a_lm_id, int $a_lmobj_id, string $a_type="pg")
getQuestionIds()
Get question ids note: this method must be called afer exportXMLPageContent.
exportXMLMetaData(ilXmlWriter $a_xml_writer)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupShortTitle(int $a_obj_id)
static getObjectList(int $lm_id, string $type="")
static _lookupActivationData(int $a_id, string $a_parent_type, string $a_lang="-")
Lookup activation data.
appendXML(string $a_str)
append xml string to document
static now()
Return current timestamp in Y-m-d H:i:s format.
static getInstance(int $a_tree_id)
modifyExportIdentifier(string $a_tag, string $a_param, string $a_value)
create(bool $a_upload=false, bool $a_omit_page_object_creation=false, int $a_layout_id=0)
static putInTree(ilLMObject $a_obj, int $a_parent_id=0, int $a_target_node_id=0)
put this object into content object tree
xmlEndTag(string $tag)
Writes an endtag.
static _lookupTitle(int $a_obj_id)
static collectFileItems(ilPageObject $a_page, DOMDocument $a_domdoc)
Get all file items that are used within the page.
static copy(string $a_source_id, string $a_target_id)
Copy all translations of an object.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _splitPage(int $a_page_id, string $a_pg_parent_type, string $a_hier_id)
split page at hierarchical id the main reason for this method being static is that a lm page object i...
getFileItemIds()
get ids of all file items within the page note: this method must be called afer exportXMLPageContent ...
__construct(ilObjLearningModule $a_content_obj, int $a_id=0, bool $a_halt=true)
static getInstance(int $obj_id)
static insertPagesFromTemplate(int $lm_id, int $num, int $node_id, bool $first_child, int $layout_id, string $title="")
Insert (multiple) pages templates at node.
exportFO(ilXmlWriter $a_xml_writer)
export page object to fo
static getPagesWithLinksList(int $a_lm_id, string $a_par_type)
Get all pages of lm that contain any internal links.
existsExportID(int $a_lm_id, int $a_exp_id, string $a_type="pg")
Does export ID exist in lm?
assignPageObject(ilLMPage $a_page_obj)
assign page object
getMediaObjectIds()
get ids of all media objects within the page note: this method must be called afer exportXMLPageConte...
copy(ilObjLearningModule $a_target_lm)
exportXML(ilXmlWriter $a_xml_writer, string $a_mode="normal", int $a_inst=0)
export page object to xml (see ilias_co.dtd)
static saveExportId(int $a_lm_id, int $a_lmobj_id, string $a_exp_id, string $a_type="pg")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getPresentationTitle(int $a_pg_id, string $a_mode=self::CHAPTER_TITLE, bool $a_include_numbers=false, bool $a_time_scheduled_activation=false, bool $a_force_content=false, int $a_lm_id=0, string $a_lang="-", bool $a_include_short=false)
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
static getPageList(int $lm_id)
__construct(Container $dic, ilPlugin $plugin)
static _lookupContObjID(int $a_id)
get learning module id for lm object
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
static _lookupType(int $id, bool $reference=false)
exportXMLPageContent(ilXmlWriter $a_xml_writer, int $a_inst=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _splitPageNext(int $a_page_id, string $a_pg_parent_type, string $a_hier_id)
split page to next page at hierarchical id
static _getQuestionIdsForPage(string $a_parent_type, int $a_page_id, string $a_lang="-")
copyToOtherContObject(ilObjLearningModule $a_cont_obj, array &$a_copied_nodes)
copy a page to another content object (learning module / dlib book)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
cloneMD(int $a_rbac_id, int $a_obj_id, string $a_obj_type)
static _moveContentAfterHierId(ilPageObject $a_source_page, ilPageObject $a_target_page, string $a_hid)
move content of hierarchical id >= $a_hid to other page