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");
41 public function __construct(&$a_content_obj, $a_id = 0, $a_halt =
true)
43 parent::__construct($a_content_obj, $a_id);
47 $this->is_alias =
false;
48 $this->contains_int_link =
false;
49 $this->mobs_contained = array();
50 $this->files_contained = array();
51 $this->halt_on_error = $a_halt;
60 if (is_object($this->page_object)) {
61 unset($this->page_object);
72 $this->page_object =
new ilLMPage($this->
id, 0);
75 public function create($a_upload =
false, $a_omit_page_object_creation =
false)
77 parent::create($a_upload);
78 if ($a_omit_page_object_creation) {
81 if (!is_object($this->page_object)) {
84 $this->page_object->setId($this->
getId());
85 $this->page_object->setParentId($this->
getLMId());
86 $this->page_object->create($a_upload);
89 public function delete($a_delete_meta_data =
true)
91 parent::delete($a_delete_meta_data);
92 $this->page_object->delete();
99 public function copy($a_target_lm)
103 $lm_page->setTitle($this->
getTitle());
106 $lm_page->setLMId($a_target_lm->getId());
107 $lm_page->setType($this->
getType());
109 $lm_page->setImportId(
"il__pg_" . $this->
getId());
110 $lm_page->create(
true);
115 if (trim($exp_id) !=
"") {
122 include_once(
"Services/MetaData/classes/class.ilMD.php");
124 $new_md = $md->cloneMD($a_target_lm->getId(), $lm_page->getId(), $this->
getType());
131 $a_target_lm->getId(),
138 $page = $lm_page->getPageObject();
139 $this->page_object->copy($page->getId(), $page->getParentType(), $page->getParentId());
149 include_once(
"./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
162 $lm_page->setTitle($this->
getTitle());
164 $lm_page->setLMId($a_cont_obj->getId());
165 $lm_page->setImportId(
"il__pg_" . $this->
getId());
166 $lm_page->setType($this->
getType());
168 $lm_page->create(
true);
169 $a_copied_nodes[$this->
getId()] = $lm_page->getId();
172 include_once(
"Services/MetaData/classes/class.ilMD.php");
174 $new_md = $md->cloneMD($a_cont_obj->getId(), $lm_page->getId(), $this->
getType());
177 $page = $lm_page->getPageObject();
178 $page->setXMLContent($this->page_object->getXMLContent());
192 public static function _splitPage($a_page_id, $a_pg_parent_type, $a_hier_id)
197 include_once(
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
203 $lm_page->setTitle($source_lm_page->getTitle());
204 $lm_page->setLMId($source_lm_page->getLMId());
205 $lm_page->setType($source_lm_page->getType());
206 $lm_page->setDescription($source_lm_page->getDescription());
207 $lm_page->create(
true);
211 $source_page = $source_lm_page->getPageObject();
212 $page = $lm_page->getPageObject();
213 $page->setXMLContent($source_page->copyXMLContent());
215 $page->buildDom(
true);
220 include_once(
"Services/MetaData/classes/class.ilMD.php");
221 $md =
new ilMD($source_lm_page->getLMId(), $a_page_id, $source_lm_page->getType());
222 $md->
cloneMD($source_lm_page->getLMId(), $lm_page->getId(), $source_lm_page->getType());
226 $tree->setTableNames(
'lm_tree',
'lm_data');
227 $tree->setTreeTablePK(
"lm_id");
228 if (
$tree->isInTree($source_lm_page->getId())) {
229 $parent_node =
$tree->getParentNodeData($source_lm_page->getId());
230 $tree->insertNode($lm_page->getId(), $parent_node[
"child"], $source_lm_page->getId());
235 $page->deleteContentBeforeHierId($a_hier_id);
239 $source_page->buildDom();
240 $source_page->addHierIds();
241 $source_page->deleteContentFromHierId($a_hier_id);
258 include_once(
"./Modules/LearningModule/classes/class.ilObjLearningModule.php");
261 $tree->setTableNames(
'lm_tree',
'lm_data');
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) {
271 $target_page = $target_lm_page->getPageObject();
272 $target_page->buildDom();
273 $target_page->addHierIds();
276 $source_page->buildDom();
277 $source_page->addHierIds();
281 return $succ[
"child"];
293 $this->page_object = $a_page_obj;
326 $this->is_alias = $a_is_alias;
337 return $this->origin_id = $a_id;
361 foreach ($pages as $page) {
362 $ids[] = $page[
"obj_id"];
367 foreach ($pages as $page) {
368 if (is_array($linked_pages[$page[
"obj_id"]])) {
384 $a_include_numbers =
false,
385 $a_time_scheduled_activation =
false,
386 $a_force_content =
false,
389 $a_include_short =
false 405 if ($a_include_short) {
413 include_once(
"./Services/Object/classes/class.ilObjectTranslation.php");
417 if ($a_lang !=
"-" && $ot->getContentActivated() && isset(
$languages[$a_lang])) {
418 include_once(
"./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
421 if ($a_include_short) {
422 $trans_title = trim($lmobjtrans->getShortTitle());
424 if ($trans_title ==
"") {
425 $trans_title = $lmobjtrans->getTitle();
427 if ($trans_title !=
"") {
436 include_once(
"./Modules/LearningModule/classes/class.ilLMTree.php");
439 if (
$tree->isInTree($a_pg_id)) {
440 $pred_node =
$tree->fetchPredecessorNode($a_pg_id,
"st");
441 $childs =
$tree->getChildsByType($pred_node[
"obj_id"],
"pg");
443 if (count($childs) > 1) {
445 foreach ($childs as $child) {
446 include_once(
"./Modules/LearningModule/classes/class.ilLMPage.php");
450 $a_time_scheduled_activation
455 if ($act_data[
"show_activation_info"] &&
461 if ($child[
"type"] !=
"pg" ||
$active) {
464 if ($child[
"obj_id"] == $a_pg_id) {
469 $cnt_str =
" (" . $cur_cnt .
"/" . $cnt .
")";
472 require_once(
"./Modules/LearningModule/classes/class.ilStructureObject.php");
476 $pred_node[
"obj_id"],
498 public function exportXML(&$a_xml_writer, $a_mode =
"normal", $a_inst = 0)
501 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
514 $attrs[
"OriginId"] =
"il_" . $a_inst .
515 "_pg_" . $this->
getId();
516 $a_xml_writer->xmlElement(
"PageAlias", $attrs);
523 $a_xml_writer->xmlEndTag(
"PageObject");
532 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
535 $attrs[
"OriginId"] =
"il_" . $a_inst .
537 $a_xml_writer->xmlElement(
"PageAlias", $attrs);
539 $a_xml_writer->xmlEndTag(
"PageObject");
551 include_once(
"Services/MetaData/classes/class.ilMD2XML.php");
553 $md2xml->setExportMode(
true);
554 $md2xml->startExport();
555 $a_xml_writer->appendXML($md2xml->getXML());
560 if ($a_tag ==
"Identifier" && $a_param ==
"Entry") {
561 $a_value =
"il_" . IL_INST_ID .
"_pg_" . $this->
getId();
580 $this->page_object->buildDom();
581 $this->page_object->insertInstIntoIDs($a_inst);
582 $this->mobs_contained = $this->page_object->collectMediaObjects(
false);
584 include_once(
"./Services/COPage/classes/class.ilPCFileList.php");
587 $xml = $this->page_object->getXMLFromDom(
false,
false,
false,
"",
true);
588 $xml = str_replace(
"&",
"&", $xml);
589 $a_xml_writer->appendXML($xml);
591 $this->page_object->freeDom();
601 include_once(
"./Services/COPage/classes/class.ilPCQuestion.php");
603 $this->content_object->getType(),
615 return $this->mobs_contained;
625 return $this->files_contained;
639 $attrs[
"font-family"] =
"Times";
640 $attrs[
"font-size"] =
"14pt";
641 $a_xml_writer->xmlElement(
"fo:block", $attrs,
$title);
645 $this->page_object->buildDom();
646 $fo = $this->page_object->getFO();
647 $a_xml_writer->appendXML($fo);
665 $ilDB = $DIC->database();
666 $rbacreview = $DIC->rbac()->review();
670 $count_query =
"SELECT count(pq.question_id) cnt ";
673 $query =
"SELECT pq.page_id, pq.question_id ";
675 $from =
" FROM page_question pq JOIN lm_tree t ON (t.lm_id = " .
$ilDB->quote($a_lm_id,
"integer") .
676 " AND pq.page_id = t.child and pq.page_parent_type = " .
$ilDB->quote(
"lm",
"text") .
") " .
677 " WHERE t.lm_id = " .
$ilDB->quote($a_lm_id,
"integer");
678 $count_query .=
$from;
683 $set =
$ilDB->query($count_query);
685 if ($rec =
$ilDB->fetchAssoc($set)) {
689 $offset = (int) $a_offset;
690 $limit = (int) $a_limit;
692 $ilDB->setLimit($limit, $offset);
698 while ($rec =
$ilDB->fetchAssoc($set)) {
701 return array(
"cnt" => $cnt,
"set" =>
$result);
& cloneMD($a_rbac_id, $a_obj_id, $a_obj_type)
getShortTitle()
get short title of lm object
& getPageObject()
get assigned page object
static saveExportId($a_lm_id, $a_lmobj_id, $a_exp_id, $a_type="pg")
Save export id.
Class ilObjLearningModule.
create($a_upload=false, $a_omit_page_object_creation=false)
modifyExportIdentifier($a_tag, $a_param, $a_value)
existsExportID($a_lm_id, $a_exp_id, $a_type="pg")
Does export ID exist in lm?
static _getQuestionIdsForPage($a_parent_type, $a_page_id, $a_lang="-")
Get all questions of a page.
exportXMLMetaData(&$a_xml_writer)
export page objects meta data to xml (see ilias_co.dtd)
static _lookupShortTitle($a_obj_id)
Lookup short title.
static getPagesWithLinks($a_parent_type, $a_parent_id, $a_lang="-")
Get all pages for parent object that contain internal links.
getQuestionIds()
Get question ids.
assignPageObject(&$a_page_obj)
assign page object
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static _moveContentAfterHierId(&$a_source_page, &$a_target_page, $a_hid)
move content of hierarchical id >= $a_hid to other page
static _lookupTitle($a_obj_id)
Lookup title.
copy($a_target_lm)
copy page
exportFO(&$a_xml_writer)
export page object to fo
static now()
Return current timestamp in Y-m-d H:i:s format.
static _getPresentationTitle( $a_st_id, $a_mode=IL_CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
get presentation title
__construct(&$a_content_obj, $a_id=0, $a_halt=true)
Constructor public.
static _splitPage($a_page_id, $a_pg_parent_type, $a_hier_id)
split page at hierarchical id
exportXML(&$a_xml_writer, $a_mode="normal", $a_inst=0)
export page object to xml (see ilias_co.dtd)
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static _splitPageNext($a_page_id, $a_pg_parent_type, $a_hier_id)
split page to next page at hierarchical id
getFileItemIds()
get ids of all file items within the page
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
static getInstance($a_tree_id)
Get Instance.
& copyToOtherContObject(&$a_cont_obj, &$a_copied_nodes)
copy a page to another content object (learning module / dlib book)
static queryQuestionsOfLearningModule( $a_lm_id, $a_order_field, $a_order_dir, $a_offset, $a_limit)
Get questions of learning module.
setAlias($a_is_alias)
set wether page object is an alias
static getPagesWithLinksList($a_lm_id, $a_par_type)
Get all pages of lm that contain any internal links.
static getExportId($a_lm_id, $a_lmobj_id, $a_type="pg")
Get export ID.
Tree class data representation in hierachical trees using the Nested Set Model with Gaps by Joe Celco...
static _lookupType($a_id, $a_reference=false)
lookup object type
getMediaObjectIds()
get ids of all media objects within the page
static _lookupActivationData($a_id, $a_parent_type, $a_lang="-")
Lookup activation data.
getTitle()
get title of lm object
static _getPresentationTitle( $a_pg_id, $a_mode=IL_CHAPTER_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-", $a_include_short=false)
presentation title doesn't have to be page title, it may be chapter title + page title or chapter tit...
static getInstance($a_obj_id)
Get instance.
exportXMLPageContent(&$a_xml_writer, $a_inst=0)
export page objects meta data to xml (see ilias_co.dtd)
static _exportXMLAlias(&$a_xml_writer, $a_id, $a_inst=0)
export page alias to xml
static getObjectList($lm_id, $type="")
static
static getPageList($lm_id)
static
Translation information on lm object.
static copy($a_source_id, $a_target_id)
Copy all translations of an object.
Extension of ilPageObject for learning modules.