ILIAS  release_8 Revision v8.24
ilLearningSequenceXMLWriter 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 ilLearningSequenceXMLWriter:
+ Collaboration diagram for ilLearningSequenceXMLWriter:

Public Member Functions

 __construct (ilObjLearningSequence $ls_object, ilSetting $settings, ilLPObjSettings $lp_settings, ilRbacReview $rbac_review)
 
 getXml ()
 
 start ()
 
- Public Member Functions inherited from ilXmlWriter
 __construct (string $version="1.0", string $outEnc="utf-8", string $inEnc="utf-8")
 
 xmlSetDtdDef (string $dtdDef)
 Sets dtd definition. More...
 
 xmlSetGenCmt (string $genCmt)
 Sets generated comment. More...
 
 xmlFormatData (string $data)
 Indents text for better reading. More...
 
 xmlHeader ()
 Writes xml header. More...
 
 xmlStartTag (string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
 Writes a starttag. More...
 
 xmlEndTag (string $tag)
 Writes an endtag. More...
 
 xmlData (string $data, bool $encode=true, bool $escape=true)
 Writes data. More...
 
 xmlElement (string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
 Writes a basic element (no children, just textual content) More...
 
 xmlDumpFile (string $file, bool $format=true)
 Dumps xml document from memory into a file. More...
 
 xmlDumpMem (bool $format=true)
 Returns xml document from memory. More...
 
 appendXML (string $a_str)
 append xml string to document More...
 
 xmlClear ()
 clears xmlStr More...
 

Protected Member Functions

 writeHeader ()
 
 writeLearningSequence ()
 
 writeTitle ()
 
 writeDescription ()
 
 writeOwner ()
 
 writeLSItems ()
 
 writeSettings ()
 
 writeLPSettings ()
 
 encodeImage (string $path=null)
 
 writeFooter ()
 

Protected Attributes

ilObjLearningSequence $ls_object
 
ilSetting $settings
 
ilLPObjSettings $lp_settings
 
ilRbacReview $rbac_review
 
ilLearningSequenceSettings $ls_settings
 

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

Definition at line 21 of file class.ilLearningSequenceXMLWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilLearningSequenceXMLWriter::__construct ( ilObjLearningSequence  $ls_object,
ilSetting  $settings,
ilLPObjSettings  $lp_settings,
ilRbacReview  $rbac_review 
)

Member Function Documentation

◆ encodeImage()

ilLearningSequenceXMLWriter::encodeImage ( string  $path = null)
protected

Definition at line 164 of file class.ilLearningSequenceXMLWriter.php.

164 : string
165 {
166 if ($path == "") {
167 return "";
168 }
169
170 return base64_encode(file_get_contents($path));
171 }
$path
Definition: ltiservices.php:32

References $path.

Referenced by writeSettings().

+ Here is the caller graph for this function:

◆ getXml()

ilLearningSequenceXMLWriter::getXml ( )

Definition at line 43 of file class.ilLearningSequenceXMLWriter.php.

43 : string
44 {
45 return $this->xmlDumpMem(false);
46 }
xmlDumpMem(bool $format=true)
Returns xml document from memory.

References ilXmlWriter\xmlDumpMem().

+ Here is the call graph for this function:

◆ start()

ilLearningSequenceXMLWriter::start ( )

Definition at line 48 of file class.ilLearningSequenceXMLWriter.php.

References writeDescription(), writeFooter(), writeHeader(), writeLearningSequence(), writeLPSettings(), writeLSItems(), writeOwner(), writeSettings(), and writeTitle().

+ Here is the call graph for this function:

◆ writeDescription()

ilLearningSequenceXMLWriter::writeDescription ( )
protected

Definition at line 89 of file class.ilLearningSequenceXMLWriter.php.

89 : void
90 {
91 $this->xmlElement("description", null, $this->ls_object->getDescription());
92 }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)

References ilXmlWriter\xmlElement().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeFooter()

ilLearningSequenceXMLWriter::writeFooter ( )
protected

Definition at line 173 of file class.ilLearningSequenceXMLWriter.php.

173 : void
174 {
175 $this->xmlEndTag('lso');
176 }
xmlEndTag(string $tag)
Writes an endtag.

References ilXmlWriter\xmlEndTag().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeHeader()

ilLearningSequenceXMLWriter::writeHeader ( )
protected

Definition at line 61 of file class.ilLearningSequenceXMLWriter.php.

61 : void
62 {
63 $this->xmlSetDtdDef(
64 "<!DOCTYPE learning sequence PUBLIC \"-//ILIAS//DTD LearningSequence//EN\" \"" .
65 ILIAS_HTTP_PATH . "/xml/ilias_lso_5_4.dtd\">"
66 );
67
68 $this->xmlSetGenCmt(
69 "Export of ILIAS LearningSequence " .
70 $this->ls_object->getId() .
71 " of installation " .
72 $this->settings->get("inst_id") .
73 "."
74 );
75 }
xmlSetGenCmt(string $genCmt)
Sets generated comment.
xmlSetDtdDef(string $dtdDef)
Sets dtd definition.

References ilXmlWriter\xmlSetDtdDef(), and ilXmlWriter\xmlSetGenCmt().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeLearningSequence()

ilLearningSequenceXMLWriter::writeLearningSequence ( )
protected

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

77 : void
78 {
79 $att["ref_id"] = $this->ls_object->getRefId();
80
81 $this->xmlStartTag("lso", $att);
82 }
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.

References ilXmlWriter\xmlStartTag().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeLPSettings()

ilLearningSequenceXMLWriter::writeLPSettings ( )
protected

Definition at line 141 of file class.ilLearningSequenceXMLWriter.php.

141 : void
142 {
143 if (!$this->settings->get("enable_tracking")) {
144 return;
145 }
146
148 $this->ls_object->getId(),
149 $this->lp_settings->getMode()
150 );
151
152 if (!is_null($collection)) {
153 $items = $collection->getItems();
154
155 foreach ($items as $item) {
156 $this->xmlElement("lp_item_ref_id", null, $item);
157 }
158 }
159
160 $this->xmlElement("lp_type", null, $this->lp_settings->getObjType());
161 $this->xmlElement("lp_mode", null, $this->lp_settings->getMode());
162 }
static getInstanceByMode(int $a_obj_id, int $a_mode)

