ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
ilContainerXmlWriter Class Reference

XML writer for container structure. More...

+ Inheritance diagram for ilContainerXmlWriter:
+ Collaboration diagram for ilContainerXmlWriter:

Public Member Functions

 __construct ($a_ref_id)
 Constructor. More...
 
 write ()
 Write XML. More...
 
- Public Member Functions inherited from ilXmlWriter
 ilXmlWriter ($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...
 
 _xmlEscapeData ($data)
 Escapes reserved characters. 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

 writeSubitems ($a_ref_id)
 Write tree childs Recursive method. More...
 
 writeCourseItemInformation ($a_ref_id)
 Write course item information Starting time, ending time... More...
 
 buildHeader ()
 Build XML header. More...
 

Protected Attributes

 $exp_options = null
 

Private Attributes

 $source = 0
 

Additional Inherited Members

- Data Fields inherited from ilXmlWriter
 $xmlStr
 
 $version
 
 $outEnc
 
 $inEnc
 
 $dtdDef = ""
 
 $stSheet = ""
 
 $genCmt = "Generated by ILIAS XmlWriter"
 

Detailed Description

XML writer for container structure.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 15 of file class.ilContainerXmlWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilContainerXmlWriter::__construct (   $a_ref_id)

Constructor.

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

References ilExportOptions\getInstance().

24  {
25  parent::__construct();
26  $this->source = $a_ref_id;
27  $this->exp_options = ilExportOptions::getInstance();
28 
29  }
static getInstance()
Get singelton instance.
+ Here is the call graph for this function:

Member Function Documentation

◆ buildHeader()

ilContainerXmlWriter::buildHeader ( )
protected

Build XML header.

Returns

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

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

144  {
145  $this->xmlSetDtdDef("<!DOCTYPE Container PUBLIC \"-//ILIAS//DTD Container//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_container_4_1.dtd\">");
146  $this->xmlSetGenCmt("Container object");
147  $this->xmlHeader();
148 
149  return true;
150  }
xmlSetGenCmt($genCmt)
Sets generated comment.
xmlSetDtdDef($dtdDef)
Sets dtd definition.
xmlHeader()
Writes xml header public.
+ Here is the call graph for this function:

◆ write()

ilContainerXmlWriter::write ( )

Write XML.

Returns
Exceptions
UnexpectedValueExceptionThrown if obj_id is not of type webr or no obj_id is given

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

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

37  {
38  global $tree;
39 
40  $this->xmlStartTag('Items');
41  $this->writeSubitems($this->source);
42  $this->xmlEndTag('Items');
43  }
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
writeSubitems($a_ref_id)
Write tree childs Recursive method.
xmlEndTag($tag)
Writes an endtag.
+ Here is the call graph for this function:

◆ writeCourseItemInformation()

ilContainerXmlWriter::writeCourseItemInformation (   $a_ref_id)
protected

Write course item information Starting time, ending time...

Parameters
int$a_ref_id
Returns

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

References ilObjectActivation\getItem(), IL_CAL_DATETIME, IL_CAL_UNIX, ilTimeZone\UTC, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by writeSubitems().

92  {
93  include_once './Services/Object/classes/class.ilObjectActivation.php';
94  $item = ilObjectActivation::getItem($a_ref_id);
95 
96  $this->xmlStartTag(
97  'Timing',
98  array(
99  'Type' => $item['timing_type'],
100  'Visible' => $item['visible'],
101  'Changeable'=> $item['changeable'],
102  )
103  );
104  if($item['timing_start'])
105  {
106  $tmp_date = new ilDateTime($item['timing_start'],IL_CAL_UNIX);
107  $this->xmlElement('Start',array(),$tmp_date->get(IL_CAL_DATETIME,'',ilTimeZone::UTC));
108  }
109  if($item['timing_end'])
110  {
111  $tmp_date = new ilDateTime($item['timing_end'],IL_CAL_UNIX);
112  $this->xmlElement('End',array(),$tmp_date->get(IL_CAL_DATETIME,'',ilTimeZone::UTC));
113  }
114  if($item['suggestion_start'])
115  {
116  $tmp_date = new ilDateTime($item['suggestion_start'],IL_CAL_UNIX);
117  $this->xmlElement('SuggestionStart',array(),$tmp_date->get(IL_CAL_DATETIME,'',ilTimeZone::UTC));
118  }
119  if($item['suggestion_end'])
120  {
121  $tmp_date = new ilDateTime($item['suggestion_end'],IL_CAL_UNIX);
122  $this->xmlElement('SuggestionEnd',array(),$tmp_date->get(IL_CAL_DATETIME,'',ilTimeZone::UTC));
123  }
124  if($item['earliest_start'])
125  {
126  $tmp_date = new ilDateTime($item['earliest_start'],IL_CAL_UNIX);
127  $this->xmlElement('EarliestStart',array(),$tmp_date->get(IL_CAL_DATETIME,'',ilTimeZone::UTC));
128  }
129  if($item['latest_end'])
130  {
131  $tmp_date = new ilDateTime($item['latest_end'],IL_CAL_UNIX);
132  $this->xmlElement('LatestEnd',array(),$tmp_date->get(IL_CAL_DATETIME,'',ilTimeZone::UTC));
133  }
134 
135  $this->xmlEndTag('Timing');
136 
137  }
const IL_CAL_DATETIME
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
static getItem($a_ref_id)
Get item data.
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
const IL_CAL_UNIX
xmlEndTag($tag)
Writes an endtag.
Date and time handling
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeSubitems()

ilContainerXmlWriter::writeSubitems (   $a_ref_id)
protected

Write tree childs Recursive method.

Parameters
object$a_ref_id
Returns

Definition at line 51 of file class.ilContainerXmlWriter.php.

References ilObject\_lookupObjId(), ilObject\_lookupTitle(), ilObject\_lookupType(), ilExportOptions\EXPORT_OMIT, ilExportOptions\KEY_ITEM_MODE, writeCourseItemInformation(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by write().

52  {
53  global $tree;
54 
55  $mode = $this->exp_options->getOptionByRefId($a_ref_id, ilExportOptions::KEY_ITEM_MODE);
56  if($mode == NULL or $mode == ilExportOptions::EXPORT_OMIT)
57  {
58  return false;
59  }
60 
61  $obj_id = ilObject::_lookupObjId($a_ref_id);
62 
63  $this->xmlStartTag(
64  'Item',
65  array(
66  'RefId' => $a_ref_id,
67  'Id' => $obj_id,
68  'Title' => ilObject::_lookupTitle($obj_id),
69  'Type' => ilObject::_lookupType($obj_id)
70  )
71  );
72 
73  $this->writeCourseItemInformation($a_ref_id);
74 
75  foreach($tree->getChilds($a_ref_id) as $node)
76  {
77  $this->writeSubitems($node['child']);
78  }
79 
80  $this->xmlEndTag('Item');
81  return true;
82  }
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
writeSubitems($a_ref_id)
Write tree childs Recursive method.
static _lookupTitle($a_id)
lookup object title
xmlEndTag($tag)
Writes an endtag.
writeCourseItemInformation($a_ref_id)
Write course item information Starting time, ending time...
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $exp_options

ilContainerXmlWriter::$exp_options = null
protected

Definition at line 17 of file class.ilContainerXmlWriter.php.

◆ $source

ilContainerXmlWriter::$source = 0
private

Definition at line 18 of file class.ilContainerXmlWriter.php.


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