ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilLearningSequenceXMLWriter Class Reference
+ Inheritance diagram for ilLearningSequenceXMLWriter:
+ Collaboration diagram for ilLearningSequenceXMLWriter:

Public Member Functions

 __construct (ilObjLearningSequence $ls_object, ilSetting $il_settings, ilLPObjSettings $lp_settings, ilRbacReview $rbac_review)
 
 getXml ()
 
 start ()
 
- Public Member Functions inherited from ilXmlWriter
 __construct ($version="1.0", $outEnc="utf-8", $inEnc="utf-8")
 constructor More...
 
 _ilXmlWriter ()
 destructor public More...
 
 xmlSetDtdDef ($dtdDef)
 Sets dtd definition. More...
 
 xmlSetStSheet ($stSheet)
 Sets stylesheet. More...
 
 xmlSetGenCmt ($genCmt)
 Sets generated comment. More...
 
 xmlEncodeData ($data)
 Encodes text from input encoding into output encoding. More...
 
 xmlFormatData ($data)
 Indents text for better reading. More...
 
 xmlFormatElement ($array)
 Callback function for xmlFormatData; do not invoke directly. More...
 
 xmlHeader ()
 Writes xml header public. More...
 
 xmlStartTag ($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
 Writes a starttag. More...
 
 xmlEndTag ($tag)
 Writes an endtag. More...
 
 xmlComment ($comment)
 Writes a comment. More...
 
 xmlData ($data, $encode=true, $escape=true)
 Writes data. More...
 
 xmlElement ($tag, $attrs=null, $data=null, $encode=true, $escape=true)
 Writes a basic element (no children, just textual content) More...
 
 xmlDumpFile ($file, $format=true)
 Dumps xml document from memory into a file. More...
 
 xmlDumpMem ($format=true)
 Returns xml document from memory. More...
 
 appendXML ($a_str)
 append xml string to document More...
 
 xmlClear ()
 clears xmlStr public More...
 

Protected Member Functions

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

Additional Inherited Members

- Static Public Member Functions inherited from ilXmlWriter
static _xmlEscapeData ($data)
 Escapes reserved characters. More...
 
- Data Fields inherited from ilXmlWriter
 $xmlStr
 
 $version
 
 $outEnc
 
 $inEnc
 
 $dtdDef = ""
 
 $stSheet = ""
 
 $genCmt = "Generated by ILIAS XmlWriter"
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References ilObjLearningSequence\getLSSettings(), and settings().

15  {
16  $this->ls_object = $ls_object;
17  $this->il_settings = $il_settings;
18  $this->settings = $ls_object->getLSSettings();
19  $this->lp_settings = $lp_settings;
20  $this->rbac_review = $rbac_review;
21  }
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ encodeImage()

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

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

References $path.

Referenced by writeSettings().

144  : string
145  {
146  if (is_null($path) || $path == "") {
147  return "";
148  }
149 
150  return base64_encode(file_get_contents($path));
151  }
$path
Definition: aliased.php:25
+ Here is the caller graph for this function:

◆ getXml()

ilLearningSequenceXMLWriter::getXml ( )

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

References ilXmlWriter\xmlDumpMem().

24  {
25  return $this->xmlDumpMem(false);
26  }
xmlDumpMem($format=true)
Returns xml document from memory.
+ Here is the call graph for this function:

◆ start()

ilLearningSequenceXMLWriter::start ( )

Definition at line 28 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 69 of file class.ilLearningSequenceXMLWriter.php.

References ilXmlWriter\xmlElement().

Referenced by start().

70  {
71  $this->xmlElement("description", null, $this->ls_object->getDescription());
72  }
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeFooter()

ilLearningSequenceXMLWriter::writeFooter ( )
protected

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

References ilXmlWriter\xmlEndTag().

Referenced by start().

154  {
155  $this->xmlEndTag('lso');
156  }
xmlEndTag($tag)
Writes an endtag.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeHeader()

ilLearningSequenceXMLWriter::writeHeader ( )
protected

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

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

Referenced by start().

42  {
43  $this->xmlSetDtdDef(
44  "<!DOCTYPE learning sequence PUBLIC \"-//ILIAS//DTD LearningSequence//EN\" \"" .
45  ILIAS_HTTP_PATH . "/xml/ilias_lso_5_4.dtd\">"
46  );
47 
48  $this->xmlSetGenCmt(
49  "Export of ILIAS LearningSequence " .
50  $this->ls_object->getId() .
51  " of installation " .
52  $this->il_settings->get("inst_id") .
53  "."
54  );
55  }
xmlSetGenCmt($genCmt)
Sets generated comment.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeLearningSequence()

ilLearningSequenceXMLWriter::writeLearningSequence ( )
protected

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

References ilXmlWriter\xmlStartTag().

Referenced by start().

58  {
59  $att["ref_id"] = $this->ls_object->getRefId();
60 
61  $this->xmlStartTag("lso", $att);
62  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeLPSettings()

ilLearningSequenceXMLWriter::writeLPSettings ( )
protected

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

References ilLPCollection\getInstanceByMode(), and ilXmlWriter\xmlElement().

Referenced by start().

122  {
123  if (!$this->il_settings->get("enable_tracking")) {
124  return;
125  }
126 
127  $collection = ilLPCollection::getInstanceByMode(
128  $this->ls_object->getId(),
129  (int) $this->lp_settings->getMode()
130  );
131 
132  if (!is_null($collection)) {
133  $items = $collection->getItems();
134 
135  foreach ($items as $item) {
136  $this->xmlElement("lp_item_ref_id", null, $item);
137  }
138  }
139 
140  $this->xmlElement("lp_type", null, $this->lp_settings->getObjType());
141  $this->xmlElement("lp_mode", null, $this->lp_settings->getMode());
142  }
static getInstanceByMode($a_obj_id, $a_mode)
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeLSItems()

ilLearningSequenceXMLWriter::writeLSItems ( )
protected

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

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

Referenced by start().

81  {
82  $ls_items = $this->ls_object->getLSItems();
83 
84  $this->xmlStartTag("ls_items");
85 
86  foreach ($ls_items as $ls_item) {
87  $post_condition = $ls_item->getPostCondition();
88  $att["id"] = $ls_item->getRefId();
89  $this->xmlStartTag("ls_item", $att);
90 
91  $this->xmlElement("ls_item_pc_ref_id", null, $post_condition->getRefId());
92  $this->xmlElement("ls_item_pc_condition_type", null, $post_condition->getConditionOperator());
93  $this->xmlElement("ls_item_pc_value", null, $post_condition->getValue());
94  $this->xmlElement("ls_item_type", null, $ls_item->getType());
95  $this->xmlElement("ls_item_title", null, $ls_item->getTitle());
96  $this->xmlElement("ls_item_description", null, $ls_item->getDescription());
97  $this->xmlElement("ls_item_icon_path", null, $ls_item->getIconPath());
98  $this->xmlElement("ls_item_is_online", null, (string) $ls_item->isOnline());
99  $this->xmlElement("ls_item_order_number", null, (string) $ls_item->getOrderNumber());
100 
101  $this->xmlEndTag("ls_item");
102  }
103 
104  $this->xmlEndTag("ls_items");
105  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
xmlEndTag($tag)
Writes an endtag.
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeOwner()

ilLearningSequenceXMLWriter::writeOwner ( )
protected

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

References ilXmlWriter\xmlElement().

Referenced by start().

75  {
76  $att['id'] = 'il_' . $this->il_settings->get("inst_id") . '_usr_' . $this->ls_object->getOwner();
77  $this->xmlElement('owner', $att);
78  }
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeSettings()

ilLearningSequenceXMLWriter::writeSettings ( )
protected

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

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

Referenced by start().

108  {
109  $abstract_img = $this->settings->getAbstractImage();
110  $extro_img = $this->settings->getExtroImage();
111 
112  $this->xmlElement("abstract", null, base64_encode($this->settings->getAbstract()));
113  $this->xmlElement("extro", null, base64_encode($this->settings->getExtro()));
114  $this->xmlElement("members_gallery", null, $this->settings->getMembersGallery());
115  $this->xmlElement("abstract_img", null, $abstract_img);
116  $this->xmlElement("extro_img", null, $extro_img);
117  $this->xmlElement("abstract_img_data", null, $this->encodeImage($abstract_img));
118  $this->xmlElement("extro_img_data", null, $this->encodeImage($extro_img));
119  }
settings()
Definition: settings.php:2
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeTitle()

ilLearningSequenceXMLWriter::writeTitle ( )
protected

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

References ilXmlWriter\xmlElement().

Referenced by start().

65  {
66  $this->xmlElement("title", null, $this->ls_object->getTitle());
67  }
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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