ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 140 of file class.ilLPXmlWriter.php.

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

Referenced by write().

141  {
142  global $ilDB;
143 
144  $this->xmlStartTag('LPData', array());
145 
146  $set = $ilDB->query(
147  $q = "SELECT * FROM ut_lp_marks " .
148  " WHERE status_changed >= " . $ilDB->quote($this->getTimestamp(), "timestamp")
149  );
150 
151  while ($rec = $ilDB->fetchAssoc($set)) {
152  $ref_ids = array();
153  if ($this->getIncludeRefIds()) {
154  $ref_ids = ilObject::_getAllReferences($rec["obj_id"]);
155  }
156 
157  if (!is_array($this->getTypeFilter()) ||
158  (count($this->getTypeFilter()) == 0) ||
159  in_array(ilObject::_lookupType($rec["obj_id"]), $this->getTypeFilter())) {
160  $this->xmlElement(
161  'LPChange',
162  array(
163  'UserId' => $rec["usr_id"],
164  'ObjId' => $rec["obj_id"],
165  'RefIds' => implode($ref_ids, ","),
166  'Timestamp' => $rec["status_changed"],
167  'LPStatus' => $rec["status"]
168  )
169  );
170  }
171  }
172 
173  $this->xmlEndTag('LPData');
174  }
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
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
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
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 109 of file class.ilLPXmlWriter.php.

References ilXmlWriter\xmlHeader().

Referenced by write().

110  {
111  //$this->xmlSetDtdDef("<!DOCTYPE LearningProgress PUBLIC \"-//ILIAS//DTD WebLinkAdministration//EN\" \"".ILIAS_HTTP_PATH."/xml/ilias_weblinks_4_0.dtd\">");
112  //$this->xmlSetGenCmt("WebLink Object");
113  $this->xmlHeader();
114 
115  return true;
116  }
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 124 of file class.ilLPXmlWriter.php.

References ilXmlWriter\xmlClear().

Referenced by write().

125  {
126  $this->xmlClear();
127 
128  /* if(!$this->obj_id)
129  {
130  throw new UnexpectedValueException('No obj_id given: ');
131  }*/
132  }
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  $this->buildHeader();
101  }
102  $this->addLPInformation();
103  }
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: