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

Test results to XML class. More...

+ Inheritance diagram for ilTestResultsToXML:
+ Collaboration diagram for ilTestResultsToXML:

Public Member Functions

 __construct ($test_id, $anonymized=false)
 
 isIncludeRandomTestQuestionsEnabled ()
 
 setIncludeRandomTestQuestionsEnabled ($includeRandomTestQuestionsEnabled)
 
 getXML ()
 
 xmlDumpMem ($format=TRUE)
 
 xmlDumpFile ($file, $format=TRUE)
 
- 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

 exportActiveIDs ()
 
 exportPassResult ()
 
 exportResultCache ()
 
 exportTestSequence ()
 
 exportTestSolutions ()
 
 exportRandomTestQuestions ()
 
 exportTestResults ()
 
 exportTestTimes ()
 

Protected Attributes

 $includeRandomTestQuestionsEnabled = false
 

Private Attributes

 $test_id = 0
 
 $anonymized = false
 
 $active_ids
 

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

Test results to XML class.

Author
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilTestResultsToXML::__construct (   $test_id,
  $anonymized = false 
)

Definition at line 21 of file class.ilTestResultsToXML.php.

References $anonymized, and $test_id.

22  {
23  parent::__construct();
24  $this->test_id = $test_id;
25  $this->anonymized = $anonymized;
26  }

Member Function Documentation

◆ exportActiveIDs()

ilTestResultsToXML::exportActiveIDs ( )
protected

Definition at line 44 of file class.ilTestResultsToXML.php.

References $ilDB, $ilSetting, $result, $row, ilObjTestAccess\_getParticipantData(), array, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by getXML().

45  {
46  global $ilDB, $ilSetting;
47 
48  include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
49  $assessmentSetting = new ilSetting("assessment");
50  $user_criteria = $assessmentSetting->get("user_criteria");
51  if (strlen($user_criteria) == 0) $user_criteria = 'usr_id';
52 
53  if ($this->anonymized)
54  {
55  $result = $ilDB->queryF("SELECT * FROM tst_active WHERE test_fi = %s",
56  array('integer'),
57  array($this->test_id)
58  );
59  }
60  else
61  {
62  $result = $ilDB->queryF("SELECT tst_active.*, usr_data." . $user_criteria . " FROM tst_active, usr_data WHERE tst_active.test_fi = %s AND tst_active.user_fi = usr_data.usr_id",
63  array('integer'),
64  array($this->test_id)
65  );
66  }
67  $this->xmlStartTag("tst_active", NULL);
68  while ($row = $ilDB->fetchAssoc($result))
69  {
70  $attrs = array(
71  'active_id' => $row['active_id'],
72  'user_fi' => $row['user_fi'],
73  'anonymous_id' => $row['anonymous_id'],
74  'test_fi' => $row['test_fi'],
75  'lastindex' => $row['lastindex'],
76  'tries' => $row['tries'],
77  'last_started_pass' => $row['last_started_pass'],
78  'last_finished_pass' => $row['last_finished_pass'],
79  'submitted' => $row['submitted'],
80  'submittimestamp' => $row['submittimestamp'],
81  'tstamp' => $row['tstamp']
82  );
83  $attrs['fullname'] = ilObjTestAccess::_getParticipantData($row['active_id']);
84  if (!$this->anonymized)
85  {
86  $attrs['user_criteria'] = $user_criteria;
87  $attrs[$user_criteria] = $row[$user_criteria];
88  }
89  array_push($this->active_ids, $row['active_id']);
90  $this->xmlElement("row", $attrs);
91  }
92  $this->xmlEndTag("tst_active");
93  }
ILIAS Setting Class.
static _getParticipantData($active_id)
Retrieves a participant name from active id.
$result
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)
xmlEndTag($tag)
Writes an endtag.
Create styles array
The data for the language used.
global $ilSetting
Definition: privfeed.php:17
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportPassResult()

ilTestResultsToXML::exportPassResult ( )
protected

Definition at line 95 of file class.ilTestResultsToXML.php.

References $ilDB, $query, $result, $row, array, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by getXML().

96  {
97  global $ilDB;
98 
99  $query = "SELECT * FROM tst_pass_result WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY active_fi, pass";
100  $result = $ilDB->query($query);
101  $this->xmlStartTag("tst_pass_result", NULL);
102  while ($row = $ilDB->fetchAssoc($result))
103  {
104  $attrs = array(
105  'active_fi' => $row['active_fi'],
106  'pass' => $row['pass'],
107  'points' => $row['points'],
108  'maxpoints' => $row['maxpoints'],
109  'questioncount' => $row['questioncount'],
110  'answeredquestions' => $row['answeredquestions'],
111  'workingtime' => $row['workingtime'],
112  'tstamp' => $row['tstamp']
113  );
114  $this->xmlElement("row", $attrs);
115  }
116  $this->xmlEndTag("tst_pass_result");
117  }
$result
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)
xmlEndTag($tag)
Writes an endtag.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportRandomTestQuestions()

