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';
 
  591        public function __construct($a_id = 0,$a_call_by_reference = 
true)
 
  596                $lng->loadLanguageModule(
"assessment");
 
  598                include_once 
"./Modules/Test/classes/class.assMarkSchema.php";
 
  600                $this->mark_schema->createSimpleSchema(
 
  601                        $lng->txt(
"failed_short"),
 
  602                        $lng->txt(
"failed_official"),
 
  605                        $lng->txt(
"passed_short"),
 
  606                        $lng->txt(
"passed_official"),
 
  612                $this->author = 
$ilUser->fullname;
 
  613                $this->introductionEnabled = 
false;
 
  614                $this->introduction = 
"";
 
  615                $this->questions = array();
 
  618                $this->instant_verification = 0;
 
  619                $this->answer_feedback_points = 0;
 
  620                $this->reporting_date = 
"";
 
  621                $this->nr_of_tries = 0;
 
  623                $this->use_previous_answers = 1;
 
  624                $this->title_output = 0;
 
  625                $this->starting_time = 
"";
 
  626                $this->ending_time = 
"";
 
  627                $this->processing_time = 
"";
 
  628                $this->enable_processing_time = 
"0";
 
  629                $this->reset_processing_time = 0;
 
  630                $this->ects_output = FALSE;
 
  631                $this->ects_fx     = NULL;
 
  632                $this->shuffle_questions = FALSE;
 
  633                $this->mailnottype = 0;
 
  634                $this->exportsettings = 0;
 
  635                $this->show_summary = 8;
 
  640                $this->answer_feedback = 0;
 
  641                $this->password = 
"";
 
  642                $this->certificate_visibility = 0;
 
  643                $this->allowedUsers = 
"";
 
  644                $this->_showfinalstatement = FALSE;
 
  645                $this->_finalstatement = 
"";
 
  646                $this->_showinfo = TRUE;
 
  647                $this->_forcejs = TRUE;
 
  648                $this->_customStyle = 
"";
 
  649                $this->allowedUsersTimeGap = 
"";
 
  650                $this->anonymity = 0;
 
  651                $this->show_cancel = 0;
 
  652                $this->show_marker = 0;
 
  653                $this->fixed_participants = 0;
 
  658                $this->testSession = FALSE;
 
  659                $this->testSequence = FALSE;
 
  660                $this->mailnotification = 0;
 
  661                $this->poolUsage = 1;
 
  663                $this->ects_grades = array(
 
  671                $this->autosave = FALSE;
 
  672                $this->autosave_ival = 30000;
 
  674                $this->enable_examview = 
false;
 
  675                $this->show_examview_html = 
false;
 
  676                $this->show_examview_pdf = 
false;
 
  677                $this->enable_archiving = 
false;
 
  679        $this->express_mode = 
false;
 
  680        $this->template_id = 
'';
 
  681                $this->redirection_mode = 0;
 
  682                $this->redirection_url = NULL;
 
  683                $this->show_exam_id_in_test_pass_enabled = 
false;
 
  684                $this->show_exam_id_in_test_results_enabled = 
false;
 
  685                $this->sign_submission = 
false;
 
  686                $this->char_selector_availability = 0;
 
  687                $this->char_selector_definition = 
null;
 
  689                $this->showGradingStatusEnabled = 
true;
 
  690                $this->showGradingMarkEnabled = 
true;
 
  692                $this->instantFeedbackAnswerFixationEnabled = 
false;
 
  694                $this->testFinalBroken = 
false;
 
  696                $this->tmpCopyWizardCopyId = 
null;
 
  698                $this->
ilObject($a_id, $a_call_by_reference);
 
  740                if (!parent::update())
 
  755        function read($a_force_db = 
false)
 
  757                parent::read($a_force_db);
 
  771                if (!parent::delete())
 
  792                global $tree, 
$ilDB, $ilPluginAdmin, 
$lng;
 
  794                require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
  796                $participantData->load($this->
getTestId());
 
  799                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_mark WHERE test_fi = %s",
 
  804                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_tests WHERE test_id = %s",
 
  809                require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
  811                $testQuestionSetConfigFactory->getQuestionSetConfig()->removeQuestionSetRelatedData();
 
  814                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  816                $directory = $tst_data_dir.
"/tst_".$this->
getId();
 
  817                if (is_dir($directory))
 
  819                        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  822                include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
  828                foreach(
$mobs as $mob)
 
  853        function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
 
  893                if ($a_node_id==
$_GET[
"ref_id"])
 
  895                        $parent_obj =& $this->
ilias->obj_factory->getInstanceByRefId($a_node_id);
 
  896                        $parent_type = $parent_obj->getType();
 
  897                        if ($parent_type == $this->
getType())
 
  899                                $a_node_id = (int) $tree->getParentId($a_node_id);
 
  903                parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
 
  913                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  916                if (!is_writable($tst_data_dir))
 
  918                        $this->
ilias->raiseError(
"Test Data Directory (".$tst_data_dir
 
  919                                .
") not writeable.",$this->
ilias->error_obj->MESSAGE);
 
  923                $tst_dir = $tst_data_dir.
"/tst_".$this->
getId();
 
  925                if (!@is_dir($tst_dir))
 
  927                        $this->
ilias->raiseError(
"Creation of Test Directory failed.",$this->
ilias->error_obj->MESSAGE);
 
  930                $export_dir = $tst_dir.
"/export";
 
  932                if (!@is_dir($export_dir))
 
  934                        $this->
ilias->raiseError(
"Creation of Export Directory failed.",$this->
ilias->error_obj->MESSAGE);
 
  945                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  956        function getExportFiles($dir)
 
  959                if(!@is_dir($dir) || !is_writeable($dir))
 
  975                        $files[] = 
$file->getBasename();
 
  988                if (strlen($a_import_dir))
 
  990                        $_SESSION[
"tst_import_dir"] = $a_import_dir;
 
 1006                if (strlen(
$_SESSION[
"tst_import_dir"]))
 
 1026                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 1030                if (!is_writable($tst_data_dir))
 
 1032                        $this->
ilias->raiseError(
"Test Data Directory (".$tst_data_dir
 
 1033                                .
") not writeable.",$this->
ilias->error_obj->FATAL);
 
 1037                $tst_dir = $tst_data_dir.
"/tst_import";
 
 1039                if (!@is_dir($tst_dir))
 
 1041                        $ilias->raiseError(
"Creation of test import directory failed.",
$ilias->error_obj->FATAL);
 
 1056                $result = 
$ilDB->queryF(
"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",
 
 1063                        if (strcmp(
$row[
'foundtypes'], 
'assSingleChoice') == 0)
 
 1081                $result = 
$ilDB->queryF(
"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",
 
 1088                        if (strcmp(
$row[
'foundtypes'], 
'assSingleChoice') == 0)
 
 1113                                SELECT  DISTINCT(qpl_qst_sc.shuffle) foundshuffles 
 1119                                WHERE   tst_test_result.question_fi = qpl_questions.question_id 
 1120                                AND             qpl_questions.question_type_fi = qpl_qst_type.question_type_id 
 1121                                AND             tst_test_result.active_fi = tst_active.active_id 
 1122                                AND             qpl_questions.question_id = qpl_qst_sc.question_fi 
 1123                                AND             tst_active.test_fi = %s 
 1124                                AND             qpl_qst_type.type_tag = %s 
 1126                        array(
'integer', 
'text'),
 
 1127                        array($this->
getTestId(), 
'assSingleChoice')
 
 1132                        return (
$row[
'foundshuffles'] == 0);
 
 1145                if( !count($this->mark_schema->mark_steps) )
 
 1166                global $tree, 
$ilDB, $ilPluginAdmin;
 
 1169                $test->loadFromDb();
 
 1171                require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 1174                return $test->isComplete( $testQuestionSetConfigFactory->getQuestionSetConfig() );
 
 1190                        if(!preg_match(
'/\d+/', $this->
getECTSFX()))
 
 1198                                SET ects_output = %s, ects_a = %s, ects_b = %s, ects_c = %s, ects_d = %s, ects_e = %s, ects_fx = %s 
 1199                                WHERE test_id = %s",
 
 1200                                array(
'text', 
'float', 
'float', 
'float', 
'float', 
'float', 
'float', 
'integer'),
 
 1203                                        $grades[
'A'], $grades[
'B'], $grades[
'C'], $grades[
'D'], $grades[
'E'],
 
 1220                if($this->
isComplete($testQuestionSetConfig))
 
 1227                                "UPDATE tst_tests SET complete = %s WHERE test_id = %s",
 
 1228                                array(
'text', 
'integer'),
 
 1229                                array($complete, $this->test_id)
 
 1254                include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
 1255                $completecontent = 
"";
 
 1258                        $completecontent .= $content;
 
 1271                global $tree, 
$ilDB, $ilPluginAdmin;
 
 1278                require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 1280                $testQuestionSetConfig = $testQuestionSetConfigFactory->getQuestionSetConfig();
 
 1282                include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1283                if ($this->test_id == -1)
 
 1286                        $next_id = 
$ilDB->nextId(
'tst_tests');
 
 1288                        $ilDB->insert(
'tst_tests', array(
 
 1289                                'test_id'                    => array(
'integer', $next_id),
 
 1290                                'obj_fi'                     => array(
'integer', $this->
getId()),
 
 1291                                'author'                     => array(
'text', $this->
getAuthor()),
 
 1295                                'showinfo'                   => array(
'integer', $this->
getShowInfo()),
 
 1296                                'forcejs'                    => array(
'integer', $this->
getForceJS()),
 
 1308                                'nr_of_tries'                => array(
'integer', $this->
getNrOfTries()),
 
 1309                                'kiosk'                      => array(
'integer', $this->
getKiosk()),
 
 1320                                'complete'                   => array(
'text', $this->
isComplete($testQuestionSetConfig)),
 
 1322                                'ects_a'                     => array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : NULL),
 
 1323                                'ects_b'                     => array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : NULL),
 
 1324                                'ects_c'                     => array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : NULL),
 
 1325                                'ects_d'                     => array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : NULL),
 
 1326                                'ects_e'                     => array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : NULL),
 
 1327                                'ects_fx'                    => array(
'float', $this->
getECTSFX()),
 
 1336                                'password'                   => array(
'text', $this->
getPassword()),
 
 1344                                'created'                    => array(
'integer', time()),
 
 1345                                'tstamp'                     => array(
'integer', time()),
 
 1347                                'template_id'                => array(
'integer', $this->
getTemplate()),
 
 1348                                'pool_usage'                 => array(
'integer', $this->
getPoolUsage()),
 
 1362                                'online_status'              => array(
'integer', (
int)$this->
isOnline()),
 
 1364                                'autosave'                   => array(
'integer', (
int)$this->
getAutosave()),
 
 1388                        $this->test_id = $next_id;
 
 1401                                $result = 
$ilDB->queryF(
"SELECT * FROM tst_tests WHERE test_id = %s",
 
 1403                                        array($this->test_id)
 
 1411                        $ilDB->update(
'tst_tests',
 
 1413                                                'author'                     => array(
'text', $this->
getAuthor()),
 
 1417                                                'showinfo'                   => array(
'integer', $this->
getShowInfo()),
 
 1418                                                'forcejs'                    => array(
'integer', $this->
getForceJS()),
 
 1430                                                'nr_of_tries'                => array(
'integer', $this->
getNrOfTries()),
 
 1431                                                'kiosk'                      => array(
'integer', $this->
getKiosk()),
 
 1442                                                'complete'                   => array(
'text', $this->
isComplete($testQuestionSetConfig)),
 
 1444                                                'ects_a'                     => array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : NULL),
 
 1445                                                'ects_b'                     => array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : NULL),
 
 1446                                                'ects_c'                     => array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : NULL),
 
 1447                                                'ects_d'                     => array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : NULL),
 
 1448                                                'ects_e'                     => array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : NULL),
 
 1449                                                'ects_fx'                    => array(
'float', $this->
getECTSFX()),
 
 1458                                                'password'                   => array(
'text', $this->
getPassword()),
 
 1466                                                'tstamp'                     => array(
'integer', time()),
 
 1468                                                'template_id'                => array(
'integer', $this->
getTemplate()),
 
 1469                                                'pool_usage'                 => array(
'integer', $this->
getPoolUsage()),
 
 1483                                                'online_status'              => array(
'integer', (
int)$this->
isOnline()),
 
 1485                                                'autosave'                   => array(
'integer', (
int)$this->
getAutosave()),
 
 1509                                                'test_id' => array(
'integer', (
int)$this->
getTestId())
 
 1513                        include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1516                                $logresult = 
