ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 xmlDumpFile ($file, $format=TRUE)
 Dumps xml document from memory into a file.
- Public Member Functions inherited from ilXmlWriter
 ilXmlWriter ($version="1.0", $outEnc="utf-8", $inEnc="utf-8")
 constructor
 _ilXmlWriter ()
 destructor public
 xmlSetDtdDef ($dtdDef)
 Sets dtd definition.
 xmlSetStSheet ($stSheet)
 Sets stylesheet.
 xmlSetGenCmt ($genCmt)
 Sets generated comment.
 _xmlEscapeData ($data)
 Escapes reserved characters.
 xmlEncodeData ($data)
 Encodes text from input encoding into output encoding.
 xmlFormatData ($data)
 Indents text for better reading.
 xmlFormatElement ($array)
 Callback function for xmlFormatData; do not invoke directly.
 xmlHeader ()
 Writes xml header public.
 xmlStartTag ($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
 Writes a starttag.
 xmlEndTag ($tag)
 Writes an endtag.
 xmlComment ($comment)
 Writes a comment.
 xmlData ($data, $encode=TRUE, $escape=TRUE)
 Writes data.
 xmlElement ($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
 Writes a basic element (no children, just textual content)
 appendXML ($a_str)
 append xml string to document
 xmlClear ()
 clears xmlStr public

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:
class.ilTestResultsToXML.php 44245 2013-08-17 11:15:45Z mbecker

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

Constructor & Destructor Documentation

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

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

References $anonymized, and $test_id.

{
$this->test_id = $test_id;
$this->anonymized = $anonymized;
}

Member Function Documentation

ilTestResultsToXML::exportActiveIDs ( )
protected

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

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

Referenced by getXML().

{
global $ilDB, $ilSetting;
include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
$assessmentSetting = new ilSetting("assessment");
$user_criteria = $assessmentSetting->get("user_criteria");
if (strlen($user_criteria) == 0) $user_criteria = 'usr_id';
if ($this->anonymized)
{
$result = $ilDB->queryF("SELECT * FROM tst_active WHERE test_fi = %s",
array('integer'),
array($this->test_id)
);
}
else
{
$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",
array('integer'),
array($this->test_id)
);
}
$this->xmlStartTag("tst_active", NULL);
while ($row = $ilDB->fetchAssoc($result))
{
$attrs = array(
'active_id' => $row['active_id'],
'user_fi' => $row['user_fi'],
'anonymous_id' => $row['anonymous_id'],
'test_fi' => $row['test_fi'],
'lastindex' => $row['lastindex'],
'tries' => $row['tries'],
'submitted' => $row['submitted'],
'submittimestamp' => $row['submittimestamp'],
'tstamp' => $row['tstamp']
);
$attrs['fullname'] = ilObjTestAccess::_getParticipantData($row['active_id']);
if (!$this->anonymized)
{
$attrs['user_criteria'] = $user_criteria;
$attrs[$user_criteria] = $row[$user_criteria];
}
array_push($this->active_ids, $row['active_id']);
$this->xmlElement("row", $attrs);
}
$this->xmlEndTag("tst_active");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestResultsToXML::exportPassResult ( )
protected

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

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

Referenced by getXML().

{
global $ilDB;
$query = "SELECT * FROM tst_pass_result WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY active_fi, pass";
$result = $ilDB->query($query);
$this->xmlStartTag("tst_pass_result", NULL);
while ($row = $ilDB->fetchAssoc($result))
{
$attrs = array(
'active_fi' => $row['active_fi'],
'pass' => $row['pass'],
'points' => $row['points'],
'maxpoints' => $row['maxpoints'],
'questioncount' => $row['questioncount'],
'answeredquestions' => $row['answeredquestions'],
'workingtime' => $row['workingtime'],
'tstamp' => $row['tstamp']
);
$this->xmlElement("row", $attrs);
}
$this->xmlEndTag("tst_pass_result");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestResultsToXML::exportResultCache ( )
protected

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

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

Referenced by getXML().

{
global $ilDB;
$query = "SELECT * FROM tst_result_cache WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY active_fi";
$result = $ilDB->query($query);
$this->xmlStartTag("tst_result_cache", NULL);
while ($row = $ilDB->fetchAssoc($result))
{
$attrs = array(
'active_fi' => $row['active_fi'],
'pass' => $row['pass'],
'max_points' => $row['max_points'],
'reached_points' => $row['reached_points'],
'mark_short' => $row['mark_short'],
'mark_official' => $row['mark_official'],
'passed' => $row['passed'],
'failed' => $row['failed'],
'tstamp' => $row['tstamp']
);
$this->xmlElement("row", $attrs);
}
$this->xmlEndTag("tst_result_cache");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestResultsToXML::exportTestQuestions ( )
protected

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

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

Referenced by getXML().

{
global $ilDB;
$result = $ilDB->queryF("SELECT * FROM tst_test_question WHERE test_fi = %s",
array('integer'),
array($this->test_id)
);
$this->xmlStartTag("tst_test_question", NULL);
while ($row = $ilDB->fetchAssoc($result))
{
$attrs = array(
'test_question_id' => $row['test_question_id'],
'test_fi' => $row['test_fi'],
'question_fi' => $row['question_fi'],
'sequence' => $row['sequence'],
'tstamp' => $row['tstamp']
);
$this->xmlElement("row", $attrs);
}
$this->xmlEndTag("tst_test_question");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestResultsToXML::exportTestResults ( )
protected

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

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

Referenced by getXML().

{
global $ilDB;
$query = "SELECT * FROM tst_test_result WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY active_fi";
$result = $ilDB->query($query);
$this->xmlStartTag("tst_test_result", NULL);
while ($row = $ilDB->fetchAssoc($result))
{
$attrs = array(
'test_result_id' => $row['test_result_id'],
'active_fi' => $row['active_fi'],
'question_fi' => $row['question_fi'],
'points' => $row['points'],
'pass' => $row['pass'],
'manual' => $row['manual'],
'tstamp' => $row['tstamp']
);
$this->xmlElement("row", $attrs);
}
$this->xmlEndTag("tst_test_result");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestResultsToXML::exportTestSequence ( )
protected

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

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

Referenced by getXML().

{
global $ilDB;
$query = "SELECT * FROM tst_sequence WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY active_fi, pass";
$result = $ilDB->query($query);
$this->xmlStartTag("tst_sequence", NULL);
while ($row = $ilDB->fetchAssoc($result))
{
$attrs = array(
'active_fi' => $row['active_fi'],
'pass' => $row['pass'],
'sequence' => $row['sequence'],
'postponed' => $row['postponed'],
'hidden' => $row['hidden'],
'tstamp' => $row['tstamp']
);
$this->xmlElement("row", $attrs);
}
$this->xmlEndTag("tst_sequence");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestResultsToXML::exportTestSolutions ( )
protected

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

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

Referenced by getXML().

{
global $ilDB;
$query = "SELECT * FROM tst_solutions WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY solution_id";
$result = $ilDB->query($query);
$this->xmlStartTag("tst_solutions", NULL);
while ($row = $ilDB->fetchAssoc($result))
{
$attrs = array(
'solution_id' => $row['solution_id'],
'active_fi' => $row['active_fi'],
'question_fi' => $row['question_fi'],
'points' => $row['points'],
'pass' => $row['pass'],
'value1' => $row['value1'],
'value2' => $row['value2'],
'tstamp' => $row['tstamp']
);
$this->xmlElement("row", $attrs);
}
$this->xmlEndTag("tst_solutions");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestResultsToXML::exportTestTimes ( )
protected

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

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

Referenced by getXML().

{
global $ilDB;
$query = "SELECT * FROM tst_times WHERE " . $ilDB->in('active_fi', $this->active_ids, false, 'integer') . " ORDER BY active_fi";
$result = $ilDB->query($query);
$this->xmlStartTag("tst_times", NULL);
while ($row = $ilDB->fetchAssoc($result))
{
$attrs = array(
'times_id' => $row['times_id'],
'active_fi' => $row['active_fi'],
'started' => $row['started'],
'finished' => $row['finished'],
'pass' => $row['pass'],
'tstamp' => $row['tstamp']
);
$this->xmlElement("row", $attrs);
}
$this->xmlEndTag("tst_times");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestResultsToXML::getXML ( )

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

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

Referenced by xmlDumpFile(), and xmlDumpMem().

{
$this->active_ids = array();
$this->xmlHeader();
$attrs = array("version" => "4.1.0");
$this->xmlStartTag("results", $attrs);
$this->exportActiveIDs();
$this->exportPassResult();
$this->exportTestTimes();
$this->xmlEndTag("results");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Dumps xml document from memory into a file.

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

Reimplemented from ilXmlWriter.

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

References $file, and getXML().

Referenced by ilTestExport\buildExportFileXML().

{
$this->getXML();
return parent::xmlDumpFile($file, $format);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestResultsToXML::xmlDumpMem (   $format = TRUE)

Returns xml document from memory.

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

Reimplemented from ilXmlWriter.

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

References getXML().

{
$this->getXML();
return parent::xmlDumpMem($format);
}

+ Here is the call graph for this function:

Field Documentation

ilTestResultsToXML::$active_ids
private

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

ilTestResultsToXML::$anonymized = false
private

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

Referenced by __construct().

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: