ILIAS  release_7 Revision v7.30-3-g800a261c036
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, $a_layout_id=0)
 
 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=self::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 insertPagesFromTemplate ($lm_id, $num, $node_id, $first_child, $layout_id, $title="")
 Insert (multiple) pages templates at node. 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=self::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
const CHAPTER_TITLE = "st_title"
 
const PAGE_TITLE = "pg_title"
 
const NO_HEADER = "none"
 
 $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 22 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 34 of file class.ilLMPageObject.php.

References ILIAS\GlobalScreen\Provider\__construct(), read(), and ilLMObject\setType().

35  {
36  parent::__construct($a_content_obj, $a_id);
37  $this->setType("pg");
38  $this->id = $a_id;
39 
40  $this->is_alias = false;
41  $this->contains_int_link = false;
42  $this->mobs_contained = array();
43  $this->files_contained = array();
44  $this->halt_on_error = $a_halt;
45 
46  if ($a_id != 0) {
47  $this->read();
48  }
49  }
setType($a_type)
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ __desctruct()

ilLMPageObject::__desctruct ( )

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

52  {
53  if (is_object($this->page_object)) {
54  unset($this->page_object);
55  }
56  }

◆ _exportXMLAlias()

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

export page alias to xml

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

Referenced by ilStructureObject\exportXMLPageObjects().

510  {
511  $attrs = array();
512  $a_xml_writer->xmlStartTag("PageObject", $attrs);
513 
514  $attrs = array();
515  $attrs["OriginId"] = "il_" . $a_inst .
516  "_pg_" . $a_id;
517  $a_xml_writer->xmlElement("PageAlias", $attrs);
518 
519  $a_xml_writer->xmlEndTag("PageObject");
520  }
+ Here is the caller graph for this function:

◆ _getPresentationTitle()