$ilDB->queryF(
"SELECT * FROM tst_tests WHERE test_id = %s",
 
 1521                                if ($logresult->numRows() == 1)
 
 1523                                        $newrow = 
$ilDB->fetchAssoc($logresult);
 
 1525                                $changed_fields = array();
 
 1526                                foreach ($oldrow as $key => $value)
 
 1528                                        if (strcmp($oldrow[$key], $newrow[$key]) != 0)
 
 1530                                                array_push($changed_fields, 
"$key: " . $oldrow[$key] . 
" => " . $newrow[$key]);
 
 1533                                $changes = join($changed_fields, 
", ");
 
 1534                                if (count($changed_fields) > 0)
 
 1545                                        $aresult = 
$ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s AND tries >= %s AND submitted = %s",
 
 1546                                                array(
'integer', 
'integer', 
'integer'),
 
 1549                                        while (
$row = $ilDB->fetchAssoc($aresult))
 
 1551                                                $ilDB->manipulateF(
"UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
 1552                                                        array(
'integer', 
'timestamp', 
'integer'),
 
 1553                                                        array(1, date(
'Y-m-d H:i:s'), 
$row[
"active_id"])
 
 1558                                        $aresult = 
$ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s AND tries < %s AND submitted = %s",
 
 1559                                                array(
'integer', 
'integer', 
'integer'),
 
 1562                                        while (
$row = $ilDB->fetchAssoc($aresult))
 
 1564                                                $ilDB->manipulateF(
"UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
 1565                                                        array(
'integer', 
'timestamp', 
'integer'),
 
 1566                                                        array(0, NULL, 
$row[
"active_id"])
 
 1573                                        $aresult = 
$ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s AND submitted = %s",
 
 1574                                                array(
'integer', 
'integer'),
 
 1577                                        while (
$row = $ilDB->fetchAssoc($aresult))
 
 1579                                                $ilDB->manipulateF(
"UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
 1580                                                        array(
'integer', 
'timestamp', 
'integer'),
 
 1581                                                        array(0, NULL, 
$row[
"active_id"])
 
 1591                        include_once 
"./Services/Object/classes/class.ilObjectActivation.php";          
 
 1607                        $item->update($this->ref_id);           
 
 1610                if (!$properties_only)
 
 1623                                $this->mark_schema->saveToDb($this->test_id);
 
 1638                $oldquestions = array();
 
 1639                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 1642                        $result = 
$ilDB->queryF(
"SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
 
 1650                                        array_push($oldquestions, 
$row[
"question_fi"]);
 
 1656                $currentQuestionsObligationsQuery = 
'SELECT question_fi, obligatory FROM tst_test_question WHERE test_fi = %s';
 
 1657                $rset = 
$ilDB->queryF($currentQuestionsObligationsQuery, array(
'integer'), array($this->
getTestId()));
 
 1658                while (
$row = $ilDB->fetchAssoc($rset)) {
 
 1659                        $obligatoryQuestionState[
$row[
'question_fi']] = 
$row[
'obligatory'];
 
 1662                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_test_question WHERE test_fi = %s",
 
 1667                foreach ($this->questions as $key => $value) 
 
 1670                        if( !isset($obligatoryQuestionState[$value]) || is_null($obligatoryQuestionState[$value]) )
 
 1672                                $obligatoryQuestionState[$value] = 0;
 
 1676                        $next_id = 
$ilDB->nextId(
'tst_test_question');
 
 1677                        $ilDB->insert(
'tst_test_question', array(
 
 1678                                'test_question_id' => array(
'integer', $next_id),
 
 1679                                'test_fi' => array(
'integer', $this->
getTestId()),
 
 1680                                'question_fi' => array(
'integer', $value),
 
 1681                                'sequence' => array(
'integer', $key),
 
 1682                                'obligatory' => array(
'integer', $obligatoryQuestionState[$value]),
 
 1683                                'tstamp' => array(
'integer', time())
 
 1686                include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1689                        $result = 
$ilDB->queryF(
"SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
 
 1693                        $newquestions = array();
 
 1698                                        array_push($newquestions, 
$row[
"question_fi"]);
 
 1701                        foreach ($oldquestions as $index => $question_id)
 
 1703                                if (strcmp($newquestions[$index], $question_id) != 0)
 
 1705                                        $pos = array_search($question_id, $newquestions);
 
 1716                        foreach ($newquestions as $index => $question_id)
 
 1718                                if (array_search($question_id, $oldquestions) === FALSE)
 
 1734                $result = 
$ilDB->queryF(
'SELECT copy_id FROM tst_rnd_cpy WHERE tst_fi = %s',
 
 1738                return $result->numRows() > 0;
 
 1762                $result = 
$ilDB->queryF(
"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",
 
 1766                $original_ids = array();
 
 1767                $paramtypes = array();
 
 1768                $paramvalues = array();
 
 1771                        array_push($original_ids, 
$row[
'original_id']);
 
 1776                if (($questionpool == 0) && (!is_array($qpls)))
 
 1778                        include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 1780                        if (count($available_pools))
 
 1782                                $available = 
" AND " . 
$ilDB->in(
'obj_fi', $available_pools, 
false, 
'integer');
 
 1790                $constraint_qpls = 
"";
 
 1791                $result_array = array();
 
 1792                if ($questionpool == 0)
 
 1794                        if (is_array($qpls))
 
 1796                                if (count($qpls) > 0)
 
 1798                                        $constraint_qpls = 
" AND " . 
$ilDB->in(
'obj_fi', $qpls, 
false, 
'integer');
 
 1803                $original_clause = 
"";
 
 1804                if (count($original_ids))
 
 1806                        $original_clause = 
" AND " . 
$ilDB->in(
'question_id', $original_ids, 
true, 
'integer');
 
 1809                if ($questionpool == 0)
 
 1811                        $result = 
$ilDB->queryF(
"SELECT question_id FROM qpl_questions WHERE original_id IS NULL $available $constraint_qpls AND owner > %s AND complete = %s $original_clause",
 
 1812                                array(
'integer', 
'text'),
 
 1818                        $result = 
$ilDB->queryF(
"SELECT question_id FROM qpl_questions WHERE original_id IS NULL AND obj_fi = %s AND owner > %s AND complete = %s $original_clause",
 
 1819                                array(
'integer',
'integer', 
'text'),
 
 1820                                array($questionpool, 0, 
"1")
 
 1823                $found_ids = array();
 
 1826                        array_push($found_ids, 
$row[
'question_id']);
 
 1828                $nr_of_questions = ($nr_of_questions > count($found_ids)) ? count($found_ids) : $nr_of_questions;
 
 1829                if ($nr_of_questions == 0) 
return array();
 
 1830                $rand_keys = array_rand($found_ids, $nr_of_questions);
 
 1832                if (is_array($rand_keys))
 
 1834                        foreach ($rand_keys as $key)
 
 1836                                $result[$found_ids[$key]] = $found_ids[$key];
 
 1841                        $result[$found_ids[$rand_keys]] = $found_ids[$rand_keys];
 
 1857                $result = 
$ilDB->queryF(
"SELECT test_result_id FROM tst_test_result WHERE active_fi = %s AND pass = %s",
 
 1858                        array(
'integer',
'integer'),
 
 1859                        array($active_id, 
$pass)
 
 1877                $result = 
$ilDB->queryF(
"SELECT test_random_question_id FROM tst_test_rnd_qst WHERE active_fi = %s AND pass = %s",
 
 1878                        array(
'integer',
'integer'),
 
 1879                        array($active_id, 
$pass)
 
 1881                return (
$result->numRows() > 0) ? true : 
false;
 
 1891                $result = 
$ilDB->queryF(
"SELECT * FROM tst_tests WHERE obj_fi = %s",
 
 1893                        array($this->
getId())
 
 1904                        include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
 1941                                        "A" => 
$data->ects_a,
 
 1942                                        "B" => 
$data->ects_b,
 
 1943                                        "C" => 
$data->ects_c,
 
 1944                                        "D" => 
$data->ects_d,
 
 1945                                        "E" => 
$data->ects_e
 
 1949                        $this->mark_schema->flush();
 
 1950                        $this->mark_schema->loadFromDb($this->
getTestId());
 
 2008                        include_once 
"./Services/Object/classes/class.ilObjectActivation.php";
 
 2010                        switch($activation[
"timing_type"])
 
 2037        $this->questions = array();
 
 2040                if (strcmp($active_id, 
"") == 0)
 
 2048                $result = 
$ilDB->queryF(
"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",
 
 2049                        array(
'integer', 
'integer'),
 
 2050                        array($active_id, 
$pass)
 
 2058                        $result = 
$ilDB->queryF(
"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",
 
 2066                $result = 
$ilDB->queryF(
"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",
 
 2068                        array($this->test_id)
 
 2074                $this->questions[$index++] = 
$data[
"question_fi"];
 
 2102                return (strlen($this->introduction)) ? $this->introduction : NULL;
 
 2127                $this->_finalstatement = $a_statement;
 
 2139                $this->_showinfo = ($a_info) ? 1 : 0;
 
 2151                $this->_forcejs = ($a_js) ? 1 : 0;
 
 2163                $this->_customStyle = $a_customStyle;
 
 2175                return (strlen($this->_customStyle)) ? $this->_customStyle : NULL;
 
 2188                $css_path = str_replace(
"ta.css", 
"customstyles", $css_path) . 
"/";
 
 2189                $customstyles = array();
 
 2190                if (is_dir($css_path))
 
 2193                        include_once 
"./Services/Utilities/classes/class.ilFileUtils.php";
 
 2206                return $customstyles;
 
 2221                        $custom = str_replace(
"ta.css", 
"customstyles/" . $this->
getCustomStyle(), $default);
 
 2222                        if (file_exists($custom))
 
 2225                                $custom = str_replace(
"ta.css", 
"customstyles/" . $this->
getCustomStyle(), $custom);
 
 2248                $this->_showfinalstatement = ($show) ? 1 : 0;
 
 2259                return (strlen($this->_finalstatement)) ? $this->_finalstatement : NULL;
 
 2271                return ($this->_showinfo) ? 1 : 0;
 
 2283                return ($this->_forcejs) ? 1 : 0;
 
 2295                return ($this->_showfinalstatement) ? 1 : 0;
 
 2315                return ($this->ects_output) ? 1 : 0;
 
 2323                $this->ects_output = $a_ects_output ? 1 : 0;
 
 2331                return (strlen($this->ects_fx)) ? $this->ects_fx : NULL;
 
 2339                $this->ects_fx = $a_ects_fx;
 
 2355                $this->ects_grades = $a_ects_grades;
 
 2365                return ($this->sequence_settings) ? $this->sequence_settings : 0;
 
 2415                switch ($instant_feedback)
 
 2418                                $this->instant_verification = 1;
 
 2421                                $this->instant_verification = 0;
 
 2438                        $this->answer_feedback = 1;
 
 2441                        $this->answer_feedback = 0;
 
 2454        switch ($generic_answer_feedback)
 
 2457                        $this->answer_feedback = 1;
 
 2460                        $this->answer_feedback = 0;
 
 2477                                $this->answer_feedback_points = 1;
 
 2480                                $this->answer_feedback_points = 0;
 
 2493                        $this->reporting_date = 
'';
 
 2516                return ($this->score_reporting) ? $this->score_reporting : 0;
 
 2533                return ($this->instant_verification) ? $this->instant_verification : 0;
 
 2546                return ($this->answer_feedback) ? $this->answer_feedback : 0;
 
 2559                return ($this->answer_feedback) ? $this->answer_feedback : 0;
 
 2571        return ($this->answer_feedback_points) ? $this->answer_feedback_points : 0;
 
 2583                return ($this->count_system) ? $this->count_system : 0;
 
 2596                $result = 
$ilDB->queryF(
"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",
 
 2603                        return $row[
"count_system"];
 
 2617                return ($this->mc_scoring) ? $this->mc_scoring : 0;
 
 2629                return ($this->score_cutting) ? $this->score_cutting : 0;
 
 2641                return ($this->pass_scoring) ? $this->pass_scoring : 0;
 
 2654                $result = 
$ilDB->queryF(
"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",
 
 2661                        return $row[
"pass_scoring"];
 
 2676                $result = 
$ilDB->queryF(
"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",
 
 2683                        return $row[
"mc_scoring"];
 
 2698                $result = 
$ilDB->queryF(
"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",
 
 2705                        return $row[
"score_cutting"];
 
 2719                return (strlen($this->reporting_date)) ? $this->reporting_date : NULL;
 
 2731                return ($this->nr_of_tries) ? $this->nr_of_tries : 0;
 
 2743                return ($this->_kiosk) ? $this->_kiosk : 0;
 
 2756                $this->_kiosk = $kiosk;
 
 2768                if (($this->_kiosk & 1) > 0)
 
 2789                        $this->_kiosk = $this->_kiosk | 1;
 
 2795                                $this->_kiosk = $this->_kiosk ^ 1;
 
 2809                if (($this->_kiosk & 2) > 0)
 
 2829                        $this->_kiosk = $this->_kiosk | 2;
 
 2835                                $this->_kiosk = $this->_kiosk ^ 2;
 
 2849                if (($this->_kiosk & 4) > 0)
 
 2869                        $this->_kiosk = $this->_kiosk | 4;
 
 2875                                $this->_kiosk = $this->_kiosk ^ 4;
 
 2889                return ($this->use_previous_answers) ? $this->use_previous_answers : 0;
 
 2901                return ($this->title_output) ? $this->title_output : 0;
 
 2916                $result = 
$ilDB->queryF(
"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",
 
 2923                        return $row[
"title_output"];
 
 2944                $result = 
$ilDB->queryF(
"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",
 
 2956                        if ($user_active_user_setting)
 
 2958                                $res = 
$ilUser->getPref(
"tst_use_previous_answers");
 
 2977                return (strlen($this->processing_time)) ? $this->processing_time : NULL;
 
 2988                if (strlen($this->processing_time))
 
 2990                        if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches))
 
 2992                                if ((
int)$matches[1]+(
int)$matches[2]+(
int)$matches[3] == 0)
 
 2999                                                'hh' => $matches[1],
 
 3000                                                'mm' => $matches[2],
 
 3001                                                'ss' => $matches[3],
 
 3011                if (strlen($this->processing_time))
 
 3013                        if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches))
 
 3015                                return ($matches[1] * 60) + $matches[2];
 
 3031                if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $this->
getProcessingTime(), $matches))
 
 3034                        return ($matches[1] * 3600) + ($matches[2] * 60) + $matches[3] + $extratime;
 
 3051                        if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getEndingTime(), $matches))
 
 3053                                $ending = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 3055                                return $ending - $now;
 
 3072                return ($this->enable_processing_time) ? $this->enable_processing_time : 0;
 
 3084                return ($this->reset_processing_time) ? $this->reset_processing_time : 0;
 
 3112                return (strlen($this->starting_time)) ? $this->starting_time : NULL;
 
 3152                return (strlen($this->ending_time)) ? $this->ending_time : NULL;
 
 3190                        $this->use_previous_answers = 1;
 
 3194                        $this->use_previous_answers = 0;
 
 3227                                $this->title_output = 1;
 
 3230                                $this->title_output = 2;
 
 3233                                $this->title_output = 0;
 
 3252                $this->processing_time = sprintf(
"%02d:%02d:00", floor($minutes/60), $minutes%60);
 
 3265                        $this->enable_processing_time = 
"1";
 
 3267                        $this->enable_processing_time = 
"0";
 
 3282                        $this->reset_processing_time = 1;
 
 3286                        $this->reset_processing_time = 0;
 
 3299                $this->count_system = $a_count_system;
 
 3327                return (strlen($this->password)) ? $this->password : NULL;
 
 3339                $this->password = $a_password;
 
 3351                $this->score_cutting = $a_score_cutting;
 
 3363                $this->mc_scoring = $a_mc_scoring;
 
 3375                switch ($a_pass_scoring)
 
 3391                foreach ($removeQuestionIds as $value) {
 
 3408                include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3413                $question->delete($question_id);
 
 3431                require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
 3433                $participantData->setUserIds($userIds);
 
 3434                $participantData->load($this->
getTestId());
 
 3449                        require_once 
'Services/Object/classes/class.ilObjectLP.php';
 
 3451                        $testLP->setTestObject($this);
 
 3452                        $testLP->resetLPDataForUserIds($participantData->
getUserIds(), 
false);
 
 3465                require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
 3467                $participantData->setUserIds($userIds);
 
 3468                $participantData->load($this->
getTestId());
 
 3470                $IN_userIds = 
$ilDB->in(
'usr_id', $participantData->getUserIds(), 
false, 
'integer');
 
 3471                $ilDB->manipulateF(
"DELETE FROM usr_pref WHERE $IN_userIds AND keyword = %s",
 
 3472                        array(
'text'), array(
"tst_password_".$this->
getTestId())
 
 3475                if( count($participantData->getActiveIds()) )
 
 3485                $IN_activeIds = 
$ilDB->in(
'active_fi', $activeIds, 
false, 
'integer');
 
 3487                $ilDB->manipulate(
"DELETE FROM tst_solutions WHERE $IN_activeIds");
 
 3488                $ilDB->manipulate(
"DELETE FROM tst_qst_solved WHERE $IN_activeIds");
 
 3489                $ilDB->manipulate(
"DELETE FROM tst_test_result WHERE $IN_activeIds");
 
 3490                $ilDB->manipulate(
"DELETE FROM tst_pass_result WHERE $IN_activeIds");
 
 3491                $ilDB->manipulate(
"DELETE FROM tst_result_cache WHERE $IN_activeIds");
 
 3492                $ilDB->manipulate(
"DELETE FROM tst_sequence WHERE $IN_activeIds");
 
 3493                $ilDB->manipulate(
"DELETE FROM tst_times WHERE $IN_activeIds");
 
 3497                        $ilDB->manipulate(
"DELETE FROM tst_test_rnd_qst WHERE $IN_activeIds");
 
 3501                        $ilDB->manipulate(
"DELETE FROM tst_seq_qst_tracking WHERE $IN_activeIds");
 
 3502                        $ilDB->manipulate(
"DELETE FROM tst_seq_qst_answstatus WHERE $IN_activeIds");
 
 3503                        $ilDB->manipulate(
"DELETE FROM tst_seq_qst_postponed WHERE $IN_activeIds");
 
 3504                        $ilDB->manipulate(
"DELETE FROM tst_seq_qst_checked WHERE $IN_activeIds");
 
 3507                include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3509                foreach ($activeIds as $active_id)
 
 3513                        if (@is_dir(CLIENT_WEB_DIR . 
"/assessment/tst_" . $this->
getTestId() . 
"/$active_id"))
 
 3524                require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
 
 3532                $IN_activeIds = 
$ilDB->in(
'active_id', $activeIds, 
false, 
'integer');
 
 3533                $ilDB->manipulate(
"DELETE FROM tst_active WHERE $IN_activeIds");
 
 3548                $result = 
$ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
 
 3549                        array(
'integer', 
'integer'),
 
 3553                if (
$data->sequence > 1) 
 
 3556                        $result = 
$ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
 
 3557                                array(
'integer',
'integer'),
 
 3562                        $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3563                                array(
'integer',
'integer'),
 
 3564                                array(
$data->sequence, $data_previous->test_question_id)
 
 3567                        $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3568                                array(
'integer',
'integer'),
 
 3569                                array(
$data->sequence - 1, 
$data->test_question_id)
 
 3571                        include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3592                $result = 
$ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
 
 3593                        array(
'integer',
'integer'),
 
 3597                $result = 
$ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
 
 3598                        array(
'integer',
'integer'),
 
 3606                        $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3607                                array(
'integer',
'integer'),
 
 3608                                array(
$data->sequence, $data_next->test_question_id)
 
 3611                        $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3612                                array(
'integer',
'integer'),
 
 3613                                array(
$data->sequence + 1, 
$data->test_question_id)
 
 3615                        include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3635                $duplicate_id = $question->duplicate(
true, 
null, 
null, 
null, $this->
getId());
 
 3637                return $duplicate_id;
 
 3651#var_dump($question_id); 
 3654                        $duplicate_id = $question_id;
 
 3662                $result = 
$ilDB->queryF(
"SELECT MAX(sequence) seq FROM tst_test_question WHERE test_fi=%s",
 
 3671                        $sequence = 
$data->seq + 1;
 
 3674                $next_id = 
$ilDB->nextId(
'tst_test_question');
 
 3675                $affectedRows = 
$ilDB->manipulateF(
"INSERT INTO tst_test_question (test_question_id, test_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
 
 3676                        array(
'integer', 
'integer',
'integer',
'integer',
'integer'),
 
 3677                        array($next_id, $this->
getTestId(), $duplicate_id, $sequence, time())
 
 3679                if ($affectedRows == 1) 
 
 3681                        include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3688                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_active WHERE test_fi = %s",
 
 3694                return $duplicate_id;
 
 3710                        $result = 
$ilDB->queryF(
"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",
 
 3716                                array_push($titles, 
$row[
"title"]);
 
 3735                        $result = 
$ilDB->queryF(
"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",
 
 3741                                $titles[
$row[
'question_id']] = 
$row[
"title"];
 
 3759                        return $this->lng->txt(
"ass_question");
 
 3779                $result = 
$ilDB->queryF(
"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",
 
 3798                $existing_questions = array();
 
 3803                        $result = 
$ilDB->queryF(
"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",
 
 3804                                array(
'integer',
'integer'),
 
 3805                                array($active_id, 
$pass)
 
 3810                        $result = 
$ilDB->queryF(
"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",
 
 3817                        if( 
$data->original_id === 
null )
 
 3822                        array_push($existing_questions, 
$data->original_id);
 
 3824                return $existing_questions;
 
 3838                if ($question_id < 1) 
return -1;
 
 3839                $result = 
$ilDB->queryF(
"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",
 
 3846                        return $data->type_tag;
 
 3864                $next_id = 
$ilDB->nextId(
'tst_times');
 
 3865                $affectedRows = 
$ilDB->manipulateF(
"INSERT INTO tst_times (times_id, active_fi, started, finished, pass, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
 
 3866                        array(
'integer', 
'integer', 
'timestamp', 
'timestamp', 
'integer', 
'integer'),
 
 3867                        array($next_id, $active_id, strftime(
"%Y-%m-%d %H:%M:%S"), strftime(
"%Y-%m-%d %H:%M:%S"), 
$pass, time())
 
 3882                $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_times SET finished = %s, tstamp = %s WHERE times_id = %s",
 
 3883                        array(
'timestamp', 
'integer', 
'integer'),
 
 3884                        array(strftime(
"%Y-%m-%d %H:%M:%S"), time(), $times_id)
 
 3901                        $result = 
$ilDB->queryF(
"SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
 
 3902                                array(
'integer',
'integer'),
 
 3903                                array($active_id, 0)
 
 3908                        $result = 
$ilDB->queryF(
"SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
 
 3909                                array(
'integer',
'integer'),
 
 3910                                array($active_id, 
$pass)
 
 3913                $result_array = array();
 
 3916                        array_push($result_array, 
$row[
"question_fi"]);
 
 3918                return $result_array;
 
 3932                return ((($currentpass > 0) && ($num == 0)) || $this->
isTestFinished($active_id)) ? true : 
false;
 
 3946                $result_array = array();
 
 3951                        if (count($this->questions) == 0) 
return $result_array;
 
 3956                        $result = 
$ilDB->queryF(
"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'),
 
 3957                                array(
'integer',
'integer'),
 
 3958                                array($active_id, 
$pass)
 
 3963                        if (count($this->questions) == 0) 
return $result_array;
 
 3964                        $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'));
 
 3968                        $result_array[
$row[
"question_id"]] = 
$row;
 
 3970                return $result_array;
 
 3986                        if (!$user_id) $user_id = 
$ilUser->getId();
 
 3989                                $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
 
 3990                                        array(
'integer',
'integer',
'text'),
 
 3994                        else if (strlen($anonymous_id))
 
 3996                                $result = 
$ilDB->queryF(
"SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
 
 3997                                        array(
'integer',
'integer',
'text'),
 
 3998                                        array($user_id, $this->test_id, $anonymous_id)
 
 4003                                if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
 
 4007                                $result = 
$ilDB->queryF(
"SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
 
 4008                                        array(
'integer',
'integer'),
 
 4009                                        array($user_id, $this->test_id)
 
 4015                                return $row[
"active_id"];
 
 4043                $result = 
$ilDB->queryF(
"SELECT tst_active.active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
 
 4044                        array(
'integer', 
'integer'),
 
 4050                        return $row[
"active_id"];
 
 4066                $keys = array_keys($array);
 
 4069                foreach ($keys as $key)
 
 4083        function &
getTestResult($active_id, 
$pass = NULL, $ordered_sequence = FALSE, $considerHiddenQuestions = 
true, $considerOptionalQuestions = 
true)
 
 4085                global $tree, 
$ilDB, 
$lng, $ilPluginAdmin;
 
 4089                if( is_null(
$pass) )
 
 4094                require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
 4096                $testSession = $testSessionFactory->getSession($active_id);
 
 4098                require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 4100                $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($active_id, 
$pass);
 
 4104                        require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 4106                        $dynamicQuestionSetConfig->loadFromDb();
 
 4115                        $testSequence->setConsiderHiddenQuestionsEnabled($considerHiddenQuestions);
 
 4116                        $testSequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions);
 
 4121                        if( $ordered_sequence )
 
 4131                $arrResults = array();
 
 4134                        SELECT          tst_test_result.question_fi, 
 4135                                                tst_test_result.points reached, 
 4136                                                tst_test_result.hint_count requested_hints, 
 4137                                                tst_test_result.hint_points hint_points, 
 4138                                                tst_test_result.answered answered 
 4140                        FROM            tst_test_result 
 4142                        LEFT JOIN       tst_solutions 
 4143                        ON                      tst_solutions.active_fi = tst_test_result.active_fi 
 4144                        AND                     tst_solutions.question_fi = tst_test_result.question_fi 
 4146                        WHERE           tst_test_result.active_fi = %s 
 4147                        AND                     tst_test_result.pass = %s 
 4150                $solutionresult = 
$ilDB->queryF(
 
 4151                        $query, array(
'integer', 
'integer'), array($active_id, 
$pass)
 
 4154                while( 
$row = 
$ilDB->fetchAssoc($solutionresult) )
 
 4156                        $arrResults[ 
$row[
'question_fi'] ] = 
$row;
 
 4159                $numWorkedThrough = count($arrResults);
 
 4161                require_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 4163                $IN_question_ids = 
$ilDB->in(
'qpl_questions.question_id', $sequence, 
false, 
'integer');
 
 4166                        SELECT          qpl_questions.*, 
 4167                                                qpl_qst_type.type_tag, 
 4168                                                qpl_sol_sug.question_fi has_sug_sol 
 4173                        LEFT JOIN       qpl_sol_sug 
 4174                        ON                      qpl_sol_sug.question_fi = qpl_questions.question_id 
 4176                        WHERE           qpl_qst_type.question_type_id = qpl_questions.question_type_fi 
 4177                        AND                     $IN_question_ids 
 4182                $unordered = array();
 
 4186                $obligationsAnswered = 
true;
 
 4191                                $row[
'points'] ? $arrResults[ 
$row[
'question_id'] ][
'reached'] / 
$row[
'points'] : 0
 
 4194                        if( $percentvalue < 0 ) $percentvalue = 0.0;
 
 4199                                "max" => round(
$row[
'points'], 2),
 
 4200                                "reached" => round($arrResults[
$row[
'question_id']][
'reached'],2),
 
 4201                                'requested_hints' => $arrResults[
$row[
'question_id']][
'requested_hints'],
 
 4202                                'hint_points' => $arrResults[
$row[
'question_id']][
'hint_points'],
 
 4203                                "percent" => sprintf(
"%2.2f ", ($percentvalue) * 100) . 
"%",
 
 4205                                "type" => 
$row[
"type_tag"],
 
 4206                                "qid" => 
$row[
'question_id'],
 
 4207                                "original_id" => 
$row[
"original_id"],
 
 4208                                "workedthrough" => isset($arrResults[
$row[
'question_id']]) ? 1 : 0,
 
 4209                                'answered' => $arrResults[
$row[
'question_id']][
'answered']
 
 4212                        if( !$arrResults[ 
$row[
'question_id'] ][
'answered'] )
 
 4214                                $obligationsAnswered = 
false;
 
 4217                        $unordered[ 
$row[
'question_id'] ] = 
$data;
 
 4222                $numQuestionsTotal = count($unordered);
 
 4226                $pass_requested_hints = 0;
 
 4227                $pass_hint_points = 0;
 
 4232                foreach( $sequence as $qid )
 
 4236                        $pass_max += round($unordered[$qid][
'max'], 2);
 
 4237                        $pass_reached += round($unordered[$qid][
'reached'], 2);
 
 4238                        $pass_requested_hints += $unordered[$qid][
'requested_hints'];
 
 4239                        $pass_hint_points += $unordered[$qid][
'hint_points'];
 
 4243                        $unordered[$qid][
'nr'] = $key;
 
 4244                        array_push($found, $unordered[$qid]);
 
 4254                        if( 
$results[
'reached_points'] < 0 )
 
 4259                        if( $pass_reached < 0 ) $pass_reached = 0;
 
 4262                $found[
'pass'][
'total_max_points'] = $pass_max;
 
 4263                $found[
'pass'][
'total_reached_points'] = $pass_reached;
 
 4264                $found[
'pass'][
'total_requested_hints'] = $pass_requested_hints;
 
 4265                $found[
'pass'][
'total_hint_points'] = $pass_hint_points;
 
 4266                $found[
'pass'][
'percent'] = ($pass_max > 0) ? $pass_reached / $pass_max : 0;
 
 4267                $found[
'pass'][
'obligationsAnswered'] = $obligationsAnswered;
 
 4268                $found[
'pass'][
'num_workedthrough'] = $numWorkedThrough;
 
 4269                $found[
'pass'][
'num_questions_total'] = $numQuestionsTotal;
 
 4271                $found[
"test"][
"total_max_points"] = 
$results[
'max_points'];
 
 4272                $found[
"test"][
"total_reached_points"] = 
$results[
'reached_points'];
 
 4273                $found[
"test"][
"total_requested_hints"] = 
$results[
'hint_count'];
 
 4274                $found[
"test"][
"total_hint_points"] = 
$results[
'hint_points'];
 
 4275                $found[
"test"][
"result_pass"] = 
$results[
'pass'];
 
 4276                $found[
'test'][
'obligations_answered'] = 
$results[
'obligations_answered'];
 
 4278                if( (!$total_reached_points) or (!$total_max_points) )
 
 4284                        $percentage = ($total_reached_points / $total_max_points) * 100.0;
 
 4286                        if( $percentage < 0 ) $percentage = 0.0;
 
 4289                $found[
"test"][
"passed"] = 
$results[
'passed'];
 
 4304                $result = 
$ilDB->queryF(
"SELECT COUNT(active_id) total FROM tst_active WHERE test_fi = %s",
 
 4309                return $row[
"total"];
 
 4322                $result = 
$ilDB->queryF(
"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",
 
 4323                        array(
'integer',
'integer'),
 
 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                        $time += ($epoch_2 - $epoch_1);
 
 4360                $result = 
$ilDB->queryF(
"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",
 
 4368                        if (!array_key_exists(
$row[
"active_fi"], $times))
 
 4370                                $times[
$row[
"active_fi"]] = 0;
 
 4372                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"started"], $matches);
 
 4373                        $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4374                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"finished"], $matches);
 
 4375                        $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4376                        $times[
$row[
"active_fi"]] += ($epoch_2 - $epoch_1);
 
 4391                $result = 
$ilDB->queryF(
"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",
 
 4392                        array(
'integer',
'integer'),
 
 4398                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"started"], $matches);
 
 4399                        $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4400                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"finished"], $matches);
 
 4401                        $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4402                        $time += ($epoch_2 - $epoch_1);
 
 4417                $result = 
$ilDB->queryF(
"SELECT * FROM tst_times WHERE active_fi = %s AND pass = %s ORDER BY started",
 
 4418                        array(
'integer',
'integer'),
 
 4419                        array($active_id, 
$pass)
 
 4424                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"started"], $matches);
 
 4425                        $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4426                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"finished"], $matches);
 
 4427                        $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4428                        $time += ($epoch_2 - $epoch_1);
 
 4457                $result = 
$ilDB->queryF(
"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",
 
 4458                        array(
'integer',
'integer'),
 
 4465                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"started"], $matches);
 
 4466                        $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4467                        if ($firstvisit == 0 || $epoch_1 < $firstvisit) $firstvisit = $epoch_1;
 
 4468                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"finished"], $matches);
 
 4469                        $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4470                        if ($epoch_2 > $lastvisit) $lastvisit = $epoch_2;
 
 4472                return array(
"firstvisit" => $firstvisit, 
"lastvisit" => $lastvisit);
 
 4487                $result = 
$ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.active_id = %s AND tst_active.active_id = tst_times.active_fi",
 
 4496                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row->started, $matches);
 
 4497                        $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4498                        if (!$first_visit) {
 
 4499                                $first_visit = $epoch_1;
 
 4501                        if ($epoch_1 < $first_visit) {
 
 4502                                $first_visit = $epoch_1;
 
 4504                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row->finished, $matches);
 
 4505                        $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4507                                $last_visit = $epoch_2;
 
 4509                        if ($epoch_2 > $last_visit) {
 
 4510                                $last_visit = $epoch_2;
 
 4512                        $times[
$row->active_fi] += ($epoch_2 - $epoch_1);
 
 4515                foreach ($times as $key => $value) {
 
 4516                        $max_time += $value;
 
 4518                if ((!$test_result[
"test"][
"total_reached_points"]) or (!$test_result[
"test"][
"total_max_points"]))
 
 4524                        $percentage = ($test_result[
"test"][
"total_reached_points"] / $test_result[
"test"][
"total_max_points"]) * 100.0;
 
 4525                        if ($percentage < 0) $percentage = 0.0;
 
 4527                $mark_obj = $this->mark_schema->getMatchingMark($percentage);
 
 4528                $first_date = getdate($first_visit);
 
 4529                $last_date = getdate($last_visit);
 
 4530                $qworkedthrough = 0;
 
 4531                foreach ($test_result as $key => $value)
 
 4533                        if (preg_match(
"/\d+/", $key))
 
 4535                                $qworkedthrough += $value[
"workedthrough"];
 
 4538                if (!$qworkedthrough)
 
 4544                        $atimeofwork = $max_time / $qworkedthrough;
 
 4547                $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
 
 4554                        $result_mark = $mark_obj->getShortName();
 
 4556                        if( $mark_obj->getPassed() && $obligationsAnswered )
 
 4565                $percent_worked_through = 0;
 
 4566                if (count($this->questions))
 
 4568                        $percent_worked_through = $qworkedthrough / count($this->questions);
 
 4570                $result_array = array(
 
 4571                        "qworkedthrough" => $qworkedthrough,
 
 4572                        "qmax" => count($this->questions),
 
 4573                        "pworkedthrough" => $percent_worked_through,
 
 4574                        "timeofwork" => $max_time,
 
 4575                        "atimeofwork" => $atimeofwork,
 
 4576                        "firstvisit" => $first_date,
 
 4577                        "lastvisit" => $last_date,
 
 4578                        "resultspoints" => $test_result[
"test"][
"total_reached_points"],
 
 4579                        "maxpoints" => $test_result[
"test"][
"total_max_points"],
 
 4580                        "resultsmarks" => $result_mark,
 
 4581                        "passed" => $passed,
 
 4582                        "distancemedian" => 
"0" 
 4584                foreach ($test_result as $key => $value)
 
 4586                        if (preg_match(
"/\d+/", $key))
 
 4588                                $result_array[$key] = $value;
 
 4591                return $result_array;
 
 4603                $totalpoints_array = array();
 
 4605                foreach ($all_users as $active_id => $user_name)
 
 4608                        $reached = $test_result[
"test"][
"total_reached_points"];
 
 4609                        $total = $test_result[
"test"][
"total_max_points"];
 
 4611                        $mark = $this->mark_schema->getMatchingMark($percentage*100.0);
 
 4613                        $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
 
 4617                                if( $mark->getPassed() && $obligationsAnswered )
 
 4619                                        array_push($totalpoints_array, $test_result[
"test"][
"total_reached_points"]);
 
 4623                return $totalpoints_array;
 
 4634                $result = 
$ilDB->queryF(
"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",
 
 4638                $persons_array = array();
 
 4641                        $name = $this->lng->txt(
"anonymous");
 
 4642                        $fullname = $this->lng->txt(
"anonymous");
 
 4646                                if (strlen(
$row[
"firstname"].
$row[
"lastname"].
$row[
"title"]) == 0)
 
 4648                                        $name = $this->lng->txt(
"deleted_user");
 
 4649                                        $fullname = $this->lng->txt(
"deleted_user");
 
 4650                                        $login = $this->lng->txt(
"unknown");
 
 4654                                        $login = 
$row[
"login"];
 
 4655                                        if (
$row[
"user_fi"] == ANONYMOUS_USER_ID)
 
 4657                                                $name = $this->lng->txt(
"anonymous");
 
 4658                                                $fullname = $this->lng->txt(
"anonymous");
 
 4662                                                $name = trim(
$row[
"lastname"] . 
", " . 
$row[
"firstname"] . 
" " .  
$row[
"title"]);
 
 4663                                                $fullname = trim(
$row[
"title"] . 
" " . 
$row[
"firstname"] . 
" " .  
$row[
"lastname"]);
 
 4667                        $persons_array[
$row[
"active_id"]] = array(
 
 4669                                "fullname" => $fullname,
 
 4673                return $persons_array;
 
 4685                $result = 
$ilDB->queryF(
"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),
 
 4689                $persons_array = array();
 
 4694                                $persons_array[
$row[
"active_id"]] = $this->lng->txt(
"anonymous");
 
 4698                                if (strlen(
$row[
"firstname"].
$row[
"lastname"].
$row[
"title"]) == 0)
 
 4700                                        $persons_array[
$row[
"active_id"]] = $this->lng->txt(
"deleted_user");
 
 4704                                        if (
$row[
"user_fi"] == ANONYMOUS_USER_ID)
 
 4706                                                $persons_array[
$row[
"active_id"]] = 
$row[
"lastname"];
 
 4710                                                $persons_array[
$row[
"active_id"]] = trim(
$row[
"lastname"] . 
", " . 
$row[
"firstname"] . 
" " .  
$row[
"title"]);
 
 4715                return $persons_array;
 
 4727                $result = 
$ilDB->queryF(
"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),
 
 4731                $persons_array = array();
 
 4736                                $persons_array[
$row[
"active_id"]] = array(
"name" => $this->lng->txt(
"anonymous"));
 
 4740                                if (strlen(
$row[
"firstname"].
$row[
"lastname"].
$row[
"title"]) == 0)
 
 4742                                        $persons_array[
$row[
"active_id"]] = array(
"name" => $this->lng->txt(
"deleted_user"));
 
 4746                                        if (
$row[
"user_fi"] == ANONYMOUS_USER_ID)
 
 4748                                                $persons_array[
$row[
"active_id"]] = array(
"name" => 
$row[
"lastname"]);
 
 4752                                                $persons_array[
$row[
"active_id"]] = array(
"name" => trim(
$row[
"lastname"] . 
", " . 
$row[
"firstname"] . 
" " .  
$row[
"title"]), 
"login" => 
$row[
"login"]);
 
 4757                return $persons_array;
 
 4770                $result = 
$ilDB->queryF(
"SELECT COUNT(active_id) total FROM tst_active WHERE test_fi = %s AND submitted = %s",
 
 4771                        array(
'integer', 
'integer'),
 
 4775                return $row[
"total"];
 
 4790                        $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
 
 4791                                "tst_test_rnd_qst.pass, qpl_questions.points " .
 
 4792                                "FROM tst_test_rnd_qst, qpl_questions " .
 
 4793                                "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
 
 4794                                "AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence",
 
 4801                        $result = 
$ilDB->queryF(
"SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
 
 4802                                "qpl_questions.points " .
 
 4803                                "FROM tst_test_question, tst_active, qpl_questions " .
 
 4804                                "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
 
 4805                                "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
 
 4815                                array_push($qtest, 
$row);
 
 4833                        $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
 
 4834                                "qpl_questions.points " .
 
 4835                                "FROM tst_test_rnd_qst, qpl_questions " .
 
 4836                                "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
 
 4837                                "AND tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.pass = %s " .
 
 4838                                "ORDER BY tst_test_rnd_qst.sequence",
 
 4839                                array(
'integer', 
'integer'),
 
 4840                                array($active_id, 
$pass)
 
 4845                        $result = 
$ilDB->queryF(
"SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
 
 4846                                "qpl_questions.points " .
 
 4847                                "FROM tst_test_question, tst_active, qpl_questions " .
 
 4848                                "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
 
 4849                                "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
 
 4859                                array_push($qpass, 
$row);
 
 4869                include_once 
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
 
 4870                include_once 
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
 
 4871                include_once 
"./Modules/Test/classes/class.ilTestEvaluationData.php";
 
 4876                        SELECT          tst_test_result.*, 
 4877                                                qpl_questions.original_id, 
 4878                                                qpl_questions.title questiontitle, 
 4879                                                qpl_questions.points maxpoints 
 4881                        FROM            tst_test_result, qpl_questions, tst_active 
 4883                        WHERE           tst_active.active_id = tst_test_result.active_fi 
 4884                        AND                     qpl_questions.question_id = tst_test_result.question_fi 
 4885                        AND                     tst_active.test_fi = %s 
 4887                        ORDER BY        tst_active.active_id ASC, tst_test_result.pass ASC, tst_test_result.tstamp DESC 
 4897                $questionData  = array();
 
 4901                        $participantObject = 
$data->getParticipant(
$row[
"active_fi"]);
 
 4908                        $passObject = $participantObject->getPass(
$row[
"pass"]);
 
 4915                        $passObject->addAnsweredQuestion(
 
 4920                foreach( array_keys(
$data->getParticipants()) as $active_id )
 
 4924                                for( $testpass = 0; $testpass <= 
$data->getParticipant($active_id)->getLastPass(); $testpass++ )
 
 4927                                        $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, qpl_questions.original_id, " .
 
 4928                                                "tst_test_rnd_qst.pass, qpl_questions.points, qpl_questions.title " .
 
 4929                                                "FROM tst_test_rnd_qst, qpl_questions " .
 
 4930                                                "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
 
 4931                                                "AND tst_test_rnd_qst.pass = %s " .
 
 4932                                                "AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence",
 
 4933                                                array(
'integer',
'integer'),
 
 4934                                                array($testpass, $active_id)
 
 4940                                                        $tpass = array_key_exists(
"pass", 
$row) ? 
$row[
"pass"] : 0;
 
 4941                                                        $data->getParticipant($active_id)->addQuestion(
$row[
"original_id"], 
$row[
"question_fi"], 
$row[
"points"], 
$row[
"sequence"], $tpass);
 
 4942                                                        $data->addQuestionTitle(
$row[
"question_fi"], 
$row[
"title"]);
 
 4949                                require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 4950                                require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 4951                                require_once 
'Modules/Test/classes/class.ilTestDynamicQuestionSetFilterSelection.php';
 
 4953                                $lastPass = 
$data->getParticipant($active_id)->getLastPass();
 
 4954                                for($testpass = 0; $testpass <= $lastPass; $testpass++)
 
 4956                                        require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 4960                                        $dynamicQuestionSetConfig->loadFromDb();
 
 4962                                        require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 4964                                        $testSequence        = $testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $testpass);
 
 4969                                        $sequence = (array)
$testSequence->getUserSequenceQuestions();
 
 4971                                        $questionsIdsToRequest = array_diff(array_values($sequence), array_values($questionData));
 
 4972                                        if(count($questionsIdsToRequest) > 0)
 
 4974                                                $questionIdsCondition = 
' ' . 
$ilDB->in(
'question_id', array_values($questionsIdsToRequest), 
false, 
'integer') . 
' ';
 
 4979                                                        WHERE {$questionIdsCondition}",
 
 4985                                                        $questionData[
$row[
'question_id']] = 
$row;
 
 4986                                                        $data->addQuestionTitle(
$row[
'question_id'], 
$row[
'title']);
 
 4990                                        foreach($sequence as $questionId)
 
 4992                                                if(!isset($questionData[$questionId]))
 
 4997                                                $row = $questionData[$questionId];
 
 4999                                                $data->getParticipant(
 
 5000                                                        $active_id)->addQuestion(
$row[
'original_id'], 
$row[
'question_id'], 
$row[
'points'],
 
 5008                                $result = 
$ilDB->queryF(
"SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
 
 5009                                        "qpl_questions.points, qpl_questions.title, qpl_questions.original_id " .
 
 5010                                        "FROM tst_test_question, tst_active, qpl_questions " .
 
 5011                                        "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
 
 5012                                        "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi ORDER BY tst_test_question.sequence",
 
 5018                                        $questionsbysequence = array();
 
 5022                                                $questionsbysequence[
$row[
"sequence"]] = 
$row;
 
 5025                                        $seqresult = 
$ilDB->queryF(
"SELECT * FROM tst_sequence WHERE active_fi = %s",
 
 5030                                        while ($seqrow = 
$ilDB->fetchAssoc($seqresult))
 
 5032                                                $questionsequence = unserialize($seqrow[
"sequence"]);
 
 5033                                                foreach ($questionsequence as $sidx => $seq)
 
 5035                                                        $data->getParticipant($active_id)->addQuestion($questionsbysequence[$seq][
"original_id"], $questionsbysequence[$seq][
"question_fi"], $questionsbysequence[$seq][
"points"], $sidx + 1, $seqrow[
"pass"]);
 
 5036                                                        $data->addQuestionTitle($questionsbysequence[$seq][
"question_fi"], $questionsbysequence[$seq][
"title"]);
 
 5048                foreach( array_keys(
$data->getParticipants()) as $active_id )
 
 5050                        $tstUserData = 
$data->getParticipant($active_id);
 
 5052                        $percentage = $tstUserData->getReachedPointsInPercent();
 
 5054                        $obligationsAnswered = $tstUserData->areObligationsAnswered();
 
 5056                        $mark = $this->mark_schema->getMatchingMark($percentage);
 
 5058                        if (is_object($mark))
 
 5060                                $tstUserData->setMark($mark->getShortName());
 
 5061                                $tstUserData->setMarkOfficial($mark->getOfficialName());
 
 5063                                $tstUserData->setPassed(
 
 5064                                        $mark->getPassed() && $tstUserData->areObligationsAnswered()
 
 5071                                                $passed_array, $tstUserData->getReached(), $tstUserData->getMaxPoints()
 
 5074                                $tstUserData->setECTSMark($ects_mark);
 
 5079                        $tstUserData->setFirstVisit($visitingTime[
"firstvisit"]);
 
 5080                        $tstUserData->setLastVisit($visitingTime[
"lastvisit"]);
 
 5097                                                SELECT          COUNT(qpl_questions.question_id) qcount, 
 5098                                                                        SUM(qpl_questions.points) qsum 
 5100                                                INNER JOIN      tst_tests 
 5101                                                ON                      tst_tests.test_id = tst_active.test_fi 
 5102                                                INNER JOIN      tst_dyn_quest_set_cfg 
 5103                                                ON          tst_dyn_quest_set_cfg.test_fi = tst_tests.test_id 
 5104                                                INNER JOIN  qpl_questions 
 5105                                                ON          qpl_questions.obj_fi = tst_dyn_quest_set_cfg.source_qpl_fi 
 5106                                                AND         qpl_questions.original_id IS NULL 
 5107                                                AND         qpl_questions.complete = %s 
 5108                                                WHERE           tst_active.active_id = %s 
 5110                                        array(
'integer', 
'integer'),
 
 5111                                        array(1, $active_id)
 
 5119                                                SELECT          tst_test_rnd_qst.pass, 
 5120                                                                        COUNT(tst_test_rnd_qst.question_fi) qcount, 
 5121                                                                        SUM(qpl_questions.points) qsum 
 5123                                                FROM            tst_test_rnd_qst, 
 5126                                                WHERE           tst_test_rnd_qst.question_fi = qpl_questions.question_id 
 5127                                                AND                     tst_test_rnd_qst.active_fi = %s 
 5130                                                GROUP BY        tst_test_rnd_qst.active_fi, 
 5131                                                                        tst_test_rnd_qst.pass 
 5133                                        array(
'integer', 
'integer'),
 
 5134                                        array($active_id, 
$pass)
 
 5142                                                SELECT          COUNT(tst_test_question.question_fi) qcount, 
 5143                                                                        SUM(qpl_questions.points) qsum 
 5145                                                FROM            tst_test_question, 
 5149                                                WHERE           tst_test_question.question_fi = qpl_questions.question_id 
 5150                                                AND                     tst_test_question.test_fi = tst_active.test_fi 
 5151                                                AND                     tst_active.active_id = %s 
 5153                                                GROUP BY        tst_test_question.test_fi 
 5163                                throw new ilTestException(
"not supported question set type: $questionSetType");
 
 5168                if( is_array(
$row) )
 
 5170                        return array(
"count" => 
$row[
"qcount"], 
"points" => 
$row[
"qsum"]);
 
 5173                return array(
"count" => 0, 
"points" => 0);
 
 5178                include_once 
"./Modules/Test/classes/class.ilTestEvaluationData.php";
 
 5179                include_once 
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
 
 5180                include_once 
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
 
 5182                if ($withStatistics)
 
 5184                        $data->calculateStatistics();
 
 5186                $data->setFilter($filterby, $filtertext);
 
 5211                $result = 
$ilDB->queryF(
"SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
 
 5212                        "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
 
 5213                        "qpl_questions.points maxpoints " .
 
 5214                        "FROM tst_test_result, qpl_questions, tst_active " .
 
 5215                        "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
 
 5216                        "WHERE tst_active.active_id = tst_test_result.active_fi " .
 
 5217                        "AND qpl_questions.question_id = tst_test_result.question_fi " .
 
 5218                        "AND tst_active.test_fi = %s " .
 
 5219                        "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
 
 5223                $overview = array();
 
 5226                        if (!array_key_exists(
$row[
"active_fi"], $overview))
 
 5228                                $overview[
$row[
"active_fi"]] = array();
 
 5229                                $overview[
$row[
"active_fi"]][
"firstname"] = 
$row[
"firstname"];
 
 5230                                $overview[
$row[
"active_fi"]][
"lastname"] = 
$row[
"lastname"];
 
 5231                                $overview[
$row[
"active_fi"]][
"title"] = 
$row[
"title"];
 
 5232                                $overview[
$row[
"active_fi"]][
"login"] = 
$row[
"login"];
 
 5233                                $overview[
$row[
"active_fi"]][
"usr_id"] = 
$row[
"usr_id"];
 
 5234                                $overview[
$row[
"active_fi"]][
"started"] = 
$row[
"started"];
 
 5235                                $overview[
$row[
"active_fi"]][
"finished"] = 
$row[
"finished"];
 
 5237                        if (!array_key_exists(
$row[
"pass"], $overview[
$row[
"active_fi"]]))
 
 5239                                $overview[
$row[
"active_fi"]][
$row[
"pass"]] = array();
 
 5240                                $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"reached"] = 0;
 
 5241                                $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"maxpoints"] = 
$row[
"maxpoints"];
 
 5243                        array_push($overview[
$row[
"active_fi"]][
$row[
"pass"]], 
$row);
 
 5244                        $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"reached"] += 
$row[
"points"];
 
 5260                $result = 
$ilDB->queryF(
"SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
 
 5261                        "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
 
 5262                        "qpl_questions.points maxpoints " .
 
 5263                        "FROM tst_test_result, qpl_questions, tst_active " .
 
 5264                        "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
 
 5265                        "WHERE tst_active.active_id = tst_test_result.active_fi " .
 
 5266                        "AND qpl_questions.question_id = tst_test_result.question_fi " .
 
 5267                        "AND tst_active.test_fi = %s AND tst_active.active_id = %s" .
 
 5268                        "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
 
 5269                        array(
'integer', 
'integer'),
 
 5272                $overview = array();
 
 5275                        if (!array_key_exists(
$row[
"active_fi"], $overview))
 
 5277                                $overview[
$row[
"active_fi"]] = array();
 
 5278                                $overview[
$row[
"active_fi"]][
"firstname"] = 
$row[
"firstname"];
 
 5279                                $overview[
$row[
"active_fi"]][
"lastname"] = 
$row[
"lastname"];
 
 5280                                $overview[
$row[
"active_fi"]][
"title"] = 
$row[
"title"];
 
 5281                                $overview[
$row[
"active_fi"]][
"login"] = 
$row[
"login"];
 
 5282                                $overview[
$row[
"active_fi"]][
"usr_id"] = 
$row[
"usr_id"];
 
 5283                                $overview[
$row[
"active_fi"]][
"started"] = 
$row[
"started"];
 
 5284                                $overview[
$row[
"active_fi"]][
"finished"] = 
$row[
"finished"];
 
 5286                        if (!array_key_exists(
$row[
"pass"], $overview[
$row[
"active_fi"]]))
 
 5288                                $overview[
$row[
"active_fi"]][
$row[
"pass"]] = array();
 
 5289                                $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"reached"] = 0;
 
 5290                                $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"maxpoints"] = 
$row[
"maxpoints"];
 
 5292                        array_push($overview[
$row[
"active_fi"]][
$row[
"pass"]], 
$row);
 
 5293                        $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"reached"] += 
$row[
"points"];
 
 5312                if (strlen($firstname.$lastname.$title) == 0)
 
 5314                        $name = $this->lng->txt(
"deleted_user");
 
 5318                        if ($user_id == ANONYMOUS_USER_ID)
 
 5324                                $name = trim($lastname . 
", " . $firstname . 
" " .  
$title);
 
 5328                                $name = $this->lng->txt(
"anonymous");
 
 5350                if (strlen($firstname.$lastname.$title) == 0)
 
 5352                        $name = 
$lng->txt(
"deleted_user");
 
 5356                        if ($user_id == ANONYMOUS_USER_ID)
 
 5362                                $name = trim($lastname . 
", " . $firstname . 
" " .  
$title);
 
 5366                                $name = 
$lng->txt(
"anonymous");
 
 5382                $result = 
$ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi",
 
 5389                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row->started, $matches);
 
 5390                        $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 5391                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row->finished, $matches);
 
 5392                        $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 5393                        $times[
$row->active_fi] += ($epoch_2 - $epoch_1);
 
 5397                foreach ($times as $key => $value)
 
 5399                        $max_time += $value;
 
 5404                        $average_time = round($max_time / $counter);
 
 5410                return $average_time;
 
 5419        function &
getAvailableQuestionpools($use_object_id = 
false, $equal_points = 
false, $could_be_offline = 
false, $show_path = FALSE, $with_questioncount = FALSE, $permission = 
"read")
 
 5421                include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 5433                $time_in_seconds = 0;
 
 5434                foreach ($this->questions as $question_id)
 
 5437                        $est_time = $question->getEstimatedWorkingTime();
 
 5438                        $time_in_seconds += $est_time[
"h"] * 3600 + $est_time[
"m"] * 60 + $est_time[
"s"];
 
 5440                $hours = (int)($time_in_seconds / 3600) ;
 
 5441                $time_in_seconds = $time_in_seconds - ($hours * 3600);
 
 5442                $minutes = (int)($time_in_seconds / 60);
 
 5443                $time_in_seconds = $time_in_seconds - ($minutes * 60);
 
 5444                $result = array(
"hh" => $hours, 
"mm" => $minutes, 
"ss" => $time_in_seconds);
 
 5456                return CLIENT_WEB_DIR . 
"/assessment/" . $this->
getId() . 
"/images/";
 
 5467                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 5482                if ((!$question_type) and ($question_id > 0))
 
 5487                if (!strlen($question_type)) 
return null;
 
 5489                include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 5493                $question = 
new $question_type_gui();
 
 5495                if ($question_id > 0)
 
 5497                        $question->object->loadFromDb($question_id);
 
 5502                        $question->object->feedbackOBJ = 
new $feedbackObjectClassname($question->object, 
$ilCtrl, 
$ilDB, 
$lng);
 
 5504                        $assSettings = 
new ilSetting(
'assessment');
 
 5505                        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
 
 5507                        $processLockerFactory->setQuestionId($question->object->getId());
 
 5508                        $processLockerFactory->setUserId(
$ilUser->getId());
 
 5509                        include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 5511                        $question->object->setProcessLocker($processLockerFactory->getLocker());
 
 5528                if (strcmp($question_id, 
"") != 0)
 
 5530                        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 5545                $this->questions = array_values($this->questions);
 
 5546                $array_pos = array_search($target_index, $this->questions);
 
 5547                if ($insert_mode == 0)
 
 5549                        $part1 = array_slice($this->questions, 0, $array_pos);
 
 5550                        $part2 = array_slice($this->questions, $array_pos);
 
 5552                else if ($insert_mode == 1)
 
 5554                        $part1 = array_slice($this->questions, 0, $array_pos + 1);
 
 5555                        $part2 = array_slice($this->questions, $array_pos + 1);
 
 5557                foreach ($move_questions as $question_id)
 
 5559                        if (!(array_search($question_id, $part1) === FALSE))
 
 5561                                unset($part1[array_search($question_id, $part1)]);
 
 5563                        if (!(array_search($question_id, $part2) === FALSE))
 
 5565                                unset($part2[array_search($question_id, $part2)]);
 
 5568                $part1 = array_values($part1);
 
 5569                $part2 = array_values($part2);
 
 5570                $new_array = array_values(array_merge($part1, $move_questions, $part2));
 
 5571                $this->questions = array();
 
 5573                foreach ($new_array as $question_id)
 
 5575                        $this->questions[$counter] = $question_id;
 
 5593                        if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getStartingTime(), $matches))
 
 5595                                $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 5597                                if ($now < $epoch_time)
 
 5618                        if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getEndingTime(), $matches))
 
 5620                                $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 5622                                if ($now > $epoch_time)
 
 5642                include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 5645                if (count($available_pools))
 
 5647                        $available = 
" AND " . 
$ilDB->in(
'qpl_questions.obj_fi', $available_pools, 
false, 
'integer');
 
 5655                        $available .= 
" AND qpl_questions.complete = " . 
$ilDB->quote(
"1", 
'text');
 
 5659                if (is_array($arrFilter))
 
 5661                        if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title']))
 
 5663                                $where .= 
" AND " . 
$ilDB->like(
'qpl_questions.title', 
'text', 
"%%" . $arrFilter[
'title'] . 
"%%");
 
 5665                        if (array_key_exists(
'description', $arrFilter) && strlen($arrFilter[
'description']))
 
 5667                                $where .= 
" AND " . 
$ilDB->like(
'qpl_questions.description', 
'text', 
"%%" . $arrFilter[
'description'] . 
"%%");
 
 5669                        if (array_key_exists(
'author', $arrFilter) && strlen($arrFilter[
'author']))
 
 5671                                $where .= 
" AND " . 
$ilDB->like(
'qpl_questions.author', 
'text', 
"%%" . $arrFilter[
'author'] . 
"%%");
 
 5673                        if (array_key_exists(
'type', $arrFilter) && strlen($arrFilter[
'type']))
 
 5675                                $where .= 
" AND qpl_qst_type.type_tag = " . 
$ilDB->quote($arrFilter[
'type'], 
'text');
 
 5677                        if (array_key_exists(
'qpl', $arrFilter) && strlen($arrFilter[
'qpl']))
 
 5679                                $where .= 
" AND " . 
$ilDB->like(
'object_data.title', 
'text', 
"%%" . $arrFilter[
'qpl'] . 
"%%");
 
 5684                $original_clause = 
" qpl_questions.original_id IS NULL";
 
 5685                if (count($original_ids))
 
 5687                        $original_clause = 
" qpl_questions.original_id IS NULL AND " . 
$ilDB->in(
'qpl_questions.question_id',  $original_ids, 
true, 
'integer');
 
 5690                $query_result = 
$ilDB->query(
 
 5691                        "SELECT qpl_questions.*, qpl_questions.tstamp, qpl_qst_type.type_tag, qpl_qst_type.plugin, object_data.title qpl " .
 
 5692                        "FROM qpl_questions, qpl_qst_type, object_data WHERE $original_clause $available AND " .
 
 5693                        "object_data.obj_id = qpl_questions.obj_fi AND qpl_questions.tstamp > 0 AND " .
 
 5694                        "qpl_questions.question_type_fi = qpl_qst_type.question_type_id$where");
 
 5697                if ($query_result->numRows())
 
 5699                        while (
$row = 
$ilDB->fetchAssoc($query_result))
 
 5701                                $row[
'ttype'] = $types[
$row[
'type_tag']];
 
 5706                                                array_push($rows, 
$row);
 
 5711                                        array_push($rows, 
$row);
 
 5723                global $ilPluginAdmin;
 
 5725                $lng->loadLanguageModule(
"assessment");
 
 5730                        if (
$row[
"plugin"] == 0)
 
 5732                                $types[
$row[
'type_tag']] = 
$lng->txt(
$row[
"type_tag"]);
 
 5736                                $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE, 
"TestQuestionPool", 
"qst");
 
 5737                                foreach ($pl_names as $pl_name)
 
 5740                                        if (strcmp($pl->getQuestionType(), 
$row[
"type_tag"]) == 0)
 
 5742                                                $types[
$row[
'type_tag']] = $pl->getQuestionTypeTranslation();
 
 5763                foreach ($assessment->objectives as $objectives)
 
 5765                        foreach ($objectives->materials as $material)
 
 5782                foreach ($assessment->assessmentcontrol as $assessmentcontrol)
 
 5784                        switch ($assessmentcontrol->getSolutionswitch())
 
 5800                foreach ($assessment->qtimetadata as 
$metadata)
 
 5827                                case "sequence_settings":
 
 5830                                case "solution_details":
 
 5833                                case "print_bs_with_res":
 
 5843                                        $this->
setKiosk($metadata[
"entry"]);
 
 5845                                case "showfinalstatement":
 
 5858                                case "highscore_enabled":
 
 5862                                case "highscore_anon":
 
 5866                                case "highscore_achieved_ts":
 
 5870                                case "highscore_score":
 
 5874                                case "highscore_percentage":
 
 5878                                case "highscore_hints":
 
 5882                                case "highscore_wtime":
 
 5886                                case "highscore_own_table":
 
 5890                                case "highscore_top_table":
 
 5894                                case "highscore_top_num":
 
 5898                                case "hide_previous_results":
 
 5908                                case "use_previous_answers":
 
 5911                                case "answer_feedback":
 
 5914                                case "hide_title_points":
 
 5917                                case "title_output":
 
 5920                                case "question_set_type":
 
 5933                                case "results_presentation":
 
 5936                                case "reset_processing_time":
 
 5939                                case "instant_verification":
 
 5942                                case "instant_feedback_answer_fixation":
 
 5945                                case "force_instant_feedback":
 
 5948                                case "answer_feedback_points":
 
 5963                                case "fixed_participants":
 
 5966                                case "score_reporting":
 
 5969                                case "shuffle_questions":
 
 5972                                case "count_system":
 
 5978                                case "mailnotification":
 
 5984                                case "exportsettings":
 
 5987                                case "score_cutting":
 
 5994                                case "allowedUsers":
 
 5998                                case "allowedUsersTimeGap":
 
 6001                                case "pass_scoring":
 
 6004                                case 'pass_deletion_allowed':
 
 6007                                case "show_summary":
 
 6010                                case "reporting_date":
 
 6012                                        if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
 
 6014                                                $this->
setReportingDate(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
 
 6017                                case 'enable_processing_time': 
 
 6020                                case "processing_time": 
 
 6023                                case "starting_time":
 
 6025                                        if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
 
 6027                                                $this->
setStartingTime(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
 
 6033                                        if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
 
 6035                                                $this->
setEndingTime(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
 
 6039                                case "enable_examview":
 
 6042                                case 'show_examview_html':
 
 6045                                case 'show_examview_pdf':
 
 6048                                case 'redirection_mode':
 
 6051                                case 'redirection_url':
 
 6054                                case 'examid_in_kiosk':
 
 6055                                case 'examid_in_test_pass':
 
 6058                                case 'show_exam_id':
 
 6059                                case 'examid_in_test_res':
 
 6062                                case 'enable_archiving':
 
 6065                                case 'sign_submission':
 
 6068                                case 'char_selector_availability':
 
 6071                                case 'char_selector_definition':
 
 6074                                case 'skill_service':
 
 6077                                case 'result_tax_filters':
 
 6080                                case 'show_grading_status':
 
 6083                                case 'show_grading_mark':
 
 6086                                case 'activation_limited': 
 
 6089                                case 'activation_start_time':
 
 6092                                case 'activation_end_time': 
 
 6095                                case 'activation_visibility': 
 
 6101                                case 'autosave_ival': 
 
 6104                                case 'offer_question_hints': 
 
 6107                                case 'instant_feedback_specific': 
 
 6110                                case 'obligations_enabled': 
 
 6114                        if (preg_match(
"/mark_step_\d+/", 
$metadata[
"label"]))
 
 6117                                preg_match(
"/<short>(.*?)<\/short>/", $xmlmark, $matches);
 
 6118                                $mark_short = $matches[1];
 
 6119                                preg_match(
"/<official>(.*?)<\/official>/", $xmlmark, $matches);
 
 6120                                $mark_official = $matches[1];
 
 6121                                preg_match(
"/<percentage>(.*?)<\/percentage>/", $xmlmark, $matches);
 
 6122                                $mark_percentage = $matches[1];
 
 6123                                preg_match(
"/<passed>(.*?)<\/passed>/", $xmlmark, $matches);
 
 6124                                $mark_passed = $matches[1];
 
 6125                                $this->mark_schema->addMarkStep($mark_short, $mark_official, $mark_percentage, $mark_passed);
 
 6129                if (is_array(
$_SESSION[
"import_mob_xhtml"]))
 
 6131                        include_once 
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
 
 6132                        include_once 
"./Services/RTE/classes/class.ilRTE.php";
 
 6133                        include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 6134                        foreach (
$_SESSION[
"import_mob_xhtml"] as $mob)
 
 6137                                if (file_exists($importfile))
 
 6147                                        $ilLog->write(
"Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
 
 6161                include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
 
 6165                $a_xml_writer->xmlSetDtdDef(
"<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">");
 
 6166                $a_xml_writer->xmlStartTag(
"questestinterop");
 
 6169                        "ident" => 
"il_".IL_INST_ID.
"_tst_".$this->getTestId(),
 
 6170                        "title" => $this->getTitle()
 
 6172                $a_xml_writer->xmlStartTag(
"assessment", $attrs);
 
 6174                $a_xml_writer->xmlElement(
"qticomment", NULL, $this->
getDescription());
 
 6177                if ($this->enable_processing_time)
 
 6179                        preg_match(
"/(\d+):(\d+):(\d+)/", $this->processing_time, $matches);
 
 6180                        $a_xml_writer->xmlElement(
"duration", NULL, sprintf(
"P0Y0M0DT%dH%dM%dS", $matches[1], $matches[2], $matches[3]));
 
 6184                $a_xml_writer->xmlStartTag(
"qtimetadata");
 
 6185                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6186                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"ILIAS_VERSION");
 
 6187                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
ilias->getSetting(
"ilias_version"));
 
 6188                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6191                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6192                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"anonymity");
 
 6193                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getAnonymity()));
 
 6194                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6196                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6197                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"use_pool");
 
 6198                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getPoolUsage() ? 1 : 0);
 
 6199                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6202                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6203                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"question_set_type");
 
 6205                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6208                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6209                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"sequence_settings");
 
 6211                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6214                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6215                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"author");
 
 6216                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getAuthor());
 
 6217                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6220                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6221                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"reset_processing_time");
 
 6223                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6226                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6227                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"count_system");
 
 6228                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getCountSystem());
 
 6229                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6232                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6233                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"mc_scoring");
 
 6234                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getMCScoring());
 
 6235                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6238                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6239                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"score_cutting");
 
 6240                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getScoreCutting());
 
 6241                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6244                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6245                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"password");
 
 6246                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getPassword());
 
 6247                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6250                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6251                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"allowedUsers");
 
 6252                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getAllowedUsers());
 
 6253                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6256                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6257                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"allowedUsersTimeGap");
 
 6259                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6262                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6263                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"pass_scoring");
 
 6264                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getPassScoring());
 
 6265                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6267                $a_xml_writer->xmlStartTag(
'qtimetadatafield');
 
 6268                $a_xml_writer->xmlElement(
'fieldlabel', NULL, 
'pass_deletion_allowed');
 
 6270                $a_xml_writer->xmlEndTag(
'qtimetadatafield');
 
 6275                        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6276                        $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"reporting_date");
 
 6277                        preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->reporting_date, $matches);
 
 6278                        $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]));
 
 6279                        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6282                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6283                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"nr_of_tries");
 
 6284                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getNrOfTries()));
 
 6285                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6288                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6289                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"kiosk");
 
 6290                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getKiosk()));
 
 6291                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6295                $a_xml_writer->xmlStartTag(
'qtimetadatafield');
 
 6296                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"redirection_mode");
 
 6298                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6301                $a_xml_writer->xmlStartTag(
'qtimetadatafield');
 
 6302                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"redirection_url");
 
 6304                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6307                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6308                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"use_previous_answers");
 
 6310                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6313                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6314                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"title_output");
 
 6315                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getTitleOutput()));
 
 6316                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6319                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6320                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"results_presentation");
 
 6322                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6325                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6326                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"examid_in_test_pass");
 
 6328                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6331                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6332                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"examid_in_test_res");
 
 6334                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6337                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6338                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"show_summary");
 
 6340                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6343                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6344                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"score_reporting");
 
 6345                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getScoreReporting()));
 
 6346                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6348                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6349                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"solution_details");
 
 6351                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6352                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6353                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"print_bs_with_res");
 
 6355                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6358                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6359                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"instant_verification");
 
 6361                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6364                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6365                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"answer_feedback");
 
 6366                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getAnswerFeedback()));
 
 6367                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6370                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6371                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"answer_feedback_points");
 
 6373                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6376                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6377                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"instant_feedback_answer_fixation");
 
 6379                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6382                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6383                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"force_instant_feedback");
 
 6385                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6389                $highscore_metadata = array(
 
 6401                foreach($highscore_metadata as $label => 
$data)
 
 6403                        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6404                        $a_xml_writer->xmlElement(
"fieldlabel", NULL, $label);
 
 6405                        $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", 
$data[
'value']));
 
 6406                        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6410                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6411                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"show_cancel");
 
 6412                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getShowCancel()));
 
 6413                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6416                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6417                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"show_marker");
 
 6418                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getShowMarker()));
 
 6419                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6422                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6423                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"fixed_participants");
 
 6425                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6428                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6429                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"showfinalstatement");
 
 6430                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", (($this->
