ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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...
 

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 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 _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 saveTitle (int $id, string $title, string $lang="-")
 
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
 
LOMServices $lom_services
 
- Protected Attributes inherited from ilLMObject
string $layout = ""
 
string $import_id = ""
 
ilObjUser $user
 
ilDBInterface $db
 
LOMServices $lom_services
 

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 getPathToExportIDInLOM ()
 
- 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 26 of file class.ilStructureObject.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ilLMObject\getLMId(), and ilLMObject\setType().

36  {
37  global $DIC;
38 
39  $this->setType("st");
40  parent::__construct($a_content_obj, $a_id);
41  $this->tree = new ilLMTree($this->getLMId());
42  $this->help_map = $DIC->help()->internal()->domain()->map();
43  $this->lom_services = $DIC->learningObjectMetadata();
44  }
setType(string $a_type)
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ 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 157 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(), and ilLMPresentationGUI\showPrintViewSelection().

166  : string {
167  global $DIC;
168 
169  $ilDB = $DIC->database();
170 
171  if ($a_lm_id == 0) {
172  $a_lm_id = ilLMObject::_lookupContObjID($a_st_id);
173  }
174 
175  if ($a_lm_id == 0) {
176  return "";
177  }
178 
179  // this is optimized when ilLMObject::preloadDataByLM is invoked (e.g. done in ilLMExplorerGUI)
180  $title = "";
181  if ($a_include_short) {
182  $title = trim(ilLMObject::_lookupShortTitle($a_st_id));
183  }
184  if ($title == "") {
185  $title = ilLMObject::_lookupTitle($a_st_id);
186  }
187 
188  // this is also optimized since ilObjectTranslation re-uses instances for one lm
189  $ot = ilObjectTranslation::getInstance($a_lm_id);
190  $languages = $ot->getLanguages();
191 
192  if ($a_lang != "-" && $ot->getContentActivated()) {
193  $lmobjtrans = new ilLMObjTranslation($a_st_id, $a_lang);
194  $trans_title = "";
195  if ($a_include_short) {
196  $trans_title = trim($lmobjtrans->getShortTitle());
197  }
198  if ($trans_title == "") {
199  $trans_title = $lmobjtrans->getTitle();
200  }
201  if ($trans_title == "") {
202  $lmobjtrans = new ilLMObjTranslation($a_st_id, $ot->getFallbackLanguage());
203  $trans_title = $lmobjtrans->getTitle();
204  }
205  if ($trans_title != "") {
206  $title = $trans_title;
207  }
208  }
209 
210  $tree = ilLMTree::getInstance($a_lm_id);
211 
212  $nr = "";
213  if ($a_include_numbers) {
214  // this is optimized, since isInTree is cached
215  if ($tree->isInTree($a_st_id)) {
216  // optimization needed from here
217 
218  // get chapter tree node
219  $query = "SELECT * FROM lm_tree WHERE child = " .
220  $ilDB->quote($a_st_id, "integer") . " AND lm_id = " .
221  $ilDB->quote($a_lm_id, "integer");
222  $tree_set = $ilDB->query($query);
223  $tree_node = $tree_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
224  $depth = $tree_node["depth"];
225 
226  $nr = $tree->getChildSequenceNumber($tree_node, "st") . " ";
227  for ($i = $depth - 1; $i > 1; $i--) {
228  // get next parent tree node
229  $query = "SELECT * FROM lm_tree WHERE child = " .
230  $ilDB->quote($tree_node["parent"], "integer") . " AND lm_id = " .
231  $ilDB->quote($a_lm_id, "integer");
232  $tree_set = $ilDB->query($query);
233  $tree_node = $tree_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
234  $seq = $tree->getChildSequenceNumber($tree_node, "st");
235 
236  $nr = $seq . "." . $nr;
237  }
238  }
239  }
240 
241  return $nr . $title;
242  }
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)
static getInstance(int $obj_id)
global $DIC
Definition: shib_login.php:22
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 82 of file class.ilStructureObject.php.

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

85  $chap = new ilStructureObject($a_target_lm);
86  $chap->setTitle($this->getTitle());
87  if ($this->getLMId() != $a_target_lm->getId()) {
88  $chap->setImportId("il__st_" . $this->getId());
89  }
90  $chap->setLMId($a_target_lm->getId());
91  $chap->setType($this->getType());
92  $chap->setDescription($this->getDescription());
93  $chap->create(true);
94  $a_copied_nodes[$this->getId()] = $chap->getId();
95 
96  // copy meta data
97  $this->lom_services->derive()
98  ->fromObject($this->getLMId(), $this->getId(), $this->getType())
99  ->forObject($a_target_lm->getId(), $chap->getId(), $this->getType());
100 
101  // copy translations
102  ilLMObjTranslation::copy($this->getId(), $chap->getId());
103 
104 
105  return $chap;
106  }
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 46 of file class.ilStructureObject.php.

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