static ilLMPageObject::_getPresentationTitle (   $a_pg_id,
  $a_mode = self::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_modeilLMOBject::CHAPTER_TITLE | ilLMOBject::PAGE_TITLE | ilLMOBject::NO_HEADER

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

References ilLMObject\$active, ilLMObject\$title, ilStructureObject\_getPresentationTitle(), ilPageObject\_lookupActivationData(), ilPageObject\_lookupActive(), ilLMObject\_lookupContObjID(), ilLMObject\_lookupShortTitle(), ilLMObject\_lookupTitle(), ilObject\_lookupType(), ilLMTree\getInstance(), ilObjectTranslation\getInstance(), ilLMObjTranslation\getTitle(), and ilUtil\now().

Referenced by ilLMObject\_getPresentationTitle(), ilObjContentObjectGUI\addLocations(), ilContObjLocatorGUI\display(), ilLMPageObjectGUI\executeCommand(), exportFO(), ilObjContentObjectGUI\formatInvalidLinkArray(), ilLMTOCExplorerGUI\getNodeContent(), ilLearningModuleNotification\getPageTitle(), ilGlossaryPresentationGUI\listDefinitions(), ilLMNavigationRendererGUI\render(), ilLMContentRendererGUI\render(), ilLMPresentationGUI\showPrintView(), and ilLMPresentationGUI\showPrintViewSelection().

375  {
376  if ($a_mode == self::NO_HEADER && !$a_force_content) {
377  return "";
378  }
379 
380  if ($a_lm_id == 0) {
381  $a_lm_id = ilLMObject::_lookupContObjID($a_pg_id);
382  }
383 
384  if ($a_lm_id == 0) {
385  return "";
386  }
387 
388  // this is optimized when ilLMObject::preloadDataByLM is invoked (e.g. done in ilLMExplorerGUI)
389  $title = "";
390  if ($a_include_short) {
391  $title = trim(ilLMObject::_lookupShortTitle($a_pg_id));
392  }
393  if ($title == "") {
394  $title = ilLMObject::_lookupTitle($a_pg_id);
395  }
396 
397  // this is also optimized since ilObjectTranslation re-uses instances for one lm
398  $ot = ilObjectTranslation::getInstance($a_lm_id);
399  $languages = $ot->getLanguages();
400 
401  if ($a_lang != "-" && $ot->getContentActivated()) {
402  $lmobjtrans = new ilLMObjTranslation($a_pg_id, $a_lang);
403  $trans_title = "";
404  if ($a_include_short) {
405  $trans_title = trim($lmobjtrans->getShortTitle());
406  }
407  if ($trans_title == "") {
408  $trans_title = $lmobjtrans->getTitle();
409  }
410  if ($trans_title == "") {
411  $lmobjtrans = new ilLMObjTranslation($a_pg_id, $ot->getFallbackLanguage());
412  $trans_title = $lmobjtrans->getTitle();
413  }
414  if ($trans_title != "") {
415  $title = $trans_title;
416  }
417  }
418 
419  if ($a_mode == self::PAGE_TITLE) {
420  return $title;
421  }
422 
423  $tree = ilLMTree::getInstance($a_lm_id);
424 
425  if ($tree->isInTree($a_pg_id)) {
426  $pred_node = $tree->fetchPredecessorNode($a_pg_id, "st");
427  $childs = $tree->getChildsByType($pred_node["obj_id"], "pg");
428  $cnt_str = "";
429  if (count($childs) > 1) {
430  $cnt = 0;
431  foreach ($childs as $child) {
433  $child["obj_id"],
434  ilObject::_lookupType($a_lm_id),
435  $a_time_scheduled_activation
436  );
437 
438  if (!$active) {
439  $act_data = ilLMPage::_lookupActivationData((int) $child["obj_id"], ilObject::_lookupType($a_lm_id));
440  if ($act_data["show_activation_info"] &&
441  (ilUtil::now() < $act_data["activation_start"])) {
442  $active = true;
443  }
444  }
445 
446  if ($child["type"] != "pg" || $active) {
447  $cnt++;
448  }
449  if ($child["obj_id"] == $a_pg_id) {
450  $cur_cnt = $cnt;
451  }
452  }
453  if ($cnt > 1) {
454  $cnt_str = " (" . $cur_cnt . "/" . $cnt . ")";
455  }
456  }
458  $pred_node["obj_id"],
459  self::CHAPTER_TITLE,
460  $a_include_numbers,
461  false,
462  false,
463  0,
464  $a_lang,
465  true
466  ) . $cnt_str;
467  } else {
468  return $title;
469  }
470  }
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 _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static getInstance($a_tree_id)
Get Instance.
static _getPresentationTitle( $a_st_id, $a_mode=self::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 _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.
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 180 of file class.ilLMPageObject.php.

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

Referenced by ilPageContentGUI\splitPage().

181  {
182  // get content object (learning module / digilib book)
183  $lm_id = ilLMObject::_lookupContObjID($a_page_id);
185  $cont_obj = new ilObjLearningModule($lm_id, false);
186  $source_lm_page = new ilLMPageObject($cont_obj, $a_page_id);
187 
188  // create new page
189  $lm_page = new ilLMPageObject($cont_obj);
190  $lm_page->setTitle($source_lm_page->getTitle());
191  $lm_page->setLMId($source_lm_page->getLMId());
192  $lm_page->setType($source_lm_page->getType());
193  $lm_page->setDescription($source_lm_page->getDescription());
194  $lm_page->create(true);
195 
196 
197  // copy complete content of source page to new page
198  $source_page = $source_lm_page->getPageObject();
199  $page = $lm_page->getPageObject();
200  $page->setXMLContent($source_page->copyXMLContent());
201  //echo htmlentities($source_page->copyXMLContent());
202  $page->buildDom(true);
203  $page->update();
204  // echo "-".$page->getId()."-".$page->getParentType()."-";
205 
206  // copy meta data
207  $md = new ilMD($source_lm_page->getLMId(), $a_page_id, $source_lm_page->getType());
208  $md->cloneMD($source_lm_page->getLMId(), $lm_page->getId(), $source_lm_page->getType());
209 
210  // insert new page in tree (after original page)
211  $tree = new ilTree($cont_obj->getId());
212  $tree->setTableNames('lm_tree', 'lm_data');
213  $tree->setTreeTablePK("lm_id");
214  if ($tree->isInTree($source_lm_page->getId())) {
215  $parent_node = $tree->getParentNodeData($source_lm_page->getId());
216  $tree->insertNode($lm_page->getId(), $parent_node["child"], $source_lm_page->getId());
217  }
218 
219  // remove all nodes < hierarchical id from new page (incl. update)
220  $page->addHierIds();
221  $page->deleteContentBeforeHierId($a_hier_id);
222  // $page->update();
223 
224  // remove all nodes >= hierarchical id from source page
225  $source_page->buildDom();
226  $source_page->addHierIds();
227  $source_page->deleteContentFromHierId($a_hier_id);
228 
229  return $lm_page;
230  }
& 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.
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 239 of file class.ilLMPageObject.php.

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

Referenced by ilPageContentGUI\splitPageNext().

240  {
241  // get content object (learning module / digilib book)
242  $lm_id = ilLMObject::_lookupContObjID($a_page_id);
244  $cont_obj = new ilObjLearningModule($lm_id, false);
245  $tree = new ilTree($cont_obj->getId());
246  $tree->setTableNames('lm_tree', 'lm_data');
247  $tree->setTreeTablePK("lm_id");
248 
249  $source_lm_page = new ilLMPageObject($cont_obj, $a_page_id);
250  $source_page = $source_lm_page->getPageObject();
251 
252  // get next page
253  $succ = $tree->fetchSuccessorNode($a_page_id, "pg");
254  if ($succ["child"] > 0) {
255  $target_lm_page = new ilLMPageObject($cont_obj, $succ["child"]);
256  $target_page = $target_lm_page->getPageObject();
257  $target_page->buildDom();
258  $target_page->addHierIds();
259 
260  // move nodes to target page
261  $source_page->buildDom();
262  $source_page->addHierIds();
263  ilLMPage::_moveContentAfterHierId($source_page, $target_page, $a_hier_id);
264  //$source_page->deleteContentFromHierId($a_hier_id);
265 
266  return $succ["child"];
267  }
268  }
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.
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 276 of file class.ilLMPageObject.php.

277  {
278  $this->page_object = $a_page_obj;
279  }

◆ copy()

ilLMPageObject::copy (   $a_target_lm)

copy page

Definition at line 96 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().

97  {
98  // copy page
99  $lm_page = new ilLMPageObject($a_target_lm);
100  $lm_page->setTitle($this->getTitle());
101  $lm_page->setShortTitle($this->getShortTitle());
102  $lm_page->setLayout($this->getLayout());
103  $lm_page->setLMId($a_target_lm->getId());
104  $lm_page->setType($this->getType());
105  $lm_page->setDescription($this->getDescription());
106  $lm_page->setImportId("il__pg_" . $this->getId());
107  $lm_page->create(true); // setting "upload" flag to true prevents creating of meta data
108 
109  // check whether export id already exists in the target lm
110  $del_exp_id = false;
111  $exp_id = ilLMPageObject::getExportId($this->getLMId(), $this->getId());
112  if (trim($exp_id) != "") {
113  if (ilLMPageObject::existsExportID($a_target_lm->getId(), $exp_id)) {
114  $del_exp_id = true;
115  }
116  }
117 
118  // copy meta data
119  $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
120  $new_md = $md->cloneMD($a_target_lm->getId(), $lm_page->getId(), $this->getType());
121 
122  // check whether export id already exists in the target lm
123  if ($del_exp_id) {
124  ilLMPageObject::saveExportId($a_target_lm->getId(), $lm_page->getId(), "");
125  } else {
127  $a_target_lm->getId(),
128  $lm_page->getId(),
129  trim($exp_id)
130  );
131  }
132 
133  // copy page content and activation
134  $page = $lm_page->getPageObject();
135  $this->page_object->copy($page->getId(), $page->getParentType(), $page->getParentId());
136  $lm_page->read(); // this gets the updated page object into lm page
137 
138  // copy translations
139  ilLMObjTranslation::copy($this->getId(), $lm_page->getId());
140 
141  return $lm_page;
142  }
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 147 of file class.ilLMPageObject.php.

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