getShowFinalStatement()) ? 
"1" : 
"0")));
 
 6431                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6434                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6435                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"showinfo");
 
 6436                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", (($this->
getShowInfo()) ? 
"1" : 
"0")));
 
 6437                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6440                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6441                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"mailnotification");
 
 6443                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6446                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6447                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"mailnottype");
 
 6449                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6452                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6453                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"exportsettings");
 
 6455                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6458                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6459                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"forcejs");
 
 6460                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", (($this->
getForceJS()) ? 
"1" : 
"0")));
 
 6461                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6464                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6465                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"customstyle");
 
 6466                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getCustomStyle());
 
 6467                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6470                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6471                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"shuffle_questions");
 
 6472                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getShuffleQuestions()));
 
 6473                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6476                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6477                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"processing_time");
 
 6479                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6482                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6483                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"enable_examview");
 
 6485                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6488                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6489                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"show_examview_html");
 
 6491                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6494                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6495                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"show_examview_pdf");
 
 6497                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6500                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6501                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"enable_archiving");
 
 6503                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6506                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6507                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"sign_submission");
 
 6509                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6512                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6513                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"char_selector_availability");
 
 6515                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6518                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6519                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"char_selector_definition");
 
 6521                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6524                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6525                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"skill_service");
 
 6527                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6530                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6531                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"result_tax_filters");
 
 6533                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6536                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6537                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"show_grading_status");
 
 6539                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6542                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6543                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"show_grading_mark");
 
 6545                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6551                        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6552                        $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"starting_time");
 
 6553                        preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->starting_time, $matches);
 
 6554                        $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]));
 
 6555                        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6560                        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6561                        $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"ending_time");
 
 6562                        preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->ending_time, $matches);
 
 6563                        $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]));
 
 6564                        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6569                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6570                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"activation_limited");
 
 6572                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6575                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6576                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"activation_start_time");
 
 6578                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6581                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6582                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"activation_end_time");
 
 6584                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6587                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6588                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"activation_visibility");
 
 6590                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6593                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6594                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"autosave");
 
 6595                $a_xml_writer->xmlElement(
"fieldentry", NULL, (
int)$this->
getAutosave());
 
 6596                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6599                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6600                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"autosave_ival");
 
 6601                $a_xml_writer->xmlElement(
"fieldentry", NULL, (
int)$this->
getAutosaveIval());
 
 6602                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6605                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6606                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"offer_question_hints");
 
 6608                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6611                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6612                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"instant_feedback_specific");
 
 6614                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6617                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6618                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"instant_feedback_answer_fixation");
 
 6620                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6623                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6624                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"obligations_enabled");
 
 6626                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6629                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6630                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"enable_processing_time");
 
 6632                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6634                foreach ($this->mark_schema->mark_steps as $index => $mark)
 
 6637                        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6638                        $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"mark_step_$index");
 
 6639                        $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
 
 6640                                "<short>%s</short><official>%s</official><percentage>%.2f</percentage><passed>%d</passed>",
 
 6641                                $mark->getShortName(), $mark->getOfficialName(), $mark->getMinimumLevel(), $mark->getPassed()
 
 6643                        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6645                $a_xml_writer->xmlEndTag(
"qtimetadata");
 
 6648                $a_xml_writer->xmlStartTag(
"objectives");
 
 6650                $a_xml_writer->xmlEndTag(
"objectives");
 
 6656                                "solutionswitch" => 
"Yes" 
 6663                $a_xml_writer->xmlElement(
"assessmentcontrol", $attrs, NULL);
 
 6668                        $a_xml_writer->xmlStartTag(
"presentation_material");
 
 6669                        $a_xml_writer->xmlStartTag(
"flow_mat");
 
 6671                        $a_xml_writer->xmlEndTag(
"flow_mat");
 
 6672                        $a_xml_writer->xmlEndTag(
"presentation_material");
 
 6678                $a_xml_writer->xmlElement(
"section", $attrs, NULL);
 
 6679                $a_xml_writer->xmlEndTag(
"assessment");
 
 6680                $a_xml_writer->xmlEndTag(
"questestinterop");
 
 6682                $xml = $a_xml_writer->xmlDumpMem(FALSE);
 
 6684                foreach ($this->questions as $question_id)
 
 6687                        $qti_question = $question->toXML(
false);
 
 6688                        $qti_question = preg_replace(
"/<questestinterop>/", 
"", $qti_question);
 
 6689                        $qti_question = preg_replace(
"/<\/questestinterop>/", 
"", $qti_question);
 
 6690                        if (strpos($xml, 
"</section>") !== 
false)
 
 6692                                $xml = str_replace(
"</section>", 
"$qti_question</section>", $xml);
 
 6696                                $xml = str_replace(
"<section ident=\"1\"/>", 
"<section ident=\"1\">\n$qti_question</section>", $xml);
 
 6712                $this->mob_ids = array();
 
 6713                $this->file_ids = array();
 
 6716                $attrs[
"Type"] = 
"Test";
 
 6717                $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
 
 6723                $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Page Objects");
 
 6724                $ilBench->start(
"ContentObjectExport", 
"exportPageObjects");
 
 6726                $ilBench->stop(
"ContentObjectExport", 
"exportPageObjects");
 
 6727                $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Page Objects");
 
 6730                $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
 
 6731                $ilBench->start(
"ContentObjectExport", 
"exportMediaObjects");
 
 6733                $ilBench->stop(
"ContentObjectExport", 
"exportMediaObjects");
 
 6734                $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
 
 6737                $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
 
 6738                $ilBench->start(
"ContentObjectExport", 
"exportFileItems");
 
 6740                $ilBench->stop(
"ContentObjectExport", 
"exportFileItems");
 
 6741                $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
 
 6743                $a_xml_writer->xmlEndTag(
"ContentObject");
 
 6754                include_once 
