ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLMPageObject Class Reference

Class ilLMPageObject. More...

+ Inheritance diagram for ilLMPageObject:
+ Collaboration diagram for ilLMPageObject:

Public Member Functions

 __construct (&$a_content_obj, $a_id=0, $a_halt=true)
 Constructor public. More...
 
 __desctruct ()
 
 read ()
 
 create ($a_upload=false, $a_omit_page_object_creation=false)
 
 delete ($a_delete_meta_data=true)
 
 copy ($a_target_lm)
 copy page More...
 
copyToOtherContObject (&$a_cont_obj, &$a_copied_nodes)
 copy a page to another content object (learning module / dlib book) More...
 
 assignPageObject (&$a_page_obj)
 assign page object More...
 
getPageObject ()
 get assigned page object More...
 
 setId ($a_id)
 set id More...
 
 getId ()
 
 setAlias ($a_is_alias)
 set wether page object is an alias More...
 
 isAlias ()
 
 setOriginID ($a_id)
 
 getOriginID ()
 
 exportXML (&$a_xml_writer, $a_mode="normal", $a_inst=0)
 export page object to xml (see ilias_co.dtd) More...
 
 exportXMLMetaData (&$a_xml_writer)
 export page objects meta data to xml (see ilias_co.dtd) More...
 
 modifyExportIdentifier ($a_tag, $a_param, $a_value)
 
 exportXMLPageContent (&$a_xml_writer, $a_inst=0)
 export page objects meta data to xml (see ilias_co.dtd) More...
 
 getQuestionIds ()
 Get question ids. More...
 
 getMediaObjectIds ()
 get ids of all media objects within the page More...
 
 getFileItemIds ()
 get ids of all file items within the page More...
 
 exportFO (&$a_xml_writer)
 export page object to fo More...
 
- Public Member Functions inherited from ilLMObject
 __construct ($a_content_obj, $a_id=0)
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 setDataRecord ($a_record)
 this method should only be called by class ilLMObjectFactory More...
 
 read ()
 
 setTitle ($a_title)
 set title of lm object More...
 
 getTitle ()
 get title of lm object More...
 
 setShortTitle ($a_title)
 set short title of lm object More...
 
 getShortTitle ()
 get short title of lm object More...
 
 setDescription ($a_description)
 
 getDescription ()
 
 setType ($a_type)
 
 getType ()
 
 setLMId ($a_lm_id)
 
 getLMId ()
 
 setContentObject (&$a_content_obj)
 
getContentObject ()
 
 setId ($a_id)
 
 getId ()
 
 getImportId ()
 
 setImportId ($a_id)
 
 setLayout ($a_val)
 Set layout. More...
 
 getLayout ()
 Get layout. More...
 
 create ($a_upload=false)
 
 update ()
 update complete object More...
 
 delete ($a_delete_meta_data=true)
 delete lm object data More...
 
 existsExportID ($a_lm_id, $a_exp_id, $a_type="pg")
 Does export ID exist in lm? More...
 
 getExportIDInfo ($a_lm_id, $a_exp_id, $a_type="pg")
 Does export ID exist in lm? More...
 

Static Public Member Functions

static _splitPage ($a_page_id, $a_pg_parent_type, $a_hier_id)
 split page at hierarchical id More...
 
static _splitPageNext ($a_page_id, $a_pg_parent_type, $a_hier_id)
 split page to next page at hierarchical id More...
 
static getPageList ($lm_id)
 static More...
 
static getPagesWithLinksList ($a_lm_id, $a_par_type)
 Get all pages of lm that contain any internal links. More...
 
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 title only, depending on settings More...
 
static _exportXMLAlias (&$a_xml_writer, $a_id, $a_inst=0)
 export page alias to xml More...
 
static queryQuestionsOfLearningModule ( $a_lm_id, $a_order_field, $a_order_dir, $a_offset, $a_limit)
 Get questions of learning module. More...
 
- Static Public Member Functions inherited from ilLMObject
static _lookupNID ($a_lm_id, $a_lm_obj_id, $a_type)
 lookup named identifier (ILIAS_NID) More...
 
static preloadDataByLM ($a_lm_id)
 Preload data records by lm. More...
 
static _lookupTitle ($a_obj_id)
 Lookup title. More...
 
static _lookupShortTitle ($a_obj_id)
 Lookup short title. More...
 
static _lookupType ($a_obj_id, $a_lm_id=0)
 Lookup type. More...
 
static _writeTitle ($a_obj_id, $a_title)
 
static _writeImportId ($a_id, $a_import_id)
 write import id to db (static) More...
 
static _writePublicAccessStatus ($a_pages, $a_cont_obj_id)
 update public access flags in lm_data for all pages of a content object More...
 
static _isPagePublic ($a_node_id, $a_check_public_mode=false)
 
static _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
static _getAllObjectsForImportId ($a_import_id, $a_in_lm=0)
 Get all items for an import ID. More...
 
static _exists ($a_id)
 checks wether a lm content object with specified id exists or not More...
 
static getObjectList ($lm_id, $type="")
 static More...
 
static _deleteAllObjectData (&$a_cobj)
 delete all objects of content object (digi book / learning module) More...
 
static _lookupContObjID ($a_id)
 get learning module / digibook id for lm object More...
 
static putInTree ($a_obj, $a_parent_id="", $a_target_node_id="")
 put this object into content object tree More...
 
static getTree ($a_cont_obj_id)
 Get learningmodule tree. More...
 
static clipboardCut ($a_cont_obj_id, $a_ids)
 Copy a set of chapters/pages into the clipboard. More...
 
static clipboardCopy ($a_cont_obj_id, $a_ids)
 Copy a set of chapters/pages into the clipboard. More...
 
static pasteTree ( $a_target_lm, $a_item_id, $a_parent_id, $a_target, $a_insert_time, &$a_copied_nodes, $a_as_copy=false, $a_source_lm=null)
 Paste item (tree) from clipboard to current lm. More...
 
static saveTitles ($a_lm, $a_titles, $a_lang="-")
 Save titles for lm objects. More...
 
static updateInternalLinks ($a_copied_nodes, $a_parent_type="lm")
 Update internal links, after multiple pages have been copied. More...
 
static uniqueTypesCheck ($a_items)
 Check for unique types (all pages or all chapters) More...
 
static writeLayout ($a_obj_id, $a_layout, $a_lm=null)
 Write layout setting. More...
 
static lookupLayout ($a_obj_id)
 Lookup type. More...
 
static getPagesOfChapter ($a_lm_id, $a_chap_id)
 Get pages of chapter. More...
 
static _getAllLMObjectsOfLM ($a_lm_id, $a_type="")
 Get all objects of learning module. More...
 
static saveExportId ($a_lm_id, $a_lmobj_id, $a_exp_id, $a_type="pg")
 Save export id. More...
 
static getExportId ($a_lm_id, $a_lmobj_id, $a_type="pg")
 Get export ID. More...
 
static getDuplicateExportIDs ($a_lm_id, $a_type="pg")
 Get duplicate export IDs (count export ID usages) More...
 
static _getPresentationTitle ( $a_node, $a_mode=IL_PAGE_TITLE, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_force_content=false, $a_lm_id=0, $a_lang="-")
 Get affective title. More...
 
static getShortTitles ($a_lm_id, $a_lang="-")
 Get short titles. More...
 
static writeShortTitle ($a_id, $a_short_title, $a_lang="-")
 Write short title. More...
 

Data Fields

 $is_alias
 
 $origin_id
 
 $id
 
 $dom
 
 $page_object
 
- Data Fields inherited from ilLMObject
 $lm_id
 
 $type
 
 $id
 
 $meta_data
 
 $data_record
 
 $content_object
 
 $title
 
 $short_title
 
 $description
 
 $active = true
 

Additional Inherited Members

- Static Protected Member Functions inherited from ilLMObject
static _lookup ($a_obj_id, $a_field)
 Lookup title. More...
 
- Protected Attributes inherited from ilLMObject
 $user
 
 $db
 
- Static Protected Attributes inherited from ilLMObject
static $data_records = array()
 

Detailed Description

Class ilLMPageObject.

Handles Page Objects of ILIAS Learning Modules

Note: This class has a member variable that contains an instance of class ilPageObject and provides the method getPageObject() to access this instance. ilPageObject handles page objects and their content. Page objects can be assigned to different container like learning modules or glossaries definitions. This class, ilLMPageObject, provides additional methods for the handling of page objects in learning modules.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 29 of file class.ilLMPageObject.php.

Constructor & Destructor Documentation

◆ __construct()

ilLMPageObject::__construct ( $a_content_obj,
  $a_id = 0,
  $a_halt = true 
)

Constructor public.

Definition at line 41 of file class.ilLMPageObject.php.

References read(), and ilLMObject\setType().

42  {
43  parent::__construct($a_content_obj, $a_id);
44  $this->setType("pg");
45  $this->id = $a_id;
46 
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;
52 
53  if ($a_id != 0) {
54  $this->read();
55  }
56  }
setType($a_type)
+ Here is the call graph for this function:

Member Function Documentation

◆ __desctruct()

