ILIAS  release_4-4 Revision
ilLMPageObject Class Reference

Class ilLMPageObject. More...

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

Public Member Functions

 ilLMPageObject (&$a_content_obj, $a_id=0, $a_halt=true)
 Constructor public. More...
 
 _ilLMPageObject ()
 
 read ()
 
 create ($a_upload=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...
 
 _splitPage ($a_page_id, $a_pg_parent_type, $a_hier_id)
 split page at hierarchical id More...
 
 _splitPageNext ($a_page_id, $a_pg_parent_type, $a_hier_id)
 split page to next page at hierarchical id 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 ()
 
 getPageList ($lm_id)
 static More...
 
 getPagesWithLinksList ($a_lm_id, $a_par_type)
 Get all pages of lm that contain any internal links. More...
 
 exportXML (&$a_xml_writer, $a_mode="normal", $a_inst=0)
 export page object to xml (see ilias_co.dtd) More...
 
 _exportXMLAlias (&$a_xml_writer, $a_id, $a_inst=0)
 export page alias to xml 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...
 
 queryQuestionsOfLearningModule ($a_lm_id, $a_order_field, $a_order_dir, $a_offset, $a_limit)
 Get questions of learning module. More...
 
- Public Member Functions inherited from ilLMObject
 ilLMObject ($a_content_obj, $a_id=0)
 
 MDUpdateListener ($a_element)
 Meta data update listener. More...
 
 _lookupNID ($a_lm_id, $a_lm_obj_id, $a_type)
 lookup named identifier (ILIAS_NID) 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...
 
 _writeTitle ($a_obj_id, $a_title)
 
 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...
 
 _writeImportId ($a_id, $a_import_id)
 write import id to db (static) More...
 
 create ($a_upload=false)
 
 update ()
 update complete object More...
 
 delete ($a_delete_meta_data=true)
 delete lm object data More...
 
 _getIdForImportId ($a_import_id)
 get current object id for import id (static) More...
 
 _getAllObjectsForImportId ($a_import_id, $a_in_lm=0)
 Get all items for an import ID. More...
 
 _exists ($a_id)
 checks wether a lm content object with specified id exists or not More...
 
 getObjectList ($lm_id, $type="")
 static More...
 
 _deleteAllObjectData (&$a_cobj)
 delete all objects of content object (digi book / learning module) More...
 
 _lookupContObjID ($a_id)
 get learning module / digibook id for lm object More...
 
 clipboardCut ($a_cont_obj_id, $a_ids)
 Copy a set of chapters/pages into the clipboard. 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 _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="-")
 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 Public Member Functions inherited from ilLMObject
static preloadDataByLM ($a_lm_id)
 Preload data records by lm. More...
 
static _lookupTitle ($a_obj_id)
 Lookup title. More...
 
static _lookupType ($a_obj_id, $a_lm_id=0)
 Lookup type. More...
 
 _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 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 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 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...
 

Data Fields

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

Additional Inherited Members

- 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.

Member Function Documentation

◆ _exportXMLAlias()

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

export page alias to xml

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

Referenced by ilStructureObject\exportXMLPageObjects().

558  {
559  $attrs = array();
560  $a_xml_writer->xmlStartTag("PageObject", $attrs);
561 
562  $attrs = array();
563  $attrs["OriginId"] = "il_".$a_inst.
564  "_pg_".$a_id;
565  $a_xml_writer->xmlElement("PageAlias", $attrs);
566 
567  $a_xml_writer->xmlEndTag("PageObject");
568  }
+ 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 = "-" 
)
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 416 of file class.ilLMPageObject.php.

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

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

