ILIAS  trunk Revision v11.0_alpha-1861-g09f3d197f78
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 25 of file class.ilLPXmlWriter.php.

Constructor & Destructor Documentation

◆ __construct()

ilLPXmlWriter::__construct ( bool  $a_add_header)

Constructor.

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

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

38  {
39  global $DIC;
40 
41  $this->db = $DIC->database();
42  $this->add_header = $a_add_header;
44  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ addLPInformation()

ilLPXmlWriter::addLPInformation ( )

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

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

Referenced by write().

116  : void
117  {
118  $this->xmlStartTag('LPData', array());
119  $set = $this->db->query(
120  $q = "SELECT * FROM ut_lp_marks " .
121  " WHERE status_changed >= " . $this->db->quote(
122  $this->getTimestamp(),
123  "timestamp"
124  )
125  );
126 
127  while ($rec = $this->db->fetchAssoc($set)) {
128  $ref_ids = array();
129  if ($this->getIncludeRefIds()) {
130  $ref_ids = ilObject::_getAllReferences((int) $rec["obj_id"]);
131  }
132 
133  if (!is_array($this->getTypeFilter()) ||
134  (count($this->getTypeFilter()) == 0) ||
135  in_array(
136  ilObject::_lookupType((int) $rec["obj_id"]),
137  $this->getTypeFilter()
138  )) {
139  $this->xmlElement(
140  'LPChange',
141  array(
142  'UserId' => (int) $rec["usr_id"],
143  'ObjId' => (int) $rec["obj_id"],
144  'RefIds' => implode(",", $ref_ids),
145  'Timestamp' => $rec["status_changed"],
146  'LPStatus' => (int) $rec["status"]
147  )
148  );
149  }
150  }
151  $this->xmlEndTag('LPData');
152  }
static _getAllReferences(int $id)
get all reference ids for object ID
xmlEndTag(string $tag)
Writes an endtag.
getTypeFilter()
Get type filter.
$q
Definition: shib_logout.php:21
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
static _lookupType(int $id, bool $reference=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildHeader()

ilLPXmlWriter::buildHeader ( )
protected

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

References ilXmlWriter\xmlHeader().

Referenced by write().

106  : void
107  {
108  $this->xmlHeader();
109  }
xmlHeader()
Writes xml header.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getIncludeRefIds()

ilLPXmlWriter::getIncludeRefIds ( )

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

References $include_ref_ids.

Referenced by addLPInformation().

69  : bool
70  {
72  }
+ 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 59 of file class.ilLPXmlWriter.php.

References $timestamp.

59  : string
60  {
61  return $this->timestamp;
62  }

◆ getTypeFilter()

ilLPXmlWriter::getTypeFilter ( )

Get type filter.

Returns
string[]

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

References $type_filter.

Referenced by addLPInformation().

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

◆ init()

ilLPXmlWriter::init ( )
protected

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

References ilXmlWriter\xmlClear().

Referenced by write().

111  : void
112  {
113  $this->xmlClear();
114  }
xmlClear()
clears xmlStr
+ 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 64 of file class.ilLPXmlWriter.php.

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

◆ setTimestamp()

ilLPXmlWriter::setTimestamp ( string  $a_val)

Set timestamp.

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

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

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

◆ setTypeFilter()

ilLPXmlWriter::setTypeFilter ( array  $a_val)

Set type filter.

Parameters
string[]$a_val

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

78  : void
79  {
80  $this->type_filter = $a_val;
81  }

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

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

97  : void
98  {
99  $this->init();
100  if ($this->add_header) {
101  $this->buildHeader();
102  }
103  $this->addLPInformation();
104  }
+ Here is the call graph for this function:

Field Documentation

◆ $add_header

bool ilLPXmlWriter::$add_header = true
private

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

◆ $db

ilDBInterface ilLPXmlWriter::$db
protected

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

◆ $include_ref_ids

bool ilLPXmlWriter::$include_ref_ids = false
private

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

Referenced by getIncludeRefIds().

◆ $timestamp

string ilLPXmlWriter::$timestamp = ""
private

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

Referenced by getTimestamp().

◆ $type_filter

array ilLPXmlWriter::$type_filter = array()
private

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

Referenced by getTypeFilter().


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