"./Services/MetaData/classes/class.ilMD2XML.php";
 
 6756                $md2xml->setExportMode(
true);
 
 6757                $md2xml->startExport();
 
 6758                $a_xml_writer->appendXML($md2xml->getXML());
 
 6768                if ($a_tag == 
"Identifier" && $a_param == 
"Entry")
 
 6770                        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 6788                include_once 
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
 
 6790                foreach ($this->questions as $question_id)
 
 6792                        $ilBench->start(
"ContentObjectExport", 
"exportPageObject");
 
 6793                        $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$question_id);
 
 6796                        $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
 
 6800                        $ilBench->start(
"ContentObjectExport", 
"exportPageObject_XML");
 
 6801                        include_once 
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
 
 6803                        $page_object->buildDom();
 
 6804                        $page_object->insertInstIntoIDs($a_inst);
 
 6805                        $mob_ids = $page_object->collectMediaObjects(
false);
 
 6806                        require_once 
'Services/COPage/classes/class.ilPCFileList.php';
 
 6808                        $xml = $page_object->getXMLFromDom(
false, 
false, 
false, 
"", 
true);
 
 6809                        $xml = str_replace(
"&",
"&", $xml);
 
 6810                        $a_xml_writer->appendXML($xml);
 
 6811                        $page_object->freeDom();
 
 6812                        unset ($page_object);
 
 6814                        $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_XML");
 
 6817                        $ilBench->start(
"ContentObjectExport", 
"exportPageObject_CollectMedia");
 
 6819                        foreach($mob_ids as $mob_id)
 
 6821                                $this->mob_ids[$mob_id] = $mob_id;
 
 6823                        $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_CollectMedia");
 
 6826                        $ilBench->start(
"ContentObjectExport", 
"exportPageObject_CollectFileItems");
 
 6828                        foreach($file_ids as $file_id)
 
 6830                                $this->file_ids[$file_id] = $file_id;
 
 6832                        $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_CollectFileItems");
 
 6834                        $a_xml_writer->xmlEndTag(
"PageObject");
 
 6837                        $ilBench->stop(
"ContentObjectExport", 
"exportPageObject");
 
 6851                include_once 
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
 
 6853                foreach ($this->mob_ids as $mob_id)
 
 6855                        $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
 
 6859                                $media_obj->exportXML($a_xml_writer, $a_inst);
 
 6860                                $media_obj->exportFiles($a_target_dir);
 
 6872                include_once 
"./Modules/File/classes/class.ilObjFile.php";
 
 6874                foreach ($this->file_ids as $file_id)
 
 6876                        $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
 
 6877                        $file_obj = 
new ilObjFile($file_id, 
false);
 
 6878                        $file_obj->export($a_target_dir);
 
 6889                if (!is_array($this->import_mapping))
 
 6895                        return $this->import_mapping;
 
 6912                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);
 
 6918        public static function _getECTSGrade($points_passed, $reached_points, $max_points, $a, $b, $c, 
$d, $e, $fx)
 
 6920                include_once 
"./Modules/Test/classes/class.ilStatistics.php";
 
 6923                $passed_statistics->setData($points_passed);
 
 6924                $ects_percentiles = array
 
 6926                        "A" => $passed_statistics->quantile($a),
 
 6927                        "B" => $passed_statistics->quantile($b),
 
 6928                        "C" => $passed_statistics->quantile($c),
 
 6929                        "D" => $passed_statistics->quantile(
$d),
 
 6930                        "E" => $passed_statistics->quantile($e)
 
 6932                if (count($points_passed) && ($reached_points >= $ects_percentiles[
"A"]))
 
 6936                else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"B"]))
 
 6940                else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"C"]))
 
 6944                else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"D"]))
 
 6948                else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"E"]))
 
 6952                else if (strcmp($fx, 
"") != 0)
 
 6954                        if ($max_points > 0)
 
 6956                                $percentage = ($reached_points / $max_points) * 100.0;
 
 6957                                if ($percentage < 0) $percentage = 0.0;
 
 6963                        if ($percentage >= $fx)
 
 6983                return $this->mark_schema->checkMarks();
 
 7011                global 
$ilDB, $ilPluginAdmin, $tree;
 
 7013                require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 7033                                if(preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getReportingDate(), $matches))
 
 7035                                        $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 7037                                        if($now < $epoch_time)
 
 7075                $md_life =& $md->getLifecycle();
 
 7078                        if (strlen($a_author) == 0)
 
 7081                                $a_author = 
$ilUser->getFullname();
 
 7084                        $md_life =& $md->addLifecycle();
 
 7086                        $con =& $md_life->addContribute();
 
 7087                        $con->setRole(
"Author");
 
 7089                        $ent =& $con->addEntity();
 
 7090                        $ent->setEntity($a_author);
 
 7102                parent::createMetaData();
 
 7116                include_once 
"./Services/MetaData/classes/class.ilMD.php";
 
 7118                $md_life =& $md->getLifecycle();
 
 7121                        $ids =& $md_life->getContributeIds();
 
 7122                        foreach ($ids as 
$id)
 
 7124                                $md_cont =& $md_life->getContribute(
$id);
 
 7125                                if (strcmp($md_cont->getRole(), 
"Author") == 0)
 
 7127                                        $entids =& $md_cont->getEntityIds();
 
 7128                                        foreach ($entids as $entid)
 
 7130                                                $md_ent =& $md_cont->getEntity($entid);
 
 7131                                                array_push(
$author, $md_ent->getEntity());
 
 7149                include_once 
"./Services/MetaData/classes/class.ilMD.php";
 
 7150                $md =& 
new ilMD($obj_id, 0, 
"tst");
 
 7151                $md_life =& $md->getLifecycle();
 
 7154                        $ids =& $md_life->getContributeIds();
 
 7155                        foreach ($ids as 
$id)
 
 7157                                $md_cont =& $md_life->getContribute(
$id);
 
 7158                                if (strcmp($md_cont->getRole(), 
"Author") == 0)
 
 7160                                        $entids =& $md_cont->getEntityIds();
 
 7161                                        foreach ($entids as $entid)
 
 7163                                                $md_ent =& $md_cont->getEntity($entid);
 
 7164                                                array_push(
$author, $md_ent->getEntity());
 
 7183                $result_array = array();
 
 7193                                        $result_array[$obj_id] = $titles[
$ref_id];
 
 7201                return $result_array;
 
 7212        public function cloneObject($a_target_id,$a_copy_id = 0)
 
 7220                $newObj = parent::cloneObject($a_target_id,$a_copy_id);
 
 7221                $newObj->setTmpCopyWizardCopyId($a_copy_id);
 
 7227                if(!$cp_options->isRootNode($this->getRefId()))
 
 7229                        $newObj->setOnline($this->
isOnline());
 
 7254                $newObj->setKiosk($this->
getKiosk());
 
 7305                $newObj->saveToDb();
 
 7308                include_once 
"./Services/Certificate/classes/class.ilCertificate.php";
 
 7309                include_once 
"./Modules/Test/classes/class.ilTestCertificateAdapter.php";
 
 7312                $cert->cloneCertificate($newcert);
 
 7314                require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 7316                $testQuestionSetConfigFactory->getQuestionSetConfig()->cloneQuestionSetRelatedData($newObj);
 
 7318                require_once 
'Modules/Test/classes/class.ilTestSkillLevelThresholdList.php';
 
 7320                $skillLevelThresholdList->setTestId($this->
getTestId());
 
 7321                $skillLevelThresholdList->loadFromDb();
 
 7322                $skillLevelThresholdList->cloneListForTest($newObj->getTestId());
 
 7324                $newObj->saveToDb();
 
 7325                $newObj->updateMetaData();
 
 7327                include_once(
'./Services/Tracking/classes/class.ilLPObjSettings.php');
 
 7329                $obj_settings->cloneSettings($newObj->getId());
 
 7346                        global $tree, 
$ilDB, $ilPluginAdmin;
 
 7349                                $tree, 
$ilDB, $ilPluginAdmin, $this
 
 7352                        $questionSetConfig->loadFromDb();
 
 7354                        if( $questionSetConfig->isQuestionAmountConfigurationModePerPool() )
 
 7356                                require_once 
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
 
 7357                                require_once 
'Modules/Test/classes/class.ilTestRandomQuestionSetBuilderWithAmountPerPool.php';
 
 7358                                require_once 
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
 
 7364                                $sourcePoolDefinitionList->loadDefinitions();
 
 7366                                $num = $sourcePoolDefinitionList->getQuestionAmount();
 
 7370                                $num = $questionSetConfig->getQuestionAmountPerTest();
 
 7375                        $num = count($this->questions);
 
 7393                if (strcmp($question_id, 
"") != 0)
 
 7395                        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 7398                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 7413                $result = 
