ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilLearningSequenceXMLWriter Class Reference
+ Inheritance diagram for ilLearningSequenceXMLWriter:
+ Collaboration diagram for ilLearningSequenceXMLWriter:

Public Member Functions

 __construct (protected ilObjLearningSequence $ls_object, protected ilSetting $settings, protected ilLPObjSettings $lp_settings)
 
 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...
 

Data Fields

const TAG_LSO = 'LearningSequence'
 
const TAG_LSITEMS = 'LSItems'
 
const TAG_LSITEM = 'LSItem'
 
const TAG_MEMBERSGALLERY = 'MembersGallery'
 
const TAG_CONDITION = 'Condition'
 
const TAG_LPSETTING = 'LPSetting'
 
const TAG_LPREFID = 'LPRefId'
 
const TAG_TITLE = 'title'
 
const TAG_DESCRIPTION = 'description'
 
const TAG_CONTAINERSETTING = 'ContainerSetting'
 

Protected Member Functions

 writeHeader ()
 
 writeLearningSequence ()
 
 writeLPSettings ()
 
 writeLSItems ()
 
 writeFooter ()
 

Protected Attributes

ilLearningSequenceSettings $ls_settings
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

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

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

References ILIAS\GlobalScreen\Provider\__construct(), and ilObjLearningSequence\getLSSettings().

40  {
42  $this->ls_settings = $ls_object->getLSSettings();
43  }
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ getXml()

ilLearningSequenceXMLWriter::getXml ( )

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

References ilXmlWriter\xmlDumpMem().

45  : string
46  {
47  return $this->xmlDumpMem(false);
48  }
xmlDumpMem(bool $format=true)
Returns xml document from memory.
+ Here is the call graph for this function:

◆ start()

ilLearningSequenceXMLWriter::start ( )

◆ writeFooter()

ilLearningSequenceXMLWriter::writeFooter ( )
protected

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

References ilXmlWriter\xmlEndTag().

Referenced by start().

143  : void
144  {
145  $this->xmlEndTag(self::TAG_LSO);
146  }
xmlEndTag(string $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 58 of file class.ilLearningSequenceXMLWriter.php.

References ILIAS\Repository\settings(), ilXmlWriter\xmlSetDtdDef(), and ilXmlWriter\xmlSetGenCmt().

Referenced by start().

58  : void
59  {
60  $this->xmlSetDtdDef(
61  "<!DOCTYPE learning sequence PUBLIC \"-//ILIAS//DTD LearningSequence//EN\" \"" .
62  ILIAS_HTTP_PATH . "/xml/ilias_lso_9_0.dtd\">"
63  );
64 
65  $this->xmlSetGenCmt(
66  "Export of ILIAS LearningSequence " .
67  $this->ls_object->getId() .
68  " of installation " .
69  $this->settings->get("inst_id") .
70  "."
71  );
72  }
xmlSetGenCmt(string $genCmt)
Sets generated comment.
xmlSetDtdDef(string $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 74 of file class.ilLearningSequenceXMLWriter.php.

References ilContainer\_exportContainerSettings(), null, writeLPSettings(), ilXmlWriter\xmlElement(), and ilXmlWriter\xmlStartTag().

Referenced by start().

74  : void
75  {
76  $attributes = [
77  'ref_id' => $this->ls_object->getRefId(),
78  'members_gallery' => $this->ls_settings->getMembersGallery() ? 'true' : 'false'
79  ];
80  $this->xmlStartTag(self::TAG_LSO, $attributes);
81 
82  $this->xmlElement(self::TAG_TITLE, null, $this->ls_object->getTitle());
83  if ($desc = $this->ls_object->getDescription()) {
84  $this->xmlElement(self::TAG_DESCRIPTION, null, $desc);
85  }
86 
87  $this->writeLPSettings();
88  \ilContainer::_exportContainerSettings($this, $this->ls_object->getId());
89  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static _exportContainerSettings(ilXmlWriter $a_xml, int $a_obj_id)
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $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:

◆ writeLPSettings()

ilLearningSequenceXMLWriter::writeLPSettings ( )
protected

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

References ilLPCollection\getInstanceByMode(), null, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by writeLearningSequence().

91  : void
92  {
93  $type = $this->lp_settings->getObjType();
94  $mode = $this->lp_settings->getMode();
95  $this->xmlStartTag(
96  self::TAG_LPSETTING,
97  [
98  'type' => $type,
99  'mode' => $mode
100  ]
101  );
102  $collection = ilLPCollection::getInstanceByMode(
103  $this->ls_object->getId(),
104  $mode
105  );
106  if (!is_null($collection)) {
107  $items = $collection->getItems();
108  foreach ($items as $item) {
109  $this->xmlElement(self::TAG_LPREFID, null, $item);
110  }
111  }
112  $this->xmlEndTag(self::TAG_LPSETTING);
113  }
xmlEndTag(string $tag)
Writes an endtag.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getInstanceByMode(int $a_obj_id, int $a_mode)
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $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 115 of file class.ilLearningSequenceXMLWriter.php.

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

Referenced by start().

115  : void
116  {
117  $this->xmlStartTag(self::TAG_LSITEMS);
118 
119  $ls_items = $this->ls_object->getLSItems();
120  foreach ($ls_items as $ls_item) {
121  $post_condition = $ls_item->getPostCondition();
122 
123  $this->xmlStartTag(
124  self::TAG_LSITEM,
125  [
126  'obj_id' => \ilObject::_lookupObjectId($ls_item->getRefId()),
127  'ref_id' => $ls_item->getRefId()
128  ]
129  );
130 
131  $this->xmlElement(
132  self::TAG_CONDITION,
133  ['type' => $post_condition->getConditionOperator()],
134  $post_condition->getValue()
135  );
136 
137  $this->xmlEndTag(self::TAG_LSITEM);
138  }
139 
140  $this->xmlEndTag(self::TAG_LSITEMS);
141  }
xmlEndTag(string $tag)
Writes an endtag.
static _lookupObjectId(int $ref_id)
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $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:

Field Documentation

◆ $ls_settings

ilLearningSequenceSettings ilLearningSequenceXMLWriter::$ls_settings
protected

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

◆ TAG_CONDITION

const ilLearningSequenceXMLWriter::TAG_CONDITION = 'Condition'

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

◆ TAG_CONTAINERSETTING

const ilLearningSequenceXMLWriter::TAG_CONTAINERSETTING = 'ContainerSetting'

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

◆ TAG_DESCRIPTION

const ilLearningSequenceXMLWriter::TAG_DESCRIPTION = 'description'

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

◆ TAG_LPREFID

const ilLearningSequenceXMLWriter::TAG_LPREFID = 'LPRefId'

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

◆ TAG_LPSETTING

const ilLearningSequenceXMLWriter::TAG_LPSETTING = 'LPSetting'

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

◆ TAG_LSITEM

const ilLearningSequenceXMLWriter::TAG_LSITEM = 'LSItem'

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

◆ TAG_LSITEMS

const ilLearningSequenceXMLWriter::TAG_LSITEMS = 'LSItems'

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

◆ TAG_LSO

const ilLearningSequenceXMLWriter::TAG_LSO = 'LearningSequence'

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

◆ TAG_MEMBERSGALLERY

const ilLearningSequenceXMLWriter::TAG_MEMBERSGALLERY = 'MembersGallery'

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

◆ TAG_TITLE

const ilLearningSequenceXMLWriter::TAG_TITLE = 'title'

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


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