ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilStructureObject Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilStructureObject:
+ Collaboration diagram for ilStructureObject:

Public Member Functions

 __construct (ilObjLearningModule $a_content_obj, int $a_id=0)
 
 delete (bool $a_delete_meta_data=true)
 
 copy (ilObjLearningModule $a_target_lm)
 copy chapter More...
 
 exportXML (ilXmlWriter $a_xml_writer, int $a_inst, ilLog $expLog)
 
 exportXMLMetaData (ilXmlWriter $a_xml_writer)
 
 modifyExportIdentifier (string $a_tag, string $a_param, string $a_value)
 
 exportXMLPageObjects (ilXmlWriter $a_xml_writer, int $a_inst=0)
 
 exportXMLStructureObjects (ilXmlWriter $a_xml_writer, int $a_inst, ilLog $expLog)
 
- Public Member Functions inherited from ilLMObject
 __construct (ilObjLearningModule $a_content_obj, int $a_id=0)
 
 MDUpdateListener (string $a_element)
 Meta data update listener Important note: Do never call create() or update() method of ilObject here. More...
 
 createMetaData ()
 create meta data entry More...
 
 updateMetaData ()
 update meta data entry More...
 
 deleteMetaData ()
 delete meta data entry More...
 
 setDataRecord (array $a_record)
 this method should only be called by class ilLMObjectFactory More...
 
 read ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setShortTitle (string $a_title)
 
 getShortTitle ()
 
 setDescription (string $a_description)
 
 getDescription ()
 
 setType (string $a_type)
 
 getType ()
 
 setLMId (int $a_lm_id)
 
 getLMId ()
 
 setContentObject (ilObjLearningModule $a_content_obj)
 
 getContentObject ()
 
 setId (int $a_id)
 
 getId ()
 
 getImportId ()
 
 setImportId (string $a_id)
 
 setLayout (string $a_val)
 
 getLayout ()
 
 create (bool $a_upload=false)
 
 update ()
 
 delete (bool $a_delete_meta_data=true)
 
 existsExportID (int $a_lm_id, int $a_exp_id, string $a_type="pg")
 Does export ID exist in lm? More...
 
 getExportIDInfo (int $a_lm_id, int $a_exp_id, string $a_type="pg")
 

Static Public Member Functions

static _getPresentationTitle (int $a_st_id, string $a_mode=self::CHAPTER_TITLE, bool $a_include_numbers=false, bool $a_time_scheduled_activation=false, bool $a_force_content=false, int $a_lm_id=0, string $a_lang="-", bool $a_include_short=false)
 
static getChapterList (int $a_lm_id)
 
- Static Public Member Functions inherited from ilLMObject
static _lookupNID (int $a_lm_id, int $a_lm_obj_id, string $a_type)
 lookup named identifier (ILIAS_NID) More...
 
static preloadDataByLM (int $a_lm_id)
 Preload data records by lm. More...
 
static _lookupTitle (int $a_obj_id)
 
static _lookupShortTitle (int $a_obj_id)
 
static _lookupType (int $a_obj_id, int $a_lm_id=0)
 
static _writeTitle (int $a_obj_id, string $a_title)
 
static _writeImportId (int $a_id, string $a_import_id)
 
static _writePublicAccessStatus (array $a_pages, int $a_cont_obj_id)
 update public access flags in lm_data for all pages of a content object More...
 
static _isPagePublic (int $a_node_id, bool $a_check_public_mode=false)
 
static _getIdForImportId (string $a_import_id)
 get current object id for import id (static) More...
 
static _getAllObjectsForImportId (string $a_import_id, int $a_in_lm=0)
 Get all items for an import ID. More...
 
static _exists (int $a_id)
 checks wether a lm content object with specified id exists or not More...
 
static getObjectList (int $lm_id, string $type="")
 
static _deleteAllObjectData (ilObjLearningModule $a_cobj)
 delete all objects of content object (digi book / learning module) More...
 
static _lookupContObjID (int $a_id)
 get learning module id for lm object More...
 
static putInTree (ilLMObject $a_obj, int $a_parent_id=0, int $a_target_node_id=0)
 put this object into content object tree More...
 