ilTestResultsToXML::exportRandomTestQuestions ( )
protected

Definition at line 190 of file class.ilTestResultsToXML.php.

References $ilDB, $result, $row, array, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by getXML().

191  {
192  global $ilDB;
193 
194  $result = $ilDB->query("
195  SELECT * FROM tst_test_rnd_qst
196  WHERE {$ilDB->in('active_fi', $this->active_ids, false, 'integer')}
197  ORDER BY test_random_question_id
198  ");
199 
200  $this->xmlStartTag('tst_test_rnd_qst', NULL);
201  while ($row = $ilDB->fetchAssoc($result))
202  {
203  $attrs = array();
204 
205  foreach($row as $field => $value)
206  {
207  $attrs[$field] = $value;
208  }
209 
210  $this->xmlElement('row', $attrs);
211  }
212  $this->xmlEndTag('tst_test_rnd_qst');
213  }
$result
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)
xmlEndTag($tag)
Writes an endtag.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportResultCache()

ilTestResultsToXML::exportResultCache ( )
protected

Definition at line 119 of file class.ilTestResultsToXML.php.

References $ilDB, $query, $result, $row, array, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by getXML().

120  {
121  global $ilDB;
122 
123  $query = "SELECT * FROM tst_result_cache WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY active_fi";
124  $result = $ilDB->query($query);
125  $this->xmlStartTag("tst_result_cache", NULL);
126  while ($row = $ilDB->fetchAssoc($result))
127  {
128  $attrs = array(
129  'active_fi' => $row['active_fi'],
130  'pass' => $row['pass'],
131  'max_points' => $row['max_points'],
132  'reached_points' => $row['reached_points'],
133  'mark_short' => $row['mark_short'],
134  'mark_official' => $row['mark_official'],
135  'passed' => $row['passed'],
136  'failed' => $row['failed'],
137  'tstamp' => $row['tstamp']
138  );
139  $this->xmlElement("row", $attrs);
140  }
141  $this->xmlEndTag("tst_result_cache");
142  }
$result
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)
xmlEndTag($tag)
Writes an endtag.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportTestResults()

ilTestResultsToXML::exportTestResults ( )
protected

Definition at line 216 of file class.ilTestResultsToXML.php.

References $ilDB, $query, $result, $row, array, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by getXML().

217  {
218  global $ilDB;
219 
220  $query = "SELECT * FROM tst_test_result WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY active_fi";
221  $result = $ilDB->query($query);
222  $this->xmlStartTag("tst_test_result", NULL);
223  while ($row = $ilDB->fetchAssoc($result))
224  {
225  $attrs = array(
226  'test_result_id' => $row['test_result_id'],
227  'active_fi' => $row['active_fi'],
228  'question_fi' => $row['question_fi'],
229  'points' => $row['points'],
230  'pass' => $row['pass'],
231  'manual' => $row['manual'],
232  'tstamp' => $row['tstamp']
233  );
234  $this->xmlElement("row", $attrs);
235  }
236  $this->xmlEndTag("tst_test_result");
237  }
$result
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)
xmlEndTag($tag)
Writes an endtag.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportTestSequence()

ilTestResultsToXML::exportTestSequence ( )
protected

Definition at line 144 of file class.ilTestResultsToXML.php.

References $ilDB, $query, $result, $row, array, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by getXML().

145  {
146  global $ilDB;
147 
148  $query = "SELECT * FROM tst_sequence WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY active_fi, pass";
149  $result = $ilDB->query($query);
150  $this->xmlStartTag("tst_sequence", NULL);
151  while ($row = $ilDB->fetchAssoc($result))
152  {
153  $attrs = array(
154  'active_fi' => $row['active_fi'],
155  'pass' => $row['pass'],
156  'sequence' => $row['sequence'],
157  'postponed' => $row['postponed'],
158  'hidden' => $row['hidden'],
159  'tstamp' => $row['tstamp']
160  );
161  $this->xmlElement("row", $attrs);
162  }
163  $this->xmlEndTag("tst_sequence");
164  }
$result
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)
xmlEndTag($tag)
Writes an endtag.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportTestSolutions()

ilTestResultsToXML::exportTestSolutions ( )
protected

Definition at line 166 of file class.ilTestResultsToXML.php.

References $ilDB, $query, $result, $row, array, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by getXML().