419  {
420  if($a_mode == IL_NO_HEADER && !$a_force_content)
421  {
422  return "";
423  }
424 
425  if ($a_lm_id == 0)
426  {
427  $a_lm_id = ilLMObject::_lookupContObjID($a_pg_id);
428  }
429 
430  if ($a_lm_id == 0)
431  {
432  return "";
433  }
434 
435  // this is optimized when ilLMObject::preloadDataByLM is invoked (e.g. done in ilLMExplorerGUI)
436  $title = ilLMObject::_lookupTitle($a_pg_id);
437 
438  // this is also optimized since ilObjectTranslation re-uses instances for one lm
439  include_once("./Services/Object/classes/class.ilObjectTranslation.php");
440  $ot = ilObjectTranslation::getInstance($a_lm_id);
441  $languages = $ot->getLanguages();
442 
443  if ($a_lang != "-" && $ot->getContentActivated() && isset($languages[$a_lang]))
444  {
445  include_once("./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
446  $lmobjtrans = new ilLMObjTranslation($a_pg_id, $a_lang);
447  if ($lmobjtrans->getTitle() != "")
448  {
449  $title = $lmobjtrans->getTitle();
450  }
451  }
452 
453  if($a_mode == IL_PAGE_TITLE)
454  {
455  return $title;
456  }
457 
458  include_once("./Modules/LearningModule/classes/class.ilLMTree.php");
459  $tree = ilLMTree::getInstance($a_lm_id);
460 
461  if ($tree->isInTree($a_pg_id))
462  {
463  $pred_node = $tree->fetchPredecessorNode($a_pg_id, "st");
464  $childs = $tree->getChildsByType($pred_node["obj_id"], "pg");
465  $cnt_str = "";
466  if(count($childs) > 1)
467  {
468  $cnt = 0;
469  foreach($childs as $child)
470  {
471  include_once("./Modules/LearningModule/classes/class.ilLMPage.php");
472  $active = ilLMPage::_lookupActive($child["obj_id"],
473  ilObject::_lookupType($a_lm_id), $a_time_scheduled_activation);
474 
475  if (!$active)
476  {
477  $act_data = ilLMPage::_lookupActivationData((int) $child["obj_id"], ilObject::_lookupType($a_lm_id));
478  if ($act_data["show_activation_info"] &&
479  (ilUtil::now() < $act_data["activation_start"]))
480  {
481  $active = true;
482  }
483  }
484 
485  if ($child["type"] != "pg" || $active)
486  {
487  $cnt++;
488  }
489  if($child["obj_id"] == $a_pg_id)
490  {
491  $cur_cnt = $cnt;
492  }
493  }
494  if ($cnt > 1)
495  {
496  $cnt_str = " (".$cur_cnt."/".$cnt.")";
497  }
498  }
499  require_once("./Modules/LearningModule/classes/class.ilStructureObject.php");
500  //$struct_obj =& new ilStructureObject($pred_node["obj_id"]);
501  //return $struct_obj->getTitle();
502  return ilStructureObject::_getPresentationTitle($pred_node["obj_id"],
503  $a_include_numbers, false, 0, $a_lang).$cnt_str;
504 
505  //return $pred_node["title"].$cnt_str;
506  }
507  else
508  {
509  return $title;
510  }
511  }
static _getPresentationTitle($a_st_id, $a_include_numbers=false, $a_time_scheduled_activation=false, $a_lm_id=0, $a_lang="-")
get presentation title
const IL_PAGE_TITLE
const IL_NO_HEADER
static _lookupTitle($a_obj_id)
Lookup title.
static now()
Return current timestamp in Y-m-d H:i:s format.
_lookupActivationData($a_id, $a_parent_type, $a_lang="-")
Lookup activation data.
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static getInstance($a_tree_id)
Get Instance.
_lookupContObjID($a_id)
get learning module / digibook id for lm object
static _lookupType($a_id, $a_reference=false)
lookup object type
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:

◆ _ilLMPageObject()

ilLMPageObject::_ilLMPageObject ( )

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

67  {
68  if(is_object($this->page_object))
69  {
70  unset($this->page_object);
71  }
72  }

◆ _splitPage()

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

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

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

Referenced by ilPageContentGUI\splitPage().

200  {
201  // get content object (learning module / digilib book)
202  $lm_id = ilLMObject::_lookupContObjID($a_page_id);
204  switch ($type)
205  {
206  case "lm":
207  include_once ("./Modules/LearningModule/classes/class.ilObjLearningModule.php");
208  $cont_obj = new ilObjLearningModule($lm_id, false);
209  break;
210 
211  case "dbk":
212  include_once ("./Modules/LearningModule/classes/class.ilObjDlBook.php");
213  $cont_obj = new ilObjDlBook($lm_id, false);
214  break;
215  }
216 
217  $source_lm_page = new ilLMPageObject($cont_obj, $a_page_id);
218 
219  // create new page
220  $lm_page = new ilLMPageObject($cont_obj);
221  $lm_page->setTitle($source_lm_page->getTitle());
222  $lm_page->setLMId($source_lm_page->getLMId());
223  $lm_page->setType($source_lm_page->getType());
224  $lm_page->setDescription($source_lm_page->getDescription());
225  $lm_page->create(true);
226 
227 
228  // copy complete content of source page to new page
229  $source_page = $source_lm_page->getPageObject();
230  $page = $lm_page->getPageObject();
231  $page->setXMLContent($source_page->copyXMLContent());
232 //echo htmlentities($source_page->copyXMLContent());
233  $page->buildDom(true);
234  $page->update();
235 // echo "-".$page->getId()."-".$page->getParentType()."-";
236 
237  // copy meta data
238  include_once("Services/MetaData/classes/class.ilMD.php");
239  $md = new ilMD($source_lm_page->getLMId(), $a_page_id, $source_lm_page->getType());
240  $md->cloneMD($source_lm_page->getLMId(), $lm_page->getId(), $source_lm_page->getType());
241 
242  // insert new page in tree (after original page)
243  $tree = new ilTree($cont_obj->getId());
244  $tree->setTableNames('lm_tree','lm_data');
245  $tree->setTreeTablePK("lm_id");
246  if ($tree->isInTree($source_lm_page->getId()))
247  {
248  $parent_node = $tree->getParentNodeData($source_lm_page->getId());
249  $tree->insertNode($lm_page->getId(), $parent_node["child"], $source_lm_page->getId());
250  }
251 
252  // remove all nodes < hierarchical id from new page (incl. update)
253  $page->addHierIds();
254  $page->deleteContentBeforeHierId($a_hier_id);
255 // $page->update();
256 
257  // remove all nodes >= hierarchical id from source page
258  $source_page->buildDom();
259  $source_page->addHierIds();
260  $source_page->deleteContentFromHierId($a_hier_id);
261 
262  return $lm_page;
263 
264  }
& cloneMD($a_rbac_id, $a_obj_id, $a_obj_type)
Definition: class.ilMD.php:361
Class ilObjLearningModule.
Class ilObjDlBook.
_lookupContObjID($a_id)
get learning module / digibook id for lm object
setTableNames($a_table_tree, $a_table_obj_data, $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be &#39;obj_id&#39; You may use...
ilLMPageObject(&$a_content_obj, $a_id=0, $a_halt=true)
Constructor public.
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()

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

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

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

Referenced by ilPageContentGUI\splitPageNext().

274  {
275  // get content object (learning module / digilib book)
276  $lm_id = ilLMObject::_lookupContObjID($a_page_id);
278  switch ($type)
279  {
280  case "lm":
281  include_once ("./Modules/LearningModule/classes/class.ilObjLearningModule.php");
282  $cont_obj = new ilObjLearningModule($lm_id, false);
283  break;
284 
285  case "dbk":
286  include_once ("./Modules/LearningModule/classes/class.ilObjDlBook.php");
287  $cont_obj = new ilObjDlBook($lm_id, false);
288  break;
289  }
290  $tree = new ilTree($cont_obj->getId());
291  $tree->setTableNames('lm_tree','lm_data');
292  $tree->setTreeTablePK("lm_id");
293 
294  $source_lm_page =& new ilLMPageObject($cont_obj, $a_page_id);
295  $source_page =& $source_lm_page->getPageObject();
296 
297  // get next page
298  $succ = $tree->fetchSuccessorNode($a_page_id, "pg");
299  if ($succ["child"] > 0)
300  {
301  $target_lm_page =& new ilLMPageObject($cont_obj, $succ["child"]);
302  $target_page =& $target_lm_page->getPageObject();
303  $target_page->buildDom();
304  $target_page->addHierIds();
305 
306  // move nodes to target page
307  $source_page->buildDom();
308  $source_page->addHierIds();
309  ilLMPage::_moveContentAfterHierId($source_page, $target_page, $a_hier_id);
310  //$source_page->deleteContentFromHierId($a_hier_id);
311 
312  return $succ["child"];
313  }
314 
315  }
Class ilObjLearningModule.
Class ilObjDlBook.
_moveContentAfterHierId(&$a_source_page, &$a_target_page, $a_hid)
move content of hierarchical id >= $a_hid to other page
_lookupContObjID($a_id)
get learning module / digibook id for lm object
setTableNames($a_table_tree, $a_table_obj_data, $a_table_obj_reference="")
set table names The primary key of the table containing your object_data must be &#39;obj_id&#39; You may use...
ilLMPageObject(&$a_content_obj, $a_id=0, $a_halt=true)
Constructor public.
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 323 of file class.ilLMPageObject.php.

324  {
325  $this->page_object =& $a_page_obj;
326  }

◆ copy()

ilLMPageObject::copy (   $a_target_lm)

copy page

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

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

107  {
108  // copy page
109  $lm_page = new ilLMPageObject($a_target_lm);
110  $lm_page->setTitle($this->getTitle());
111  $lm_page->setLayout($this->getLayout());
112  $lm_page->setLMId($a_target_lm->getId());
113  $lm_page->setType($this->getType());
114  $lm_page->setDescription($this->getDescription());
115  $lm_page->setImportId("il__pg_".$this->getId());
116  $lm_page->create(true); // setting "upload" flag to true prevents creating of meta data
117 
118  // check whether export id already exists in the target lm
119  $del_exp_id = false;
120  $exp_id = ilLMPageObject::getExportId($this->getLMId(), $this->getId());
121  if (trim($exp_id) != "")
122  {
123  if (ilLMPageObject::existsExportID($a_target_lm->getId(), $exp_id))
124  {
125  $del_exp_id = true;
126  }
127  }
128 
129  // copy meta data
130  include_once("Services/MetaData/classes/class.ilMD.php");
131  $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
132  $new_md = $md->cloneMD($a_target_lm->getId(), $lm_page->getId(), $this->getType());
133 
134  // check whether export id already exists in the target lm
135  if ($del_exp_id)
136  {
137  ilLMPageObject::saveExportId($a_target_lm->getId(), $lm_page->getId(), "");
138  }
139  else
140  {
141  ilLMPageObject::saveExportId($a_target_lm->getId(), $lm_page->getId(),
142  trim($exp_id));
143  }
144 
145  // copy page content and activation
146  $page = $lm_page->getPageObject();
147  $this->page_object->copy($page->getId(), $page->getParentType(), $page->getParentId());
148  /*$page->setXMLContent($this->page_object->copyXMLContent());
149  $page->setActive($this->page_object->getActive());
150  $page->setActivationStart($this->page_object->getActivationStart());
151  $page->setActivationEnd($this->page_object->getActivationEnd());
152  $page->buildDom();
153  $page->update();*/
154  $lm_page->read(); // this gets the updated page object into lm page
155 
156  // copy translations
157  include_once("./Modules/LearningModule/classes/class.ilLMObjTranslation.php");
158  ilLMObjTranslation::copy($this->getId(), $lm_page->getId());
159 
160  return $lm_page;
161  }
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.
ilLMPageObject(&$a_content_obj, $a_id=0, $a_halt=true)
Constructor public.
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 166 of file class.ilLMPageObject.php.

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

167  {
168  // copy page
169  $lm_page =& new ilLMPageObject($a_cont_obj);
170  $lm_page->setTitle($this->getTitle());
171  $lm_page->setLMId($a_cont_obj->getId());
172  $lm_page->setImportId("il__pg_".$this->getId());
173  $lm_page->setType($this->getType());
174  $lm_page->setDescription($this->getDescription());
175  $lm_page->create(true); // setting "upload" flag to true prevents creating of meta data
176  $a_copied_nodes[$this->getId()] = $lm_page->getId();
177 
178  // copy meta data
179  include_once("Services/MetaData/classes/class.ilMD.php");
180  $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
181  $new_md =& $md->cloneMD($a_cont_obj->getId(), $lm_page->getId(), $this->getType());
182 
183  // copy page content
184  $page =& $lm_page->getPageObject();
185  $page->setXMLContent($this->page_object->getXMLContent());
186  $page->buildDom();
187  $page->update();
188 
189  return $lm_page;
190  }
ilLMPageObject(&$a_content_obj, $a_id=0, $a_halt=true)
Constructor public.
getTitle()
get title of lm object
+ Here is the call graph for this function:

◆ create()

ilLMPageObject::create (   $a_upload = false)

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

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

85  {
86  parent::create($a_upload);
87  if(!is_object($this->page_object))
88  {
89  $this->page_object = new ilLMPage();
90  }
91  $this->page_object->setId($this->getId());
92  $this->page_object->setParentId($this->getLMId());
93  $this->page_object->create($a_upload);
94  }
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 96 of file class.ilLMPageObject.php.

97  {
98  parent::delete($a_delete_meta_data);
99  $this->page_object->delete();
100  }

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

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

662  {
663  global $ilBench;
664 
665  //$attrs = array();
666  //$a_xml_writer->xmlStartTag("PageObject", $attrs);
668  if ($title != "")
669  {
670  $attrs = array();
671  $attrs["font-family"] = "Times";
672  $attrs["font-size"] = "14pt";
673  $a_xml_writer->xmlElement("fo:block", $attrs, $title);
674  }
675 
676  // PageContent
677  $this->page_object->buildDom();
678  $fo = $this->page_object->getFO();
679  $a_xml_writer->appendXML($fo);
680 
681  //$a_xml_writer->xmlEndTag("PageObject");
682  }
global $ilBench
Definition: ilias.php:18
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="-")
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 519 of file class.ilLMPageObject.php.

References $ilBench, exportXMLMetaData(), and exportXMLPageContent().

520  {
521  global $ilBench;
522 
523  $attrs = array();
524  $a_xml_writer->xmlStartTag("PageObject", $attrs);
525 
526  switch ($a_mode)
527  {
528  case "normal":
529  // MetaData
530  $ilBench->start("ContentObjectExport", "exportPageObject_XML_Meta");
531  $this->exportXMLMetaData($a_xml_writer);
532  $ilBench->stop("ContentObjectExport", "exportPageObject_XML_Meta");
533 
534  // PageContent
535  $ilBench->start("ContentObjectExport", "exportPageObject_XML_PageContent");
536  $this->exportXMLPageContent($a_xml_writer, $a_inst);
537  $ilBench->stop("ContentObjectExport", "exportPageObject_XML_PageContent");
538  break;
539 
540  case "alias":
541  $attrs = array();
542  $attrs["OriginId"] = "il_".$a_inst.
543  "_pg_".$this->getId();
544  $a_xml_writer->xmlElement("PageAlias", $attrs);
545  break;
546  }
547 
548  // Layout
549  // not implemented
550 
551  $a_xml_writer->xmlEndTag("PageObject");
552  }
exportXMLMetaData(&$a_xml_writer)
export page objects meta data to xml (see ilias_co.dtd)
global $ilBench
Definition: ilias.php:18
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 577 of file class.ilLMPageObject.php.

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

Referenced by exportXML().

578  {
579  include_once("Services/MetaData/classes/class.ilMD2XML.php");
580  $md2xml = new ilMD2XML($this->getLMId(), $this->getId(), $this->getType());
581  $md2xml->setExportMode(true);
582  $md2xml->startExport();
583  $a_xml_writer->appendXML($md2xml->getXML());
584  }
+ 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 604 of file class.ilLMPageObject.php.

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

Referenced by exportXML().

605  {
606 //echo "exportxmlpagecontent:$a_inst:<br>";
607  $cont_obj = $this->getContentObject();
608 
609  $this->page_object->buildDom();
610  $this->page_object->insertInstIntoIDs($a_inst);
611  $this->mobs_contained = $this->page_object->collectMediaObjects(false);
612  //$this->files_contained = $this->page_object->collectFileItems();
613  include_once("./Services/COPage/classes/class.ilPCFileList.php");
614  $this->files_contained = ilPCFileList::collectFileItems($this->page_object, $this->page_object->getDomDoc());
615 // $this->questions_contained = $this->page_object->getQuestionIds();
616  $xml = $this->page_object->getXMLFromDom(false, false, false, "", true);
617  $xml = str_replace("&","&amp;", $xml);
618  $a_xml_writer->appendXML($xml);
619 
620  $this->page_object->freeDom();
621  }
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 650 of file class.ilLMPageObject.php.

651  {
652  return $this->files_contained;
653  }

◆ getId()

ilLMPageObject::getId ( )

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

References $id.

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

349  {
350  return $this->id;
351  }
+ 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 640 of file class.ilLMPageObject.php.

641  {
642  return $this->mobs_contained;
643  }

◆ getOriginID()

ilLMPageObject::getOriginID ( )

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

References $origin_id.

374  {
375  return $this->origin_id;
376  }

◆ getPageList()

◆ getPageObject()

& ilLMPageObject::getPageObject ( )

get assigned page object

Returns
object page object

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

References $page_object.

335  {
336  return $this->page_object;
337  }

◆ getPagesWithLinksList()

ilLMPageObject::getPagesWithLinksList (   $a_lm_id,
  $a_par_type 
)

Get all pages of lm that contain any internal links.

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

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

Referenced by ilLinksTableGUI\getLinks().

390  {
391  $pages = ilLMPageObject::getPageList($a_lm_id);
392  $ids = array();
393  foreach($pages as $page)
394  {
395  $ids[] = $page["obj_id"];
396  }
397 
398  $linked_pages = ilLMPage::getPagesWithLinks($a_par_type, $a_lm_id);
399  $result = array();
400  foreach($pages as $page)
401  {
402  if (is_array($linked_pages[$page["obj_id"]]))
403  {
404  $result[] = $page;
405  }
406  }
407  return $result;
408  }
$result
static getPagesWithLinks($a_parent_type, $a_parent_id, $a_lang="-")
Get all pages for parent object that contain internal links.
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 628 of file class.ilLMPageObject.php.

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

629  {
630  include_once("./Services/COPage/classes/class.ilPCQuestion.php");
631  return ilPCQuestion::_getQuestionIdsForPage($this->content_object->getType(),
632  $this->getId());
633  }
static _getQuestionIdsForPage($a_parent_type, $a_page_id, $a_lang="-")
Get all questions of a page.
+ Here is the call graph for this function:

◆ ilLMPageObject()

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

Constructor public.

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

References $ilBench, $ilias, read(), and ilLMObject\setType().

Referenced by _splitPage(), _splitPageNext(), copy(), and copyToOtherContObject().

43  {
44  global $ilias, $ilBench;
45 
46  $ilBench->start("ContentPresentation", "ilLMPageObject_Constructor");
47 
48  parent::ilLMObject($a_content_obj, $a_id);
49  $this->setType("pg");
50  $this->id = $a_id;
51 
52  $this->is_alias = false;
53  $this->contains_int_link = false;
54  $this->mobs_contained = array();
55  $this->files_contained = array();
56  $this->halt_on_error = $a_halt;
57 
58  if($a_id != 0)
59  {
60  $this->read();
61  }
62 
63  $ilBench->stop("ContentPresentation", "ilLMPageObject_Constructor");
64  }
setType($a_type)
global $ilBench
Definition: ilias.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAlias()

ilLMPageObject::isAlias ( )

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

References $is_alias.

362  {
363  return $this->is_alias;
364  }

◆ modifyExportIdentifier()

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

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

References getId().

587  {
588  if ($a_tag == "Identifier" && $a_param == "Entry")
589  {
590  $a_value = "il_".IL_INST_ID."_pg_".$this->getId();
591  //$a_value = ilUtil::insertInstIntoID($a_value);
592  }
593 
594  return $a_value;
595  }
+ Here is the call graph for this function:

◆ queryQuestionsOfLearningModule()

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

Get questions of learning module.

Parameters

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

References $query, and $result.

Referenced by ilLMQuestionListTableGUI\getItems().

692  {
693  global $ilDB, $rbacreview;
694 
695 
696  // count query
697  $count_query = "SELECT count(pq.question_id) cnt ";
698 
699  // basic query
700  $query = "SELECT pq.page_id, pq.question_id ";
701 
702  $from = " FROM page_question pq JOIN lm_tree t ON (t.lm_id = ".$ilDB->quote($a_lm_id, "integer").
703  " AND pq.page_id = t.child and pq.page_parent_type = ".$ilDB->quote("lm", "text").") ".
704  " WHERE t.lm_id = ".$ilDB->quote($a_lm_id, "integer");
705  $count_query.= $from;
706  $query.= $from;
707 
708 
709  // count query
710  $set = $ilDB->query($count_query);
711  $cnt = 0;
712  if ($rec = $ilDB->fetchAssoc($set))
713  {
714  $cnt = $rec["cnt"];
715  }
716 
717  $offset = (int) $a_offset;
718  $limit = (int) $a_limit;
719  $ilDB->setLimit($limit, $offset);
720 
721  // set query
722  $set = $ilDB->query($query);
723  $result = array();
724  while($rec = $ilDB->fetchAssoc($set))
725  {
726  $result[] = $rec;
727  }
728  return array("cnt" => $cnt, "set" => $result);
729  }
$result
+ Here is the caller graph for this function:

◆ read()

ilLMPageObject::read ( )

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

Referenced by ilLMPageObject().

78  {
79  parent::read();
80 
81  $this->page_object = new ilLMPage($this->id, 0);
82  }
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 356 of file class.ilLMPageObject.php.

357  {
358  $this->is_alias = $a_is_alias;
359  }

◆ setId()

ilLMPageObject::setId (   $a_id)

set id

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

344  {
345  $this->id = $a_id;
346  }

◆ setOriginID()

ilLMPageObject::setOriginID (   $a_id)

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

368  {
369  return $this->origin_id = $a_id;
370  }

Field Documentation

◆ $dom

ilLMPageObject::$dom

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

◆ $id

ilLMPageObject::$id

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

Referenced by getId().

◆ $ilias

ilLMPageObject::$ilias

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

Referenced by ilLMPageObject().

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

Referenced by getPageObject().


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