static getTree (int $a_cont_obj_id)
 Get learning module tree. More...
 
static clipboardCut (int $a_cont_obj_id, array $a_ids)
 Copy a set of chapters/pages into the clipboard. More...
 
static clipboardCopy (int $a_cont_obj_id, array $a_ids)
 Copy a set of chapters/pages into the clipboard. More...
 
static saveTitles (ilObjLearningModule $a_lm, array $a_titles, string $a_lang="-")
 Save titles for lm objects. More...
 
static updateInternalLinks (array $a_copied_nodes, string $a_parent_type="lm")
 Update internal links, after multiple pages have been copied. More...
 
static uniqueTypesCheck (array $a_items)
 Check for unique types (all pages or all chapters) More...
 
static writeLayout (int $a_obj_id, string $a_layout, ?ilObjLearningModule $a_lm=null)
 Write layout setting. More...
 
static lookupLayout (int $a_obj_id)
 Lookup type. More...
 
static getPagesOfChapter (int $a_lm_id, int $a_chap_id)
 Get pages of chapter. More...
 
static _getAllLMObjectsOfLM (int $a_lm_id, string $a_type="")
 Get all objects of learning module. More...
 
static saveExportId (int $a_lm_id, int $a_lmobj_id, string $a_exp_id, string $a_type="pg")
 
static getExportId (int $a_lm_id, int $a_lmobj_id, string $a_type="pg")
 
static getDuplicateExportIDs (int $a_lm_id, string $a_type="pg")
 Get duplicate export IDs (count export ID usages) More...
 
static _getNodePresentationTitle (array $a_node, string $a_mode=self::PAGE_TITLE, bool $a_include_numbers=false, bool $a_time_scheduled_activation=false, bool $a_force_content=false, int $a_lm_id=0, string $a_lang="-")
 
static getShortTitles (int $a_lm_id, string $a_lang="-")
 
static writeShortTitle (int $a_id, string $a_short_title, string $a_lang="-")
 

Data Fields

string $origin_id
 
ilLMTree $tree
 
- Data Fields inherited from ilLMObject
const CHAPTER_TITLE = "st_title"
 
const PAGE_TITLE = "pg_title"
 
const NO_HEADER = "none"
 
int $lm_id = 0
 
string $type = ""
 
int $id = 0
 
array $data_record
 
ilObjLearningModule $content_object
 
string $title = ""
 
string $short_title = ""
 
string $description = ""
 
bool $active = true
 

Protected Attributes

ILIAS Help Map MapManager $help_map
 
- Protected Attributes inherited from ilLMObject
string $layout = ""
 
string $import_id = ""
 
ilObjUser $user
 
ilDBInterface $db
 

Private Member Functions

 delete_rec (ilLMTree $a_tree, bool $a_delete_meta_data=true)
 Delete sub tree. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from ilLMObject
static _lookup (int $a_obj_id, string $a_field)
 
- Static Protected Attributes inherited from ilLMObject
static $data_records = array()
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Handles StructureObjects of ILIAS Learning Modules (see ILIAS DTD)

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

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

Constructor & Destructor Documentation

◆ __construct()

ilStructureObject::__construct ( ilObjLearningModule  $a_content_obj,
int  $a_id = 0 
)

Definition at line 30 of file class.ilStructureObject.php.

References $DIC, ILIAS\MetaData\Repository\Validation\Data\__construct(), ilLMObject\getLMId(), and ilLMObject\setType().

33  {
34  global $DIC;
35 
36  $this->setType("st");
37  parent::__construct($a_content_obj, $a_id);
38  $this->tree = new ilLMTree($this->getLMId());
39  $this->help_map = $DIC->help()->internal()->domain()->map();
40  }
setType(string $a_type)
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

Member Function Documentation

◆ _getPresentationTitle()

static ilStructureObject::_getPresentationTitle ( int  $a_st_id,
string  $a_mode = self::CHAPTER_TITLE,
bool  $a_include_numbers = false,
bool  $a_time_scheduled_activation = false,
bool  $a_force_content = false,
int  $a_lm_id = 0,
string  $a_lang = "-",
bool  $a_include_short = false 
)
static

