ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 27 of file class.ilStructureObject.php.

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilLMObject.

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

37 {
38 global $DIC;
39
40 $this->setType("st");
41 parent::__construct($a_content_obj, $a_id);
42 $this->tree = new ilLMTree($this->getLMId());
43 $this->help_map = $DIC->help()->internal()->domain()->map();
44 $this->lom_services = $DIC->learningObjectMetadata();
45 }
setType(string $a_type)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

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

+ 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 158 of file class.ilStructureObject.php.

167 : string {
168 global $DIC;
169
170 $ilDB = $DIC->database();
171
172 if ($a_lm_id == 0) {
173 $a_lm_id = ilLMObject::_lookupContObjID($a_st_id);
174 }
175
176 if ($a_lm_id == 0) {
177 return "";
178 }
179
180 // this is optimized when ilLMObject::preloadDataByLM is invoked (e.g. done in ilLMExplorerGUI)
181 $title = "";
182 if ($a_include_short) {
183 $title = trim(ilLMObject::_lookupShortTitle($a_st_id));
184 }
185 if ($title == "") {
187 }
188
189 $ot = (new TranslationsRepository($ilDB))->getFor($a_lm_id);
190
191 if ($a_lang != "-" && $ot->getContentTranslationActivated()) {
192 $lmobjtrans = new ilLMObjTranslation($a_st_id, $a_lang);
193 $trans_title = "";
194 if ($a_include_short) {
195 $trans_title = trim($lmobjtrans->getShortTitle());
196 }
197 if ($trans_title == "") {
198 $trans_title = $lmobjtrans->getTitle();
199 }
200 if ($trans_title == "") {
201 $lmobjtrans = new ilLMObjTranslation($a_st_id, $ot->getDefaultLanguage());
202 $trans_title = $lmobjtrans->getTitle();
203 }
204 if ($trans_title != "") {
205 $title = $trans_title;
206 }
207 }
208
209 $tree = ilLMTree::getInstance($a_lm_id);
210
211 $nr = "";
212 if ($a_include_numbers) {
213 // this is optimized, since isInTree is cached
214 if ($tree->isInTree($a_st_id)) {
215 // optimization needed from here
216
217 // get chapter tree node
218 $query = "SELECT * FROM lm_tree WHERE child = " .
219 $ilDB->quote($a_st_id, "integer") . " AND lm_id = " .
220 $ilDB->quote($a_lm_id, "integer");
221 $tree_set = $ilDB->query($query);
222 $tree_node = $tree_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
223 $depth = $tree_node["depth"];
224
225 $nr = $tree->getChildSequenceNumber($tree_node, "st") . " ";
226 for ($i = $depth - 1; $i > 1; $i--) {
227 // get next parent tree node
228 $query = "SELECT * FROM lm_tree WHERE child = " .
229 $ilDB->quote($tree_node["parent"], "integer") . " AND lm_id = " .
230 $ilDB->quote($a_lm_id, "integer");
231 $tree_set = $ilDB->query($query);
232 $tree_node = $tree_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
233 $seq = $tree->getChildSequenceNumber($tree_node, "st");
234
235 $nr = $seq . "." . $nr;
236 }
237 }
238 }
239
240 return $nr . $title;
241 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupShortTitle(int $a_obj_id)
static _lookupContObjID(int $a_id)
get learning module id for lm object
static _lookupTitle(int $a_obj_id)
static getInstance(int $a_tree_id)
getChildSequenceNumber(array $a_node, string $type="")
get sequence number of node in sibling sequence
isInTree(?int $a_node_id)
get all information of a node.

References ilLMObject\_lookupContObjID().

Referenced by ilLMNavigationRendererGUI\addDropdown(), ilLMTOCExplorerGUI\getNodeContent(), ilLMPresentationGUI\ilLocator(), ilLMPresentationGUI\showPrintView(), and ilLMPresentationGUI\showPrintViewSelection().

+ 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 83 of file class.ilStructureObject.php.

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

References ILIAS\Survey\Mode\getId().

+ Here is the call graph for this function:

◆ delete()

ilStructureObject::delete ( bool  $a_delete_meta_data = true)

Reimplemented from ilLMObject.

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

47 : void
48 {
49 // only relevant for online help authoring
50 $this->help_map->removeScreenIdsOfChapter($this->getId());
51
52 $node_data = $this->tree->getNodeData($this->getId());
53 $this->delete_rec($this->tree, $a_delete_meta_data);
54 $this->tree->deleteTree($node_data);
55 }
delete_rec(ilLMTree $a_tree, bool $a_delete_meta_data=true)
Delete sub tree.

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

+ 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 60 of file class.ilStructureObject.php.

63 : void {
64 $childs = $a_tree->getChilds($this->getId());
65 foreach ($childs as $child) {
66 $obj = ilLMObjectFactory::getInstance($this->content_object, $child["obj_id"], false);
67 if (is_object($obj)) {
68 if ($obj->getType() == "st") {
69 $obj->delete_rec($a_tree, $a_delete_meta_data);
70 }
71 if ($obj->getType() == "pg") {
72 $obj->delete($a_delete_meta_data);
73 }
74 }
75 unset($obj);
76 }
77 parent::delete($a_delete_meta_data);
78 }
static getInstance(ilObjLearningModule $a_content_obj, int $a_id=0, bool $a_halt=true)
getChilds(int $a_node_id, string $a_order="", string $a_direction="ASC")
get child nodes of given node

References ilLMObjectFactory\getInstance().

Referenced by delete().

+ 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 109 of file class.ilStructureObject.php.

113 : void {
114 $expLog->write(date("[y-m-d H:i:s] ") . "Structure Object " . $this->getId());
115 $attrs = array();
116 $a_xml_writer->xmlStartTag("StructureObject", $attrs);
117
118 // MetaData
119 $this->exportXMLMetaData($a_xml_writer);
120
121 // StructureObjects
122 $this->exportXMLPageObjects($a_xml_writer, $a_inst);
123
124 // PageObjects
125 $this->exportXMLStructureObjects($a_xml_writer, $a_inst, $expLog);
126
127 $a_xml_writer->xmlEndTag("StructureObject");
128 }
write(string $a_msg, $a_log_level=null)
logging
exportXMLStructureObjects(ilXmlWriter $a_xml_writer, int $a_inst, ilLog $expLog)
exportXMLMetaData(ilXmlWriter $a_xml_writer)
exportXMLPageObjects(ilXmlWriter $a_xml_writer, int $a_inst=0)
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.

◆ exportXMLMetaData()

ilStructureObject::exportXMLMetaData ( ilXmlWriter  $a_xml_writer)

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

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

◆ exportXMLPageObjects()

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

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

246 : void {
247 $childs = $this->tree->getChilds($this->getId());
248 foreach ($childs as $child) {
249 if ($child["type"] != "pg") {
250 continue;
251 }
252
253 // export xml to writer object
254 ilLMPageObject::_exportXMLAlias($a_xml_writer, $child["obj_id"], $a_inst);
255 }
256 }
static _exportXMLAlias(ilXmlWriter $a_xml_writer, int $a_id, int $a_inst=0)
export page alias to xml

References ilLMPageObject\_exportXMLAlias().

+ Here is the call graph for this function:

◆ exportXMLStructureObjects()

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

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

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

◆ getChapterList()

static ilStructureObject::getChapterList ( int  $a_lm_id)
static

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

282 : array {
283 $tree = new ilLMTree($a_lm_id);
284
285 $chapters = array();
286 $ndata = $tree->getNodeData($tree->readRootId());
287 $childs = $tree->getSubTree($ndata);
288 foreach ($childs as $child) {
289 if ($child["type"] == "st") {
290 $chapters[] = $child;
291 }
292 }
293 return $chapters;
294 }
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

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

+ Here is the caller graph for this function:

◆ modifyExportIdentifier()

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

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

150 : string {
151 if ($a_tag == "Identifier" && $a_param == "Entry") {
152 $a_value = "il_" . IL_INST_ID . "_st_" . $this->getId();
153 }
154
155 return $a_value;
156 }
const IL_INST_ID
Definition: constants.php:40

References ILIAS\Survey\Mode\getId(), and IL_INST_ID.

+ Here is the call graph for this function:

Field Documentation

◆ $help_map

ILIAS Help Map MapManager ilStructureObject::$help_map
protected

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

◆ $lom_services

LOMServices ilStructureObject::$lom_services
protected

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

◆ $origin_id

string ilStructureObject::$origin_id

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

◆ $tree

ilLMTree ilStructureObject::$tree

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


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