References ilLPCollection\getInstanceByMode(), ILIAS\Repository\settings(), and ilXmlWriter\xmlElement().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeLSItems()

ilLearningSequenceXMLWriter::writeLSItems ( )
protected

Definition at line 100 of file class.ilLearningSequenceXMLWriter.php.

100 : void
101 {
102 $ls_items = $this->ls_object->getLSItems();
103
104 $this->xmlStartTag("ls_items");
105
106 foreach ($ls_items as $ls_item) {
107 $post_condition = $ls_item->getPostCondition();
108 $att["id"] = $ls_item->getRefId();
109 $this->xmlStartTag("ls_item", $att);
110
111 $this->xmlElement("ls_item_pc_ref_id", null, $post_condition->getRefId());
112 $this->xmlElement("ls_item_pc_condition_type", null, $post_condition->getConditionOperator());
113 $this->xmlElement("ls_item_pc_value", null, $post_condition->getValue());
114 $this->xmlElement("ls_item_type", null, $ls_item->getType());
115 $this->xmlElement("ls_item_title", null, $ls_item->getTitle());
116 $this->xmlElement("ls_item_description", null, $ls_item->getDescription());
117 $this->xmlElement("ls_item_icon_path", null, $ls_item->getIconPath());
118 $this->xmlElement("ls_item_is_online", null, (string) $ls_item->isOnline());
119 $this->xmlElement("ls_item_order_number", null, (string) $ls_item->getOrderNumber());
120
121 $this->xmlEndTag("ls_item");
122 }
123
124 $this->xmlEndTag("ls_items");
125 }

References ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeOwner()

ilLearningSequenceXMLWriter::writeOwner ( )
protected

Definition at line 94 of file class.ilLearningSequenceXMLWriter.php.

94 : void
95 {
96 $att['id'] = 'il_' . $this->settings->get("inst_id") . '_usr_' . $this->ls_object->getOwner();
97 $this->xmlElement('owner', $att);
98 }

References ILIAS\Repository\settings(), and ilXmlWriter\xmlElement().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeSettings()

ilLearningSequenceXMLWriter::writeSettings ( )
protected

Definition at line 127 of file class.ilLearningSequenceXMLWriter.php.

127 : void
128 {
129 $abstract_img = $this->ls_settings->getAbstractImage();
130 $extro_img = $this->ls_settings->getExtroImage();
131
132 $this->xmlElement("abstract", null, base64_encode($this->ls_settings->getAbstract()));
133 $this->xmlElement("extro", null, base64_encode($this->ls_settings->getExtro()));
134 $this->xmlElement("members_gallery", null, $this->ls_settings->getMembersGallery());
135 $this->xmlElement("abstract_img", null, $abstract_img);
136 $this->xmlElement("extro_img", null, $extro_img);
137 $this->xmlElement("abstract_img_data", null, $this->encodeImage($abstract_img));
138 $this->xmlElement("extro_img_data", null, $this->encodeImage($extro_img));
139 }

References encodeImage(), and ilXmlWriter\xmlElement().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeTitle()

ilLearningSequenceXMLWriter::writeTitle ( )
protected

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

84 : void
85 {
86 $this->xmlElement("title", null, $this->ls_object->getTitle());
87 }

References ilXmlWriter\xmlElement().

Referenced by start().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $lp_settings

ilLPObjSettings ilLearningSequenceXMLWriter::$lp_settings
protected

Definition at line 25 of file class.ilLearningSequenceXMLWriter.php.

Referenced by __construct().

◆ $ls_object

ilObjLearningSequence ilLearningSequenceXMLWriter::$ls_object
protected

Definition at line 23 of file class.ilLearningSequenceXMLWriter.php.

Referenced by __construct().

◆ $ls_settings

ilLearningSequenceSettings ilLearningSequenceXMLWriter::$ls_settings
protected

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

◆ $rbac_review

ilRbacReview ilLearningSequenceXMLWriter::$rbac_review
protected

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

Referenced by __construct().

◆ $settings

ilSetting ilLearningSequenceXMLWriter::$settings
protected

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

Referenced by __construct().


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