Definition at line 145 of file class.ilStructureObject.php.

References $DIC, $ilDB, ilLMObject\$title, ilLMObject\_lookupContObjID(), ilLMObject\_lookupShortTitle(), ilLMObject\_lookupTitle(), ilDBConstants\FETCHMODE_ASSOC, ilTree\getChildSequenceNumber(), ilLMTree\getInstance(), ilObjectTranslation\getInstance(), ilLMObjTranslation\getTitle(), and ilTree\isInTree().

Referenced by ilLMObject\_getNodePresentationTitle(), ilLMPageObject\_getPresentationTitle(), ilLMNavigationRendererGUI\addDropdown(), ilLMTOCExplorerGUI\getNodeContent(), ilLMPresentationGUI\ilLocator(), ilLMPresentationGUI\showPrintView(), ilLMPresentationGUI\showPrintViewSelection(), and ilStructureObjectGUI\subchap().

154  : string {
155  global $DIC;
156 
157  $ilDB = $DIC->database();
158 
159  if ($a_lm_id == 0) {
160  $a_lm_id = ilLMObject::_lookupContObjID($a_st_id);
161  }
162 
163  if ($a_lm_id == 0) {
164  return "";
165  }
166 
167  // this is optimized when ilLMObject::preloadDataByLM is invoked (e.g. done in ilLMExplorerGUI)
168  $title = "";
169  if ($a_include_short) {
170  $title = trim(ilLMObject::_lookupShortTitle($a_st_id));
171  }
172  if ($title == "") {
173  $title = ilLMObject::_lookupTitle($a_st_id);
174  }
175 
176  // this is also optimized since ilObjectTranslation re-uses instances for one lm
177  $ot = ilObjectTranslation::getInstance($a_lm_id);
178  $languages = $ot->getLanguages();
179 
180  if ($a_lang != "-" && $ot->getContentActivated()) {
181  $lmobjtrans = new ilLMObjTranslation($a_st_id, $a_lang);
182  $trans_title = "";
183  if ($a_include_short) {
184  $trans_title = trim($lmobjtrans->getShortTitle());
185  }
186  if ($trans_title == "") {
187  $trans_title = $lmobjtrans->getTitle();
188  }
189  if ($trans_title == "") {
190  $lmobjtrans = new ilLMObjTranslation($a_st_id, $ot->getFallbackLanguage());
191  $trans_title = $lmobjtrans->getTitle();
192  }
193  if ($trans_title != "") {
194  $title = $trans_title;
195  }
196  }
197 
198  $tree = ilLMTree::getInstance($a_lm_id);
199 
200  $nr = "";
201  if ($a_include_numbers) {
202  // this is optimized, since isInTree is cached
203  if ($tree->isInTree($a_st_id)) {
204  // optimization needed from here
205 
206  // get chapter tree node
207  $query = "SELECT * FROM lm_tree WHERE child = " .
208  $ilDB->quote($a_st_id, "integer") . " AND lm_id = " .
209  $ilDB->quote($a_lm_id, "integer");
210  $tree_set = $ilDB->query($query);
211  $tree_node = $tree_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
212  $depth = $tree_node["depth"];
213 
214  $nr = $tree->getChildSequenceNumber($tree_node, "st") . " ";
215  for ($i = $depth - 1; $i > 1; $i--) {
216  // get next parent tree node
217  $query = "SELECT * FROM lm_tree WHERE child = " .
218  $ilDB->quote($tree_node["parent"], "integer") . " AND lm_id = " .
219  $ilDB->quote($a_lm_id, "integer");
220  $tree_set = $ilDB->query($query);
221  $tree_node = $tree_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
222  $seq = $tree->getChildSequenceNumber($tree_node, "st");
223 
224  $nr = $seq . "." . $nr;
225  }
226  }
227  }
228 
229  return $nr . $title;
230  }
isInTree(?int $a_node_id)
get all information of a node.
static _lookupShortTitle(int $a_obj_id)
static getInstance(int $a_tree_id)
static _lookupTitle(int $a_obj_id)
global $DIC
Definition: feed.php:28
static getInstance(int $obj_id)
static _lookupContObjID(int $a_id)
get learning module id for lm object
getChildSequenceNumber(array $a_node, string $type="")
get sequence number of node in sibling sequence
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ copy()