$ilDB->queryF(
"SELECT obj_fi FROM tst_tests WHERE test_id = %s",
 
 7420                        $object_id = 
$row[
"obj_fi"];
 
 7436                $result = 
$ilDB->queryF(
"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",
 
 7443                        $object_id = 
$row[
"obj_fi"];
 
 7459                $result = 
$ilDB->queryF(
"SELECT test_id FROM tst_tests WHERE obj_fi = %s",
 
 7484                if (($active_id) && ($question_id))
 
 7488                                include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 7491                        $result = 
$ilDB->queryF(
"SELECT value1 FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
 7492                                array(
'integer', 
'integer', 
'integer'),
 
 7493                                array($active_id, $question_id, 
$pass)
 
 7518                        $result = 
$ilDB->queryF(
"SELECT question_text FROM qpl_questions WHERE question_id = %s",
 
 7541                $result_array = array();
 
 7545                        if (is_numeric($user_id))
 
 7547                                $result = 
$ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
 
 7548                                        "tst_active.submitted test_finished, matriculation FROM usr_data, tst_invited_user " .
 
 7549                                        "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7550                                        "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
 
 7552                                        array(
'text', 
'text', 
'text', 
'integer', 
'integer'),
 
 7553                                        array(
"", $this->lng->txt(
"anonymous"), 
"", $this->getTestId(), $user_id)
 
 7558                                $result = 
$ilDB->queryF(
"SELECT tst_active.active_id, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
 
 7559                                        "tst_active.submitted test_finished, matriculation FROM usr_data, tst_invited_user " .
 
 7560                                        "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7561                                        "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
 
 7563                                        array(
'text', 
'text', 
'text', 
'integer'),
 
 7564                                        array(
"", $this->lng->txt(
"anonymous"), 
"", $this->getTestId())
 
 7570                        if (is_numeric($user_id))
 
 7572                                $result = 
$ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
 
 7573                                        "tst_active.submitted test_finished, matriculation FROM usr_data, tst_invited_user " .
 
 7574                                        "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7575                                        "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
 
 7577                                        array(
'integer', 
'integer'),
 
 7583                                $result = 
$ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
 
 7584                                        "tst_active.submitted test_finished, matriculation FROM usr_data, tst_invited_user " .
 
 7585                                        "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7586                                        "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
 
 7593                $result_array = array();
 
 7596                        $result_array[
$row[
'usr_id']]= 
$row;
 
 7598                return $result_array;
 
 7614                                SELECT  tst_active.active_id, 
 7616                                                tst_active.user_fi usr_id, 
 7620                                                tst_active.submitted test_finished, 
 7621                                                usr_data.matriculation, 
 7623                                                tst_active.lastindex 
 7626                                ON tst_active.user_fi = usr_data.usr_id 
 7627                                WHERE tst_active.test_fi = %s 
 7628                                ORDER BY usr_data.lastname 
 7631                                array(
'text', 
'text', 
'text', 
'integer'),
 
 7632                                array(
"", $this->lng->txt(
"anonymous"), 
"", $this->getTestId())
 
 7638                                SELECT  tst_active.active_id, 
 7640                                                tst_active.user_fi usr_id, 
 7644                                                tst_active.submitted test_finished, 
 7645                                                usr_data.matriculation, 
 7647                                                tst_active.lastindex 
 7650                                ON tst_active.user_fi = usr_data.usr_id 
 7651                                WHERE tst_active.test_fi = %s 
 7652                                ORDER BY usr_data.lastname 
 7663                foreach (
$data as $index => $participant)
 
 7665                        if (strlen(trim($participant[
"firstname"].$participant[
"lastname"])) == 0)
 
 7667                                $data[$index][
"lastname"] = $this->lng->txt(
"deleted_user");
 
 7677                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 7679                if (count($scoring) == 0) 
return array();
 
 7682                $filtered_participants = array();
 
 7683                foreach ($participants as $active_id => $participant)
 
 7685                        $qstType_IN_manScoreableQstTypes = 
$ilDB->in(
'qpl_questions.question_type_fi', $scoring, 
false, 
'integer');
 
 7688                                SELECT          tst_test_result.manual 
 7690                                FROM            tst_test_result 
 7692                                INNER JOIN      qpl_questions 
 7693                                ON                      tst_test_result.question_fi = qpl_questions.question_id 
 7695                                WHERE           tst_test_result.active_fi = %s 
 7696                                AND                     $qstType_IN_manScoreableQstTypes 
 7700                                        $queryString, array(
"integer"), array($active_id)
 
 7710                                                if ($participant->active) $filtered_participants[$active_id] = $participant;
 
 7713                                                if (!$participant->active) $filtered_participants[$active_id] = $participant;
 
 7716                                                $filtered_participants[$active_id] = $participant;
 
 7731                                                        $assessmentSetting = 
new ilSetting(
"assessment");
 
 7732                                                        $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
 
 7733                                                        if ($manscoring_done) $filtered_participants[$active_id] = $participant;
 
 7745                                                        $assessmentSetting = 
new ilSetting(
"assessment");
 
 7746                                                        $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
 
 7747                                                        if (!$manscoring_done) $filtered_participants[$active_id] = $participant;
 
 7755                                                        if (
$row[
"manual"]) $found++;
 
 7757                                                if (($found > 0) && ($found < $count)) $filtered_participants[$active_id] = $participant;
 
 7760                                                $filtered_participants[$active_id] = $participant;
 
 7765                return $filtered_participants;
 
 7779                if (!is_array($ids) || count($ids) ==0) 
return array();
 
 7783                        $result = $ilDB->queryF(
"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",
 
 7784                                array(
'text', 
'text', 
'text'),
 
 7785                                array(
"", $this->lng->txt(
"anonymous"), 
"")
 
 7790                        $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");
 
 7793                $result_array = array();
 
 7796                        $result_array[
$row[
"usr_id"]]= 
$row;
 
 7798                return $result_array;
 
 7803                if (!is_array($ids) || count($ids) ==0) 
return array();
 
 7815                if (!is_array($ids) || count($ids) ==0) 
return array();
 
 7817                foreach ($ids as $obj_id)
 
 7833                include_once 
"./Modules/Group/classes/class.ilObjGroup.php";
 
 7835                $members = $group->getGroupMemberIds();
 
 7836                include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 7837                foreach ($members as $user_id)
 
 7852                $members =  $rbacreview->assignedUsers($role_id,
"usr_id");
 
 7853                include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 7854                foreach ($members as $user_id)
 
 7872                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
 
 7873                        array(
'integer', 
'integer'),
 
 7888                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
 
 7889                        array(
'integer', 
'integer'),
 
 7892                $affectedRows = 
$ilDB->manipulateF(
"INSERT INTO tst_invited_user (test_fi, user_fi, clientip, tstamp) VALUES (%s, %s, %s, %s)",
 
 7893                        array(
'integer', 
'integer', 
'text', 
'integer'),
 
 7894                        array($this->
getTestId(), $user_id, (strlen($client_ip)) ? $client_ip : NULL, time())
 
 7903                $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_invited_user SET clientip = %s, tstamp = %s WHERE test_fi=%s and user_fi=%s",
 
 7904                        array(
'text', 
'integer', 
'integer', 
'integer'),
 
 7905                        array((strlen($client_ip)) ? $client_ip : NULL, time(), $this->
getTestId(), $user_id)
 
 7917                if (is_numeric($question_fi))
 
 7919                        $result = 
$ilDB->queryF(
"SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s AND question_fi=%s",
 
 7920                                array(
'integer', 
'integer'),
 
 7921                                array($active_id, $question_fi)
 
 7926                        $result = 
$ilDB->queryF(
"SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s",
 
 7931                $result_array = array();
 
 7934                        $result_array[
$row[
"question_fi"]]= 
$row;
 
 7936                return $result_array;
 
 7948                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_qst_solved WHERE active_fi = %s AND question_fi = %s",
 
 7949                        array(
'integer', 
'integer'),
 
 7950                        array($active_id, $question_id)
 
 7952                $affectedRows = 
$ilDB->manipulateF(
"INSERT INTO tst_qst_solved (solved, question_fi, active_fi) VALUES (%s, %s, %s)",
 
 7953                        array(
'integer', 
'integer', 
'integer'),
 
 7954                        array($value, $question_id, $active_id)
 
 7965                $result = 
$ilDB->queryF(
"SELECT submitted FROM tst_active WHERE active_id=%s AND submitted=%s",
 
 7966                        array(
'integer', 
'integer'),
 
 7967                        array($active_id, 1)
 
 7969                return $result->numRows() == 1;
 
 7980                if (!is_numeric($user_id))
 
 7983                $result = 
$ilDB->queryF(
"SELECT submitted FROM tst_active WHERE test_fi=%s AND user_fi=%s AND submitted=%s",
 
 7984                        array(
'integer', 
'integer', 
'integer'),
 
 7987                return $result->numRows() == 1;
 
 8022                        "user_id" => $this->lng->txt(
"user_id"),
 
 8023                        "matriculation" =>  $this->lng->txt(
"matriculation"),
 
 8024                        "lastname" =>  $this->lng->txt(
"lastname"),
 
 8025                        "firstname" => $this->lng->txt(
"firstname"),
 
 8026                        "login" =>$this->lng->txt(
"login"),
 
 8027                        "reached_points" => $this->lng->txt(
"tst_reached_points"),
 
 8028                        "max_points" => $this->lng->txt(
"tst_maximum_points"),
 
 8029                        "percent_value" => $this->lng->txt(
"tst_percent_solved"),
 
 8030                        "mark" => $this->lng->txt(
"tst_mark"),
 
 8031                        "ects" => $this->lng->txt(
"ects_grade")
 
 8034                if (count($participants))
 
 8040                        foreach ($participants as $active_id => $user_rec)
 
 8042                                $mark = $ects_mark = 
'';
 
 8044                                $reached_points = 0;
 
 8046                                foreach ($this->questions as $value)
 
 8049                                        if (is_object($question))
 
 8051                                                $max_points += $question->getMaximumPoints();
 
 8052                                                $reached_points += $question->getReachedPoints($active_id);
 
 8055                                if ($max_points > 0)
 
 8057                                        $percentvalue = $reached_points / $max_points;
 
 8058                                        if ($percentvalue < 0) $percentvalue = 0.0;
 
 8064                                $mark_obj = $this->mark_schema->getMatchingMark($percentvalue * 100);
 
 8068                                        $mark = $mark_obj->getOfficialName();
 
 8071                                                $ects_mark = $this->
getECTSGrade($passed_array, $reached_points, $max_points);
 
 8076                                        $user_rec[
'firstname'] = 
"";
 
 8077                                        $user_rec[
'lastname'] = $this->lng->txt(
"anonymous");
 
 8080                                        "user_id"=>$user_rec[
'usr_id'],
 
 8081                                        "matriculation" =>  $user_rec[
'matriculation'],
 
 8082                                        "lastname" =>  $user_rec[
'lastname'],
 
 8083                                        "firstname" => $user_rec[
'firstname'],
 
 8084                                        "login"=>$user_rec[
'login'],
 
 8085                                        "reached_points" => $reached_points,
 
 8086                                        "max_points" => $max_points,
 
 8087                                        "percent_value" => $percentvalue,
 
 8089                                        "ects" => $ects_mark
 
 8109                $resultarray = array();
 
 8110                foreach (
$row as $rowindex => $entry)
 
 8117                        if (strpos($entry, 
"\"") !== FALSE)
 
 8119                                $entry = str_replace(
"\"", 
"\"\"", $entry);
 
 8127                        $entry = str_replace(chr(13).chr(10), chr(10), $entry);
 
 8131                            $entry = 
"\"" . $entry . 
"\"";
 
 8134                        $resultarray[$rowindex] = $entry;
 
 8136                return $resultarray;
 
 8150                $result = 
$ilDB->queryF(
"SELECT tries FROM tst_active WHERE active_id = %s",
 
 8157                        return $row[
"tries"];
 
 8177                        $result = 
$ilDB->queryF(
"SELECT MAX(pass) maxpass FROM tst_pass_result WHERE active_fi = %s",
 
 8184                                $max = 
$row[
"maxpass"];
 
 8207                $result = 
$ilDB->queryF(
"SELECT * FROM tst_pass_result WHERE active_fi = %s",
 
 8217                                if(
$row[
"maxpoints"] > 0)
 
 8219                                        $factor = 
$row[
"points"] / 
$row[
"maxpoints"];
 
 8226                                if($factor > $bestfactor)
 
 8229                                        $bestfactor = $factor;
 
 8232                        if (is_array($bestrow))
 
 8234                                return $bestrow[
"pass"];
 
 8257                $counted_pass = NULL;
 
 8266                return $counted_pass;
 
 8282                        global $tree, 
$ilDB, 
$lng, $ilPluginAdmin;
 
 8284                        require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
 8286                        $testSession = $testSessionFactory->getSession($active_id);
 
 8288                        require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 8292                        require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 8294                        $dynamicQuestionSetConfig->loadFromDb();
 
 8306                include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 8308                foreach ($this->questions as $value)
 
 8312                                $workedthrough += 1;
 
 8315                return $workedthrough;
 
 8337                        SELECT  tst_pass_result.tstamp pass_res_tstamp, 
 8338                                        tst_test_result.tstamp quest_res_tstamp 
 8340                        FROM tst_pass_result 
 8342                        LEFT JOIN tst_test_result 
 8343                        ON tst_test_result.active_fi = tst_pass_result.active_fi 
 8344                        AND tst_test_result.pass = tst_pass_result.pass 
 8346                        WHERE tst_pass_result.active_fi = %s 
 8347                        AND tst_pass_result.pass = %s 
 8349                        ORDER BY tst_test_result.tstamp DESC 
 8353                        array(
'integer', 
'integer'),
 
 8354                        array($active_id, 
$pass)
 
 8359                        if( 
$row[
'qres_tstamp'] )
 
 8361                                return $row[
'quest_res_tstamp'];
 
 8364                        return $row[
'pass_res_tstamp'];
 
 8381                        "executable" => 
true,
 
 8382                        "errormessage" => 
"" 
 8386                        $result[
"executable"] = 
false;
 
 8392                        $result[
"executable"] = 
false;
 
 8421                                                        $result[
"executable"] = 
false;
 
 8422                                                        $result[
"errormessage"] = $this->lng->txt(
"detail_max_processing_time_reached");
 
 8432                        require_once 
'Modules/Test/classes/class.ilTestPassesSelector.php';
 
 8434                        $testPassesSelector->setActiveId($active_id);
 
 8435                        $testPassesSelector->setLastFinishedPass(
$testSession->getLastFinishedPass());
 
 8437                        $closedPasses = $testPassesSelector->getClosedPasses();
 
 8441                                $result[
"executable"] = 
false;
 
 8442                                $result[
"errormessage"] = $this->lng->txt(
"maximum_nr_of_tries_reached");
 
 8476                                if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getReportingDate(), $matches))
 
 8478                                        $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 8480                                        if ($now < $epoch_time)
 
 8499                $notimeleft = FALSE;
 
 8528                if ($active_id < 1) 
return FALSE;
 
 8533                $result = 
$ilDB->queryF(
"SELECT tst_times.started FROM tst_times WHERE tst_times.active_fi = %s AND tst_times.pass = %s ORDER BY tst_times.started",
 
 8534                        array(
'integer', 
'integer'),
 
 8535                        array($active_id, 
$pass)
 
 8540                        if (preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"started"], $matches))
 
 8542                                return mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 8590                                                questtypes.type_tag, 
 8592                                                tstquest.obligatory, 
 8593                                                origquest.obj_fi orig_obj_fi 
 8595                        FROM            qpl_questions questions 
 8597                        INNER JOIN      qpl_qst_type questtypes 
 8598                        ON                      questtypes.question_type_id = questions.question_type_fi 
 8600                        INNER JOIN      tst_test_question tstquest 
 8601                        ON                      tstquest.question_fi = questions.question_id 
 8603                        LEFT JOIN       qpl_questions origquest 
 8604                        ON                      origquest.question_id = questions.original_id 
 8606                        WHERE           tstquest.test_fi = %s 
 8608                        ORDER BY        tstquest.sequence 
 8611                $query_result = 
$ilDB->queryF(
 
 8615                $questions = array();
 
 8617                while (
$row = 
$ilDB->fetchAssoc($query_result))
 
 8632        public function getPotentialRandomTestQuestions()
 
 8641                                                questtypes.type_tag, 
 8642                                                origquest.obj_fi orig_obj_fi 
 8644                        FROM            qpl_questions questions 
 8646                        INNER JOIN      qpl_qst_type questtypes 
 8647                        ON                      questtypes.question_type_id = questions.question_type_fi 
 8649                        INNER JOIN      tst_rnd_cpy tstquest 
 8650                        ON                      tstquest.qst_fi = questions.question_id 
 8652                        LEFT JOIN       qpl_questions origquest 
 8653                        ON                      origquest.question_id = questions.original_id 
 8655                        WHERE           tstquest.tst_fi = %s 
 8658                $query_result = 
$ilDB->queryF(
 
 8662                $questions = array();
 
 8664                while (
$row = 
$ilDB->fetchAssoc($query_result))
 
 8684                return ($this->shuffle_questions) ? 1 : 0;
 
 8695                $this->shuffle_questions = ($a_shuffle) ? 1 : 0;
 
 8712                return ($this->show_summary) ? $this->show_summary : 0;
 
 8729                $this->show_summary = $a_value;
 
 8740                if (($this->show_summary & 1) > 0)
 
 8760                        $this->show_summary = 1;
 
 8764                        $this->show_summary = 0;
 
 8776                if (($this->show_summary & 2) > 0)
 
 8796                        $this->show_summary = $this->show_summary | 2;
 
 8802                                $this->show_summary = $this->show_summary ^ 2;
 
 8815                if (($this->show_summary & 4) > 0)
 
 8835                        $this->show_summary = $this->show_summary | 4;
 
 8841                                $this->show_summary = $this->show_summary ^ 4;
 
 8854                        if (($this->show_summary & 8) > 0)
 
 8874                                $this->show_summary = $this->show_summary | 8;
 
 8880                                        $this->show_summary = $this->show_summary ^ 8;
 
 8893                return ($this->results_presentation) ? $this->results_presentation : 0;
 
 8904                if (($this->results_presentation & 1) > 0)
 
 8922                if (($this->results_presentation & 2) > 0)
 
 8940                if (($this->results_presentation & 4) > 0)
 
 8958                if (($this->results_presentation & 8) > 0)
 
 8976                        if (($this->results_presentation & 16) > 0)
 
 8994                        if (($this->results_presentation & 32) > 0)
 
 9010                if (($this->results_presentation & 64) > 0)
 
 9026                if(($this->results_presentation & 128) > 0)
 
 9044                $this->results_presentation = $a_results_presentation;
 
 9059                        $this->results_presentation = $this->results_presentation | 1;
 
 9065                                $this->results_presentation = $this->results_presentation ^ 1;
 
 9080                        $this->results_presentation = $this->results_presentation | 2;
 
 9086                                $this->results_presentation = $this->results_presentation ^ 2;
 
 9112                        $this->results_presentation = $this->results_presentation | 4;
 
 9118                                $this->results_presentation = $this->results_presentation ^ 4;
 
 9133                        $this->results_presentation = $this->results_presentation | 8;
 
 9139                                $this->results_presentation = $this->results_presentation ^ 8;
 
 9154                                $this->results_presentation = $this->results_presentation | 16;
 
 9160                                        $this->results_presentation = $this->results_presentation ^ 16;
 
 9175                                $this->results_presentation = $this->results_presentation | 32;
 
 9181                                        $this->results_presentation = $this->results_presentation ^ 32;
 
 9196                        $this->results_presentation = $this->results_presentation | 64;
 
 9202                                $this->results_presentation = $this->results_presentation ^ 64;
 
 9216                        $this->results_presentation = $this->results_presentation | 128;
 
 9222                                $this->results_presentation = $this->results_presentation ^ 128;
 
 9233                $result = 
$ilDB->queryF(
"SELECT user_fi FROM tst_active WHERE active_id = %s",
 
 9240                        return $row[
"user_fi"];
 
 9266                return ($this->allowedUsers) ? $this->allowedUsers : 0;
 
 9271                $this->allowedUsers = $a_allowed_users;
 
 9276                return ($this->allowedUsersTimeGap) ? $this->allowedUsersTimeGap : 0;
 
 9281                $this->allowedUsersTimeGap = $a_allowed_users_time_gap;
 
 9290                if (($nr_of_users > 0) && ($time_gap > 0))
 
 9293                        $time_border = $now - $time_gap;
 
 9294                        $str_time_border = strftime(
"%Y%m%d%H%M%S", $time_border);
 
 9296                                SELECT DISTINCT tst_times.active_fi 
 9298                                INNER JOIN tst_active 
 9299                                ON tst_times.active_fi = tst_active.active_id 
 9301                                        tst_times.pass > tst_active.last_finished_pass OR tst_active.last_finished_pass IS NULL 
 9303                                WHERE tst_times.tstamp > %s 
 9304                                AND tst_active.test_fi = %s 
 9307                        if (
$result->numRows() >= $nr_of_users)
 
 9309                                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 9328                $result = 
$ilDB->queryF(
"SELECT finished FROM tst_times WHERE active_fi = %s ORDER BY finished DESC",
 
 9335                        return $row[
"finished"];
 
 9349                if (preg_match(
"/<[^>]*?>/", $a_text))
 
 9369                for ($i = 0; $i < $a_material->getMaterialCount(); $i++)
 
 9371                        $material = $a_material->getMaterial($i);
 
 9372                        if (strcmp($material[
"type"], 
"mattext") == 0)
 
 9374                                $result .= $material[
"material"]->getContent();
 
 9376                        if (strcmp($material[
"type"], 
"matimage") == 0)
 
 9378                                $matimage = $material[
"material"];
 
 9379                                if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches))
 
 9382                                        if (!is_array(
$_SESSION[
"import_mob_xhtml"])) 
$_SESSION[
"import_mob_xhtml"] = array();
 
 9383                                        array_push(
$_SESSION[
"import_mob_xhtml"], array(
"mob" => $matimage->getLabel(), 
"uri" => $matimage->getUri()));
 
 9402                include_once 
"./Services/RTE/classes/class.ilRTE.php";
 
 9403                include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 9405                $a_xml_writer->xmlStartTag(
"material");
 
 9407                        "texttype" => 
"text/plain" 
 9409                if ($this->
isHTML($a_material))
 
 9411                        $attrs[
"texttype"] = 
"text/xhtml";
 
 9416                foreach (
$mobs as $mob)
 
 9418                        $moblabel = 
"il_" . IL_INST_ID . 
"_mob_" . $mob;
 
 9419                        if (strpos($a_material, 
"mm_$mob") !== FALSE)
 
 9425                                                "label" => $moblabel,
 
 9426                                                "uri" => 
"objects/" . 
"il_" . IL_INST_ID . 
"_mob_" . $mob . 
"/" . $mob_obj->getTitle()
 
 9429                                $a_xml_writer->xmlElement(
"matimage", $imgattrs, NULL);
 
 9432                $a_xml_writer->xmlEndTag(
"material");
 
 9443                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 9457                $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_tests SET certificate_visibility = %s, tstamp = %s WHERE test_id = %s",
 
 9458                        array(
'text', 
'integer', 
'integer'),
 
 9459                        array($a_value, time(), $this->
getTestId())
 
 9471                return (strlen($this->certificate_visibility)) ? $this->certificate_visibility : 0;
 
 9482                $this->certificate_visibility = $a_value;
 
 9493                return ($this->anonymity) ? 1 : 0;
 
 9507                                $this->anonymity = 1;
 
 9510                                $this->anonymity = 0;
 
 9523                return ($this->show_cancel) ? 1 : 0;
 
 9537                                $this->show_cancel = 1;
 
 9540                                $this->show_cancel = 0;
 
 9553                return ($this->show_marker) ? 1 : 0;
 
 9567                                $this->show_marker = 1;
 
 9570                                $this->show_marker = 0;
 
 9583                return ($this->fixed_participants) ? 1 : 0;
 
 9597                                $this->fixed_participants = 1;
 
 9600                                $this->fixed_participants = 0;
 
 9616                $result = 
$ilDB->queryF(
"SELECT anonymity FROM tst_tests WHERE obj_fi = %s",
 
 9622                        return $row[
'anonymity'];
 
 9638                        SELECT          tst_tests.question_set_type 
 9640                        INNER JOIN      tst_tests 
 9641                        ON                      tst_active.test_fi = tst_tests.test_id 
 9642                        WHERE           tst_active.active_id = %s 
 9649                        return $row[
'question_set_type'];
 
 9665                throw new Exception(__METHOD__.
' is deprecated ... use ilObjTest::lookupQuestionSetTypeByActiveId() instead!');
 
 9669                $result = 
$ilDB->queryF(
"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",
 
 9675                        return $row[
'random_test'];
 
 9694                        return $this->lng->txt(
"anonymous") . $suffix;
 
 9698                        include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 9700                        if (strlen($uname[
"firstname"].$uname[
"lastname"]) == 0) $uname[
"firstname"] = $this->lng->txt(
"deleted_user");
 
 9703                                return trim($uname[
"lastname"] . 
", " . $uname[
"firstname"]) .  $suffix;
 
 9707                                return trim($uname[
"firstname"] . 
" " . $uname[
"lastname"]) .  $suffix;
 
 9723                        return $this->lng->txt(
"tst_start_test");
 
 9725                $active_pass = $this->
_getPass($active_id);
 
 9729                        if ($active_pass == 0)
 
 9731                                return $this->lng->txt(
"tst_start_test");
 
 9735                                return $this->lng->txt(
"tst_start_new_test_pass");
 
 9740                        return $this->lng->txt(
"tst_resume_test");
 
 9749        public function getAvailableDefaults()
 
 9758                        "SELECT * FROM tst_test_defaults WHERE user_fi = %s ORDER BY name ASC",
 
 9762                $defaults = array();
 
 9765                        $defaults[
$row[
"test_defaults_id"]] = 
$row;
 
 9786                $result = 
$ilDB->queryF(
"SELECT * FROM tst_test_defaults WHERE test_defaults_id = %s",
 
 9788                        array($test_defaults_id)
 
 9810                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_test_defaults WHERE test_defaults_id = %s",
 
 9812                        array($test_default_id)
 
 9826                $testsettings = array(
 
 9918                $next_id = 
$ilDB->nextId(
'tst_test_defaults');
 
 9920                        'tst_test_defaults',
 
 9922                                'test_defaults_id' => array(
'integer', $next_id),
 
 9923                                'name'             => array(
'text', $a_name),
 
 9924                                'user_fi'          => array(
'integer', 
$ilUser->getId()),
 
 9925                                'defaults'         => array(
'clob', serialize($testsettings)),
 
 9926                                'marks'            => array(
'clob', serialize($this->mark_schema)),
 
 9927                                'tstamp'           => array(
'integer', time())
 
 9941                $testsettings = unserialize($test_defaults[
"defaults"]);
 
 9942                include_once 
"./Modules/Test/classes/class.assMarkSchema.php";
 
 9943                $this->mark_schema = unserialize($test_defaults[
"marks"]);
 
 9977                $this->
setKiosk($testsettings[
"Kiosk"]);
 
 9981                $this->
setECTSFX($testsettings[
"ECTSFX"]);
 
 9983                if( isset($testsettings[
"isRandomTest"]) )
 
 9985                        if( $testsettings[
"isRandomTest"] )
 
 9994                elseif( isset($testsettings[
"questionSetType"]) )
 
10017                if( isset($testsettings[
'examid_in_kiosk']) )
 
10025                if( isset($testsettings[
'show_exam_id']) )
 
10080                if (extension_loaded(
"tidy"))
 
10084                                "output-xml"     => 
true,
 
10085                                "numeric-entities" => 
true 
10087                        $tidy = 
new tidy();
 
10088                        $tidy->parseString($print_output, $config, 
'utf8');
 
10089                        $tidy->cleanRepair();
 
10090                        $print_output = tidy_get_output($tidy);
 
10091                        $print_output = preg_replace(
"/^.*?(<html)/", 
"\\1", $print_output);
 
10095                        $print_output = str_replace(
" ", 
" ", $print_output);
 
10096                        $print_output = str_replace(
"⊗", 
"X", $print_output);
 
10098                $xsl = file_get_contents(
"./Modules/Test/xml/question2fo.xsl");
 
10101                $xsl = str_replace(
 
10102                                'font-family="Helvetica, unifont"',
 
10103                                'font-family="'.
$GLOBALS[
'ilSetting']->
get(
'rpc_pdf_font',
'Helvetica, unifont').
'"',
 
10107                $args = array( 
'/_xml' => $print_output, 
'/_xsl' => $xsl );
 
10110                $output = xslt_process($xh, 
"arg:/_xml", 
"arg:/_xsl", NULL, $args, 
$params);
 
10124                $content = preg_replace(
"/href=\".*?\"/", 
"", $content);
 
10125                $printbody = 
new ilTemplate(
"tpl.il_as_tst_print_body.html", TRUE, TRUE, 
"Modules/Test");
 
10127                $printbody->setVariable(
"ADM_CONTENT", $content);
 
10128                $printbody->setCurrentBlock(
"css_file");
 
10130                $printbody->parseCurrentBlock();
 
10131                $printbody->setCurrentBlock(
"css_file");
 
10133                $printbody->parseCurrentBlock();
 
10134                $printoutput = $printbody->get();
 
10135                $html = str_replace(
"href=\"./", 
"href=\"" . ILIAS_HTTP_PATH . 
"/", $printoutput);
 
10136                $html = preg_replace(
"/<div id=\"dontprint\">.*?<\\/div>/ims", 
"", 
$html);
 
10137                if (extension_loaded(
"tidy"))
 
10141                                "output-xml"     => 
true,
 
10142                                "numeric-entities" => 
true 
10144                        $tidy = 
new tidy();
 
10145                        $tidy->parseString(
$html, $config, 
'utf8');
 
10146                        $tidy->cleanRepair();
 
10147                        $html = tidy_get_output($tidy);
 
10148                        $html = preg_replace(
"/^.*?(<html)/", 
"\\1", 
$html);
 
10152                        $html = str_replace(
" ", 
" ", 
$html);
 
10153                        $html = str_replace(
"⊗", 
"X", 
$html);
 
10155                $html = preg_replace(
"/src=\".\\//ims", 
"src=\"" . ILIAS_HTTP_PATH . 
"/", 
$html);
 
10169                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
10171                $fp = fopen($fo_file, 
"w"); fwrite($fp, $fo); fclose($fp);
 
10173                include_once 
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
 
10183                        $ilLog->write(__METHOD__.
': '.$e->getMessage());
 
10186                catch(Exception $e)
 
10188                        $ilLog->write(__METHOD__.
': '.$e->getMessage());
 
10215                $result = 
$ilDB->queryF(
"SELECT feedback FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
10216                        array(
'integer', 
'integer', 
'integer'),
 
10217                        array($active_id, $question_id, 
$pass)
 
10222                        include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
10238        function saveManualFeedback($active_id, $question_id, 
$pass, $feedback)
 
10242                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
10243                        array(
'integer', 
'integer', 
'integer'),
 
10244                        array($active_id, $question_id, 
$pass)
 
10247                if (strlen($feedback))
 
10249                        $next_id = 
$ilDB->nextId(
'tst_manual_fb');
 
10252                                                                                                           'manual_feedback_id'         => array( 
'integer',    $next_id ),
 
10253                                                                                                           'active_fi'                          => array( 
'integer',    $active_id ),
 
10254                                                                                                           'question_fi'                        => array( 
'integer',    $question_id ),
 
10255                                                                                                           'pass'                                       => array( 
'integer',    
$pass),
 
10257                                                                                                           'tstamp'                                     => array( 
'integer',    time() ),
 
10260                        include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
10264                                include_once 
"./Modules/Test/classes/class.ilObjTestAccess.php";
 
10266                                include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
10301                include_once 
"./Modules/Test/classes/class.ilTestSequence.php";
 
10312                $this->test_id = $a_id;
 
10326                if (count($participants))
 
10328                        foreach ($participants as $active_id => $user_rec)
 
10331                                $reached_points = 0;
 
10333                                foreach ($this->questions as $value)
 
10336                                        if (is_object($question))
 
10338                                                $max_points += $question->getMaximumPoints();
 
10339                                                $reached_points += $question->getReachedPoints($active_id);
 
10340                                                if ($max_points > 0)
 
10342                                                        $percentvalue = $reached_points / $max_points;
 
10343                                                        if ($percentvalue < 0) $percentvalue = 0.0;
 
10351                                                        $user_rec[
'firstname'] = 
"";
 
10352                                                        $user_rec[
'lastname'] = $this->lng->txt(
"anonymous");
 
10355                                                        "user_id"=>$user_rec[
'usr_id'],
 
10356                                                        "matriculation" =>  $user_rec[
'matriculation'],
 
10357                                                        "lastname" =>  $user_rec[
'lastname'],
 
10358                                                        "firstname" => $user_rec[
'firstname'],
 
10359                                                        "login"=>$user_rec[
'login'],
 
10360                                                        "question_id" => $question->getId(),
 
10361                                                        "question_title" => $question->getTitle(),
 
10362                                                        "reached_points" => $reached_points,
 
10363                                                        "max_points" => $max_points
 
10380                $result = 
$ilDB->queryF(
"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",
 
10385                return $rec[
"obj_id"];
 
10396                global $ilPluginAdmin;
 
10397                if ($ilPluginAdmin->isActive(
IL_COMP_MODULE, 
"TestQuestionPool", 
"qst", $a_pname))
 
10411                $result = 
$ilDB->queryF(
"SELECT passed FROM tst_result_cache WHERE active_fi = %s",
 
10418                        return $row[
'passed'];
 
10423                        $result_array =& $this->
getTestResult($active_id, $counted_pass);
 
10424                        return $result_array[
"test"][
"passed"];
 
10437                        include_once 
"./Services/Certificate/classes/class.ilCertificate.php";
 
10438                        include_once 
"./Modules/Test/classes/class.ilTestCertificateAdapter.php";
 
10440                        if ($cert->isComplete())
 
10482        public function getParticipantsForTestAndQuestion(
$test_id, $question_id)
 
10488                        SELECT tst_test_result.active_fi, tst_test_result.question_fi, tst_test_result.pass  
10489                        FROM tst_test_result 
10490                        INNER JOIN tst_active ON tst_active.active_id = tst_test_result.active_fi AND tst_active.test_fi = %s  
10491                        INNER JOIN qpl_questions ON qpl_questions.question_id = tst_test_result.question_fi 
10492                        LEFT JOIN usr_data ON usr_data.usr_id = tst_active.user_fi 
10493                        WHERE tst_test_result.question_fi = %s 
10494                        ORDER BY usr_data.lastname ASC, usr_data.firstname ASC 
10498                        array(
'integer', 
'integer'),
 
10501                $foundusers = array();
 
10505                        if (!array_key_exists(
$row[
"active_fi"], $foundusers))
 
10507                                $foundusers[
$row[
"active_fi"]] = array();
 
10509                        array_push($foundusers[
$row[
"active_fi"]], array(
"pass" => 
$row[
"pass"], 
"qid" => 
$row[
"question_fi"]));
 
10511                return $foundusers;
 
10522                $foundParticipants =& 
$data->getParticipants();
 
10523                $results = array(
"overview" => array(), 
"questions" => array());
 
10524                if (count($foundParticipants)) 
 
10526                        $results[
"overview"][$this->lng->txt(
"tst_eval_total_persons")] = count($foundParticipants);
 
10528                        $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished")] = $total_finished;
 
10530                        $diff_seconds = $average_time;
 
10531                        $diff_hours    = floor($diff_seconds/3600);
 
10532                        $diff_seconds -= $diff_hours   * 3600;
 
10533                        $diff_minutes  = floor($diff_seconds/60);
 
10534                        $diff_seconds -= $diff_minutes * 60;
 
10535                        $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
 
10537                        $total_passed_reached = 0;
 
10538                        $total_passed_max = 0;
 
10539                        $total_passed_time = 0;
 
10540                        foreach ($foundParticipants as $userdata)
 
10542                                if ($userdata->getPassed()) 
 
10545                                        $total_passed_reached += $userdata->getReached();
 
10546                                        $total_passed_max += $userdata->getMaxpoints();
 
10547                                        $total_passed_time += $userdata->getTimeOfWork();
 
10550                        $average_passed_reached = $total_passed ? $total_passed_reached / $total_passed : 0;
 
10551                        $average_passed_max = $total_passed ? $total_passed_max / $total_passed : 0;
 
10552                        $average_passed_time = $total_passed ? $total_passed_time / $total_passed : 0;
 
10553                        $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed")] = $total_passed;
 
10554                        $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);
 
10555                        $average_time = $average_passed_time;
 
10556                        $diff_seconds = $average_time;
 
10557                        $diff_hours    = floor($diff_seconds/3600);
 
10558                        $diff_seconds -= $diff_hours   * 3600;
 
10559                        $diff_minutes  = floor($diff_seconds/60);
 
10560                        $diff_seconds -= $diff_minutes * 60;
 
10561                        $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
 
10564                foreach (
$data->getQuestionTitles() as $question_id => $question_title)
 
10569                        foreach ($foundParticipants as $userdata)
 
10571                                for ($i = 0; $i <= $userdata->getLastPass(); $i++)
 
10573                                        if (is_object($userdata->getPass($i)))
 
10575                                                $question =& $userdata->getPass($i)->getAnsweredQuestionByQuestionId($question_id);
 
10576                                                if (is_array($question))
 
10579                                                        $reached += $question[
"reached"];
 
10580                                                        $max += $question[
"points"];
 
10585                        $percent = $max ? $reached/$max * 100.0 : 0;
 
10587                        $results[
"questions"][$question_id] = array(
 
10589                                sprintf(
"%.2f", $answered ? $reached / $answered : 0) . 
" " . strtolower($this->lng->txt(
"of")) . 
" " . sprintf(
"%.2f", $answered ? $max / $answered : 0),
 
10590                                sprintf(
"%.2f", $percent) . 
"%",
 
10592                                sprintf(
"%.2f", $answered ? $reached / $answered : 0),
 
10593                                sprintf(
"%.2f", $answered ? $max / $answered : 0),
 
10605                include_once(
"./Modules/Test/classes/class.ilTestExport.php");
 
10607                return $test_exp->buildExportFile();
 
10625                $this->mailnotification = $a_notification;
 
10630                include_once 
"./Modules/Test/classes/class.ilTestMailNotification.php";
 
10635                $mail->sendSimpleNotification($owner_id, $this->
getTitle(), $usr_data);
 
10645                include_once 
"./Modules/Test/classes/class.ilObjTestGUI.php";
 
10646                include_once 
"./Modules/Test/classes/tables/class.ilEvaluationAllTableGUI.php";
 
10648                return $table_gui->getSelectedColumns();
 
10653                include_once 
"./Modules/Test/classes/class.ilTestMailNotification.php";
 
10659                include_once 
"./Modules/Test/classes/class.ilTestExport.php";
 
10661                $file = $exportObj->exportToExcel($deliver = FALSE, 
'active_id', $active_id, $passedonly = FALSE);
 
10662                include_once 
"./Services/Mail/classes/class.ilFileDataMail.php";
 
10664                $fd->copyAttachmentFile(
$file, 
"result_" . $active_id . 
".xls");
 
10665                $file_names[] = 
"result_" . $active_id . 
".xls";
 
10667                $mail->sendAdvancedNotification($owner_id, $this->
getTitle(), $usr_data, $file_names);
 
10669                if(count($file_names))
 
10671                        $fd->unlinkFiles($file_names);
 
10682                $query = 
"SELECT usr_id FROM usr_data";
 
10686                        $activequery = sprintf(
"SELECT user_fi FROM tst_active WHERE test_fi = %s AND user_fi = %s",
 
10687                                $ilDB->quote($this->getTestId()),
 
10690                        $activeresult = 
$ilDB->query($activequery);
 
10691                        if ($activeresult->numRows() == 0)
 
10693                                $user_id = 
$data[
'usr_id'];
 
10694                                if ($user_id != 13)
 
10696                                        include_once 
"./Modules/Test/classes/class.ilTestSession.php";
 
10699                                        $testSession->setTestId($this->
getTestId());
 
10700                                        $testSession->setUserId($user_id);
 
10703                                        $nr_of_passes = rand(1, $passes);
 
10707                                                include_once 
"./Modules/Test/classes/class.ilTestSequence.php";
 
10709                                                $testSequence->loadFromDb();
 
10716                                                for ($seq = 1; $seq <= count($this->questions); $seq++)
 
10718                                                        $question_id = 
$testSequence->getQuestionForSequence($seq);
 
10720                                                        $assSettings = 
new ilSetting(
'assessment');
 
10721                                                        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
 
10723                                                        $processLockerFactory->setQuestionId($objQuestion->getId());
 
10724                                                        $processLockerFactory->setUserId(
$testSession->getUserId());
 
10725                                                        include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
10727                                                        $objQuestion->setProcessLocker($processLockerFactory->getLocker());
 
10734                                                $testSession->setSubmittedTimestamp(date(
'Y-m-d H:i:s'));
 
10738                                        if ($number == 0) 
return;
 
10750                        FROM            tst_result_cache 
10751                        WHERE           active_fi = %s 
10755                        $query, array(
'integer'), array($active_id)
 
10760                        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
10766                                FROM            tst_result_cache 
10767                                WHERE           active_fi = %s 
10771                                $query, array(
'integer'), array($active_id)
 
10783                if ($this->mailnottype == 1)
 
10797                        $this->mailnottype = 1;
 
10801                        $this->mailnottype = 0;
 
10807                if ($this->exportsettings)
 
10821                        $this->exportsettings = $a_settings;
 
10825                        $this->exportsettings = 0;
 
10831                if (($this->exportsettings & 1) > 0)
 
10845                        $this->exportsettings = $this->exportsettings | 1;
 
10851                                $this->exportsettings = $this->exportsettings ^ 1;
 
10857            return $this->enabled_view_mode;
 
10861            $this->enabled_view_mode = $mode;
 
10873            $new_array = array();
 
10876            $query = 
'SELECT question_fi  FROM tst_test_question WHERE test_fi = %s';
 
10877            $types = array(
'integer');
 
10880            $new_question_id += 1;
 
10887                $qid = 
$row[
'question_fi'];
 
10889                if ($qid == $new_question_id) {
 
10892                else if ($qid == $previous_question_id) {
 
10893                    $new_array[$position++] = $qid;
 
10894                    $new_array[$position++] =  $new_question_id;
 
10898                    $new_array[$position++] = $qid;
 
10902            $update_query = 
'UPDATE tst_test_question SET sequence = %s WHERE test_fi = %s AND question_fi = %s';
 
10903            $update_types = array(
'integer', 
'integer', 
'integer');
 
10905            foreach($new_array as $position => $qid) {
 
10906                $ilDB->manipulateF(
 
10938                'pass_details' => 
'setShowPassDetails',
 
10939                'solution_details' => 
'setShowSolutionDetails',
 
10940                'solution_printview' => 
'setShowSolutionPrintview',
 
10941                'solution_feedback' => 
'setShowSolutionFeedback',
 
10942                'solution_answers_only' => 
'setShowSolutionAnswersOnly',
 
10943                'solution_signature' => 
'setShowSolutionSignature',
 
10944                'solution_suggested' => 
'setShowSolutionSuggested',
 
10946            foreach($setter as $key => $setter) {
 
10961            $this->poolUsage = (boolean)$usage;
 
10970                require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
10972                $questionSetConfig = $qscFactory->getQuestionSetConfig();
 
10975                $questionSetConfig->reindexQuestionOrdering();
 
10988            foreach($orders as 
$id => $position)
 
10993                                isset($obligations[
$id]) && $obligations[
$id] ? 1 : 0
 
10997                                UPDATE          tst_test_question 
11000                                WHERE           question_fi = %s 
11003                        $ilDB->manipulateF(
 
11004                                $query, array(
'integer', 
'integer', 
'integer'), array($i, $obligatory, 
$id)
 
11014            if ($question_before) {
 
11015                $query = 
'SELECT sequence, test_fi FROM tst_test_question WHERE question_fi = %s';
 
11016                $types = array(
'integer');
 
11017                $values = array($question_before);
 
11021            if (!$question_before || ($rset && !(
$row = 
$ilDB->fetchAssoc($rset)))) {
 
11028            $update = 
'UPDATE tst_test_question SET sequence = sequence + 1 WHERE sequence > %s AND test_fi = %s';
 
11029            $types = array(
'integer', 
'integer');
 
11030            $values = array(
$row[
'sequence'], 
$row[
'test_fi']);
 
11031            $ilDB->manipulateF($update, $types, $values);
 
11033            $update = 
'UPDATE tst_test_question SET sequence = %s WHERE question_fi = %s';
 
11034            $types = array(
'integer', 
'integer');
 
11035            $values = array(
$row[
'sequence'] + 1, $question_to_move);
 
11036            $ilDB->manipulateF($update, $types, $values);
 
11047                $IN_questions = 
$ilDB->in(
'q1.question_id', array_keys(
$questions), 
false, 
'integer');
 
11050                        SELECT          count(q1.question_id) cnt 
11052                        FROM            qpl_questions q1 
11054                        INNER JOIN      qpl_questions q2 
11055                        ON                      q2.question_id = q1.original_id 
11057                        WHERE           $IN_questions 
11058                        AND                     q1.obj_fi = q2.obj_fi 
11065                return $row[
'cnt'] > 0;
 
11078                $result = 
$ilDB->queryF(
"SELECT test_fi,MAX(pass) AS pass FROM tst_active".
 
11079                        " JOIN tst_pass_result ON (tst_pass_result.active_fi = tst_active.active_id)".
 
11080                        " WHERE user_fi=%s".
 
11081                        " GROUP BY test_fi",
 
11082                        array(
'integer', 
'integer'),
 
11083                        array($a_user_id, 1)
 
11089                        $all[$obj_id] = (bool)
$row[
"pass"];
 
11105                $this->online = (bool)$a_online;
 
11110                $this->print_best_solution_with_result = (bool) $status;
 
11140                $this->activation_visibility = (bool) $a_value;
 
11150           return (
bool)$this->activation_limited;
 
11155           $this->activation_limited = (bool)$a_value;
 
11167                $this->_highscore_enabled = (bool)$a_enabled;
 
11177                return (
bool) $this->_highscore_enabled;
 
11189                $this->_highscore_anon = (bool)$a_anon;
 
11203                return (
bool) $this->_highscore_anon;
 
11233                $this->_highscore_achieved_ts = (bool)$a_achieved_ts;
 
11243                return (
bool) $this->_highscore_achieved_ts;
 
11253                $this->_highscore_score = (bool)$a_score;
 
11263                return (
bool) $this->_highscore_score;
 
11273                $this->_highscore_percentage = (bool)$a_percentage;
 
11283                return (
bool) $this->_highscore_percentage;
 
11293                $this->_highscore_hints = (bool)$a_hints;
 
11303                return (
bool) $this->_highscore_hints;
 
11313                $this->_highscore_wtime = (bool)$a_wtime;
 
11323                return (
bool) $this->_highscore_wtime;
 
11333                $this->_highscore_own_table = (bool)$a_own_table;
 
11343                return (
bool) $this->_highscore_own_table;
 
11353                $this->_highscore_top_table = (bool)$a_top_table;
 
11363                return (
bool) $this->_highscore_top_table;
 
11374                $this->_highscore_top_num = (int)$a_top_num;
 
11387                $retval = $a_retval;
 
11388                if ( (
int) $this->_highscore_top_num != 0)
 
11390                        $retval = $this->_highscore_top_num;
 
11446                switch ($specific_answer_feedback)
 
11449                                $this->specific_answer_feedback = 1;
 
11452                                $this->specific_answer_feedback = 0;
 
11459                switch ($this->specific_answer_feedback)
 
11496                require_once(
'Modules/TestQuestionPool/classes/class.assQuestion.php');
 
11504                $obligationPossible = call_user_func(array($classConcreteQuestion, 
'isObligationPossible'), $questionId);
 
11506                return $obligationPossible;
 
11519            $rset = 
$ilDB->queryF(
'SELECT obligatory FROM tst_test_question WHERE question_fi = %s', array(
'integer'), array($question_id));
 
11523                        return (
bool) 
$row[
'obligatory'];
 
11545            $rset = 
$ilDB->queryF(
 
11546                    'SELECT obligations_answered FROM tst_pass_result WHERE active_fi = %s AND pass = %s',
 
11547                    array(
'integer', 
'integer'),
 
11548                    array($active_id, 
$pass)
 
11553                        return (
bool)
$row[
'obligations_answered'];
 
11571                $rset = 
$ilDB->queryF(
 
11572                        'SELECT count(*) cnt FROM tst_test_question WHERE test_fi = %s AND obligatory = 1',
 
11578                return (
bool)
$row[
'cnt'] > 0;
 
11621        #region Examview / PDF Examview 
11684                return (strlen($this->activation_starting_time)) ? $this->activation_starting_time : NULL;
 
11689                return (strlen($this->activation_ending_time)) ? $this->activation_ending_time : NULL;
 
11697                $result = 
$ilDB->query(
"SELECT tst_times.active_fi, tst_times.started FROM tst_times, tst_active WHERE tst_times.active_fi = tst_active.active_id ORDER BY tst_times.tstamp DESC");
 
11700                        $times[
$row[
'active_fi']] = 
$row[
'started'];
 
11710                $result = 
$ilDB->queryF(
"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",
 
11716                        $times[
$row[
'active_fi']] = 
$row[
'additionaltime'];
 
11725                $result = 
$ilDB->queryF(
"SELECT additionaltime FROM tst_addtime WHERE active_fi = %s",
 
11732                        return $row[
'additionaltime'];
 
11741                $participants = array();
 
11742                if ($active_id == 0)
 
11744                        $result = 
$ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s",
 
11750                                array_push($participants, 
$row[
'active_id']);
 
11755                        array_push($participants, $active_id);
 
11757                foreach ($participants as $active_id)
 
11759                        $result = 
$ilDB->queryF(
"SELECT active_fi FROM tst_addtime WHERE active_fi = %s",
 
11765                                $ilDB->manipulateF(
"DELETE FROM tst_addtime WHERE active_fi = %s",
 
11771                        $ilDB->manipulateF(
"UPDATE tst_active SET tries = %s, submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
11772                                array(
'integer',
'integer',
'timestamp',
'integer'),
 
11773                                array(0, 0, NULL, $active_id)
 
11776                        $ilDB->manipulateF(
"INSERT INTO tst_addtime (active_fi, additionaltime, tstamp) VALUES (%s, %s, %s)",
 
11777                                array(
'integer',
'integer',
'integer'),
 
11778                                array($active_id, $minutes, time())
 
11781                        require_once 
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
 
11808        public function getMaxPassOfTest()
 
11816                        SELECT MAX(tst_pass_result.pass) + 1 max_res 
11817                        FROM tst_pass_result  
11818                        INNER JOIN tst_active ON tst_active.active_id = tst_pass_result.active_fi 
11819                        WHERE test_fi = '.$ilDB->quote($this->
getTestId(), 
'integer').
' 
11823                return (
int)
$data[
'max_res'];
 
11836                $exam_id_query  = 
'SELECT exam_id FROM tst_pass_result WHERE active_fi = %s AND pass = %s';
 
11837                $exam_id_result = 
$ilDB->queryF( $exam_id_query, array( 
'integer', 
'integer' ), array( $active_id, 
$pass ) );
 
11838                if (
$ilDB->numRows( $exam_id_result ) == 1)
 
11840                        $exam_id_row = 
$ilDB->fetchAssoc( $exam_id_result );
 
11842                        if ($exam_id_row[
'exam_id'] != 
null)
 
11844                                return $exam_id_row[
'exam_id'];
 
11862                $inst_id = 
$ilSetting->get( 
'inst_id', 
null );
 
11864                if($test_obj_id === 
null)
 
11870                        $obj_id  = $test_obj_id;
 
11873                $examId = 
'I' . $inst_id . 
'_T' . $obj_id . 
'_A' . $active_id . 
'_P' . 
$pass;
 
11925                $this->char_selector_availability = (int) $availability;
 
11941                $this->char_selector_definition = $definition;
 
11984                $query = 
"SELECT question_set_type FROM tst_tests WHERE obj_fi = %s";
 
12045                                return $lng->txt(
'tst_question_set_type_fixed');
 
12048                                return $lng->txt(
'tst_question_set_type_random');
 
12051                                return $lng->txt(
'tst_question_set_type_dynamic');
 
12084                require_once 
'class.ilTestScoring.php';
 
12086                $scoring->setPreserveManualScores($preserve_manscoring);
 
12087                $scoring->recalculateSolutions();
 
12092                require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
12094                $questionChangeListeners = array(
 
12098                return $questionChangeListeners;
 
12108                        INNER JOIN tst_tests 
12109                        ON test_id = test_fi 
12119                        $objIds[] = (int)
$row[
'obj_fi'];
 
12152                if( !self::isSkillManagementGloballyActivated() )
 
12164                if( self::$isSkillManagementGloballyActivated === 
null )
 
12166                        include_once 
'Services/Skill/classes/class.ilSkillManagementSettings.php';
 
12169                        self::$isSkillManagementGloballyActivated = $skmgSet->isActivated();
 
12230                $activeId = $testOBJ->getActiveIdOfUser($userId);
 
12232                require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
12235                require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
12238                $testSession = $testSessionFactory->getSession($activeId);
 
12243                if($a_force_new_run)
 
12264                $activeId = $testOBJ->getActiveIdOfUser($userId);
 
12266                require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
12269                $testSessionFactory->reset();
 
12271                require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
12274                $testSession = $testSessionFactory->getSession($activeId);
 
A class defining mark schemas for assessment test objects.
isError($data, $code=null)
Tell whether a value is a PEAR error.
_getQuestionTitle($question_id)
Returns the question title of a question with a given id.
static getFeedbackClassNameByQuestionType($questionType)
static _getOriginalId($question_id)
Returns the original id of a question.
_getSolutionMaxPass($question_id, $active_id)
Returns the maximum pass a users question solution.
_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.
_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.
deleteRequestsByActiveIds($activeIds)
Deletes all hint requests relating to a testactive included in given active ids.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
TableGUI class for evaluation of all users.
This class handles all operations on files (attachments) in directory ilias_data/mail.
recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
_addLog($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=FALSE, $test_ref_id=NULL)
Add an assessment log entry.
_getLogLanguage()
retrieve the log language for assessment logging
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
_getManualScoring()
Retrieve the manual scoring settings.
& _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.
_getParticipantData($active_id)
Retrieves a participant name from active id.
static getPoolQuestionChangeListener(ilDB $db, $poolObjId)
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.
setShowSolutionFeedback($a_feedback=TRUE)
Sets if the the feedback should be presented to the user in the solution or not.
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()
& _getAvailableTests($use_object_id=FALSE)
Returns the available tests for the active 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.
_getPassScoring($active_id)
Gets the pass scoring type.
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)
getProcessingTimeAsMinutes()
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.
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
getQuestionTitle($title)
Returns the title of a test question and checks if the title output is allowed.
setTestId($a_id)
Sets the test ID.
& getExistingQuestions($pass=NULL)
Get the id's of the questions which are already part of the test.
getShowKioskModeParticipant()
Returns the status of the kiosk mode participant.
setKiosk($kiosk=0)
Sets the kiosk mode for the test.
getHighscoreWTime()
Gets if the column with the workingtime should be shown.
getHighscoreOwnTable()
Gets if the own rankings table should be shown.
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.
getEnableProcessingTime()
Returns the state of the processing time (enabled/disabled)
_getObjectIDFromTestID($test_id)
Returns the ILIAS test object id for a given test id.
getListOfQuestionsStart()
Returns if the list of questions should be presented as the first page of the test.
& getCompleteEvaluationData($withStatistics=TRUE, $filterby="", $filtertext="")
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.
$char_selector_availability
isComplete(ilTestQuestionSetConfig $testQuestionSetConfig)
Returns true, if a test is complete for use and can be set online.
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)
_getActiveIdOfUser($user_id="", $test_id="")
Gets the active id of the tst_active table for the active user.
& 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.
setScoringFeedbackOptionsByArray($options)
getDetailedTestResults($participants)
returns all test results for all participants
_getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
setActivationEndingTime($ending_time=NULL)
setAllowedUsers($a_allowed_users)
isNrOfTriesReached($tries)
returns if number of tries are reached
reindexFixedQuestionOrdering()
_lookupAnonymity($a_obj_id)
Returns the anonymity status of a test with a given object id.
static getTestObjIdsWithActiveForUserId($userId)
setTemplate($template_id)
setShowExamviewPdf($show_examview_pdf)
_getCountSystem($active_id)
Gets the count system for the calculation of points.
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.
getQuestionCount()
Returns the number of questions in the test.
create($a_upload=false)
create test object
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
prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output in tests.
saveAuthorToMetadata($a_author="")
Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be c...
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()
loadQuestions($active_id="", $pass=NULL)
Load the test question id's from the database.
createExportDirectory()
creates data directory for export files (data_dir/tst_data/tst_<id>/export, depending on data directo...
setShowGradingStatusEnabled($showGradingStatusEnabled)
& 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.
setListOfQuestionsStart($a_value=TRUE)
Sets if the the list of questions as the start page of the test.
_getImportDirectory()
Get the import directory location of the test.
getFixedParticipants()
Returns the fixed participants status.
isBestSolutionPrintedWithResult()
getAnsweredQuestionCount($active_id, $pass=NULL)
Retrieves the number of answered questions for a given user in a given test.
_lookupRandomTestFromActiveId($active_id)
Returns the random status of a test with a given object id.
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.
deliverPDFfromHTML($content, $title=NULL)
Delivers a PDF file from XHTML.
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.
setListOfQuestionsDescription($a_value=TRUE)
Sets the show_summary attribute to TRUE if the list of questions should be presented with the questio...
setEndingTimeEnabled($ending_time_enabled)
setShowPassDetails($a_details=1)
Sets if the pass details should be shown when a test is not finished.
isScoreReportingAvailable()
insertQuestion(ilTestQuestionSetConfig $testQuestionSetConfig, $question_id, $linkOnly=false)
Insert a question in the list of questions.
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
buildName($user_id, $firstname, $lastname, $title)
Builds a user name for the output depending on test type and existence of the user.
hasQuestionsWithoutQuestionpool()
$print_best_solution_with_result
setCountSystem($a_count_system=COUNT_PARTIAL_SOLUTIONS)
Sets the count system for the calculation of points.
setStartingTime($starting_time=NULL)
Sets the starting time in database timestamp format for the test.
_getQuestionCountAndPointsForPassOfParticipant($active_id, $pass)
$instantFeedbackAnswerFixationEnabled
setShowSolutionSuggested($a_solution=FALSE)
Set to TRUE, if the suggested solution should be shown in the solution.
getImagePath()
Returns the image path for web accessable images of a test The image path is under the CLIENT_WEB_DIR...
setActivationStartingTime($starting_time=NULL)
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
randomSelectQuestions($nr_of_questions, $questionpool, $use_obj_id=0, $qpls="", $pass=NULL)
Returns a random selection of questions.
setShowSolutionListComparison($a_comparison=FALSE)
Set to TRUE, if the list of answers should be shown prior to finish the test.
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.
_setImportDirectory($a_import_dir=null)
set import directory
& 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.
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...
& getTotalPointsPassedArray()
Returns an array with the total points of all users who passed the test This array could be used for ...
_getSolvedQuestions($active_id, $question_fi=null)
get solved questions
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
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...
_getBestPass($active_id)
Retrieves the best pass of a given user for a given test.
getShowSolutionFeedback()
Returns if the feedback should be presented to the solution or not.
setShowSolutionSignature($a_signature=FALSE)
Set to TRUE, if the signature field should be shown in the solution.
setHighscoreTopNum($a_top_num)
Sets the number of entries which are to be shown in the top-rankings table.
evalTotalFinished()
Returns the number of total finished tests.
getTimeExtensionsOfParticipants()
getActivationStartingTime()
evalTotalStartedAverageTime()
Returns the average processing time for all started tests.
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='')
saveToDb($properties_only=FALSE)
Saves a ilObjTest object to a database.
setCustomStyle($a_customStyle=NULL)
Set the custom style.
setKioskMode($a_kiosk=FALSE)
Sets the kiosk mode for the test.
getKiosk()
Returns the kiosk mode.
getResultsForActiveId($active_id)
isExecutable($testSession, $user_id, $allowPassIncrease=FALSE)
Checks if the test is executable by the given user.
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)
setListOfQuestions($a_value=TRUE)
Sets if the the list of questions should be presented to the user or not.
$activation_starting_time
getAuthor()
Gets the authors name of the ilObjTest object.
$forceInstantFeedbackEnabled
getAnswerFeedbackPoints()
Returns 1 if answer specific feedback as reached points is activated.
setIntroductionEnabled($introductionEnabled)
getProcessingTimeInSeconds($active_id="")
Returns the processing time for the test in seconds.
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.
_lookupTestObjIdForQuestionId($a_q_id)
Get test Object ID for question ID.
getShowSolutionSuggested()
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.
getCustomStyles()
Return the available custom styles.
setCertificateVisibility($a_value)
Sets the visibility settings of the certificate.
_getMCScoring($active_id)
Gets the scoring type for multiple choice questions.
setResetProcessingTime($reset=0)
Sets wheather the processing time should be reset or not.
moveQuestions($move_questions, $target_index, $insert_mode)
Move questions to another position.
setListOfQuestionsSettings($a_value=0)
Sets the settings for the list of questions options in the test properties This could contain one of ...
isSkillServiceToBeConsidered()
canShowTestResults($testSession)
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.
static isSkillManagementGloballyActivated()
getHighscoreHints()
Gets, if the column with the number of requested hints should be shown.
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.
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.
_lookupAuthor($obj_id)
Gets the authors name of the ilObjTest object.
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)
getShowInfo()
Gets whether the complete information page is shown or the required data only.
setListOfQuestionsEnd($a_value=TRUE)
Sets if the the list of questions as the end page of the test.
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 _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
getQuestionDataset($question_id)
Returns the dataset for a given question id.
getCharSelectorDefinition()
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)
getHighscoreAchievedTS()
Returns if date and time of the scores achievement should be displayed.
& 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.
canViewResults()
Returns true, if the test results can be viewed.
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)
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.
$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.
getHighscoreTopNum($a_retval=10)
Gets the number of entries which are to be shown in the top-rankings table.
setSpecificAnswerFeedback($specific_answer_feedback)
setMailNotificationType($a_type)
static ensureParticipantsLastActivePassFinished($testObjId, $userId, $a_force_new_run=FALSE)
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)
& processCSVRow($row, $quoteAll=FALSE, $separator=";")
Processes an array as a CSV row and converts the array values to correct CSV values.
& getQuestionsOfTest($active_id)
Retrieves all the assigned questions for all test passes of a test participant.
getMailNotificationType()
removeQuestions($removeQuestionIds)
lookupExamId($active_id, $pass)
getForceJS()
Gets whether JavaScript should be forced for tests.
& 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.
setPassword($a_password=NULL)
Sets the password for test access.
read($a_force_db=false)
read object data from db into object
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.
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.
getImagePathWeb()
Returns the web image path for web accessable images of a test The image path is under the web access...
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
getEndingTime()
Returns the ending time of the test.
_getMaxPass($active_id)
Retrieves the maximum pass of a given user for a given test in which the user answered at least one q...
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)
& _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
getCompleteWorkingTimeOfParticipant($active_id)
Returns the complete working time in seconds for a test participant.
evalTotalPersons()
Returns the number of persons who started the test.
setEnableExamview($enable_examview)
notify($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
notifys an object about an event occured Based on the event happend, each object may decide how it re...
static $isSkillManagementGloballyActivated
getScoreReporting()
Gets the score reporting of the ilObjTest object.
getMailNotification()
Get mail notification settings.
getUnfilteredEvaluationData()
setSignSubmission($sign_submission)
setEndingTime($ending_time=NULL)
Sets the ending time in database timestamp format for the test.
setEnableArchiving($enable_archiving)
& _evalResultsOverview($test_id)
Creates an associated array with the results of all participants of a test.
_getObjectIDFromActiveID($active_id)
Returns the ILIAS test object id for a given active id.
setResultFilterTaxIds($resultFilterTaxIds)
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}
addQTIMaterial(&$a_xml_writer, $a_material)
Creates a QTI material tag from a plain text or xhtml text.
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.
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)
& getWorkedQuestions($active_id, $pass=NULL)
Gets the id's of all questions a user already worked through.
toXML()
Returns a QTI xml representation of the test.
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.
setHighscoreWTime($a_wtime)
Sets if the workingtime of the scores should be shown.
setShowSolutionAnswersOnly($a_full=TRUE)
Set to true, if the full solution (including the ILIAS content pages) should be shown in the solution...
setNrOfTries($nr_of_tries=0)
Sets the nr of tries for the test.
getTestStyleLocation($mode="output")
get full style sheet file name (path inclusive) of current user
$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.
getPassFinishDate($active_id, $pass)
Retrieves the number of answered questions for a given user in a given test.
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 getPoolQuestionChangeListeners(ilDB $db, $poolObjId)
canShowSolutionPrintview($user_id=NULL)
Calculates if a user may see the solution printview of his/her test results.
setRedirectionUrl($redirection_url=NULL)
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.
setShowKioskModeTitle($a_title=FALSE)
Set to true, if the full test title should be shown in kiosk mode.
_getTestIDFromObjectID($object_id)
Returns the ILIAS test id for a given object id.
$online
the object's online status
setExportSettingsSingleChoiceShort($a_settings)
& getQuestionTypeTranslations()
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.
getCustomStyle()
Get the custom style.
checkMarks()
{boolean|string True or an error string which can be used for display purposes}
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.
_getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
setShowExamviewHtml($show_examview_html)
const SCORE_REPORTING_DATE
setMCScoring($a_mc_scoring=SCORE_ZERO_POINTS_WHEN_UNANSWERED)
Sets the multiple choice scoring.
$offeringQuestionHintsEnabled
getTextAnswer($active_id, $question_id, $pass=NULL)
Returns the text answer of a given user for a given question.
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.
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 manual feedback for a question in a test.
inviteRole($role_id)
Invites all users of a role to a test.
_getScoreCutting($active_id)
Determines if the score of a question should be cut at 0 points or the score of the whole test.
getJavaScriptOutput()
Returns if Javascript should be chosen for drag & drop actions for the active user.
static isQuestionObligatory($question_id)
checks wether the question with given id is marked as obligatory or not
getTestParticipantsForManualScoring($filter=NULL)
update()
update object data
canShowCertificate($testSession, $user_id, $active_id)
Checks whether the certificate button could be shown on the info page or not.
setShowKioskModeParticipant($a_participant=FALSE)
Set to true, if the participant's name should be shown in kiosk mode.
getNrOfResultsForPass($active_id, $pass)
Calculates the number of user results for a specific test pass.
isShowGradingMarkEnabled()
createRandomSolutions($number)
setExportSettings($a_settings)
getStartingTimeOfParticipants()
addExtraTime($active_id, $minutes)
cleanupMediaobjectUsage()
Cleans up the media objects for all text fields in a test which are using an RTE field.
userLookupFullName($user_id, $overwrite_anonymity=FALSE, $sorted_order=FALSE, $suffix="")
Returns the full name of a test user according to the anonymity status.
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.
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
hasNrOfTriesRestriction()
returns if the numbers of tries have to be checked
const SCORE_REPORTING_DISABLED
setTmpCopyWizardCopyId($tmpCopyWizardCopyId)
getVisitTimeOfParticipant($active_id)
Returns the first and last visit of a participant.
& getAllQuestions($pass=NULL)
Returns all questions of a test in test order.
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.
_getWorkingTimeOfParticipantForPass($active_id, $pass)
Returns the complete working time in seconds for a test participant.
getIntroduction()
Gets the introduction text of the ilObjTest object.
getAnswerFeedback()
Returns 1 if generic answer feedback is activated.
_createImportDirectory()
creates data directory for import files (data_dir/tst_data/tst_<id>/import, depending on data directo...
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
_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.
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)
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone object permissions, put in tree ...
static _lookupTitle($a_id)
lookup object title
setTitle($a_title)
set object title
ilObject($a_id=0, $a_reference=true)
Constructor @access public.
deleteMetaData()
delete meta data entry
static _lookupDescription($a_id)
lookup object description
_lookupOwner($a_id)
lookup object owner
setDescription($a_desc)
set object description
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.
getTitle()
get object title @access public
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
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...
_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)
Create an XML_RPC2 client instance.
Skill management settings.
special template class to simplify handling of ITX/PEAR
Test certificate adapter.
Base Exception for all Exceptions relating to Modules/Test.
Class ilTestMailNotification.
isQuestionSetConfigured()
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)
Create a temporary file in an ILIAS writable directory.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static removeTrailingPathSeparators($path)
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.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
const SCORE_ZERO_POINTS_WHEN_UNANSWERED
const COUNT_PARTIAL_SOLUTIONS
const TEST_FIXED_SEQUENCE
Test constants.
redirection script todo: (a better solution should control the processing via a xml file)
if(!is_array($argv)) $options
const ILIAS_ABSOLUTE_PATH