4require_once 
'Services/Object/classes/class.ilObject.php';
 
    5require_once 
'Modules/Test/classes/inc.AssessmentConstants.php';
 
    6require_once 
'Modules/Test/interfaces/interface.ilMarkSchemaAware.php';
 
    7require_once 
'Modules/Test/interfaces/interface.ilEctsGradesEnabled.php';
 
    8require_once 
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionType.php';
 
  600    public function __construct($a_id = 0, $a_call_by_reference = 
true)
 
  605        $this->refinery = 
$DIC[
'refinery'];
 
  608        $lng->loadLanguageModule(
"assessment");
 
  610        include_once 
"./Modules/Test/classes/class.assMarkSchema.php";
 
  612        $this->mark_schema->createSimpleSchema(
 
  613            $lng->txt(
"failed_short"),
 
  614            $lng->txt(
"failed_official"),
 
  617            $lng->txt(
"passed_short"),
 
  618            $lng->txt(
"passed_official"),
 
  624        $this->author = 
$ilUser->fullname;
 
  625        $this->introductionEnabled = 
false;
 
  626        $this->introduction = 
"";
 
  627        $this->questions = array();
 
  630        $this->instant_verification = 0;
 
  631        $this->answer_feedback_points = 0;
 
  632        $this->reporting_date = 
"";
 
  633        $this->nr_of_tries = 0;
 
  635        $this->use_previous_answers = 1;
 
  636        $this->title_output = 0;
 
  637        $this->starting_time = 
"";
 
  638        $this->ending_time = 
"";
 
  639        $this->processing_time = 
"";
 
  640        $this->enable_processing_time = 
"0";
 
  641        $this->reset_processing_time = 0;
 
  642        $this->ects_output = 
false;
 
  643        $this->ects_fx = 
null;
 
  644        $this->shuffle_questions = 
false;
 
  645        $this->mailnottype = 0;
 
  646        $this->exportsettings = 0;
 
  647        $this->show_summary = 8;
 
  652        $this->answer_feedback = 0;
 
  653        $this->password = 
"";
 
  654        $this->certificate_visibility = 0;
 
  655        $this->allowedUsers = 
"";
 
  656        $this->_showfinalstatement = 
false;
 
  657        $this->_finalstatement = 
"";
 
  658        $this->_showinfo = 
true;
 
  659        $this->_forcejs = 
true;
 
  660        $this->_customStyle = 
"";
 
  661        $this->allowedUsersTimeGap = 
"";
 
  662        $this->anonymity = 0;
 
  663        $this->show_cancel = 0;
 
  664        $this->show_marker = 0;
 
  665        $this->fixed_participants = 0;
 
  670        $this->testSession = 
false;
 
  671        $this->testSequence = 
false;
 
  672        $this->mailnotification = 0;
 
  673        $this->poolUsage = 1;
 
  675        $this->ects_grades = array(
 
  683        $this->autosave = 
false;
 
  684        $this->autosave_ival = 30000;
 
  686        $this->enable_examview = 
false;
 
  687        $this->show_examview_html = 
false;
 
  688        $this->show_examview_pdf = 
false;
 
  689        $this->enable_archiving = 
false;
 
  691        $this->express_mode = 
false;
 
  692        $this->template_id = 
'';
 
  693        $this->redirection_mode = 0;
 
  694        $this->redirection_url = 
null;
 
  695        $this->show_exam_id_in_test_pass_enabled = 
false;
 
  696        $this->show_exam_id_in_test_results_enabled = 
false;
 
  697        $this->sign_submission = 
false;
 
  698        $this->char_selector_availability = 0;
 
  699        $this->char_selector_definition = 
null;
 
  701        $this->showGradingStatusEnabled = 
true;
 
  702        $this->showGradingMarkEnabled = 
true;
 
  704        $this->followupQuestionAnswerFixationEnabled = 
false;
 
  705        $this->instantFeedbackAnswerFixationEnabled = 
false;
 
  707        $this->testFinalBroken = 
false;
 
  709        $this->tmpCopyWizardCopyId = 
null;
 
  721        require_once 
'Services/Utilities/classes/class.ilUtil.php';
 
  764        if (!parent::update()) {
 
  791    public function delete()
 
  794        if (!parent::delete()) {
 
  804        require_once 
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
 
  806        $qsaImportFails->deleteRegisteredImportFails();
 
  807        require_once 
'Modules/Test/classes/class.ilTestSkillLevelThresholdImportFails.php';
 
  809        $sltImportFails->deleteRegisteredImportFails();
 
  824        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
  827        require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
  829        $participantData->load($this->
getTestId());
 
  832        $affectedRows = 
$ilDB->manipulateF(
 
  833            "DELETE FROM tst_mark WHERE test_fi = %s",
 
  838        $affectedRows = 
$ilDB->manipulateF(
 
  839            "DELETE FROM tst_tests WHERE test_id = %s",
 
  844        require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
  846        $testQuestionSetConfigFactory->getQuestionSetConfig()->removeQuestionSetRelatedData();
 
  849        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  851        $directory = $tst_data_dir . 
"/tst_" . $this->
getId();
 
  852        if (is_dir($directory)) {
 
  853            include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  856        include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
  862        foreach (
$mobs as $mob) {
 
  878        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  881        if (!is_writable($tst_data_dir)) {
 
  882            $this->
ilias->raiseError(
"Test Data Directory (" . $tst_data_dir
 
  883                . 
") not writeable.", $this->
ilias->error_obj->MESSAGE);
 
  887        $tst_dir = $tst_data_dir . 
"/tst_" . $this->
getId();
 
  889        if (!@is_dir($tst_dir)) {
 
  890            $this->
ilias->raiseError(
"Creation of Test Directory failed.", $this->
ilias->error_obj->MESSAGE);
 
  893        $export_dir = $tst_dir . 
"/export";
 
  895        if (!@is_dir($export_dir)) {
 
  896            $this->
ilias->raiseError(
"Creation of Export Directory failed.", $this->
ilias->error_obj->MESSAGE);
 
  907        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  918    public function getExportFiles($dir)
 
  921        if (!@is_dir($dir) || !is_writeable($dir)) {
 
  926        foreach (
new DirectoryIterator($dir) as $file) {
 
  930            if ($file->isDir()) {
 
  934            $files[] = $file->getBasename();
 
  947        if (strlen($a_import_dir)) {
 
  948            $_SESSION[
"tst_import_dir"] = $a_import_dir;
 
  962        if (strlen(
$_SESSION[
"tst_import_dir"])) {
 
  981        $ilias = 
$DIC[
'ilias'];
 
  982        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  986        if (!is_writable($tst_data_dir)) {
 
  987            $ilias->raiseError(
"Test Data Directory (" . $tst_data_dir
 
  988                . 
") not writeable.", $ilias->error_obj->FATAL);
 
  992        $tst_dir = $tst_data_dir . 
"/tst_import";
 
  994        if (!@is_dir($tst_dir)) {
 
  995            $ilias->raiseError(
"Creation of test import directory failed.", $ilias->error_obj->FATAL);
 
 1016            "SELECT DISTINCT(qpl_qst_type.type_tag) foundtypes FROM qpl_questions, tst_test_result, qpl_qst_type, tst_active WHERE tst_test_result.question_fi = qpl_questions.question_id AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id AND tst_test_result.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
 
 1022            if (strcmp($row[
'foundtypes'], 
'assSingleChoice') == 0) {
 
 1041            "SELECT DISTINCT(qpl_qst_type.type_tag) foundtypes FROM qpl_questions, tst_test_result, qpl_qst_type, tst_active WHERE tst_test_result.question_fi = qpl_questions.question_id AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id AND tst_test_result.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
 
 1045        if (
$result->numRows() == 1) {
 
 1047            if (strcmp($row[
'foundtypes'], 
'assSingleChoice') == 0) {
 
 1073                                SELECT  DISTINCT(qpl_qst_sc.shuffle) foundshuffles 
 1079                                WHERE   tst_test_result.question_fi = qpl_questions.question_id 
 1080                                AND             qpl_questions.question_type_fi = qpl_qst_type.question_type_id 
 1081                                AND             tst_test_result.active_fi = tst_active.active_id 
 1082                                AND             qpl_questions.question_id = qpl_qst_sc.question_fi 
 1083                                AND             tst_active.test_fi = %s 
 1084                                AND             qpl_qst_type.type_tag = %s 
 1086            array(
'integer', 
'text'),
 
 1087            array($this->
getTestId(), 
'assSingleChoice')
 
 1089        if (
$result->numRows() == 1) {
 
 1091            return ($row[
'foundshuffles'] == 0);
 
 1104        if (!count($this->mark_schema->mark_steps)) {
 
 1126        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 1129        $test->loadFromDb();
 
 1131        require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 1134        return $test->isComplete($testQuestionSetConfigFactory->getQuestionSetConfig());
 
 1150            if (!preg_match(
'/\d+/', $this->
getECTSFX())) {
 
 1157                                SET ects_output = %s, ects_a = %s, ects_b = %s, ects_c = %s, ects_d = %s, ects_e = %s, ects_fx = %s 
 1158                                WHERE test_id = %s",
 
 1159                array(
'text', 
'float', 
'float', 
'float', 
'float', 
'float', 
'float', 
'integer'),
 
 1162                    $grades[
'A'], $grades[
'B'], $grades[
'C'], $grades[
'D'], $grades[
'E'],
 
 1180        if ($this->
isComplete($testQuestionSetConfig)) {
 
 1185                "UPDATE tst_tests SET complete = %s WHERE test_id = %s",
 
 1186                array(
'text', 
'integer'),
 
 1187                array($complete, $this->test_id)
 
 1212        include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
 1213        $completecontent = 
"";
 
 1215            $completecontent .= $content;
 
 1234        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 1241        require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 1243        $testQuestionSetConfig = $testQuestionSetConfigFactory->getQuestionSetConfig();
 
 1245        include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1246        if ($this->test_id == -1) {
 
 1248            $next_id = 
$ilDB->nextId(
'tst_tests');
 
 1250            $ilDB->insert(
'tst_tests', array(
 
 1251                'test_id' => array(
'integer', $next_id),
 
 1252                'obj_fi' => array(
'integer', $this->
getId()),
 
 1253                'author' => array(
'text', $this->
getAuthor()),
 
 1257                'showinfo' => array(
'integer', $this->
getShowInfo()),
 
 1258                'forcejs' => array(
'integer', $this->
getForceJS()),
 
 1270                'nr_of_tries' => array(
'integer', $this->
getNrOfTries()),
 
 1272                'kiosk' => array(
'integer', $this->
getKiosk()),
 
 1283                'complete' => array(
'text', $this->
isComplete($testQuestionSetConfig)),
 
 1285                'ects_a' => array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : 
null),
 
 1286                'ects_b' => array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : 
null),
 
 1287                'ects_c' => array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : 
null),
 
 1288                'ects_d' => array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : 
null),
 
 1289                'ects_e' => array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : 
null),
 
 1290                'ects_fx' => array(
'float', $this->
getECTSFX()),
 
 1299                'password' => array(
'text', $this->
getPassword()),
 
 1307                'created' => array(
'integer', time()),
 
 1308                'tstamp' => array(
'integer', time()),
 
 1310                'template_id' => array(
'integer', $this->
getTemplate()),
 
 1311                'pool_usage' => array(
'integer', $this->
getPoolUsage()),
 
 1326                'autosave' => array(
'integer', (
int) $this->
getAutosave()),
 
 1349                'pass_waiting' => array(
'text', (
string) $this->
getPassWaiting())
 
 1352            $this->test_id = $next_id;
 
 1362                    "SELECT * FROM tst_tests WHERE test_id = %s",
 
 1364                    array($this->test_id)
 
 1366                if (
$result->numRows() == 1) {
 
 1374                        'author' => array(
'text', $this->
getAuthor()),
 
 1378                        'showinfo' => array(
'integer', $this->
getShowInfo()),
 
 1379                        'forcejs' => array(
'integer', $this->
getForceJS()),
 
 1391                        'nr_of_tries' => array(
'integer', $this->
getNrOfTries()),
 
 1393                        'kiosk' => array(
'integer', $this->
getKiosk()),
 
 1404                        'complete' => array(
'text', $this->
isComplete($testQuestionSetConfig)),
 
 1406                        'ects_a' => array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : 
null),
 
 1407                        'ects_b' => array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : 
null),
 
 1408                        'ects_c' => array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : 
null),
 
 1409                        'ects_d' => array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : 
null),
 
 1410                        'ects_e' => array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : 
null),
 
 1411                        'ects_fx' => array(
'float', $this->
getECTSFX()),
 
 1420                        'password' => array(
'text', $this->
getPassword()),
 
 1428                        'tstamp' => array(
'integer', time()),
 
 1430                        'template_id' => array(
'integer', $this->
getTemplate()),
 
 1431                        'pool_usage' => array(
'integer', $this->
getPoolUsage()),
 
 1446                        'autosave' => array(
'integer', (
int) $this->
getAutosave()),
 
 1469                        'pass_waiting' => array(
'text', (
string) $this->
getPassWaiting())
 
 1472                        'test_id' => array(
'integer', (
int) $this->
getTestId())
 
 1476            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1478                $logresult = 
$ilDB->queryF(
 
 1479                    "SELECT * FROM tst_tests WHERE test_id = %s",
 
 1484                if ($logresult->numRows() == 1) {
 
 1485                    $newrow = 
$ilDB->fetchAssoc($logresult);
 
 1487                $changed_fields = array();
 
 1488                foreach ($oldrow as $key => $value) {
 
 1489                    if (strcmp($oldrow[$key], $newrow[$key]) != 0) {
 
 1490                        array_push($changed_fields, 
"$key: " . $oldrow[$key] . 
" => " . $newrow[$key]);
 
 1493                $changes = join(
", ", $changed_fields);
 
 1494                if (count($changed_fields) > 0) {
 
 1502                    $aresult = 
$ilDB->queryF(
 
 1503                        "SELECT active_id FROM tst_active WHERE test_fi = %s AND tries >= %s AND submitted = %s",
 
 1504                        array(
'integer', 
'integer', 
'integer'),
 
 1507                    while ($row = 
$ilDB->fetchAssoc($aresult)) {
 
 1509                            "UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
 1510                            array(
'integer', 
'timestamp', 
'integer'),
 
 1511                            array(1, date(
'Y-m-d H:i:s'), $row[
"active_id"])
 
 1516                    $aresult = 
$ilDB->queryF(
 
 1517                        "SELECT active_id FROM tst_active WHERE test_fi = %s AND tries < %s AND submitted = %s",
 
 1518                        array(
'integer', 
'integer', 
'integer'),
 
 1521                    while ($row = 
$ilDB->fetchAssoc($aresult)) {
 
 1523                            "UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
 1524                            array(
'integer', 
'timestamp', 
'integer'),
 
 1525                            array(0, 
null, $row[
"active_id"])
 
 1530                    $aresult = 
$ilDB->queryF(
 
 1531                        "SELECT active_id FROM tst_active WHERE test_fi = %s AND submitted = %s",
 
 1532                        array(
'integer', 
'integer'),
 
 1535                    while ($row = 
$ilDB->fetchAssoc($aresult)) {
 
 1537                            "UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
 1538                            array(
'integer', 
'timestamp', 
'integer'),
 
 1539                            array(0, 
null, $row[
"active_id"])
 
 1547        include_once 
'Services/News/classes/class.ilNewsItem.php';
 
 1552            $newsItem->setContext($this->
getId(), 
'tst');
 
 1554            $newsItem->setTitle(
'new_test_online');
 
 1555            $newsItem->setContentIsLangVar(
true);
 
 1556            $newsItem->setContent(
'');
 
 1557            $newsItem->setUserId(
$ilUser->getId());
 
 1559            $newsItem->create();
 
 1566                $newsItem->setTitle(
'new_test_online');
 
 1567                $newsItem->setContentIsLangVar(
true);
 
 1568                $newsItem->setContent(
'');
 
 1569                $newsItem->update();
 
 1574        if ($this->ref_id) {
 
 1575            include_once 
"./Services/Object/classes/class.ilObjectActivation.php";
 
 1588            $item->update($this->ref_id);
 
 1591        if (!$properties_only) {
 
 1596            $this->mark_schema->saveToDb($this->test_id);
 
 1611        $oldquestions = array();
 
 1612        include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 1615                "SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
 
 1621                    array_push($oldquestions, $row[
"question_fi"]);
 
 1627        $currentQuestionsObligationsQuery = 
'SELECT question_fi, obligatory FROM tst_test_question WHERE test_fi = %s';
 
 1628        $rset = 
$ilDB->queryF($currentQuestionsObligationsQuery, array(
'integer'), array($this->
getTestId()));
 
 1629        while ($row = 
$ilDB->fetchAssoc($rset)) {
 
 1630            $obligatoryQuestionState[$row[
'question_fi']] = $row[
'obligatory'];
 
 1633        $affectedRows = 
$ilDB->manipulateF(
 
 1634            "DELETE FROM tst_test_question WHERE test_fi = %s",
 
 1639        foreach ($this->questions as $key => $value) {
 
 1641            if (!isset($obligatoryQuestionState[$value]) || is_null($obligatoryQuestionState[$value])) {
 
 1642                $obligatoryQuestionState[$value] = 0;
 
 1646            $next_id = 
$ilDB->nextId(
'tst_test_question');
 
 1647            $ilDB->insert(
'tst_test_question', array(
 
 1648                'test_question_id' => array(
'integer', $next_id),
 
 1649                'test_fi' => array(
'integer', $this->
getTestId()),
 
 1650                'question_fi' => array(
'integer', $value),
 
 1651                'sequence' => array(
'integer', $key),
 
 1652                'obligatory' => array(
'integer', $obligatoryQuestionState[$value]),
 
 1653                'tstamp' => array(
'integer', time())
 
 1656        include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1659                "SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
 
 1663            $newquestions = array();
 
 1666                    array_push($newquestions, $row[
"question_fi"]);
 
 1669            foreach ($oldquestions as 
$index => $question_id) {
 
 1670                if (strcmp($newquestions[
$index], $question_id) != 0) {
 
 1671                    $pos = array_search($question_id, $newquestions);
 
 1672                    if ($pos === 
false) {
 
 1679            foreach ($newquestions as 
$index => $question_id) {
 
 1680                if (array_search($question_id, $oldquestions) === 
false) {
 
 1697            'SELECT copy_id FROM tst_rnd_cpy WHERE tst_fi = %s',
 
 1701        return $result->numRows() > 0;
 
 1719        $rbacsystem = 
$DIC[
'rbacsystem'];
 
 1723        if (($questionpool != 0) && (!$use_obj_id)) {
 
 1729            "SELECT qpl_questions.original_id FROM qpl_questions, tst_test_question WHERE qpl_questions.question_id = tst_test_question.question_fi AND qpl_questions.tstamp > 0 AND tst_test_question.test_fi = %s",
 
 1733        $original_ids = array();
 
 1734        $paramtypes = array();
 
 1735        $paramvalues = array();
 
 1737            array_push($original_ids, $row[
'original_id']);
 
 1742        if (($questionpool == 0) && (!is_array($qpls))) {
 
 1743            include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 1745            if (count($available_pools)) {
 
 1746                $available = 
" AND " . 
$ilDB->in(
'obj_fi', $available_pools, 
false, 
'integer');
 
 1752        $constraint_qpls = 
"";
 
 1753        $result_array = array();
 
 1754        if ($questionpool == 0) {
 
 1755            if (is_array($qpls)) {
 
 1756                if (count($qpls) > 0) {
 
 1757                    $constraint_qpls = 
" AND " . 
$ilDB->in(
'obj_fi', $qpls, 
false, 
'integer');
 
 1762        $original_clause = 
"";
 
 1763        if (count($original_ids)) {
 
 1764            $original_clause = 
" AND " . 
$ilDB->in(
'question_id', $original_ids, 
true, 
'integer');
 
 1767        if ($questionpool == 0) {
 
 1769                "SELECT question_id FROM qpl_questions WHERE original_id IS NULL $available $constraint_qpls AND owner > %s AND complete = %s $original_clause",
 
 1770                array(
'integer', 
'text'),
 
 1775                "SELECT question_id FROM qpl_questions WHERE original_id IS NULL AND obj_fi = %s AND owner > %s AND complete = %s $original_clause",
 
 1776                array(
'integer',
'integer', 
'text'),
 
 1777                array($questionpool, 0, 
"1")
 
 1780        $found_ids = array();
 
 1782            array_push($found_ids, $row[
'question_id']);
 
 1784        $nr_of_questions = ($nr_of_questions > count($found_ids)) ? count($found_ids) : $nr_of_questions;
 
 1785        if ($nr_of_questions == 0) {
 
 1788        $rand_keys = array_rand($found_ids, $nr_of_questions);
 
 1790        if (is_array($rand_keys)) {
 
 1791            foreach ($rand_keys as $key) {
 
 1792                $result[$found_ids[$key]] = $found_ids[$key];
 
 1795            $result[$found_ids[$rand_keys]] = $found_ids[$rand_keys];
 
 1813            "SELECT test_result_id FROM tst_test_result WHERE active_fi = %s AND pass = %s",
 
 1814            array(
'integer',
'integer'),
 
 1815            array($active_id, 
$pass)
 
 1835            "SELECT test_random_question_id FROM tst_test_rnd_qst WHERE active_fi = %s AND pass = %s",
 
 1836            array(
'integer',
'integer'),
 
 1837            array($active_id, 
$pass)
 
 1851            "SELECT * FROM tst_tests WHERE obj_fi = %s",
 
 1853            array($this->
getId())
 
 1855        if (
$result->numRows() == 1) {
 
 1862            include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
 1900                    "A" => 
$data->ects_a,
 
 1901                    "B" => 
$data->ects_b,
 
 1902                    "C" => 
$data->ects_c,
 
 1903                    "D" => 
$data->ects_d,
 
 1904                    "E" => 
$data->ects_e
 
 1908            $this->mark_schema->flush();
 
 1909            $this->mark_schema->loadFromDb($this->
getTestId());
 
 1967        if ($this->ref_id) {
 
 1968            include_once 
"./Services/Object/classes/class.ilObjectActivation.php";
 
 1970            switch ($activation[
"timing_type"]) {
 
 1997        $tags_trafo = $this->refinery->string()->stripTags();
 
 1999        $this->questions = array();
 
 2001            if (strcmp($active_id, 
"") == 0) {
 
 2004            if (is_null(
$pass)) {
 
 2008                "SELECT tst_test_rnd_qst.* FROM tst_test_rnd_qst, qpl_questions WHERE tst_test_rnd_qst.active_fi = %s AND qpl_questions.question_id = tst_test_rnd_qst.question_fi AND tst_test_rnd_qst.pass = %s ORDER BY sequence",
 
 2009                array(
'integer', 
'integer'),
 
 2010                array($active_id, 
$pass)
 
 2016            if (
$result->numRows() == 0) {
 
 2018                    "SELECT tst_test_rnd_qst.* FROM tst_test_rnd_qst, qpl_questions WHERE tst_test_rnd_qst.active_fi = %s AND qpl_questions.question_id = tst_test_rnd_qst.question_fi AND tst_test_rnd_qst.pass = 0 ORDER BY sequence",
 
 2025                "SELECT tst_test_question.* FROM tst_test_question, qpl_questions WHERE tst_test_question.test_fi = %s AND qpl_questions.question_id = tst_test_question.question_fi ORDER BY sequence",
 
 2027                array($this->test_id)
 
 2032            $this->questions[
$index++] = 
$data[
"question_fi"];
 
 2060        return (strlen($this->introduction)) ? $this->introduction : 
null;
 
 2088        if (is_null($a_statement)) {
 
 2103        $this->_showinfo = ($a_info) ? 1 : 0;
 
 2115        $this->_forcejs = ($a_js) ? 1 : 0;
 
 2127        $this->_customStyle = $a_customStyle;
 
 2139        return (strlen($this->_customStyle)) ? $this->_customStyle : 
null;
 
 2152        $this->_showfinalstatement = ($show) ? 1 : 0;
 
 2163        return (strlen($this->_finalstatement)) ? $this->_finalstatement : 
null;
 
 2175        return ($this->_showinfo) ? 1 : 0;
 
 2187        return ($this->_forcejs) ? 1 : 0;
 
 2199        return ($this->_showfinalstatement) ? 1 : 0;
 
 2219        return ($this->ects_output) ? 1 : 0;
 
 2227        $this->ects_output = $a_ects_output ? 1 : 0;
 
 2235        return (strlen($this->ects_fx)) ? $this->ects_fx : 
null;
 
 2243        $this->ects_fx = $a_ects_fx;
 
 2259        $this->ects_grades = $a_ects_grades;
 
 2269        return ($this->sequence_settings) ? $this->sequence_settings : 0;
 
 2319        switch ($instant_feedback) {
 
 2321                $this->instant_verification = 1;
 
 2324                $this->instant_verification = 0;
 
 2340            $this->answer_feedback = 1;
 
 2343            $this->answer_feedback = 0;
 
 2355        switch ($generic_answer_feedback) {
 
 2357            $this->answer_feedback = 1;
 
 2360            $this->answer_feedback = 0;
 
 2376                $this->answer_feedback_points = 1;
 
 2379                $this->answer_feedback_points = 0;
 
 2391            $this->reporting_date = 
'';
 
 2413        return ($this->score_reporting) ? $this->score_reporting : 0;
 
 2442        return ($this->instant_verification) ? $this->instant_verification : 0;
 
 2455        return ($this->answer_feedback) ? $this->answer_feedback : 0;
 
 2466        return ($this->answer_feedback) ? $this->answer_feedback : 0;
 
 2478        return ($this->answer_feedback_points) ? $this->answer_feedback_points : 0;
 
 2490        return ($this->count_system) ? $this->count_system : 0;
 
 2505            "SELECT tst_tests.count_system FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_active.test_fi = tst_tests.test_id",
 
 2511            return $row[
"count_system"];
 
 2525        return ($this->mc_scoring) ? $this->mc_scoring : 0;
 
 2537        return ($this->score_cutting) ? $this->score_cutting : 0;
 
 2549        return ($this->pass_scoring) ? $this->pass_scoring : 0;
 
 2564            "SELECT tst_tests.pass_scoring FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
 
 2570            return $row[
"pass_scoring"];
 
 2587            "SELECT tst_tests.mc_scoring FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_active.test_fi = tst_tests.test_id",
 
 2593            return $row[
"mc_scoring"];
 
 2610            "SELECT tst_tests.score_cutting FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_tests.test_id = tst_active.test_fi",
 
 2616            return $row[
"score_cutting"];
 
 2630        return (strlen($this->reporting_date)) ? $this->reporting_date : 
null;
 
 2642        return ($this->nr_of_tries) ? $this->nr_of_tries : 0;
 
 2670        return ($this->_kiosk) ? $this->_kiosk : 0;
 
 2683        $this->_kiosk = $kiosk;
 
 2695        if (($this->_kiosk & 1) > 0) {
 
 2712            $this->_kiosk = $this->_kiosk | 1;
 
 2715                $this->_kiosk = $this->_kiosk ^ 1;
 
 2729        if (($this->_kiosk & 2) > 0) {
 
 2745            $this->_kiosk = $this->_kiosk | 2;
 
 2748                $this->_kiosk = $this->_kiosk ^ 2;
 
 2762        if (($this->_kiosk & 4) > 0) {
 
 2777        if ($a_participant) {
 
 2778            $this->_kiosk = $this->_kiosk | 4;
 
 2781                $this->_kiosk = $this->_kiosk ^ 4;
 
 2795        return ($this->use_previous_answers) ? $this->use_previous_answers : 0;
 
 2807        return ($this->title_output) ? $this->title_output : 0;
 
 2824            "SELECT tst_tests.title_output FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
 
 2830            return $row[
"title_output"];
 
 2861            "SELECT tst_tests.use_previous_answers FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
 
 2871            if ($user_active_user_setting) {
 
 2872                $res = 
$ilUser->getPref(
"tst_use_previous_answers");
 
 2873                if (
$res !== 
false) {
 
 2890        return (strlen($this->processing_time)) ? $this->processing_time : 
null;
 
 2901        if (strlen($this->processing_time)) {
 
 2902            if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches)) {
 
 2903                if ((
int) $matches[1] + (
int) $matches[2] + (
int) $matches[3] == 0) {
 
 2907                        'hh' => $matches[1],
 
 2908                        'mm' => $matches[2],
 
 2909                        'ss' => $matches[3],
 
 2919        if (strlen($this->processing_time)) {
 
 2920            if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches)) {
 
 2921                return ($matches[1] * 60) + $matches[2];
 
 2937        if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $this->
getProcessingTime(), $matches)) {
 
 2939            return ($matches[1] * 3600) + ($matches[2] * 60) + $matches[3] + $extratime;
 
 2957            return $ending - $now;
 
 2972        return ($this->enable_processing_time) ? $this->enable_processing_time : 0;
 
 2984        return ($this->reset_processing_time) ? $this->reset_processing_time : 0;
 
 3012        return ($this->starting_time != 0) ? $this->starting_time : 0;
 
 3052        return ($this->ending_time != 0) ? $this->ending_time : 0;
 
 3089            $this->use_previous_answers = 1;
 
 3091            $this->use_previous_answers = 0;
 
 3123                $this->title_output = 1;
 
 3126                $this->title_output = 2;
 
 3129                $this->title_output = 0;
 
 3148        $this->processing_time = sprintf(
"%02d:%02d:00", floor($minutes / 60), $minutes % 60);
 
 3161            $this->enable_processing_time = 
"1";
 
 3163            $this->enable_processing_time = 
"0";
 
 3177            $this->reset_processing_time = 1;
 
 3179            $this->reset_processing_time = 0;
 
 3192        $this->count_system = $a_count_system;
 
 3220        return (strlen($this->password)) ? $this->password : 
null;
 
 3232        $this->password = $a_password;
 
 3244        $this->score_cutting = $a_score_cutting;
 
 3256        $this->mc_scoring = $a_mc_scoring;
 
 3268        switch ($a_pass_scoring) {
 
 3317            $DIC[
'ilPluginAdmin'],
 
 3321        foreach ($activeIds as $activeId) {
 
 3323            $passSelector->setActiveId($activeId);
 
 3325            foreach ($passSelector->getExistingPasses() as 
$pass) {
 
 3326                $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($activeId, 
$pass);
 
 3329                $testSequence->removeQuestion($questionId, $reindexedSequencePositionMap);
 
 3340        foreach ($removeQuestionIds as $value) {
 
 3357        include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3361        $question->delete($question_id);
 
 3380        require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
 3382        $participantData->setUserIdsFilter($userIds);
 
 3383        $participantData->load($this->
getTestId());
 
 3396            require_once 
'Services/Object/classes/class.ilObjectLP.php';
 
 3398            $testLP->setTestObject($this);
 
 3399            $testLP->resetLPDataForUserIds($participantData->
getUserIds(), 
false);
 
 3413        require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
 3415        $participantData->setUserIdsFilter($userIds);
 
 3416        $participantData->load($this->
getTestId());
 
 3418        $IN_userIds = 
$ilDB->in(
'usr_id', $participantData->getUserIds(), 
false, 
'integer');
 
 3420            "DELETE FROM usr_pref WHERE $IN_userIds AND keyword = %s",
 
 3422            array(
"tst_password_" . $this->
getTestId())
 
 3425        if (count($participantData->getActiveIds())) {
 
 3435        $IN_activeIds = 
$ilDB->in(
'active_fi', $activeIds, 
false, 
'integer');
 
 3437        $ilDB->manipulate(
"DELETE FROM tst_solutions WHERE $IN_activeIds");
 
 3438        $ilDB->manipulate(
"DELETE FROM tst_qst_solved WHERE $IN_activeIds");
 
 3439        $ilDB->manipulate(
"DELETE FROM tst_test_result WHERE $IN_activeIds");
 
 3440        $ilDB->manipulate(
"DELETE FROM tst_pass_result WHERE $IN_activeIds");
 
 3441        $ilDB->manipulate(
"DELETE FROM tst_result_cache WHERE $IN_activeIds");
 
 3442        $ilDB->manipulate(
"DELETE FROM tst_sequence WHERE $IN_activeIds");
 
 3443        $ilDB->manipulate(
"DELETE FROM tst_times WHERE $IN_activeIds");
 
 3446            $ilDB->manipulate(
"DELETE FROM tst_test_rnd_qst WHERE $IN_activeIds");
 
 3448            $ilDB->manipulate(
"DELETE FROM tst_seq_qst_tracking WHERE $IN_activeIds");
 
 3449            $ilDB->manipulate(
"DELETE FROM tst_seq_qst_answstatus WHERE $IN_activeIds");
 
 3450            $ilDB->manipulate(
"DELETE FROM tst_seq_qst_postponed WHERE $IN_activeIds");
 
 3451            $ilDB->manipulate(
"DELETE FROM tst_seq_qst_checked WHERE $IN_activeIds");
 
 3454        include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3456        foreach ($activeIds as $active_id) {
 
 3467        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
 
 3476        $IN_activeIds = 
$ilDB->in(
'active_id', $activeIds, 
false, 
'integer');
 
 3477        $ilDB->manipulate(
"DELETE FROM tst_active WHERE $IN_activeIds");
 
 3494            "SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
 
 3495            array(
'integer', 
'integer'),
 
 3499        if (
$data->sequence > 1) {
 
 3502                "SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
 
 3503                array(
'integer',
'integer'),
 
 3508            $affectedRows = 
$ilDB->manipulateF(
 
 3509                "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3510                array(
'integer',
'integer'),
 
 3511                array(
$data->sequence, $data_previous->test_question_id)
 
 3514            $affectedRows = 
$ilDB->manipulateF(
 
 3515                "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3516                array(
'integer',
'integer'),
 
 3517                array(
$data->sequence - 1, 
$data->test_question_id)
 
 3519            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3541            "SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
 
 3542            array(
'integer',
'integer'),
 
 3547            "SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
 
 3548            array(
'integer',
'integer'),
 
 3551        if (
$result->numRows() == 1) {
 
 3555            $affectedRows = 
$ilDB->manipulateF(
 
 3556                "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3557                array(
'integer',
'integer'),
 
 3558                array(
$data->sequence, $data_next->test_question_id)
 
 3561            $affectedRows = 
$ilDB->manipulateF(
 
 3562                "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3563                array(
'integer',
'integer'),
 
 3564                array(
$data->sequence + 1, 
$data->test_question_id)
 
 3566            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3586        $duplicate_id = $question->duplicate(
true, 
null, 
null, 
null, $this->
getId());
 
 3588        return $duplicate_id;
 
 3604            $duplicate_id = $question_id;
 
 3611            "SELECT MAX(sequence) seq FROM tst_test_question WHERE test_fi=%s",
 
 3617        if (
$result->numRows() == 1) {
 
 3619            $sequence = 
$data->seq + 1;
 
 3622        $next_id = 
$ilDB->nextId(
'tst_test_question');
 
 3623        $affectedRows = 
$ilDB->manipulateF(
 
 3624            "INSERT INTO tst_test_question (test_question_id, test_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
 
 3625            array(
'integer', 
'integer',
'integer',
'integer',
'integer'),
 
 3626            array($next_id, $this->
getTestId(), $duplicate_id, $sequence, time())
 
 3628        if ($affectedRows == 1) {
 
 3629            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3635        $affectedRows = 
$ilDB->manipulateF(
 
 3636            "DELETE FROM tst_active WHERE test_fi = %s",
 
 3642        return $duplicate_id;
 
 3659                "SELECT qpl_questions.title FROM tst_test_question, qpl_questions WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id ORDER BY tst_test_question.sequence",
 
 3664                array_push($titles, $row[
"title"]);
 
 3684                "SELECT qpl_questions.title, qpl_questions.question_id FROM tst_test_question, qpl_questions WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id ORDER BY tst_test_question.sequence",
 
 3689                $titles[$row[
'question_id']] = $row[
"title"];
 
 3711            } elseif (isset($nr)) {
 
 3712                return $this->lng->txt(
"ass_question") . 
' ' . $nr;
 
 3714                return $this->lng->txt(
"ass_question");
 
 3736            "SELECT qpl_questions.*, qpl_qst_type.type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
 
 3756        $existing_questions = array();
 
 3759            if (is_null(
$pass)) {
 
 3763                "SELECT qpl_questions.original_id FROM qpl_questions, tst_test_rnd_qst WHERE tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.question_fi = qpl_questions.question_id AND tst_test_rnd_qst.pass = %s",
 
 3764                array(
'integer',
'integer'),
 
 3765                array($active_id, 
$pass)
 
 3769                "SELECT qpl_questions.original_id FROM qpl_questions, tst_test_question WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id",
 
 3775            if (
$data->original_id === 
null) {
 
 3779            array_push($existing_questions, 
$data->original_id);
 
 3781        return $existing_questions;
 
 3796        if ($question_id < 1) {
 
 3800            "SELECT type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
 
 3804        if (
$result->numRows() == 1) {
 
 3806            return $data->type_tag;
 
 3823        $next_id = 
$ilDB->nextId(
'tst_times');
 
 3824        $affectedRows = 
$ilDB->manipulateF(
 
 3825            "INSERT INTO tst_times (times_id, active_fi, started, finished, pass, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
 
 3826            array(
'integer', 
'integer', 
'timestamp', 
'timestamp', 
'integer', 
'integer'),
 
 3827            array($next_id, $active_id, strftime(
"%Y-%m-%d %H:%M:%S"), strftime(
"%Y-%m-%d %H:%M:%S"), 
$pass, time())
 
 3843        $affectedRows = 
$ilDB->manipulateF(
 
 3844            "UPDATE tst_times SET finished = %s, tstamp = %s WHERE times_id = %s",
 
 3845            array(
'timestamp', 
'integer', 
'integer'),
 
 3846            array(strftime(
"%Y-%m-%d %H:%M:%S"), time(), $times_id)
 
 3862        if (is_null(
$pass)) {
 
 3864                "SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
 
 3865                array(
'integer',
'integer'),
 
 3866                array($active_id, 0)
 
 3870                "SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
 
 3871                array(
'integer',
'integer'),
 
 3872                array($active_id, 
$pass)
 
 3875        $result_array = array();
 
 3877            array_push($result_array, $row[
"question_fi"]);
 
 3879        return $result_array;
 
 3893        return ((($currentpass > 0) && ($num == 0)) || $this->
isTestFinished($active_id)) ? 
true : 
false;
 
 3908        $result_array = array();
 
 3912            if (count($this->questions) == 0) {
 
 3913                return $result_array;
 
 3915            if (is_null(
$pass)) {
 
 3919                "SELECT qpl_questions.* FROM qpl_questions, tst_test_rnd_qst WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id AND tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.pass = %s AND " . 
$ilDB->in(
'qpl_questions.question_id', $this->questions, 
false, 
'integer'),
 
 3920                array(
'integer',
'integer'),
 
 3921                array($active_id, 
$pass)
 
 3924            if (count($this->questions) == 0) {
 
 3925                return $result_array;
 
 3927            $result = 
$ilDB->query(
"SELECT qpl_questions.* FROM qpl_questions, tst_test_question WHERE tst_test_question.question_fi = qpl_questions.question_id AND " . 
$ilDB->in(
'qpl_questions.question_id', $this->questions, 
false, 
'integer'));
 
 3930            $result_array[$row[
"question_id"]] = $row;
 
 3932        return $result_array;
 
 3954                "SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
 
 3955                array(
'integer',
'integer',
'text'),
 
 3958        } elseif (strlen($anonymous_id)) {
 
 3960                "SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
 
 3961                array(
'integer',
'integer',
'text'),
 
 3962                array($user_id, $this->test_id, $anonymous_id)
 
 3969                "SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
 
 3970                array(
'integer',
'integer'),
 
 3971                array($user_id, $this->test_id)
 
 3976            return $row[
"active_id"];
 
 4003            "SELECT tst_active.active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
 
 4004            array(
'integer', 
'integer'),
 
 4009            return $row[
"active_id"];
 
 4023        $keys = array_keys($array);
 
 4026        foreach (
$keys as $key) {
 
 4039    public function &
getTestResult($active_id, 
$pass = 
null, $ordered_sequence = 
false, $considerHiddenQuestions = 
true, $considerOptionalQuestions = 
true)
 
 4045        $refinery = 
$DIC[
'refinery'];
 
 4046        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 4050        if (
$pass === 
null) {
 
 4054        require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
 4056        $testSession = $testSessionFactory->getSession($active_id);
 
 4058        require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 4060        $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($active_id, 
$pass);
 
 4063            require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 4065            $dynamicQuestionSetConfig->loadFromDb();
 
 4072            $testSequence->setConsiderHiddenQuestionsEnabled($considerHiddenQuestions);
 
 4073            $testSequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions);
 
 4078            if ($ordered_sequence) {
 
 4088                        SELECT          tst_test_result.question_fi, 
 4089                                                tst_test_result.points reached, 
 4090                                                tst_test_result.hint_count requested_hints, 
 4091                                                tst_test_result.hint_points hint_points, 
 4092                                                tst_test_result.answered answered 
 4094                        FROM            tst_test_result 
 4096                        LEFT JOIN       tst_solutions 
 4097                        ON                      tst_solutions.active_fi = tst_test_result.active_fi 
 4098                        AND                     tst_solutions.question_fi = tst_test_result.question_fi 
 4100                        WHERE           tst_test_result.active_fi = %s 
 4101                        AND                     tst_test_result.pass = %s 
 4104        $solutionresult = 
$ilDB->queryF(
 
 4106            array(
'integer', 
'integer'),
 
 4107            array($active_id, 
$pass)
 
 4110        while ($row = 
$ilDB->fetchAssoc($solutionresult)) {
 
 4111            $arrResults[ $row[
'question_fi'] ] = $row;
 
 4114        $numWorkedThrough = count($arrResults);
 
 4116        require_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 4118        $IN_question_ids = 
$ilDB->in(
'qpl_questions.question_id', $sequence, 
false, 
'integer');
 
 4121                        SELECT          qpl_questions.*, 
 4122                                                qpl_qst_type.type_tag, 
 4123                                                qpl_sol_sug.question_fi has_sug_sol 
 4128                        LEFT JOIN       qpl_sol_sug 
 4129                        ON                      qpl_sol_sug.question_fi = qpl_questions.question_id 
 4131                        WHERE           qpl_qst_type.question_type_id = qpl_questions.question_type_fi 
 4132                        AND                     $IN_question_ids 
 4141        $obligationsAnswered = 
true;
 
 4145                $row[
'points'] ? $arrResults[ $row[
'question_id'] ][
'reached'] / $row[
'points'] : 0
 
 4148            if ($percentvalue < 0) {
 
 4149                $percentvalue = 0.0;
 
 4155                "max" => round($row[
'points'], 2),
 
 4156                "reached" => round($arrResults[$row[
'question_id']][
'reached'], 2),
 
 4157                'requested_hints' => $arrResults[$row[
'question_id']][
'requested_hints'],
 
 4158                'hint_points' => $arrResults[$row[
'question_id']][
'hint_points'],
 
 4159                "percent" => sprintf(
"%2.2f ", ($percentvalue) * 100) . 
"%",
 
 4161                "type" => $row[
"type_tag"],
 
 4162                "qid" => $row[
'question_id'],
 
 4163                "original_id" => $row[
"original_id"],
 
 4164                "workedthrough" => isset($arrResults[$row[
'question_id']]) ? 1 : 0,
 
 4165                'answered' => $arrResults[$row[
'question_id']][
'answered']
 
 4168            if (!$arrResults[ $row[
'question_id'] ][
'answered']) {
 
 4169                $obligationsAnswered = 
false;
 
 4172            $unordered[ $row[
'question_id'] ] = 
$data;
 
 4177        $numQuestionsTotal = count($unordered);
 
 4181        $pass_requested_hints = 0;
 
 4182        $pass_hint_points = 0;
 
 4187        foreach ($sequence as $qid) {
 
 4190            $pass_max += round($unordered[$qid][
'max'], 2);
 
 4191            $pass_reached += round($unordered[$qid][
'reached'], 2);
 
 4192            $pass_requested_hints += $unordered[$qid][
'requested_hints'];
 
 4193            $pass_hint_points += $unordered[$qid][
'hint_points'];
 
 4197            $unordered[$qid][
'nr'] = $key;
 
 4198            array_push($found, $unordered[$qid]);
 
 4207            if (
$results[
'reached_points'] < 0) {
 
 4211            if ($pass_reached < 0) {
 
 4216        $found[
'pass'][
'total_max_points'] = $pass_max;
 
 4217        $found[
'pass'][
'total_reached_points'] = $pass_reached;
 
 4218        $found[
'pass'][
'total_requested_hints'] = $pass_requested_hints;
 
 4219        $found[
'pass'][
'total_hint_points'] = $pass_hint_points;
 
 4220        $found[
'pass'][
'percent'] = ($pass_max > 0) ? $pass_reached / $pass_max : 0;
 
 4221        $found[
'pass'][
'obligationsAnswered'] = $obligationsAnswered;
 
 4222        $found[
'pass'][
'num_workedthrough'] = $numWorkedThrough;
 
 4223        $found[
'pass'][
'num_questions_total'] = $numQuestionsTotal;
 
 4225        $found[
"test"][
"total_max_points"] = 
$results[
'max_points'];
 
 4226        $found[
"test"][
"total_reached_points"] = 
$results[
'reached_points'];
 
 4227        $found[
"test"][
"total_requested_hints"] = 
$results[
'hint_count'];
 
 4228        $found[
"test"][
"total_hint_points"] = 
$results[
'hint_points'];
 
 4229        $found[
"test"][
"result_pass"] = 
$results[
'pass'];
 
 4230        $found[
'test'][
'result_tstamp'] = 
$results[
'tstamp'];
 
 4231        $found[
'test'][
'obligations_answered'] = 
$results[
'obligations_answered'];
 
 4233        if ((!$found[
'pass'][
'total_reached_points']) or (!$found[
'pass'][
'total_max_points'])) {
 
 4236            $percentage = ($found[
'pass'][
'total_reached_points'] / $found[
'pass'][
'total_max_points']) * 100.0;
 
 4238            if ($percentage < 0) {
 
 4243        $found[
"test"][
"passed"] = 
$results[
'passed'];
 
 4260            "SELECT COUNT(active_id) total FROM tst_active WHERE test_fi = %s",
 
 4265        return $row[
"total"];
 
 4280            "SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi AND tst_active.user_fi = %s",
 
 4281            array(
'integer',
'integer'),
 
 4286            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"started"], $matches);
 
 4287            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4288            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"finished"], $matches);
 
 4289            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4290            $time += ($epoch_2 - $epoch_1);
 
 4319            "SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi ORDER BY tst_times.active_fi, tst_times.started",
 
 4326            if (!array_key_exists($row[
"active_fi"], $times)) {
 
 4327                $times[$row[
"active_fi"]] = 0;
 
 4329            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"started"], $matches);
 
 4330            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4331            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"finished"], $matches);
 
 4332            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4333            $times[$row[
"active_fi"]] += ($epoch_2 - $epoch_1);
 
 4350            "SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi AND tst_active.active_id = %s ORDER BY tst_times.active_fi, tst_times.started",
 
 4351            array(
'integer',
'integer'),
 
 4356            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"started"], $matches);
 
 4357            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4358            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"finished"], $matches);
 
 4359            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4360            $time += ($epoch_2 - $epoch_1);
 
 4377            "SELECT * FROM tst_times WHERE active_fi = %s AND pass = %s ORDER BY started",
 
 4378            array(
'integer',
'integer'),
 
 4379            array($active_id, 
$pass)
 
 4383            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"started"], $matches);
 
 4384            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4385            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"finished"], $matches);
 
 4386            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4387            $time += ($epoch_2 - $epoch_1);
 
 4418            "SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi AND tst_active.active_id = %s ORDER BY tst_times.started",
 
 4419            array(
'integer',
'integer'),
 
 4425            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"started"], $matches);
 
 4426            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4427            if ($firstvisit == 0 || $epoch_1 < $firstvisit) {
 
 4428                $firstvisit = $epoch_1;
 
 4430            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"finished"], $matches);
 
 4431            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4432            if ($epoch_2 > $lastvisit) {
 
 4433                $lastvisit = $epoch_2;
 
 4436        return array(
"firstvisit" => $firstvisit, 
"lastvisit" => $lastvisit);
 
 4453            "SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.active_id = %s AND tst_active.active_id = tst_times.active_fi",
 
 4461            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->started, $matches);
 
 4462            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4463            if (!$first_visit) {
 
 4464                $first_visit = $epoch_1;
 
 4466            if ($epoch_1 < $first_visit) {
 
 4467                $first_visit = $epoch_1;
 
 4469            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->finished, $matches);
 
 4470            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4472                $last_visit = $epoch_2;
 
 4474            if ($epoch_2 > $last_visit) {
 
 4475                $last_visit = $epoch_2;
 
 4477            $times[$row->active_fi] += ($epoch_2 - $epoch_1);
 
 4480        foreach ($times as $key => $value) {
 
 4481            $max_time += $value;
 
 4483        if ((!$test_result[
"test"][
"total_reached_points"]) or (!$test_result[
"test"][
"total_max_points"])) {
 
 4486            $percentage = ($test_result[
"test"][
"total_reached_points"] / $test_result[
"test"][
"total_max_points"]) * 100.0;
 
 4487            if ($percentage < 0) {
 
 4491        $mark_obj = $this->mark_schema->getMatchingMark($percentage);
 
 4492        $first_date = getdate($first_visit);
 
 4493        $last_date = getdate($last_visit);
 
 4494        $qworkedthrough = 0;
 
 4495        foreach ($test_result as $key => $value) {
 
 4496            if (preg_match(
"/\d+/", $key)) {
 
 4497                $qworkedthrough += $value[
"workedthrough"];
 
 4500        if (!$qworkedthrough) {
 
 4503            $atimeofwork = $max_time / $qworkedthrough;
 
 4506        $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
 
 4512            $result_mark = $mark_obj->getShortName();
 
 4514            if ($mark_obj->getPassed() && $obligationsAnswered) {
 
 4520        $percent_worked_through = 0;
 
 4521        if (count($this->questions)) {
 
 4522            $percent_worked_through = $qworkedthrough / count($this->questions);
 
 4524        $result_array = array(
 
 4525            "qworkedthrough" => $qworkedthrough,
 
 4526            "qmax" => count($this->questions),
 
 4527            "pworkedthrough" => $percent_worked_through,
 
 4528            "timeofwork" => $max_time,
 
 4529            "atimeofwork" => $atimeofwork,
 
 4530            "firstvisit" => $first_date,
 
 4531            "lastvisit" => $last_date,
 
 4532            "resultspoints" => $test_result[
"test"][
"total_reached_points"],
 
 4533            "maxpoints" => $test_result[
"test"][
"total_max_points"],
 
 4534            "resultsmarks" => $result_mark,
 
 4535            "passed" => $passed,
 
 4536            "distancemedian" => 
"0" 
 4538        foreach ($test_result as $key => $value) {
 
 4539            if (preg_match(
"/\d+/", $key)) {
 
 4540                $result_array[$key] = $value;
 
 4543        return $result_array;
 
 4555        $totalpoints_array = array();
 
 4557        foreach ($all_users as $active_id => $user_name) {
 
 4559            $reached = $test_result[
"test"][
"total_reached_points"];
 
 4560            $total = $test_result[
"test"][
"total_max_points"];
 
 4562            $mark = $this->mark_schema->getMatchingMark($percentage * 100.0);
 
 4564            $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
 
 4567                if ($mark->getPassed() && $obligationsAnswered) {
 
 4568                    array_push($totalpoints_array, $test_result[
"test"][
"total_reached_points"]);
 
 4572        return $totalpoints_array;
 
 4585            "SELECT tst_active.active_id, usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login FROM tst_active LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id WHERE tst_active.test_fi = %s ORDER BY usr_data.lastname ASC",
 
 4589        $persons_array = array();
 
 4591            $name = $this->lng->txt(
"anonymous");
 
 4592            $fullname = $this->lng->txt(
"anonymous");
 
 4595                if (strlen($row[
"firstname"] . $row[
"lastname"] . $row[
"title"]) == 0) {
 
 4596                    $name = $this->lng->txt(
"deleted_user");
 
 4597                    $fullname = $this->lng->txt(
"deleted_user");
 
 4598                    $login = $this->lng->txt(
"unknown");
 
 4602                        $name = $this->lng->txt(
"anonymous");
 
 4603                        $fullname = $this->lng->txt(
"anonymous");
 
 4605                        $name = trim($row[
"lastname"] . 
", " . $row[
"firstname"] . 
" " . $row[
"title"]);
 
 4606                        $fullname = trim($row[
"title"] . 
" " . $row[
"firstname"] . 
" " . $row[
"lastname"]);
 
 4610            $persons_array[$row[
"active_id"]] = array(
 
 4612                "fullname" => $fullname,
 
 4616        return $persons_array;
 
 4630            "SELECT tst_active.active_id, usr_data.firstname, usr_data.lastname, usr_data.title FROM tst_active LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id WHERE tst_active.test_fi = %s ORDER BY usr_data.lastname " . strtoupper($name_sort_order),
 
 4634        $persons_array = array();
 
 4641                $persons_array[$row[
"active_id"]] = $this->lng->txt(
"anonymous");
 
 4643                if (strlen($row[
"firstname"] . $row[
"lastname"] . $row[
"title"]) == 0) {
 
 4644                    $persons_array[$row[
"active_id"]] = $this->lng->txt(
"deleted_user");
 
 4647                        $persons_array[$row[
"active_id"]] = $row[
"lastname"];
 
 4649                        $persons_array[$row[
"active_id"]] = trim($row[
"lastname"] . 
", " . $row[
"firstname"] . 
" " . $row[
"title"]);
 
 4654        return $persons_array;
 
 4668            "SELECT tst_active.active_id, usr_data.login, usr_data.firstname, usr_data.lastname, usr_data.title FROM tst_active LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id WHERE tst_active.test_fi = %s ORDER BY usr_data.lastname " . strtoupper($name_sort_order),
 
 4672        $persons_array = array();
 
 4675                $persons_array[$row[
"active_id"]] = array(
"name" => $this->lng->txt(
"anonymous"));
 
 4677                if (strlen($row[
"firstname"] . $row[
"lastname"] . $row[
"title"]) == 0) {
 
 4678                    $persons_array[$row[
"active_id"]] = array(
"name" => $this->lng->txt(
"deleted_user"));
 
 4681                        $persons_array[$row[
"active_id"]] = array(
"name" => $row[
"lastname"]);
 
 4683                        $persons_array[$row[
"active_id"]] = array(
"name" => trim($row[
"lastname"] . 
", " . $row[
"firstname"] . 
" " . $row[
"title"]), 
"login" => $row[
"login"]);
 
 4688        return $persons_array;
 
 4704                "SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
 
 4705                "tst_test_rnd_qst.pass, qpl_questions.points " .
 
 4706                "FROM tst_test_rnd_qst, qpl_questions " .
 
 4707                "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
 
 4708                "AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence",
 
 4714                "SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
 
 4715                "qpl_questions.points " .
 
 4716                "FROM tst_test_question, tst_active, qpl_questions " .
 
 4717                "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
 
 4718                "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
 
 4726                array_push($qtest, $row);
 
 4745                "SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
 
 4746                "qpl_questions.points " .
 
 4747                "FROM tst_test_rnd_qst, qpl_questions " .
 
 4748                "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
 
 4749                "AND tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.pass = %s " .
 
 4750                "ORDER BY tst_test_rnd_qst.sequence",
 
 4751                array(
'integer', 
'integer'),
 
 4752                array($active_id, 
$pass)
 
 4756                "SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
 
 4757                "qpl_questions.points " .
 
 4758                "FROM tst_test_question, tst_active, qpl_questions " .
 
 4759                "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
 
 4760                "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
 
 4768                array_push($qpass, $row);
 
 4800        require_once 
'Modules/Test/classes/class.ilTestParticipantList.php';
 
 4801        require_once 
'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
 
 4806        $list = $list->getAccessFilteredList(
 
 4813    public function getUnfilteredEvaluationData()
 
 4820        include_once 
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
 
 4821        include_once 
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
 
 4822        include_once 
"./Modules/Test/classes/class.ilTestEvaluationData.php";
 
 4827                        SELECT          tst_test_result.*, 
 4828                                                qpl_questions.original_id, 
 4829                                                qpl_questions.title questiontitle, 
 4830                                                qpl_questions.points maxpoints 
 4832                        FROM            tst_test_result, qpl_questions, tst_active 
 4834                        WHERE           tst_active.active_id = tst_test_result.active_fi 
 4835                        AND                     qpl_questions.question_id = tst_test_result.question_fi 
 4836                        AND                     tst_active.test_fi = %s 
 4838                        ORDER BY        tst_active.active_id ASC, tst_test_result.pass ASC, tst_test_result.tstamp DESC 
 4853            $participantObject = 
$data->getParticipant($row[
"active_fi"]);
 
 4859            $passObject = $participantObject->getPass($row[
"pass"]);
 
 4865            $passObject->addAnsweredQuestion(
 
 4866                $row[
"question_fi"],
 
 4875        foreach (array_keys(
$data->getParticipants()) as $active_id) {
 
 4877                for ($testpass = 0; $testpass <= 
$data->getParticipant($active_id)->getLastPass(); $testpass++) {
 
 4881                                                SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, qpl_questions.original_id, 
 4882                                                tst_test_rnd_qst.pass, qpl_questions.points, qpl_questions.title 
 4883                                                FROM tst_test_rnd_qst, qpl_questions 
 4884                                                WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id 
 4885                                                AND tst_test_rnd_qst.pass = %s 
 4886                                                AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence 
 4891                        array(
'integer',
'integer'),
 
 4892                        array($testpass, $active_id)
 
 4897                            $tpass = array_key_exists(
"pass", $row) ? $row[
"pass"] : 0;
 
 4899                            $data->getParticipant($active_id)->addQuestion(
 
 4900                                $row[
"original_id"],
 
 4901                                $row[
"question_fi"],
 
 4907                            $data->addQuestionTitle($row[
"question_fi"], $row[
"title"]);
 
 4912                $lastPass = 
$data->getParticipant($active_id)->getLastPass();
 
 4913                for ($testpass = 0; $testpass <= $lastPass; $testpass++) {
 
 4914                    require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 4916                        $DIC->repositoryTree(),
 
 4918                        $DIC[
'ilPluginAdmin'],
 
 4921                    $dynamicQuestionSetConfig->loadFromDb();
 
 4923                    require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 4925                    $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $testpass);
 
 4930                    $sequence = (array) 
$testSequence->getUserSequenceQuestions();
 
 4932                    $questionsIdsToRequest = array_diff(array_values($sequence), array_values($questionData));
 
 4933                    if (count($questionsIdsToRequest) > 0) {
 
 4934                        $questionIdsCondition = 
' ' . 
$DIC->database()->in(
'question_id', array_values($questionsIdsToRequest), 
false, 
'integer') . 
' ';
 
 4940                                                        WHERE {$questionIdsCondition}",
 
 4944                        while ($row = 
$DIC->database()->fetchAssoc(
$res)) {
 
 4945                            $questionData[$row[
'question_id']] = $row;
 
 4946                            $data->addQuestionTitle($row[
'question_id'], $row[
'title']);
 
 4950                    foreach ($sequence as $questionId) {
 
 4951                        if (!isset($questionData[$questionId])) {
 
 4955                        $row = $questionData[$questionId];
 
 4957                        $data->getParticipant(
 
 4960                            $row[
'original_id'],
 
 4961                            $row[
'question_id'],
 
 4970                                        SELECT tst_test_question.sequence, tst_test_question.question_fi, 
 4971                                        qpl_questions.points, qpl_questions.title, qpl_questions.original_id 
 4972                                        FROM tst_test_question, tst_active, qpl_questions 
 4973                                        WHERE tst_test_question.question_fi = qpl_questions.question_id 
 4974                                        AND tst_active.active_id = %s 
 4975                                        AND tst_active.test_fi = tst_test_question.test_fi 
 4976                                        ORDER BY tst_test_question.sequence 
 4986                    $questionsbysequence = array();
 
 4989                        $questionsbysequence[$row[
"sequence"]] = $row;
 
 4992                    $seqresult = 
$ilDB->queryF(
 
 4993                        "SELECT * FROM tst_sequence WHERE active_fi = %s",
 
 4998                    while ($seqrow = 
$ilDB->fetchAssoc($seqresult)) {
 
 4999                        $questionsequence = unserialize($seqrow[
"sequence"]);
 
 5001                        foreach ($questionsequence as $sidx => $seq) {
 
 5002                            $data->getParticipant($active_id)->addQuestion(
 
 5003                                $questionsbysequence[$seq][
"original_id"],
 
 5004                                $questionsbysequence[$seq][
"question_fi"],
 
 5005                                $questionsbysequence[$seq][
"points"],
 
 5010                            $data->addQuestionTitle(
 
 5011                                $questionsbysequence[$seq][
"question_fi"],
 
 5012                                $questionsbysequence[$seq][
"title"]
 
 5024        foreach (array_keys(
$data->getParticipants()) as $active_id) {
 
 5025            $tstUserData = 
$data->getParticipant($active_id);
 
 5027            $percentage = $tstUserData->getReachedPointsInPercent();
 
 5029            $obligationsAnswered = $tstUserData->areObligationsAnswered();
 
 5031            $mark = $this->mark_schema->getMatchingMark($percentage);
 
 5033            if (is_object($mark)) {
 
 5034                $tstUserData->setMark($mark->getShortName());
 
 5035                $tstUserData->setMarkOfficial($mark->getOfficialName());
 
 5037                $tstUserData->setPassed(
 
 5038                    $mark->getPassed() && $tstUserData->areObligationsAnswered()
 
 5045                    $tstUserData->getReached(),
 
 5046                    $tstUserData->getMaxPoints()
 
 5049                $tstUserData->setECTSMark($ects_mark);
 
 5054            $tstUserData->setFirstVisit($visitingTime[
"firstvisit"]);
 
 5055            $tstUserData->setLastVisit($visitingTime[
"lastvisit"]);
 
 5073                                                SELECT          COUNT(qpl_questions.question_id) qcount, 
 5074                                                                        SUM(qpl_questions.points) qsum 
 5076                                                INNER JOIN      tst_tests 
 5077                                                ON                      tst_tests.test_id = tst_active.test_fi 
 5078                                                INNER JOIN      tst_dyn_quest_set_cfg 
 5079                                                ON          tst_dyn_quest_set_cfg.test_fi = tst_tests.test_id 
 5080                                                INNER JOIN  qpl_questions 
 5081                                                ON          qpl_questions.obj_fi = tst_dyn_quest_set_cfg.source_qpl_fi 
 5082                                                AND         qpl_questions.original_id IS NULL 
 5083                                                AND         qpl_questions.complete = %s 
 5084                                                WHERE           tst_active.active_id = %s 
 5086                    array(
'integer', 
'integer'),
 
 5087                    array(1, $active_id)
 
 5096                                                SELECT          tst_test_rnd_qst.pass, 
 5097                                                                        COUNT(tst_test_rnd_qst.question_fi) qcount, 
 5098                                                                        SUM(qpl_questions.points) qsum 
 5100                                                FROM            tst_test_rnd_qst, 
 5103                                                WHERE           tst_test_rnd_qst.question_fi = qpl_questions.question_id 
 5104                                                AND                     tst_test_rnd_qst.active_fi = %s 
 5107                                                GROUP BY        tst_test_rnd_qst.active_fi, 
 5108                                                                        tst_test_rnd_qst.pass 
 5110                    array(
'integer', 
'integer'),
 
 5111                    array($active_id, 
$pass)
 
 5120                                                SELECT          COUNT(tst_test_question.question_fi) qcount, 
 5121                                                                        SUM(qpl_questions.points) qsum 
 5123                                                FROM            tst_test_question, 
 5127                                                WHERE           tst_test_question.question_fi = qpl_questions.question_id 
 5128                                                AND                     tst_test_question.test_fi = tst_active.test_fi 
 5129                                                AND                     tst_active.active_id = %s 
 5131                                                GROUP BY        tst_test_question.test_fi 
 5141                throw new ilTestException(
"not supported question set type: $questionSetType");
 
 5146        if (is_array($row)) {
 
 5147            return array(
"count" => $row[
"qcount"], 
"points" => $row[
"qsum"]);
 
 5150        return array(
"count" => 0, 
"points" => 0);
 
 5155        include_once 
"./Modules/Test/classes/class.ilTestEvaluationData.php";
 
 5156        include_once 
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
 
 5157        include_once 
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
 
 5158        $data = $this->getUnfilteredEvaluationData();
 
 5159        if ($withStatistics) {
 
 5160            $data->calculateStatistics();
 
 5162        $data->setFilter($filterby, $filtertext);
 
 5189            "SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
 
 5190            "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
 
 5191            "qpl_questions.points maxpoints " .
 
 5192            "FROM tst_test_result, qpl_questions, tst_active " .
 
 5193            "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
 
 5194            "WHERE tst_active.active_id = tst_test_result.active_fi " .
 
 5195            "AND qpl_questions.question_id = tst_test_result.question_fi " .
 
 5196            "AND tst_active.test_fi = %s " .
 
 5197            "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
 
 5201        $overview = array();
 
 5203            if (!array_key_exists($row[
"active_fi"], $overview)) {
 
 5204                $overview[$row[
"active_fi"]] = array();
 
 5205                $overview[$row[
"active_fi"]][
"firstname"] = $row[
"firstname"];
 
 5206                $overview[$row[
"active_fi"]][
"lastname"] = $row[
"lastname"];
 
 5207                $overview[$row[
"active_fi"]][
"title"] = $row[
"title"];
 
 5208                $overview[$row[
"active_fi"]][
"login"] = $row[
"login"];
 
 5209                $overview[$row[
"active_fi"]][
"usr_id"] = $row[
"usr_id"];
 
 5210                $overview[$row[
"active_fi"]][
"started"] = $row[
"started"];
 
 5211                $overview[$row[
"active_fi"]][
"finished"] = $row[
"finished"];
 
 5213            if (!array_key_exists($row[
"pass"], $overview[$row[
"active_fi"]])) {
 
 5214                $overview[$row[
"active_fi"]][$row[
"pass"]] = array();
 
 5215                $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] = 0;
 
 5216                $overview[$row[
"active_fi"]][$row[
"pass"]][
"maxpoints"] = $row[
"maxpoints"];
 
 5218            array_push($overview[$row[
"active_fi"]][$row[
"pass"]], $row);
 
 5219            $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] += $row[
"points"];
 
 5237            "SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
 
 5238            "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
 
 5239            "qpl_questions.points maxpoints " .
 
 5240            "FROM tst_test_result, qpl_questions, tst_active " .
 
 5241            "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
 
 5242            "WHERE tst_active.active_id = tst_test_result.active_fi " .
 
 5243            "AND qpl_questions.question_id = tst_test_result.question_fi " .
 
 5244            "AND tst_active.test_fi = %s AND tst_active.active_id = %s" .
 
 5245            "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
 
 5246            array(
'integer', 
'integer'),
 
 5249        $overview = array();
 
 5251            if (!array_key_exists($row[
"active_fi"], $overview)) {
 
 5252                $overview[$row[
"active_fi"]] = array();
 
 5253                $overview[$row[
"active_fi"]][
"firstname"] = $row[
"firstname"];
 
 5254                $overview[$row[
"active_fi"]][
"lastname"] = $row[
"lastname"];
 
 5255                $overview[$row[
"active_fi"]][
"title"] = $row[
"title"];
 
 5256                $overview[$row[
"active_fi"]][
"login"] = $row[
"login"];
 
 5257                $overview[$row[
"active_fi"]][
"usr_id"] = $row[
"usr_id"];
 
 5258                $overview[$row[
"active_fi"]][
"started"] = $row[
"started"];
 
 5259                $overview[$row[
"active_fi"]][
"finished"] = $row[
"finished"];
 
 5261            if (!array_key_exists($row[
"pass"], $overview[$row[
"active_fi"]])) {
 
 5262                $overview[$row[
"active_fi"]][$row[
"pass"]] = array();
 
 5263                $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] = 0;
 
 5264                $overview[$row[
"active_fi"]][$row[
"pass"]][
"maxpoints"] = $row[
"maxpoints"];
 
 5266            array_push($overview[$row[
"active_fi"]][$row[
"pass"]], $row);
 
 5267            $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] += $row[
"points"];
 
 5286        if (strlen($firstname . $lastname . 
$title) == 0) {
 
 5287            $name = $this->lng->txt(
"deleted_user");
 
 5292                $name = trim($lastname . 
", " . $firstname . 
" " . 
$title);
 
 5295                $name = $this->lng->txt(
"anonymous");
 
 5318        if (strlen($firstname . $lastname . 
$title) == 0) {
 
 5324                $name = trim($lastname . 
", " . $firstname . 
" " . 
$title);
 
 5326            if ($is_anonymous) {
 
 5343        $query = 
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi";
 
 5345        if (is_array($activeIdsFilter) && count($activeIdsFilter)) {
 
 5346            $query .= 
" AND " . 
$DIC->database()->in(
'active_id', $activeIdsFilter, 
false, 
'integer');
 
 5351        while ($row = 
$DIC->database()->fetchObject(
$result)) {
 
 5352            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->started, $matches);
 
 5353            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 5354            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->finished, $matches);
 
 5355            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 5356            $times[$row->active_fi] += ($epoch_2 - $epoch_1);
 
 5360        foreach ($times as $key => $value) {
 
 5361            $max_time += $value;
 
 5365            $average_time = round($max_time / $counter);
 
 5369        return $average_time;
 
 5378    public function &
getAvailableQuestionpools($use_object_id = 
false, $equal_points = 
false, $could_be_offline = 
false, $show_path = 
false, $with_questioncount = 
false, $permission = 
"read")
 
 5380        include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 5392        $time_in_seconds = 0;
 
 5393        foreach ($this->questions as $question_id) {
 
 5395            $est_time = $question->getEstimatedWorkingTime();
 
 5396            $time_in_seconds += $est_time[
"h"] * 3600 + $est_time[
"m"] * 60 + $est_time[
"s"];
 
 5398        $hours = (int) ($time_in_seconds / 3600)        ;
 
 5399        $time_in_seconds = $time_in_seconds - ($hours * 3600);
 
 5400        $minutes = (int) ($time_in_seconds / 60);
 
 5401        $time_in_seconds = $time_in_seconds - ($minutes * 60);
 
 5402        $result = array(
"hh" => $hours, 
"mm" => $minutes, 
"ss" => $time_in_seconds);
 
 5425        $relative_path = 
"/assessment/" . $this->
getId() . 
"/images/";
 
 5439        if ((!$question_type) and ($question_id > 0)) {
 
 5443        if (!strlen($question_type)) {
 
 5447        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 5451        $question = 
new $question_type_gui();
 
 5453        if ($question_id > 0) {
 
 5454            $question->object->loadFromDb($question_id);
 
 5457            $ilCtrl = 
$DIC[
'ilCtrl'];
 
 5463            $question->object->feedbackOBJ = 
new $feedbackObjectClassname($question->object, $ilCtrl, 
$ilDB, 
$lng);
 
 5465            $assSettings = 
new ilSetting(
'assessment');
 
 5466            require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
 
 5468            $processLockerFactory->setQuestionId($question->object->getId());
 
 5469            $processLockerFactory->setUserId(
$ilUser->getId());
 
 5470            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 5472            $question->object->setProcessLocker($processLockerFactory->getLocker());
 
 5489        if (strcmp($question_id, 
"") != 0) {
 
 5490            include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 5505        $this->questions = array_values($this->questions);
 
 5506        $array_pos = array_search($target_index, $this->questions);
 
 5507        if ($insert_mode == 0) {
 
 5508            $part1 = array_slice($this->questions, 0, $array_pos);
 
 5509            $part2 = array_slice($this->questions, $array_pos);
 
 5510        } elseif ($insert_mode == 1) {
 
 5511            $part1 = array_slice($this->questions, 0, $array_pos + 1);
 
 5512            $part2 = array_slice($this->questions, $array_pos + 1);
 
 5514        foreach ($move_questions as $question_id) {
 
 5515            if (!(array_search($question_id, $part1) === 
false)) {
 
 5516                unset($part1[array_search($question_id, $part1)]);
 
 5518            if (!(array_search($question_id, $part2) === 
false)) {
 
 5519                unset($part2[array_search($question_id, $part2)]);
 
 5522        $part1 = array_values($part1);
 
 5523        $part2 = array_values($part2);
 
 5524        $new_array = array_values(array_merge($part1, $move_questions, $part2));
 
 5525        $this->questions = array();
 
 5527        foreach ($new_array as $question_id) {
 
 5528            $this->questions[$counter] = $question_id;
 
 5579        $pluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 5584        include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 5587        if (count($available_pools)) {
 
 5588            $available = 
" AND " . 
$ilDB->in(
'qpl_questions.obj_fi', $available_pools, 
false, 
'integer');
 
 5592        if ($completeonly) {
 
 5593            $available .= 
" AND qpl_questions.complete = " . 
$ilDB->quote(
"1", 
'text');
 
 5597        if (is_array($arrFilter)) {
 
 5598            if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title'])) {
 
 5599                $where .= 
" AND " . 
$ilDB->like(
'qpl_questions.title', 
'text', 
"%%" . $arrFilter[
'title'] . 
"%%");
 
 5601            if (array_key_exists(
'description', $arrFilter) && strlen($arrFilter[
'description'])) {
 
 5602                $where .= 
" AND " . 
$ilDB->like(
'qpl_questions.description', 
'text', 
"%%" . $arrFilter[
'description'] . 
"%%");
 
 5604            if (array_key_exists(
'author', $arrFilter) && strlen($arrFilter[
'author'])) {
 
 5605                $where .= 
" AND " . 
$ilDB->like(
'qpl_questions.author', 
'text', 
"%%" . $arrFilter[
'author'] . 
"%%");
 
 5607            if (array_key_exists(
'type', $arrFilter) && strlen($arrFilter[
'type'])) {
 
 5608                $where .= 
" AND qpl_qst_type.type_tag = " . 
$ilDB->quote($arrFilter[
'type'], 
'text');
 
 5610            if (array_key_exists(
'qpl', $arrFilter) && strlen($arrFilter[
'qpl'])) {
 
 5611                $where .= 
" AND " . 
$ilDB->like(
'object_data.title', 
'text', 
"%%" . $arrFilter[
'qpl'] . 
"%%");
 
 5616        $original_clause = 
" qpl_questions.original_id IS NULL";
 
 5617        if (count($original_ids)) {
 
 5618            $original_clause = 
" qpl_questions.original_id IS NULL AND " . 
$ilDB->in(
'qpl_questions.question_id', $original_ids, 
true, 
'integer');
 
 5621        $query_result = 
$ilDB->query(
" 
 5622                        SELECT          qpl_questions.*, qpl_questions.tstamp, 
 5623                                                qpl_qst_type.type_tag, qpl_qst_type.plugin, qpl_qst_type.plugin_name, 
 5624                                                object_data.title parent_title 
 5625                        FROM            qpl_questions, qpl_qst_type, object_data 
 5626                        WHERE $original_clause $available 
 5627                        AND object_data.obj_id = qpl_questions.obj_fi 
 5628                        AND qpl_questions.tstamp > 0 
 5629                        AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id 
 5633        $types = $this->getQuestionTypeTranslations();
 
 5634        if ($query_result->numRows()) {
 
 5635            while ($row = 
$ilDB->fetchAssoc($query_result)) {
 
 5638                if (!$row[
'plugin']) {
 
 5639                    $row[ 
'ttype' ] = 
$lng->txt($row[ 
"type_tag" ]);
 
 5645                if (!$pluginAdmin->isActive(
IL_COMP_MODULE, 
'TestQuestionPool', 
'qst', $row[
'plugin_name'])) {
 
 5650                $row[ 
'ttype' ] = $pl->getQuestionTypeTranslation();
 
 5670        foreach ($assessment->objectives as $objectives) {
 
 5671            foreach ($objectives->materials as $material) {
 
 5686        foreach ($assessment->assessmentcontrol as $assessmentcontrol) {
 
 5687            switch ($assessmentcontrol->getSolutionswitch()) {
 
 5702        foreach ($assessment->qtimetadata as 
$metadata) {
 
 5726                case "sequence_settings":
 
 5729                case "solution_details":
 
 5732                case "print_bs_with_res":
 
 5741                case 'block_after_passed':
 
 5744                case "pass_waiting":
 
 5748                    $this->
setKiosk($metadata[
"entry"]);
 
 5750                case "showfinalstatement":
 
 5763                case "highscore_enabled":
 
 5767                case "highscore_anon":
 
 5771                case "highscore_achieved_ts":
 
 5775                case "highscore_score":
 
 5779                case "highscore_percentage":
 
 5783                case "highscore_hints":
 
 5787                case "highscore_wtime":
 
 5791                case "highscore_own_table":
 
 5795                case "highscore_top_table":
 
 5799                case "highscore_top_num":
 
 5803                case "hide_previous_results":
 
 5810                case "use_previous_answers":
 
 5813                case "answer_feedback":
 
 5816                case "hide_title_points":
 
 5819                case "title_output":
 
 5822                case "question_set_type":
 
 5832                case "results_presentation":
 
 5835                case "reset_processing_time":
 
 5838                case "instant_verification":
 
 5841                case "follow_qst_answer_fixation":
 
 5844                case "instant_feedback_answer_fixation":
 
 5847                case "force_instant_feedback":
 
 5850                case "answer_feedback_points":
 
 5865                case "fixed_participants":
 
 5868                case "score_reporting":
 
 5871                case "shuffle_questions":
 
 5874                case "count_system":
 
 5880                case "mailnotification":
 
 5886                case "exportsettings":
 
 5889                case "score_cutting":
 
 5896                case "allowedUsers":
 
 5900                case "allowedUsersTimeGap":
 
 5903                case "pass_scoring":
 
 5906                case 'pass_deletion_allowed':
 
 5909                case "show_summary":
 
 5912                case "reporting_date":
 
 5914                    if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches)) {
 
 5915                        $this->
setReportingDate(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
 
 5918                case 'enable_processing_time':
 
 5921                case "processing_time":
 
 5924                case "starting_time":
 
 5926                    if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches)) {
 
 5927                        $date_time = 
new ilDateTime(sprintf(
"%02d-%02d-%02d %02d:%02d:%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]), 
IL_CAL_DATETIME);
 
 5934                    if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches)) {
 
 5935                        $date_time = 
new ilDateTime(sprintf(
"%02d-%02d-%02d %02d:%02d:%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]), 
IL_CAL_DATETIME);
 
 5940                case "enable_examview":
 
 5943                case 'show_examview_html':
 
 5946                case 'show_examview_pdf':
 
 5949                case 'redirection_mode':
 
 5952                case 'redirection_url':
 
 5955                case 'examid_in_kiosk':
 
 5956                case 'examid_in_test_pass':
 
 5959                case 'show_exam_id':
 
 5960                case 'examid_in_test_res':
 
 5963                case 'enable_archiving':
 
 5966                case 'sign_submission':
 
 5969                case 'char_selector_availability':
 
 5972                case 'char_selector_definition':
 
 5975                case 'skill_service':
 
 5978                case 'result_tax_filters':
 
 5981                case 'show_grading_status':
 
 5984                case 'show_grading_mark':
 
 5987                case 'activation_limited':
 
 5990                case 'activation_start_time':
 
 5993                case 'activation_end_time':
 
 5996                case 'activation_visibility':
 
 6002                case 'autosave_ival':
 
 6005                case 'offer_question_hints':
 
 6008                case 'instant_feedback_specific':
 
 6011                case 'obligations_enabled':
 
 6015            if (preg_match(
"/mark_step_\d+/", 
$metadata[
"label"])) {
 
 6017                preg_match(
"/<short>(.*?)<\/short>/", $xmlmark, $matches);
 
 6018                $mark_short = $matches[1];
 
 6019                preg_match(
"/<official>(.*?)<\/official>/", $xmlmark, $matches);
 
 6020                $mark_official = $matches[1];
 
 6021                preg_match(
"/<percentage>(.*?)<\/percentage>/", $xmlmark, $matches);
 
 6022                $mark_percentage = $matches[1];
 
 6023                preg_match(
"/<passed>(.*?)<\/passed>/", $xmlmark, $matches);
 
 6024                $mark_passed = $matches[1];
 
 6025                $this->mark_schema->addMarkStep($mark_short, $mark_official, $mark_percentage, $mark_passed);
 
 6029        if (is_array(
$_SESSION[
"import_mob_xhtml"])) {
 
 6030            include_once 
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
 
 6031            include_once 
"./Services/RTE/classes/class.ilRTE.php";
 
 6032            include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 6033            foreach (
$_SESSION[
"import_mob_xhtml"] as $mob) {
 
 6035                if (file_exists($importfile)) {
 
 6042                    $ilLog = 
$DIC[
'ilLog'];
 
 6043                    $ilLog->write(
"Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
 
 6057        include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
 
 6061        $a_xml_writer->xmlSetDtdDef(
"<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">");
 
 6062        $a_xml_writer->xmlStartTag(
"questestinterop");
 
 6068        $a_xml_writer->xmlStartTag(
"assessment", $attrs);
 
 6070        $a_xml_writer->xmlElement(
"qticomment", 
null, $this->
getDescription());
 
 6073        if ($this->enable_processing_time) {
 
 6074            preg_match(
"/(\d+):(\d+):(\d+)/", $this->processing_time, $matches);
 
 6075            $a_xml_writer->xmlElement(
"duration", 
null, sprintf(
"P0Y0M0DT%dH%dM%dS", $matches[1], $matches[2], $matches[3]));
 
 6079        $a_xml_writer->xmlStartTag(
"qtimetadata");
 
 6080        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6081        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"ILIAS_VERSION");
 
 6082        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
ilias->getSetting(
"ilias_version"));
 
 6083        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6086        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6087        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"anonymity");
 
 6088        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getAnonymity()));
 
 6089        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6091        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6092        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"use_pool");
 
 6093        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getPoolUsage() ? 1 : 0);
 
 6094        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6097        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6098        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"question_set_type");
 
 6100        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6103        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6104        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"sequence_settings");
 
 6106        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6109        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6110        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"author");
 
 6111        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getAuthor());
 
 6112        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6115        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6116        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"reset_processing_time");
 
 6118        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6121        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6122        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"count_system");
 
 6123        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getCountSystem());
 
 6124        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6127        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6128        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"mc_scoring");
 
 6129        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getMCScoring());
 
 6130        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6133        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6134        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"score_cutting");
 
 6135        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getScoreCutting());
 
 6136        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6139        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6140        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"password");
 
 6141        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getPassword());
 
 6142        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6145        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6146        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"allowedUsers");
 
 6147        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getAllowedUsers());
 
 6148        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6151        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6152        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"allowedUsersTimeGap");
 
 6154        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6157        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6158        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"pass_scoring");
 
 6159        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getPassScoring());
 
 6160        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6162        $a_xml_writer->xmlStartTag(
'qtimetadatafield');
 
 6163        $a_xml_writer->xmlElement(
'fieldlabel', 
null, 
'pass_deletion_allowed');
 
 6165        $a_xml_writer->xmlEndTag(
'qtimetadatafield');
 
 6169            $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6170            $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"reporting_date");
 
 6171            preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->reporting_date, $matches);
 
 6172            $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"P%dY%dM%dDT%dH%dM%dS", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
 
 6173            $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6176        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6177        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"nr_of_tries");
 
 6178        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getNrOfTries()));
 
 6179        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6182        $a_xml_writer->xmlStartTag(
'qtimetadatafield');
 
 6183        $a_xml_writer->xmlElement(
'fieldlabel', 
null, 
'block_after_passed');
 
 6185        $a_xml_writer->xmlEndTag(
'qtimetadatafield');
 
 6188        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6189        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"pass_waiting");
 
 6190        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getPassWaiting());
 
 6191        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6194        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6195        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"kiosk");
 
 6196        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getKiosk()));
 
 6197        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6201        $a_xml_writer->xmlStartTag(
'qtimetadatafield');
 
 6202        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"redirection_mode");
 
 6204        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6207        $a_xml_writer->xmlStartTag(
'qtimetadatafield');
 
 6208        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"redirection_url");
 
 6210        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6213        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6214        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"use_previous_answers");
 
 6216        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6219        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6220        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"title_output");
 
 6221        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getTitleOutput()));
 
 6222        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6225        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6226        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"results_presentation");
 
 6228        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6231        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6232        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"examid_in_test_pass");
 
 6234        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6237        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6238        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"examid_in_test_res");
 
 6240        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6243        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6244        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_summary");
 
 6246        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6249        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6250        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"score_reporting");
 
 6251        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getScoreReporting()));
 
 6252        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6254        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6255        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"solution_details");
 
 6257        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6258        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6259        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"print_bs_with_res");
 
 6261        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6264        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6265        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"instant_verification");
 
 6267        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6270        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6271        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"answer_feedback");
 
 6272        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getAnswerFeedback()));
 
 6273        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6276        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6277        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"answer_feedback_points");
 
 6279        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6282        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6283        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"follow_qst_answer_fixation");
 
 6285        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6288        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6289        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"instant_feedback_answer_fixation");
 
 6291        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6294        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6295        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"force_instant_feedback");
 
 6297        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6301        $highscore_metadata = array(
 
 6313        foreach ($highscore_metadata as $label => 
$data) {
 
 6314            $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6315            $a_xml_writer->xmlElement(
"fieldlabel", 
null, $label);
 
 6316            $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", 
$data[
'value']));
 
 6317            $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6321        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6322        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_cancel");
 
 6323        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getShowCancel()));
 
 6324        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6327        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6328        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_marker");
 
 6329        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getShowMarker()));
 
 6330        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6333        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6334        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"fixed_participants");
 
 6336        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6339        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6340        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"showfinalstatement");
 
 6341        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", (($this->
getShowFinalStatement()) ? 
"1" : 
"0")));
 
 6342        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6345        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6346        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"showinfo");
 
 6347        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", (($this->
getShowInfo()) ? 
"1" : 
"0")));
 
 6348        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6351        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6352        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"mailnotification");
 
 6354        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6357        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6358        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"mailnottype");
 
 6360        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6363        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6364        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"exportsettings");
 
 6365        $a_xml_writer->xmlElement(
"fieldentry", 
null, (
int) $this->
getExportSettings());
 
 6366        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6369        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6370        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"forcejs");
 
 6371        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", (($this->
getForceJS()) ? 
"1" : 
"0")));
 
 6372        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6375        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6376        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"customstyle");
 
 6377        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getCustomStyle());
 
 6378        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6381        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6382        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"shuffle_questions");
 
 6383        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getShuffleQuestions()));
 
 6384        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6387        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6388        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"processing_time");
 
 6390        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6393        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6394        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"enable_examview");
 
 6395        $a_xml_writer->xmlElement(
"fieldentry", 
null, (
int) $this->
getEnableExamview());
 
 6396        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6399        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6400        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_examview_html");
 
 6402        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6405        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6406        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_examview_pdf");
 
 6408        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6411        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6412        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"enable_archiving");
 
 6414        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6417        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6418        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"sign_submission");
 
 6419        $a_xml_writer->xmlElement(
"fieldentry", 
null, (
int) $this->
getSignSubmission());
 
 6420        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6423        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6424        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"char_selector_availability");
 
 6426        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6429        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6430        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"char_selector_definition");
 
 6432        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6435        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6436        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"skill_service");
 
 6438        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6441        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6442        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"result_tax_filters");
 
 6444        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6447        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6448        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_grading_status");
 
 6450        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6453        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6454        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_grading_mark");
 
 6456        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6461            $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6462            $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"starting_time");
 
 6464            $a_xml_writer->xmlElement(
"fieldentry", 
null, $backward_compatibility_format);
 
 6465            $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6469            $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6470            $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"ending_time");
 
 6472            $a_xml_writer->xmlElement(
"fieldentry", 
null, $backward_compatibility_format);
 
 6473            $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6478        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6479        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"activation_limited");
 
 6481        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6484        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6485        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"activation_start_time");
 
 6487        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6490        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6491        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"activation_end_time");
 
 6493        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6496        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6497        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"activation_visibility");
 
 6499        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6502        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6503        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"autosave");
 
 6504        $a_xml_writer->xmlElement(
"fieldentry", 
null, (
int) $this->
getAutosave());
 
 6505        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6508        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6509        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"autosave_ival");
 
 6510        $a_xml_writer->xmlElement(
"fieldentry", 
null, (
int) $this->
getAutosaveIval());
 
 6511        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6514        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6515        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"offer_question_hints");
 
 6517        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6520        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6521        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"instant_feedback_specific");
 
 6523        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6526        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6527        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"instant_feedback_answer_fixation");
 
 6529        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6532        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6533        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"obligations_enabled");
 
 6535        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6538        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6539        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"enable_processing_time");
 
 6541        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6543        foreach ($this->mark_schema->mark_steps as 
$index => $mark) {
 
 6545            $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6546            $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"mark_step_$index");
 
 6547            $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
 
 6548                "<short>%s</short><official>%s</official><percentage>%.2f</percentage><passed>%d</passed>",
 
 6549                $mark->getShortName(),
 
 6550                $mark->getOfficialName(),
 
 6551                $mark->getMinimumLevel(),
 
 6554            $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6556        $a_xml_writer->xmlEndTag(
"qtimetadata");
 
 6559        $a_xml_writer->xmlStartTag(
"objectives");
 
 6561        $a_xml_writer->xmlEndTag(
"objectives");
 
 6566                "solutionswitch" => 
"Yes" 
 6571        $a_xml_writer->xmlElement(
"assessmentcontrol", $attrs, 
null);
 
 6575            $a_xml_writer->xmlStartTag(
"presentation_material");
 
 6576            $a_xml_writer->xmlStartTag(
"flow_mat");
 
 6578            $a_xml_writer->xmlEndTag(
"flow_mat");
 
 6579            $a_xml_writer->xmlEndTag(
"presentation_material");
 
 6585        $a_xml_writer->xmlElement(
"section", $attrs, 
null);
 
 6586        $a_xml_writer->xmlEndTag(
"assessment");
 
 6587        $a_xml_writer->xmlEndTag(
"questestinterop");
 
 6589        $xml = $a_xml_writer->xmlDumpMem(
false);
 
 6601        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $date_time, $matches);
 
 6602        $iso8601_period = sprintf(
"P%dY%dM%dDT%dH%dM%dS", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]);
 
 6603        return $iso8601_period;
 
 6617        $this->mob_ids = array();
 
 6618        $this->file_ids = array();
 
 6624        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Start Export Page Objects");
 
 6625        $ilBench->start(
"ContentObjectExport", 
"exportPageObjects");
 
 6627        $ilBench->stop(
"ContentObjectExport", 
"exportPageObjects");
 
 6628        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Finished Export Page Objects");
 
 6631        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Start Export Media Objects");
 
 6632        $ilBench->start(
"ContentObjectExport", 
"exportMediaObjects");
 
 6634        $ilBench->stop(
"ContentObjectExport", 
"exportMediaObjects");
 
 6635        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Finished Export Media Objects");
 
 6638        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Start Export File Items");
 
 6639        $ilBench->start(
"ContentObjectExport", 
"exportFileItems");
 
 6641        $ilBench->stop(
"ContentObjectExport", 
"exportFileItems");
 
 6642        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Finished Export File Items");
 
 6653        include_once 
"./Services/MetaData/classes/class.ilMD2XML.php";
 
 6655        $md2xml->setExportMode(
true);
 
 6656        $md2xml->startExport();
 
 6657        $a_xml_writer->appendXML($md2xml->getXML());
 
 6667        if ($a_tag == 
"Identifier" && $a_param == 
"Entry") {
 
 6668            include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 6687        include_once 
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
 
 6689        foreach ($this->questions as $question_id) {
 
 6690            $ilBench->start(
"ContentObjectExport", 
"exportPageObject");
 
 6691            $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Page Object " . $question_id);
 
 6694            $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
 
 6698            $ilBench->start(
"ContentObjectExport", 
"exportPageObject_XML");
 
 6699            include_once 
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
 
 6701            $page_object->buildDom();
 
 6702            $page_object->insertInstIntoIDs($a_inst);
 
 6703            $mob_ids = $page_object->collectMediaObjects(
false);
 
 6704            require_once 
'Services/COPage/classes/class.ilPCFileList.php';
 
 6706            $xml = $page_object->getXMLFromDom(
false, 
false, 
false, 
"", 
true);
 
 6707            $xml = str_replace(
"&", 
"&", 
$xml);
 
 6708            $a_xml_writer->appendXML(
$xml);
 
 6709            $page_object->freeDom();
 
 6710            unset($page_object);
 
 6712            $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_XML");
 
 6715            $ilBench->start(
"ContentObjectExport", 
"exportPageObject_CollectMedia");
 
 6717            foreach ($mob_ids as $mob_id) {
 
 6718                $this->mob_ids[$mob_id] = $mob_id;
 
 6720            $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_CollectMedia");
 
 6723            $ilBench->start(
"ContentObjectExport", 
"exportPageObject_CollectFileItems");
 
 6725            foreach ($file_ids as $file_id) {
 
 6726                $this->file_ids[$file_id] = $file_id;
 
 6728            $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_CollectFileItems");
 
 6730            $a_xml_writer->xmlEndTag(
"PageObject");
 
 6733            $ilBench->stop(
"ContentObjectExport", 
"exportPageObject");
 
 6745        include_once 
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
 
 6747        foreach ($this->mob_ids as $mob_id) {
 
 6748            $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Media Object " . $mob_id);
 
 6751                $media_obj->exportXML($a_xml_writer, $a_inst);
 
 6752                $media_obj->exportFiles($a_target_dir);
 
 6764        include_once 
"./Modules/File/classes/class.ilObjFile.php";
 
 6766        foreach ($this->file_ids as $file_id) {
 
 6767            $expLog->write(date(
"[y-m-d H:i:s] ") . 
"File Item " . $file_id);
 
 6768            $file_dir = $target_dir . 
'/objects/il_' . 
IL_INST_ID . 
'_file_' . $file_id;
 
 6770            $file_obj = 
new ilObjFile($file_id, 
false);
 
 6771            $source_file = $file_obj->getFile($file_obj->getVersion());
 
 6772            if (!is_file($source_file)) {
 
 6773                $source_file = $file_obj->getFile();
 
 6775            if (is_file($source_file)) {
 
 6776                copy($source_file, $file_dir . 
'/' . $file_obj->getFileName());
 
 6788        if (!is_array($this->import_mapping)) {
 
 6791            return $this->import_mapping;
 
 6816        return self::_getECTSGrade($passed_array, $reached_points, $max_points, $this->ects_grades[
"A"], $this->ects_grades[
"B"], $this->ects_grades[
"C"], $this->ects_grades[
"D"], $this->ects_grades[
"E"], $this->ects_fx);
 
 6824        include_once 
"./Modules/Test/classes/class.ilStatistics.php";
 
 6827        $passed_statistics->setData($points_passed);
 
 6828        $ects_percentiles = array(
 
 6829            "A" => $passed_statistics->quantile(
$a),
 
 6830            "B" => $passed_statistics->quantile(
$b),
 
 6831            "C" => $passed_statistics->quantile(
$c),
 
 6832            "D" => $passed_statistics->quantile(
$d),
 
 6833            "E" => $passed_statistics->quantile(
$e)
 
 6835        if (count($points_passed) && ($reached_points >= $ects_percentiles[
"A"])) {
 
 6837        } elseif (count($points_passed) && ($reached_points >= $ects_percentiles[
"B"])) {
 
 6839        } elseif (count($points_passed) && ($reached_points >= $ects_percentiles[
"C"])) {
 
 6841        } elseif (count($points_passed) && ($reached_points >= $ects_percentiles[
"D"])) {
 
 6843        } elseif (count($points_passed) && ($reached_points >= $ects_percentiles[
"E"])) {
 
 6845        } elseif (strcmp($fx, 
"") != 0) {
 
 6846            if ($max_points > 0) {
 
 6847                $percentage = ($reached_points / $max_points) * 100.0;
 
 6848                if ($percentage < 0) {
 
 6854            if ($percentage >= $fx) {
 
 6869        return $this->mark_schema->checkMarks();
 
 6899        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 6902        require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 6919                if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getReportingDate(), $matches)) {
 
 6920                    $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 6922                    if ($now < $epoch_time) {
 
 6957        $md_life = &$md->getLifecycle();
 
 6959            if (strlen($a_author) == 0) {
 
 6962                $a_author = 
$ilUser->getFullname();
 
 6965            $md_life = &$md->addLifecycle();
 
 6967            $con = &$md_life->addContribute();
 
 6968            $con->setRole(
"Author");
 
 6970            $ent = &$con->addEntity();
 
 6971            $ent->setEntity($a_author);
 
 6983        parent::createMetaData();
 
 6997        include_once 
"./Services/MetaData/classes/class.ilMD.php";
 
 6999        $md_life = &$md->getLifecycle();
 
 7001            $ids = &$md_life->getContributeIds();
 
 7002            foreach ($ids as 
$id) {
 
 7003                $md_cont = &$md_life->getContribute(
$id);
 
 7004                if (strcmp($md_cont->getRole(), 
"Author") == 0) {
 
 7005                    $entids = &$md_cont->getEntityIds();
 
 7006                    foreach ($entids as $entid) {
 
 7007                        $md_ent = &$md_cont->getEntity($entid);
 
 7008                        array_push(
$author, $md_ent->getEntity());
 
 7026        include_once 
"./Services/MetaData/classes/class.ilMD.php";
 
 7027        $md = 
new ilMD($obj_id, 0, 
"tst");
 
 7028        $md_life = &$md->getLifecycle();
 
 7030            $ids = &$md_life->getContributeIds();
 
 7031            foreach ($ids as 
$id) {
 
 7032                $md_cont = &$md_life->getContribute(
$id);
 
 7033                if (strcmp($md_cont->getRole(), 
"Author") == 0) {
 
 7034                    $entids = &$md_cont->getEntityIds();
 
 7035                    foreach ($entids as $entid) {
 
 7036                        $md_ent = &$md_cont->getEntity($entid);
 
 7037                        array_push(
$author, $md_ent->getEntity());
 
 7057        $result_array = array();
 
 7058        $tests = array_slice(
 
 7066        if (count($tests)) {
 
 7069                if ($use_object_id) {
 
 7071                    $result_array[$obj_id] = $titles[
$ref_id];
 
 7077        return $result_array;
 
 7088    public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree = 
false)
 
 7092        $certificateLogger = 
$DIC->logger()->cert();
 
 7095        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 7101        $newObj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
 
 7102        $newObj->setTmpCopyWizardCopyId($a_copy_id);
 
 7107        if ($cp_options->isRootNode($this->getRefId())) {
 
 7108            $newObj->setOfflineStatus(
true);
 
 7136        $newObj->setKiosk($this->
getKiosk());
 
 7195        $newObj->saveToDb();
 
 7204            $templateRepository,
 
 7205            $DIC->filesystem()->web(),
 
 7210        $cloneAction->cloneCertificate($this, $newObj);
 
 7213        $testQuestionSetConfigFactory->getQuestionSetConfig()->cloneQuestionSetRelatedData($newObj);
 
 7215        require_once 
'Modules/Test/classes/class.ilTestSkillLevelThresholdList.php';
 
 7217        $skillLevelThresholdList->setTestId($this->
getTestId());
 
 7218        $skillLevelThresholdList->loadFromDb();
 
 7219        $skillLevelThresholdList->cloneListForTest($newObj->getTestId());
 
 7221        $newObj->saveToDb();
 
 7222        $newObj->updateMetaData();
 
 7224        include_once(
'./Services/Tracking/classes/class.ilLPObjSettings.php');
 
 7226        $obj_settings->cloneSettings($newObj->getId());
 
 7245            $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 7254            $questionSetConfig->loadFromDb();
 
 7256            if ($questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
 
 7257                require_once 
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
 
 7258                require_once 
'Modules/Test/classes/class.ilTestRandomQuestionSetBuilderWithAmountPerPool.php';
 
 7259                require_once 
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
 
 7267                $sourcePoolDefinitionList->loadDefinitions();
 
 7269                $num = $sourcePoolDefinitionList->getQuestionAmount();
 
 7271                $num = $questionSetConfig->getQuestionAmountPerTest();
 
 7274            $num = count($this->questions);
 
 7293        if (strcmp($question_id, 
"") != 0) {
 
 7294            include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 7297        include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 7314            "SELECT obj_fi FROM tst_tests WHERE test_id = %s",
 
 7320            $object_id = $row[
"obj_fi"];
 
 7338            "SELECT tst_tests.obj_fi FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
 
 7344            $object_id = $row[
"obj_fi"];
 
 7362            "SELECT test_id FROM tst_tests WHERE obj_fi = %s",
 
 7387        if (($active_id) && ($question_id)) {
 
 7388            if (is_null(
$pass)) {
 
 7389                include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 7393                "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
 7394                array(
'integer', 
'integer', 
'integer'),
 
 7395                array($active_id, $question_id, 
$pass)
 
 7397            if (
$result->numRows() == 1) {
 
 7399                $res = $row[
"value1"];
 
 7420                "SELECT question_text FROM qpl_questions WHERE question_id = %s",
 
 7424            if (
$result->numRows() == 1) {
 
 7426                $res = $row[
"question_text"];
 
 7437        require_once 
'Modules/Test/classes/class.ilTestParticipantList.php';
 
 7441        return $participantList;
 
 7449        require_once 
'Modules/Test/classes/class.ilTestParticipantList.php';
 
 7453        return $participantList;
 
 7467        $result_array = array();
 
 7470            if (is_numeric($user_id)) {
 
 7472                    "SELECT tst_active.active_id, tst_active.tries, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
 
 7473                    "tst_active.submitted test_finished, matriculation, COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes  FROM usr_data, tst_invited_user " .
 
 7474                    "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7475                    "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
 
 7477                    array(
'text', 
'text', 
'text', 
'integer', 
'integer'),
 
 7478                    array(
"", $this->lng->txt(
"anonymous"), 
"", $this->getTestId(), $user_id)
 
 7482                    "SELECT tst_active.active_id, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
 
 7483                    "tst_active.submitted test_finished, matriculation, COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes  FROM usr_data, tst_invited_user " .
 
 7484                    "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7485                    "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
 
 7487                    array(
'text', 
'text', 
'text', 
'integer'),
 
 7488                    array(
"", $this->lng->txt(
"anonymous"), 
"", $this->getTestId())
 
 7492            if (is_numeric($user_id)) {
 
 7494                    "SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
 
 7495                    "tst_active.submitted test_finished, matriculation, COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes  FROM usr_data, tst_invited_user " .
 
 7496                    "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7497                    "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
 
 7499                    array(
'integer', 
'integer'),
 
 7504                    "SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
 
 7505                    "tst_active.submitted test_finished, matriculation, COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes  FROM usr_data, tst_invited_user " .
 
 7506                    "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7507                    "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
 
 7514        $result_array = array();
 
 7516            $result_array[$row[
'usr_id']] = $row;
 
 7518        return $result_array;
 
 7534                                SELECT  tst_active.active_id, 
 7536                                                tst_active.user_fi usr_id, 
 7540                                                tst_active.submitted test_finished, 
 7541                                                usr_data.matriculation, 
 7543                                                tst_active.lastindex, 
 7544                                                COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes 
 7547                                ON tst_active.user_fi = usr_data.usr_id 
 7548                                WHERE tst_active.test_fi = %s 
 7549                                ORDER BY usr_data.lastname 
 7553                array(
'text', 
'text', 
'text', 
'integer'),
 
 7554                array(
"", $this->lng->txt(
"anonymous"), 
"", $this->getTestId())
 
 7558                                SELECT  tst_active.active_id, 
 7560                                                tst_active.user_fi usr_id, 
 7564                                                tst_active.submitted test_finished, 
 7565                                                usr_data.matriculation, 
 7567                                                tst_active.lastindex, 
 7568                                                COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes 
 7571                                ON tst_active.user_fi = usr_data.usr_id 
 7572                                WHERE tst_active.test_fi = %s 
 7573                                ORDER BY usr_data.lastname 
 7583            $data[$row[
'active_id']] = $row;
 
 7586            if (strlen(trim($participant[
"firstname"] . $participant[
"lastname"])) == 0) {
 
 7587                $data[
$index][
"lastname"] = $this->lng->txt(
"deleted_user");
 
 7598        include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 7600        if (count($scoring) == 0) {
 
 7605        $filtered_participants = array();
 
 7606        foreach ($participants as $active_id => $participant) {
 
 7607            $qstType_IN_manScoreableQstTypes = 
$ilDB->in(
'qpl_questions.question_type_fi', $scoring, 
false, 
'integer');
 
 7610                                SELECT          tst_test_result.manual 
 7612                                FROM            tst_test_result 
 7614                                INNER JOIN      qpl_questions 
 7615                                ON                      tst_test_result.question_fi = qpl_questions.question_id 
 7617                                WHERE           tst_test_result.active_fi = %s 
 7618                                AND                     $qstType_IN_manScoreableQstTypes 
 7632                        if ($participant->active) {
 
 7633                            $filtered_participants[$active_id] = $participant;
 
 7637                        if (!$participant->active) {
 
 7638                            $filtered_participants[$active_id] = $participant;
 
 7642                        $filtered_participants[$active_id] = $participant;
 
 7657                            $assessmentSetting = 
new ilSetting(
"assessment");
 
 7658                            $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
 
 7659                            if ($manscoring_done) {
 
 7660                                $filtered_participants[$active_id] = $participant;
 
 7673                            $assessmentSetting = 
new ilSetting(
"assessment");
 
 7674                            $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
 
 7675                            if (!$manscoring_done) {
 
 7676                                $filtered_participants[$active_id] = $participant;
 
 7684                            if ($row[
"manual"]) {
 
 7688                        if (($found > 0) && ($found < $count)) {
 
 7689                            $filtered_participants[$active_id] = $participant;
 
 7693                        $filtered_participants[$active_id] = $participant;
 
 7698        return $filtered_participants;
 
 7713        if (!is_array($ids) || count($ids) == 0) {
 
 7719                "SELECT usr_id, %s login, %s lastname, %s firstname, client_ip clientip FROM usr_data WHERE " . 
$ilDB->in(
'usr_id', $ids, 
false, 
'integer') . 
" ORDER BY login",
 
 7720                array(
'text', 
'text', 
'text'),
 
 7721                array(
"", $this->lng->txt(
"anonymous"), 
"")
 
 7724            $result = 
$ilDB->query(
"SELECT usr_id, login, lastname, firstname, client_ip clientip FROM usr_data WHERE " . 
$ilDB->in(
'usr_id', $ids, 
false, 
'integer') . 
" ORDER BY login");
 
 7727        $result_array = array();
 
 7729            $result_array[$row[
"usr_id"]] = $row;
 
 7731        return $result_array;
 
 7736        if (!is_array($ids) || count($ids) == 0) {
 
 7749        if (!is_array($ids) || count($ids) == 0) {
 
 7753        foreach ($ids as $obj_id) {
 
 7768        include_once 
"./Modules/Group/classes/class.ilObjGroup.php";
 
 7770        $members = $group->getGroupMemberIds();
 
 7771        include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 7772        foreach ($members as $user_id) {
 
 7788        include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 7789        foreach ($members as $user_id) {
 
 7807        $affectedRows = 
$ilDB->manipulateF(
 
 7808            "DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
 
 7809            array(
'integer', 
'integer'),
 
 7825        $affectedRows = 
$ilDB->manipulateF(
 
 7826            "DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
 
 7827            array(
'integer', 
'integer'),
 
 7830        $affectedRows = 
$ilDB->manipulateF(
 
 7831            "INSERT INTO tst_invited_user (test_fi, user_fi, clientip, tstamp) VALUES (%s, %s, %s, %s)",
 
 7832            array(
'integer', 
'integer', 
'text', 
'integer'),
 
 7833            array($this->
getTestId(), $user_id, (strlen($client_ip)) ? $client_ip : 
null, time())
 
 7843        $affectedRows = 
$ilDB->manipulateF(
 
 7844            "UPDATE tst_invited_user SET clientip = %s, tstamp = %s WHERE test_fi=%s and user_fi=%s",
 
 7845            array(
'text', 
'integer', 
'integer', 
'integer'),
 
 7846            array((strlen($client_ip)) ? $client_ip : 
null, time(), $this->
getTestId(), $user_id)
 
 7859        if (is_numeric($question_fi)) {
 
 7861                "SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s AND question_fi=%s",
 
 7862                array(
'integer', 
'integer'),
 
 7863                array($active_id, $question_fi)
 
 7867                "SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s",
 
 7872        $result_array = array();
 
 7874            $result_array[$row[
"question_fi"]] = $row;
 
 7876        return $result_array;
 
 7889        $affectedRows = 
$ilDB->manipulateF(
 
 7890            "DELETE FROM tst_qst_solved WHERE active_fi = %s AND question_fi = %s",
 
 7891            array(
'integer', 
'integer'),
 
 7892            array($active_id, $question_id)
 
 7894        $affectedRows = 
$ilDB->manipulateF(
 
 7895            "INSERT INTO tst_qst_solved (solved, question_fi, active_fi) VALUES (%s, %s, %s)",
 
 7896            array(
'integer', 
'integer', 
'integer'),
 
 7897            array($value, $question_id, $active_id)
 
 7910            "SELECT submitted FROM tst_active WHERE active_id=%s AND submitted=%s",
 
 7911            array(
'integer', 
'integer'),
 
 7912            array($active_id, 1)
 
 7914        return $result->numRows() == 1;
 
 7926        if (!is_numeric($user_id)) {
 
 7931            "SELECT submitted FROM tst_active WHERE test_fi=%s AND user_fi=%s AND submitted=%s",
 
 7932            array(
'integer', 
'integer', 
'integer'),
 
 7935        return $result->numRows() == 1;
 
 7970            "user_id" => $this->lng->txt(
"user_id"),
 
 7971            "matriculation" => $this->lng->txt(
"matriculation"),
 
 7972            "lastname" => $this->lng->txt(
"lastname"),
 
 7973            "firstname" => $this->lng->txt(
"firstname"),
 
 7974            "login" => $this->lng->txt(
"login"),
 
 7975            "reached_points" => $this->lng->txt(
"tst_reached_points"),
 
 7976            "max_points" => $this->lng->txt(
"tst_maximum_points"),
 
 7977            "percent_value" => $this->lng->txt(
"tst_percent_solved"),
 
 7978            "mark" => $this->lng->txt(
"tst_mark"),
 
 7979            "ects" => $this->lng->txt(
"ects_grade"),
 
 7980            "passed" => $this->lng->txt(
"tst_mark_passed"),
 
 7983        if (count($participants)) {
 
 7987            foreach ($participants as $active_id => $user_rec) {
 
 7988                $mark = $ects_mark = 
'';
 
 7990                $reached_points = 0;
 
 7992                foreach ($this->questions as $value) {
 
 7994                    if (is_object($question)) {
 
 7995                        $max_points += $question->getMaximumPoints();
 
 7996                        $reached_points += $question->getReachedPoints($active_id);
 
 7999                if ($max_points > 0) {
 
 8000                    $percentvalue = $reached_points / $max_points;
 
 8001                    if ($percentvalue < 0) {
 
 8002                        $percentvalue = 0.0;
 
 8007                $mark_obj = $this->mark_schema->getMatchingMark($percentvalue * 100);
 
 8010                    $mark = $mark_obj->getOfficialName();
 
 8012                        $ects_mark = $this->
getECTSGrade($passed_array, $reached_points, $max_points);
 
 8016                    $user_rec[
'firstname'] = 
"";
 
 8017                    $user_rec[
'lastname'] = $this->lng->txt(
"anonymous");
 
 8020                    "user_id" => $user_rec[
'usr_id'],
 
 8021                    "matriculation" => $user_rec[
'matriculation'],
 
 8022                    "lastname" => $user_rec[
'lastname'],
 
 8023                    "firstname" => $user_rec[
'firstname'],
 
 8024                    "login" => $user_rec[
'login'],
 
 8025                    "reached_points" => $reached_points,
 
 8026                    "max_points" => $max_points,
 
 8027                    "percent_value" => $percentvalue,
 
 8029                    "ects" => $ects_mark,
 
 8030                    "passed" => $user_rec[
'passed'] ? 
'1' : 
'0',
 
 8050        $resultarray = array();
 
 8051        foreach ($row as $rowindex => $entry) {
 
 8056            if (strpos($entry, 
"\"") !== 
false) {
 
 8057                $entry = str_replace(
"\"", 
"\"\"", $entry);
 
 8060            if (strpos($entry, $separator) !== 
false) {
 
 8064            $entry = str_replace(chr(13) . chr(10), chr(10), $entry);
 
 8067                $entry = 
"\"" . $entry . 
"\"";
 
 8070            $resultarray[$rowindex] = $entry;
 
 8072        return $resultarray;
 
 8088            "SELECT tries FROM tst_active WHERE active_id = %s",
 
 8094            return $row[
"tries"];
 
 8114            "SELECT MAX(pass) maxpass FROM tst_pass_result WHERE active_fi = %s",
 
 8120            $max = $row[
"maxpass"];
 
 8138            "SELECT * FROM tst_pass_result WHERE active_fi = %s",
 
 8146                if ($row[
"maxpoints"] > 0) {
 
 8147                    $factor = (float) ($row[
"points"] / $row[
"maxpoints"]);
 
 8152                if ($factor === 0.0 && $bestfactor === 0.0
 
 8153                    || $factor > $bestfactor) {
 
 8155                    $bestfactor = $factor;
 
 8158            if (is_array($bestrow)) {
 
 8159                return $bestrow[
"pass"];
 
 8178        $counted_pass = 
null;
 
 8184        return $counted_pass;
 
 8203            $refinery = 
$DIC[
'refinery'];
 
 8204            $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 8206            require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
 8208            $testSession = $testSessionFactory->getSession($active_id);
 
 8210            require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 8214            require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 8216            $dynamicQuestionSetConfig->loadFromDb();
 
 8227        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 8229        foreach ($this->questions as $value) {
 
 8231                $workedthrough += 1;
 
 8234        return $workedthrough;
 
 8248        if (is_null(
$pass)) {
 
 8253                        SELECT  tst_pass_result.tstamp pass_res_tstamp, 
 8254                                        tst_test_result.tstamp quest_res_tstamp 
 8256                        FROM tst_pass_result 
 8258                        LEFT JOIN tst_test_result 
 8259                        ON tst_test_result.active_fi = tst_pass_result.active_fi 
 8260                        AND tst_test_result.pass = tst_pass_result.pass 
 8262                        WHERE tst_pass_result.active_fi = %s 
 8263                        AND tst_pass_result.pass = %s 
 8265                        ORDER BY tst_test_result.tstamp DESC 
 8270            array(
'integer', 
'integer'),
 
 8271            array($active_id, 
$pass)
 
 8275            if ($row[
'qres_tstamp']) {
 
 8276                return $row[
'quest_res_tstamp'];
 
 8279            return $row[
'pass_res_tstamp'];
 
 8296            "executable" => 
true,
 
 8297            "errormessage" => 
"" 
 8300            $result[
"executable"] = 
false;
 
 8305            $result[
"executable"] = 
false;
 
 8313            if ($active_id > 0) {
 
 8327                            $result[
"executable"] = 
false;
 
 8328                            $result[
"errormessage"] = $this->lng->txt(
"detail_max_processing_time_reached");
 
 8336        require_once 
'Modules/Test/classes/class.ilTestPassesSelector.php';
 
 8338        $testPassesSelector->setActiveId($active_id);
 
 8339        $testPassesSelector->setLastFinishedPass(
$testSession->getLastFinishedPass());
 
 8342            $closedPasses = $testPassesSelector->getClosedPasses();
 
 8345                $result[
"executable"] = 
false;
 
 8346                $result[
"errormessage"] = $this->lng->txt(
"maximum_nr_of_tries_reached");
 
 8352                    $result[
'executable'] = 
false;
 
 8353                    $result[
'errormessage'] = $this->lng->txt(
"tst_addit_passes_blocked_after_passed_msg");
 
 8359            $lastPass = $testPassesSelector->getLastFinishedPassTimestamp();
 
 8362                $time_values = explode(
":", $pass_waiting_string);
 
 8363                $next_pass_allowed = strtotime(
'+ ' . $time_values[0] . 
' Months + ' . $time_values[1] . 
' Days + ' . $time_values[2] . 
' Hours' . $time_values[3] . 
' Minutes', $lastPass);
 
 8365                if (time() < $next_pass_allowed) {
 
 8368                    $result[
"executable"] = 
false;
 
 8369                    $result[
"errormessage"] = sprintf($this->lng->txt(
'wait_for_next_pass_hint_msg'), $date);
 
 8382        require_once 
'Modules/Test/classes/class.ilTestPassesSelector.php';
 
 8385        $passSelector->setActiveId(
$testSession->getActiveId());
 
 8386        $passSelector->setLastFinishedPass(
$testSession->getLastFinishedPass());
 
 8388        return $passSelector->hasReportablePasses();
 
 8395        require_once 
'Modules/Test/classes/class.ilTestPassesSelector.php';
 
 8398        $passSelector->setActiveId(
$testSession->getActiveId());
 
 8399        $passSelector->setLastFinishedPass(
$testSession->getLastFinishedPass());
 
 8401        return $passSelector->hasExistingPasses();
 
 8416        if ($active_id < 1) {
 
 8419        if (
$pass === 
null) {
 
 8423            "SELECT tst_times.started FROM tst_times WHERE tst_times.active_fi = %s AND tst_times.pass = %s ORDER BY tst_times.started",
 
 8424            array(
'integer', 
'integer'),
 
 8425            array($active_id, 
$pass)
 
 8429            if (preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"started"], $matches)) {
 
 8430                return mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 8467        $tags_trafo = $this->refinery->string()->stripTags();
 
 8471                                                questtypes.type_tag, 
 8473                                                tstquest.obligatory, 
 8474                                                origquest.obj_fi orig_obj_fi 
 8476                        FROM            qpl_questions questions 
 8478                        INNER JOIN      qpl_qst_type questtypes 
 8479                        ON                      questtypes.question_type_id = questions.question_type_fi 
 8481                        INNER JOIN      tst_test_question tstquest 
 8482                        ON                      tstquest.question_fi = questions.question_id 
 8484                        LEFT JOIN       qpl_questions origquest 
 8485                        ON                      origquest.question_id = questions.original_id 
 8487                        WHERE           tstquest.test_fi = %s 
 8489                        ORDER BY        tstquest.sequence 
 8492        $query_result = 
$ilDB->queryF(
 
 8500        while ($row = 
$ilDB->fetchAssoc($query_result)) {
 
 8501            $row[
'title'] = $tags_trafo->transform($row[
'title']);
 
 8502            $row[
'description'] = $tags_trafo->transform($row[
'description'] !== 
'' && $row[
'description'] !== 
null ? $row[
'description'] : 
' ');
 
 8503            $row[
'author'] = $tags_trafo->transform($row[
'author']);
 
 8519            if ($questionData[
'question_id'] != $questionId) {
 
 8533        $row = 
$DIC->database()->fetchAssoc(
$DIC->database()->queryF(
 
 8534            "SELECT COUNT(question_id) cnt FROM qpl_questions WHERE question_id = %s AND obj_fi = %s",
 
 8535            array(
'integer', 
'integer'),
 
 8536            array($questionId, $this->
getId())
 
 8539        return (
bool) $row[
'cnt'];
 
 8550            $points += $questionData[
'points'];
 
 8561        $totalWorkingTime = 
'00:00:00';
 
 8566                $questionData[
'working_time']
 
 8570        return $totalWorkingTime;
 
 8576    public function getPotentialRandomTestQuestions()
 
 8586                                                questtypes.type_tag, 
 8587                                                origquest.obj_fi orig_obj_fi 
 8589                        FROM            qpl_questions questions 
 8591                        INNER JOIN      qpl_qst_type questtypes 
 8592                        ON                      questtypes.question_type_id = questions.question_type_fi 
 8594                        INNER JOIN      tst_rnd_cpy tstquest 
 8595                        ON                      tstquest.qst_fi = questions.question_id 
 8597                        LEFT JOIN       qpl_questions origquest 
 8598                        ON                      origquest.question_id = questions.original_id 
 8600                        WHERE           tstquest.tst_fi = %s 
 8603        $query_result = 
$ilDB->queryF(
 
 8611        while ($row = 
$ilDB->fetchAssoc($query_result)) {
 
 8630        return ($this->shuffle_questions) ? 1 : 0;
 
 8641        $this->shuffle_questions = ($a_shuffle) ? 1 : 0;
 
 8658        return ($this->show_summary) ? $this->show_summary : 0;
 
 8675        $this->show_summary = $a_value;
 
 8686        if (($this->show_summary & 1) > 0) {
 
 8702            $this->show_summary = 1;
 
 8704            $this->show_summary = 0;
 
 8716        if (($this->show_summary & 2) > 0) {
 
 8732            $this->show_summary = $this->show_summary | 2;
 
 8736                $this->show_summary = $this->show_summary ^ 2;
 
 8749        if (($this->show_summary & 4) > 0) {
 
 8765            $this->show_summary = $this->show_summary | 4;
 
 8769                $this->show_summary = $this->show_summary ^ 4;
 
 8782        if (($this->show_summary & 8) > 0) {
 
 8798            $this->show_summary = $this->show_summary | 8;
 
 8802                $this->show_summary = $this->show_summary ^ 8;
 
 8815        return ($this->results_presentation) ? $this->results_presentation : 0;
 
 8826        if (($this->results_presentation & 1) > 0) {
 
 8841        if (($this->results_presentation & 2) > 0) {
 
 8856        if (($this->results_presentation & 4) > 0) {
 
 8871        if (($this->results_presentation & 8) > 0) {
 
 8886        if (($this->results_presentation & 16) > 0) {
 
 8901        if (($this->results_presentation & 32) > 0) {
 
 8914        if (($this->results_presentation & 64) > 0) {
 
 8927        if (($this->results_presentation & 128) > 0) {
 
 8942        $this->results_presentation = $a_results_presentation;
 
 8956            $this->results_presentation = $this->results_presentation | 1;
 
 8959                $this->results_presentation = $this->results_presentation ^ 1;
 
 8973            $this->results_presentation = $this->results_presentation | 2;
 
 8976                $this->results_presentation = $this->results_presentation ^ 2;
 
 9001            $this->results_presentation = $this->results_presentation | 4;
 
 9004                $this->results_presentation = $this->results_presentation ^ 4;
 
 9018            $this->results_presentation = $this->results_presentation | 8;
 
 9021                $this->results_presentation = $this->results_presentation ^ 8;
 
 9035            $this->results_presentation = $this->results_presentation | 16;
 
 9038                $this->results_presentation = $this->results_presentation ^ 16;
 
 9052            $this->results_presentation = $this->results_presentation | 32;
 
 9055                $this->results_presentation = $this->results_presentation ^ 32;
 
 9069            $this->results_presentation = $this->results_presentation | 64;
 
 9072                $this->results_presentation = $this->results_presentation ^ 64;
 
 9084        if ($a_comparison) {
 
 9085            $this->results_presentation = $this->results_presentation | 128;
 
 9088                $this->results_presentation = $this->results_presentation ^ 128;
 
 9101            "SELECT user_fi FROM tst_active WHERE active_id = %s",
 
 9107            return $row[
"user_fi"];
 
 9131        return ($this->allowedUsers) ? $this->allowedUsers : 0;
 
 9136        $this->allowedUsers = $a_allowed_users;
 
 9141        return ($this->allowedUsersTimeGap) ? $this->allowedUsersTimeGap : 0;
 
 9146        $this->allowedUsersTimeGap = $a_allowed_users_time_gap;
 
 9156        if (($nr_of_users > 0) && ($time_gap > 0)) {
 
 9158            $time_border = $now - $time_gap;
 
 9159            $str_time_border = strftime(
"%Y%m%d%H%M%S", $time_border);
 
 9161                                SELECT DISTINCT tst_times.active_fi 
 9163                                INNER JOIN tst_active 
 9164                                ON tst_times.active_fi = tst_active.active_id 
 9166                                        tst_times.pass > tst_active.last_finished_pass OR tst_active.last_finished_pass IS NULL 
 9168                                WHERE tst_times.tstamp > %s 
 9169                                AND tst_active.test_fi = %s 
 9172            if (
$result->numRows() >= $nr_of_users) {
 
 9173                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 9191            "SELECT finished FROM tst_times WHERE active_fi = %s ORDER BY finished DESC",
 
 9197            return $row[
"finished"];
 
 9207            SELECT MAX(tst_times.tstamp) as last_pass_access 
 9209            WHERE active_fi = %s 
 9215            array(
'integer', 
'integer'),
 
 9216            array($activeId, $passIndex)
 
 9219        while ($row = 
$DIC->database()->fetchAssoc(
$res)) {
 
 9220            return $row[
'last_pass_access'];
 
 9235        if (preg_match(
"/<[^>]*?>/", $a_text)) {
 
 9252        for (
$i = 0; 
$i < $a_material->getMaterialCount(); 
$i++) {
 
 9253            $material = $a_material->getMaterial(
$i);
 
 9254            if (strcmp($material[
"type"], 
"mattext") == 0) {
 
 9255                $result .= $material[
"material"]->getContent();
 
 9257            if (strcmp($material[
"type"], 
"matimage") == 0) {
 
 9258                $matimage = $material[
"material"];
 
 9259                if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches)) {
 
 9261                    if (!is_array(
$_SESSION[
"import_mob_xhtml"])) {
 
 9262                        $_SESSION[
"import_mob_xhtml"] = array();
 
 9264                    array_push(
$_SESSION[
"import_mob_xhtml"], array(
"mob" => $matimage->getLabel(), 
"uri" => $matimage->getUri()));
 
 9269        $ilLog = 
$DIC[
'ilLog'];
 
 9270        $ilLog->write(print_r(
$_SESSION[
"import_mob_xhtml"], 
true));
 
 9284        include_once 
"./Services/RTE/classes/class.ilRTE.php";
 
 9285        include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 9287        $a_xml_writer->xmlStartTag(
"material");
 
 9290            "texttype" => 
"text/plain" 
 9292        if ($this->
isHTML($a_material)) {
 
 9293            $attrs[
"texttype"] = 
"text/xhtml";
 
 9297        $a_xml_writer->xmlElement(
"mattext", $attrs, 
$txt);
 
 9300        foreach (
$mobs as $mob) {
 
 9301            $moblabel = 
"il_" . 
IL_INST_ID . 
"_mob_" . $mob;
 
 9302            if (strpos($a_material, 
"mm_$mob") !== 
false) {
 
 9306                        "label" => $moblabel,
 
 9307                        "uri" => 
"objects/" . 
"il_" . 
IL_INST_ID . 
"_mob_" . $mob . 
"/" . $mob_obj->getTitle()
 
 9310                $a_xml_writer->xmlElement(
"matimage", $imgattrs, 
null);
 
 9313        $a_xml_writer->xmlEndTag(
"material");
 
 9324        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 9339        $affectedRows = 
$ilDB->manipulateF(
 
 9340            "UPDATE tst_tests SET certificate_visibility = %s, tstamp = %s WHERE test_id = %s",
 
 9341            array(
'text', 
'integer', 
'integer'),
 
 9342            array($a_value, time(), $this->
getTestId())
 
 9354        return (strlen($this->certificate_visibility)) ? $this->certificate_visibility : 0;
 
 9365        $this->certificate_visibility = $a_value;
 
 9376        return ($this->anonymity) ? 1 : 0;
 
 9389                $this->anonymity = 1;
 
 9392                $this->anonymity = 0;
 
 9405        return ($this->show_cancel) ? 1 : 0;
 
 9418                $this->show_cancel = 1;
 
 9421                $this->show_cancel = 0;
 
 9434        return ($this->show_marker) ? 1 : 0;
 
 9447                $this->show_marker = 1;
 
 9450                $this->show_marker = 0;
 
 9463        return ($this->fixed_participants) ? 1 : 0;
 
 9476                $this->fixed_participants = 1;
 
 9479                $this->fixed_participants = 0;
 
 9497            "SELECT anonymity FROM tst_tests WHERE obj_fi = %s",
 
 9502            return $row[
'anonymity'];
 
 9519                        SELECT          tst_tests.question_set_type 
 9521                        INNER JOIN      tst_tests 
 9522                        ON                      tst_active.test_fi = tst_tests.test_id 
 9523                        WHERE           tst_active.active_id = %s 
 9528        while ($row = 
$ilDB->fetchAssoc(
$res)) {
 
 9529            return $row[
'question_set_type'];
 
 9545        throw new Exception(__METHOD__ . 
' is deprecated ... use ilObjTest::lookupQuestionSetTypeByActiveId() instead!');
 
 9551            "SELECT tst_tests.random_test FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_active.test_fi = tst_tests.test_id",
 
 9556            return $row[
'random_test'];
 
 9571    public function userLookupFullName($user_id, $overwrite_anonymity = 
false, $sorted_order = 
false, $suffix = 
"")
 
 9574            return $this->lng->txt(
"anonymous") . $suffix;
 
 9576            include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 9578            if (strlen($uname[
"firstname"] . $uname[
"lastname"]) == 0) {
 
 9579                $uname[
"firstname"] = $this->lng->txt(
"deleted_user");
 
 9581            if ($sorted_order) {
 
 9582                return trim($uname[
"lastname"] . 
", " . $uname[
"firstname"]) . $suffix;
 
 9584                return trim($uname[
"firstname"] . 
" " . $uname[
"lastname"]) . $suffix;
 
 9599            return $this->lng->txt(
"tst_start_test");
 
 9604            if ($active_pass == 0) {
 
 9605                return $this->lng->txt(
"tst_start_test");
 
 9607                return $this->lng->txt(
"tst_start_new_test_pass");
 
 9610            return $this->lng->txt(
"tst_resume_test");
 
 9619    public function getAvailableDefaults()
 
 9630            "SELECT * FROM tst_test_defaults WHERE user_fi = %s ORDER BY name ASC",
 
 9634        $defaults = array();
 
 9636            $defaults[$row[
"test_defaults_id"]] = $row;
 
 9659            "SELECT * FROM tst_test_defaults WHERE test_defaults_id = %s",
 
 9661            array($test_defaults_id)
 
 9663        if (
$result->numRows() == 1) {
 
 9681        $affectedRows = 
$ilDB->manipulateF(
 
 9682            "DELETE FROM tst_test_defaults WHERE test_defaults_id = %s",
 
 9684            array($test_default_id)
 
 9699        $testsettings = array(
 
 9794        $next_id = 
$ilDB->nextId(
'tst_test_defaults');
 
 9796            'tst_test_defaults',
 
 9798                'test_defaults_id' => array(
'integer', $next_id),
 
 9799                'name' => array(
'text', $a_name),
 
 9800                'user_fi' => array(
'integer', 
$ilUser->getId()),
 
 9801                'defaults' => array(
'clob', serialize($testsettings)),
 
 9802                'marks' => array(
'clob', serialize($this->mark_schema)),
 
 9803                'tstamp' => array(
'integer', time())
 
 9817        $testsettings = unserialize($test_defaults[
"defaults"]);
 
 9818        include_once 
"./Modules/Test/classes/class.assMarkSchema.php";
 
 9819        $this->mark_schema = unserialize($test_defaults[
"marks"]);
 
 9854        $this->
setKiosk($testsettings[
"Kiosk"]);
 
 9858        $this->
setECTSFX($testsettings[
"ECTSFX"]);
 
 9860        if (isset($testsettings[
"isRandomTest"])) {
 
 9861            if ($testsettings[
"isRandomTest"]) {
 
 9866        } elseif (isset($testsettings[
"questionSetType"])) {
 
 9888        if (isset($testsettings[
'examid_in_kiosk'])) {
 
 9893        if (isset($testsettings[
'show_exam_id'])) {
 
 9947        if (extension_loaded(
"tidy")) {
 
 9950                "output-xml" => 
true,
 
 9951                "numeric-entities" => 
true 
 9954            $tidy->parseString($print_output, 
$config, 
'utf8');
 
 9955            $tidy->cleanRepair();
 
 9956            $print_output = tidy_get_output($tidy);
 
 9957            $print_output = preg_replace(
"/^.*?(<html)/", 
"\\1", $print_output);
 
 9959            $print_output = str_replace(
" ", 
" ", $print_output);
 
 9960            $print_output = str_replace(
"⊗", 
"X", $print_output);
 
 9962        $xsl = file_get_contents(
"./Modules/Test/xml/question2fo.xsl");
 
 9967            'font-family="Helvetica, unifont"',
 
 9968            'font-family="' . 
$DIC[
'ilSetting']->
get(
'rpc_pdf_font', 
'Helvetica, unifont') . 
'"',
 
 9972        $args = array( 
'/_xml' => $print_output, 
'/_xsl' => $xsl );
 
 9975        $output = xslt_process($xh, 
"arg:/_xml", 
"arg:/_xsl", 
null, $args, $params);
 
 9989        $content = preg_replace(
"/href=\".*?\"/", 
"", $content);
 
 9990        $printbody = 
new ilTemplate(
"tpl.il_as_tst_print_body.html", 
true, 
true, 
"Modules/Test");
 
 9992        $printbody->setVariable(
"ADM_CONTENT", $content);
 
 9993        $printbody->setCurrentBlock(
"css_file");
 
 9995        $printbody->parseCurrentBlock();
 
 9996        $printoutput = $printbody->get();
 
 9997        $html = str_replace(
"href=\"./", 
"href=\"" . ILIAS_HTTP_PATH . 
"/", $printoutput);
 
 9998        $html = preg_replace(
"/<div id=\"dontprint\">.*?<\\/div>/ims", 
"", $html);
 
 9999        if (extension_loaded(
"tidy")) {
 
10002                "output-xml" => 
true,
 
10003                "numeric-entities" => 
true 
10005            $tidy = 
new tidy();
 
10006            $tidy->parseString($html, 
$config, 
'utf8');
 
10007            $tidy->cleanRepair();
 
10008            $html = tidy_get_output($tidy);
 
10009            $html = preg_replace(
"/^.*?(<html)/", 
"\\1", $html);
 
10011            $html = str_replace(
" ", 
" ", $html);
 
10012            $html = str_replace(
"⊗", 
"X", $html);
 
10014        $html = preg_replace(
"/src=\".\\//ims", 
"src=\"" . ILIAS_HTTP_PATH . 
"/", $html);
 
10027        $ilLog = 
$DIC[
'ilLog'];
 
10029        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
10031        $fp = fopen($fo_file, 
"w");
 
10035        include_once 
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
 
10041        } 
catch (Exception 
$e) {
 
10042            $ilLog->write(__METHOD__ . 
': ' . 
$e->getMessage());
 
10062            $feedback = $row[
'feedback'];
 
10084            "SELECT * FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
10085            array(
'integer', 
'integer', 
'integer'),
 
10086            array($active_id, $question_id, 
$pass)
 
10089        if (
$result->numRows() === 1) {
 
10093            $DIC->logger()->root()->warning(
"WARNING: Multiple feedback entries on tst_manual_fb for " .
 
10094                "active_fi = $active_id , question_fi = $question_id and pass = $pass");
 
10112        $feedback = array();
 
10114            "SELECT * FROM tst_manual_fb WHERE question_fi = %s",
 
10116            array($question_id)
 
10120            $active = $row[
'active_fi'];
 
10121            $pass = $row[
'pass'];
 
10122            $question = $row[
'question_fi'];
 
10126            $feedback[$active][
$pass][$question] = $row;
 
10149        $finalized_record = (int) $feedback_old[
'finalized_evaluation'];
 
10150        if ($finalized_record === 0 || ($is_single_feedback && $finalized_record === 1)) {
 
10151            $DIC->database()->manipulateF(
 
10152                "DELETE FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
10153                array(
'integer', 
'integer', 
'integer'),
 
10154                array($active_id, $question_id, 
$pass)
 
10183        $next_id = 
$ilDB->nextId(
'tst_manual_fb');
 
10185        $finalized_time = time();
 
10187        $update_default = [
 
10188            'manual_feedback_id' => [ 
'integer', $next_id],
 
10189            'active_fi' => [ 
'integer', $active_id],
 
10190            'question_fi' => [ 
'integer', $question_id],
 
10191            'pass' => [ 
'integer', 
$pass],
 
10193            'tstamp' => [ 
'integer', time()]
 
10196        if ($feedback_old[
'finalized_evaluation'] == 1) {
 
10197            $user = $feedback_old[
'finalized_by_usr_id'];
 
10198            $finalized_time = $feedback_old[
'finalized_tstamp'];
 
10201        if ($finalized === 
false) {
 
10202            $update_default[
'finalized_evaluation'] = [
'integer', 0];
 
10203            $update_default[
'finalized_by_usr_id'] = [
'integer', 0];
 
10204            $update_default[
'finalized_tstamp'] = [
'integer', 0];
 
10205        } elseif ($finalized === 
true) {
 
10206            $update_default[
'finalized_evaluation'] = [
'integer', 1];
 
10207            $update_default[
'finalized_by_usr_id'] = [
'integer', $user];
 
10208            $update_default[
'finalized_tstamp'] = [
'integer', $finalized_time];
 
10211        $ilDB->insert(
'tst_manual_fb', $update_default);
 
10261        include_once 
"./Modules/Test/classes/class.ilTestSequence.php";
 
10272        $this->test_id = $a_id;
 
10286        if (count($participants)) {
 
10287            foreach ($participants as $active_id => $user_rec) {
 
10289                $reached_points = 0;
 
10291                foreach ($this->questions as $value) {
 
10293                    if (is_object($question)) {
 
10294                        $max_points += $question->getMaximumPoints();
 
10295                        $reached_points += $question->getReachedPoints($active_id);
 
10296                        if ($max_points > 0) {
 
10297                            $percentvalue = $reached_points / $max_points;
 
10298                            if ($percentvalue < 0) {
 
10299                                $percentvalue = 0.0;
 
10305                            $user_rec[
'firstname'] = 
"";
 
10306                            $user_rec[
'lastname'] = $this->lng->txt(
"anonymous");
 
10309                            "user_id" => $user_rec[
'usr_id'],
 
10310                            "matriculation" => $user_rec[
'matriculation'],
 
10311                            "lastname" => $user_rec[
'lastname'],
 
10312                            "firstname" => $user_rec[
'firstname'],
 
10313                            "login" => $user_rec[
'login'],
 
10314                            "question_id" => $question->getId(),
 
10315                            "question_title" => $question->getTitle(),
 
10316                            "reached_points" => $reached_points,
 
10317                            "max_points" => $max_points,
 
10318                            "passed" => $user_rec[
'passed'] ? 
'1' : 
'0',
 
10337            "SELECT t.obj_fi obj_id FROM tst_test_question q, tst_tests t WHERE q.test_fi = t.test_id AND q.question_fi = %s",
 
10342        return $rec[
"obj_id"];
 
10354        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
10355        if ($ilPluginAdmin->isActive(
IL_COMP_MODULE, 
"TestQuestionPool", 
"qst", $a_pname)) {
 
10368            "SELECT passed FROM tst_result_cache WHERE active_fi = %s",
 
10374            return $row[
'passed'];
 
10377            $result_array = &$this->
getTestResult($active_id, $counted_pass);
 
10378            return $result_array[
"test"][
"passed"];
 
10390            $isComplete = 
false;
 
10393                $userCertificateRepository->fetchActiveCertificate($user_id, $this->
getId());
 
10394                $isComplete = 
true;
 
10430    public function getParticipantsForTestAndQuestion(
$test_id, $question_id)
 
10437                        SELECT tst_test_result.active_fi, tst_test_result.question_fi, tst_test_result.pass 
10438                        FROM tst_test_result 
10439                        INNER JOIN tst_active ON tst_active.active_id = tst_test_result.active_fi AND tst_active.test_fi = %s 
10440                        INNER JOIN qpl_questions ON qpl_questions.question_id = tst_test_result.question_fi 
10441                        LEFT JOIN usr_data ON usr_data.usr_id = tst_active.user_fi 
10442                        WHERE tst_test_result.question_fi = %s 
10443                        ORDER BY usr_data.lastname ASC, usr_data.firstname ASC 
10448            array(
'integer', 
'integer'),
 
10451        $foundusers = array();
 
10458            if (!array_key_exists($row[
"active_fi"], $foundusers)) {
 
10459                $foundusers[$row[
"active_fi"]] = array();
 
10461            array_push($foundusers[$row[
"active_fi"]], array(
"pass" => $row[
"pass"], 
"qid" => $row[
"question_fi"]));
 
10463        return $foundusers;
 
10474        $foundParticipants = &
$data->getParticipants();
 
10475        $results = array(
"overview" => array(), 
"questions" => array());
 
10476        if (count($foundParticipants)) {
 
10477            $results[
"overview"][$this->lng->txt(
"tst_eval_total_persons")] = count($foundParticipants);
 
10478            $total_finished = 
$data->getTotalFinishedParticipants();
 
10479            $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished")] = $total_finished;
 
10481            $diff_seconds = $average_time;
 
10482            $diff_hours = floor($diff_seconds / 3600);
 
10483            $diff_seconds -= $diff_hours * 3600;
 
10484            $diff_minutes = floor($diff_seconds / 60);
 
10485            $diff_seconds -= $diff_minutes * 60;
 
10486            $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
 
10488            $total_passed_reached = 0;
 
10489            $total_passed_max = 0;
 
10490            $total_passed_time = 0;
 
10491            foreach ($foundParticipants as $userdata) {
 
10492                if ($userdata->getPassed()) {
 
10494                    $total_passed_reached += $userdata->getReached();
 
10495                    $total_passed_max += $userdata->getMaxpoints();
 
10496                    $total_passed_time += $userdata->getTimeOfWork();
 
10499            $average_passed_reached = $total_passed ? $total_passed_reached / $total_passed : 0;
 
10500            $average_passed_max = $total_passed ? $total_passed_max / $total_passed : 0;
 
10501            $average_passed_time = $total_passed ? $total_passed_time / $total_passed : 0;
 
10502            $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed")] = $total_passed;
 
10503            $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed_average_points")] = sprintf(
"%2.2f", $average_passed_reached) . 
" " . strtolower($this->lng->txt(
"of")) . 
" " . sprintf(
"%2.2f", $average_passed_max);
 
10504            $average_time = $average_passed_time;
 
10505            $diff_seconds = $average_time;
 
10506            $diff_hours = floor($diff_seconds / 3600);
 
10507            $diff_seconds -= $diff_hours * 3600;
 
10508            $diff_minutes = floor($diff_seconds / 60);
 
10509            $diff_seconds -= $diff_minutes * 60;
 
10510            $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
 
10513        foreach (
$data->getQuestionTitles() as $question_id => $question_title) {
 
10517            foreach ($foundParticipants as $userdata) {
 
10518                for (
$i = 0; 
$i <= $userdata->getLastPass(); 
$i++) {
 
10519                    if (is_object($userdata->getPass(
$i))) {
 
10520                        $question = &$userdata->getPass(
$i)->getAnsweredQuestionByQuestionId($question_id);
 
10521                        if (is_array($question)) {
 
10523                            $reached += $question[
"reached"];
 
10524                            $max += $question[
"points"];
 
10529            $percent = $max ? $reached / $max * 100.0 : 0;
 
10530            $results[
"questions"][$question_id] = array(
 
10532                sprintf(
"%.2f", $answered ? $reached / $answered : 0) . 
" " . strtolower($this->lng->txt(
"of")) . 
" " . sprintf(
"%.2f", $answered ? $max / $answered : 0),
 
10533                sprintf(
"%.2f", $percent) . 
"%",
 
10535                sprintf(
"%.2f", $answered ? $reached / $answered : 0),
 
10536                sprintf(
"%.2f", $answered ? $max / $answered : 0),
 
10548        require_once 
'Modules/Test/classes/class.ilTestExportFactory.php';
 
10550        $test_exp = $expFactory->getExporter(
'xml');
 
10551        return $test_exp->buildExportFile();
 
10569        $this->mailnotification = $a_notification;
 
10574        include_once 
"./Modules/Test/classes/class.ilTestMailNotification.php";
 
10579        $mail->sendSimpleNotification($owner_id, $this->
getTitle(), $usr_data);
 
10589        include_once 
"./Modules/Test/classes/class.ilObjTestGUI.php";
 
10590        include_once 
"./Modules/Test/classes/tables/class.ilEvaluationAllTableGUI.php";
 
10592        return $table_gui->getSelectedColumns();
 
10597        include_once 
"./Modules/Test/classes/class.ilTestMailNotification.php";
 
10606        require_once 
'Modules/Test/classes/class.ilTestExportFactory.php';
 
10608        $exportObj = $expFactory->getExporter(
'results');
 
10609        $exportObj->setForcedAccessFilteredParticipantList($participantList);
 
10610        $file = $exportObj->exportToExcel($deliver = 
false, 
'active_id', $active_id, $passedonly = 
false);
 
10611        include_once 
"./Services/Mail/classes/class.ilFileDataMail.php";
 
10613        $fd->copyAttachmentFile($file, 
"result_" . $active_id . 
".xls");
 
10614        $file_names[] = 
"result_" . $active_id . 
".xls";
 
10616        $mail->sendAdvancedNotification($owner_id, $this->
getTitle(), $usr_data, $file_names);
 
10618        if (count($file_names)) {
 
10619            $fd->unlinkFiles($file_names);
 
10632                        FROM            tst_result_cache 
10633                        WHERE           active_fi = %s 
10646            include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
10652                                FROM            tst_result_cache 
10653                                WHERE           active_fi = %s 
10670        if ($this->mailnottype == 1) {
 
10679        if ($a_type == 1) {
 
10680            $this->mailnottype = 1;
 
10682            $this->mailnottype = 0;
 
10688        if ($this->exportsettings) {
 
10698            $this->exportsettings = $a_settings;
 
10700            $this->exportsettings = 0;
 
10706        if (($this->exportsettings & 1) > 0) {
 
10716            $this->exportsettings = $this->exportsettings | 1;
 
10719                $this->exportsettings = $this->exportsettings ^ 1;
 
10726        return $this->enabled_view_mode;
 
10731        $this->enabled_view_mode = $mode;
 
10746        $new_array = array();
 
10749        $query = 
'SELECT question_fi  FROM tst_test_question WHERE test_fi = %s';
 
10750        $types = array(
'integer');
 
10753        $new_question_id += 1;
 
10759        while ($row = 
$ilDB->fetchAssoc(
$res)) {
 
10760            $qid = $row[
'question_fi'];
 
10762            if ($qid == $new_question_id) {
 
10764            } elseif ($qid == $previous_question_id) {
 
10765                $new_array[$position++] = $qid;
 
10766                $new_array[$position++] = $new_question_id;
 
10769                $new_array[$position++] = $qid;
 
10773        $update_query = 
'UPDATE tst_test_question SET sequence = %s WHERE test_fi = %s AND question_fi = %s';
 
10774        $update_types = array(
'integer', 
'integer', 
'integer');
 
10776        foreach ($new_array as $position => $qid) {
 
10777            $ilDB->manipulateF(
 
10802            $values[] = 
'instant_feedback_specific';
 
10805            $values[] = 
'instant_feedback_generic';
 
10808            $values[] = 
'instant_feedback_points';
 
10811            $values[] = 
'instant_feedback_solution';
 
10819        if (is_array($options)) {
 
10835                'pass_details' => 
'setShowPassDetails',
 
10836                'solution_details' => 
'setShowSolutionDetails',
 
10837                'solution_printview' => 
'setShowSolutionPrintview',
 
10838                'solution_feedback' => 
'setShowSolutionFeedback',
 
10839                'solution_answers_only' => 
'setShowSolutionAnswersOnly',
 
10840                'solution_signature' => 
'setShowSolutionSignature',
 
10841                'solution_suggested' => 
'setShowSolutionSuggested',
 
10843        foreach ($setter as $key => $setter) {
 
10844            if (in_array($key, $options)) {
 
10859        $this->poolUsage = (boolean) $usage;
 
10870        $pluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
10872        require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
10874        $questionSetConfig = $qscFactory->getQuestionSetConfig();
 
10877        $reindexedSequencePositionMap = $questionSetConfig->reindexQuestionOrdering();
 
10881        return $reindexedSequencePositionMap;
 
10893        foreach ($orders as 
$id => $position) {
 
10897                isset($obligations[
$id]) && $obligations[
$id] ? 1 : 0
 
10901                                UPDATE          tst_test_question 
10904                                WHERE           question_fi = %s 
10907            $ilDB->manipulateF(
 
10909                array(
'integer', 
'integer', 
'integer'),
 
10910                array(
$i, $obligatory, 
$id)
 
10922        if ($question_before) {
 
10923            $query = 
'SELECT sequence, test_fi FROM tst_test_question WHERE question_fi = %s';
 
10924            $types = array(
'integer');
 
10925            $values = array($question_before);
 
10929        if (!$question_before || ($rset && !($row = 
$ilDB->fetchAssoc($rset)))) {
 
10936        $update = 
'UPDATE tst_test_question SET sequence = sequence + 1 WHERE sequence > %s AND test_fi = %s';
 
10937        $types = array(
'integer', 
'integer');
 
10938        $values = array($row[
'sequence'], $row[
'test_fi']);
 
10939        $ilDB->manipulateF($update, $types, $values);
 
10941        $update = 
'UPDATE tst_test_question SET sequence = %s WHERE question_fi = %s';
 
10942        $types = array(
'integer', 
'integer');
 
10943        $values = array($row[
'sequence'] + 1, $question_to_move);
 
10944        $ilDB->manipulateF($update, $types, $values);
 
10956        $IN_questions = 
$ilDB->in(
'q1.question_id', array_keys(
$questions), 
false, 
'integer');
 
10959                        SELECT          count(q1.question_id) cnt 
10961                        FROM            qpl_questions q1 
10963                        INNER JOIN      qpl_questions q2 
10964                        ON                      q2.question_id = q1.original_id 
10966                        WHERE           $IN_questions 
10967                        AND                     q1.obj_fi = q2.obj_fi 
10972        $row = 
$ilDB->fetchAssoc($rset);
 
10974        return $row[
'cnt'] > 0;
 
10989            "SELECT test_fi,MAX(pass) AS pass FROM tst_active" .
 
10990            " JOIN tst_pass_result ON (tst_pass_result.active_fi = tst_active.active_id)" .
 
10991            " WHERE user_fi=%s" .
 
10992            " GROUP BY test_fi",
 
10993            array(
'integer', 
'integer'),
 
10994            array($a_user_id, 1)
 
10999            $all[$obj_id] = (bool) $row[
"pass"];
 
11010        return $this->online;
 
11015        $this->online = (bool) $a_online;
 
11036        $this->print_best_solution_with_result = (bool) $status;
 
11066        $this->activation_visibility = (bool) $a_value;
 
11076        return (
bool) $this->activation_limited;
 
11081        $this->activation_limited = (bool) $a_value;
 
11093        $this->_highscore_enabled = (bool) $a_enabled;
 
11103        return (
bool) $this->_highscore_enabled;
 
11115        $this->_highscore_anon = (bool) $a_anon;
 
11129        return (
bool) $this->_highscore_anon;
 
11156        $this->_highscore_achieved_ts = (bool) $a_achieved_ts;
 
11166        return (
bool) $this->_highscore_achieved_ts;
 
11176        $this->_highscore_score = (bool) $a_score;
 
11186        return (
bool) $this->_highscore_score;
 
11196        $this->_highscore_percentage = (bool) $a_percentage;
 
11206        return (
bool) $this->_highscore_percentage;
 
11216        $this->_highscore_hints = (bool) $a_hints;
 
11226        return (
bool) $this->_highscore_hints;
 
11236        $this->_highscore_wtime = (bool) $a_wtime;
 
11246        return (
bool) $this->_highscore_wtime;
 
11256        $this->_highscore_own_table = (bool) $a_own_table;
 
11266        return (
bool) $this->_highscore_own_table;
 
11276        $this->_highscore_top_table = (bool) $a_top_table;
 
11286        return (
bool) $this->_highscore_top_table;
 
11297        $this->_highscore_top_num = (int) $a_top_num;
 
11310        $retval = $a_retval;
 
11311        if ((
int) $this->_highscore_top_num != 0) {
 
11312            $retval = $this->_highscore_top_num;
 
11366        switch ($specific_answer_feedback) {
 
11368                $this->specific_answer_feedback = 1;
 
11371                $this->specific_answer_feedback = 0;
 
11378        switch ($this->specific_answer_feedback) {
 
11414        require_once(
'Modules/TestQuestionPool/classes/class.assQuestion.php');
 
11422        $obligationPossible = call_user_func(array($classConcreteQuestion, 
'isObligationPossible'), $questionId);
 
11424        return $obligationPossible;
 
11438        $rset = 
$ilDB->queryF(
'SELECT obligatory FROM tst_test_question WHERE question_fi = %s', array(
'integer'), array($question_id));
 
11440        if ($row = 
$ilDB->fetchAssoc($rset)) {
 
11441            return (
bool) $row[
'obligatory'];
 
11464        $rset = 
$ilDB->queryF(
 
11465            'SELECT obligations_answered FROM tst_pass_result WHERE active_fi = %s AND pass = %s',
 
11466            array(
'integer', 
'integer'),
 
11467            array($active_id, 
$pass)
 
11470        if ($row = 
$ilDB->fetchAssoc($rset)) {
 
11471            return (
bool) $row[
'obligations_answered'];
 
11490        $rset = 
$ilDB->queryF(
 
11491            'SELECT count(*) cnt FROM tst_test_question WHERE test_fi = %s AND obligatory = 1',
 
11496        $row = 
$ilDB->fetchAssoc($rset);
 
11498        return (
bool) $row[
'cnt'] > 0;
 
11541    #region Examview / PDF Examview 
11604        return (strlen($this->activation_starting_time)) ? $this->activation_starting_time : 
null;
 
11609        return (strlen($this->activation_ending_time)) ? $this->activation_ending_time : 
null;
 
11625            "SELECT tst_times.active_fi, tst_times.started FROM tst_times, tst_active WHERE tst_times.active_fi = tst_active.active_id AND tst_active.test_fi = %s ORDER BY tst_times.tstamp DESC",
 
11630            $times[$row[
'active_fi']] = $row[
'started'];
 
11642            "SELECT tst_addtime.active_fi, tst_addtime.additionaltime FROM tst_addtime, tst_active WHERE tst_addtime.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
 
11647            $times[$row[
'active_fi']] = $row[
'additionaltime'];
 
11658            "SELECT additionaltime FROM tst_addtime WHERE active_fi = %s",
 
11662        if (
$result->numRows() > 0) {
 
11664            return $row[
'additionaltime'];
 
11673        require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
11676        $participantData->setParticipantAccessFilter(
 
11681            $participantData->setActiveIdsFilter(array($active_id));
 
11684        $participantData->load($this->
getTestId());
 
11686        foreach ($participantData->getActiveIds() as $active_id) {
 
11688                "SELECT active_fi FROM tst_addtime WHERE active_fi = %s",
 
11693            if (
$result->numRows() > 0) {
 
11694                $DIC->database()->manipulateF(
 
11695                    "DELETE FROM tst_addtime WHERE active_fi = %s",
 
11701            $DIC->database()->manipulateF(
 
11702                "UPDATE tst_active SET tries = %s, submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
11703                array(
'integer',
'integer',
'timestamp',
'integer'),
 
11704                array(0, 0, 
null, $active_id)
 
11707            $DIC->database()->manipulateF(
 
11708                "INSERT INTO tst_addtime (active_fi, additionaltime, tstamp) VALUES (%s, %s, %s)",
 
11709                array(
'integer',
'integer',
'integer'),
 
11710                array($active_id, $minutes, time())
 
11713            require_once 
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
 
11739    public function getMaxPassOfTest()
 
11748                        SELECT MAX(tst_pass_result.pass) + 1 max_res 
11749                        FROM tst_pass_result 
11750                        INNER JOIN tst_active ON tst_active.active_id = tst_pass_result.active_fi 
11751                        WHERE test_fi = ' . 
$ilDB->quote($this->
getTestId(), 
'integer') . 
' 
11755        return (
int) 
$data[
'max_res'];
 
11768        $exam_id_query = 
'SELECT exam_id FROM tst_pass_result WHERE active_fi = %s AND pass = %s';
 
11769        $exam_id_result = 
$ilDB->queryF($exam_id_query, array( 
'integer', 
'integer' ), array( $active_id, 
$pass ));
 
11770        if (
$ilDB->numRows($exam_id_result) == 1) {
 
11771            $exam_id_row = 
$ilDB->fetchAssoc($exam_id_result);
 
11773            if ($exam_id_row[
'exam_id'] != 
null) {
 
11774                return $exam_id_row[
'exam_id'];
 
11792        $inst_id = 
$ilSetting->get(
'inst_id', 
null);
 
11794        if ($test_obj_id === 
null) {
 
11797            $obj_id = $test_obj_id;
 
11800        $examId = 
'I' . $inst_id . 
'_T' . $obj_id . 
'_A' . $active_id . 
'_P' . 
$pass;
 
11852        $this->char_selector_availability = (int) $availability;
 
11868        $this->char_selector_definition = $definition;
 
11912        $query = 
"SELECT question_set_type FROM tst_tests WHERE obj_fi = %s";
 
11918        while ($row = 
$ilDB->fetchAssoc(
$res)) {
 
11971                return $lng->txt(
'tst_question_set_type_fixed');
 
11974                return $lng->txt(
'tst_question_set_type_random');
 
11977                return $lng->txt(
'tst_question_set_type_dynamic');
 
11994        require_once 
'class.ilTestScoring.php';
 
11996        $scoring->setPreserveManualScores($preserve_manscoring);
 
11997        $scoring->recalculateSolutions();
 
12002        require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
12004        $questionChangeListeners = array(
 
12008        return $questionChangeListeners;
 
12019                        INNER JOIN tst_tests 
12020                        ON test_id = test_fi 
12028        while ($row = 
$ilDB->fetchAssoc(
$res)) {
 
12029            $objIds[] = (int) $row[
'obj_fi'];
 
12061        if (!self::isSkillManagementGloballyActivated()) {
 
12072        if (self::$isSkillManagementGloballyActivated === 
null) {
 
12075            self::$isSkillManagementGloballyActivated = $skmgSet->isActivated();
 
12143        $refinery = 
$DIC[
'refinery'];
 
12144        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
12150        $activeId = $testOBJ->getActiveIdOfUser($userId);
 
12152        require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
12155        require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
12158        $testSession = $testSessionFactory->getSession($activeId);
 
12163        if ($a_force_new_run) {
 
12178        $refinery = 
$DIC[
'refinery'];
 
12179        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
12186        $activeId = $testOBJ->getActiveIdOfUser($userId);
 
12188        require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
12191        $testSessionFactory->reset();
 
12193        require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
12196        $testSession = $testSessionFactory->getSession($activeId);
 
12219    public function adjustTestSequence()
 
12228                        SELECT COUNT(test_question_id) cnt 
12229                        FROM tst_test_question 
12236        $row = 
$ilDB->fetchAssoc($questRes);
 
12237        $questCount = $row[
'cnt'];
 
12242                                FROM tst_active tac 
12243                                INNER JOIN tst_sequence tseq 
12244                                        ON tseq.active_fi = tac.active_id 
12245                                WHERE tac.test_fi = %s 
12248            $partRes = 
$ilDB->queryF(
 
12254            while ($row = 
$ilDB->fetchAssoc($partRes)) {
 
12255                $sequence = @unserialize($row[
'sequence']);
 
12258                    $sequence = array();
 
12261                $sequence = array_filter($sequence, 
function ($value) use ($questCount) {
 
12262                    return $value <= $questCount;
 
12265                $num_seq = count($sequence);
 
12266                if ($questCount > $num_seq) {
 
12267                    $diff = $questCount - $num_seq;
 
12268                    for (
$i = 1; 
$i <= $diff; 
$i++) {
 
12269                        $sequence[$num_seq + 
$i - 1] = $num_seq + 
$i;
 
12273                $new_sequence = serialize($sequence);
 
12275                $ilDB->update(
'tst_sequence', array(
 
12276                    'sequence' => array(
'clob', $new_sequence)
 
12278                    'active_fi' => array(
'integer', $row[
'active_fi']),
 
12279                    'pass' => array(
'integer', $row[
'pass'])
 
12283            $new_sequence = serialize($questCount > 0 ? range(1, $questCount) : array());
 
12287                                FROM tst_active tac 
12288                                INNER JOIN tst_sequence tseq 
12289                                        ON tseq.active_fi = tac.active_id 
12290                                WHERE tac.test_fi = %s 
12293            $part_rest = 
$ilDB->queryF(
 
12299            while ($row = 
$ilDB->fetchAssoc($part_rest)) {
 
12300                $ilDB->update(
'tst_sequence', array(
 
12301                    'sequence' => array(
'clob', $new_sequence)
 
12303                    'active_fi' => array(
'integer', $row[
'active_fi']),
 
12304                    'pass' => array(
'integer', $row[
'pass'])
 
12322        $webdir = implode(
'/', [
 
12328        $parts = array_filter(explode(
'/', $webdir), 
function ($p) {
 
12329            return trim($p) != 
'' && trim($p) != 
'.';
 
12331        return array_shift($parts) . 
'//' . implode(
'/', $parts) . 
'/';
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
A class defining mark schemas for assessment test objects.
An exception for terminatinating execution or to throw for unit testing.
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
static getFeedbackClassNameByQuestionType($questionType)
static _getOriginalId($question_id)
Returns the original id of a question.
static sumTimesInISO8601FormatH_i_s_Extended($time1, $time2)
static _getSolutionMaxPass($question_id, $active_id)
Returns the maximum pass a users question solution.
static _updateTestResultCache($active_id, ilAssQuestionProcessLocker $processLocker=null)
@TODO Move this to a proper place.
static _getSuggestedSolutionOutput($question_id)
Returns the output of the suggested solution.
static getGuiClassNameByQuestionType($questionType)
static _isWorkedThrough($active_id, $question_id, $pass=null)
Returns true if the question was worked through in the given pass Worked through means that the user ...
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
static _getQuestionTitle($question_id)
Returns the question title of a question with a given id.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static deleteRequestsByActiveIds($activeIds)
Deletes all hint requests relating to a testactive included in given active ids.
static completeMissingPluginName($questionTypeData)
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
TableGUI class for evaluation of all users.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getInstanceByType(string $type)
Factory method for creating purifier instances.
static deleteNewsOfContext( $a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id=0, $a_context_sub_obj_type="")
Delete all news of a context.
static getFirstNewsIdForContext( $a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id="", $a_context_sub_obj_type="")
Get first new id of news set related to a certain context.
static _addLog($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=false, $test_ref_id=null)
Add an assessment log entry.
static _getLogLanguage()
retrieve the log language for assessment logging
static _getManualScoring()
Retrieve the manual scoring settings.
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
static _getAvailableQuestionpools($use_object_id=false, $equal_points=false, $could_be_offline=false, $showPath=false, $with_questioncount=false, $permission="read", $usr_id="")
Returns the available question pools for the active user.
static _getParticipantData($active_id)
Retrieves a participant name from active id.
static _isPassed($user_id, $a_obj_id)
Returns TRUE if the user with the user id $user_id passed the test with the object id $a_obj_id.
static getPoolQuestionChangeListener(ilDBInterface $db, $poolObjId)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getECTSGrade($points_passed, $reached_points, $max_points, $a, $b, $c, $d, $e, $fx)
{Returns the ECTS grade for a number of reached points.string The ECTS grade short description}
setHighscorePercentage($a_percentage)
Sets if the percentages of the scores pass should be shown.
getResetProcessingTime()
Returns wheather the processing time should be reset or not.
_buildName($is_anonymous, $user_id, $firstname, $lastname, $title)
Builds a user name for the output depending on test type and existence of the user.
getActivationEndingTime()
static _getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
setPrintBestSolutionWithResult($status)
setAnswerFeedback($answer_feedback=0)
Sets the generic feedback for the test @deprecate Use setGenericAnswerFeedback instead.
__construct($a_id=0, $a_call_by_reference=true)
Constructor.
setIntroduction($introduction="")
Sets the introduction text of the ilObjTest object.
exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog)
export page objects to xml (see ilias_co.dtd)
static _getObjectIDFromActiveID($active_id)
Returns the ILIAS test object id for a given active id.
getProcessingTimeAsMinutes()
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
getEstimatedWorkingTime()
Returns the estimated working time for the test calculated from the working time of the contained que...
setShowInfo($a_info=1)
Set whether the complete information page is shown or the required data only.
const QUESTION_SET_TYPE_DYNAMIC
type setting value for dynamic question set (continues testing mode)
getTestId()
Gets the database id of the additional test data.
getECTSOutput()
{int|bool}
& createQuestionGUI($question_type, $question_id=-1)
Creates a question GUI instance of a given question type.
$followupQuestionAnswerFixationEnabled
endingTimeReached()
Returns true if the ending time of a test is reached An ending time is not available for self assessm...
setClientIP($user_id, $client_ip)
setAllowedUsersTimeGap($a_allowed_users_time_gap)
getQuestionSetType()
getter for question set type
insertManualFeedback($active_id, $question_id, $pass, $feedback, $finalized, $feedback_old)
Inserts a manual feedback into the DB.
setTestId($a_id)
Sets the test ID.
getShowKioskModeParticipant()
Returns the status of the kiosk mode participant.
setKiosk($kiosk=0)
Sets the kiosk mode for the test.
getQuestionTitle($title, $nr=null)
Returns the title of a test question and checks if the title output is allowed.
canShowEctsGrades()
{boolean}
getHighscoreWTime()
Gets if the column with the workingtime should be shown.
getHighscoreOwnTable()
Gets if the own rankings table should be shown.
getAnsweredQuestionCount($active_id, $pass=null)
Retrieves the number of answered questions for a given user in a given test.
getShowKioskModeTitle()
Returns the status of the kiosk mode title.
hasRandomQuestionsForPass($active_id, $pass)
Checkes wheather a random test has already created questions for a given pass or not.
getHighscoreTopTable()
Gets, if the top-rankings table should be shown.
getCountSystem()
Gets the count system for the calculation of points.
isShowExamIdInTestPassEnabled()
setPostponingEnabled($postponingEnabled)
setInstantFeedbackSolution($instant_feedback=0)
Sets the instant feedback for the solution.
static getDataWebPath(string $relative_path='')
This is originally a fix for https://mantis.ilias.de/view.php?id=35707; in general,...
canShowSolutionPrintview($user_id=null)
Calculates if a user may see the solution printview of his/her test results.
getEnableProcessingTime()
Returns the state of the processing time (enabled/disabled)
setShowKioskModeParticipant($a_participant=false)
Set to true, if the participant's name should be shown in kiosk mode.
getListOfQuestionsStart()
Returns if the list of questions should be presented as the first page of the test.
& getExistingQuestions($pass=null)
Get the id's of the questions which are already part of the test.
getActiveParticipantList()
static _getTestIDFromObjectID($object_id)
Returns the ILIAS test id for a given object id.
loadFromDb()
Loads a ilObjTest object from a database.
pcArrayShuffle($array)
Shuffles the values of a given array.
_getTitleOutput($active_id)
Returns the value of the title_output status.
isAnyInstantFeedbackOptionEnabled()
$char_selector_availability
isComplete(ilTestQuestionSetConfig $testQuestionSetConfig)
Returns true, if a test is complete for use and can be set online.
canShowTestResults(ilTestSession $testSession)
getInstantFeedbackSolution()
Returns 1 if the correct solution will be shown after answering a question.
setFinalStatement($a_statement="")
Sets the final statement text of the ilObjTest object.
setFixedParticipants($a_value=1)
Sets the fixed participants status.
getStartingTimeOfUser($active_id, $pass=null)
Returns the unix timestamp of the time a user started a test.
_getLastAccess($active_id)
getStartTestLabel($active_id)
Returns the "Start the Test" label for the Info page.
static _getTestDefaults($test_defaults_id)
setOnline($a_online=true)
& getParticipants()
Returns all persons who started the test.
setProcessingTime($processing_time="00:00:00")
Sets the processing time for the test.
setHighscoreAnon($a_anon)
Sets if the highscores should be anonymized.
getDetailedTestResults($participants)
returns all test results for all participants
setAllowedUsers($a_allowed_users)
isNrOfTriesReached($tries)
returns if number of tries are reached
reindexFixedQuestionOrdering()
static getTestObjIdsWithActiveForUserId($userId)
setKioskMode($a_kiosk=false)
Sets the kiosk mode for the test.
setTemplate($template_id)
setShowExamviewPdf($show_examview_pdf)
setShowSolutionSignature($a_signature=false)
Set to TRUE, if the signature field should be shown in the solution.
setShowExamIdInTestPassEnabled($show_exam_id_in_test_pass_enabled)
inviteUser($user_id, $client_ip="")
Invites a user to a test.
setScoreCutting($a_score_cutting=SCORE_CUT_QUESTION)
Sets the type of score cutting.
static _getCountSystem($active_id)
Gets the count system for the calculation of points.
evalTotalStartedAverageTime($activeIdsFilter=null)
Returns the average processing time for all started tests.
setFollowupQuestionAnswerFixationEnabled($followupQuestionAnswerFixationEnabled)
getQuestionCount()
Returns the number of questions in the test.
getQuestiontext($question_id)
Returns the question text for a given question.
setResultsPresentationOptionsByArray($options)
QTIMaterialToString($a_material)
Reads an QTI material tag an creates a text string.
& getTestDefaults($test_defaults_id)
Returns the test defaults for a given id.
const QUESTION_SET_TYPE_RANDOM
type setting value for random question set
saveAuthorToMetadata($a_author="")
Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be c...
setOldOnlineStatus($oldOnlineStatus)
processPrintoutput2FO($print_output)
Convert a print output to XSL-FO.
setPassDeletionAllowed($passDeletionAllowed)
setter for the test setting passDeletionAllowed
setHighscoreScore($a_score)
Sets if the actual score should be displayed.
const HIGHSCORE_SHOW_ALL_TABLES
sendSimpleNotification($active_id)
getXMLZip()
Get zipped xml file for test.
getShowSolutionListComparison()
static lookupExamId($active_id, $pass)
createExportDirectory()
creates data directory for export files (data_dir/tst_data/tst_<id>/export, depending on data directo...
setShowGradingStatusEnabled($showGradingStatusEnabled)
static _getActiveIdOfUser($user_id="", $test_id="")
Gets the active id of the tst_active table for the active user.
isPreviousSolutionReuseEnabled($activeId)
getFixedParticipants()
Returns the fixed participants status.
isBestSolutionPrintedWithResult()
_lookupRandomTestFromActiveId($active_id)
Returns the random status of a test with a given object id.
setPassword($a_password=null)
Sets the password for test access.
setShowSolutionDetails($a_details=1)
Sets if the the solution details should be presented to the user or not.
& createTestSequence($active_id, $pass, $shuffle)
$show_exam_id_in_test_results_enabled
getFinalStatement()
Gets the final statement.
getProcessingTimeAsArray()
Returns the processing time for the test.
questionMoveDown($question_id)
Moves a question down in order.
setShowFinalStatement($show=0)
Sets whether the final statement should be shown or not.
logAction($logtext="", $question_id="")
Logs an action into the Test&Assessment log.
createMetaData()
Create meta data entry.
getEvaluationAdditionalFields()
Gets additional user fields that should be shown in the user evaluation.
setEndingTimeEnabled($ending_time_enabled)
loadQuestions($active_id="", $pass=null)
Load the test question id's from the database.
& getCompleteEvaluationData($withStatistics=true, $filterby="", $filtertext="")
setShowPassDetails($a_details=1)
Sets if the pass details should be shown when a test is not finished.
insertQuestion(ilTestQuestionSetConfig $testQuestionSetConfig, $question_id, $linkOnly=false)
Insert a question in the list of questions.
buildName($user_id, $firstname, $lastname, $title)
Builds a user name for the output depending on test type and existence of the user.
setRedirectionUrl($redirection_url=null)
hasQuestionsWithoutQuestionpool()
$print_best_solution_with_result
setCountSystem($a_count_system=COUNT_PARTIAL_SOLUTIONS)
Sets the count system for the calculation of points.
buildIso8601PeriodFromUnixtimeForExportCompatibility($unix_timestamp)
$instantFeedbackAnswerFixationEnabled
static _getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
exportFileItems($target_dir, &$expLog)
export files of file itmes
removeQuestionFromSequences($questionId, $activeIds, ilTestReindexedSequencePositionMap $reindexedSequencePositionMap)
getImagePath()
Returns the image path for web accessable images of a test The image path is under the CLIENT_WEB_DIR...
getShowSolutionSignature()
Returns if the signature field should be shown in the test results.
getHighscoreAnon()
Gets if the highscores should be anonymized per setting.
exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export media objects to xml (see ilias_co.dtd)
getPassScoring()
Gets the pass scoring type.
setInstantFeedbackAnswerFixationEnabled($instantFeedbackAnswerFixationEnabled)
setHighscoreHints($a_hints)
Sets if the number of requested hints should be shown.
getPassword()
Returns the password for test access.
isShowGradingStatusEnabled()
setPasswordEnabled($passwordEnabled)
setPassScoring($a_pass_scoring=SCORE_LAST_PASS)
Sets the pass scoring.
isHighscoreAnon()
Gets if the highscores should be displayed anonymized.
setOfferingQuestionHintsEnabled($offeringQuestionHintsEnabled)
sets offering question hints enabled/disabled
getFixedQuestionSetTotalWorkingTime()
getShowSolutionAnswersOnly()
Returns if the full solution (including ILIAS content) should be presented to the solution or not.
setShowSolutionPrintview($a_printview=1)
Sets if the the solution printview should be presented to the user or not.
& evalTotalPersonsArray($name_sort_order="asc")
Returns all persons who started the test.
& evalStatistical($active_id)
Returns the statistical evaluation of the test for a specified user.
isExecutable($testSession, $user_id, $allowPassIncrease=false)
Checks if the test is executable by the given user.
const SCORE_REPORTING_IMMIDIATLY
& getTestParticipants()
Returns a list of all participants in a test.
getStartingTime()
Returns the starting time of the test.
canEditEctsGrades()
{boolean}
startingTimeReached()
Returns true if the starting time of a test is reached A starting time is not available for self asse...
saveManualFeedback($active_id, $question_id, $pass, $feedback, $finalized=false, $is_single_feedback=false)
Saves the manual feedback for a question in a test.
setListOfQuestions($a_value=true)
Sets if the the list of questions should be presented to the user or not.
& getTotalPointsPassedArray()
Returns an array with the total points of all users who passed the test This array could be used for ...
getShowPassDetails()
Returns if the pass details should be shown when a test is not finished.
getQuestionSetTypeTranslation(ilLanguage $lng, $questionSetType)
& evalResultsOverview()
Creates an associated array with the results of all participants of a test.
getResultsPresentation()
Returns the combined results presentation value.
$show_exam_id_in_test_pass_enabled
static _lookupAuthor($obj_id)
Gets the authors name of the ilObjTest object.
saveCompleteStatus(ilTestQuestionSetConfig $testQuestionSetConfig)
Checks if the test is complete and saves the status in the database.
getKioskMode()
Returns the kiosk mode.
getSequenceSettings()
SEQUENCE SETTING = POSTPONING ENABLED !!
static allObligationsAnswered($test_id, $active_id, $pass)
checks wether all questions marked as obligatory were answered within the test pass with given testId...
getShowSolutionFeedback()
Returns if the feedback should be presented to the solution or not.
static _getPassScoring($active_id)
Gets the pass scoring type.
setHighscoreTopNum($a_top_num)
Sets the number of entries which are to be shown in the top-rankings table.
getTimeExtensionsOfParticipants()
static getSingleManualFeedback($active_id, $question_id, $pass)
Retrieves the manual feedback for a question in a test.
getActivationStartingTime()
static _getQuestionCountAndPointsForPassOfParticipant($active_id, $pass)
const QUESTION_SET_TYPE_FIXED
type setting value for fixed question set
setHighscoreEnabled($a_enabled)
Sets if the highscore feature should be enabled.
duplicateQuestionForTest($question_id)
Takes a question and creates a copy of the question for use in the test.
setRedirectionMode($redirection_mode=0)
$showGradingStatusEnabled
hasSingleChoiceQuestions()
Returns TRUE if the test contains single choice results.
setMailNotification($a_notification)
Set mail notification settings.
isActiveTestSubmitted($user_id=null)
returns if the active for user_id has been submitted
setQuestionSetType($questionSetType)
setter for question set type
setReportingDate($reporting_date)
Sets the reporting date of the ilObjTest object.
static lookupQuestionSetType($objId)
lookup-er for question set type
moveQuestionAfterOLD($previous_question_id, $new_question_id)
setCharSelectorDefinition($definition='')
getKiosk()
Returns the kiosk mode.
getResultsForActiveId($active_id)
getShowSolutionDetails()
Returns if the solution details should be presented to the user or not.
setAuthor($author="")
Sets the authors name of the ilObjTest object.
setQuestionOrderAndObligations($orders, $obligations)
isTestQuestion($questionId)
$activation_starting_time
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
getAuthor()
Gets the authors name of the ilObjTest object.
$forceInstantFeedbackEnabled
getAnswerFeedbackPoints()
Returns 1 if answer specific feedback as reached points is activated.
randomSelectQuestions($nr_of_questions, $questionpool, $use_obj_id=0, $qpls="", $pass=null)
Returns a random selection of questions.
setIntroductionEnabled($introductionEnabled)
getProcessingTimeInSeconds($active_id="")
Returns the processing time for the test in seconds.
getFixedQuestionSetTotalPoints()
static lookupLastTestPassAccess($activeId, $passIndex)
inviteGroup($group_id)
Invites all users of a group to a test.
getScoreCutting()
Determines if the score of a question should be cut at 0 points or the score of the whole test.
getShowSolutionSuggested()
read()
read object data from db into object
getHighscorePercentage()
Gets if the percentage column should be shown.
const SCORE_REPORTING_FINISHED
addDefaults($a_name)
Adds the defaults of this test to the test defaults.
setCertificateVisibility($a_value)
Sets the visibility settings of the certificate.
prepareTextareaOutput($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output in tests.
setListOfQuestionsEnd($a_value=true)
Sets if the the list of questions as the end page of the test.
getTestParticipantsForManualScoring($filter=null)
static _getMCScoring($active_id)
Gets the scoring type for multiple choice questions.
getHtmlQuestionContentPurifier()
setResetProcessingTime($reset=0)
Sets wheather the processing time should be reset or not.
const SCORE_REPORTING_AFTER_PASSED
moveQuestions($move_questions, $target_index, $insert_mode)
Move questions to another position.
static _getObjectIDFromTestID($test_id)
Returns the ILIAS test object id for a given test id.
setListOfQuestionsSettings($a_value=0)
Sets the settings for the list of questions options in the test properties This could contain one of ...
isSkillServiceToBeConsidered()
sendAdvancedNotification($active_id)
modifyExportIdentifier($a_tag, $a_param, $a_value)
Returns the installation id for a given identifier.
updateWorkingTime($times_id)
Update the working time of a test when a question is answered.
setActivationStartingTime($starting_time=null)
static isSkillManagementGloballyActivated()
getHighscoreHints()
Gets, if the column with the number of requested hints should be shown.
buildStatisticsAccessFilteredParticipantList()
getMCScoring()
Gets the scoring type for multiple choice questions.
getGenericAnswerFeedback()
Returns 1 if generic answer feedback is to be shown.
setObligationsEnabled($obligationsEnabled=true)
sets obligations enabled/disabled
setSkillServiceEnabled($skillServiceEnabled)
fromXML(ilQTIAssessment $assessment)
Receives parameters from a QTI parser and creates a valid ILIAS test object.
setHighscoreTopTable($a_top_table)
Sets if the top-rankings table should be shown.
static _setImportDirectory($a_import_dir=null)
set import directory
static _getMaxPass($active_id)
Retrieves the maximum pass of a given user for a given test in which the user answered at least one q...
isRandomTest()
Returns the fact wether this test is a random questions test or not.
getQuestionType($question_id)
Returns the question type of a question with a given id.
getShowSolutionPrintview()
Returns if the solution printview should be presented to the user or not.
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
static _getImportDirectory()
Get the import directory location of the test.
getShowInfo()
Gets whether the complete information page is shown or the required data only.
setActivationVisibility($a_value)
setQuestionSetSolved($value, $question_id, $user_id)
sets question solved state to value for given user_id
isFixedTest()
Returns the fact wether this test is a fixed question set test or not.
getMarkSchema()
{ASS_MarkSchema}
& _getCompleteWorkingTimeOfParticipants($test_id)
Returns the complete working time in seconds for all test participants.
deleteTest()
Deletes the test and all related objects, files and database entries.
deleteDefaults($test_default_id)
Deletes the defaults for a test.
getListOfQuestionsEnd()
Returns if the list of questions should be presented as the last page of the test.
getHighscoreEnabled()
Gets the setting which determines if the highscore feature is enabled.
getReportingDate()
Gets the reporting date of the ilObjTest object.
setForceJS($a_js=1)
Set whether JavaScript should be forced for tests.
isTestFinished($active_id)
returns if the active for user_id has been submitted
static _getBestPass($active_id)
Retrieves the best pass of a given user for a given test.
static _lookupRandomTest($a_obj_id)
Returns the fact wether the test with passed obj id is a random questions test or not.
const HIGHSCORE_SHOW_OWN_TABLE
setShowSolutionListComparison($a_comparison=false)
Set to TRUE, if the list of answers should be shown prior to finish the test.
getQuestionDataset($question_id)
Returns the dataset for a given question id.
getCharSelectorDefinition()
& getTestResult($active_id, $pass=null, $ordered_sequence=false, $considerHiddenQuestions=true, $considerOptionalQuestions=true)
Calculates the results of a test for a given user and returns an array with all test results.
getTitleOutput()
Returns the value of the title_output status.
getAggregatedResultsData()
Returns the aggregated test results.
isDynamicTest()
Returns the fact wether this test is a dynamic question set test or not.
setShowExamIdInTestResultsEnabled($show_exam_id_in_test_results_enabled)
checkQuestionParent($questionId)
setInstantFeedbackOptionsByArray($options)
getHighscoreAchievedTS()
Returns if date and time of the scores achievement should be displayed.
setActivationEndingTime($ending_time=null)
static getCompleteManualFeedback(int $question_id)
Retrieves the manual feedback for a question in a test.
& getQuestionTitlesAndIndexes()
Returns the titles of the test questions in question sequence.
getAllTestResults($participants, $prepareForCSV=true)
returns all test results for all participants
getListOfQuestions()
Returns if the list of questions should be presented to the user or not.
saveToDb($properties_only=false)
Saves a ilObjTest object to a database.
isMaxProcessingTimeReached($starting_time, $active_id)
Returns whether the maximum processing time for a test is reached or not.
isHTML($a_text)
Checks if a given string contains HTML or not.
moveQuestionAfter($question_to_move, $question_before)
logManualFeedback($active_id, $question_id, $feedback)
Creates a log for the manual feedback.
saveQuestionsToDb()
Saves the test questions to the database.
setShuffleQuestions($a_shuffle)
Sets the status of the shuffle_questions variable.
getUsePreviousAnswers()
Returns if the previous answers should be shown for a learner.
& getWorkedQuestions($active_id, $pass=null)
Gets the id's of all questions a user already worked through.
$char_selector_definition
setForceInstantFeedbackEnabled($forceInstantFeedbackEnabled)
getAvailableQuestions($arrFilter, $completeonly=0)
Calculates the available questions for a test.
getListOfQuestionsSettings()
Returns the settings for the list of questions options in the test properties This could contain one ...
removeTestResultsByActiveIds($activeIds)
getCharSelectorAvailability()
startWorkingTime($active_id, $pass)
Write the initial entry for the tests working time to the database.
isFollowupQuestionAnswerFixationEnabled()
getHighscoreTopNum($a_retval=10)
Gets the number of entries which are to be shown in the top-rankings table.
setBlockPassesAfterPassedEnabled($blockPassesAfterPassedEnabled)
setSpecificAnswerFeedback($specific_answer_feedback)
& processCSVRow($row, $quoteAll=false, $separator=";")
Processes an array as a CSV row and converts the array values to correct CSV values.
setMailNotificationType($a_type)
setTitleOutput($title_output=0)
Sets the status of the title output.
isOfferingQuestionHintsEnabled()
returns the fact wether offering hints is enabled or not
getCompleteWorkingTime($user_id)
Returns the complete working time in seconds a user worked on the test.
static buildExamId($active_id, $pass, $test_obj_id=null)
& getQuestionsOfTest($active_id)
Retrieves all the assigned questions for all test passes of a test participant.
getMailNotificationType()
setPassWaiting($pass_waiting)
removeQuestions($removeQuestionIds)
getForceJS()
Gets whether JavaScript should be forced for tests.
removeTestResults(ilTestParticipantData $participantData)
applyDefaults($test_defaults)
Applies given test defaults to this test.
disinviteUser($user_id)
Disinvites a user from a test.
setAnswerFeedbackPoints($answer_feedback_points=0)
Sets the answer specific feedback of reached points for the test.
getExportDirectory()
Get the location of the export directory for the test.
getInstantFeedbackOptionsAsArray()
setStartingTimeEnabled($starting_time_enabled)
setECTSGrades(array $a_ects_grades)
{}
static lookupQuestionSetTypeByActiveId($active_id)
returns the question set type of test relating to passed active id
& getQuestionsOfPass($active_id, $pass)
Retrieves all the assigned questions for a test participant in a given test pass.
deliverPDFfromHTML($content, $title=null)
Delivers a PDF file from XHTML.
getImagePathWeb()
Returns the web image path for web accessable images of a test The image path is under the web access...
addQTIMaterial(&$a_xml_writer, $a_material='')
Creates a QTI material tag from a plain text or xhtml text.
static _getWorkingTimeOfParticipantForPass($active_id, $pass)
Returns the complete working time in seconds for a test participant.
static isQuestionObligationPossible($questionId)
checks wether the obligation for question with given id is possible or not
setActivationLimited($a_value)
_isComplete($obj_id)
Returns true, if a test is complete for use.
isShowExamIdInTestResultsEnabled()
areObligationsEnabled()
returns the fact wether obligations are enabled or not
const DEFAULT_PROCESSING_TIME_MINUTES
static _createImportDirectory()
creates data directory for import files (data_dir/tst_data/tst_<id>/import, depending on data directo...
create()
create test object
setShowSolutionSuggested($a_solution=false)
Set to TRUE, if the suggested solution should be shown in the solution.
getEndingTime()
Returns the ending time of the test.
static _getAvailableTests($use_object_id=false)
Returns the available tests for the active user.
setShowKioskModeTitle($a_title=false)
Set to true, if the full test title should be shown in kiosk mode.
setHighscoreOwnTable($a_own_table)
Sets if the table with the own ranking should be shown.
saveCertificateVisibility($a_value)
Saves the visibility settings of the certificate.
setShowGradingMarkEnabled($showGradingMarkEnabled)
getCompleteWorkingTimeOfParticipant($active_id)
Returns the complete working time in seconds for a test participant.
setStartingTime($starting_time=null)
Sets the starting time in database timestamp format for the test.
evalTotalPersons()
Returns the number of persons who started the test.
setEnableExamview($enable_examview)
static $isSkillManagementGloballyActivated
getScoreReporting()
Gets the score reporting of the ilObjTest object.
getMailNotification()
Get mail notification settings.
setSignSubmission($sign_submission)
setEnableArchiving($enable_archiving)
& _evalResultsOverview($test_id)
Creates an associated array with the results of all participants of a test.
setResultFilterTaxIds($resultFilterTaxIds)
$blockPassesAfterPassedEnabled
isInstantFeedbackAnswerFixationEnabled()
& getQuestionTitles()
Returns the titles of the test questions in question sequence.
getAllRTEContent()
Returns the content of all RTE enabled text areas in the test.
_getVisitTimeOfParticipant($test_id, $active_id)
Returns the first and last visit of a participant.
getSpecificAnswerFeedback()
getExportSettingsSingleChoiceShort()
setShowCancel($a_value=1)
Sets the cancel test button status.
getMarkSchemaForeignId()
{int}
& getAllQuestions($pass=null)
Returns all questions of a test in test order.
static _getUserIdFromActiveId($active_id)
isPluginActive($a_pname)
Checks wheather or not a question plugin with a given name is active.
& evalTotalParticipantsArray($name_sort_order="asc")
Returns all participants who started the test.
setShowSolutionAnswersOnly($a_full=true)
Set to true, if the full solution (including the ILIAS content pages) should be shown in the solution...
setAutosaveIval($autosave_ival)
getAnonymity()
Returns the anonymity status of the test.
deliverPDFfromFO($fo, $title=null)
Delivers a PDF file from a XSL-FO string.
static hasObligations($test_id)
returns the fact wether the test with given test id contains questions markes as obligatory or not
setTestFinalBroken($testFinalBroken)
setResultsPresentation($a_results_presentation=3)
Sets the combined results presentation value.
removeQuestion($question_id)
Removes a question from the test object.
setLimitUsersEnabled($limitUsersEnabled)
toXML()
Returns a QTI xml representation of the test.
static lookupPassResultsUpdateTimestamp($active_id, $pass)
hasAnyTestResult(ilTestSession $testSession)
isSingleChoiceTest()
Returns TRUE if the test contains single choice results only.
& evalResultsOverviewOfParticipant($active_id)
Creates an associated array with the results for a given participant of a test.
getShowCancel()
Returns wheather the cancel test button is shown or not.
getCertificateVisibility()
Returns the visibility settings of the certificate.
getInvitedParticipantList()
setHighscoreWTime($a_wtime)
Sets if the workingtime of the scores should be shown.
setNrOfTries($nr_of_tries=0)
Sets the nr of tries for the test.
$participantDataExist
holds the fact wether participant data exists or not DO NOT USE TIS PROPERTY DRIRECTLY ALWAYS USE ilO...
getHighscoreScore()
Gets if the score column should be shown.
isBlockPassesAfterPassedEnabled()
setECTSOutput($a_ects_output)
{}
& getInvitedUsers($user_id="", $order="login, lastname, firstname")
Returns a list of all invited users in a test.
setProcessingTimeByMinutes($minutes)
removeTestResultsFromSoapLpAdministration($userIds)
static _lookupFinishedUserTests($a_user_id)
Gather all finished tests for user.
static _getScoreCutting($active_id)
Determines if the score of a question should be cut at 0 points or the score of the whole test.
setListOfQuestionsStart($a_value=true)
Sets if the the list of questions as the start page of the test.
setHighscoreAchievedTS($a_achieved_ts)
Sets if the date and time of the scores achievement should be displayed.
removeTestActives($activeIds)
getShowMarker()
Returns wheather the marker button is shown or not.
getImportMapping()
get array of (two) new created questions for import id
isSingleChoiceTestWithoutShuffle()
Returns TRUE if the test contains single choice results and no shuffle only.
setCharSelectorAvailability($availability)
setAnonymity($a_value=0)
Sets the anonymity status of the test.
checkMaximumAllowedUsers()
getShuffleQuestions()
Returns the status of the shuffle_questions variable.
setExportSettingsSingleChoiceShort($a_settings)
removeTestResultsByUserIds($userIds)
& getUserData($ids)
Returns a data of all users specified by id list.
isNewRandomTest()
Checks wheather the test is a new random test (using tst_rnd_cpy) or an old one.
getListOfQuestionsDescription()
Returns TRUE if the list of questions should be presented with the question descriptions.
getECTSGrade($passed_array, $reached_points, $max_points)
{Returns the ECTS grade for a number of reached points.string The ECTS grade short description}
getActiveIdOfUser($user_id="", $anonymous_id="")
Gets the active id of a given user.
$accessFilteredParticipantList
getCustomStyle()
Get the custom style.
checkMarks()
{boolean|string True or an error string which can be used for display purposes}
setShowSolutionFeedback($a_feedback=true)
Sets if the the feedback should be presented to the user in the solution or not.
recalculateScores($preserve_manscoring=false)
setEnabledViewMode($mode)
static isParticipantsLastPassActive($testRefId, $userId)
getSecondsUntilEndingTime()
Returns the seconds left from the actual time until the ending time.
isPassDeletionAllowed()
getter for the test setting passDeletionAllowed
getNrOfTries()
Returns the nr of tries for the test.
setShowExamviewHtml($show_examview_html)
const SCORE_REPORTING_DATE
setMCScoring($a_mc_scoring=SCORE_ZERO_POINTS_WHEN_UNANSWERED)
Sets the multiple choice scoring.
$offeringQuestionHintsEnabled
static _getSolvedQuestions($active_id, $question_fi=null)
get solved questions
static _lookupAnonymity($a_obj_id)
Returns the anonymity status of a test with a given object id.
setEnableProcessingTime($enable=0)
Sets the processing time enabled or disabled.
getActivationVisibility()
setUsePreviousAnswers($use_previous_answers=1)
Sets the status of the visibility of previous learner answers.
& getAvailableQuestionpools($use_object_id=false, $equal_points=false, $could_be_offline=false, $show_path=false, $with_questioncount=false, $permission="read")
Returns the available question pools for the active user.
setGenericAnswerFeedback($generic_answer_feedback=0)
Sets if the generic feedback is to be shown in the test.
static getManualFeedback($active_id, $question_id, $pass)
Retrieves the feedback comment for a question in a test if it is finalized.
inviteRole($role_id)
Invites all users of a role to a test.
getJavaScriptOutput()
Returns if Javascript should be chosen for drag & drop actions for the active user.
setListOfQuestionsDescription($a_value=true)
Sets the show_summary attribute to TRUE if the list of questions should be presented with the questio...
static isQuestionObligatory($question_id)
checks wether the question with given id is marked as obligatory or not
update()
update object data
canShowCertificate($testSession, $user_id, $active_id)
Checks whether the certificate button could be shown on the info page or not.
getTextAnswer($active_id, $question_id, $pass=null)
Returns the text answer of a given user for a given question.
userLookupFullName($user_id, $overwrite_anonymity=false, $sorted_order=false, $suffix="")
Returns the full name of a test user according to the anonymity status.
getNrOfResultsForPass($active_id, $pass)
Calculates the number of user results for a specific test pass.
isShowGradingMarkEnabled()
setExportSettings($a_settings)
setEndingTime($ending_time=null)
Sets the ending time in database timestamp format for the test.
getStartingTimeOfParticipants()
Note, this function should only be used if absolutely necessary, since it perform joins on tables tha...
addExtraTime($active_id, $minutes)
getAccessFilteredParticipantList()
static getPoolQuestionChangeListeners(ilDBInterface $db, $poolObjId)
cleanupMediaobjectUsage()
Cleans up the media objects for all text fields in a test which are using an RTE field.
setScoreReporting($score_reporting=0)
Sets the score reporting of the ilObjTest object.
isTestFinishedToViewResults($active_id, $currentpass)
Returns true if an active user completed a test pass and did not start a new pass.
static ensureParticipantsLastActivePassFinished($testObjId, $userId, $a_force_new_run=false)
hasNrOfTriesRestriction()
returns if the numbers of tries have to be checked
static _lookupTestObjIdForQuestionId($a_q_id)
Get test Object ID for question ID.
setCustomStyle($a_customStyle=null)
Set the custom style.
const SCORE_REPORTING_DISABLED
setTmpCopyWizardCopyId($tmpCopyWizardCopyId)
getVisitTimeOfParticipant($active_id)
Returns the first and last visit of a participant.
setAccessFilteredParticipantList($accessFilteredParticipantList)
getTitleFilenameCompliant()
returns the object title prepared to be used as a filename
getShowFinalStatement()
Returns whether the final statement should be shown or not.
questionMoveUp($question_id)
Moves a question up in order.
getProcessingTime()
Returns the processing time for the test.
setSequenceSettings($sequence_settings=0)
SEQUENCE SETTING = POSTPONING ENABLED !!
isForceInstantFeedbackEnabled()
& getCompleteWorkingTimeOfParticipants()
Returns the complete working time in seconds for all test participants.
getIntroduction()
Gets the introduction text of the ilObjTest object.
getAnswerFeedback()
Returns 1 if generic answer feedback is activated.
const HIGHSCORE_SHOW_TOP_TABLE
exportPagesXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export pages of test to xml (see ilias_co.dtd)
isScoreReportingEnabled()
setShowMarker($a_value=1)
Sets the marker button status.
static _lookupName($a_user_id)
lookup user name
static _lookupClientIP($a_user_id)
Lookup client ip.
Class ilObjectActivation.
const TIMINGS_DEACTIVATED
setTimingType($a_type)
Set timing type.
static getItem($a_ref_id)
Get item data.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static getInstance($a_obj_id)
Class ilObject Basic functions for all objects.
getType()
get object type @access public
getOwner()
get object owner
static _lookupObjId($a_id)
setOfflineStatus($a_status)
Set offline status.
static _lookupTitle($a_id)
lookup object title
setTitle($a_title)
set object title
deleteMetaData()
delete meta data entry
static _lookupDescription($a_id)
lookup object description
updateMetaData()
update meta data entry
setDescription($a_desc)
set object description
getOfflineStatus()
Get offline status.
getRefId()
get reference id @access public
getDescription()
get object description
cloneMetaData($target_obj)
Copy meta data.
getId()
get object id @access public
static _prepareCloneSelection($a_ref_ids, $new_type, $show_path=true)
Prepare copy wizard object selection.
static _lookupOwner($a_id)
lookup object owner
getTitle()
get object title @access public
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
static getPluginObject(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
getPresentationMaterial()
{ilQTIPresentationMaterial|null}
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static _cleanupMediaObjectUsage($a_text, $a_usage_type, $a_usage_id)
Synchronises appearances of media objects in $a_text with media object usage table.
static factory($a_package, $a_timeout=0)
Creates an ilRpcClient instance to our ilServer.
Skill management settings.
special template class to simplify handling of ITX/PEAR
Base Exception for all Exceptions relating to Modules/Test.
Class ilTestMailNotification.
static getManageParticipantsUserFilter($refId)
static getAccessStatisticsUserFilter($refId)
isQuestionSetConfigured()
static isManScoringDone($activeId)
reads the flag wether manscoring is done for the given test active or not from the global settings (s...
static getDataDir()
get data directory (outside webspace)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static insertInstIntoID($a_value)
inserts installation id into ILIAS id
static prepareTextareaOutput($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free,...
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static _getObjectsByOperations($a_obj_type, $a_operation, $a_usr_id=0, $limit=0)
Get all objects of a specific type and check access This function is not recursive,...
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
xmlHeader()
Writes xml header @access public.
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
const SCORE_ZERO_POINTS_WHEN_UNANSWERED
const COUNT_PARTIAL_SOLUTIONS
const TEST_FIXED_SEQUENCE
Test constants.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
redirection script todo: (a better solution should control the processing via a xml file)
foreach($_POST as $key=> $value) $res