ilStructureObject::copy ( ilObjLearningModule  $a_target_lm)

copy chapter

Definition at line 78 of file class.ilStructureObject.php.

References ilLMObjTranslation\copy(), ilLMObject\getDescription(), ilObject\getId(), ilLMObject\getId(), ilLMObject\getLMId(), ilLMObject\getTitle(), and ilLMObject\getType().

81  $chap = new ilStructureObject($a_target_lm);
82  $chap->setTitle($this->getTitle());
83  if ($this->getLMId() != $a_target_lm->getId()) {
84  $chap->setImportId("il__st_" . $this->getId());
85  }
86  $chap->setLMId($a_target_lm->getId());
87  $chap->setType($this->getType());
88  $chap->setDescription($this->getDescription());
89  $chap->create(true);
90  $a_copied_nodes[$this->getId()] = $chap->getId();
91 
92  // copy meta data
93  $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
94  $new_md = $md->cloneMD($a_target_lm->getId(), $chap->getId(), $this->getType());
95 
96  // copy translations
97  ilLMObjTranslation::copy($this->getId(), $chap->getId());
98 
99 
100  return $chap;
101  }
static copy(string $a_source_id, string $a_target_id)
Copy all translations of an object.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ delete()

ilStructureObject::delete ( bool  $a_delete_meta_data = true)

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

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

42  : void
43  {
44  // only relevant for online help authoring
45  $this->help_map->removeScreenIdsOfChapter($this->getId());
46 
47  $node_data = $this->tree->getNodeData($this->getId());
48  $this->delete_rec($this->tree, $a_delete_meta_data);
49  $this->tree->deleteTree($node_data);
50  }
delete_rec(ilLMTree $a_tree, bool $a_delete_meta_data=true)
Delete sub tree.
+ Here is the call graph for this function:

◆ delete_rec()

ilStructureObject::delete_rec ( ilLMTree  $a_tree,
bool  $a_delete_meta_data = true 
)
private

Delete sub tree.

Definition at line 55 of file class.ilStructureObject.php.

References ilTree\getChilds(), ilLMObject\getId(), and ilLMObjectFactory\getInstance().

Referenced by delete().