148  {
149  // copy page
150  $lm_page = new ilLMPageObject($a_cont_obj);
151  $lm_page->setTitle($this->getTitle());
152  $lm_page->setShortTitle($this->getShortTitle());
153  $lm_page->setLMId($a_cont_obj->getId());
154  $lm_page->setImportId("il__pg_" . $this->getId());
155  $lm_page->setType($this->getType());
156  $lm_page->setDescription($this->getDescription());
157  $lm_page->create(true); // setting "upload" flag to true prevents creating of meta data
158  $a_copied_nodes[$this->getId()] = $lm_page->getId();
159 
160  // copy meta data
161  $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
162  $new_md = $md->cloneMD($a_cont_obj->getId(), $lm_page->getId(), $this->getType());
163 
164  // copy page content
165  $page = $lm_page->getPageObject();
166  $page->setXMLContent($this->page_object->getXMLContent());
167  $page->buildDom();
168  $page->update();
169 
170  return $lm_page;
171  }
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,
  $a_layout_id = 0 
)

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

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

69  {
70  parent::create($a_upload);
71  if ($a_omit_page_object_creation) {
72  return;
73  }
74  if (!is_object($this->page_object)) {
75  $this->page_object = new ilLMPage();
76  }
77  $this->page_object->setId($this->getId());
78  $this->page_object->setParentId($this->getLMId());
79  if ($a_layout_id == 0) {
80  $this->page_object->create($a_upload);
81  } else {
82  $this->page_object->createWithLayoutId($a_layout_id);
83  }
84  }
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 86 of file class.ilLMPageObject.php.

87  {
88  parent::delete($a_delete_meta_data);
89  $this->page_object->delete();
90  }

◆ 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 608 of file class.ilLMPageObject.php.

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

609  {
611  if ($title != "") {
612  $attrs = array();
613  $attrs["font-family"] = "Times";
614  $attrs["font-size"] = "14pt";
615  $a_xml_writer->xmlElement("fo:block", $attrs, $title);
616  }
617 
618  // PageContent
619  $this->page_object->buildDom();
620  $fo = $this->page_object->getFO();
621  $a_xml_writer->appendXML($fo);
622  }
static _getPresentationTitle( $a_pg_id, $a_mode=self::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 478 of file class.ilLMPageObject.php.

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

479  {
480  $attrs = array();
481  $a_xml_writer->xmlStartTag("PageObject", $attrs);
482 
483  switch ($a_mode) {
484  case "normal":
485  // MetaData
486  $this->exportXMLMetaData($a_xml_writer);
487 
488  // PageContent
489  $this->exportXMLPageContent($a_xml_writer, $a_inst);
490  break;
491 
492  case "alias":
493  $attrs = array();
494  $attrs["OriginId"] = "il_" . $a_inst .
495  "_pg_" . $this->getId();
496  $a_xml_writer->xmlElement("PageAlias", $attrs);
497  break;
498  }
499 
500  // Layout
501  // not implemented
502 
503  $a_xml_writer->xmlEndTag("PageObject");
504  }
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 529 of file class.ilLMPageObject.php.

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

Referenced by exportXML().

530  {
531  $md2xml = new ilMD2XML($this->getLMId(), $this->getId(), $this->getType());
532  $md2xml->setExportMode(true);
533  $md2xml->startExport();
534  $a_xml_writer->appendXML($md2xml->getXML());
535  }
+ 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 554 of file class.ilLMPageObject.php.

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

Referenced by exportXML().

555  {
556  $cont_obj = $this->getContentObject();
557 
558  $this->page_object->buildDom();
559  $this->page_object->insertInstIntoIDs($a_inst);
560  $this->mobs_contained = $this->page_object->collectMediaObjects(false);
561  $this->files_contained = ilPCFileList::collectFileItems($this->page_object, $this->page_object->getDomDoc());
562  $xml = $this->page_object->getXMLFromDom(false, false, false, "", true);
563  $xml = str_replace("&", "&amp;", $xml);
564  $a_xml_writer->appendXML($xml);
565 
566  $this->page_object->freeDom();
567  }
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
$xml
Definition: metadata.php:332
+ 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 597 of file class.ilLMPageObject.php.

598  {
599  return $this->files_contained;
600  }

◆ getId()

ilLMPageObject::getId ( )

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

References $id.

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

302  {
303  return $this->id;
304  }
+ 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 587 of file class.ilLMPageObject.php.

588  {
589  return $this->mobs_contained;
590  }

◆ getOriginID()

ilLMPageObject::getOriginID ( )

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

References $origin_id.

327  {
328  return $this->origin_id;
329  }

◆ getPageList()

◆ getPageObject()

& ilLMPageObject::getPageObject ( )

get assigned page object

Returns
object page object

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

References $page_object.

288  {
289  return $this->page_object;
290  }

◆ getPagesWithLinksList()

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

Get all pages of lm that contain any internal links.

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

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

Referenced by ilLinksTableGUI\getLinks().

343  {
344  $pages = ilLMPageObject::getPageList($a_lm_id);
345  $ids = array();
346  foreach ($pages as $page) {
347  $ids[] = $page["obj_id"];
348  }
349 
350  $linked_pages = ilLMPage::getPagesWithLinks($a_par_type, $a_lm_id);
351  $result = array();
352  foreach ($pages as $page) {
353  if (is_array($linked_pages[$page["obj_id"]])) {
354  $result[] = $page;
355  }
356  }
357  return $result;
358  }
$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 574 of file class.ilLMPageObject.php.

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

575  {
577  $this->content_object->getType(),
578  $this->getId()
579  );
580  }
static _getQuestionIdsForPage($a_parent_type, $a_page_id, $a_lang="-")
Get all questions of a page.
+ Here is the call graph for this function:

◆ insertPagesFromTemplate()

static ilLMPageObject::insertPagesFromTemplate (   $lm_id,
  $num,
  $node_id,
  $first_child,
  $layout_id,
  $title = "" 
)
static

