ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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)
 
 getXML ()
 
 xmlDumpMem ($format=TRUE)
 Returns xml document from memory. More...
 
 xmlDumpFile ($file, $format=TRUE)
 Dumps xml document from memory into a file. More...
 
- Public Member Functions inherited from ilXmlWriter
 ilXmlWriter ($version="1.0", $outEnc="utf-8", $inEnc="utf-8")
 constructor More...
 
 _ilXmlWriter ()
 destructor @access public More...
 
 xmlSetDtdDef ($dtdDef)
 Sets dtd definition. More...
 
 xmlSetStSheet ($stSheet)
 Sets stylesheet. More...
 
 xmlSetGenCmt ($genCmt)
 Sets generated comment. More...
 
 _xmlEscapeData ($data)
 Escapes reserved characters. 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 @access 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 @access public More...
 

Protected Member Functions

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

Private Attributes

 $test_id = 0
 
 $anonymized = false
 
 $active_ids
 

Additional Inherited Members

- 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 19 of file class.ilTestResultsToXML.php.

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

References $anonymized, and $test_id.

Member Function Documentation

◆ exportActiveIDs()

ilTestResultsToXML::exportActiveIDs ( )
protected

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

27 {
28 global $ilDB, $ilSetting;
29
30 include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
31 $assessmentSetting = new ilSetting("assessment");
32 $user_criteria = $assessmentSetting->get("user_criteria");
33 if (strlen($user_criteria) == 0) $user_criteria = 'usr_id';
34
35 if ($this->anonymized)
36 {
37 $result = $ilDB->queryF("SELECT * FROM tst_active WHERE test_fi = %s",
38 array('integer'),
39 array($this->test_id)
40 );
41 }
42 else
43 {
44 $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",
45 array('integer'),
46 array($this->test_id)
47 );
48 }
49 $this->xmlStartTag("tst_active", NULL);
50 while ($row = $ilDB->fetchAssoc($result))
51 {
52 $attrs = array(
53 'active_id' => $row['active_id'],
54 'user_fi' => $row['user_fi'],
55 'anonymous_id' => $row['anonymous_id'],
56 'test_fi' => $row['test_fi'],
57 'lastindex' => $row['lastindex'],
58 'tries' => $row['tries'],
59 'submitted' => $row['submitted'],
60 'submittimestamp' => $row['submittimestamp'],
61 'tstamp' => $row['tstamp']
62 );
63 $attrs['fullname'] = ilObjTestAccess::_getParticipantData($row['active_id']);
64 if (!$this->anonymized)
65 {
66 $attrs['user_criteria'] = $user_criteria;
67 $attrs[$user_criteria] = $row[$user_criteria];
68 }
69 array_push($this->active_ids, $row['active_id']);
70 $this->xmlElement("row", $attrs);
71 }
72 $this->xmlEndTag("tst_active");
73 }
$result
_getParticipantData($active_id)
Retrieves a participant name from active id.
ILIAS Setting Class.
xmlEndTag($tag)
Writes an endtag.
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)
global $ilSetting
Definition: privfeed.php:40
global $ilDB

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

Referenced by getXML().

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

◆ exportPassResult()

ilTestResultsToXML::exportPassResult ( )
protected

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

76 {
77 global $ilDB;
78
79 $query = "SELECT * FROM tst_pass_result WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY active_fi, pass";
80 $result = $ilDB->query($query);
81 $this->xmlStartTag("tst_pass_result", NULL);
82 while ($row = $ilDB->fetchAssoc($result))
83 {
84 $attrs = array(
85 'active_fi' => $row['active_fi'],
86 'pass' => $row['pass'],
87 'points' => $row['points'],
88 'maxpoints' => $row['maxpoints'],
89 'questioncount' => $row['questioncount'],
90 'answeredquestions' => $row['answeredquestions'],
91 'workingtime' => $row['workingtime'],
92 'tstamp' => $row['tstamp']
93 );
94 $this->xmlElement("row", $attrs);
95 }
96 $this->xmlEndTag("tst_pass_result");
97 }

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

Referenced by getXML().

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

◆ exportResultCache()

ilTestResultsToXML::exportResultCache ( )
protected

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

100 {
101 global $ilDB;
102
103 $query = "SELECT * FROM tst_result_cache WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY active_fi";
104 $result = $ilDB->query($query);
105 $this->xmlStartTag("tst_result_cache", NULL);
106 while ($row = $ilDB->fetchAssoc($result))
107 {
108 $attrs = array(
109 'active_fi' => $row['active_fi'],
110 'pass' => $row['pass'],
111 'max_points' => $row['max_points'],
112 'reached_points' => $row['reached_points'],
113 'mark_short' => $row['mark_short'],
114 'mark_official' => $row['mark_official'],
115 'passed' => $row['passed'],
116 'failed' => $row['failed'],
117 'tstamp' => $row['tstamp']
118 );
119 $this->xmlElement("row", $attrs);
120 }
121 $this->xmlEndTag("tst_result_cache");
122 }

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

Referenced by getXML().

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

◆ exportTestQuestions()

ilTestResultsToXML::exportTestQuestions ( )
protected

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