58  : void {
59  $childs = $a_tree->getChilds($this->getId());
60  foreach ($childs as $child) {
61  $obj = ilLMObjectFactory::getInstance($this->content_object, $child["obj_id"], false);
62  if (is_object($obj)) {
63  if ($obj->getType() == "st") {
64  $obj->delete_rec($a_tree, $a_delete_meta_data);
65  }
66  if ($obj->getType() == "pg") {
67  $obj->delete($a_delete_meta_data);
68  }
69  }
70  unset($obj);
71  }
72  parent::delete($a_delete_meta_data);
73  }
getChilds(int $a_node_id, string $a_order="", string $a_direction="ASC")
get child nodes of given node
static getInstance(ilObjLearningModule $a_content_obj, int $a_id=0, bool $a_halt=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXML()

ilStructureObject::exportXML ( ilXmlWriter  $a_xml_writer,
int  $a_inst,
ilLog  $expLog 
)

Definition at line 103 of file class.ilStructureObject.php.

References exportXMLMetaData(), exportXMLPageObjects(), exportXMLStructureObjects(), ilLMObject\getId(), ilLog\write(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

107  : void {
108  $expLog->write(date("[y-m-d H:i:s] ") . "Structure Object " . $this->getId());
109  $attrs = array();
110  $a_xml_writer->xmlStartTag("StructureObject", $attrs);
111 
112  // MetaData
113  $this->exportXMLMetaData($a_xml_writer);
114 
115  // StructureObjects
116  $this->exportXMLPageObjects($a_xml_writer, $a_inst);
117 
118  // PageObjects
119  $this->exportXMLStructureObjects($a_xml_writer, $a_inst, $expLog);
120 
121  $a_xml_writer->xmlEndTag("StructureObject");
122  }
exportXMLPageObjects(ilXmlWriter $a_xml_writer, int $a_inst=0)
exportXMLStructureObjects(ilXmlWriter $a_xml_writer, int $a_inst, ilLog $expLog)
xmlEndTag(string $tag)
Writes an endtag.
exportXMLMetaData(ilXmlWriter $a_xml_writer)
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
write(string $a_msg, $a_log_level=null)
logging
+ Here is the call graph for this function:

◆ exportXMLMetaData()

ilStructureObject::exportXMLMetaData ( ilXmlWriter  $a_xml_writer)

Definition at line 124 of file class.ilStructureObject.php.

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

Referenced by exportXML().

126  : void {
127  $md2xml = new ilMD2XML($this->getLMId(), $this->getId(), $this->getType());
128  $md2xml->setExportMode(true);
129  $md2xml->startExport();
130  $a_xml_writer->appendXML($md2xml->getXML());
131  }
appendXML(string $a_str)
append xml string to document
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXMLPageObjects()

ilStructureObject::exportXMLPageObjects ( ilXmlWriter  $a_xml_writer,
int  $a_inst = 0 
)

Definition at line 232 of file class.ilStructureObject.php.

References ilLMPageObject\_exportXMLAlias(), and ilLMObject\getId().

Referenced by exportXML().

235  : void {
236  $childs = $this->tree->getChilds($this->getId());
237  foreach ($childs as $child) {
238  if ($child["type"] != "pg") {
239  continue;
240  }
241 
242  // export xml to writer object
243  ilLMPageObject::_exportXMLAlias($a_xml_writer, $child["obj_id"], $a_inst);
244  }
245  }
static _exportXMLAlias(ilXmlWriter $a_xml_writer, int $a_id, int $a_inst=0)
export page alias to xml
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportXMLStructureObjects()

ilStructureObject::exportXMLStructureObjects ( ilXmlWriter  $a_xml_writer,
int  $a_inst,
ilLog  $expLog 
)

Definition at line 247 of file class.ilStructureObject.php.

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

Referenced by exportXML().

251  : void {
252  $childs = $this->tree->getChilds($this->getId());
253  foreach ($childs as $child) {
254  if ($child["type"] != "st") {
255  continue;
256  }
257 
258  // export xml to writer object
259  $structure_obj = new ilStructureObject(
260  $this->getContentObject(),
261  $child["obj_id"]
262  );
263  $structure_obj->exportXML($a_xml_writer, $a_inst, $expLog);
264  unset($structure_obj);
265  }
266  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getChapterList()

static ilStructureObject::getChapterList ( int  $a_lm_id)
static

Definition at line 269 of file class.ilStructureObject.php.

References ilTree\getNodeData(), ilTree\getSubTree(), and ilTree\readRootId().

Referenced by ilExportIDTableGUI\__construct(), and ilHelpMappingTableGUI\getChapters().

271  : array {
272  $tree = new ilLMTree($a_lm_id);
273 
274  $chapters = array();
275  $ndata = $tree->getNodeData($tree->readRootId());
276  $childs = $tree->getSubTree($ndata);
277  foreach ($childs as $child) {
278  if ($child["type"] == "st") {
279  $chapters[] = $child;
280  }
281  }
282  return $chapters;
283  }
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getSubTree(array $a_node, bool $a_with_data=true, array $a_type=[])
get all nodes in the subtree under specified node
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modifyExportIdentifier()

ilStructureObject::modifyExportIdentifier ( string  $a_tag,
string  $a_param,
string  $a_value 
)

Definition at line 133 of file class.ilStructureObject.php.

References ilLMObject\getId(), and IL_INST_ID.

137  : string {
138  if ($a_tag == "Identifier" && $a_param == "Entry") {
139  $a_value = "il_" . IL_INST_ID . "_st_" . $this->getId();
140  }
141 
142  return $a_value;
143  }
const IL_INST_ID
Definition: constants.php:40
+ Here is the call graph for this function:

Field Documentation

◆ $help_map

ILIAS Help Map MapManager ilStructureObject::$help_map
protected

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

◆ $origin_id

string ilStructureObject::$origin_id

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

◆ $tree

ilLMTree ilStructureObject::$tree

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


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