ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
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 505 of file class.ilLMPageObject.php.

Referenced by ilStructureObject\exportXMLPageObjects().

506  {
507  $attrs = array();
508  $a_xml_writer->xmlStartTag("PageObject", $attrs);
509 
510  $attrs = array();
511  $attrs["OriginId"] = "il_" . $a_inst .
512  "_pg_" . $a_id;
513  $a_xml_writer->xmlElement("PageAlias", $attrs);
514 
515  $a_xml_writer->xmlEndTag("PageObject");
516  }
+ 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(), 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() && isset($languages[$a_lang])) {
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  $title = $trans_title;
412  }
413  }
414 
415  if ($a_mode == self::PAGE_TITLE) {
416  return $title;
417  }
418 
419  $tree = ilLMTree::getInstance($a_lm_id);
420 
421  if ($tree->isInTree($a_pg_id)) {
422  $pred_node = $tree->fetchPredecessorNode($a_pg_id, "st");
423  $childs = $tree->getChildsByType($pred_node["obj_id"], "pg");
424  $cnt_str = "";
425  if (count($childs) > 1) {
426  $cnt = 0;
427  foreach ($childs as $child) {
429  $child["obj_id"],
430  ilObject::_lookupType($a_lm_id),
431  $a_time_scheduled_activation
432  );
433 
434  if (!$active) {
435  $act_data = ilLMPage::_lookupActivationData((int) $child["obj_id"], ilObject::_lookupType($a_lm_id));
436  if ($act_data["show_activation_info"] &&
437  (ilUtil::now() < $act_data["activation_start"])) {
438  $active = true;
439  }
440  }
441 
442  if ($child["type"] != "pg" || $active) {
443  $cnt++;
444  }
445  if ($child["obj_id"] == $a_pg_id) {
446  $cur_cnt = $cnt;
447  }
448  }
449  if ($cnt > 1) {
450  $cnt_str = " (" . $cur_cnt . "/" . $cnt . ")";
451  }
452  }
454  $pred_node["obj_id"],
455  self::CHAPTER_TITLE,
456  $a_include_numbers,
457  false,
458  false,
459  0,
460  $a_lang,
461  true
462  ) . $cnt_str;
463  } else {
464  return $title;
465  }
466  }
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 604 of file class.ilLMPageObject.php.

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

605  {
607  if ($title != "") {
608  $attrs = array();
609  $attrs["font-family"] = "Times";
610  $attrs["font-size"] = "14pt";
611  $a_xml_writer->xmlElement("fo:block", $attrs, $title);
612  }
613 
614  // PageContent
615  $this->page_object->buildDom();
616  $fo = $this->page_object->getFO();
617  $a_xml_writer->appendXML($fo);
618  }
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 474 of file class.ilLMPageObject.php.

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

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

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

Referenced by exportXML().

526  {
527  $md2xml = new ilMD2XML($this->getLMId(), $this->getId(), $this->getType());
528  $md2xml->setExportMode(true);
529  $md2xml->startExport();
530  $a_xml_writer->appendXML($md2xml->getXML());
531  }
+ 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 550 of file class.ilLMPageObject.php.

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

Referenced by exportXML().

551  {
552  $cont_obj = $this->getContentObject();
553 
554  $this->page_object->buildDom();
555  $this->page_object->insertInstIntoIDs($a_inst);
556  $this->mobs_contained = $this->page_object->collectMediaObjects(false);
557  $this->files_contained = ilPCFileList::collectFileItems($this->page_object, $this->page_object->getDomDoc());
558  $xml = $this->page_object->getXMLFromDom(false, false, false, "", true);
559  $xml = str_replace("&", "&amp;", $xml);
560  $a_xml_writer->appendXML($xml);
561 
562  $this->page_object->freeDom();
563  }
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 593 of file class.ilLMPageObject.php.

594  {
595  return $this->files_contained;
596  }

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

584  {
585  return $this->mobs_contained;
586  }

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

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

571  {
573  $this->content_object->getType(),
574  $this->getId()
575  );
576  }
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 677 of file class.ilLMPageObject.php.

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

Referenced by ilStructureObjectGUI\insertPageFromTemplate().

678  {
679  global $DIC;
680 
681  $lng = $DIC->language();
682 
683  if ($title == "") {
684  $title = $lng->txt("cont_new_page");
685  }
686  $lm_tree = new ilLMTree($lm_id);
687  $lm = new ilObjLearningModule($lm_id, false);
688  if (!$first_child) { // insert after node id
689  $parent_id = $lm_tree->getParentId($node_id);
690  $target = $node_id;
691  } else { // insert as first child
692  $parent_id = $node_id;
693  $target = IL_FIRST_NODE;
694  }
695 
696  $page_ids = array();
697  for ($i = 1; $i <= $num; $i++) {
698  $page = new ilLMPageObject($lm);
699  $page->setTitle($title);
700  $page->setLMId($lm->getId());
701  $page->create(false, false, $layout_id);
702  ilLMObject::putInTree($page, $parent_id, $target);
703  $page_ids[] = $page->getId();
704  }
705  $page_ids = array_reverse($page_ids);
706  return $page_ids;
707  }
Class ilObjLearningModule.
Class ilLMPageObject.
$lng
const IL_FIRST_NODE
Definition: class.ilTree.php:5
static putInTree($a_obj, $a_parent_id="", $a_target_node_id="")
put this object into content object tree
$DIC
Definition: xapitoken.php:46
$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 533 of file class.ilLMPageObject.php.

References getId().

534  {
535  if ($a_tag == "Identifier" && $a_param == "Entry") {
536  $a_value = "il_" . IL_INST_ID . "_pg_" . $this->getId();
537  //$a_value = ilUtil::insertInstIntoID($a_value);
538  }
539 
540  return $a_value;
541  }
+ 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 626 of file class.ilLMPageObject.php.

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

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

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