ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups 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.
 write ()
 Write XML.
- Public Member Functions inherited from ilXmlWriter
 ilXmlWriter ($version="1.0", $outEnc="utf-8", $inEnc="utf-8")
 constructor
 _ilXmlWriter ()
 destructor public
 xmlSetDtdDef ($dtdDef)
 Sets dtd definition.
 xmlSetStSheet ($stSheet)
 Sets stylesheet.
 xmlSetGenCmt ($genCmt)
 Sets generated comment.
 _xmlEscapeData ($data)
 Escapes reserved characters.
 xmlEncodeData ($data)
 Encodes text from input encoding into output encoding.
 xmlFormatData ($data)
 Indents text for better reading.
 xmlFormatElement ($array)
 Callback function for xmlFormatData; do not invoke directly.
 xmlHeader ()
 Writes xml header public.
 xmlStartTag ($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
 Writes a starttag.
 xmlEndTag ($tag)
 Writes an endtag.
 xmlComment ($comment)
 Writes a comment.
 xmlData ($data, $encode=TRUE, $escape=TRUE)
 Writes data.
 xmlElement ($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
 Writes a basic element (no children, just textual content)
 xmlDumpFile ($file, $format=TRUE)
 Dumps xml document from memory into a file.
 xmlDumpMem ($format=TRUE)
 Returns xml document from memory.
 appendXML ($a_str)
 append xml string to document
 xmlClear ()
 clears xmlStr public

Protected Member Functions

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

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

ilContainerXmlWriter::__construct (   $a_ref_id)

Constructor.

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

References ilExportOptions\getInstance().

{
$this->source = $a_ref_id;
$this->exp_options = ilExportOptions::getInstance();
}

+ Here is the call graph for this function:

Member Function Documentation

ilContainerXmlWriter::buildHeader ( )
protected

Build XML header.

Returns

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

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

{
$this->xmlSetDtdDef("<!DOCTYPE Container PUBLIC \"-//ILIAS//DTD Container//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_container_4_1.dtd\">");
$this->xmlSetGenCmt("Container object");
$this->xmlHeader();
return true;
}

+ Here is the call graph for this function:

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().

{
global $tree;
$this->xmlStartTag('Items');
$this->writeSubitems($this->source);
$this->xmlEndTag('Items');
}

+ Here is the call graph for this function:

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().

{
include_once './Services/Object/classes/class.ilObjectActivation.php';
$item = ilObjectActivation::getItem($a_ref_id);
$this->xmlStartTag(
'Timing',
array(
'Type' => $item['timing_type'],
'Visible' => $item['visible'],
'Changeable'=> $item['changeable'],
)
);
if($item['timing_start'])
{
$tmp_date = new ilDateTime($item['timing_start'],IL_CAL_UNIX);
$this->xmlElement('Start',array(),$tmp_date->get(IL_CAL_DATETIME,'',ilTimeZone::UTC));
}
if($item['timing_end'])
{
$tmp_date = new ilDateTime($item['timing_end'],IL_CAL_UNIX);
$this->xmlElement('End',array(),$tmp_date->get(IL_CAL_DATETIME,'',ilTimeZone::UTC));
}
if($item['suggestion_start'])
{
$tmp_date = new ilDateTime($item['suggestion_start'],IL_CAL_UNIX);
$this->xmlElement('SuggestionStart',array(),$tmp_date->get(IL_CAL_DATETIME,'',ilTimeZone::UTC));
}
if($item['suggestion_end'])
{
$tmp_date = new ilDateTime($item['suggestion_end'],IL_CAL_UNIX);
$this->xmlElement('SuggestionEnd',array(),$tmp_date->get(IL_CAL_DATETIME,'',ilTimeZone::UTC));
}
if($item['earliest_start'])
{
$tmp_date = new ilDateTime($item['earliest_start'],IL_CAL_UNIX);
$this->xmlElement('EarliestStart',array(),$tmp_date->get(IL_CAL_DATETIME,'',ilTimeZone::UTC));
}
if($item['latest_end'])
{
$tmp_date = new ilDateTime($item['latest_end'],IL_CAL_UNIX);
$this->xmlElement('LatestEnd',array(),$tmp_date->get(IL_CAL_DATETIME,'',ilTimeZone::UTC));
}
$this->xmlEndTag('Timing');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

{
global $tree;
$mode = $this->exp_options->getOptionByRefId($a_ref_id, ilExportOptions::KEY_ITEM_MODE);
if($mode == NULL or $mode == ilExportOptions::EXPORT_OMIT)
{
return false;
}
$obj_id = ilObject::_lookupObjId($a_ref_id);
$this->xmlStartTag(
'Item',
array(
'RefId' => $a_ref_id,
'Id' => $obj_id,
'Title' => ilObject::_lookupTitle($obj_id),
'Type' => ilObject::_lookupType($obj_id)
)
);
$this->writeCourseItemInformation($a_ref_id);
foreach($tree->getChilds($a_ref_id) as $node)
{
$this->writeSubitems($node['child']);
}
$this->xmlEndTag('Item');
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilContainerXmlWriter::$exp_options = null
protected

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

ilContainerXmlWriter::$source = 0
private

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


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