171 {
172 global $ilDB;
173
174 $result = $ilDB->queryF("SELECT * FROM tst_test_question WHERE test_fi = %s",
175 array('integer'),
176 array($this->test_id)
177 );
178 $this->xmlStartTag("tst_test_question", NULL);
179 while ($row = $ilDB->fetchAssoc($result))
180 {
181 $attrs = array(
182 'test_question_id' => $row['test_question_id'],
183 'test_fi' => $row['test_fi'],
184 'question_fi' => $row['question_fi'],
185 'sequence' => $row['sequence'],
186 'tstamp' => $row['tstamp']
187 );
188 $this->xmlElement("row", $attrs);
189 }
190 $this->xmlEndTag("tst_test_question");
191 }

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

Referenced by getXML().

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

◆ exportTestResults()

ilTestResultsToXML::exportTestResults ( )
protected

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

195 {
196 global $ilDB;
197
198 $query = "SELECT * FROM tst_test_result WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY active_fi";
199 $result = $ilDB->query($query);
200 $this->xmlStartTag("tst_test_result", NULL);
201 while ($row = $ilDB->fetchAssoc($result))
202 {
203 $attrs = array(
204 'test_result_id' => $row['test_result_id'],
205 'active_fi' => $row['active_fi'],
206 'question_fi' => $row['question_fi'],
207 'points' => $row['points'],
208 'pass' => $row['pass'],
209 'manual' => $row['manual'],
210 'tstamp' => $row['tstamp']
211 );
212 $this->xmlElement("row", $attrs);
213 }
214 $this->xmlEndTag("tst_test_result");
215 }

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

Referenced by getXML().

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

◆ exportTestSequence()

ilTestResultsToXML::exportTestSequence ( )
protected

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

125 {
126 global $ilDB;
127
128 $query = "SELECT * FROM tst_sequence WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY active_fi, pass";
129 $result = $ilDB->query($query);
130 $this->xmlStartTag("tst_sequence", NULL);
131 while ($row = $ilDB->fetchAssoc($result))
132 {
133 $attrs = array(
134 'active_fi' => $row['active_fi'],
135 'pass' => $row['pass'],
136 'sequence' => $row['sequence'],
137 'postponed' => $row['postponed'],
138 'hidden' => $row['hidden'],
139 'tstamp' => $row['tstamp']
140 );
141 $this->xmlElement("row", $attrs);
142 }
143 $this->xmlEndTag("tst_sequence");
144 }

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

Referenced by getXML().

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

◆ exportTestSolutions()

ilTestResultsToXML::exportTestSolutions ( )
protected

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

147 {
148 global $ilDB;
149
150 $query = "SELECT * FROM tst_solutions WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY solution_id";
151 $result = $ilDB->query($query);
152 $this->xmlStartTag("tst_solutions", NULL);
153 while ($row = $ilDB->fetchAssoc($result))
154 {
155 $attrs = array(
156 'solution_id' => $row['solution_id'],
157 'active_fi' => $row['active_fi'],
158 'question_fi' => $row['question_fi'],
159 'points' => $row['points'],
160 'pass' => $row['pass'],
161 'value1' => $row['value1'],
162 'value2' => $row['value2'],
163 'tstamp' => $row['tstamp']
164 );
165 $this->xmlElement("row", $attrs);
166 }
167 $this->xmlEndTag("tst_solutions");
168 }

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

Referenced by getXML().

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

◆ exportTestTimes()

ilTestResultsToXML::exportTestTimes ( )
protected

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

218 {
219 global $ilDB;
220
221 $query = "SELECT * FROM tst_times WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY active_fi";
222 $result = $ilDB->query($query);
223 $this->xmlStartTag("tst_times", NULL);
224 while ($row = $ilDB->fetchAssoc($result))
225 {
226 $attrs = array(
227 'times_id' => $row['times_id'],
228 'active_fi' => $row['active_fi'],
229 'started' => $row['started'],
230 'finished' => $row['finished'],
231 'pass' => $row['pass'],
232 'tstamp' => $row['tstamp']
233 );
234 $this->xmlElement("row", $attrs);
235 }
236 $this->xmlEndTag("tst_times");
237 }

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

Referenced by getXML().

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

◆ getXML()

ilTestResultsToXML::getXML ( )

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

240 {
241 $this->active_ids = array();
242 $this->xmlHeader();
243 $attrs = array("version" => "4.1.0");
244 $this->xmlStartTag("results", $attrs);
245 $this->exportActiveIDs();
246 $this->exportTestQuestions();
247 $this->exportPassResult();
248 $this->exportResultCache();
249 $this->exportTestSequence();
250 $this->exportTestSolutions();
251 $this->exportTestResults();
252 $this->exportTestTimes();
253 $this->xmlEndTag("results");
254 }
xmlHeader()
Writes xml header @access public.

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

Referenced by xmlDumpFile(), and xmlDumpMem().

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

◆ xmlDumpFile()

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

Dumps xml document from memory into a file.

Parameters
stringfile name (full path)
booleanindent text (TRUE) or not (FALSE) @access public

Reimplemented from ilXmlWriter.

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

263 {
264 $this->getXML();
265 return parent::xmlDumpFile($file, $format);
266 }
print $file

References $file, and getXML().

+ Here is the call graph for this function:

◆ xmlDumpMem()

ilTestResultsToXML::xmlDumpMem (   $format = TRUE)

Returns xml document from memory.

Parameters
booleanindent text (TRUE) or not (FALSE)
Returns
string xml document @access public

Reimplemented from ilXmlWriter.

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

257 {
258 $this->getXML();
259 return parent::xmlDumpMem($format);
260 }

References getXML().

+ 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().

◆ $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: