ILIAS  release_8 Revision v8.24
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)
 
 exportFO (ilXmlWriter $a_xml_writer)
 
 exportFOPageObjects (ilXmlWriter $a_xml_writer)
 
- 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
 

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)
 
- Protected Attributes inherited from ilLMObject
string $layout = ""
 
string $import_id = ""
 
ilObjUser $user
 
ilDBInterface $db
 
- 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 
)

Reimplemented from ilLMObject.

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

32 {
33 $this->setType("st");
34 parent::__construct($a_content_obj, $a_id);
35 $this->tree = new ilLMTree($this->getLMId());
36 }
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

References 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 141 of file class.ilStructureObject.php.

150 : string {
151 global $DIC;
152
153 $ilDB = $DIC->database();
154
155 if ($a_lm_id == 0) {
156 $a_lm_id = ilLMObject::_lookupContObjID($a_st_id);
157 }
158
159 if ($a_lm_id == 0) {
160 return "";
161 }
162
163 // this is optimized when ilLMObject::preloadDataByLM is invoked (e.g. done in ilLMExplorerGUI)
164 $title = "";
165 if ($a_include_short) {
166 $title = trim(ilLMObject::_lookupShortTitle($a_st_id));
167 }
168 if ($title == "") {
170 }
171
172 // this is also optimized since ilObjectTranslation re-uses instances for one lm
173 $ot = ilObjectTranslation::getInstance($a_lm_id);
174 $languages = $ot->getLanguages();
175
176 if ($a_lang != "-" && $ot->getContentActivated()) {
177 $lmobjtrans = new ilLMObjTranslation($a_st_id, $a_lang);
178 $trans_title = "";
179 if ($a_include_short) {
180 $trans_title = trim($lmobjtrans->getShortTitle());
181 }
182 if ($trans_title == "") {
183 $trans_title = $lmobjtrans->getTitle();
184 }
185 if ($trans_title == "") {
186 $lmobjtrans = new ilLMObjTranslation($a_st_id, $ot->getFallbackLanguage());
187 $trans_title = $lmobjtrans->getTitle();
188 }
189 if ($trans_title != "") {
190 $title = $trans_title;
191 }
192 }
193
194 $tree = ilLMTree::getInstance($a_lm_id);
195
196 $nr = "";
197 if ($a_include_numbers) {
198 // this is optimized, since isInTree is cached
199 if ($tree->isInTree($a_st_id)) {
200 // optimization needed from here
201
202 // get chapter tree node
203 $query = "SELECT * FROM lm_tree WHERE child = " .
204 $ilDB->quote($a_st_id, "integer") . " AND lm_id = " .
205 $ilDB->quote($a_lm_id, "integer");
206 $tree_set = $ilDB->query($query);
207 $tree_node = $tree_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
208 $depth = $tree_node["depth"];
209
210 $nr = $tree->getChildSequenceNumber($tree_node, "st") . " ";
211 for ($i = $depth - 1; $i > 1; $i--) {
212 // get next parent tree node
213 $query = "SELECT * FROM lm_tree WHERE child = " .
214 $ilDB->quote($tree_node["parent"], "integer") . " AND lm_id = " .
215 $ilDB->quote($a_lm_id, "integer");
216 $tree_set = $ilDB->query($query);
217 $tree_node = $tree_set->fetchRow(ilDBConstants::FETCHMODE_ASSOC);
218 $seq = $tree->getChildSequenceNumber($tree_node, "st");
219
220 $nr = $seq . "." . $nr;
221 }
222 }
223 }
224
225 return $nr . $title;
226 }
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)
static getInstance(int $obj_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.
global $DIC
Definition: feed.php:28
$i
Definition: metadata.php:41
$query

References ilLMObject\_lookupContObjID().

Referenced by ilLMTOCExplorerGUI\getNodeContent(), ilLMPresentationGUI\ilLocator(), ilLMPresentationGUI\showPrintView(), ilLMPresentationGUI\showPrintViewSelection(), and ilStructureObjectGUI\subchap().

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

77 $chap = new ilStructureObject($a_target_lm);
78 $chap->setTitle($this->getTitle());
79 if ($this->getLMId() != $a_target_lm->getId()) {
80 $chap->setImportId("il__st_" . $this->getId());
81 }
82 $chap->setLMId($a_target_lm->getId());
83 $chap->setType($this->getType());
84 $chap->setDescription($this->getDescription());
85 $chap->create(true);
86 $a_copied_nodes[$this->getId()] = $chap->getId();
87
88 // copy meta data
89 $md = new ilMD($this->getLMId(), $this->getId(), $this->getType());
90 $new_md = $md->cloneMD($a_target_lm->getId(), $chap->getId(), $this->getType());
91
92 // copy translations
93 ilLMObjTranslation::copy($this->getId(), $chap->getId());
94
95
96 return $chap;
97 }
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 38 of file class.ilStructureObject.php.

