ILIAS  release_8 Revision v8.24
ilLPXmlWriter Class Reference

XML writer learning progress. More...

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

Public Member Functions

 __construct (bool $a_add_header)
 Constructor. More...
 
 setTimestamp (string $a_val)
 Set timestamp. More...
 
 getTimestamp ()
 Get timestamp. More...
 
 setIncludeRefIds (bool $a_val)
 
 getIncludeRefIds ()
 
 setTypeFilter (array $a_val)
 Set type filter. More...
 
 getTypeFilter ()
 Get type filter. More...
 
 write ()
 Write XML. More...
 
 addLPInformation ()
 
- 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...
 

Protected Member Functions

 buildHeader ()
 
 init ()
 

Protected Attributes

ilDBInterface $db
 

Private Attributes

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

Detailed Description

XML writer learning progress.

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

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

Constructor & Destructor Documentation

◆ __construct()

ilLPXmlWriter::__construct ( bool  $a_add_header)

Constructor.

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

24 {
25 global $DIC;
26
27 $this->db = $DIC->database();
28 $this->add_header = $a_add_header;
30 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ addLPInformation()

ilLPXmlWriter::addLPInformation ( )

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

102 : void
103 {
104 $this->xmlStartTag('LPData', array());
105 $set = $this->db->query(
106 $q = "SELECT * FROM ut_lp_marks " .
107 " WHERE status_changed >= " . $this->db->quote(
108 $this->getTimestamp(),
109 "timestamp"
110 )
111 );
112
113 while ($rec = $this->db->fetchAssoc($set)) {
114 $ref_ids = array();
115 if ($this->getIncludeRefIds()) {
116 $ref_ids = ilObject::_getAllReferences((int) $rec["obj_id"]);
117 }
118
119 if (!is_array($this->getTypeFilter()) ||
120 (count($this->getTypeFilter()) == 0) ||
121 in_array(
122 ilObject::_lookupType((int) $rec["obj_id"]),
123 $this->getTypeFilter()
124 )) {
125 $this->xmlElement(
126 'LPChange',
127 array(
128 'UserId' => (int) $rec["usr_id"],
129 'ObjId' => (int) $rec["obj_id"],
130 'RefIds' => implode(",", $ref_ids),
131 'Timestamp' => $rec["status_changed"],
132 'LPStatus' => (int) $rec["status"]
133 )
134 );
135 }
136 }
137 $this->xmlEndTag('LPData');
138 }
getTypeFilter()
Get type filter.
static _lookupType(int $id, bool $reference=false)
static _getAllReferences(int $id)
get all reference ids for object ID
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.

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

Referenced by write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildHeader()

ilLPXmlWriter::buildHeader ( )
protected

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

92 : void
93 {
94 $this->xmlHeader();
95 }
xmlHeader()
Writes xml header.

References ilXmlWriter\xmlHeader().

Referenced by write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIncludeRefIds()

ilLPXmlWriter::getIncludeRefIds ( )

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

55 : bool
56 {
58 }

References $include_ref_ids.

Referenced by addLPInformation().

+ 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 45 of file class.ilLPXmlWriter.php.

45 : string
46 {
47 return $this->timestamp;
48 }

References $timestamp.

◆ getTypeFilter()

ilLPXmlWriter::getTypeFilter ( )

Get type filter.

Returns
string[]

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

73 : array
74 {
75 return $this->type_filter;
76 }

References $type_filter.

Referenced by addLPInformation().

+ Here is the caller graph for this function:

◆ init()

ilLPXmlWriter::init ( )
protected

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

97 : void
98 {
99 $this->xmlClear();
100 }
xmlClear()
clears xmlStr

References ilXmlWriter\xmlClear().

Referenced by write().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setIncludeRefIds()

ilLPXmlWriter::setIncludeRefIds ( bool  $a_val)

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

50 : void
51 {
52 $this->include_ref_ids = $a_val;
53 }

◆ setTimestamp()

ilLPXmlWriter::setTimestamp ( string  $a_val)

Set timestamp.

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

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

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

◆ setTypeFilter()

ilLPXmlWriter::setTypeFilter ( array  $a_val)

Set type filter.

Parameters
string[]$a_val

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

64 : void
65 {
66 $this->type_filter = $a_val;
67 }

◆ 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 83 of file class.ilLPXmlWriter.php.

83 : void
84 {
85 $this->init();
86 if ($this->add_header) {
87 $this->buildHeader();
88 }
89 $this->addLPInformation();
90 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $add_header

bool ilLPXmlWriter::$add_header = true
private

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

◆ $db

ilDBInterface ilLPXmlWriter::$db
protected

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

◆ $include_ref_ids

bool ilLPXmlWriter::$include_ref_ids = false
private

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

Referenced by getIncludeRefIds().

◆ $timestamp

string ilLPXmlWriter::$timestamp = ""
private

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

Referenced by getTimestamp().

◆ $type_filter

array ilLPXmlWriter::$type_filter = array()
private

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

Referenced by getTypeFilter().


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