46  : void
47  {
48  // only relevant for online help authoring
49  $this->help_map->removeScreenIdsOfChapter($this->getId());
50 
51  $node_data = $this->tree->getNodeData($this->getId());
52  $this->delete_rec($this->tree, $a_delete_meta_data);
53  $this->tree->deleteTree($node_data);
54  }
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 59 of file class.ilStructureObject.php.

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

Referenced by delete().

62  : void {
63  $childs = $a_tree->getChilds($this->getId());
64  foreach ($childs as $child) {
65  $obj = ilLMObjectFactory::getInstance($this->content_object, $child["obj_id"], false);
66  if (is_object($obj)) {
67  if ($obj->getType() == "st") {
68  $obj->delete_rec($a_tree, $a_delete_meta_data);
69  }
70  if ($obj->getType() == "pg") {
71  $obj->delete($a_delete_meta_data);
72  }
73  }
74  unset($obj);
75  }
76  parent::delete($a_delete_meta_data);
77  }
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 108 of file class.ilStructureObject.php.

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

112  : void {
113  $expLog->write(date("[y-m-d H:i:s] ") . "Structure Object " . $this->getId());
114  $attrs = array();
115  $a_xml_writer->xmlStartTag("StructureObject", $attrs);
116 
117  // MetaData
118  $this->exportXMLMetaData($a_xml_writer);
119 
120  // StructureObjects
121  $this->exportXMLPageObjects($a_xml_writer, $a_inst);
122 
123  // PageObjects
124  $this->exportXMLStructureObjects($a_xml_writer, $a_inst, $expLog);
125 
126  $a_xml_writer->xmlEndTag("StructureObject");
127  }
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 129 of file class.ilStructureObject.php.

Referenced by exportXML().

131  : void {
132  /*
133  * As far as I can tell, this is unused.
134  *
135  * I traced usages of this method up to ilObjContentObjectGUI::export and
136  * ilObjMediaPoolGUI::export (both via ilObjContentObject::exportXML), which have
137  * both been made redundant by the usual export mechanisms.
138  */
139  /*$md2xml = new ilMD2XML($this->getLMId(), $this->getId(), $this->getType());
140  $md2xml->setExportMode(true);
141  $md2xml->startExport();
142  $a_xml_writer->appendXML($md2xml->getXML());*/
143  }
+ Here is the caller graph for this function:

◆ exportXMLPageObjects()

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

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

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

Referenced by exportXML().

247  : void {
248  $childs = $this->tree->getChilds($this->getId());
249  foreach ($childs as $child) {
250  if ($child["type"] != "pg") {
251  continue;
252  }
253 
254  // export xml to writer object
255  ilLMPageObject::_exportXMLAlias($a_xml_writer, $child["obj_id"], $a_inst);
256  }
257  }
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 259 of file class.ilStructureObject.php.

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

Referenced by exportXML().

263  : void {
264  $childs = $this->tree->getChilds($this->getId());
265  foreach ($childs as $child) {
266  if ($child["type"] != "st") {
267  continue;
268  }
269 
270  // export xml to writer object
271  $structure_obj = new ilStructureObject(
272  $this->getContentObject(),
273  $child["obj_id"]
274  );
275  $structure_obj->exportXML($a_xml_writer, $a_inst, $expLog);
276  unset($structure_obj);
277  }
278  }
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 281 of file class.ilStructureObject.php.

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

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

283  : array {
284  $tree = new ilLMTree($a_lm_id);
285 
286  $chapters = array();
287  $ndata = $tree->getNodeData($tree->readRootId());
288  $childs = $tree->getSubTree($ndata);
289  foreach ($childs as $child) {
290  if ($child["type"] == "st") {
291  $chapters[] = $child;
292  }
293  }
294  return $chapters;
295  }
getNodeData(int $a_node_id, ?int $a_tree_pk=null)
get all information of a node.
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 145 of file class.ilStructureObject.php.

References ilLMObject\getId(), and IL_INST_ID.

149  : string {
150  if ($a_tag == "Identifier" && $a_param == "Entry") {
151  $a_value = "il_" . IL_INST_ID . "_st_" . $this->getId();
152  }
153 
154  return $a_value;
155  }
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 28 of file class.ilStructureObject.php.

◆ $lom_services

LOMServices ilStructureObject::$lom_services
protected

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

◆ $origin_id

string ilStructureObject::$origin_id

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

◆ $tree

ilLMTree ilStructureObject::$tree

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


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