167  {
168  global $ilDB;
169 
170  $query = "SELECT * FROM tst_solutions WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY solution_id";
171  $result = $ilDB->query($query);
172  $this->xmlStartTag("tst_solutions", NULL);
173  while ($row = $ilDB->fetchAssoc($result))
174  {
175  $attrs = array(
176  'solution_id' => $row['solution_id'],
177  'active_fi' => $row['active_fi'],
178  'question_fi' => $row['question_fi'],
179  'points' => $row['points'],
180  'pass' => $row['pass'],
181  'value1' => $row['value1'],
182  'value2' => $row['value2'],
183  'tstamp' => $row['tstamp']
184  );
185  $this->xmlElement("row", $attrs);
186  }
187  $this->xmlEndTag("tst_solutions");
188  }
$result
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)
xmlEndTag($tag)
Writes an endtag.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exportTestTimes()

ilTestResultsToXML::exportTestTimes ( )
protected

Definition at line 239 of file class.ilTestResultsToXML.php.

References $ilDB, $query, $result, $row, array, ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by getXML().

240  {
241  global $ilDB;
242 
243  $query = "SELECT * FROM tst_times WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY active_fi";
244  $result = $ilDB->query($query);
245  $this->xmlStartTag("tst_times", NULL);
246  while ($row = $ilDB->fetchAssoc($result))
247  {
248  $attrs = array(
249  'times_id' => $row['times_id'],
250  'active_fi' => $row['active_fi'],
251  'started' => $row['started'],
252  'finished' => $row['finished'],
253  'pass' => $row['pass'],
254  'tstamp' => $row['tstamp']
255  );
256  $this->xmlElement("row", $attrs);
257  }
258  $this->xmlEndTag("tst_times");
259  }
$result
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)
xmlEndTag($tag)
Writes an endtag.
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getXML()

ilTestResultsToXML::getXML ( )

Definition at line 261 of file class.ilTestResultsToXML.php.

References array, exportActiveIDs(), exportPassResult(), exportRandomTestQuestions(), exportResultCache(), exportTestResults(), exportTestSequence(), exportTestSolutions(), exportTestTimes(), isIncludeRandomTestQuestionsEnabled(), ilXmlWriter\xmlEndTag(), ilXmlWriter\xmlHeader(), and ilXmlWriter\xmlStartTag().

Referenced by xmlDumpFile(), and xmlDumpMem().

262  {
263  $this->active_ids = array();
264  $this->xmlHeader();
265  $attrs = array("version" => "4.1.0");
266  $this->xmlStartTag("results", $attrs);
267  $this->exportActiveIDs();
268 
270  {
271  $this->exportRandomTestQuestions();
272  }
273 
274  $this->exportPassResult();
275  $this->exportResultCache();
276  $this->exportTestSequence();
277  $this->exportTestSolutions();
278  $this->exportTestResults();
279  $this->exportTestTimes();
280  $this->xmlEndTag("results");
281  }
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
xmlEndTag($tag)
Writes an endtag.
xmlHeader()
Writes xml header public.
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isIncludeRandomTestQuestionsEnabled()

ilTestResultsToXML::isIncludeRandomTestQuestionsEnabled ( )
Returns
boolean

Definition at line 31 of file class.ilTestResultsToXML.php.

References $includeRandomTestQuestionsEnabled.

Referenced by getXML().

+ Here is the caller graph for this function:

◆ setIncludeRandomTestQuestionsEnabled()

ilTestResultsToXML::setIncludeRandomTestQuestionsEnabled (   $includeRandomTestQuestionsEnabled)
Parameters
boolean$includeRandomTestQuestionsEnabled

Definition at line 39 of file class.ilTestResultsToXML.php.

References $includeRandomTestQuestionsEnabled.

Referenced by ilTestExport\buildExportFileXML().

40  {
41  $this->includeRandomTestQuestionsEnabled = $includeRandomTestQuestionsEnabled;
42  }
+ Here is the caller graph for this function:

◆ xmlDumpFile()

ilTestResultsToXML::xmlDumpFile (   $file,
  $format = TRUE 
)

Definition at line 289 of file class.ilTestResultsToXML.php.

References $file, and getXML().

290  {
291  $this->getXML();
292  return parent::xmlDumpFile($file, $format);
293  }
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
+ Here is the call graph for this function:

◆ xmlDumpMem()

ilTestResultsToXML::xmlDumpMem (   $format = TRUE)

Definition at line 283 of file class.ilTestResultsToXML.php.

References getXML().

284  {
285  $this->getXML();
286  return parent::xmlDumpMem($format);
287  }
+ Here is the call graph for this function:

Field Documentation

◆ $active_ids

ilTestResultsToXML::$active_ids
private

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

◆ $anonymized

ilTestResultsToXML::$anonymized = false
private

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

Referenced by __construct().

◆ $includeRandomTestQuestionsEnabled

ilTestResultsToXML::$includeRandomTestQuestionsEnabled = false
protected

◆ $test_id

ilTestResultsToXML::$test_id = 0
private

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

Referenced by __construct().


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