ilLMPageObject::__desctruct ( )

Definition at line 58 of file class.ilLMPageObject.php.

59  {
60  if (is_object($this->page_object)) {
61  unset($this->page_object);
62  }
63  }

◆ _exportXMLAlias()

static ilLMPageObject::_exportXMLAlias ( $a_xml_writer,
  $a_id,
  $a_inst = 0 
)
static

export page alias to xml

Definition at line 529 of file class.ilLMPageObject.php.

Referenced by ilStructureObject\exportXMLPageObjects().

530  {
531  $attrs = array();
532  $a_xml_writer->xmlStartTag("PageObject", $attrs);
533 
534  $attrs = array();
535  $attrs["OriginId"] = "il_" . $a_inst .
536  "_pg_" . $a_id;
537  $a_xml_writer->xmlElement("PageAlias", $attrs);
538 
539  $a_xml_writer->xmlEndTag("PageObject");
540  }
+ Here is the caller graph for this function:

◆ _getPresentationTitle()

static ilLMPageObject::_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 
)
static

presentation title doesn't have to be page title, it may be chapter title + page title or chapter title only, depending on settings

Parameters
string$a_modeIL_CHAPTER_TITLE | IL_PAGE_TITLE | IL_NO_HEADER

Definition at line 381 of file class.ilLMPageObject.php.

References ilLMObject\$active, $languages, ilLMObject\$title, $tree, ilStructureObject\_getPresentationTitle(), ilPageObject\_lookupActivationData(), ilPageObject\_lookupActive(), ilLMObject\_lookupContObjID(), ilLMObject\_lookupShortTitle(), ilLMObject\_lookupTitle(), ilObject\_lookupType(), ilLMTree\getInstance(), ilObjectTranslation\getInstance(), IL_CHAPTER_TITLE, IL_NO_HEADER, IL_PAGE_TITLE, and ilUtil\now().

Referenced by ilLMObject\_getPresentationTitle(), ilObjContentObjectGUI\addLocations(), ilContObjLocatorGUI\display(), ilLMPageObjectGUI\executeCommand(), exportFO(), ilObjContentObjectGUI\formatInvalidLinkArray(), ilLMTOCExplorerGUI\getNodeContent(), ilLMPresentationGUI\ilLMNavigation(), ilLMPresentationGUI\ilLMSubMenu(), ilLMPresentationGUI\ilPage(), ilGlossaryPresentationGUI\listDefinitions(), ilLMPresentationGUI\showPrintView(), and ilLMPresentationGUI\showPrintViewSelection().

390  {
391  if ($a_mode == IL_NO_HEADER && !$a_force_content) {
392  return "";
393  }
394 
395  if ($a_lm_id == 0) {
396  $a_lm_id = ilLMObject::_lookupContObjID($a_pg_id);
397  }
398 
399  if ($a_lm_id == 0) {
400  return "";
401  }
402 
403  // this is optimized when ilLMObject::preloadDataByLM is invoked (e.g. done in ilLMExplorerGUI)
404  $title = "";
405  if ($a_include_short) {
406  $title = trim(ilLMObject::_lookupShortTitle($a_pg_id));
407  }
408  if ($title == "") {
409  $title = ilLMObject::_lookupTitle($a_pg_id);
410  }
411 
412  // this is also optimized since ilObjectTranslation re-uses instances for one lm
413  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
414  $ot = ilObjectTranslation::getInstance($a_lm_id);
415  $languages = $ot->getLanguages();
416 
417  if ($a_lang != "-" && $ot->getContentActivated() && isset($languages[$a_lang])) {
418  include_once("./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
419  $lmobjtrans = new ilLMObjTranslation($a_pg_id, $a_lang);
420  $trans_title = "";
421  if ($a_include_short) {
422  $trans_title = trim($lmobjtrans->getShortTitle());
423  }
424  if ($trans_title == "") {
425  $trans_title = $lmobjtrans->getTitle();
426  }
427  if ($trans_title != "") {
428  $title = $trans_title;
429  }
430  }
431 
432  if ($a_mode == IL_PAGE_TITLE) {
433  return $title;
434  }
435 
436  include_once("./Modules/LearningModule/classes/class.ilLMTree.php");
437  $tree = ilLMTree::getInstance($a_lm_id);
438 
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");
442  $cnt_str = "";
443  if (count($childs) > 1) {
444  $cnt = 0;
445  foreach ($childs as $child) {
446  include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
448  $child["obj_id"],
449  ilObject::_lookupType($a_lm_id),
450  $a_time_scheduled_activation
451  );
452 
453  if (!$active) {
454  $act_data = ilLMPage::_lookupActivationData((int) $child["obj_id"], ilObject::_lookupType($a_lm_id));
455  if ($act_data["show_activation_info"] &&
456  (ilUtil::now() < $act_data["activation_start"])) {
457  $active = true;
458  }
459  }
460 
461  if ($child["type"] != "pg" || $active) {
462  $cnt++;
463  }
464  if ($child["obj_id"] == $a_pg_id) {
465  $cur_cnt = $cnt;
466  }
467  }
468  if ($cnt > 1) {
469  $cnt_str = " (" . $cur_cnt . "/" . $cnt . ")";
470  }
471  }
472  require_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
473  //$struct_obj = new ilStructureObject($pred_node["obj_id"]);
474  //return $struct_obj->getTitle();
476  $pred_node["obj_id"],
478  $a_include_numbers,
479  false,
480  false,
481  0,
482  $a_lang,
483  true
484  ) . $cnt_str;
485 
486  //return $pred_node["title"].$cnt_str;
487  } else {
488  return $title;
489  }
490  }
const IL_PAGE_TITLE
const IL_NO_HEADER
static _lookupShortTitle($a_obj_id)
Lookup short title.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
static _lookupTitle($a_obj_id)
Lookup title.
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
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static getInstance($a_tree_id)
Get Instance.
static _lookupType($a_id, $a_reference=false)
lookup object type
static _lookupActivationData($a_id, $a_parent_type, $a_lang="-")
Lookup activation data.
static getInstance($a_obj_id)
Get instance.
const IL_CHAPTER_TITLE
$languages
Definition: cssgen2.php:34
Translation information on lm object.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _splitPage()