38 : void
39 {
40 // only relevant for online help authoring
42
43 $node_data = $this->tree->getNodeData($this->getId());
44 $this->delete_rec($this->tree, $a_delete_meta_data);
45 $this->tree->deleteTree($node_data);
46 }
static removeScreenIdsOfChapter(int $a_chap, int $a_module_id=0)
delete_rec(ilLMTree $a_tree, bool $a_delete_meta_data=true)
Delete sub tree.

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

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

54 : void {
55 $childs = $a_tree->getChilds($this->getId());
56 foreach ($childs as $child) {
57 $obj = ilLMObjectFactory::getInstance($this->content_object, $child["obj_id"], false);
58 if (is_object($obj)) {
59 if ($obj->getType() == "st") {
60 $obj->delete_rec($a_tree, $a_delete_meta_data);
61 }
62 if ($obj->getType() == "pg") {
63 $obj->delete($a_delete_meta_data);
64 }
65 }
66 unset($obj);
67 }
68 parent::delete($a_delete_meta_data);
69 }
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:

◆ exportFO()

ilStructureObject::exportFO ( ilXmlWriter  $a_xml_writer)

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

266 : void {
267
268 // fo:block (complete)
269 $attrs = array();
270 $attrs["font-family"] = "Times";
271 $attrs["font-size"] = "14pt";
272 $a_xml_writer->xmlElement("fo:block", $attrs, $this->getTitle());
273
274 // page objects
275 $this->exportFOPageObjects($a_xml_writer);
276 }
exportFOPageObjects(ilXmlWriter $a_xml_writer)
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)

◆ exportFOPageObjects()

ilStructureObject::exportFOPageObjects ( ilXmlWriter  $a_xml_writer)

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

280 : void {
281 $childs = $this->tree->getChilds($this->getId());
282 foreach ($childs as $child) {
283 if ($child["type"] != "pg") {
284 continue;
285 }
286
287 // export xml to writer object
288 $page_obj = new ilLMPageObject($this->getContentObject(), $child["obj_id"]);
289 $page_obj->exportFO($a_xml_writer);
290 }
291 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ exportXML()

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

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

103 : void {
104 $expLog->write(date("[y-m-d H:i:s] ") . "Structure Object " . $this->getId());
105 $attrs = array();
106 $a_xml_writer->xmlStartTag("StructureObject", $attrs);
107
108 // MetaData
109 $this->exportXMLMetaData($a_xml_writer);
110
111 // StructureObjects
112 $this->exportXMLPageObjects($a_xml_writer, $a_inst);
113
114 // PageObjects
115 $this->exportXMLStructureObjects($a_xml_writer, $a_inst, $expLog);
116
117 $a_xml_writer->xmlEndTag("StructureObject");
118 }
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 120 of file class.ilStructureObject.php.

122 : void {
123 $md2xml = new ilMD2XML($this->getLMId(), $this->getId(), $this->getType());
124 $md2xml->setExportMode(true);
125 $md2xml->startExport();
126 $a_xml_writer->appendXML($md2xml->getXML());
127 }
appendXML(string $a_str)
append xml string to document

◆ exportXMLPageObjects()

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

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

231 : void {
232 $childs = $this->tree->getChilds($this->getId());
233 foreach ($childs as $child) {
234 if ($child["type"] != "pg") {
235 continue;
236 }
237
238 // export xml to writer object
239 ilLMPageObject::_exportXMLAlias($a_xml_writer, $child["obj_id"], $a_inst);
240 }
241 }
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 243 of file class.ilStructureObject.php.

247 : void {
248 $childs = $this->tree->getChilds($this->getId());
249 foreach ($childs as $child) {
250 if ($child["type"] != "st") {
251 continue;
252 }
253
254 // export xml to writer object
255 $structure_obj = new ilStructureObject(
256 $this->getContentObject(),
257 $child["obj_id"]
258 );
259 $structure_obj->exportXML($a_xml_writer, $a_inst, $expLog);
260 unset($structure_obj);
261 }
262 }

◆ getChapterList()

static ilStructureObject::getChapterList ( int  $a_lm_id)
static

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

295 : array {
296 $tree = new ilLMTree($a_lm_id);
297
298 $chapters = array();
299 $ndata = $tree->getNodeData($tree->readRootId());
300 $childs = $tree->getSubTree($ndata);
301 foreach ($childs as $child) {
302 if ($child["type"] == "st") {
303 $chapters[] = $child;
304 }
305 }
306 return $chapters;
307 }
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 129 of file class.ilStructureObject.php.

133 : string {
134 if ($a_tag == "Identifier" && $a_param == "Entry") {
135 $a_value = "il_" . IL_INST_ID . "_st_" . $this->getId();
136 }
137
138 return $a_value;
139 }
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

◆ $origin_id

string ilStructureObject::$origin_id

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

◆ $tree

ilLMTree ilStructureObject::$tree

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


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