Insert (multiple) pages templates at node.

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

References $DIC, $i, ilLMObject\$lm_id, $lng, ilLMObject\$title, IL_FIRST_NODE, and ilLMObject\putInTree().

Referenced by ilStructureObjectGUI\insertPageFromTemplate().

682  {
683  global $DIC;
684 
685  $lng = $DIC->language();
686 
687  if ($title == "") {
688  $title = $lng->txt("cont_new_page");
689  }
690  $lm_tree = new ilLMTree($lm_id);
691  $lm = new ilObjLearningModule($lm_id, false);
692  if (!$first_child) { // insert after node id
693  $parent_id = $lm_tree->getParentId($node_id);
694  $target = $node_id;
695  } else { // insert as first child
696  $parent_id = $node_id;
697  $target = IL_FIRST_NODE;
698  }
699 
700  $page_ids = array();
701  for ($i = 1; $i <= $num; $i++) {
702  $page = new ilLMPageObject($lm);
703  $page->setTitle($title);
704  $page->setLMId($lm->getId());
705  $page->create(false, false, $layout_id);
706  ilLMObject::putInTree($page, $parent_id, $target);
707  $page_ids[] = $page->getId();
708  }
709  $page_ids = array_reverse($page_ids);
710  return $page_ids;
711  }
Class ilObjLearningModule.
Class ilLMPageObject.
$lng
const IL_FIRST_NODE
Definition: class.ilTree.php:5
global $DIC
Definition: goto.php:24
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
$i
Definition: metadata.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAlias()

ilLMPageObject::isAlias ( )

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

References $is_alias.

315  {
316  return $this->is_alias;
317  }

◆ modifyExportIdentifier()

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

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

References getId(), and IL_INST_ID.

538  {
539  if ($a_tag == "Identifier" && $a_param == "Entry") {
540  $a_value = "il_" . IL_INST_ID . "_pg_" . $this->getId();
541  //$a_value = ilUtil::insertInstIntoID($a_value);
542  }
543 
544  return $a_value;
545  }
const IL_INST_ID
Definition: constants.php:38
+ 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 630 of file class.ilLMPageObject.php.

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

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

636  {
637  global $DIC;
638 
639  $ilDB = $DIC->database();
640  $rbacreview = $DIC->rbac()->review();
641 
642 
643  // count query
644  $count_query = "SELECT count(pq.question_id) cnt ";
645 
646  // basic query
647  $query = "SELECT pq.page_id, pq.question_id ";
648 
649  $from = " FROM page_question pq JOIN lm_tree t ON (t.lm_id = " . $ilDB->quote($a_lm_id, "integer") .
650  " AND pq.page_id = t.child and pq.page_parent_type = " . $ilDB->quote("lm", "text") . ") " .
651  " WHERE t.lm_id = " . $ilDB->quote($a_lm_id, "integer");
652  $count_query .= $from;
653  $query .= $from;
654 
655 
656  // count query
657  $set = $ilDB->query($count_query);
658  $cnt = 0;
659  if ($rec = $ilDB->fetchAssoc($set)) {
660  $cnt = $rec["cnt"];
661  }
662 
663  $offset = (int) $a_offset;
664  $limit = (int) $a_limit;
665  if ($a_limit > 0) {
666  $ilDB->setLimit($limit, $offset);
667  }
668 
669  // set query
670  $set = $ilDB->query($query);
671  $result = array();
672  while ($rec = $ilDB->fetchAssoc($set)) {
673  $result[] = $rec;
674  }
675  return array("cnt" => $cnt, "set" => $result);
676  }
$result
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ read()

ilLMPageObject::read ( )

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

Referenced by __construct().

62  {
63  parent::read();
64 
65  $this->page_object = new ilLMPage($this->id, 0);
66  }
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 309 of file class.ilLMPageObject.php.

310  {
311  $this->is_alias = $a_is_alias;
312  }

◆ setId()

ilLMPageObject::setId (   $a_id)

set id

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

297  {
298  $this->id = $a_id;
299  }

◆ setOriginID()

ilLMPageObject::setOriginID (   $a_id)

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

321  {
322  return $this->origin_id = $a_id;
323  }

Field Documentation

◆ $dom

ilLMPageObject::$dom

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

◆ $id

ilLMPageObject::$id

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

Referenced by getId().

◆ $is_alias

ilLMPageObject::$is_alias

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

Referenced by isAlias().

◆ $origin_id

ilLMPageObject::$origin_id

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

Referenced by getOriginID().

◆ $page_object

ilLMPageObject::$page_object

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

Referenced by getPageObject().


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