ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTestEvaluationData Class Reference
+ Collaboration diagram for ilTestEvaluationData:

Public Member Functions

 __sleep ()
 __construct ($test="")
 Constructor.
 __destruct ()
 generateOverview ()
 unsetParticipant ($active_id)
 getCompleteDataForParticipant ($active_id)
 getTest ()
 setTest ($test)
 setDatasets ($datasets)
 getDatasets ()
 addQuestionTitle ($question_id, $question_title)
 getQuestionTitles ()
 getQuestionTitle ($question_id)
 calculateStatistics ()
 getParticipants ()
 resetFilter ()
 setFilter ($by, $text)
 setFilterArray ($arrFilter)
 addParticipant ($active_id, $participant)
getParticipant ($active_id)
 participantExists ($active_id)
 removeParticipant ($active_id)
getStatistics ()
 getParticipantIds ()

Static Public Member Functions

static _getTimeStatsForParticipant ($active_id, $pass=null)
static _getTimeStatsForTest ($test_id)
static _getTimeStatsForQueryResult ($result)

Data Fields

 $questionTitles
 $participants
 $statistics
 $arrFilter
 $datasets

Private Attributes

 $test

Detailed Description

Definition at line 34 of file class.ilTestEvaluationData.php.

Constructor & Destructor Documentation

ilTestEvaluationData::__construct (   $test = "")

Constructor.

public

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

References $test, and generateOverview().

{
$this->participants = array();
$this->questionTitles = array();
if (is_object($test)) $this->test =& $test;
if (is_object($test))
{
$this->generateOverview();
}
}

+ Here is the call graph for this function:

ilTestEvaluationData::__destruct ( )

Definition at line 98 of file class.ilTestEvaluationData.php.

{
unset($this->participants);
$this->participants = array();
unset($this->questionTitles);
$this->questionTitles = array();
unset($this->test);
unset($this->statistics);
}

Member Function Documentation

ilTestEvaluationData::__sleep ( )

Definition at line 77 of file class.ilTestEvaluationData.php.

{
return array('questionTitles', 'participants', 'statistics', 'arrFilter', 'datasets', 'test');
}
static ilTestEvaluationData::_getTimeStatsForParticipant (   $active_id,
  $pass = null 
)
static

Definition at line 437 of file class.ilTestEvaluationData.php.

References $ilDB, $pass, and _getTimeStatsForQueryResult().

{
global $ilDB;
if (is_numeric($pass))
{
$result = $ilDB->queryF("SELECT * FROM tst_times WHERE active_fi = %s AND pass = %s",
array('integer', 'integer'),
array($active_id, $pass)
);
}
else
{
$result = $ilDB->queryF("SELECT * FROM tst_times WHERE active_fi = %s",
array('integer'),
array($active_id)
);
}
}

+ Here is the call graph for this function:

static ilTestEvaluationData::_getTimeStatsForQueryResult (   $result)
static

Definition at line 467 of file class.ilTestEvaluationData.php.

References $data, $ilDB, and $row.

Referenced by _getTimeStatsForParticipant(), and _getTimeStatsForTest().

{
global $ilDB;
$data = array();
while ($row = $ilDB->fetchAssoc($result))
{
if (!array_key_exists($row['question_fi'], $data))
{
$data[$row['question_fi']] = array();
}
if (!array_key_exists($row['pass'], $data[$row['question_fi']]))
{
$data[$row['question_fi']][$row['pass']] = array();
}
if (!array_key_exists($row['active_fi'], $data[$row['question_fi']][$row['pass']]))
{
$data[$row['question_fi']][$row['pass']][$row['active_fi']] = array();
}
preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["started"], $matches);
$epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
preg_match("/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row["finished"], $matches);
$epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
$timeInSeconds = ($epoch_2 - $epoch_1);
array_push($data[$row['question_fi']][$row['pass']][$row['active_fi']], $timeInSeconds);
}
return $data;
}

+ Here is the caller graph for this function:

static ilTestEvaluationData::_getTimeStatsForTest (   $test_id)
static

Definition at line 457 of file class.ilTestEvaluationData.php.

References $ilDB, and _getTimeStatsForQueryResult().

Referenced by ilTestEvaluationGUI\singleResults(), and ilTestExport\writeQuestionUsageTimes().

{
global $ilDB;
$result = $ilDB->queryF("SELECT tst_times.* FROM tst_times, tst_active WHERE tst_times.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
array('integer'),
array($test_id)
);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestEvaluationData::addParticipant (   $active_id,
  $participant 
)

Definition at line 407 of file class.ilTestEvaluationData.php.

Referenced by generateOverview().

{
$this->participants[$active_id] = $participant;
}

+ Here is the caller graph for this function:

ilTestEvaluationData::addQuestionTitle (   $question_id,
  $question_title 
)

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

Referenced by getCompleteDataForParticipant().

{
$this->questionTitles[$question_id] = $question_title;
}

+ Here is the caller graph for this function:

ilTestEvaluationData::calculateStatistics ( )

Definition at line 311 of file class.ilTestEvaluationData.php.

{
include_once "./Modules/Test/classes/class.ilTestStatistics.php";
$this->statistics = new ilTestStatistics($this);
}
ilTestEvaluationData::generateOverview ( )

Definition at line 108 of file class.ilTestEvaluationData.php.

References $data, $ilDB, $pass, $row, ilObjTest\_getQuestionCountAndPointsForPassOfParticipant(), addParticipant(), getParticipant(), getTest(), and participantExists().

Referenced by __construct().

{
$this->participants = array();
global $ilDB;
include_once "./Modules/Test/classes/class.ilTestEvaluationPassData.php";
include_once "./Modules/Test/classes/class.ilTestEvaluationUserData.php";
$result = $ilDB->queryF("SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
"tst_pass_result.* FROM tst_pass_result, tst_active " .
"LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
"WHERE tst_active.active_id = tst_pass_result.active_fi " .
"AND tst_active.test_fi = %s " .
"ORDER BY usr_data.lastname, usr_data.firstname, tst_pass_result.active_fi, tst_pass_result.pass, tst_pass_result.tstamp",
array('integer'),
array($this->getTest()->getTestId())
);
$pass = NULL;
$checked = array();
$thissets = 0;
while ($row = $ilDB->fetchAssoc($result))
{
$thissets++;
$remove = FALSE;
if (!$this->participantExists($row["active_fi"]))
{
$this->addParticipant($row["active_fi"], new ilTestEvaluationUserData($this->getTest()->getPassScoring()));
$this->getParticipant($row["active_fi"])->setName($this->getTest()->buildName($row["usr_id"], $row["firstname"], $row["lastname"], $row["title"]));
$this->getParticipant($row["active_fi"])->setLogin($row["login"]);
$this->getParticipant($row["active_fi"])->setUserID($row["usr_id"]);
}
if (!is_object($this->getParticipant($row["active_fi"])->getPass($row["pass"])))
{
$pass->setPass($row["pass"]);
$this->getParticipant($row["active_fi"])->addPass($row["pass"], $pass);
}
$this->getParticipant($row["active_fi"])->getPass($row["pass"])->setReachedPoints($row["points"]);
if ($row["questioncount"] == 0)
{
$this->getParticipant($row["active_fi"])->getPass($row["pass"])->setMaxPoints($data['points']);
$this->getParticipant($row["active_fi"])->getPass($row["pass"])->setQuestionCount($data['count']);
}
else
{
$this->getParticipant($row["active_fi"])->getPass($row["pass"])->setMaxPoints($row["maxpoints"]);
$this->getParticipant($row["active_fi"])->getPass($row["pass"])->setQuestionCount($row["questioncount"]);
}
$this->getParticipant($row["active_fi"])->getPass($row["pass"])->setNrOfAnsweredQuestions($row["answeredquestions"]);
$this->getParticipant($row["active_fi"])->getPass($row["pass"])->setWorkingTime($row["workingtime"]);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestEvaluationData::getCompleteDataForParticipant (   $active_id)

Definition at line 165 of file class.ilTestEvaluationData.php.

References $datasets, $ilDB, $pass, $row, addQuestionTitle(), getParticipant(), and getTest().

{
global $ilDB;
$result = $ilDB->queryF("SELECT tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
"qpl_questions.points maxpoints " .
"FROM tst_test_result, qpl_questions, tst_active " .
"WHERE tst_active.active_id = tst_test_result.active_fi " .
"AND qpl_questions.question_id = tst_test_result.question_fi " .
"AND tst_active.test_fi = %s AND tst_active.active_id = %s " .
"ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
array('integer', 'integer'),
array($this->getTest()->getTestId(), $active_id)
);
$pass = NULL;
$checked = array();
$datasets = 0;
while ($row = $ilDB->fetchAssoc($result))
{
$this->getParticipant($row["active_fi"])->getPass($row["pass"])->addAnsweredQuestion($row["question_fi"], $row["maxpoints"], $row["points"]);
}
if ($this->getTest()->isRandomTest())
{
for ($testpass = 0; $testpass <= $this->getParticipant($active_id)->getLastPass(); $testpass++)
{
$ilDB->setLimit($this->getTest()->getQuestionCount(), 0);
$result = $ilDB->queryF("SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, qpl_questions.original_id, " .
"tst_test_rnd_qst.pass, qpl_questions.points, qpl_questions.title " .
"FROM tst_test_rnd_qst, qpl_questions " .
"WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
"AND tst_test_rnd_qst.pass = %s " .
"AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence",
array('integer','integer'),
array($testpass, $active_id)
);
if ($result->numRows())
{
while ($row = $ilDB->fetchAssoc($result))
{
$tpass = array_key_exists("pass", $row) ? $row["pass"] : 0;
$this->getParticipant($active_id)->addQuestion($row["original_id"] ? $row["original_id"] : $row["question_fi"], $row["question_fi"], $row["points"], $row["sequence"], $tpass);
$this->addQuestionTitle($row["question_fi"], $row["title"]);
}
}
}
}
else
{
$result = $ilDB->queryF("SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
"qpl_questions.points, qpl_questions.title, qpl_questions.original_id " .
"FROM tst_test_question, tst_active, qpl_questions " .
"WHERE tst_test_question.question_fi = qpl_questions.question_id " .
"AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi ORDER BY tst_test_question.sequence",
array('integer'),
array($active_id)
);
if ($result->numRows())
{
$questionsbysequence = array();
while ($row = $ilDB->fetchAssoc($result))
{
$questionsbysequence[$row["sequence"]] = $row;
}
$seqresult = $ilDB->queryF("SELECT * FROM tst_sequence WHERE active_fi = %s",
array('integer'),
array($active_id)
);
while ($seqrow = $ilDB->fetchAssoc($seqresult))
{
$questionsequence = unserialize($seqrow["sequence"]);
foreach ($questionsequence as $sidx => $seq)
{
$qsid = $questionsbysequence[$seq]["original_id"] ? $questionsbysequence[$seq]["original_id"] : $questionsbysequence[$seq]["question_fi"];
$this->getParticipant($active_id)->addQuestion($qsid, $questionsbysequence[$seq]["question_fi"], $questionsbysequence[$seq]["points"], $sidx + 1, $seqrow["pass"]);
$this->addQuestionTitle($questionsbysequence[$seq]["question_fi"], $questionsbysequence[$seq]["title"]);
}
}
}
}
if ($this->getTest()->getECTSOutput())
{
$passed_array =& $this->getTest()->getTotalPointsPassedArray();
}
$percentage = $this->getParticipant($active_id)->getReachedPointsInPercent();
$mark = $this->getTest()->getMarkSchema()->getMatchingMark($percentage);
if (is_object($mark))
{
$this->getParticipant($active_id)->setMark($mark->getShortName());
$this->getParticipant($active_id)->setMarkOfficial($mark->getOfficialName());
$this->getParticipant($active_id)->setPassed($mark->getPassed());
}
if ($this->getTest()->getECTSOutput())
{
$ects_mark = $this->getTest()->getECTSGrade($passed_array, $this->getParticipant($active_id)->getReached(), $this->getParticipant($active_id)->getMaxPoints());
$this->getParticipant($active_id)->setECTSMark($ects_mark);
}
$visitingTime =& $this->getTest()->getVisitTimeOfParticipant($active_id);
$this->getParticipant($active_id)->setFirstVisit($visitingTime["firstvisit"]);
$this->getParticipant($active_id)->setLastVisit($visitingTime["lastvisit"]);
}

+ Here is the call graph for this function:

ilTestEvaluationData::getDatasets ( )

Definition at line 284 of file class.ilTestEvaluationData.php.

References $datasets.

{
}
& ilTestEvaluationData::getParticipant (   $active_id)

Definition at line 412 of file class.ilTestEvaluationData.php.

Referenced by generateOverview(), and getCompleteDataForParticipant().

{
return $this->participants[$active_id];
}

+ Here is the caller graph for this function:

ilTestEvaluationData::getParticipantIds ( )

Definition at line 432 of file class.ilTestEvaluationData.php.

{
return array_keys($this->participants);
}
ilTestEvaluationData::getParticipants ( )

Definition at line 317 of file class.ilTestEvaluationData.php.

References $ilDB, $participants, ilObject\_getIdsForTitle(), and ilParticipants\_getMembershipByType().

{
if (count($this->arrFilter))
{
$filteredParticipants = array();
$courseids = array();
$groupids = array();
global $ilDB;
if (array_key_exists('group', $this->arrFilter))
{
$ids = ilObject::_getIdsForTitle($this->arrFilter['group'], 'grp', true);
$groupids = array_merge($groupids, $ids);
}
if (array_key_exists('course', $this->arrFilter))
{
$ids = ilObject::_getIdsForTitle($this->arrFilter['course'], 'crs', true);
$courseids = array_merge($courseids, $ids);
}
foreach ($this->participants as $active_id => $participant)
{
$remove = FALSE;
if (array_key_exists('name', $this->arrFilter))
{
if (!(strpos(strtolower($participant->getName()), strtolower($this->arrFilter['name'])) !== FALSE)) $remove = TRUE;
}
if (!$remove)
{
if (array_key_exists('group', $this->arrFilter))
{
include_once "./Services/Membership/classes/class.ilParticipants.php";
$groups = ilParticipants::_getMembershipByType($participant->getUserID(), "grp");
$foundfilter = FALSE;
if (count(array_intersect($groupids, $groups))) $foundfilter = TRUE;
if (!$foundfilter) $remove = TRUE;
}
}
if (!$remove)
{
if (array_key_exists('course', $this->arrFilter))
{
include_once "./Services/Membership/classes/class.ilParticipants.php";
$courses = ilParticipants::_getMembershipByType($participant->getUserID(), "crs");
$foundfilter = FALSE;
if (count(array_intersect($courseids, $courses))) $foundfilter = TRUE;
if (!$foundfilter) $remove = TRUE;
}
}
if (!$remove)
{
if (array_key_exists('active_id', $this->arrFilter))
{
if ($active_id != $this->arrFilter['active_id']) $remove = TRUE;
}
}
if (!$remove) $filteredParticipants[$active_id] = $participant;
}
return $filteredParticipants;
}
else
{
}
}

+ Here is the call graph for this function:

ilTestEvaluationData::getQuestionTitle (   $question_id)

Definition at line 299 of file class.ilTestEvaluationData.php.

{
if (array_key_exists($question_id, $this->questionTitles))
{
return $this->questionTitles[$question_id];
}
else
{
return "";
}
}
ilTestEvaluationData::getQuestionTitles ( )

Definition at line 294 of file class.ilTestEvaluationData.php.

References $questionTitles.

{
}
& ilTestEvaluationData::getStatistics ( )

Definition at line 427 of file class.ilTestEvaluationData.php.

References $statistics.

{
}
ilTestEvaluationData::getTest ( )

Definition at line 269 of file class.ilTestEvaluationData.php.

References $test.

Referenced by generateOverview(), and getCompleteDataForParticipant().

{
return $this->test;
}

+ Here is the caller graph for this function:

ilTestEvaluationData::participantExists (   $active_id)

Definition at line 417 of file class.ilTestEvaluationData.php.

Referenced by generateOverview().

{
return array_key_exists($active_id, $this->participants);
}

+ Here is the caller graph for this function:

ilTestEvaluationData::removeParticipant (   $active_id)

Definition at line 422 of file class.ilTestEvaluationData.php.

{
unset($this->participants[$active_id]);
}
ilTestEvaluationData::resetFilter ( )

Definition at line 381 of file class.ilTestEvaluationData.php.

{
$this->arrFilter = array();
}
ilTestEvaluationData::setDatasets (   $datasets)

Definition at line 279 of file class.ilTestEvaluationData.php.

References $datasets.

{
$this->datasets = $datasets;
}
ilTestEvaluationData::setFilter (   $by,
  $text 
)

Definition at line 392 of file class.ilTestEvaluationData.php.

{
$this->arrFilter = array($by => $text);
}
ilTestEvaluationData::setFilterArray (   $arrFilter)

Definition at line 402 of file class.ilTestEvaluationData.php.

References $arrFilter.

{
$this->arrFilter = $arrFilter;
}
ilTestEvaluationData::setTest (   $test)

Definition at line 274 of file class.ilTestEvaluationData.php.

References $test.

{
$this->test =& $test;
}
ilTestEvaluationData::unsetParticipant (   $active_id)

Definition at line 160 of file class.ilTestEvaluationData.php.

{
unset($this->participants[$active_id]);
}

Field Documentation

ilTestEvaluationData::$arrFilter

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

Referenced by setFilterArray().

ilTestEvaluationData::$datasets
ilTestEvaluationData::$participants

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

Referenced by getParticipants().

ilTestEvaluationData::$questionTitles

Definition at line 41 of file class.ilTestEvaluationData.php.

Referenced by getQuestionTitles().

ilTestEvaluationData::$statistics

Definition at line 62 of file class.ilTestEvaluationData.php.

Referenced by getStatistics().

ilTestEvaluationData::$test
private

Definition at line 48 of file class.ilTestEvaluationData.php.

Referenced by __construct(), getTest(), and setTest().


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