ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilLPXmlWriter Class Reference

XML writer learning progress. More...

+ Inheritance diagram for ilLPXmlWriter:
+ Collaboration diagram for ilLPXmlWriter:

Public Member Functions

 __construct ($a_add_header)
 Constructor. More...
 
 setTimestamp ($a_val)
 Set timestamp. More...
 
 getTimestamp ()
 Get timestamp. More...
 
 setIncludeRefIds ($a_val)
 Set include ref ids. More...
 
 getIncludeRefIds ()
 Get include ref ids. More...
 
 setTypeFilter ($a_val)
 Set type filter. More...
 
 getTypeFilter ()
 Get type filter. More...
 
 write ()
 Write XML. More...
 
 addLPInformation ()
 Add lp information as xml. More...
 
- 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

 buildHeader ()
 Build XML header. More...
 
 init ()
 Init xml writer. More...
 

Private Attributes

 $add_header = true
 
 $timestamp = ""
 
 $include_ref_ids = false
 
 $type_filter = array()
 

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

XML writer learning progress.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 14 of file class.ilLPXmlWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilLPXmlWriter::__construct (   $a_add_header)

Constructor.

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

26  {
27  $this->add_header = $a_add_header;
28  parent::__construct();
29  }

Member Function Documentation

◆ addLPInformation()

ilLPXmlWriter::addLPInformation ( )

Add lp information as xml.

Parameters

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

References $ilDB, ilObject\_getAllReferences(), ilObject\_lookupType(), array, getIncludeRefIds(), getTypeFilter(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by write().

142  {
143  global $ilDB;
144 
145  $this->xmlStartTag('LPData', array());
146 
147  $set = $ilDB->query($q = "SELECT * FROM ut_lp_marks ".
148  " WHERE status_changed >= ".$ilDB->quote($this->getTimestamp(), "timestamp")
149  );
150 
151  while ($rec = $ilDB->fetchAssoc($set))
152  {
153  $ref_ids = array();
154  if ($this->getIncludeRefIds())
155  {
156  $ref_ids = ilObject::_getAllReferences($rec["obj_id"]);
157  }
158 
159  if (!is_array($this->getTypeFilter()) ||
160  (count($this->getTypeFilter()) == 0) ||
161  in_array(ilObject::_lookupType($rec["obj_id"]), $this->getTypeFilter()))
162  {
163  $this->xmlElement('LPChange',
164  array(
165  'UserId' => $rec["usr_id"],
166  'ObjId' => $rec["obj_id"],
167  'RefIds' => implode($ref_ids, ","),
168  'Timestamp' => $rec["status_changed"],
169  'LPStatus' => $rec["status"]
170  )
171  );
172  }
173  }
174 
175  $this->xmlEndTag('LPData');
176  }
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
getIncludeRefIds()
Get include ref ids.
static _getAllReferences($a_id)
get all reference ids of object
xmlEndTag($tag)
Writes an endtag.
getTypeFilter()
Get type filter.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildHeader()

ilLPXmlWriter::buildHeader ( )
protected

Build XML header.

Returns

Definition at line 110 of file class.ilLPXmlWriter.php.

References ilXmlWriter\xmlHeader().

Referenced by write().

111  {
112  //$this->xmlSetDtdDef("<!DOCTYPE LearningProgress PUBLIC \"-//ILIAS//DTD WebLinkAdministration//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_weblinks_4_0.dtd\">");
113  //$this->xmlSetGenCmt("WebLink Object");
114  $this->xmlHeader();
115 
116  return true;
117  }
xmlHeader()
Writes xml header public.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIncludeRefIds()

ilLPXmlWriter::getIncludeRefIds ( )

Get include ref ids.

Returns
bool include ref ids

Definition at line 66 of file class.ilLPXmlWriter.php.

References $include_ref_ids.

Referenced by addLPInformation().

67  {
69  }
+ Here is the caller graph for this function:

◆ getTimestamp()

ilLPXmlWriter::getTimestamp ( )

Get timestamp.

Returns
string timestamp (YYYY-MM-DD hh:mm:ss)

Definition at line 46 of file class.ilLPXmlWriter.php.

References $timestamp.

47  {
48  return $this->timestamp;
49  }

◆ getTypeFilter()

ilLPXmlWriter::getTypeFilter ( )

Get type filter.

Returns
array string of arrays

Definition at line 86 of file class.ilLPXmlWriter.php.

References $type_filter.

Referenced by addLPInformation().

87  {
88  return $this->type_filter;
89  }
+ Here is the caller graph for this function:

◆ init()

ilLPXmlWriter::init ( )
protected

Init xml writer.

Returns
bool
Exceptions
UnexpectedValueExceptionThrown if obj_id is not of type webr

Definition at line 125 of file class.ilLPXmlWriter.php.

References ilXmlWriter\xmlClear().

Referenced by write().

126  {
127  $this->xmlClear();
128 
129 /* if(!$this->obj_id)
130  {
131  throw new UnexpectedValueException('No obj_id given: ');
132  }*/
133  }
xmlClear()
clears xmlStr public
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setIncludeRefIds()

ilLPXmlWriter::setIncludeRefIds (   $a_val)

Set include ref ids.

Parameters
bool$a_valinclude ref ids

Definition at line 56 of file class.ilLPXmlWriter.php.

57  {
58  $this->include_ref_ids = $a_val;
59  }

◆ setTimestamp()

ilLPXmlWriter::setTimestamp (   $a_val)

Set timestamp.

Parameters
string$a_valtimestamp (YYYY-MM-DD hh:mm:ss)

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

37  {
38  $this->timestamp = $a_val;
39  }

◆ setTypeFilter()

ilLPXmlWriter::setTypeFilter (   $a_val)

Set type filter.

Parameters
array$a_valstring of arrays

Definition at line 76 of file class.ilLPXmlWriter.php.

77  {
78  $this->type_filter = $a_val;
79  }

◆ write()

ilLPXmlWriter::write ( )

Write XML.

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

Definition at line 96 of file class.ilLPXmlWriter.php.

References addLPInformation(), buildHeader(), and init().

97  {
98  $this->init();
99  if($this->add_header)
100  {
101  $this->buildHeader();
102  }
103  $this->addLPInformation();
104  }
buildHeader()
Build XML header.
init()
Init xml writer.
addLPInformation()
Add lp information as xml.
+ Here is the call graph for this function:

Field Documentation

◆ $add_header

ilLPXmlWriter::$add_header = true
private

Definition at line 16 of file class.ilLPXmlWriter.php.

◆ $include_ref_ids

ilLPXmlWriter::$include_ref_ids = false
private

Definition at line 19 of file class.ilLPXmlWriter.php.

Referenced by getIncludeRefIds().

◆ $timestamp

ilLPXmlWriter::$timestamp = ""
private

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

Referenced by getTimestamp().

◆ $type_filter

ilLPXmlWriter::$type_filter = array()
private

Definition at line 20 of file class.ilLPXmlWriter.php.

Referenced by getTypeFilter().


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