static ilLMPageObject::_splitPage (   $a_page_id,
  $a_pg_parent_type,
  $a_hier_id 
)
static

split page at hierarchical id

the main reason for this method being static is that a lm page object is not available within ilPageContentGUI where this method is called

Definition at line 192 of file class.ilLMPageObject.php.

References ilLMObject\$lm_id, $tree, ilLMObject\$type, ilLMObject\_lookupContObjID(), ilObject\_lookupType(), and ilMD\cloneMD().

Referenced by ilPageContentGUI\splitPage().

193  {
194  // get content object (learning module / digilib book)
195  $lm_id = ilLMObject::_lookupContObjID($a_page_id);
197  include_once("./Modules/LearningModule/classes/class.ilObjLearningModule.php");
198  $cont_obj = new ilObjLearningModule($lm_id, false);
199  $source_lm_page = new ilLMPageObject($cont_obj, $a_page_id);
200 
201  // create new page
202  $lm_page = new ilLMPageObject($cont_obj);
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);
208 
209 
210  // copy complete content of source page to new page
211  $source_page = $source_lm_page->getPageObject();
212  $page = $lm_page->getPageObject();
213  $page->setXMLContent($source_page->copyXMLContent());
214  //echo htmlentities($source_page->copyXMLContent());
215  $page->buildDom(true);
216  $page->update();
217  // echo "-".$page->getId()."-".$page->getParentType()."-";
218 
219  // copy meta data
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());
223 
224  // insert new page in tree (after original page)
225  $tree = new ilTree($cont_obj->getId());
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());
231  }
232 
233  // remove all nodes < hierarchical id from new page (incl. update)
234  $page->addHierIds();
235  $page->deleteContentBeforeHierId($a_hier_id);
236  // $page->update();
237 
238  // remove all nodes >= hierarchical id from source page
239  $source_page->buildDom();
240  $source_page->addHierIds();
241  $source_page->deleteContentFromHierId($a_hier_id);
242 
243  return $lm_page;
244  }
& cloneMD($a_rbac_id, $a_obj_id, $a_obj_type)
Definition: class.ilMD.php:326
Class ilObjLearningModule.
static _lookupContObjID($a_id)
get learning module / digibook id for lm object
Class ilLMPageObject.
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
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _splitPageNext()

static ilLMPageObject::_splitPageNext (   $a_page_id,
  $a_pg_parent_type,
  $a_hier_id 
)
static

split page to next page at hierarchical id

the main reason for this method being static is that a lm page object is not available within ilPageContentGUI where this method is called

Definition at line 253 of file class.ilLMPageObject.php.

References ilLMObject\$lm_id, $tree, ilLMObject\$type, ilLMObject\_lookupContObjID(), ilObject\_lookupType(), and ilPageObject\_moveContentAfterHierId().

Referenced by ilPageContentGUI\splitPageNext().

254  {
255  // get content object (learning module / digilib book)
256  $lm_id = ilLMObject::_lookupContObjID($a_page_id);
258  include_once("./Modules/LearningModule/classes/class.ilObjLearningModule.php");
259  $cont_obj = new ilObjLearningModule($lm_id, false);
260  $tree = new ilTree($cont_obj->getId());
261  $tree->setTableNames('lm_tree', 'lm_data');
262  $tree->setTreeTablePK("lm_id");
263 
264  $source_lm_page = new ilLMPageObject($cont_obj, $a_page_id);
265  $source_page = $source_lm_page->getPageObject();
266 
267  // get next page
268  $succ = $tree->fetchSuccessorNode($a_page_id, "pg");
269  if ($succ["child"] > 0) {
270  $target_lm_page = new ilLMPageObject($cont_obj, $succ["child"]);
271  $target_page = $target_lm_page->getPageObject();
272  $target_page->buildDom();
273  $target_page->addHierIds();
274 
275  // move nodes to target page
276  $source_page->buildDom();
277  $source_page->addHierIds();
278  ilLMPage::_moveContentAfterHierId($source_page, $target_page, $a_hier_id);
279  //$source_page->deleteContentFromHierId($a_hier_id);
280 
281  return $succ["child"];
282  }
283  }
Class ilObjLearningModule.
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
Class ilLMPageObject.
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
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignPageObject()

ilLMPageObject::assignPageObject ( $a_page_obj)

assign page object

Parameters
object$a_page_objpage object

Definition at line 291 of file class.ilLMPageObject.php.

292  {
293  $this->page_object = $a_page_obj;
294  }

◆ copy()

ilLMPageObject::copy (   $a_target_lm)

copy page

Definition at line 99 of file class.ilLMPageObject.php.

References ilLMObjTranslation\copy(), ilLMObject\existsExportID(), ilLMObject\getDescription(), ilLMObject\getExportId(), getId(), ilLMObject\getLayout(), ilLMObject\getLMId(), ilLMObject\getShortTitle(), ilLMObject\getTitle(), ilLMObject\getType(), and ilLMObject\saveExportId().

100  {
101  // copy page
102  $lm_page = new ilLMPageObject($a_target_lm);
103  $lm_page->setTitle($this->getTitle());
104  $lm_page->setShortTitle($this->getShortTitle());
105  $lm_page->setLayout($this->getLayout());
106  $lm_page->setLMId($a_target_lm->getId());
107  $lm_page->setType($this->getType());
108  $lm_page->setDescription($this->getDescription());
109  $lm_page->setImportId("il__pg_" . $this->getId());
110  $lm_page->create(true); // setting "upload" flag to true prevents creating of meta data
111 
112  // check whether export id already exists in the target lm
113  $del_exp_id = false;
114  $exp_id = ilLMPageObject::getExportId($this->getLMId(), $this->getId());
115  if (trim($exp_id) != "") {
116  if (ilLMPageObject::existsExportID($a_target_lm->getId(), $exp_id)) {
117  $del_exp_id = true;
118  }
119  }
120 
121  // copy meta data
122  include_once("Services/MetaData/classes/class.ilMD.php");
123  $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
124  $new_md = $md->cloneMD($a_target_lm->getId(), $lm_page->getId(), $this->getType());
125 
126  // check whether export id already exists in the target lm
127  if ($del_exp_id) {
128  ilLMPageObject::saveExportId($a_target_lm->getId(), $lm_page->getId(), "");
129  } else {
131  $a_target_lm->getId(),
132  $lm_page->getId(),
133  trim($exp_id)
134  );
135  }
136 
137  // copy page content and activation
138  $page = $lm_page->getPageObject();
139  $this->page_object->copy($page->getId(), $page->getParentType(), $page->getParentId());
140  /*$page->setXMLContent($this->page_object->copyXMLContent());
141  $page->setActive($this->page_object->getActive());
142  $page->setActivationStart($this->page_object->getActivationStart());
143  $page->setActivationEnd($this->page_object->getActivationEnd());
144  $page->buildDom();
145  $page->update();*/
146  $lm_page->read(); // this gets the updated page object into lm page
147 
148  // copy translations
149  include_once("./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
150  ilLMObjTranslation::copy($this->getId(), $lm_page->getId());
151 
152  return $lm_page;
153  }
getShortTitle()
get short title of lm object
static saveExportId($a_lm_id, $a_lmobj_id, $a_exp_id, $a_type="pg")
Save export id.
existsExportID($a_lm_id, $a_exp_id, $a_type="pg")
Does export ID exist in lm?
getLayout()
Get layout.
Class ilLMPageObject.
static getExportId($a_lm_id, $a_lmobj_id, $a_type="pg")
Get export ID.
getTitle()
get title of lm object
static copy($a_source_id, $a_target_id)
Copy all translations of an object.
+ Here is the call graph for this function:

◆ copyToOtherContObject()

& ilLMPageObject::copyToOtherContObject ( $a_cont_obj,
$a_copied_nodes 
)

copy a page to another content object (learning module / dlib book)

Definition at line 158 of file class.ilLMPageObject.php.

References ilLMObject\getDescription(), getId(), ilLMObject\getLMId(), ilLMObject\getShortTitle(), ilLMObject\getTitle(), and ilLMObject\getType().

159  {
160  // copy page
161  $lm_page = new ilLMPageObject($a_cont_obj);
162  $lm_page->setTitle($this->getTitle());
163  $lm_page->setShortTitle($this->getShortTitle());
164  $lm_page->setLMId($a_cont_obj->getId());
165  $lm_page->setImportId("il__pg_" . $this->getId());
166  $lm_page->setType($this->getType());
167  $lm_page->setDescription($this->getDescription());
168  $lm_page->create(true); // setting "upload" flag to true prevents creating of meta data
169  $a_copied_nodes[$this->getId()] = $lm_page->getId();
170 
171  // copy meta data
172  include_once("Services/MetaData/classes/class.ilMD.php");
173  $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
174  $new_md = $md->cloneMD($a_cont_obj->getId(), $lm_page->getId(), $this->getType());
175 
176  // copy page content
177  $page = $lm_page->getPageObject();
178  $page->setXMLContent($this->page_object->getXMLContent());
179  $page->buildDom();
180  $page->update();
181 
182  return $lm_page;
183  }
getShortTitle()
get short title of lm object
Class ilLMPageObject.
getTitle()
get title of lm object
+ Here is the call graph for this function:

◆ create()

ilLMPageObject::create (   $a_upload = false,
  $a_omit_page_object_creation = false 
)

Definition at line 75 of file class.ilLMPageObject.php.

References getId(), and ilLMObject\getLMId().

76  {
77  parent::create($a_upload);
78  if ($a_omit_page_object_creation) {
79  return;
80  }
81  if (!is_object($this->page_object)) {
82  $this->page_object = new ilLMPage();
83  }
84  $this->page_object->setId($this->getId());
85  $this->page_object->setParentId($this->getLMId());
86  $this->page_object->create($a_upload);
87  }
Extension of ilPageObject for learning modules.
+ Here is the call graph for this function:

◆ delete()

ilLMPageObject::delete (   $a_delete_meta_data = true)

Definition at line 89 of file class.ilLMPageObject.php.

90  {
91  parent::delete($a_delete_meta_data);
92  $this->page_object->delete();
93  }

◆ exportFO()

ilLMPageObject::exportFO ( $a_xml_writer)

export page object to fo

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

Definition at line 634 of file class.ilLMPageObject.php.

References ilLMObject\$title, _getPresentationTitle(), and getId().

635  {
637  if ($title != "") {
638  $attrs = array();
639  $attrs["font-family"] = "Times";
640  $attrs["font-size"] = "14pt";
641  $a_xml_writer->xmlElement("fo:block", $attrs, $title);
642  }
643 
644  // PageContent
645  $this->page_object->buildDom();
646  $fo = $this->page_object->getFO();
647  $a_xml_writer->appendXML($fo);
648  }
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&#39;t have to be page title, it may be chapter title + page title or chapter tit...
+ Here is the call graph for this function:

◆ exportXML()

ilLMPageObject::exportXML ( $a_xml_writer,
  $a_mode = "normal",
  $a_inst = 0 
)

export page object to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

Definition at line 498 of file class.ilLMPageObject.php.

References exportXMLMetaData(), exportXMLPageContent(), and getId().

499  {
500  $attrs = array();
501  $a_xml_writer->xmlStartTag("PageObject", $attrs);
502 
503  switch ($a_mode) {
504  case "normal":
505  // MetaData
506  $this->exportXMLMetaData($a_xml_writer);
507 
508  // PageContent
509  $this->exportXMLPageContent($a_xml_writer, $a_inst);
510  break;
511 
512  case "alias":
513  $attrs = array();
514  $attrs["OriginId"] = "il_" . $a_inst .
515  "_pg_" . $this->getId();
516  $a_xml_writer->xmlElement("PageAlias", $attrs);
517  break;
518  }
519 
520  // Layout
521  // not implemented
522 
523  $a_xml_writer->xmlEndTag("PageObject");
524  }
exportXMLMetaData(&$a_xml_writer)
export page objects meta data to xml (see ilias_co.dtd)
exportXMLPageContent(&$a_xml_writer, $a_inst=0)
export page objects meta data to xml (see ilias_co.dtd)
+ Here is the call graph for this function:

◆ exportXMLMetaData()

ilLMPageObject::exportXMLMetaData ( $a_xml_writer)

export page objects meta data to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

Definition at line 549 of file class.ilLMPageObject.php.

References getId(), ilLMObject\getLMId(), and ilLMObject\getType().

Referenced by exportXML().

550  {
551  include_once("Services/MetaData/classes/class.ilMD2XML.php");
552  $md2xml = new ilMD2XML($this->getLMId(), $this->getId(), $this->getType());
553  $md2xml->setExportMode(true);
554  $md2xml->startExport();
555  $a_xml_writer->appendXML($md2xml->getXML());
556  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXMLPageContent()

ilLMPageObject::exportXMLPageContent ( $a_xml_writer,
  $a_inst = 0 
)

export page objects meta data to xml (see ilias_co.dtd)

Parameters
object$a_xml_writerilXmlWriter object that receives the xml data

Definition at line 575 of file class.ilLMPageObject.php.

References $xml, ilPCFileList\collectFileItems(), and ilLMObject\getContentObject().

Referenced by exportXML().

576  {
577  //echo "exportxmlpagecontent:$a_inst:<br>";
578  $cont_obj = $this->getContentObject();
579 
580  $this->page_object->buildDom();
581  $this->page_object->insertInstIntoIDs($a_inst);
582  $this->mobs_contained = $this->page_object->collectMediaObjects(false);
583  //$this->files_contained = $this->page_object->collectFileItems();
584  include_once("./Services/COPage/classes/class.ilPCFileList.php");
585  $this->files_contained = ilPCFileList::collectFileItems($this->page_object, $this->page_object->getDomDoc());
586  // $this->questions_contained = $this->page_object->getQuestionIds();
587  $xml = $this->page_object->getXMLFromDom(false, false, false, "", true);
588  $xml = str_replace("&", "&amp;", $xml);
589  $a_xml_writer->appendXML($xml);
590 
591  $this->page_object->freeDom();
592  }
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFileItemIds()

ilLMPageObject::getFileItemIds ( )

get ids of all file items within the page

note: this method must be called afer exportXMLPageContent

Definition at line 623 of file class.ilLMPageObject.php.

624  {
625  return $this->files_contained;
626  }

◆ getId()

ilLMPageObject::getId ( )

Definition at line 316 of file class.ilLMPageObject.php.

References $id.

Referenced by copy(), copyToOtherContObject(), create(), exportFO(), exportXML(), exportXMLMetaData(), getQuestionIds(), and modifyExportIdentifier().

317  {
318  return $this->id;
319  }
+ Here is the caller graph for this function:

◆ getMediaObjectIds()

ilLMPageObject::getMediaObjectIds ( )

get ids of all media objects within the page

note: this method must be called afer exportXMLPageContent

Definition at line 613 of file class.ilLMPageObject.php.

614  {
615  return $this->mobs_contained;
616  }

◆ getOriginID()

ilLMPageObject::getOriginID ( )

Definition at line 341 of file class.ilLMPageObject.php.

References $origin_id.

342  {
343  return $this->origin_id;
344  }

◆ getPageList()

◆ getPageObject()

& ilLMPageObject::getPageObject ( )

get assigned page object

Returns
object page object

Definition at line 302 of file class.ilLMPageObject.php.

References $page_object.

303  {
304  return $this->page_object;
305  }

◆ getPagesWithLinksList()

static ilLMPageObject::getPagesWithLinksList (   $a_lm_id,
  $a_par_type 
)
static

Get all pages of lm that contain any internal links.

Definition at line 357 of file class.ilLMPageObject.php.

References $result, getPageList(), and ilPageObject\getPagesWithLinks().

Referenced by ilLinksTableGUI\getLinks().

358  {
359  $pages = ilLMPageObject::getPageList($a_lm_id);
360  $ids = array();
361  foreach ($pages as $page) {
362  $ids[] = $page["obj_id"];
363  }
364 
365  $linked_pages = ilLMPage::getPagesWithLinks($a_par_type, $a_lm_id);
366  $result = array();
367  foreach ($pages as $page) {
368  if (is_array($linked_pages[$page["obj_id"]])) {
369  $result[] = $page;
370  }
371  }
372  return $result;
373  }
$result
static getPagesWithLinks($a_parent_type, $a_parent_id, $a_lang="-")
Get all pages for parent object that contain internal links.
static getPageList($lm_id)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionIds()

ilLMPageObject::getQuestionIds ( )

Get question ids.

note: this method must be called afer exportXMLPageContent

Definition at line 599 of file class.ilLMPageObject.php.

References ilPCQuestion\_getQuestionIdsForPage(), and getId().

600  {
601  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
603  $this->content_object->getType(),
604  $this->getId()
605  );
606  }
static _getQuestionIdsForPage($a_parent_type, $a_page_id, $a_lang="-")
Get all questions of a page.
+ Here is the call graph for this function:

◆ isAlias()

ilLMPageObject::isAlias ( )

Definition at line 329 of file class.ilLMPageObject.php.

References $is_alias.

330  {
331  return $this->is_alias;
332  }

◆ modifyExportIdentifier()

ilLMPageObject::modifyExportIdentifier (   $a_tag,
  $a_param,
  $a_value 
)

Definition at line 558 of file class.ilLMPageObject.php.

References getId().

559  {
560  if ($a_tag == "Identifier" && $a_param == "Entry") {
561  $a_value = "il_" . IL_INST_ID . "_pg_" . $this->getId();
562  //$a_value = ilUtil::insertInstIntoID($a_value);
563  }
564 
565  return $a_value;
566  }
+ Here is the call graph for this function:

◆ queryQuestionsOfLearningModule()

static ilLMPageObject::queryQuestionsOfLearningModule (   $a_lm_id,
  $a_order_field,
  $a_order_dir,
  $a_offset,
  $a_limit 
)
static

Get questions of learning module.

Parameters

Definition at line 656 of file class.ilLMPageObject.php.

References $DIC, $from, $ilDB, $query, and $result.

Referenced by ilLMTracker\getBlockedUsersInformation(), ilLMQuestionListTableGUI\getItems(), and ilLMTracker\loadLMTrackingData().

662  {
663  global $DIC;
664 
665  $ilDB = $DIC->database();
666  $rbacreview = $DIC->rbac()->review();
667 
668 
669  // count query
670  $count_query = "SELECT count(pq.question_id) cnt ";
671 
672  // basic query
673  $query = "SELECT pq.page_id, pq.question_id ";
674 
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;
679  $query .= $from;
680 
681 
682  // count query
683  $set = $ilDB->query($count_query);
684  $cnt = 0;
685  if ($rec = $ilDB->fetchAssoc($set)) {
686  $cnt = $rec["cnt"];
687  }
688 
689  $offset = (int) $a_offset;
690  $limit = (int) $a_limit;
691  if ($a_limit > 0) {
692  $ilDB->setLimit($limit, $offset);
693  }
694 
695  // set query
696  $set = $ilDB->query($query);
697  $result = array();
698  while ($rec = $ilDB->fetchAssoc($set)) {
699  $result[] = $rec;
700  }
701  return array("cnt" => $cnt, "set" => $result);
702  }
$result
global $DIC
Definition: saml.php:7
$from
$query
global $ilDB
+ Here is the caller graph for this function:

◆ read()

ilLMPageObject::read ( )

Definition at line 68 of file class.ilLMPageObject.php.

Referenced by __construct().

69  {
70  parent::read();
71 
72  $this->page_object = new ilLMPage($this->id, 0);
73  }
Extension of ilPageObject for learning modules.
+ Here is the caller graph for this function:

◆ setAlias()

ilLMPageObject::setAlias (   $a_is_alias)

set wether page object is an alias

Definition at line 324 of file class.ilLMPageObject.php.

325  {
326  $this->is_alias = $a_is_alias;
327  }

◆ setId()

ilLMPageObject::setId (   $a_id)

set id

Definition at line 311 of file class.ilLMPageObject.php.

312  {
313  $this->id = $a_id;
314  }

◆ setOriginID()

ilLMPageObject::setOriginID (   $a_id)

Definition at line 335 of file class.ilLMPageObject.php.

336  {
337  return $this->origin_id = $a_id;
338  }

Field Documentation

◆ $dom

ilLMPageObject::$dom

Definition at line 34 of file class.ilLMPageObject.php.

◆ $id

ilLMPageObject::$id

Definition at line 33 of file class.ilLMPageObject.php.

Referenced by getId().

◆ $is_alias

ilLMPageObject::$is_alias

Definition at line 31 of file class.ilLMPageObject.php.

Referenced by isAlias().

◆ $origin_id

ilLMPageObject::$origin_id

Definition at line 32 of file class.ilLMPageObject.php.

Referenced by getOriginID().

◆ $page_object

ilLMPageObject::$page_object

Definition at line 35 of file class.ilLMPageObject.php.

Referenced by getPageObject().


The documentation for this class was generated from the following file: