4require_once 
'Services/Object/classes/class.ilObject.php';
 
    5require_once 
'Modules/Test/classes/inc.AssessmentConstants.php';
 
    6require_once 
'Modules/Test/interfaces/interface.ilMarkSchemaAware.php';
 
    7require_once 
'Modules/Test/interfaces/interface.ilEctsGradesEnabled.php';
 
    8require_once 
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionType.php';
 
  598    public function __construct($a_id = 0, $a_call_by_reference = 
true)
 
  605        $lng->loadLanguageModule(
"assessment");
 
  607        include_once 
"./Modules/Test/classes/class.assMarkSchema.php";
 
  609        $this->mark_schema->createSimpleSchema(
 
  610            $lng->txt(
"failed_short"),
 
  611            $lng->txt(
"failed_official"),
 
  614            $lng->txt(
"passed_short"),
 
  615            $lng->txt(
"passed_official"),
 
  621        $this->author = 
$ilUser->fullname;
 
  622        $this->introductionEnabled = 
false;
 
  623        $this->introduction = 
"";
 
  624        $this->questions = array();
 
  627        $this->instant_verification = 0;
 
  628        $this->answer_feedback_points = 0;
 
  629        $this->reporting_date = 
"";
 
  630        $this->nr_of_tries = 0;
 
  632        $this->use_previous_answers = 1;
 
  633        $this->title_output = 0;
 
  634        $this->starting_time = 
"";
 
  635        $this->ending_time = 
"";
 
  636        $this->processing_time = 
"";
 
  637        $this->enable_processing_time = 
"0";
 
  638        $this->reset_processing_time = 0;
 
  639        $this->ects_output = 
false;
 
  640        $this->ects_fx = 
null;
 
  641        $this->shuffle_questions = 
false;
 
  642        $this->mailnottype = 0;
 
  643        $this->exportsettings = 0;
 
  644        $this->show_summary = 8;
 
  649        $this->answer_feedback = 0;
 
  650        $this->password = 
"";
 
  651        $this->certificate_visibility = 0;
 
  652        $this->allowedUsers = 
"";
 
  653        $this->_showfinalstatement = 
false;
 
  654        $this->_finalstatement = 
"";
 
  655        $this->_showinfo = 
true;
 
  656        $this->_forcejs = 
true;
 
  657        $this->_customStyle = 
"";
 
  658        $this->allowedUsersTimeGap = 
"";
 
  659        $this->anonymity = 0;
 
  660        $this->show_cancel = 0;
 
  661        $this->show_marker = 0;
 
  662        $this->fixed_participants = 0;
 
  667        $this->testSession = 
false;
 
  668        $this->testSequence = 
false;
 
  669        $this->mailnotification = 0;
 
  670        $this->poolUsage = 1;
 
  672        $this->ects_grades = array(
 
  680        $this->autosave = 
false;
 
  681        $this->autosave_ival = 30000;
 
  683        $this->enable_examview = 
false;
 
  684        $this->show_examview_html = 
false;
 
  685        $this->show_examview_pdf = 
false;
 
  686        $this->enable_archiving = 
false;
 
  688        $this->express_mode = 
false;
 
  689        $this->template_id = 
'';
 
  690        $this->redirection_mode = 0;
 
  691        $this->redirection_url = 
null;
 
  692        $this->show_exam_id_in_test_pass_enabled = 
false;
 
  693        $this->show_exam_id_in_test_results_enabled = 
false;
 
  694        $this->sign_submission = 
false;
 
  695        $this->char_selector_availability = 0;
 
  696        $this->char_selector_definition = 
null;
 
  698        $this->showGradingStatusEnabled = 
true;
 
  699        $this->showGradingMarkEnabled = 
true;
 
  701        $this->followupQuestionAnswerFixationEnabled = 
false;
 
  702        $this->instantFeedbackAnswerFixationEnabled = 
false;
 
  704        $this->testFinalBroken = 
false;
 
  706        $this->tmpCopyWizardCopyId = 
null;
 
  718        require_once 
'Services/Utilities/classes/class.ilUtil.php';
 
  761        if (!parent::update()) {
 
  788    public function delete()
 
  791        if (!parent::delete()) {
 
  801        require_once 
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
 
  803        $qsaImportFails->deleteRegisteredImportFails();
 
  804        require_once 
'Modules/Test/classes/class.ilTestSkillLevelThresholdImportFails.php';
 
  806        $sltImportFails->deleteRegisteredImportFails();
 
  821        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
  824        require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
  826        $participantData->load($this->
getTestId());
 
  829        $affectedRows = 
$ilDB->manipulateF(
 
  830            "DELETE FROM tst_mark WHERE test_fi = %s",
 
  835        $affectedRows = 
$ilDB->manipulateF(
 
  836            "DELETE FROM tst_tests WHERE test_id = %s",
 
  841        require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
  843        $testQuestionSetConfigFactory->getQuestionSetConfig()->removeQuestionSetRelatedData();
 
  846        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  848        $directory = $tst_data_dir . 
"/tst_" . $this->
getId();
 
  849        if (is_dir($directory)) {
 
  850            include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  853        include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
  859        foreach (
$mobs as $mob) {
 
  875        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  878        if (!is_writable($tst_data_dir)) {
 
  879            $this->
ilias->raiseError(
"Test Data Directory (" . $tst_data_dir
 
  880                . 
") not writeable.", $this->
ilias->error_obj->MESSAGE);
 
  884        $tst_dir = $tst_data_dir . 
"/tst_" . $this->
getId();
 
  886        if (!@is_dir($tst_dir)) {
 
  887            $this->
ilias->raiseError(
"Creation of Test Directory failed.", $this->
ilias->error_obj->MESSAGE);
 
  890        $export_dir = $tst_dir . 
"/export";
 
  892        if (!@is_dir($export_dir)) {
 
  893            $this->
ilias->raiseError(
"Creation of Export Directory failed.", $this->
ilias->error_obj->MESSAGE);
 
  904        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  915    public function getExportFiles($dir)
 
  918        if (!@is_dir($dir) || !is_writeable($dir)) {
 
  923        foreach (
new DirectoryIterator($dir) as $file) {
 
  927            if ($file->isDir()) {
 
  931            $files[] = $file->getBasename();
 
  944        if (strlen($a_import_dir)) {
 
  945            $_SESSION[
"tst_import_dir"] = $a_import_dir;
 
  959        if (strlen(
$_SESSION[
"tst_import_dir"])) {
 
  978        $ilias = 
$DIC[
'ilias'];
 
  979        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  983        if (!is_writable($tst_data_dir)) {
 
  984            $ilias->raiseError(
"Test Data Directory (" . $tst_data_dir
 
  985                . 
") not writeable.", $ilias->error_obj->FATAL);
 
  989        $tst_dir = $tst_data_dir . 
"/tst_import";
 
  991        if (!@is_dir($tst_dir)) {
 
  992            $ilias->raiseError(
"Creation of test import directory failed.", $ilias->error_obj->FATAL);
 
 1013            "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",
 
 1019            if (strcmp($row[
'foundtypes'], 
'assSingleChoice') == 0) {
 
 1038            "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",
 
 1042        if (
$result->numRows() == 1) {
 
 1044            if (strcmp($row[
'foundtypes'], 
'assSingleChoice') == 0) {
 
 1070                                SELECT  DISTINCT(qpl_qst_sc.shuffle) foundshuffles 
 1076                                WHERE   tst_test_result.question_fi = qpl_questions.question_id 
 1077                                AND             qpl_questions.question_type_fi = qpl_qst_type.question_type_id 
 1078                                AND             tst_test_result.active_fi = tst_active.active_id 
 1079                                AND             qpl_questions.question_id = qpl_qst_sc.question_fi 
 1080                                AND             tst_active.test_fi = %s 
 1081                                AND             qpl_qst_type.type_tag = %s 
 1083            array(
'integer', 
'text'),
 
 1084            array($this->
getTestId(), 
'assSingleChoice')
 
 1086        if (
$result->numRows() == 1) {
 
 1088            return ($row[
'foundshuffles'] == 0);
 
 1101        if (!count($this->mark_schema->mark_steps)) {
 
 1123        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 1126        $test->loadFromDb();
 
 1128        require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 1131        return $test->isComplete($testQuestionSetConfigFactory->getQuestionSetConfig());
 
 1147            if (!preg_match(
'/\d+/', $this->
getECTSFX())) {
 
 1154                                SET ects_output = %s, ects_a = %s, ects_b = %s, ects_c = %s, ects_d = %s, ects_e = %s, ects_fx = %s 
 1155                                WHERE test_id = %s",
 
 1156                array(
'text', 
'float', 
'float', 
'float', 
'float', 
'float', 
'float', 
'integer'),
 
 1159                    $grades[
'A'], $grades[
'B'], $grades[
'C'], $grades[
'D'], $grades[
'E'],
 
 1177        if ($this->
isComplete($testQuestionSetConfig)) {
 
 1182                "UPDATE tst_tests SET complete = %s WHERE test_id = %s",
 
 1183                array(
'text', 
'integer'),
 
 1184                array($complete, $this->test_id)
 
 1209        include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
 1210        $completecontent = 
"";
 
 1212            $completecontent .= $content;
 
 1231        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 1238        require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 1240        $testQuestionSetConfig = $testQuestionSetConfigFactory->getQuestionSetConfig();
 
 1242        include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1243        if ($this->test_id == -1) {
 
 1245            $next_id = 
$ilDB->nextId(
'tst_tests');
 
 1247            $ilDB->insert(
'tst_tests', array(
 
 1248                'test_id' => array(
'integer', $next_id),
 
 1249                'obj_fi' => array(
'integer', $this->
getId()),
 
 1250                'author' => array(
'text', $this->
getAuthor()),
 
 1254                'showinfo' => array(
'integer', $this->
getShowInfo()),
 
 1255                'forcejs' => array(
'integer', $this->
getForceJS()),
 
 1267                'nr_of_tries' => array(
'integer', $this->
getNrOfTries()),
 
 1269                'kiosk' => array(
'integer', $this->
getKiosk()),
 
 1280                'complete' => array(
'text', $this->
isComplete($testQuestionSetConfig)),
 
 1282                'ects_a' => array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : 
null),
 
 1283                'ects_b' => array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : 
null),
 
 1284                'ects_c' => array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : 
null),
 
 1285                'ects_d' => array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : 
null),
 
 1286                'ects_e' => array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : 
null),
 
 1287                'ects_fx' => array(
'float', $this->
getECTSFX()),
 
 1296                'password' => array(
'text', $this->
getPassword()),
 
 1304                'created' => array(
'integer', time()),
 
 1305                'tstamp' => array(
'integer', time()),
 
 1307                'template_id' => array(
'integer', $this->
getTemplate()),
 
 1308                'pool_usage' => array(
'integer', $this->
getPoolUsage()),
 
 1323                'autosave' => array(
'integer', (
int) $this->
getAutosave()),
 
 1346                'pass_waiting' => array(
'text', (
string) $this->
getPassWaiting())
 
 1349            $this->test_id = $next_id;
 
 1359                    "SELECT * FROM tst_tests WHERE test_id = %s",
 
 1361                    array($this->test_id)
 
 1363                if (
$result->numRows() == 1) {
 
 1371                        'author' => array(
'text', $this->
getAuthor()),
 
 1375                        'showinfo' => array(
'integer', $this->
getShowInfo()),
 
 1376                        'forcejs' => array(
'integer', $this->
getForceJS()),
 
 1388                        'nr_of_tries' => array(
'integer', $this->
getNrOfTries()),
 
 1390                        'kiosk' => array(
'integer', $this->
getKiosk()),
 
 1401                        'complete' => array(
'text', $this->
isComplete($testQuestionSetConfig)),
 
 1403                        'ects_a' => array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : 
null),
 
 1404                        'ects_b' => array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : 
null),
 
 1405                        'ects_c' => array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : 
null),
 
 1406                        'ects_d' => array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : 
null),
 
 1407                        'ects_e' => array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : 
null),
 
 1408                        'ects_fx' => array(
'float', $this->
getECTSFX()),
 
 1417                        'password' => array(
'text', $this->
getPassword()),
 
 1425                        'tstamp' => array(
'integer', time()),
 
 1427                        'template_id' => array(
'integer', $this->
getTemplate()),
 
 1428                        'pool_usage' => array(
'integer', $this->
getPoolUsage()),
 
 1443                        'autosave' => array(
'integer', (
int) $this->
getAutosave()),
 
 1466                        'pass_waiting' => array(
'text', (
string) $this->
getPassWaiting())
 
 1469                        'test_id' => array(
'integer', (
int) $this->
getTestId())
 
 1473            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1475                $logresult = 
$ilDB->queryF(
 
 1476                    "SELECT * FROM tst_tests WHERE test_id = %s",
 
 1481                if ($logresult->numRows() == 1) {
 
 1482                    $newrow = 
$ilDB->fetchAssoc($logresult);
 
 1484                $changed_fields = array();
 
 1485                foreach ($oldrow as $key => $value) {
 
 1486                    if (strcmp($oldrow[$key], $newrow[$key]) != 0) {
 
 1487                        array_push($changed_fields, 
"$key: " . $oldrow[$key] . 
" => " . $newrow[$key]);
 
 1490                $changes = join(
", ", $changed_fields);
 
 1491                if (count($changed_fields) > 0) {
 
 1499                    $aresult = 
$ilDB->queryF(
 
 1500                        "SELECT active_id FROM tst_active WHERE test_fi = %s AND tries >= %s AND submitted = %s",
 
 1501                        array(
'integer', 
'integer', 
'integer'),
 
 1504                    while ($row = 
$ilDB->fetchAssoc($aresult)) {
 
 1506                            "UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
 1507                            array(
'integer', 
'timestamp', 
'integer'),
 
 1508                            array(1, date(
'Y-m-d H:i:s'), $row[
"active_id"])
 
 1513                    $aresult = 
$ilDB->queryF(
 
 1514                        "SELECT active_id FROM tst_active WHERE test_fi = %s AND tries < %s AND submitted = %s",
 
 1515                        array(
'integer', 
'integer', 
'integer'),
 
 1518                    while ($row = 
$ilDB->fetchAssoc($aresult)) {
 
 1520                            "UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
 1521                            array(
'integer', 
'timestamp', 
'integer'),
 
 1522                            array(0, 
null, $row[
"active_id"])
 
 1527                    $aresult = 
$ilDB->queryF(
 
 1528                        "SELECT active_id FROM tst_active WHERE test_fi = %s AND submitted = %s",
 
 1529                        array(
'integer', 
'integer'),
 
 1532                    while ($row = 
$ilDB->fetchAssoc($aresult)) {
 
 1534                            "UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
 1535                            array(
'integer', 
'timestamp', 
'integer'),
 
 1536                            array(0, 
null, $row[
"active_id"])
 
 1544        include_once 
'Services/News/classes/class.ilNewsItem.php';
 
 1549            $newsItem->setContext($this->
getId(), 
'tst');
 
 1551            $newsItem->setTitle(
'new_test_online');
 
 1552            $newsItem->setContentIsLangVar(
true);
 
 1553            $newsItem->setContent(
'');
 
 1554            $newsItem->setUserId(
$ilUser->getId());
 
 1556            $newsItem->create();
 
 1563                $newsItem->setTitle(
'new_test_online');
 
 1564                $newsItem->setContentIsLangVar(
true);
 
 1565                $newsItem->setContent(
'');
 
 1566                $newsItem->update();
 
 1571        if ($this->ref_id) {
 
 1572            include_once 
"./Services/Object/classes/class.ilObjectActivation.php";
 
 1585            $item->update($this->ref_id);
 
 1588        if (!$properties_only) {
 
 1593            $this->mark_schema->saveToDb($this->test_id);
 
 1608        $oldquestions = array();
 
 1609        include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 1612                "SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
 
 1618                    array_push($oldquestions, $row[
"question_fi"]);
 
 1624        $currentQuestionsObligationsQuery = 
'SELECT question_fi, obligatory FROM tst_test_question WHERE test_fi = %s';
 
 1625        $rset = 
$ilDB->queryF($currentQuestionsObligationsQuery, array(
'integer'), array($this->
getTestId()));
 
 1626        while ($row = 
$ilDB->fetchAssoc($rset)) {
 
 1627            $obligatoryQuestionState[$row[
'question_fi']] = $row[
'obligatory'];
 
 1630        $affectedRows = 
$ilDB->manipulateF(
 
 1631            "DELETE FROM tst_test_question WHERE test_fi = %s",
 
 1636        foreach ($this->questions as $key => $value) {
 
 1638            if (!isset($obligatoryQuestionState[$value]) || is_null($obligatoryQuestionState[$value])) {
 
 1639                $obligatoryQuestionState[$value] = 0;
 
 1643            $next_id = 
$ilDB->nextId(
'tst_test_question');
 
 1644            $ilDB->insert(
'tst_test_question', array(
 
 1645                'test_question_id' => array(
'integer', $next_id),
 
 1646                'test_fi' => array(
'integer', $this->
getTestId()),
 
 1647                'question_fi' => array(
'integer', $value),
 
 1648                'sequence' => array(
'integer', $key),
 
 1649                'obligatory' => array(
'integer', $obligatoryQuestionState[$value]),
 
 1650                'tstamp' => array(
'integer', time())
 
 1653        include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1656                "SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
 
 1660            $newquestions = array();
 
 1663                    array_push($newquestions, $row[
"question_fi"]);
 
 1666            foreach ($oldquestions as 
$index => $question_id) {
 
 1667                if (strcmp($newquestions[
$index], $question_id) != 0) {
 
 1668                    $pos = array_search($question_id, $newquestions);
 
 1669                    if ($pos === 
false) {
 
 1676            foreach ($newquestions as 
$index => $question_id) {
 
 1677                if (array_search($question_id, $oldquestions) === 
false) {
 
 1694            'SELECT copy_id FROM tst_rnd_cpy WHERE tst_fi = %s',
 
 1698        return $result->numRows() > 0;
 
 1716        $rbacsystem = 
$DIC[
'rbacsystem'];
 
 1720        if (($questionpool != 0) && (!$use_obj_id)) {
 
 1726            "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",
 
 1730        $original_ids = array();
 
 1731        $paramtypes = array();
 
 1732        $paramvalues = array();
 
 1734            array_push($original_ids, $row[
'original_id']);
 
 1739        if (($questionpool == 0) && (!is_array($qpls))) {
 
 1740            include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 1742            if (count($available_pools)) {
 
 1743                $available = 
" AND " . 
$ilDB->in(
'obj_fi', $available_pools, 
false, 
'integer');
 
 1749        $constraint_qpls = 
"";
 
 1750        $result_array = array();
 
 1751        if ($questionpool == 0) {
 
 1752            if (is_array($qpls)) {
 
 1753                if (count($qpls) > 0) {
 
 1754                    $constraint_qpls = 
" AND " . 
$ilDB->in(
'obj_fi', $qpls, 
false, 
'integer');
 
 1759        $original_clause = 
"";
 
 1760        if (count($original_ids)) {
 
 1761            $original_clause = 
" AND " . 
$ilDB->in(
'question_id', $original_ids, 
true, 
'integer');
 
 1764        if ($questionpool == 0) {
 
 1766                "SELECT question_id FROM qpl_questions WHERE original_id IS NULL $available $constraint_qpls AND owner > %s AND complete = %s $original_clause",
 
 1767                array(
'integer', 
'text'),
 
 1772                "SELECT question_id FROM qpl_questions WHERE original_id IS NULL AND obj_fi = %s AND owner > %s AND complete = %s $original_clause",
 
 1773                array(
'integer',
'integer', 
'text'),
 
 1774                array($questionpool, 0, 
"1")
 
 1777        $found_ids = array();
 
 1779            array_push($found_ids, $row[
'question_id']);
 
 1781        $nr_of_questions = ($nr_of_questions > count($found_ids)) ? count($found_ids) : $nr_of_questions;
 
 1782        if ($nr_of_questions == 0) {
 
 1785        $rand_keys = array_rand($found_ids, $nr_of_questions);
 
 1787        if (is_array($rand_keys)) {
 
 1788            foreach ($rand_keys as $key) {
 
 1789                $result[$found_ids[$key]] = $found_ids[$key];
 
 1792            $result[$found_ids[$rand_keys]] = $found_ids[$rand_keys];
 
 1810            "SELECT test_result_id FROM tst_test_result WHERE active_fi = %s AND pass = %s",
 
 1811            array(
'integer',
'integer'),
 
 1812            array($active_id, 
$pass)
 
 1832            "SELECT test_random_question_id FROM tst_test_rnd_qst WHERE active_fi = %s AND pass = %s",
 
 1833            array(
'integer',
'integer'),
 
 1834            array($active_id, 
$pass)
 
 1836        return (
$result->numRows() > 0) ? true : 
false;
 
 1848            "SELECT * FROM tst_tests WHERE obj_fi = %s",
 
 1850            array($this->
getId())
 
 1852        if (
$result->numRows() == 1) {
 
 1859            include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
 1897                    "A" => 
$data->ects_a,
 
 1898                    "B" => 
$data->ects_b,
 
 1899                    "C" => 
$data->ects_c,
 
 1900                    "D" => 
$data->ects_d,
 
 1901                    "E" => 
$data->ects_e
 
 1905            $this->mark_schema->flush();
 
 1906            $this->mark_schema->loadFromDb($this->
getTestId());
 
 1964        if ($this->ref_id) {
 
 1965            include_once 
"./Services/Object/classes/class.ilObjectActivation.php";
 
 1967            switch ($activation[
"timing_type"]) {
 
 1994        $this->questions = array();
 
 1996            if (strcmp($active_id, 
"") == 0) {
 
 1999            if (is_null(
$pass)) {
 
 2003                "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",
 
 2004                array(
'integer', 
'integer'),
 
 2005                array($active_id, 
$pass)
 
 2011            if (
$result->numRows() == 0) {
 
 2013                    "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",
 
 2020                "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",
 
 2022                array($this->test_id)
 
 2027            $this->questions[
$index++] = 
$data[
"question_fi"];
 
 2055        return (strlen($this->introduction)) ? $this->introduction : 
null;
 
 2083        if (is_null($a_statement)) {
 
 2098        $this->_showinfo = ($a_info) ? 1 : 0;
 
 2110        $this->_forcejs = ($a_js) ? 1 : 0;
 
 2122        $this->_customStyle = $a_customStyle;
 
 2134        return (strlen($this->_customStyle)) ? $this->_customStyle : 
null;
 
 2147        $css_path = str_replace(
"ta.css", 
"customstyles", $css_path) . 
"/";
 
 2148        $customstyles = array();
 
 2149        if (is_dir($css_path)) {
 
 2151            include_once 
"./Services/Utilities/classes/class.ilFileUtils.php";
 
 2161        return $customstyles;
 
 2175            $custom = str_replace(
"ta.css", 
"customstyles/" . $this->
getCustomStyle(), $default);
 
 2176            if (file_exists($custom)) {
 
 2178                $custom = str_replace(
"ta.css", 
"customstyles/" . $this->
getCustomStyle(), $custom);
 
 2197        $this->_showfinalstatement = ($show) ? 1 : 0;
 
 2208        return (strlen($this->_finalstatement)) ? $this->_finalstatement : 
null;
 
 2220        return ($this->_showinfo) ? 1 : 0;
 
 2232        return ($this->_forcejs) ? 1 : 0;
 
 2244        return ($this->_showfinalstatement) ? 1 : 0;
 
 2264        return ($this->ects_output) ? 1 : 0;
 
 2272        $this->ects_output = $a_ects_output ? 1 : 0;
 
 2280        return (strlen($this->ects_fx)) ? $this->ects_fx : 
null;
 
 2288        $this->ects_fx = $a_ects_fx;
 
 2304        $this->ects_grades = $a_ects_grades;
 
 2314        return ($this->sequence_settings) ? $this->sequence_settings : 0;
 
 2364        switch ($instant_feedback) {
 
 2366                $this->instant_verification = 1;
 
 2369                $this->instant_verification = 0;
 
 2385            $this->answer_feedback = 1;
 
 2388            $this->answer_feedback = 0;
 
 2400        switch ($generic_answer_feedback) {
 
 2402            $this->answer_feedback = 1;
 
 2405            $this->answer_feedback = 0;
 
 2421                $this->answer_feedback_points = 1;
 
 2424                $this->answer_feedback_points = 0;
 
 2436            $this->reporting_date = 
'';
 
 2458        return ($this->score_reporting) ? $this->score_reporting : 0;
 
 2487        return ($this->instant_verification) ? $this->instant_verification : 0;
 
 2500        return ($this->answer_feedback) ? $this->answer_feedback : 0;
 
 2511        return ($this->answer_feedback) ? $this->answer_feedback : 0;
 
 2523        return ($this->answer_feedback_points) ? $this->answer_feedback_points : 0;
 
 2535        return ($this->count_system) ? $this->count_system : 0;
 
 2550            "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",
 
 2556            return $row[
"count_system"];
 
 2570        return ($this->mc_scoring) ? $this->mc_scoring : 0;
 
 2582        return ($this->score_cutting) ? $this->score_cutting : 0;
 
 2594        return ($this->pass_scoring) ? $this->pass_scoring : 0;
 
 2609            "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",
 
 2615            return $row[
"pass_scoring"];
 
 2632            "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",
 
 2638            return $row[
"mc_scoring"];
 
 2655            "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",
 
 2661            return $row[
"score_cutting"];
 
 2675        return (strlen($this->reporting_date)) ? $this->reporting_date : 
null;
 
 2687        return ($this->nr_of_tries) ? $this->nr_of_tries : 0;
 
 2715        return ($this->_kiosk) ? $this->_kiosk : 0;
 
 2728        $this->_kiosk = $kiosk;
 
 2740        if (($this->_kiosk & 1) > 0) {
 
 2757            $this->_kiosk = $this->_kiosk | 1;
 
 2760                $this->_kiosk = $this->_kiosk ^ 1;
 
 2774        if (($this->_kiosk & 2) > 0) {
 
 2790            $this->_kiosk = $this->_kiosk | 2;
 
 2793                $this->_kiosk = $this->_kiosk ^ 2;
 
 2807        if (($this->_kiosk & 4) > 0) {
 
 2822        if ($a_participant) {
 
 2823            $this->_kiosk = $this->_kiosk | 4;
 
 2826                $this->_kiosk = $this->_kiosk ^ 4;
 
 2840        return ($this->use_previous_answers) ? $this->use_previous_answers : 0;
 
 2852        return ($this->title_output) ? $this->title_output : 0;
 
 2869            "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",
 
 2875            return $row[
"title_output"];
 
 2906            "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",
 
 2916            if ($user_active_user_setting) {
 
 2917                $res = 
$ilUser->getPref(
"tst_use_previous_answers");
 
 2918                if (
$res !== 
false) {
 
 2935        return (strlen($this->processing_time)) ? $this->processing_time : 
null;
 
 2946        if (strlen($this->processing_time)) {
 
 2947            if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches)) {
 
 2948                if ((
int) $matches[1] + (
int) $matches[2] + (
int) $matches[3] == 0) {
 
 2952                        'hh' => $matches[1],
 
 2953                        'mm' => $matches[2],
 
 2954                        'ss' => $matches[3],
 
 2964        if (strlen($this->processing_time)) {
 
 2965            if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches)) {
 
 2966                return ($matches[1] * 60) + $matches[2];
 
 2982        if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $this->
getProcessingTime(), $matches)) {
 
 2984            return ($matches[1] * 3600) + ($matches[2] * 60) + $matches[3] + $extratime;
 
 3002            return $ending - $now;
 
 3017        return ($this->enable_processing_time) ? $this->enable_processing_time : 0;
 
 3029        return ($this->reset_processing_time) ? $this->reset_processing_time : 0;
 
 3057        return ($this->starting_time != 0) ? $this->starting_time : 0;
 
 3097        return ($this->ending_time != 0) ? $this->ending_time : 0;
 
 3134            $this->use_previous_answers = 1;
 
 3136            $this->use_previous_answers = 0;
 
 3168                $this->title_output = 1;
 
 3171                $this->title_output = 2;
 
 3174                $this->title_output = 0;
 
 3193        $this->processing_time = sprintf(
"%02d:%02d:00", floor($minutes / 60), $minutes % 60);
 
 3206            $this->enable_processing_time = 
"1";
 
 3208            $this->enable_processing_time = 
"0";
 
 3222            $this->reset_processing_time = 1;
 
 3224            $this->reset_processing_time = 0;
 
 3237        $this->count_system = $a_count_system;
 
 3265        return (strlen($this->password)) ? $this->password : 
null;
 
 3277        $this->password = $a_password;
 
 3289        $this->score_cutting = $a_score_cutting;
 
 3301        $this->mc_scoring = $a_mc_scoring;
 
 3313        switch ($a_pass_scoring) {
 
 3361            $DIC[
'ilPluginAdmin'],
 
 3365        foreach ($activeIds as $activeId) {
 
 3367            $passSelector->setActiveId($activeId);
 
 3369            foreach ($passSelector->getExistingPasses() as 
$pass) {
 
 3370                $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($activeId, 
$pass);
 
 3373                $testSequence->removeQuestion($questionId, $reindexedSequencePositionMap);
 
 3384        foreach ($removeQuestionIds as $value) {
 
 3401        include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3405        $question->delete($question_id);
 
 3424        require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
 3426        $participantData->setUserIdsFilter($userIds);
 
 3427        $participantData->load($this->
getTestId());
 
 3440            require_once 
'Services/Object/classes/class.ilObjectLP.php';
 
 3442            $testLP->setTestObject($this);
 
 3443            $testLP->resetLPDataForUserIds($participantData->
getUserIds(), 
false);
 
 3457        require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
 3459        $participantData->setUserIdsFilter($userIds);
 
 3460        $participantData->load($this->
getTestId());
 
 3462        $IN_userIds = 
$ilDB->in(
'usr_id', $participantData->getUserIds(), 
false, 
'integer');
 
 3464            "DELETE FROM usr_pref WHERE $IN_userIds AND keyword = %s",
 
 3466            array(
"tst_password_" . $this->
getTestId())
 
 3469        if (count($participantData->getActiveIds())) {
 
 3479        $IN_activeIds = 
$ilDB->in(
'active_fi', $activeIds, 
false, 
'integer');
 
 3481        $ilDB->manipulate(
"DELETE FROM tst_solutions WHERE $IN_activeIds");
 
 3482        $ilDB->manipulate(
"DELETE FROM tst_qst_solved WHERE $IN_activeIds");
 
 3483        $ilDB->manipulate(
"DELETE FROM tst_test_result WHERE $IN_activeIds");
 
 3484        $ilDB->manipulate(
"DELETE FROM tst_pass_result WHERE $IN_activeIds");
 
 3485        $ilDB->manipulate(
"DELETE FROM tst_result_cache WHERE $IN_activeIds");
 
 3486        $ilDB->manipulate(
"DELETE FROM tst_sequence WHERE $IN_activeIds");
 
 3487        $ilDB->manipulate(
"DELETE FROM tst_times WHERE $IN_activeIds");
 
 3490            $ilDB->manipulate(
"DELETE FROM tst_test_rnd_qst WHERE $IN_activeIds");
 
 3492            $ilDB->manipulate(
"DELETE FROM tst_seq_qst_tracking WHERE $IN_activeIds");
 
 3493            $ilDB->manipulate(
"DELETE FROM tst_seq_qst_answstatus WHERE $IN_activeIds");
 
 3494            $ilDB->manipulate(
"DELETE FROM tst_seq_qst_postponed WHERE $IN_activeIds");
 
 3495            $ilDB->manipulate(
"DELETE FROM tst_seq_qst_checked WHERE $IN_activeIds");
 
 3498        include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3500        foreach ($activeIds as $active_id) {
 
 3502            if (@is_dir(CLIENT_WEB_DIR . 
"/assessment/tst_" . $this->
getTestId() . 
"/$active_id")) {
 
 3511        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
 
 3520        $IN_activeIds = 
$ilDB->in(
'active_id', $activeIds, 
false, 
'integer');
 
 3521        $ilDB->manipulate(
"DELETE FROM tst_active WHERE $IN_activeIds");
 
 3538            "SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
 
 3539            array(
'integer', 
'integer'),
 
 3543        if (
$data->sequence > 1) {
 
 3546                "SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
 
 3547                array(
'integer',
'integer'),
 
 3552            $affectedRows = 
$ilDB->manipulateF(
 
 3553                "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3554                array(
'integer',
'integer'),
 
 3555                array(
$data->sequence, $data_previous->test_question_id)
 
 3558            $affectedRows = 
$ilDB->manipulateF(
 
 3559                "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3560                array(
'integer',
'integer'),
 
 3561                array(
$data->sequence - 1, 
$data->test_question_id)
 
 3563            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3585            "SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
 
 3586            array(
'integer',
'integer'),
 
 3591            "SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
 
 3592            array(
'integer',
'integer'),
 
 3595        if (
$result->numRows() == 1) {
 
 3599            $affectedRows = 
$ilDB->manipulateF(
 
 3600                "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3601                array(
'integer',
'integer'),
 
 3602                array(
$data->sequence, $data_next->test_question_id)
 
 3605            $affectedRows = 
$ilDB->manipulateF(
 
 3606                "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3607                array(
'integer',
'integer'),
 
 3608                array(
$data->sequence + 1, 
$data->test_question_id)
 
 3610            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3630        $duplicate_id = $question->duplicate(
true, 
null, 
null, 
null, $this->
getId());
 
 3632        return $duplicate_id;
 
 3647        #var_dump($question_id); 
 3649            $duplicate_id = $question_id;
 
 3656            "SELECT MAX(sequence) seq FROM tst_test_question WHERE test_fi=%s",
 
 3662        if (
$result->numRows() == 1) {
 
 3664            $sequence = 
$data->seq + 1;
 
 3667        $next_id = 
$ilDB->nextId(
'tst_test_question');
 
 3668        $affectedRows = 
$ilDB->manipulateF(
 
 3669            "INSERT INTO tst_test_question (test_question_id, test_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
 
 3670            array(
'integer', 
'integer',
'integer',
'integer',
'integer'),
 
 3671            array($next_id, $this->
getTestId(), $duplicate_id, $sequence, time())
 
 3673        if ($affectedRows == 1) {
 
 3674            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3680        $affectedRows = 
$ilDB->manipulateF(
 
 3681            "DELETE FROM tst_active WHERE test_fi = %s",
 
 3687        return $duplicate_id;
 
 3704                "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",
 
 3709                array_push($titles, $row[
"title"]);
 
 3729                "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",
 
 3734                $titles[$row[
'question_id']] = $row[
"title"];
 
 3756            } elseif (isset($nr)) {
 
 3757                return $this->lng->txt(
"ass_question") . 
' ' . $nr;
 
 3759                return $this->lng->txt(
"ass_question");
 
 3781            "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",
 
 3801        $existing_questions = array();
 
 3804            if (is_null(
$pass)) {
 
 3808                "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",
 
 3809                array(
'integer',
'integer'),
 
 3810                array($active_id, 
$pass)
 
 3814                "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",
 
 3820            if (
$data->original_id === 
null) {
 
 3824            array_push($existing_questions, 
$data->original_id);
 
 3826        return $existing_questions;
 
 3841        if ($question_id < 1) {
 
 3845            "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",
 
 3849        if (
$result->numRows() == 1) {
 
 3851            return $data->type_tag;
 
 3868        $next_id = 
$ilDB->nextId(
'tst_times');
 
 3869        $affectedRows = 
$ilDB->manipulateF(
 
 3870            "INSERT INTO tst_times (times_id, active_fi, started, finished, pass, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
 
 3871            array(
'integer', 
'integer', 
'timestamp', 
'timestamp', 
'integer', 
'integer'),
 
 3872            array($next_id, $active_id, strftime(
"%Y-%m-%d %H:%M:%S"), strftime(
"%Y-%m-%d %H:%M:%S"), 
$pass, time())
 
 3888        $affectedRows = 
$ilDB->manipulateF(
 
 3889            "UPDATE tst_times SET finished = %s, tstamp = %s WHERE times_id = %s",
 
 3890            array(
'timestamp', 
'integer', 
'integer'),
 
 3891            array(strftime(
"%Y-%m-%d %H:%M:%S"), time(), $times_id)
 
 3907        if (is_null(
$pass)) {
 
 3909                "SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
 
 3910                array(
'integer',
'integer'),
 
 3911                array($active_id, 0)
 
 3915                "SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
 
 3916                array(
'integer',
'integer'),
 
 3917                array($active_id, 
$pass)
 
 3920        $result_array = array();
 
 3922            array_push($result_array, $row[
"question_fi"]);
 
 3924        return $result_array;
 
 3938        return ((($currentpass > 0) && ($num == 0)) || $this->
isTestFinished($active_id)) ? true : 
false;
 
 3953        $result_array = array();
 
 3957            if (count($this->questions) == 0) {
 
 3958                return $result_array;
 
 3960            if (is_null(
$pass)) {
 
 3964                "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'),
 
 3965                array(
'integer',
'integer'),
 
 3966                array($active_id, 
$pass)
 
 3969            if (count($this->questions) == 0) {
 
 3970                return $result_array;
 
 3972            $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'));
 
 3975            $result_array[$row[
"question_id"]] = $row;
 
 3977        return $result_array;
 
 3999                "SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
 
 4000                array(
'integer',
'integer',
'text'),
 
 4003        } elseif (strlen($anonymous_id)) {
 
 4005                "SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
 
 4006                array(
'integer',
'integer',
'text'),
 
 4007                array($user_id, $this->test_id, $anonymous_id)
 
 4010            if (
$GLOBALS[
'DIC'][
'ilUser']->
getId() == ANONYMOUS_USER_ID) {
 
 4014                "SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
 
 4015                array(
'integer',
'integer'),
 
 4016                array($user_id, $this->test_id)
 
 4021            return $row[
"active_id"];
 
 4048            "SELECT tst_active.active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
 
 4049            array(
'integer', 
'integer'),
 
 4054            return $row[
"active_id"];
 
 4068        $keys = array_keys($array);
 
 4071        foreach (
$keys as $key) {
 
 4084    public function &
getTestResult($active_id, 
$pass = 
null, $ordered_sequence = 
false, $considerHiddenQuestions = 
true, $considerOptionalQuestions = 
true)
 
 4090        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 4094        if (is_null(
$pass)) {
 
 4098        require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
 4100        $testSession = $testSessionFactory->getSession($active_id);
 
 4102        require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 4104        $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($active_id, 
$pass);
 
 4107            require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 4109            $dynamicQuestionSetConfig->loadFromDb();
 
 4116            $testSequence->setConsiderHiddenQuestionsEnabled($considerHiddenQuestions);
 
 4117            $testSequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions);
 
 4122            if ($ordered_sequence) {
 
 4129        $arrResults = array();
 
 4132                        SELECT          tst_test_result.question_fi, 
 4133                                                tst_test_result.points reached, 
 4134                                                tst_test_result.hint_count requested_hints, 
 4135                                                tst_test_result.hint_points hint_points, 
 4136                                                tst_test_result.answered answered 
 4138                        FROM            tst_test_result 
 4140                        LEFT JOIN       tst_solutions 
 4141                        ON                      tst_solutions.active_fi = tst_test_result.active_fi 
 4142                        AND                     tst_solutions.question_fi = tst_test_result.question_fi 
 4144                        WHERE           tst_test_result.active_fi = %s 
 4145                        AND                     tst_test_result.pass = %s 
 4148        $solutionresult = 
$ilDB->queryF(
 
 4150            array(
'integer', 
'integer'),
 
 4151            array($active_id, 
$pass)
 
 4154        while ($row = 
$ilDB->fetchAssoc($solutionresult)) {
 
 4155            $arrResults[ $row[
'question_fi'] ] = $row;
 
 4158        $numWorkedThrough = count($arrResults);
 
 4160        require_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 4162        $IN_question_ids = 
$ilDB->in(
'qpl_questions.question_id', $sequence, 
false, 
'integer');
 
 4165                        SELECT          qpl_questions.*, 
 4166                                                qpl_qst_type.type_tag, 
 4167                                                qpl_sol_sug.question_fi has_sug_sol 
 4172                        LEFT JOIN       qpl_sol_sug 
 4173                        ON                      qpl_sol_sug.question_fi = qpl_questions.question_id 
 4175                        WHERE           qpl_qst_type.question_type_id = qpl_questions.question_type_fi 
 4176                        AND                     $IN_question_ids 
 4181        $unordered = array();
 
 4185        $obligationsAnswered = 
true;
 
 4189                $row[
'points'] ? $arrResults[ $row[
'question_id'] ][
'reached'] / $row[
'points'] : 0
 
 4192            if ($percentvalue < 0) {
 
 4193                $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']) {
 
 4213                $obligationsAnswered = 
false;
 
 4216            $unordered[ $row[
'question_id'] ] = 
$data;
 
 4221        $numQuestionsTotal = count($unordered);
 
 4225        $pass_requested_hints = 0;
 
 4226        $pass_hint_points = 0;
 
 4231        foreach ($sequence as $qid) {
 
 4234            $pass_max += round($unordered[$qid][
'max'], 2);
 
 4235            $pass_reached += round($unordered[$qid][
'reached'], 2);
 
 4236            $pass_requested_hints += $unordered[$qid][
'requested_hints'];
 
 4237            $pass_hint_points += $unordered[$qid][
'hint_points'];
 
 4241            $unordered[$qid][
'nr'] = $key;
 
 4242            array_push($found, $unordered[$qid]);
 
 4251            if (
$results[
'reached_points'] < 0) {
 
 4255            if ($pass_reached < 0) {
 
 4260        $found[
'pass'][
'total_max_points'] = $pass_max;
 
 4261        $found[
'pass'][
'total_reached_points'] = $pass_reached;
 
 4262        $found[
'pass'][
'total_requested_hints'] = $pass_requested_hints;
 
 4263        $found[
'pass'][
'total_hint_points'] = $pass_hint_points;
 
 4264        $found[
'pass'][
'percent'] = ($pass_max > 0) ? $pass_reached / $pass_max : 0;
 
 4265        $found[
'pass'][
'obligationsAnswered'] = $obligationsAnswered;
 
 4266        $found[
'pass'][
'num_workedthrough'] = $numWorkedThrough;
 
 4267        $found[
'pass'][
'num_questions_total'] = $numQuestionsTotal;
 
 4269        $found[
"test"][
"total_max_points"] = 
$results[
'max_points'];
 
 4270        $found[
"test"][
"total_reached_points"] = 
$results[
'reached_points'];
 
 4271        $found[
"test"][
"total_requested_hints"] = 
$results[
'hint_count'];
 
 4272        $found[
"test"][
"total_hint_points"] = 
$results[
'hint_points'];
 
 4273        $found[
"test"][
"result_pass"] = 
$results[
'pass'];
 
 4274        $found[
'test'][
'result_tstamp'] = 
$results[
'tstamp'];
 
 4275        $found[
'test'][
'obligations_answered'] = 
$results[
'obligations_answered'];
 
 4277        if ((!$found[
'pass'][
'total_reached_points']) or (! $found[
'pass'][
'total_max_points'])) {
 
 4280            $percentage = ($found[
'pass'][
'total_reached_points'] /  $found[
'pass'][
'total_max_points']) * 100.0;
 
 4282            if ($percentage < 0) {
 
 4287        $found[
"test"][
"passed"] = 
$results[
'passed'];
 
 4304            "SELECT COUNT(active_id) total FROM tst_active WHERE test_fi = %s",
 
 4309        return $row[
"total"];
 
 4324            "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",
 
 4325            array(
'integer',
'integer'),
 
 4330            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"started"], $matches);
 
 4331            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4332            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"finished"], $matches);
 
 4333            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4334            $time += ($epoch_2 - $epoch_1);
 
 4363            "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",
 
 4370            if (!array_key_exists($row[
"active_fi"], $times)) {
 
 4371                $times[$row[
"active_fi"]] = 0;
 
 4373            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"started"], $matches);
 
 4374            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4375            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"finished"], $matches);
 
 4376            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4377            $times[$row[
"active_fi"]] += ($epoch_2 - $epoch_1);
 
 4394            "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",
 
 4395            array(
'integer',
'integer'),
 
 4400            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"started"], $matches);
 
 4401            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4402            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"finished"], $matches);
 
 4403            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4404            $time += ($epoch_2 - $epoch_1);
 
 4421            "SELECT * FROM tst_times WHERE active_fi = %s AND pass = %s ORDER BY started",
 
 4422            array(
'integer',
'integer'),
 
 4423            array($active_id, 
$pass)
 
 4427            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"started"], $matches);
 
 4428            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4429            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"finished"], $matches);
 
 4430            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4431            $time += ($epoch_2 - $epoch_1);
 
 4462            "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",
 
 4463            array(
'integer',
'integer'),
 
 4469            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"started"], $matches);
 
 4470            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4471            if ($firstvisit == 0 || $epoch_1 < $firstvisit) {
 
 4472                $firstvisit = $epoch_1;
 
 4474            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"finished"], $matches);
 
 4475            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4476            if ($epoch_2 > $lastvisit) {
 
 4477                $lastvisit = $epoch_2;
 
 4480        return array(
"firstvisit" => $firstvisit, 
"lastvisit" => $lastvisit);
 
 4497            "SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.active_id = %s AND tst_active.active_id = tst_times.active_fi",
 
 4505            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->started, $matches);
 
 4506            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4507            if (!$first_visit) {
 
 4508                $first_visit = $epoch_1;
 
 4510            if ($epoch_1 < $first_visit) {
 
 4511                $first_visit = $epoch_1;
 
 4513            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->finished, $matches);
 
 4514            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4516                $last_visit = $epoch_2;
 
 4518            if ($epoch_2 > $last_visit) {
 
 4519                $last_visit = $epoch_2;
 
 4521            $times[$row->active_fi] += ($epoch_2 - $epoch_1);
 
 4524        foreach ($times as $key => $value) {
 
 4525            $max_time += $value;
 
 4527        if ((!$test_result[
"test"][
"total_reached_points"]) or (!$test_result[
"test"][
"total_max_points"])) {
 
 4530            $percentage = ($test_result[
"test"][
"total_reached_points"] / $test_result[
"test"][
"total_max_points"]) * 100.0;
 
 4531            if ($percentage < 0) {
 
 4535        $mark_obj = $this->mark_schema->getMatchingMark($percentage);
 
 4536        $first_date = getdate($first_visit);
 
 4537        $last_date = getdate($last_visit);
 
 4538        $qworkedthrough = 0;
 
 4539        foreach ($test_result as $key => $value) {
 
 4540            if (preg_match(
"/\d+/", $key)) {
 
 4541                $qworkedthrough += $value[
"workedthrough"];
 
 4544        if (!$qworkedthrough) {
 
 4547            $atimeofwork = $max_time / $qworkedthrough;
 
 4550        $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
 
 4556            $result_mark = $mark_obj->getShortName();
 
 4558            if ($mark_obj->getPassed() && $obligationsAnswered) {
 
 4564        $percent_worked_through = 0;
 
 4565        if (count($this->questions)) {
 
 4566            $percent_worked_through = $qworkedthrough / count($this->questions);
 
 4568        $result_array = array(
 
 4569            "qworkedthrough" => $qworkedthrough,
 
 4570            "qmax" => count($this->questions),
 
 4571            "pworkedthrough" => $percent_worked_through,
 
 4572            "timeofwork" => $max_time,
 
 4573            "atimeofwork" => $atimeofwork,
 
 4574            "firstvisit" => $first_date,
 
 4575            "lastvisit" => $last_date,
 
 4576            "resultspoints" => $test_result[
"test"][
"total_reached_points"],
 
 4577            "maxpoints" => $test_result[
"test"][
"total_max_points"],
 
 4578            "resultsmarks" => $result_mark,
 
 4579            "passed" => $passed,
 
 4580            "distancemedian" => 
"0" 
 4582        foreach ($test_result as $key => $value) {
 
 4583            if (preg_match(
"/\d+/", $key)) {
 
 4584                $result_array[$key] = $value;
 
 4587        return $result_array;
 
 4599        $totalpoints_array = array();
 
 4601        foreach ($all_users as $active_id => $user_name) {
 
 4603            $reached = $test_result[
"test"][
"total_reached_points"];
 
 4604            $total = $test_result[
"test"][
"total_max_points"];
 
 4606            $mark = $this->mark_schema->getMatchingMark($percentage * 100.0);
 
 4608            $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
 
 4611                if ($mark->getPassed() && $obligationsAnswered) {
 
 4612                    array_push($totalpoints_array, $test_result[
"test"][
"total_reached_points"]);
 
 4616        return $totalpoints_array;
 
 4629            "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",
 
 4633        $persons_array = array();
 
 4635            $name = $this->lng->txt(
"anonymous");
 
 4636            $fullname = $this->lng->txt(
"anonymous");
 
 4639                if (strlen($row[
"firstname"] . $row[
"lastname"] . $row[
"title"]) == 0) {
 
 4640                    $name = $this->lng->txt(
"deleted_user");
 
 4641                    $fullname = $this->lng->txt(
"deleted_user");
 
 4642                    $login = $this->lng->txt(
"unknown");
 
 4645                    if ($row[
"user_fi"] == ANONYMOUS_USER_ID) {
 
 4646                        $name = $this->lng->txt(
"anonymous");
 
 4647                        $fullname = $this->lng->txt(
"anonymous");
 
 4649                        $name = trim($row[
"lastname"] . 
", " . $row[
"firstname"] . 
" " . $row[
"title"]);
 
 4650                        $fullname = trim($row[
"title"] . 
" " . $row[
"firstname"] . 
" " . $row[
"lastname"]);
 
 4654            $persons_array[$row[
"active_id"]] = array(
 
 4656                "fullname" => $fullname,
 
 4660        return $persons_array;
 
 4674            "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),
 
 4678        $persons_array = array();
 
 4685                $persons_array[$row[
"active_id"]] = $this->lng->txt(
"anonymous");
 
 4687                if (strlen($row[
"firstname"] . $row[
"lastname"] . $row[
"title"]) == 0) {
 
 4688                    $persons_array[$row[
"active_id"]] = $this->lng->txt(
"deleted_user");
 
 4690                    if ($row[
"user_fi"] == ANONYMOUS_USER_ID) {
 
 4691                        $persons_array[$row[
"active_id"]] = $row[
"lastname"];
 
 4693                        $persons_array[$row[
"active_id"]] = trim($row[
"lastname"] . 
", " . $row[
"firstname"] . 
" " . $row[
"title"]);
 
 4698        return $persons_array;
 
 4712            "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),
 
 4716        $persons_array = array();
 
 4719                $persons_array[$row[
"active_id"]] = array(
"name" => $this->lng->txt(
"anonymous"));
 
 4721                if (strlen($row[
"firstname"] . $row[
"lastname"] . $row[
"title"]) == 0) {
 
 4722                    $persons_array[$row[
"active_id"]] = array(
"name" => $this->lng->txt(
"deleted_user"));
 
 4724                    if ($row[
"user_fi"] == ANONYMOUS_USER_ID) {
 
 4725                        $persons_array[$row[
"active_id"]] = array(
"name" => $row[
"lastname"]);
 
 4727                        $persons_array[$row[
"active_id"]] = array(
"name" => trim($row[
"lastname"] . 
", " . $row[
"firstname"] . 
" " . $row[
"title"]), 
"login" => $row[
"login"]);
 
 4732        return $persons_array;
 
 4748                "SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
 
 4749                "tst_test_rnd_qst.pass, qpl_questions.points " .
 
 4750                "FROM tst_test_rnd_qst, qpl_questions " .
 
 4751                "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
 
 4752                "AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence",
 
 4758                "SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
 
 4759                "qpl_questions.points " .
 
 4760                "FROM tst_test_question, tst_active, qpl_questions " .
 
 4761                "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
 
 4762                "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
 
 4770                array_push($qtest, $row);
 
 4789                "SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
 
 4790                "qpl_questions.points " .
 
 4791                "FROM tst_test_rnd_qst, qpl_questions " .
 
 4792                "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
 
 4793                "AND tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.pass = %s " .
 
 4794                "ORDER BY tst_test_rnd_qst.sequence",
 
 4795                array(
'integer', 
'integer'),
 
 4796                array($active_id, 
$pass)
 
 4800                "SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
 
 4801                "qpl_questions.points " .
 
 4802                "FROM tst_test_question, tst_active, qpl_questions " .
 
 4803                "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
 
 4804                "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
 
 4812                array_push($qpass, $row);
 
 4844        require_once 
'Modules/Test/classes/class.ilTestParticipantList.php';
 
 4845        require_once 
'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
 
 4850        $list = $list->getAccessFilteredList(
 
 4857    public function getUnfilteredEvaluationData()
 
 4864        include_once 
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
 
 4865        include_once 
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
 
 4866        include_once 
"./Modules/Test/classes/class.ilTestEvaluationData.php";
 
 4871                        SELECT          tst_test_result.*, 
 4872                                                qpl_questions.original_id, 
 4873                                                qpl_questions.title questiontitle, 
 4874                                                qpl_questions.points maxpoints 
 4876                        FROM            tst_test_result, qpl_questions, tst_active 
 4878                        WHERE           tst_active.active_id = tst_test_result.active_fi 
 4879                        AND                     qpl_questions.question_id = tst_test_result.question_fi 
 4880                        AND                     tst_active.test_fi = %s 
 4882                        ORDER BY        tst_active.active_id ASC, tst_test_result.pass ASC, tst_test_result.tstamp DESC 
 4897            $participantObject = 
$data->getParticipant($row[
"active_fi"]);
 
 4903            $passObject = $participantObject->getPass($row[
"pass"]);
 
 4909            $passObject->addAnsweredQuestion(
 
 4910                $row[
"question_fi"],
 
 4919        foreach (array_keys(
$data->getParticipants()) as $active_id) {
 
 4921                for ($testpass = 0; $testpass <= 
$data->getParticipant($active_id)->getLastPass(); $testpass++) {
 
 4925                                                SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, qpl_questions.original_id, 
 4926                                                tst_test_rnd_qst.pass, qpl_questions.points, qpl_questions.title 
 4927                                                FROM tst_test_rnd_qst, qpl_questions 
 4928                                                WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id 
 4929                                                AND tst_test_rnd_qst.pass = %s 
 4930                                                AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence 
 4935                        array(
'integer',
'integer'),
 
 4936                        array($testpass, $active_id)
 
 4941                            $tpass = array_key_exists(
"pass", $row) ? $row[
"pass"] : 0;
 
 4943                            $data->getParticipant($active_id)->addQuestion(
 
 4944                                $row[
"original_id"],
 
 4945                                $row[
"question_fi"],
 
 4951                            $data->addQuestionTitle($row[
"question_fi"], $row[
"title"]);
 
 4956                $lastPass = 
$data->getParticipant($active_id)->getLastPass();
 
 4957                for ($testpass = 0; $testpass <= $lastPass; $testpass++) {
 
 4958                    require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 4960                        $DIC->repositoryTree(),
 
 4962                        $DIC[
'ilPluginAdmin'],
 
 4965                    $dynamicQuestionSetConfig->loadFromDb();
 
 4967                    require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 4969                    $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $testpass);
 
 4974                    $sequence = (array) 
$testSequence->getUserSequenceQuestions();
 
 4976                    $questionsIdsToRequest = array_diff(array_values($sequence), array_values($questionData));
 
 4977                    if (count($questionsIdsToRequest) > 0) {
 
 4978                        $questionIdsCondition = 
' ' . 
$DIC->database()->in(
'question_id', array_values($questionsIdsToRequest), 
false, 
'integer') . 
' ';
 
 4984                                                        WHERE {$questionIdsCondition}",
 
 4988                        while ($row = 
$DIC->database()->fetchAssoc(
$res)) {
 
 4989                            $questionData[$row[
'question_id']] = $row;
 
 4990                            $data->addQuestionTitle($row[
'question_id'], $row[
'title']);
 
 4994                    foreach ($sequence as $questionId) {
 
 4995                        if (!isset($questionData[$questionId])) {
 
 4999                        $row = $questionData[$questionId];
 
 5001                        $data->getParticipant(
 
 5004                            $row[
'original_id'],
 
 5005                            $row[
'question_id'],
 
 5014                                        SELECT tst_test_question.sequence, tst_test_question.question_fi, 
 5015                                        qpl_questions.points, qpl_questions.title, qpl_questions.original_id 
 5016                                        FROM tst_test_question, tst_active, qpl_questions 
 5017                                        WHERE tst_test_question.question_fi = qpl_questions.question_id 
 5018                                        AND tst_active.active_id = %s 
 5019                                        AND tst_active.test_fi = tst_test_question.test_fi 
 5020                                        ORDER BY tst_test_question.sequence 
 5030                    $questionsbysequence = array();
 
 5033                        $questionsbysequence[$row[
"sequence"]] = $row;
 
 5036                    $seqresult = 
$ilDB->queryF(
 
 5037                        "SELECT * FROM tst_sequence WHERE active_fi = %s",
 
 5042                    while ($seqrow = 
$ilDB->fetchAssoc($seqresult)) {
 
 5043                        $questionsequence = unserialize($seqrow[
"sequence"]);
 
 5045                        foreach ($questionsequence as $sidx => $seq) {
 
 5046                            $data->getParticipant($active_id)->addQuestion(
 
 5047                                $questionsbysequence[$seq][
"original_id"],
 
 5048                                $questionsbysequence[$seq][
"question_fi"],
 
 5049                                $questionsbysequence[$seq][
"points"],
 
 5054                            $data->addQuestionTitle(
 
 5055                                $questionsbysequence[$seq][
"question_fi"],
 
 5056                                $questionsbysequence[$seq][
"title"]
 
 5068        foreach (array_keys(
$data->getParticipants()) as $active_id) {
 
 5069            $tstUserData = 
$data->getParticipant($active_id);
 
 5071            $percentage = $tstUserData->getReachedPointsInPercent();
 
 5073            $obligationsAnswered = $tstUserData->areObligationsAnswered();
 
 5075            $mark = $this->mark_schema->getMatchingMark($percentage);
 
 5077            if (is_object($mark)) {
 
 5078                $tstUserData->setMark($mark->getShortName());
 
 5079                $tstUserData->setMarkOfficial($mark->getOfficialName());
 
 5081                $tstUserData->setPassed(
 
 5082                    $mark->getPassed() && $tstUserData->areObligationsAnswered()
 
 5089                    $tstUserData->getReached(),
 
 5090                    $tstUserData->getMaxPoints()
 
 5093                $tstUserData->setECTSMark($ects_mark);
 
 5098            $tstUserData->setFirstVisit($visitingTime[
"firstvisit"]);
 
 5099            $tstUserData->setLastVisit($visitingTime[
"lastvisit"]);
 
 5117                                                SELECT          COUNT(qpl_questions.question_id) qcount, 
 5118                                                                        SUM(qpl_questions.points) qsum 
 5120                                                INNER JOIN      tst_tests 
 5121                                                ON                      tst_tests.test_id = tst_active.test_fi 
 5122                                                INNER JOIN      tst_dyn_quest_set_cfg 
 5123                                                ON          tst_dyn_quest_set_cfg.test_fi = tst_tests.test_id 
 5124                                                INNER JOIN  qpl_questions 
 5125                                                ON          qpl_questions.obj_fi = tst_dyn_quest_set_cfg.source_qpl_fi 
 5126                                                AND         qpl_questions.original_id IS NULL 
 5127                                                AND         qpl_questions.complete = %s 
 5128                                                WHERE           tst_active.active_id = %s 
 5130                    array(
'integer', 
'integer'),
 
 5131                    array(1, $active_id)
 
 5140                                                SELECT          tst_test_rnd_qst.pass, 
 5141                                                                        COUNT(tst_test_rnd_qst.question_fi) qcount, 
 5142                                                                        SUM(qpl_questions.points) qsum 
 5144                                                FROM            tst_test_rnd_qst, 
 5147                                                WHERE           tst_test_rnd_qst.question_fi = qpl_questions.question_id 
 5148                                                AND                     tst_test_rnd_qst.active_fi = %s 
 5151                                                GROUP BY        tst_test_rnd_qst.active_fi, 
 5152                                                                        tst_test_rnd_qst.pass 
 5154                    array(
'integer', 
'integer'),
 
 5155                    array($active_id, 
$pass)
 
 5164                                                SELECT          COUNT(tst_test_question.question_fi) qcount, 
 5165                                                                        SUM(qpl_questions.points) qsum 
 5167                                                FROM            tst_test_question, 
 5171                                                WHERE           tst_test_question.question_fi = qpl_questions.question_id 
 5172                                                AND                     tst_test_question.test_fi = tst_active.test_fi 
 5173                                                AND                     tst_active.active_id = %s 
 5175                                                GROUP BY        tst_test_question.test_fi 
 5185                throw new ilTestException(
"not supported question set type: $questionSetType");
 
 5190        if (is_array($row)) {
 
 5191            return array(
"count" => $row[
"qcount"], 
"points" => $row[
"qsum"]);
 
 5194        return array(
"count" => 0, 
"points" => 0);
 
 5199        include_once 
"./Modules/Test/classes/class.ilTestEvaluationData.php";
 
 5200        include_once 
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
 
 5201        include_once 
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
 
 5202        $data = $this->getUnfilteredEvaluationData();
 
 5203        if ($withStatistics) {
 
 5204            $data->calculateStatistics();
 
 5206        $data->setFilter($filterby, $filtertext);
 
 5233            "SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
 
 5234            "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
 
 5235            "qpl_questions.points maxpoints " .
 
 5236            "FROM tst_test_result, qpl_questions, tst_active " .
 
 5237            "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
 
 5238            "WHERE tst_active.active_id = tst_test_result.active_fi " .
 
 5239            "AND qpl_questions.question_id = tst_test_result.question_fi " .
 
 5240            "AND tst_active.test_fi = %s " .
 
 5241            "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
 
 5245        $overview = array();
 
 5247            if (!array_key_exists($row[
"active_fi"], $overview)) {
 
 5248                $overview[$row[
"active_fi"]] = array();
 
 5249                $overview[$row[
"active_fi"]][
"firstname"] = $row[
"firstname"];
 
 5250                $overview[$row[
"active_fi"]][
"lastname"] = $row[
"lastname"];
 
 5251                $overview[$row[
"active_fi"]][
"title"] = $row[
"title"];
 
 5252                $overview[$row[
"active_fi"]][
"login"] = $row[
"login"];
 
 5253                $overview[$row[
"active_fi"]][
"usr_id"] = $row[
"usr_id"];
 
 5254                $overview[$row[
"active_fi"]][
"started"] = $row[
"started"];
 
 5255                $overview[$row[
"active_fi"]][
"finished"] = $row[
"finished"];
 
 5257            if (!array_key_exists($row[
"pass"], $overview[$row[
"active_fi"]])) {
 
 5258                $overview[$row[
"active_fi"]][$row[
"pass"]] = array();
 
 5259                $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] = 0;
 
 5260                $overview[$row[
"active_fi"]][$row[
"pass"]][
"maxpoints"] = $row[
"maxpoints"];
 
 5262            array_push($overview[$row[
"active_fi"]][$row[
"pass"]], $row);
 
 5263            $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] += $row[
"points"];
 
 5281            "SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
 
 5282            "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
 
 5283            "qpl_questions.points maxpoints " .
 
 5284            "FROM tst_test_result, qpl_questions, tst_active " .
 
 5285            "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
 
 5286            "WHERE tst_active.active_id = tst_test_result.active_fi " .
 
 5287            "AND qpl_questions.question_id = tst_test_result.question_fi " .
 
 5288            "AND tst_active.test_fi = %s AND tst_active.active_id = %s" .
 
 5289            "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
 
 5290            array(
'integer', 
'integer'),
 
 5293        $overview = array();
 
 5295            if (!array_key_exists($row[
"active_fi"], $overview)) {
 
 5296                $overview[$row[
"active_fi"]] = array();
 
 5297                $overview[$row[
"active_fi"]][
"firstname"] = $row[
"firstname"];
 
 5298                $overview[$row[
"active_fi"]][
"lastname"] = $row[
"lastname"];
 
 5299                $overview[$row[
"active_fi"]][
"title"] = $row[
"title"];
 
 5300                $overview[$row[
"active_fi"]][
"login"] = $row[
"login"];
 
 5301                $overview[$row[
"active_fi"]][
"usr_id"] = $row[
"usr_id"];
 
 5302                $overview[$row[
"active_fi"]][
"started"] = $row[
"started"];
 
 5303                $overview[$row[
"active_fi"]][
"finished"] = $row[
"finished"];
 
 5305            if (!array_key_exists($row[
"pass"], $overview[$row[
"active_fi"]])) {
 
 5306                $overview[$row[
"active_fi"]][$row[
"pass"]] = array();
 
 5307                $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] = 0;
 
 5308                $overview[$row[
"active_fi"]][$row[
"pass"]][
"maxpoints"] = $row[
"maxpoints"];
 
 5310            array_push($overview[$row[
"active_fi"]][$row[
"pass"]], $row);
 
 5311            $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] += $row[
"points"];
 
 5330        if (strlen($firstname . $lastname . 
$title) == 0) {
 
 5331            $name = $this->lng->txt(
"deleted_user");
 
 5333            if ($user_id == ANONYMOUS_USER_ID) {
 
 5336                $name = trim($lastname . 
", " . $firstname . 
" " . 
$title);
 
 5339                $name = $this->lng->txt(
"anonymous");
 
 5362        if (strlen($firstname . $lastname . 
$title) == 0) {
 
 5365            if ($user_id == ANONYMOUS_USER_ID) {
 
 5368                $name = trim($lastname . 
", " . $firstname . 
" " . 
$title);
 
 5370            if ($is_anonymous) {
 
 5387        $query = 
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi";
 
 5389        if (is_array($activeIdsFilter) && count($activeIdsFilter)) {
 
 5390            $query .= 
" AND " . 
$DIC->database()->in(
'active_id', $activeIdsFilter, 
false, 
'integer');
 
 5395        while ($row = 
$DIC->database()->fetchObject(
$result)) {
 
 5396            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->started, $matches);
 
 5397            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 5398            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row->finished, $matches);
 
 5399            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 5400            $times[$row->active_fi] += ($epoch_2 - $epoch_1);
 
 5404        foreach ($times as $key => $value) {
 
 5405            $max_time += $value;
 
 5409            $average_time = round($max_time / $counter);
 
 5413        return $average_time;
 
 5422    public function &
getAvailableQuestionpools($use_object_id = 
false, $equal_points = 
false, $could_be_offline = 
false, $show_path = 
false, $with_questioncount = 
false, $permission = 
"read")
 
 5424        include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 5436        $time_in_seconds = 0;
 
 5437        foreach ($this->questions as $question_id) {
 
 5439            $est_time = $question->getEstimatedWorkingTime();
 
 5440            $time_in_seconds += $est_time[
"h"] * 3600 + $est_time[
"m"] * 60 + $est_time[
"s"];
 
 5442        $hours = (int) ($time_in_seconds / 3600)        ;
 
 5443        $time_in_seconds = $time_in_seconds - ($hours * 3600);
 
 5444        $minutes = (int) ($time_in_seconds / 60);
 
 5445        $time_in_seconds = $time_in_seconds - ($minutes * 60);
 
 5446        $result = array(
"hh" => $hours, 
"mm" => $minutes, 
"ss" => $time_in_seconds);
 
 5458        return CLIENT_WEB_DIR . 
"/assessment/" . $this->
getId() . 
"/images/";
 
 5469        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 5484        if ((!$question_type) and ($question_id > 0)) {
 
 5488        if (!strlen($question_type)) {
 
 5492        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 5496        $question = 
new $question_type_gui();
 
 5498        if ($question_id > 0) {
 
 5499            $question->object->loadFromDb($question_id);
 
 5508            $question->object->feedbackOBJ = 
new $feedbackObjectClassname($question->object, 
$ilCtrl, 
$ilDB, 
$lng);
 
 5510            $assSettings = 
new ilSetting(
'assessment');
 
 5511            require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
 
 5513            $processLockerFactory->setQuestionId($question->object->getId());
 
 5514            $processLockerFactory->setUserId(
$ilUser->getId());
 
 5515            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 5517            $question->object->setProcessLocker($processLockerFactory->getLocker());
 
 5534        if (strcmp($question_id, 
"") != 0) {
 
 5535            include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 5550        $this->questions = array_values($this->questions);
 
 5551        $array_pos = array_search($target_index, $this->questions);
 
 5552        if ($insert_mode == 0) {
 
 5553            $part1 = array_slice($this->questions, 0, $array_pos);
 
 5554            $part2 = array_slice($this->questions, $array_pos);
 
 5555        } elseif ($insert_mode == 1) {
 
 5556            $part1 = array_slice($this->questions, 0, $array_pos + 1);
 
 5557            $part2 = array_slice($this->questions, $array_pos + 1);
 
 5559        foreach ($move_questions as $question_id) {
 
 5560            if (!(array_search($question_id, $part1) === 
false)) {
 
 5561                unset($part1[array_search($question_id, $part1)]);
 
 5563            if (!(array_search($question_id, $part2) === 
false)) {
 
 5564                unset($part2[array_search($question_id, $part2)]);
 
 5567        $part1 = array_values($part1);
 
 5568        $part2 = array_values($part2);
 
 5569        $new_array = array_values(array_merge($part1, $move_questions, $part2));
 
 5570        $this->questions = array();
 
 5572        foreach ($new_array as $question_id) {
 
 5573            $this->questions[$counter] = $question_id;
 
 5624        $pluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 5629        include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 5632        if (count($available_pools)) {
 
 5633            $available = 
" AND " . 
$ilDB->in(
'qpl_questions.obj_fi', $available_pools, 
false, 
'integer');
 
 5637        if ($completeonly) {
 
 5638            $available .= 
" AND qpl_questions.complete = " . 
$ilDB->quote(
"1", 
'text');
 
 5642        if (is_array($arrFilter)) {
 
 5643            if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title'])) {
 
 5644                $where .= 
" AND " . 
$ilDB->like(
'qpl_questions.title', 
'text', 
"%%" . $arrFilter[
'title'] . 
"%%");
 
 5646            if (array_key_exists(
'description', $arrFilter) && strlen($arrFilter[
'description'])) {
 
 5647                $where .= 
" AND " . 
$ilDB->like(
'qpl_questions.description', 
'text', 
"%%" . $arrFilter[
'description'] . 
"%%");
 
 5649            if (array_key_exists(
'author', $arrFilter) && strlen($arrFilter[
'author'])) {
 
 5650                $where .= 
" AND " . 
$ilDB->like(
'qpl_questions.author', 
'text', 
"%%" . $arrFilter[
'author'] . 
"%%");
 
 5652            if (array_key_exists(
'type', $arrFilter) && strlen($arrFilter[
'type'])) {
 
 5653                $where .= 
" AND qpl_qst_type.type_tag = " . 
$ilDB->quote($arrFilter[
'type'], 
'text');
 
 5655            if (array_key_exists(
'qpl', $arrFilter) && strlen($arrFilter[
'qpl'])) {
 
 5656                $where .= 
" AND " . 
$ilDB->like(
'object_data.title', 
'text', 
"%%" . $arrFilter[
'qpl'] . 
"%%");
 
 5661        $original_clause = 
" qpl_questions.original_id IS NULL";
 
 5662        if (count($original_ids)) {
 
 5663            $original_clause = 
" qpl_questions.original_id IS NULL AND " . 
$ilDB->in(
'qpl_questions.question_id', $original_ids, 
true, 
'integer');
 
 5666        $query_result = 
$ilDB->query(
" 
 5667                        SELECT          qpl_questions.*, qpl_questions.tstamp, 
 5668                                                qpl_qst_type.type_tag, qpl_qst_type.plugin, qpl_qst_type.plugin_name, 
 5669                                                object_data.title parent_title 
 5670                        FROM            qpl_questions, qpl_qst_type, object_data 
 5671                        WHERE $original_clause $available 
 5672                        AND object_data.obj_id = qpl_questions.obj_fi 
 5673                        AND qpl_questions.tstamp > 0 
 5674                        AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id 
 5678        $types = $this->getQuestionTypeTranslations();
 
 5679        if ($query_result->numRows()) {
 
 5680            while ($row = 
$ilDB->fetchAssoc($query_result)) {
 
 5683                if (!$row[
'plugin']) {
 
 5684                    $row[ 
'ttype' ] = 
$lng->txt($row[ 
"type_tag" ]);
 
 5690                if (!$pluginAdmin->isActive(
IL_COMP_MODULE, 
'TestQuestionPool', 
'qst', $row[
'plugin_name'])) {
 
 5695                $row[ 
'ttype' ] = $pl->getQuestionTypeTranslation();
 
 5715        foreach ($assessment->objectives as $objectives) {
 
 5716            foreach ($objectives->materials as $material) {
 
 5731        foreach ($assessment->assessmentcontrol as $assessmentcontrol) {
 
 5732            switch ($assessmentcontrol->getSolutionswitch()) {
 
 5747        foreach ($assessment->qtimetadata as 
$metadata) {
 
 5771                case "sequence_settings":
 
 5774                case "solution_details":
 
 5777                case "print_bs_with_res":
 
 5786                case 'block_after_passed':
 
 5789                case "pass_waiting":
 
 5793                    $this->
setKiosk($metadata[
"entry"]);
 
 5795                case "showfinalstatement":
 
 5808                case "highscore_enabled":
 
 5812                case "highscore_anon":
 
 5816                case "highscore_achieved_ts":
 
 5820                case "highscore_score":
 
 5824                case "highscore_percentage":
 
 5828                case "highscore_hints":
 
 5832                case "highscore_wtime":
 
 5836                case "highscore_own_table":
 
 5840                case "highscore_top_table":
 
 5844                case "highscore_top_num":
 
 5848                case "hide_previous_results":
 
 5855                case "use_previous_answers":
 
 5858                case "answer_feedback":
 
 5861                case "hide_title_points":
 
 5864                case "title_output":
 
 5867                case "question_set_type":
 
 5877                case "results_presentation":
 
 5880                case "reset_processing_time":
 
 5883                case "instant_verification":
 
 5886                case "follow_qst_answer_fixation":
 
 5889                case "instant_feedback_answer_fixation":
 
 5892                case "force_instant_feedback":
 
 5895                case "answer_feedback_points":
 
 5910                case "fixed_participants":
 
 5913                case "score_reporting":
 
 5916                case "shuffle_questions":
 
 5919                case "count_system":
 
 5925                case "mailnotification":
 
 5931                case "exportsettings":
 
 5934                case "score_cutting":
 
 5941                case "allowedUsers":
 
 5945                case "allowedUsersTimeGap":
 
 5948                case "pass_scoring":
 
 5951                case 'pass_deletion_allowed':
 
 5954                case "show_summary":
 
 5957                case "reporting_date":
 
 5959                    if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches)) {
 
 5960                        $this->
setReportingDate(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
 
 5963                case 'enable_processing_time':
 
 5966                case "processing_time":
 
 5969                case "starting_time":
 
 5971                    if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches)) {
 
 5972                        $date_time = 
new ilDateTime(sprintf(
"%02d-%02d-%02d %02d:%02d:%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]), 
IL_CAL_DATETIME);
 
 5979                    if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches)) {
 
 5980                        $date_time = 
new ilDateTime(sprintf(
"%02d-%02d-%02d %02d:%02d:%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]), 
IL_CAL_DATETIME);
 
 5985                case "enable_examview":
 
 5988                case 'show_examview_html':
 
 5991                case 'show_examview_pdf':
 
 5994                case 'redirection_mode':
 
 5997                case 'redirection_url':
 
 6000                case 'examid_in_kiosk':
 
 6001                case 'examid_in_test_pass':
 
 6004                case 'show_exam_id':
 
 6005                case 'examid_in_test_res':
 
 6008                case 'enable_archiving':
 
 6011                case 'sign_submission':
 
 6014                case 'char_selector_availability':
 
 6017                case 'char_selector_definition':
 
 6020                case 'skill_service':
 
 6023                case 'result_tax_filters':
 
 6026                case 'show_grading_status':
 
 6029                case 'show_grading_mark':
 
 6032                case 'activation_limited':
 
 6035                case 'activation_start_time':
 
 6038                case 'activation_end_time':
 
 6041                case 'activation_visibility':
 
 6047                case 'autosave_ival':
 
 6050                case 'offer_question_hints':
 
 6053                case 'instant_feedback_specific':
 
 6056                case 'obligations_enabled':
 
 6060            if (preg_match(
"/mark_step_\d+/", 
$metadata[
"label"])) {
 
 6062                preg_match(
"/<short>(.*?)<\/short>/", $xmlmark, $matches);
 
 6063                $mark_short = $matches[1];
 
 6064                preg_match(
"/<official>(.*?)<\/official>/", $xmlmark, $matches);
 
 6065                $mark_official = $matches[1];
 
 6066                preg_match(
"/<percentage>(.*?)<\/percentage>/", $xmlmark, $matches);
 
 6067                $mark_percentage = $matches[1];
 
 6068                preg_match(
"/<passed>(.*?)<\/passed>/", $xmlmark, $matches);
 
 6069                $mark_passed = $matches[1];
 
 6070                $this->mark_schema->addMarkStep($mark_short, $mark_official, $mark_percentage, $mark_passed);
 
 6074        if (is_array(
$_SESSION[
"import_mob_xhtml"])) {
 
 6075            include_once 
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
 
 6076            include_once 
"./Services/RTE/classes/class.ilRTE.php";
 
 6077            include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 6078            foreach (
$_SESSION[
"import_mob_xhtml"] as $mob) {
 
 6080                if (file_exists($importfile)) {
 
 6088                    $ilLog->write(
"Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
 
 6102        include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
 
 6106        $a_xml_writer->xmlSetDtdDef(
"<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">");
 
 6107        $a_xml_writer->xmlStartTag(
"questestinterop");
 
 6110            "ident" => 
"il_" . IL_INST_ID . 
"_tst_" . $this->
getTestId(),
 
 6113        $a_xml_writer->xmlStartTag(
"assessment", $attrs);
 
 6115        $a_xml_writer->xmlElement(
"qticomment", 
null, $this->
getDescription());
 
 6118        if ($this->enable_processing_time) {
 
 6119            preg_match(
"/(\d+):(\d+):(\d+)/", $this->processing_time, $matches);
 
 6120            $a_xml_writer->xmlElement(
"duration", 
null, sprintf(
"P0Y0M0DT%dH%dM%dS", $matches[1], $matches[2], $matches[3]));
 
 6124        $a_xml_writer->xmlStartTag(
"qtimetadata");
 
 6125        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6126        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"ILIAS_VERSION");
 
 6127        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
ilias->getSetting(
"ilias_version"));
 
 6128        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6131        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6132        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"anonymity");
 
 6133        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getAnonymity()));
 
 6134        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6136        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6137        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"use_pool");
 
 6138        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getPoolUsage() ? 1 : 0);
 
 6139        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6142        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6143        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"question_set_type");
 
 6145        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6148        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6149        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"sequence_settings");
 
 6151        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6154        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6155        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"author");
 
 6156        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getAuthor());
 
 6157        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6160        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6161        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"reset_processing_time");
 
 6163        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6166        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6167        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"count_system");
 
 6168        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getCountSystem());
 
 6169        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6172        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6173        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"mc_scoring");
 
 6174        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getMCScoring());
 
 6175        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6178        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6179        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"score_cutting");
 
 6180        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getScoreCutting());
 
 6181        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6184        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6185        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"password");
 
 6186        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getPassword());
 
 6187        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6190        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6191        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"allowedUsers");
 
 6192        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getAllowedUsers());
 
 6193        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6196        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6197        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"allowedUsersTimeGap");
 
 6199        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6202        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6203        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"pass_scoring");
 
 6204        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getPassScoring());
 
 6205        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6207        $a_xml_writer->xmlStartTag(
'qtimetadatafield');
 
 6208        $a_xml_writer->xmlElement(
'fieldlabel', 
null, 
'pass_deletion_allowed');
 
 6210        $a_xml_writer->xmlEndTag(
'qtimetadatafield');
 
 6214            $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6215            $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"reporting_date");
 
 6216            preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->reporting_date, $matches);
 
 6217            $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]));
 
 6218            $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6221        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6222        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"nr_of_tries");
 
 6223        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getNrOfTries()));
 
 6224        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6227        $a_xml_writer->xmlStartTag(
'qtimetadatafield');
 
 6228        $a_xml_writer->xmlElement(
'fieldlabel', 
null, 
'block_after_passed');
 
 6230        $a_xml_writer->xmlEndTag(
'qtimetadatafield');
 
 6233        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6234        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"pass_waiting");
 
 6235        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getPassWaiting());
 
 6236        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6239        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6240        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"kiosk");
 
 6241        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getKiosk()));
 
 6242        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6246        $a_xml_writer->xmlStartTag(
'qtimetadatafield');
 
 6247        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"redirection_mode");
 
 6249        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6252        $a_xml_writer->xmlStartTag(
'qtimetadatafield');
 
 6253        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"redirection_url");
 
 6255        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6258        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6259        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"use_previous_answers");
 
 6261        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6264        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6265        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"title_output");
 
 6266        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getTitleOutput()));
 
 6267        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6270        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6271        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"results_presentation");
 
 6273        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6276        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6277        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"examid_in_test_pass");
 
 6279        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6282        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6283        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"examid_in_test_res");
 
 6285        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6288        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6289        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_summary");
 
 6291        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6294        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6295        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"score_reporting");
 
 6296        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getScoreReporting()));
 
 6297        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6299        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6300        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"solution_details");
 
 6302        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6303        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6304        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"print_bs_with_res");
 
 6306        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6309        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6310        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"instant_verification");
 
 6312        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6315        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6316        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"answer_feedback");
 
 6317        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getAnswerFeedback()));
 
 6318        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6321        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6322        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"answer_feedback_points");
 
 6324        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6327        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6328        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"follow_qst_answer_fixation");
 
 6330        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6333        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6334        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"instant_feedback_answer_fixation");
 
 6336        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6339        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6340        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"force_instant_feedback");
 
 6342        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6346        $highscore_metadata = array(
 
 6358        foreach ($highscore_metadata as $label => 
$data) {
 
 6359            $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6360            $a_xml_writer->xmlElement(
"fieldlabel", 
null, $label);
 
 6361            $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", 
$data[
'value']));
 
 6362            $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6366        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6367        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_cancel");
 
 6368        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getShowCancel()));
 
 6369        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6372        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6373        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_marker");
 
 6374        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getShowMarker()));
 
 6375        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6378        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6379        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"fixed_participants");
 
 6381        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6384        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6385        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"showfinalstatement");
 
 6386        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", (($this->
getShowFinalStatement()) ? 
"1" : 
"0")));
 
 6387        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6390        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6391        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"showinfo");
 
 6392        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", (($this->
getShowInfo()) ? 
"1" : 
"0")));
 
 6393        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6396        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6397        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"mailnotification");
 
 6399        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6402        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6403        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"mailnottype");
 
 6405        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6408        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6409        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"exportsettings");
 
 6410        $a_xml_writer->xmlElement(
"fieldentry", 
null, (
int) $this->
getExportSettings());
 
 6411        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6414        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6415        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"forcejs");
 
 6416        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", (($this->
getForceJS()) ? 
"1" : 
"0")));
 
 6417        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6420        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6421        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"customstyle");
 
 6422        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getCustomStyle());
 
 6423        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6426        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6427        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"shuffle_questions");
 
 6428        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getShuffleQuestions()));
 
 6429        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6432        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6433        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"processing_time");
 
 6435        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6438        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6439        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"enable_examview");
 
 6440        $a_xml_writer->xmlElement(
"fieldentry", 
null, (
int) $this->
getEnableExamview());
 
 6441        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6444        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6445        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_examview_html");
 
 6447        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6450        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6451        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_examview_pdf");
 
 6453        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6456        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6457        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"enable_archiving");
 
 6459        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6462        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6463        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"sign_submission");
 
 6464        $a_xml_writer->xmlElement(
"fieldentry", 
null, (
int) $this->
getSignSubmission());
 
 6465        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6468        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6469        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"char_selector_availability");
 
 6471        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6474        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6475        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"char_selector_definition");
 
 6477        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6480        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6481        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"skill_service");
 
 6483        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6486        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6487        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"result_tax_filters");
 
 6489        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6492        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6493        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_grading_status");
 
 6495        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6498        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6499        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_grading_mark");
 
 6501        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6506            $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6507            $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"starting_time");
 
 6509            $a_xml_writer->xmlElement(
"fieldentry", 
null, $backward_compatibility_format);
 
 6510            $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6514            $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6515            $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"ending_time");
 
 6517            $a_xml_writer->xmlElement(
"fieldentry", 
null, $backward_compatibility_format);
 
 6518            $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6523        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6524        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"activation_limited");
 
 6526        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6529        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6530        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"activation_start_time");
 
 6532        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6535        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6536        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"activation_end_time");
 
 6538        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6541        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6542        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"activation_visibility");
 
 6544        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6547        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6548        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"autosave");
 
 6549        $a_xml_writer->xmlElement(
"fieldentry", 
null, (
int) $this->
getAutosave());
 
 6550        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6553        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6554        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"autosave_ival");
 
 6555        $a_xml_writer->xmlElement(
"fieldentry", 
null, (
int) $this->
getAutosaveIval());
 
 6556        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6559        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6560        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"offer_question_hints");
 
 6562        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6565        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6566        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"instant_feedback_specific");
 
 6568        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6571        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6572        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"instant_feedback_answer_fixation");
 
 6574        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6577        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6578        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"obligations_enabled");
 
 6580        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6583        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6584        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"enable_processing_time");
 
 6586        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6588        foreach ($this->mark_schema->mark_steps as 
$index => $mark) {
 
 6590            $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6591            $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"mark_step_$index");
 
 6592            $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
 
 6593                "<short>%s</short><official>%s</official><percentage>%.2f</percentage><passed>%d</passed>",
 
 6594                $mark->getShortName(),
 
 6595                $mark->getOfficialName(),
 
 6596                $mark->getMinimumLevel(),
 
 6599            $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6601        $a_xml_writer->xmlEndTag(
"qtimetadata");
 
 6604        $a_xml_writer->xmlStartTag(
"objectives");
 
 6606        $a_xml_writer->xmlEndTag(
"objectives");
 
 6611                "solutionswitch" => 
"Yes" 
 6616        $a_xml_writer->xmlElement(
"assessmentcontrol", $attrs, 
null);
 
 6620            $a_xml_writer->xmlStartTag(
"presentation_material");
 
 6621            $a_xml_writer->xmlStartTag(
"flow_mat");
 
 6623            $a_xml_writer->xmlEndTag(
"flow_mat");
 
 6624            $a_xml_writer->xmlEndTag(
"presentation_material");
 
 6630        $a_xml_writer->xmlElement(
"section", $attrs, 
null);
 
 6631        $a_xml_writer->xmlEndTag(
"assessment");
 
 6632        $a_xml_writer->xmlEndTag(
"questestinterop");
 
 6634        $xml = $a_xml_writer->xmlDumpMem(
false);
 
 6646        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $date_time, $matches);
 
 6647        $iso8601_period = sprintf(
"P%dY%dM%dDT%dH%dM%dS", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]);
 
 6648        return $iso8601_period;
 
 6662        $this->mob_ids = array();
 
 6663        $this->file_ids = array();
 
 6669        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Start Export Page Objects");
 
 6670        $ilBench->start(
"ContentObjectExport", 
"exportPageObjects");
 
 6672        $ilBench->stop(
"ContentObjectExport", 
"exportPageObjects");
 
 6673        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Finished Export Page Objects");
 
 6676        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Start Export Media Objects");
 
 6677        $ilBench->start(
"ContentObjectExport", 
"exportMediaObjects");
 
 6679        $ilBench->stop(
"ContentObjectExport", 
"exportMediaObjects");
 
 6680        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Finished Export Media Objects");
 
 6683        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Start Export File Items");
 
 6684        $ilBench->start(
"ContentObjectExport", 
"exportFileItems");
 
 6686        $ilBench->stop(
"ContentObjectExport", 
"exportFileItems");
 
 6687        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Finished Export File Items");
 
 6698        include_once 
"./Services/MetaData/classes/class.ilMD2XML.php";
 
 6700        $md2xml->setExportMode(
true);
 
 6701        $md2xml->startExport();
 
 6702        $a_xml_writer->appendXML($md2xml->getXML());
 
 6712        if ($a_tag == 
"Identifier" && $a_param == 
"Entry") {
 
 6713            include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 6732        include_once 
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
 
 6734        foreach ($this->questions as $question_id) {
 
 6735            $ilBench->start(
"ContentObjectExport", 
"exportPageObject");
 
 6736            $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Page Object " . $question_id);
 
 6739            $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
 
 6743            $ilBench->start(
"ContentObjectExport", 
"exportPageObject_XML");
 
 6744            include_once 
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
 
 6746            $page_object->buildDom();
 
 6747            $page_object->insertInstIntoIDs($a_inst);
 
 6748            $mob_ids = $page_object->collectMediaObjects(
false);
 
 6749            require_once 
'Services/COPage/classes/class.ilPCFileList.php';
 
 6751            $xml = $page_object->getXMLFromDom(
false, 
false, 
false, 
"", 
true);
 
 6752            $xml = str_replace(
"&", 
"&", 
$xml);
 
 6753            $a_xml_writer->appendXML(
$xml);
 
 6754            $page_object->freeDom();
 
 6755            unset($page_object);
 
 6757            $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_XML");
 
 6760            $ilBench->start(
"ContentObjectExport", 
"exportPageObject_CollectMedia");
 
 6762            foreach ($mob_ids as $mob_id) {
 
 6763                $this->mob_ids[$mob_id] = $mob_id;
 
 6765            $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_CollectMedia");
 
 6768            $ilBench->start(
"ContentObjectExport", 
"exportPageObject_CollectFileItems");
 
 6770            foreach ($file_ids as $file_id) {
 
 6771                $this->file_ids[$file_id] = $file_id;
 
 6773            $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_CollectFileItems");
 
 6775            $a_xml_writer->xmlEndTag(
"PageObject");
 
 6778            $ilBench->stop(
"ContentObjectExport", 
"exportPageObject");
 
 6790        include_once 
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
 
 6792        foreach ($this->mob_ids as $mob_id) {
 
 6793            $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Media Object " . $mob_id);
 
 6796                $media_obj->exportXML($a_xml_writer, $a_inst);
 
 6797                $media_obj->exportFiles($a_target_dir);
 
 6809        include_once 
"./Modules/File/classes/class.ilObjFile.php";
 
 6811        foreach ($this->file_ids as $file_id) {
 
 6812            $expLog->write(date(
"[y-m-d H:i:s] ") . 
"File Item " . $file_id);
 
 6813            $file_obj = 
new ilObjFile($file_id, 
false);
 
 6814            $file_obj->export($a_target_dir);
 
 6825        if (!is_array($this->import_mapping)) {
 
 6828            return $this->import_mapping;
 
 6853        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);
 
 6861        include_once 
"./Modules/Test/classes/class.ilStatistics.php";
 
 6864        $passed_statistics->setData($points_passed);
 
 6865        $ects_percentiles = array(
 
 6866            "A" => $passed_statistics->quantile(
$a),
 
 6867            "B" => $passed_statistics->quantile(
$b),
 
 6868            "C" => $passed_statistics->quantile(
$c),
 
 6869            "D" => $passed_statistics->quantile(
$d),
 
 6870            "E" => $passed_statistics->quantile(
$e)
 
 6872        if (count($points_passed) && ($reached_points >= $ects_percentiles[
"A"])) {
 
 6874        } elseif (count($points_passed) && ($reached_points >= $ects_percentiles[
"B"])) {
 
 6876        } elseif (count($points_passed) && ($reached_points >= $ects_percentiles[
"C"])) {
 
 6878        } elseif (count($points_passed) && ($reached_points >= $ects_percentiles[
"D"])) {
 
 6880        } elseif (count($points_passed) && ($reached_points >= $ects_percentiles[
"E"])) {
 
 6882        } elseif (strcmp($fx, 
"") != 0) {
 
 6883            if ($max_points > 0) {
 
 6884                $percentage = ($reached_points / $max_points) * 100.0;
 
 6885                if ($percentage < 0) {
 
 6891            if ($percentage >= $fx) {
 
 6906        return $this->mark_schema->checkMarks();
 
 6936        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 6939        require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 6956                if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getReportingDate(), $matches)) {
 
 6957                    $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 6959                    if ($now < $epoch_time) {
 
 6994        $md_life = &$md->getLifecycle();
 
 6996            if (strlen($a_author) == 0) {
 
 6999                $a_author = 
$ilUser->getFullname();
 
 7002            $md_life = &$md->addLifecycle();
 
 7004            $con = &$md_life->addContribute();
 
 7005            $con->setRole(
"Author");
 
 7007            $ent = &$con->addEntity();
 
 7008            $ent->setEntity($a_author);
 
 7020        parent::createMetaData();
 
 7034        include_once 
"./Services/MetaData/classes/class.ilMD.php";
 
 7036        $md_life = &$md->getLifecycle();
 
 7038            $ids = &$md_life->getContributeIds();
 
 7039            foreach ($ids as 
$id) {
 
 7040                $md_cont = &$md_life->getContribute(
$id);
 
 7041                if (strcmp($md_cont->getRole(), 
"Author") == 0) {
 
 7042                    $entids = &$md_cont->getEntityIds();
 
 7043                    foreach ($entids as $entid) {
 
 7044                        $md_ent = &$md_cont->getEntity($entid);
 
 7045                        array_push(
$author, $md_ent->getEntity());
 
 7063        include_once 
"./Services/MetaData/classes/class.ilMD.php";
 
 7064        $md = 
new ilMD($obj_id, 0, 
"tst");
 
 7065        $md_life = &$md->getLifecycle();
 
 7067            $ids = &$md_life->getContributeIds();
 
 7068            foreach ($ids as 
$id) {
 
 7069                $md_cont = &$md_life->getContribute(
$id);
 
 7070                if (strcmp($md_cont->getRole(), 
"Author") == 0) {
 
 7071                    $entids = &$md_cont->getEntityIds();
 
 7072                    foreach ($entids as $entid) {
 
 7073                        $md_ent = &$md_cont->getEntity($entid);
 
 7074                        array_push(
$author, $md_ent->getEntity());
 
 7094        $result_array = array();
 
 7095        $tests = array_slice(
 
 7103        if (count($tests)) {
 
 7106                if ($use_object_id) {
 
 7108                    $result_array[$obj_id] = $titles[
$ref_id];
 
 7114        return $result_array;
 
 7125    public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree = 
false)
 
 7129        $certificateLogger = 
$DIC->logger()->cert();
 
 7132        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 7138        $newObj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
 
 7139        $newObj->setTmpCopyWizardCopyId($a_copy_id);
 
 7143        $newObj->setOfflineStatus(
true);
 
 7168        $newObj->setKiosk($this->
getKiosk());
 
 7224        $newObj->saveToDb();
 
 7233            $templateRepository,
 
 7234            $DIC->filesystem()->web(),
 
 7239        $cloneAction->cloneCertificate($this, $newObj);
 
 7242        $testQuestionSetConfigFactory->getQuestionSetConfig()->cloneQuestionSetRelatedData($newObj);
 
 7244        require_once 
'Modules/Test/classes/class.ilTestSkillLevelThresholdList.php';
 
 7246        $skillLevelThresholdList->setTestId($this->
getTestId());
 
 7247        $skillLevelThresholdList->loadFromDb();
 
 7248        $skillLevelThresholdList->cloneListForTest($newObj->getTestId());
 
 7250        $newObj->saveToDb();
 
 7251        $newObj->updateMetaData();
 
 7253        include_once(
'./Services/Tracking/classes/class.ilLPObjSettings.php');
 
 7255        $obj_settings->cloneSettings($newObj->getId());
 
 7274            $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 7283            $questionSetConfig->loadFromDb();
 
 7285            if ($questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
 
 7286                require_once 
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
 
 7287                require_once 
'Modules/Test/classes/class.ilTestRandomQuestionSetBuilderWithAmountPerPool.php';
 
 7288                require_once 
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
 
 7296                $sourcePoolDefinitionList->loadDefinitions();
 
 7298                $num = $sourcePoolDefinitionList->getQuestionAmount();
 
 7300                $num = $questionSetConfig->getQuestionAmountPerTest();
 
 7303            $num = count($this->questions);
 
 7322        if (strcmp($question_id, 
"") != 0) {
 
 7323            include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 7326        include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 7343            "SELECT obj_fi FROM tst_tests WHERE test_id = %s",
 
 7349            $object_id = $row[
"obj_fi"];
 
 7367            "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",
 
 7373            $object_id = $row[
"obj_fi"];
 
 7391            "SELECT test_id FROM tst_tests WHERE obj_fi = %s",
 
 7416        if (($active_id) && ($question_id)) {
 
 7417            if (is_null(
$pass)) {
 
 7418                include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 7422                "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
 7423                array(
'integer', 
'integer', 
'integer'),
 
 7424                array($active_id, $question_id, 
$pass)
 
 7426            if (
$result->numRows() == 1) {
 
 7428                $res = $row[
"value1"];
 
 7449                "SELECT question_text FROM qpl_questions WHERE question_id = %s",
 
 7453            if (
$result->numRows() == 1) {
 
 7455                $res = $row[
"question_text"];
 
 7466        require_once 
'Modules/Test/classes/class.ilTestParticipantList.php';
 
 7470        return $participantList;
 
 7478        require_once 
'Modules/Test/classes/class.ilTestParticipantList.php';
 
 7482        return $participantList;
 
 7496        $result_array = array();
 
 7499            if (is_numeric($user_id)) {
 
 7501                    "SELECT tst_active.active_id, tst_active.tries, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
 
 7502                    "tst_active.submitted test_finished, matriculation, COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes  FROM usr_data, tst_invited_user " .
 
 7503                    "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7504                    "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
 
 7506                    array(
'text', 
'text', 
'text', 
'integer', 
'integer'),
 
 7507                    array(
"", $this->lng->txt(
"anonymous"), 
"", $this->getTestId(), $user_id)
 
 7511                    "SELECT tst_active.active_id, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
 
 7512                    "tst_active.submitted test_finished, matriculation, COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes  FROM usr_data, tst_invited_user " .
 
 7513                    "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7514                    "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
 
 7516                    array(
'text', 
'text', 
'text', 
'integer'),
 
 7517                    array(
"", $this->lng->txt(
"anonymous"), 
"", $this->getTestId())
 
 7521            if (is_numeric($user_id)) {
 
 7523                    "SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
 
 7524                    "tst_active.submitted test_finished, matriculation, COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes  FROM usr_data, tst_invited_user " .
 
 7525                    "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7526                    "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
 
 7528                    array(
'integer', 
'integer'),
 
 7533                    "SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
 
 7534                    "tst_active.submitted test_finished, matriculation, COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes  FROM usr_data, tst_invited_user " .
 
 7535                    "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7536                    "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
 
 7543        $result_array = array();
 
 7545            $result_array[$row[
'usr_id']] = $row;
 
 7547        return $result_array;
 
 7563                                SELECT  tst_active.active_id, 
 7565                                                tst_active.user_fi usr_id, 
 7569                                                tst_active.submitted test_finished, 
 7570                                                usr_data.matriculation, 
 7572                                                tst_active.lastindex, 
 7573                                                COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes 
 7576                                ON tst_active.user_fi = usr_data.usr_id 
 7577                                WHERE tst_active.test_fi = %s 
 7578                                ORDER BY usr_data.lastname 
 7582                array(
'text', 
'text', 
'text', 
'integer'),
 
 7583                array(
"", $this->lng->txt(
"anonymous"), 
"", $this->getTestId())
 
 7587                                SELECT  tst_active.active_id, 
 7589                                                tst_active.user_fi usr_id, 
 7593                                                tst_active.submitted test_finished, 
 7594                                                usr_data.matriculation, 
 7596                                                tst_active.lastindex, 
 7597                                                COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes 
 7600                                ON tst_active.user_fi = usr_data.usr_id 
 7601                                WHERE tst_active.test_fi = %s 
 7602                                ORDER BY usr_data.lastname 
 7612            $data[$row[
'active_id']] = $row;
 
 7615            if (strlen(trim($participant[
"firstname"] . $participant[
"lastname"])) == 0) {
 
 7616                $data[
$index][
"lastname"] = $this->lng->txt(
"deleted_user");
 
 7627        include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 7629        if (count($scoring) == 0) {
 
 7634        $filtered_participants = array();
 
 7635        foreach ($participants as $active_id => $participant) {
 
 7636            $qstType_IN_manScoreableQstTypes = 
$ilDB->in(
'qpl_questions.question_type_fi', $scoring, 
false, 
'integer');
 
 7639                                SELECT          tst_test_result.manual 
 7641                                FROM            tst_test_result 
 7643                                INNER JOIN      qpl_questions 
 7644                                ON                      tst_test_result.question_fi = qpl_questions.question_id 
 7646                                WHERE           tst_test_result.active_fi = %s 
 7647                                AND                     $qstType_IN_manScoreableQstTypes 
 7661                        if ($participant->active) {
 
 7662                            $filtered_participants[$active_id] = $participant;
 
 7666                        if (!$participant->active) {
 
 7667                            $filtered_participants[$active_id] = $participant;
 
 7671                        $filtered_participants[$active_id] = $participant;
 
 7686                            $assessmentSetting = 
new ilSetting(
"assessment");
 
 7687                            $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
 
 7688                            if ($manscoring_done) {
 
 7689                                $filtered_participants[$active_id] = $participant;
 
 7702                            $assessmentSetting = 
new ilSetting(
"assessment");
 
 7703                            $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
 
 7704                            if (!$manscoring_done) {
 
 7705                                $filtered_participants[$active_id] = $participant;
 
 7713                            if ($row[
"manual"]) {
 
 7717                        if (($found > 0) && ($found < $count)) {
 
 7718                            $filtered_participants[$active_id] = $participant;
 
 7722                        $filtered_participants[$active_id] = $participant;
 
 7727        return $filtered_participants;
 
 7742        if (!is_array($ids) || count($ids) == 0) {
 
 7748                "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",
 
 7749                array(
'text', 
'text', 
'text'),
 
 7750                array(
"", $this->lng->txt(
"anonymous"), 
"")
 
 7753            $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");
 
 7756        $result_array = array();
 
 7758            $result_array[$row[
"usr_id"]] = $row;
 
 7760        return $result_array;
 
 7765        if (!is_array($ids) || count($ids) == 0) {
 
 7778        if (!is_array($ids) || count($ids) == 0) {
 
 7782        foreach ($ids as $obj_id) {
 
 7797        include_once 
"./Modules/Group/classes/class.ilObjGroup.php";
 
 7799        $members = $group->getGroupMemberIds();
 
 7800        include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 7801        foreach ($members as $user_id) {
 
 7817        include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 7818        foreach ($members as $user_id) {
 
 7836        $affectedRows = 
$ilDB->manipulateF(
 
 7837            "DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
 
 7838            array(
'integer', 
'integer'),
 
 7854        $affectedRows = 
$ilDB->manipulateF(
 
 7855            "DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
 
 7856            array(
'integer', 
'integer'),
 
 7859        $affectedRows = 
$ilDB->manipulateF(
 
 7860            "INSERT INTO tst_invited_user (test_fi, user_fi, clientip, tstamp) VALUES (%s, %s, %s, %s)",
 
 7861            array(
'integer', 
'integer', 
'text', 
'integer'),
 
 7862            array($this->
getTestId(), $user_id, (strlen($client_ip)) ? $client_ip : 
null, time())
 
 7872        $affectedRows = 
$ilDB->manipulateF(
 
 7873            "UPDATE tst_invited_user SET clientip = %s, tstamp = %s WHERE test_fi=%s and user_fi=%s",
 
 7874            array(
'text', 
'integer', 
'integer', 
'integer'),
 
 7875            array((strlen($client_ip)) ? $client_ip : 
null, time(), $this->
getTestId(), $user_id)
 
 7888        if (is_numeric($question_fi)) {
 
 7890                "SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s AND question_fi=%s",
 
 7891                array(
'integer', 
'integer'),
 
 7892                array($active_id, $question_fi)
 
 7896                "SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s",
 
 7901        $result_array = array();
 
 7903            $result_array[$row[
"question_fi"]] = $row;
 
 7905        return $result_array;
 
 7918        $affectedRows = 
$ilDB->manipulateF(
 
 7919            "DELETE FROM tst_qst_solved WHERE active_fi = %s AND question_fi = %s",
 
 7920            array(
'integer', 
'integer'),
 
 7921            array($active_id, $question_id)
 
 7923        $affectedRows = 
$ilDB->manipulateF(
 
 7924            "INSERT INTO tst_qst_solved (solved, question_fi, active_fi) VALUES (%s, %s, %s)",
 
 7925            array(
'integer', 
'integer', 
'integer'),
 
 7926            array($value, $question_id, $active_id)
 
 7939            "SELECT submitted FROM tst_active WHERE active_id=%s AND submitted=%s",
 
 7940            array(
'integer', 
'integer'),
 
 7941            array($active_id, 1)
 
 7943        return $result->numRows() == 1;
 
 7955        if (!is_numeric($user_id)) {
 
 7960            "SELECT submitted FROM tst_active WHERE test_fi=%s AND user_fi=%s AND submitted=%s",
 
 7961            array(
'integer', 
'integer', 
'integer'),
 
 7964        return $result->numRows() == 1;
 
 7999            "user_id" => $this->lng->txt(
"user_id"),
 
 8000            "matriculation" => $this->lng->txt(
"matriculation"),
 
 8001            "lastname" => $this->lng->txt(
"lastname"),
 
 8002            "firstname" => $this->lng->txt(
"firstname"),
 
 8003            "login" => $this->lng->txt(
"login"),
 
 8004            "reached_points" => $this->lng->txt(
"tst_reached_points"),
 
 8005            "max_points" => $this->lng->txt(
"tst_maximum_points"),
 
 8006            "percent_value" => $this->lng->txt(
"tst_percent_solved"),
 
 8007            "mark" => $this->lng->txt(
"tst_mark"),
 
 8008            "ects" => $this->lng->txt(
"ects_grade")
 
 8011        if (count($participants)) {
 
 8015            foreach ($participants as $active_id => $user_rec) {
 
 8016                $mark = $ects_mark = 
'';
 
 8018                $reached_points = 0;
 
 8020                foreach ($this->questions as $value) {
 
 8022                    if (is_object($question)) {
 
 8023                        $max_points += $question->getMaximumPoints();
 
 8024                        $reached_points += $question->getReachedPoints($active_id);
 
 8027                if ($max_points > 0) {
 
 8028                    $percentvalue = $reached_points / $max_points;
 
 8029                    if ($percentvalue < 0) {
 
 8030                        $percentvalue = 0.0;
 
 8035                $mark_obj = $this->mark_schema->getMatchingMark($percentvalue * 100);
 
 8038                    $mark = $mark_obj->getOfficialName();
 
 8040                        $ects_mark = $this->
getECTSGrade($passed_array, $reached_points, $max_points);
 
 8044                    $user_rec[
'firstname'] = 
"";
 
 8045                    $user_rec[
'lastname'] = $this->lng->txt(
"anonymous");
 
 8048                    "user_id" => $user_rec[
'usr_id'],
 
 8049                    "matriculation" => $user_rec[
'matriculation'],
 
 8050                    "lastname" => $user_rec[
'lastname'],
 
 8051                    "firstname" => $user_rec[
'firstname'],
 
 8052                    "login" => $user_rec[
'login'],
 
 8053                    "reached_points" => $reached_points,
 
 8054                    "max_points" => $max_points,
 
 8055                    "percent_value" => $percentvalue,
 
 8057                    "ects" => $ects_mark
 
 8077        $resultarray = array();
 
 8078        foreach ($row as $rowindex => $entry) {
 
 8083            if (strpos($entry, 
"\"") !== 
false) {
 
 8084                $entry = str_replace(
"\"", 
"\"\"", $entry);
 
 8087            if (strpos($entry, $separator) !== 
false) {
 
 8091            $entry = str_replace(chr(13) . chr(10), chr(10), $entry);
 
 8094                $entry = 
"\"" . $entry . 
"\"";
 
 8097            $resultarray[$rowindex] = $entry;
 
 8099        return $resultarray;
 
 8115            "SELECT tries FROM tst_active WHERE active_id = %s",
 
 8121            return $row[
"tries"];
 
 8141            "SELECT MAX(pass) maxpass FROM tst_pass_result WHERE active_fi = %s",
 
 8147            $max = $row[
"maxpass"];
 
 8165            "SELECT * FROM tst_pass_result WHERE active_fi = %s",
 
 8173                if ($row[
"maxpoints"] > 0) {
 
 8174                    $factor = $row[
"points"] / $row[
"maxpoints"];
 
 8179                if ($factor > $bestfactor) {
 
 8181                    $bestfactor = $factor;
 
 8184            if (is_array($bestrow)) {
 
 8185                return $bestrow[
"pass"];
 
 8204        $counted_pass = 
null;
 
 8210        return $counted_pass;
 
 8229            $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 8231            require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
 8233            $testSession = $testSessionFactory->getSession($active_id);
 
 8235            require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 8239            require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 8241            $dynamicQuestionSetConfig->loadFromDb();
 
 8252        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 8254        foreach ($this->questions as $value) {
 
 8256                $workedthrough += 1;
 
 8259        return $workedthrough;
 
 8273        if (is_null(
$pass)) {
 
 8278                        SELECT  tst_pass_result.tstamp pass_res_tstamp, 
 8279                                        tst_test_result.tstamp quest_res_tstamp 
 8281                        FROM tst_pass_result 
 8283                        LEFT JOIN tst_test_result 
 8284                        ON tst_test_result.active_fi = tst_pass_result.active_fi 
 8285                        AND tst_test_result.pass = tst_pass_result.pass 
 8287                        WHERE tst_pass_result.active_fi = %s 
 8288                        AND tst_pass_result.pass = %s 
 8290                        ORDER BY tst_test_result.tstamp DESC 
 8295            array(
'integer', 
'integer'),
 
 8296            array($active_id, 
$pass)
 
 8300            if ($row[
'qres_tstamp']) {
 
 8301                return $row[
'quest_res_tstamp'];
 
 8304            return $row[
'pass_res_tstamp'];
 
 8321            "executable" => 
true,
 
 8322            "errormessage" => 
"" 
 8325            $result[
"executable"] = 
false;
 
 8330            $result[
"executable"] = 
false;
 
 8338            if ($active_id > 0) {
 
 8352                            $result[
"executable"] = 
false;
 
 8353                            $result[
"errormessage"] = $this->lng->txt(
"detail_max_processing_time_reached");
 
 8361        require_once 
'Modules/Test/classes/class.ilTestPassesSelector.php';
 
 8363        $testPassesSelector->setActiveId($active_id);
 
 8364        $testPassesSelector->setLastFinishedPass(
$testSession->getLastFinishedPass());
 
 8367            $closedPasses = $testPassesSelector->getClosedPasses();
 
 8370                $result[
"executable"] = 
false;
 
 8371                $result[
"errormessage"] = $this->lng->txt(
"maximum_nr_of_tries_reached");
 
 8377                    $result[
'executable'] = 
false;
 
 8378                    $result[
'errormessage'] = $this->lng->txt(
"tst_addit_passes_blocked_after_passed_msg");
 
 8384            $lastPass = $testPassesSelector->getLastFinishedPassTimestamp();
 
 8387                $time_values = explode(
":", $pass_waiting_string);
 
 8388                $next_pass_allowed = strtotime(
'+ ' . $time_values[0] . 
' Months + ' . $time_values[1] . 
' Days + ' . $time_values[2] . 
' Hours' . $time_values[3] . 
' Minutes', $lastPass);
 
 8390                if (time() < $next_pass_allowed) {
 
 8393                    $result[
"executable"] = 
false;
 
 8394                    $result[
"errormessage"] = sprintf($this->lng->txt(
'wait_for_next_pass_hint_msg'), $date);
 
 8407        require_once 
'Modules/Test/classes/class.ilTestPassesSelector.php';
 
 8410        $passSelector->setActiveId(
$testSession->getActiveId());
 
 8411        $passSelector->setLastFinishedPass(
$testSession->getLastFinishedPass());
 
 8413        return $passSelector->hasReportablePasses();
 
 8420        require_once 
'Modules/Test/classes/class.ilTestPassesSelector.php';
 
 8423        $passSelector->setActiveId(
$testSession->getActiveId());
 
 8424        $passSelector->setLastFinishedPass(
$testSession->getLastFinishedPass());
 
 8426        return $passSelector->hasExistingPasses();
 
 8441        if ($active_id < 1) {
 
 8444        if (
$pass === 
null) {
 
 8448            "SELECT tst_times.started FROM tst_times WHERE tst_times.active_fi = %s AND tst_times.pass = %s ORDER BY tst_times.started",
 
 8449            array(
'integer', 
'integer'),
 
 8450            array($active_id, 
$pass)
 
 8454            if (preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $row[
"started"], $matches)) {
 
 8455                return mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 8494                                                questtypes.type_tag, 
 8496                                                tstquest.obligatory, 
 8497                                                origquest.obj_fi orig_obj_fi 
 8499                        FROM            qpl_questions questions 
 8501                        INNER JOIN      qpl_qst_type questtypes 
 8502                        ON                      questtypes.question_type_id = questions.question_type_fi 
 8504                        INNER JOIN      tst_test_question tstquest 
 8505                        ON                      tstquest.question_fi = questions.question_id 
 8507                        LEFT JOIN       qpl_questions origquest 
 8508                        ON                      origquest.question_id = questions.original_id 
 8510                        WHERE           tstquest.test_fi = %s 
 8512                        ORDER BY        tstquest.sequence 
 8515        $query_result = 
$ilDB->queryF(
 
 8523        while ($row = 
$ilDB->fetchAssoc($query_result)) {
 
 8541            if ($questionData[
'question_id'] != $questionId) {
 
 8555        $row = 
$DIC->database()->fetchAssoc(
$DIC->database()->queryF(
 
 8556            "SELECT COUNT(question_id) cnt FROM qpl_questions WHERE question_id = %s AND obj_fi = %s",
 
 8557            array(
'integer', 
'integer'),
 
 8558            array($questionId, $this->
getId())
 
 8561        return (
bool) $row[
'cnt'];
 
 8572            $points += $questionData[
'points'];
 
 8583        $totalWorkingTime = 
'00:00:00';
 
 8588                $questionData[
'working_time']
 
 8592        return $totalWorkingTime;
 
 8598    public function getPotentialRandomTestQuestions()
 
 8608                                                questtypes.type_tag, 
 8609                                                origquest.obj_fi orig_obj_fi 
 8611                        FROM            qpl_questions questions 
 8613                        INNER JOIN      qpl_qst_type questtypes 
 8614                        ON                      questtypes.question_type_id = questions.question_type_fi 
 8616                        INNER JOIN      tst_rnd_cpy tstquest 
 8617                        ON                      tstquest.qst_fi = questions.question_id 
 8619                        LEFT JOIN       qpl_questions origquest 
 8620                        ON                      origquest.question_id = questions.original_id 
 8622                        WHERE           tstquest.tst_fi = %s 
 8625        $query_result = 
$ilDB->queryF(
 
 8633        while ($row = 
$ilDB->fetchAssoc($query_result)) {
 
 8652        return ($this->shuffle_questions) ? 1 : 0;
 
 8663        $this->shuffle_questions = ($a_shuffle) ? 1 : 0;
 
 8680        return ($this->show_summary) ? $this->show_summary : 0;
 
 8697        $this->show_summary = $a_value;
 
 8708        if (($this->show_summary & 1) > 0) {
 
 8724            $this->show_summary = 1;
 
 8726            $this->show_summary = 0;
 
 8738        if (($this->show_summary & 2) > 0) {
 
 8754            $this->show_summary = $this->show_summary | 2;
 
 8758                $this->show_summary = $this->show_summary ^ 2;
 
 8771        if (($this->show_summary & 4) > 0) {
 
 8787            $this->show_summary = $this->show_summary | 4;
 
 8791                $this->show_summary = $this->show_summary ^ 4;
 
 8804        if (($this->show_summary & 8) > 0) {
 
 8820            $this->show_summary = $this->show_summary | 8;
 
 8824                $this->show_summary = $this->show_summary ^ 8;
 
 8837        return ($this->results_presentation) ? $this->results_presentation : 0;
 
 8848        if (($this->results_presentation & 1) > 0) {
 
 8863        if (($this->results_presentation & 2) > 0) {
 
 8878        if (($this->results_presentation & 4) > 0) {
 
 8893        if (($this->results_presentation & 8) > 0) {
 
 8908        if (($this->results_presentation & 16) > 0) {
 
 8923        if (($this->results_presentation & 32) > 0) {
 
 8936        if (($this->results_presentation & 64) > 0) {
 
 8949        if (($this->results_presentation & 128) > 0) {
 
 8964        $this->results_presentation = $a_results_presentation;
 
 8978            $this->results_presentation = $this->results_presentation | 1;
 
 8981                $this->results_presentation = $this->results_presentation ^ 1;
 
 8995            $this->results_presentation = $this->results_presentation | 2;
 
 8998                $this->results_presentation = $this->results_presentation ^ 2;
 
 9023            $this->results_presentation = $this->results_presentation | 4;
 
 9026                $this->results_presentation = $this->results_presentation ^ 4;
 
 9040            $this->results_presentation = $this->results_presentation | 8;
 
 9043                $this->results_presentation = $this->results_presentation ^ 8;
 
 9057            $this->results_presentation = $this->results_presentation | 16;
 
 9060                $this->results_presentation = $this->results_presentation ^ 16;
 
 9074            $this->results_presentation = $this->results_presentation | 32;
 
 9077                $this->results_presentation = $this->results_presentation ^ 32;
 
 9091            $this->results_presentation = $this->results_presentation | 64;
 
 9094                $this->results_presentation = $this->results_presentation ^ 64;
 
 9106        if ($a_comparison) {
 
 9107            $this->results_presentation = $this->results_presentation | 128;
 
 9110                $this->results_presentation = $this->results_presentation ^ 128;
 
 9123            "SELECT user_fi FROM tst_active WHERE active_id = %s",
 
 9129            return $row[
"user_fi"];
 
 9153        return ($this->allowedUsers) ? $this->allowedUsers : 0;
 
 9158        $this->allowedUsers = $a_allowed_users;
 
 9163        return ($this->allowedUsersTimeGap) ? $this->allowedUsersTimeGap : 0;
 
 9168        $this->allowedUsersTimeGap = $a_allowed_users_time_gap;
 
 9178        if (($nr_of_users > 0) && ($time_gap > 0)) {
 
 9180            $time_border = $now - $time_gap;
 
 9181            $str_time_border = strftime(
"%Y%m%d%H%M%S", $time_border);
 
 9183                                SELECT DISTINCT tst_times.active_fi 
 9185                                INNER JOIN tst_active 
 9186                                ON tst_times.active_fi = tst_active.active_id 
 9188                                        tst_times.pass > tst_active.last_finished_pass OR tst_active.last_finished_pass IS NULL 
 9190                                WHERE tst_times.tstamp > %s 
 9191                                AND tst_active.test_fi = %s 
 9194            if (
$result->numRows() >= $nr_of_users) {
 
 9195                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 9213            "SELECT finished FROM tst_times WHERE active_fi = %s ORDER BY finished DESC",
 
 9219            return $row[
"finished"];
 
 9229            SELECT MAX(tst_times.tstamp) as last_pass_access 
 9231            WHERE active_fi = %s 
 9237            array(
'integer', 
'integer'),
 
 9238            array($activeId, $passIndex)
 
 9241        while ($row = 
$DIC->database()->fetchAssoc(
$res)) {
 
 9242            return $row[
'last_pass_access'];
 
 9257        if (preg_match(
"/<[^>]*?>/", $a_text)) {
 
 9274        for (
$i = 0; 
$i < $a_material->getMaterialCount(); 
$i++) {
 
 9275            $material = $a_material->getMaterial(
$i);
 
 9276            if (strcmp($material[
"type"], 
"mattext") == 0) {
 
 9277                $result .= $material[
"material"]->getContent();
 
 9279            if (strcmp($material[
"type"], 
"matimage") == 0) {
 
 9280                $matimage = $material[
"material"];
 
 9281                if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches)) {
 
 9283                    if (!is_array(
$_SESSION[
"import_mob_xhtml"])) {
 
 9284                        $_SESSION[
"import_mob_xhtml"] = array();
 
 9286                    array_push(
$_SESSION[
"import_mob_xhtml"], array(
"mob" => $matimage->getLabel(), 
"uri" => $matimage->getUri()));
 
 9306        include_once 
"./Services/RTE/classes/class.ilRTE.php";
 
 9307        include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 9309        $a_xml_writer->xmlStartTag(
"material");
 
 9311            "texttype" => 
"text/plain" 
 9313        if ($this->
isHTML($a_material)) {
 
 9314            $attrs[
"texttype"] = 
"text/xhtml";
 
 9319        foreach (
$mobs as $mob) {
 
 9320            $moblabel = 
"il_" . IL_INST_ID . 
"_mob_" . $mob;
 
 9321            if (strpos($a_material, 
"mm_$mob") !== 
false) {
 
 9325                        "label" => $moblabel,
 
 9326                        "uri" => 
"objects/" . 
"il_" . IL_INST_ID . 
"_mob_" . $mob . 
"/" . $mob_obj->getTitle()
 
 9329                $a_xml_writer->xmlElement(
"matimage", $imgattrs, 
null);
 
 9332        $a_xml_writer->xmlEndTag(
"material");
 
 9343        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 9358        $affectedRows = 
$ilDB->manipulateF(
 
 9359            "UPDATE tst_tests SET certificate_visibility = %s, tstamp = %s WHERE test_id = %s",
 
 9360            array(
'text', 
'integer', 
'integer'),
 
 9361            array($a_value, time(), $this->
getTestId())
 
 9373        return (strlen($this->certificate_visibility)) ? $this->certificate_visibility : 0;
 
 9384        $this->certificate_visibility = $a_value;
 
 9395        return ($this->anonymity) ? 1 : 0;
 
 9408                $this->anonymity = 1;
 
 9411                $this->anonymity = 0;
 
 9424        return ($this->show_cancel) ? 1 : 0;
 
 9437                $this->show_cancel = 1;
 
 9440                $this->show_cancel = 0;
 
 9453        return ($this->show_marker) ? 1 : 0;
 
 9466                $this->show_marker = 1;
 
 9469                $this->show_marker = 0;
 
 9482        return ($this->fixed_participants) ? 1 : 0;
 
 9495                $this->fixed_participants = 1;
 
 9498                $this->fixed_participants = 0;
 
 9516            "SELECT anonymity FROM tst_tests WHERE obj_fi = %s",
 
 9521            return $row[
'anonymity'];
 
 9538                        SELECT          tst_tests.question_set_type 
 9540                        INNER JOIN      tst_tests 
 9541                        ON                      tst_active.test_fi = tst_tests.test_id 
 9542                        WHERE           tst_active.active_id = %s 
 9547        while ($row = 
$ilDB->fetchAssoc(
$res)) {
 
 9548            return $row[
'question_set_type'];
 
 9564        throw new Exception(__METHOD__ . 
' is deprecated ... use ilObjTest::lookupQuestionSetTypeByActiveId() instead!');
 
 9570            "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",
 
 9575            return $row[
'random_test'];
 
 9590    public function userLookupFullName($user_id, $overwrite_anonymity = 
false, $sorted_order = 
false, $suffix = 
"")
 
 9593            return $this->lng->txt(
"anonymous") . $suffix;
 
 9595            include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 9597            if (strlen($uname[
"firstname"] . $uname[
"lastname"]) == 0) {
 
 9598                $uname[
"firstname"] = $this->lng->txt(
"deleted_user");
 
 9600            if ($sorted_order) {
 
 9601                return trim($uname[
"lastname"] . 
", " . $uname[
"firstname"]) . $suffix;
 
 9603                return trim($uname[
"firstname"] . 
" " . $uname[
"lastname"]) . $suffix;
 
 9618            return $this->lng->txt(
"tst_start_test");
 
 9623            if ($active_pass == 0) {
 
 9624                return $this->lng->txt(
"tst_start_test");
 
 9626                return $this->lng->txt(
"tst_start_new_test_pass");
 
 9629            return $this->lng->txt(
"tst_resume_test");
 
 9638    public function getAvailableDefaults()
 
 9649            "SELECT * FROM tst_test_defaults WHERE user_fi = %s ORDER BY name ASC",
 
 9653        $defaults = array();
 
 9655            $defaults[$row[
"test_defaults_id"]] = $row;
 
 9678            "SELECT * FROM tst_test_defaults WHERE test_defaults_id = %s",
 
 9680            array($test_defaults_id)
 
 9682        if (
$result->numRows() == 1) {
 
 9700        $affectedRows = 
$ilDB->manipulateF(
 
 9701            "DELETE FROM tst_test_defaults WHERE test_defaults_id = %s",
 
 9703            array($test_default_id)
 
 9718        $testsettings = array(
 
 9813        $next_id = 
$ilDB->nextId(
'tst_test_defaults');
 
 9815            'tst_test_defaults',
 
 9817                'test_defaults_id' => array(
'integer', $next_id),
 
 9818                'name' => array(
'text', $a_name),
 
 9819                'user_fi' => array(
'integer', 
$ilUser->getId()),
 
 9820                'defaults' => array(
'clob', serialize($testsettings)),
 
 9821                'marks' => array(
'clob', serialize($this->mark_schema)),
 
 9822                'tstamp' => array(
'integer', time())
 
 9836        $testsettings = unserialize($test_defaults[
"defaults"]);
 
 9837        include_once 
"./Modules/Test/classes/class.assMarkSchema.php";
 
 9838        $this->mark_schema = unserialize($test_defaults[
"marks"]);
 
 9873        $this->
setKiosk($testsettings[
"Kiosk"]);
 
 9877        $this->
setECTSFX($testsettings[
"ECTSFX"]);
 
 9879        if (isset($testsettings[
"isRandomTest"])) {
 
 9880            if ($testsettings[
"isRandomTest"]) {
 
 9885        } elseif (isset($testsettings[
"questionSetType"])) {
 
 9907        if (isset($testsettings[
'examid_in_kiosk'])) {
 
 9912        if (isset($testsettings[
'show_exam_id'])) {
 
 9966        if (extension_loaded(
"tidy")) {
 
 9969                "output-xml" => 
true,
 
 9970                "numeric-entities" => 
true 
 9973            $tidy->parseString($print_output, 
$config, 
'utf8');
 
 9974            $tidy->cleanRepair();
 
 9975            $print_output = tidy_get_output($tidy);
 
 9976            $print_output = preg_replace(
"/^.*?(<html)/", 
"\\1", $print_output);
 
 9978            $print_output = str_replace(
" ", 
" ", $print_output);
 
 9979            $print_output = str_replace(
"⊗", 
"X", $print_output);
 
 9981        $xsl = file_get_contents(
"./Modules/Test/xml/question2fo.xsl");
 
 9986            'font-family="Helvetica, unifont"',
 
 9987            'font-family="' . 
$DIC[
'ilSetting']->
get(
'rpc_pdf_font', 
'Helvetica, unifont') . 
'"',
 
 9991        $args = array( 
'/_xml' => $print_output, 
'/_xsl' => $xsl );
 
 9994        $output = xslt_process($xh, 
"arg:/_xml", 
"arg:/_xsl", 
null, $args, $params);
 
10008        $content = preg_replace(
"/href=\".*?\"/", 
"", $content);
 
10009        $printbody = 
new ilTemplate(
"tpl.il_as_tst_print_body.html", 
true, 
true, 
"Modules/Test");
 
10011        $printbody->setVariable(
"ADM_CONTENT", $content);
 
10012        $printbody->setCurrentBlock(
"css_file");
 
10014        $printbody->parseCurrentBlock();
 
10015        $printbody->setCurrentBlock(
"css_file");
 
10017        $printbody->parseCurrentBlock();
 
10018        $printoutput = $printbody->get();
 
10019        $html = str_replace(
"href=\"./", 
"href=\"" . 
ILIAS_HTTP_PATH . 
"/", $printoutput);
 
10020        $html = preg_replace(
"/<div id=\"dontprint\">.*?<\\/div>/ims", 
"", $html);
 
10021        if (extension_loaded(
"tidy")) {
 
10024                "output-xml" => 
true,
 
10025                "numeric-entities" => 
true 
10027            $tidy = 
new tidy();
 
10028            $tidy->parseString($html, 
$config, 
'utf8');
 
10029            $tidy->cleanRepair();
 
10030            $html = tidy_get_output($tidy);
 
10031            $html = preg_replace(
"/^.*?(<html)/", 
"\\1", $html);
 
10033            $html = str_replace(
" ", 
" ", $html);
 
10034            $html = str_replace(
"⊗", 
"X", $html);
 
10036        $html = preg_replace(
"/src=\".\\//ims", 
"src=\"" . 
ILIAS_HTTP_PATH . 
"/", $html);
 
10051        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
10053        $fp = fopen($fo_file, 
"w");
 
10057        include_once 
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
 
10063        } 
catch (Exception 
$e) {
 
10064            $ilLog->write(__METHOD__ . 
': ' . 
$e->getMessage());
 
10084            $feedback = $row[
'feedback'];
 
10106            "SELECT * FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
10107            array(
'integer', 
'integer', 
'integer'),
 
10108            array($active_id, $question_id, 
$pass)
 
10111        if (
$result->numRows() === 1) {
 
10115            $DIC->logger()->root()->warning(
"WARNING: Multiple feedback entries on tst_manual_fb for " .
 
10116                "active_fi = $active_id , question_fi = $question_id and pass = $pass");
 
10134        $feedback = array();
 
10136            "SELECT * FROM tst_manual_fb WHERE question_fi = %s",
 
10138            array($question_id)
 
10142            $active = $row[
'active_fi'];
 
10143            $pass = $row[
'pass'];
 
10144            $question = $row[
'question_fi'];
 
10148            $feedback[$active][
$pass][$question] = $row;
 
10171        $finalized_record = (int) $feedback_old[
'finalized_evaluation'];
 
10172        if ($finalized_record === 0 || ($is_single_feedback && $finalized_record === 1)) {
 
10173            $DIC->database()->manipulateF(
 
10174                "DELETE FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
10175                array(
'integer', 
'integer', 
'integer'),
 
10176                array($active_id, $question_id, 
$pass)
 
10205        $next_id = 
$ilDB->nextId(
'tst_manual_fb');
 
10207        $finalized_time = time();
 
10209        $update_default = [
 
10210            'manual_feedback_id' => [ 
'integer', $next_id],
 
10211            'active_fi' => [ 
'integer', $active_id],
 
10212            'question_fi' => [ 
'integer', $question_id],
 
10213            'pass' => [ 
'integer', 
$pass],
 
10215            'tstamp' => [ 
'integer', time()]
 
10218        if ($feedback_old[
'finalized_evaluation'] == 1) {
 
10219            $user = $feedback_old[
'finalized_by_usr_id'];
 
10220            $finalized_time = $feedback_old[
'finalized_tstamp'];
 
10223        if ($finalized === 
true || $feedback_old[
'finalized_evaluation'] == 1) {
 
10224            if (!array_key_exists(
'evaluated', 
$_POST)) {
 
10225                $update_default[
'finalized_evaluation'] = [
'integer', 0];
 
10226                $update_default[
'finalized_by_usr_id'] = [
'integer', 0];
 
10227                $update_default[
'finalized_tstamp'] = [
'integer', 0];
 
10229                $update_default[
'finalized_evaluation'] = [
'integer', 1];
 
10230                $update_default[
'finalized_by_usr_id'] = [
'integer', $user];
 
10231                $update_default[
'finalized_tstamp'] = [
'integer', $finalized_time];
 
10235        $ilDB->insert(
'tst_manual_fb', $update_default);
 
10285        include_once 
"./Modules/Test/classes/class.ilTestSequence.php";
 
10296        $this->test_id = $a_id;
 
10310        if (count($participants)) {
 
10311            foreach ($participants as $active_id => $user_rec) {
 
10313                $reached_points = 0;
 
10315                foreach ($this->questions as $value) {
 
10317                    if (is_object($question)) {
 
10318                        $max_points += $question->getMaximumPoints();
 
10319                        $reached_points += $question->getReachedPoints($active_id);
 
10320                        if ($max_points > 0) {
 
10321                            $percentvalue = $reached_points / $max_points;
 
10322                            if ($percentvalue < 0) {
 
10323                                $percentvalue = 0.0;
 
10329                            $user_rec[
'firstname'] = 
"";
 
10330                            $user_rec[
'lastname'] = $this->lng->txt(
"anonymous");
 
10333                            "user_id" => $user_rec[
'usr_id'],
 
10334                            "matriculation" => $user_rec[
'matriculation'],
 
10335                            "lastname" => $user_rec[
'lastname'],
 
10336                            "firstname" => $user_rec[
'firstname'],
 
10337                            "login" => $user_rec[
'login'],
 
10338                            "question_id" => $question->getId(),
 
10339                            "question_title" => $question->getTitle(),
 
10340                            "reached_points" => $reached_points,
 
10341                            "max_points" => $max_points
 
10360            "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",
 
10365        return $rec[
"obj_id"];
 
10377        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
10378        if ($ilPluginAdmin->isActive(
IL_COMP_MODULE, 
"TestQuestionPool", 
"qst", $a_pname)) {
 
10391            "SELECT passed FROM tst_result_cache WHERE active_fi = %s",
 
10397            return $row[
'passed'];
 
10400            $result_array = &$this->
getTestResult($active_id, $counted_pass);
 
10401            return $result_array[
"test"][
"passed"];
 
10413            $isComplete = 
false;
 
10416                $userCertificateRepository->fetchActiveCertificate($user_id, $this->
getId());
 
10417                $isComplete = 
true;
 
10453    public function getParticipantsForTestAndQuestion(
$test_id, $question_id)
 
10460                        SELECT tst_test_result.active_fi, tst_test_result.question_fi, tst_test_result.pass 
10461                        FROM tst_test_result 
10462                        INNER JOIN tst_active ON tst_active.active_id = tst_test_result.active_fi AND tst_active.test_fi = %s 
10463                        INNER JOIN qpl_questions ON qpl_questions.question_id = tst_test_result.question_fi 
10464                        LEFT JOIN usr_data ON usr_data.usr_id = tst_active.user_fi 
10465                        WHERE tst_test_result.question_fi = %s 
10466                        ORDER BY usr_data.lastname ASC, usr_data.firstname ASC 
10471            array(
'integer', 
'integer'),
 
10474        $foundusers = array();
 
10481            if (!array_key_exists($row[
"active_fi"], $foundusers)) {
 
10482                $foundusers[$row[
"active_fi"]] = array();
 
10484            array_push($foundusers[$row[
"active_fi"]], array(
"pass" => $row[
"pass"], 
"qid" => $row[
"question_fi"]));
 
10486        return $foundusers;
 
10497        $foundParticipants = &
$data->getParticipants();
 
10498        $results = array(
"overview" => array(), 
"questions" => array());
 
10499        if (count($foundParticipants)) {
 
10500            $results[
"overview"][$this->lng->txt(
"tst_eval_total_persons")] = count($foundParticipants);
 
10501            $total_finished = 
$data->getTotalFinishedParticipants();
 
10502            $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished")] = $total_finished;
 
10504            $diff_seconds = $average_time;
 
10505            $diff_hours = floor($diff_seconds / 3600);
 
10506            $diff_seconds -= $diff_hours * 3600;
 
10507            $diff_minutes = floor($diff_seconds / 60);
 
10508            $diff_seconds -= $diff_minutes * 60;
 
10509            $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
 
10511            $total_passed_reached = 0;
 
10512            $total_passed_max = 0;
 
10513            $total_passed_time = 0;
 
10514            foreach ($foundParticipants as $userdata) {
 
10515                if ($userdata->getPassed()) {
 
10517                    $total_passed_reached += $userdata->getReached();
 
10518                    $total_passed_max += $userdata->getMaxpoints();
 
10519                    $total_passed_time += $userdata->getTimeOfWork();
 
10522            $average_passed_reached = $total_passed ? $total_passed_reached / $total_passed : 0;
 
10523            $average_passed_max = $total_passed ? $total_passed_max / $total_passed : 0;
 
10524            $average_passed_time = $total_passed ? $total_passed_time / $total_passed : 0;
 
10525            $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed")] = $total_passed;
 
10526            $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);
 
10527            $average_time = $average_passed_time;
 
10528            $diff_seconds = $average_time;
 
10529            $diff_hours = floor($diff_seconds / 3600);
 
10530            $diff_seconds -= $diff_hours * 3600;
 
10531            $diff_minutes = floor($diff_seconds / 60);
 
10532            $diff_seconds -= $diff_minutes * 60;
 
10533            $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
 
10536        foreach (
$data->getQuestionTitles() as $question_id => $question_title) {
 
10540            foreach ($foundParticipants as $userdata) {
 
10541                for (
$i = 0; 
$i <= $userdata->getLastPass(); 
$i++) {
 
10542                    if (is_object($userdata->getPass(
$i))) {
 
10543                        $question = &$userdata->getPass(
$i)->getAnsweredQuestionByQuestionId($question_id);
 
10544                        if (is_array($question)) {
 
10546                            $reached += $question[
"reached"];
 
10547                            $max += $question[
"points"];
 
10552            $percent = $max ? $reached / $max * 100.0 : 0;
 
10553            $results[
"questions"][$question_id] = array(
 
10555                sprintf(
"%.2f", $answered ? $reached / $answered : 0) . 
" " . strtolower($this->lng->txt(
"of")) . 
" " . sprintf(
"%.2f", $answered ? $max / $answered : 0),
 
10556                sprintf(
"%.2f", $percent) . 
"%",
 
10558                sprintf(
"%.2f", $answered ? $reached / $answered : 0),
 
10559                sprintf(
"%.2f", $answered ? $max / $answered : 0),
 
10571        require_once 
'Modules/Test/classes/class.ilTestExportFactory.php';
 
10573        $test_exp = $expFactory->getExporter(
'xml');
 
10574        return $test_exp->buildExportFile();
 
10592        $this->mailnotification = $a_notification;
 
10597        include_once 
"./Modules/Test/classes/class.ilTestMailNotification.php";
 
10602        $mail->sendSimpleNotification($owner_id, $this->
getTitle(), $usr_data);
 
10612        include_once 
"./Modules/Test/classes/class.ilObjTestGUI.php";
 
10613        include_once 
"./Modules/Test/classes/tables/class.ilEvaluationAllTableGUI.php";
 
10615        return $table_gui->getSelectedColumns();
 
10620        include_once 
"./Modules/Test/classes/class.ilTestMailNotification.php";
 
10629        require_once 
'Modules/Test/classes/class.ilTestExportFactory.php';
 
10631        $exportObj = $expFactory->getExporter(
'results');
 
10632        $exportObj->setForcedAccessFilteredParticipantList($participantList);
 
10633        $file = $exportObj->exportToExcel($deliver = 
false, 
'active_id', $active_id, $passedonly = 
false);
 
10634        include_once 
"./Services/Mail/classes/class.ilFileDataMail.php";
 
10636        $fd->copyAttachmentFile($file, 
"result_" . $active_id . 
".xls");
 
10637        $file_names[] = 
"result_" . $active_id . 
".xls";
 
10639        $mail->sendAdvancedNotification($owner_id, $this->
getTitle(), $usr_data, $file_names);
 
10641        if (count($file_names)) {
 
10642            $fd->unlinkFiles($file_names);
 
10655                        FROM            tst_result_cache 
10656                        WHERE           active_fi = %s 
10666            include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
10672                                FROM            tst_result_cache 
10673                                WHERE           active_fi = %s 
10690        if ($this->mailnottype == 1) {
 
10700            $this->mailnottype = 1;
 
10702            $this->mailnottype = 0;
 
10708        if ($this->exportsettings) {
 
10718            $this->exportsettings = $a_settings;
 
10720            $this->exportsettings = 0;
 
10726        if (($this->exportsettings & 1) > 0) {
 
10736            $this->exportsettings = $this->exportsettings | 1;
 
10739                $this->exportsettings = $this->exportsettings ^ 1;
 
10746        return $this->enabled_view_mode;
 
10751        $this->enabled_view_mode = $mode;
 
10766        $new_array = array();
 
10769        $query = 
'SELECT question_fi  FROM tst_test_question WHERE test_fi = %s';
 
10770        $types = array(
'integer');
 
10773        $new_question_id += 1;
 
10779        while ($row = 
$ilDB->fetchAssoc(
$res)) {
 
10780            $qid = $row[
'question_fi'];
 
10782            if ($qid == $new_question_id) {
 
10784            } elseif ($qid == $previous_question_id) {
 
10785                $new_array[$position++] = $qid;
 
10786                $new_array[$position++] = $new_question_id;
 
10789                $new_array[$position++] = $qid;
 
10793        $update_query = 
'UPDATE tst_test_question SET sequence = %s WHERE test_fi = %s AND question_fi = %s';
 
10794        $update_types = array(
'integer', 
'integer', 
'integer');
 
10796        foreach ($new_array as $position => $qid) {
 
10797            $ilDB->manipulateF(
 
10822            $values[] = 
'instant_feedback_specific';
 
10825            $values[] = 
'instant_feedback_generic';
 
10828            $values[] = 
'instant_feedback_points';
 
10831            $values[] = 
'instant_feedback_solution';
 
10839        if (is_array($options)) {
 
10855                'pass_details' => 
'setShowPassDetails',
 
10856                'solution_details' => 
'setShowSolutionDetails',
 
10857                'solution_printview' => 
'setShowSolutionPrintview',
 
10858                'solution_feedback' => 
'setShowSolutionFeedback',
 
10859                'solution_answers_only' => 
'setShowSolutionAnswersOnly',
 
10860                'solution_signature' => 
'setShowSolutionSignature',
 
10861                'solution_suggested' => 
'setShowSolutionSuggested',
 
10863        foreach ($setter as $key => $setter) {
 
10864            if (in_array($key, $options)) {
 
10879        $this->poolUsage = (boolean) $usage;
 
10890        $pluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
10892        require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
10894        $questionSetConfig = $qscFactory->getQuestionSetConfig();
 
10897        $reindexedSequencePositionMap = $questionSetConfig->reindexQuestionOrdering();
 
10901        return $reindexedSequencePositionMap;
 
10913        foreach ($orders as 
$id => $position) {
 
10917                isset($obligations[
$id]) && $obligations[
$id] ? 1 : 0
 
10921                                UPDATE          tst_test_question 
10924                                WHERE           question_fi = %s 
10927            $ilDB->manipulateF(
 
10929                array(
'integer', 
'integer', 
'integer'),
 
10930                array(
$i, $obligatory, 
$id)
 
10942        if ($question_before) {
 
10943            $query = 
'SELECT sequence, test_fi FROM tst_test_question WHERE question_fi = %s';
 
10944            $types = array(
'integer');
 
10945            $values = array($question_before);
 
10949        if (!$question_before || ($rset && !($row = 
$ilDB->fetchAssoc($rset)))) {
 
10956        $update = 
'UPDATE tst_test_question SET sequence = sequence + 1 WHERE sequence > %s AND test_fi = %s';
 
10957        $types = array(
'integer', 
'integer');
 
10958        $values = array($row[
'sequence'], $row[
'test_fi']);
 
10959        $ilDB->manipulateF($update, $types, $values);
 
10961        $update = 
'UPDATE tst_test_question SET sequence = %s WHERE question_fi = %s';
 
10962        $types = array(
'integer', 
'integer');
 
10963        $values = array($row[
'sequence'] + 1, $question_to_move);
 
10964        $ilDB->manipulateF($update, $types, $values);
 
10976        $IN_questions = 
$ilDB->in(
'q1.question_id', array_keys(
$questions), 
false, 
'integer');
 
10979                        SELECT          count(q1.question_id) cnt 
10981                        FROM            qpl_questions q1 
10983                        INNER JOIN      qpl_questions q2 
10984                        ON                      q2.question_id = q1.original_id 
10986                        WHERE           $IN_questions 
10987                        AND                     q1.obj_fi = q2.obj_fi 
10992        $row = 
$ilDB->fetchAssoc($rset);
 
10994        return $row[
'cnt'] > 0;
 
11009            "SELECT test_fi,MAX(pass) AS pass FROM tst_active" .
 
11010            " JOIN tst_pass_result ON (tst_pass_result.active_fi = tst_active.active_id)" .
 
11011            " WHERE user_fi=%s" .
 
11012            " GROUP BY test_fi",
 
11013            array(
'integer', 
'integer'),
 
11014            array($a_user_id, 1)
 
11019            $all[$obj_id] = (bool) $row[
"pass"];
 
11030        return $this->online;
 
11035        $this->online = (bool) $a_online;
 
11056        $this->print_best_solution_with_result = (bool) $status;
 
11086        $this->activation_visibility = (bool) $a_value;
 
11096        return (
bool) $this->activation_limited;
 
11101        $this->activation_limited = (bool) $a_value;
 
11113        $this->_highscore_enabled = (bool) $a_enabled;
 
11123        return (
bool) $this->_highscore_enabled;
 
11135        $this->_highscore_anon = (bool) $a_anon;
 
11149        return (
bool) $this->_highscore_anon;
 
11176        $this->_highscore_achieved_ts = (bool) $a_achieved_ts;
 
11186        return (
bool) $this->_highscore_achieved_ts;
 
11196        $this->_highscore_score = (bool) $a_score;
 
11206        return (
bool) $this->_highscore_score;
 
11216        $this->_highscore_percentage = (bool) $a_percentage;
 
11226        return (
bool) $this->_highscore_percentage;
 
11236        $this->_highscore_hints = (bool) $a_hints;
 
11246        return (
bool) $this->_highscore_hints;
 
11256        $this->_highscore_wtime = (bool) $a_wtime;
 
11266        return (
bool) $this->_highscore_wtime;
 
11276        $this->_highscore_own_table = (bool) $a_own_table;
 
11286        return (
bool) $this->_highscore_own_table;
 
11296        $this->_highscore_top_table = (bool) $a_top_table;
 
11306        return (
bool) $this->_highscore_top_table;
 
11317        $this->_highscore_top_num = (int) $a_top_num;
 
11330        $retval = $a_retval;
 
11331        if ((
int) $this->_highscore_top_num != 0) {
 
11332            $retval = $this->_highscore_top_num;
 
11386        switch ($specific_answer_feedback) {
 
11388                $this->specific_answer_feedback = 1;
 
11391                $this->specific_answer_feedback = 0;
 
11398        switch ($this->specific_answer_feedback) {
 
11434        require_once(
'Modules/TestQuestionPool/classes/class.assQuestion.php');
 
11442        $obligationPossible = call_user_func(array($classConcreteQuestion, 
'isObligationPossible'), $questionId);
 
11444        return $obligationPossible;
 
11458        $rset = 
$ilDB->queryF(
'SELECT obligatory FROM tst_test_question WHERE question_fi = %s', array(
'integer'), array($question_id));
 
11460        if ($row = 
$ilDB->fetchAssoc($rset)) {
 
11461            return (
bool) $row[
'obligatory'];
 
11484        $rset = 
$ilDB->queryF(
 
11485            'SELECT obligations_answered FROM tst_pass_result WHERE active_fi = %s AND pass = %s',
 
11486            array(
'integer', 
'integer'),
 
11487            array($active_id, 
$pass)
 
11490        if ($row = 
$ilDB->fetchAssoc($rset)) {
 
11491            return (
bool) $row[
'obligations_answered'];
 
11510        $rset = 
$ilDB->queryF(
 
11511            'SELECT count(*) cnt FROM tst_test_question WHERE test_fi = %s AND obligatory = 1',
 
11516        $row = 
$ilDB->fetchAssoc($rset);
 
11518        return (
bool) $row[
'cnt'] > 0;
 
11561    #region Examview / PDF Examview 
11624        return (strlen($this->activation_starting_time)) ? $this->activation_starting_time : 
null;
 
11629        return (strlen($this->activation_ending_time)) ? $this->activation_ending_time : 
null;
 
11644        $result = 
$ilDB->queryF(
"SELECT tst_times.active_fi, tst_times.started FROM tst_times, tst_active WHERE tst_times.active_fi = tst_active.active_id AND tst_active.test_fi = %s ORDER BY tst_times.tstamp DESC",
 
11649            $times[$row[
'active_fi']] = $row[
'started'];
 
11661            "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",
 
11666            $times[$row[
'active_fi']] = $row[
'additionaltime'];
 
11677            "SELECT additionaltime FROM tst_addtime WHERE active_fi = %s",
 
11681        if (
$result->numRows() > 0) {
 
11683            return $row[
'additionaltime'];
 
11692        require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
11695        $participantData->setParticipantAccessFilter(
 
11700            $participantData->setActiveIdsFilter(array($active_id));
 
11703        $participantData->load($this->
getTestId());
 
11705        foreach ($participantData->getActiveIds() as $active_id) {
 
11707                "SELECT active_fi FROM tst_addtime WHERE active_fi = %s",
 
11712            if (
$result->numRows() > 0) {
 
11713                $DIC->database()->manipulateF(
 
11714                    "DELETE FROM tst_addtime WHERE active_fi = %s",
 
11720            $DIC->database()->manipulateF(
 
11721                "UPDATE tst_active SET tries = %s, submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
11722                array(
'integer',
'integer',
'timestamp',
'integer'),
 
11723                array(0, 0, 
null, $active_id)
 
11726            $DIC->database()->manipulateF(
 
11727                "INSERT INTO tst_addtime (active_fi, additionaltime, tstamp) VALUES (%s, %s, %s)",
 
11728                array(
'integer',
'integer',
'integer'),
 
11729                array($active_id, $minutes, time())
 
11732            require_once 
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
 
11758    public function getMaxPassOfTest()
 
11767                        SELECT MAX(tst_pass_result.pass) + 1 max_res 
11768                        FROM tst_pass_result 
11769                        INNER JOIN tst_active ON tst_active.active_id = tst_pass_result.active_fi 
11770                        WHERE test_fi = ' . 
$ilDB->quote($this->
getTestId(), 
'integer') . 
' 
11774        return (
int) 
$data[
'max_res'];
 
11787        $exam_id_query = 
'SELECT exam_id FROM tst_pass_result WHERE active_fi = %s AND pass = %s';
 
11788        $exam_id_result = 
$ilDB->queryF($exam_id_query, array( 
'integer', 
'integer' ), array( $active_id, 
$pass ));
 
11789        if (
$ilDB->numRows($exam_id_result) == 1) {
 
11790            $exam_id_row = 
$ilDB->fetchAssoc($exam_id_result);
 
11792            if ($exam_id_row[
'exam_id'] != 
null) {
 
11793                return $exam_id_row[
'exam_id'];
 
11811        $inst_id = 
$ilSetting->get(
'inst_id', 
null);
 
11813        if ($test_obj_id === 
null) {
 
11816            $obj_id = $test_obj_id;
 
11819        $examId = 
'I' . $inst_id . 
'_T' . $obj_id . 
'_A' . $active_id . 
'_P' . 
$pass;
 
11871        $this->char_selector_availability = (int) $availability;
 
11887        $this->char_selector_definition = $definition;
 
11931        $query = 
"SELECT question_set_type FROM tst_tests WHERE obj_fi = %s";
 
11937        while ($row = 
$ilDB->fetchAssoc(
$res)) {
 
11990                return $lng->txt(
'tst_question_set_type_fixed');
 
11993                return $lng->txt(
'tst_question_set_type_random');
 
11996                return $lng->txt(
'tst_question_set_type_dynamic');
 
12013        require_once 
'class.ilTestScoring.php';
 
12015        $scoring->setPreserveManualScores($preserve_manscoring);
 
12016        $scoring->recalculateSolutions();
 
12021        require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
12023        $questionChangeListeners = array(
 
12027        return $questionChangeListeners;
 
12038                        INNER JOIN tst_tests 
12039                        ON test_id = test_fi 
12047        while ($row = 
$ilDB->fetchAssoc(
$res)) {
 
12048            $objIds[] = (int) $row[
'obj_fi'];
 
12080        if (!self::isSkillManagementGloballyActivated()) {
 
12091        if (self::$isSkillManagementGloballyActivated === 
null) {
 
12092            include_once 
'Services/Skill/classes/class.ilSkillManagementSettings.php';
 
12095            self::$isSkillManagementGloballyActivated = $skmgSet->isActivated();
 
12163        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
12169        $activeId = $testOBJ->getActiveIdOfUser($userId);
 
12171        require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
12174        require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
12177        $testSession = $testSessionFactory->getSession($activeId);
 
12182        if ($a_force_new_run) {
 
12197        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
12204        $activeId = $testOBJ->getActiveIdOfUser($userId);
 
12206        require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
12209        $testSessionFactory->reset();
 
12211        require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
12214        $testSession = $testSessionFactory->getSession($activeId);
 
12237    public function adjustTestSequence()
 
12246                        SELECT COUNT(test_question_id) cnt 
12247                        FROM tst_test_question 
12254        $row = 
$ilDB->fetchAssoc($questRes);
 
12255        $questCount = $row[
'cnt'];
 
12260                                FROM tst_active tac 
12261                                INNER JOIN tst_sequence tseq 
12262                                        ON tseq.active_fi = tac.active_id 
12263                                WHERE tac.test_fi = %s 
12266            $partRes = 
$ilDB->queryF(
 
12272            while ($row = 
$ilDB->fetchAssoc($partRes)) {
 
12273                $sequence = @unserialize($row[
'sequence']);
 
12276                    $sequence = array();
 
12279                $sequence = array_filter($sequence, 
function ($value) use ($questCount) {
 
12280                    return $value <= $questCount;
 
12283                $num_seq = count($sequence);
 
12284                if ($questCount > $num_seq) {
 
12285                    $diff = $questCount - $num_seq;
 
12286                    for (
$i = 1; 
$i <= $diff; 
$i++) {
 
12287                        $sequence[$num_seq + 
$i - 1] = $num_seq + 
$i;
 
12291                $new_sequence = serialize($sequence);
 
12293                $ilDB->update(
'tst_sequence', array(
 
12294                    'sequence' => array(
'clob', $new_sequence)
 
12296                    'active_fi' => array(
'integer', $row[
'active_fi']),
 
12297                    'pass' => array(
'integer', $row[
'pass'])
 
12301            $new_sequence = serialize($questCount > 0 ? range(1, $questCount) : array());
 
12305                                FROM tst_active tac 
12306                                INNER JOIN tst_sequence tseq 
12307                                        ON tseq.active_fi = tac.active_id 
12308                                WHERE tac.test_fi = %s 
12311            $part_rest = 
$ilDB->queryF(
 
12317            while ($row = 
$ilDB->fetchAssoc($part_rest)) {
 
12318                $ilDB->update(
'tst_sequence', array(
 
12319                    'sequence' => array(
'clob', $new_sequence)
 
12321                    'active_fi' => array(
'integer', $row[
'active_fi']),
 
12322                    'pass' => array(
'integer', $row[
'pass'])
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
A class defining mark schemas for assessment test objects.
An exception for terminatinating execution or to throw for unit testing.
static getFeedbackClassNameByQuestionType($questionType)
static _getOriginalId($question_id)
Returns the original id of a question.
static sumTimesInISO8601FormatH_i_s_Extended($time1, $time2)
static _getSolutionMaxPass($question_id, $active_id)
Returns the maximum pass a users question solution.
static _updateTestResultCache($active_id, ilAssQuestionProcessLocker $processLocker=null)
@TODO Move this to a proper place.
static _getSuggestedSolutionOutput($question_id)
Returns the output of the suggested solution.
static getGuiClassNameByQuestionType($questionType)
static _isWorkedThrough($active_id, $question_id, $pass=null)
Returns true if the question was worked through in the given pass Worked through means that the user ...
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
static _getQuestionTitle($question_id)
Returns the question title of a question with a given id.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static deleteRequestsByActiveIds($activeIds)
Deletes all hint requests relating to a testactive included in given active ids.
static completeMissingPluginName($questionTypeData)
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
TableGUI class for evaluation of all users.
Base class for ILIAS Exception handling.
static recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
static _getInstanceByType(string $type)
Factory method for creating purifier instances.
static deleteNewsOfContext( $a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id=0, $a_context_sub_obj_type="")
Delete all news of a context.
static getFirstNewsIdForContext( $a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id="", $a_context_sub_obj_type="")
Get first new id of news set related to a certain context.
static _addLog($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=false, $test_ref_id=null)
Add an assessment log entry.
static _getLogLanguage()
retrieve the log language for assessment logging
static _getManualScoring()
Retrieve the manual scoring settings.
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
static _getAvailableQuestionpools($use_object_id=false, $equal_points=false, $could_be_offline=false, $showPath=false, $with_questioncount=false, $permission="read", $usr_id="")
Returns the available question pools for the active user.
static _getParticipantData($active_id)
Retrieves a participant name from active id.
static _isPassed($user_id, $a_obj_id)
Returns TRUE if the user with the user id $user_id passed the test with the object id $a_obj_id.
static getPoolQuestionChangeListener(ilDBInterface $db, $poolObjId)
static _getECTSGrade($points_passed, $reached_points, $max_points, $a, $b, $c, $d, $e, $fx)
{Returns the ECTS grade for a number of reached points.string The ECTS grade short description}
setHighscorePercentage($a_percentage)
Sets if the percentages of the scores pass should be shown.
getResetProcessingTime()
Returns wheather the processing time should be reset or not.
_buildName($is_anonymous, $user_id, $firstname, $lastname, $title)
Builds a user name for the output depending on test type and existence of the user.
getActivationEndingTime()
static _getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
setPrintBestSolutionWithResult($status)
setAnswerFeedback($answer_feedback=0)
Sets the generic feedback for the test @deprecate Use setGenericAnswerFeedback instead.
__construct($a_id=0, $a_call_by_reference=true)
Constructor.
setIntroduction($introduction="")
Sets the introduction text of the ilObjTest object.
exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog)
export page objects to xml (see ilias_co.dtd)
static _getObjectIDFromActiveID($active_id)
Returns the ILIAS test object id for a given active id.
getProcessingTimeAsMinutes()
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
getEstimatedWorkingTime()
Returns the estimated working time for the test calculated from the working time of the contained que...
setShowInfo($a_info=1)
Set whether the complete information page is shown or the required data only.
const QUESTION_SET_TYPE_DYNAMIC
type setting value for dynamic question set (continues testing mode)
getTestId()
Gets the database id of the additional test data.
getECTSOutput()
{int|bool}
& createQuestionGUI($question_type, $question_id=-1)
Creates a question GUI instance of a given question type.
$followupQuestionAnswerFixationEnabled
endingTimeReached()
Returns true if the ending time of a test is reached An ending time is not available for self assessm...
setClientIP($user_id, $client_ip)
setAllowedUsersTimeGap($a_allowed_users_time_gap)
getQuestionSetType()
getter for question set type
insertManualFeedback($active_id, $question_id, $pass, $feedback, $finalized, $feedback_old)
Inserts a manual feedback into the DB.
setTestId($a_id)
Sets the test ID.
getShowKioskModeParticipant()
Returns the status of the kiosk mode participant.
setKiosk($kiosk=0)
Sets the kiosk mode for the test.
getQuestionTitle($title, $nr=null)
Returns the title of a test question and checks if the title output is allowed.
canShowEctsGrades()
{boolean}
getHighscoreWTime()
Gets if the column with the workingtime should be shown.
getHighscoreOwnTable()
Gets if the own rankings table should be shown.
getAnsweredQuestionCount($active_id, $pass=null)
Retrieves the number of answered questions for a given user in a given test.
getShowKioskModeTitle()
Returns the status of the kiosk mode title.
hasRandomQuestionsForPass($active_id, $pass)
Checkes wheather a random test has already created questions for a given pass or not.
getHighscoreTopTable()
Gets, if the top-rankings table should be shown.
getCountSystem()
Gets the count system for the calculation of points.
isShowExamIdInTestPassEnabled()
setPostponingEnabled($postponingEnabled)
setInstantFeedbackSolution($instant_feedback=0)
Sets the instant feedback for the solution.
canShowSolutionPrintview($user_id=null)
Calculates if a user may see the solution printview of his/her test results.
getEnableProcessingTime()
Returns the state of the processing time (enabled/disabled)
setShowKioskModeParticipant($a_participant=false)
Set to true, if the participant's name should be shown in kiosk mode.
getListOfQuestionsStart()
Returns if the list of questions should be presented as the first page of the test.
& getExistingQuestions($pass=null)
Get the id's of the questions which are already part of the test.
getActiveParticipantList()
static _getTestIDFromObjectID($object_id)
Returns the ILIAS test id for a given object id.
loadFromDb()
Loads a ilObjTest object from a database.
pcArrayShuffle($array)
Shuffles the values of a given array.
_getTitleOutput($active_id)
Returns the value of the title_output status.
isAnyInstantFeedbackOptionEnabled()
$char_selector_availability
isComplete(ilTestQuestionSetConfig $testQuestionSetConfig)
Returns true, if a test is complete for use and can be set online.
canShowTestResults(ilTestSession $testSession)
getInstantFeedbackSolution()
Returns 1 if the correct solution will be shown after answering a question.
setFinalStatement($a_statement="")
Sets the final statement text of the ilObjTest object.
setFixedParticipants($a_value=1)
Sets the fixed participants status.
getStartingTimeOfUser($active_id, $pass=null)
Returns the unix timestamp of the time a user started a test.
_getLastAccess($active_id)
getStartTestLabel($active_id)
Returns the "Start the Test" label for the Info page.
static _getTestDefaults($test_defaults_id)
setOnline($a_online=true)
& getParticipants()
Returns all persons who started the test.
setProcessingTime($processing_time="00:00:00")
Sets the processing time for the test.
setHighscoreAnon($a_anon)
Sets if the highscores should be anonymized.
getDetailedTestResults($participants)
returns all test results for all participants
setAllowedUsers($a_allowed_users)
isNrOfTriesReached($tries)
returns if number of tries are reached
reindexFixedQuestionOrdering()
static getTestObjIdsWithActiveForUserId($userId)
setKioskMode($a_kiosk=false)
Sets the kiosk mode for the test.
setTemplate($template_id)
setShowExamviewPdf($show_examview_pdf)
setShowSolutionSignature($a_signature=false)
Set to TRUE, if the signature field should be shown in the solution.
setShowExamIdInTestPassEnabled($show_exam_id_in_test_pass_enabled)
inviteUser($user_id, $client_ip="")
Invites a user to a test.
setScoreCutting($a_score_cutting=SCORE_CUT_QUESTION)
Sets the type of score cutting.
static _getCountSystem($active_id)
Gets the count system for the calculation of points.
evalTotalStartedAverageTime($activeIdsFilter=null)
Returns the average processing time for all started tests.
setFollowupQuestionAnswerFixationEnabled($followupQuestionAnswerFixationEnabled)
getQuestionCount()
Returns the number of questions in the test.
getQuestiontext($question_id)
Returns the question text for a given question.
setResultsPresentationOptionsByArray($options)
QTIMaterialToString($a_material)
Reads an QTI material tag an creates a text string.
& getTestDefaults($test_defaults_id)
Returns the test defaults for a given id.
const QUESTION_SET_TYPE_RANDOM
type setting value for random question set
saveAuthorToMetadata($a_author="")
Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be c...
setOldOnlineStatus($oldOnlineStatus)
processPrintoutput2FO($print_output)
Convert a print output to XSL-FO.
setPassDeletionAllowed($passDeletionAllowed)
setter for the test setting passDeletionAllowed
setHighscoreScore($a_score)
Sets if the actual score should be displayed.
const HIGHSCORE_SHOW_ALL_TABLES
sendSimpleNotification($active_id)
getXMLZip()
Get zipped xml file for test.
getShowSolutionListComparison()
static lookupExamId($active_id, $pass)
createExportDirectory()
creates data directory for export files (data_dir/tst_data/tst_<id>/export, depending on data directo...
setShowGradingStatusEnabled($showGradingStatusEnabled)
static _getActiveIdOfUser($user_id="", $test_id="")
Gets the active id of the tst_active table for the active user.
isPreviousSolutionReuseEnabled($activeId)
getFixedParticipants()
Returns the fixed participants status.
isBestSolutionPrintedWithResult()
_lookupRandomTestFromActiveId($active_id)
Returns the random status of a test with a given object id.
setPassword($a_password=null)
Sets the password for test access.
setShowSolutionDetails($a_details=1)
Sets if the the solution details should be presented to the user or not.
& createTestSequence($active_id, $pass, $shuffle)
$show_exam_id_in_test_results_enabled
getFinalStatement()
Gets the final statement.
getProcessingTimeAsArray()
Returns the processing time for the test.
questionMoveDown($question_id)
Moves a question down in order.
setShowFinalStatement($show=0)
Sets whether the final statement should be shown or not.
logAction($logtext="", $question_id="")
Logs an action into the Test&Assessment log.
createMetaData()
Create meta data entry.
getEvaluationAdditionalFields()
Gets additional user fields that should be shown in the user evaluation.
setEndingTimeEnabled($ending_time_enabled)
loadQuestions($active_id="", $pass=null)
Load the test question id's from the database.
& getCompleteEvaluationData($withStatistics=true, $filterby="", $filtertext="")
setShowPassDetails($a_details=1)
Sets if the pass details should be shown when a test is not finished.
insertQuestion(ilTestQuestionSetConfig $testQuestionSetConfig, $question_id, $linkOnly=false)
Insert a question in the list of questions.
buildName($user_id, $firstname, $lastname, $title)
Builds a user name for the output depending on test type and existence of the user.
setRedirectionUrl($redirection_url=null)
hasQuestionsWithoutQuestionpool()
$print_best_solution_with_result
setCountSystem($a_count_system=COUNT_PARTIAL_SOLUTIONS)
Sets the count system for the calculation of points.
buildIso8601PeriodFromUnixtimeForExportCompatibility($unix_timestamp)
$instantFeedbackAnswerFixationEnabled
static _getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
removeQuestionFromSequences($questionId, $activeIds, ilTestReindexedSequencePositionMap $reindexedSequencePositionMap)
getImagePath()
Returns the image path for web accessable images of a test The image path is under the CLIENT_WEB_DIR...
getShowSolutionSignature()
Returns if the signature field should be shown in the test results.
getHighscoreAnon()
Gets if the highscores should be anonymized per setting.
exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export media objects to xml (see ilias_co.dtd)
getPassScoring()
Gets the pass scoring type.
setInstantFeedbackAnswerFixationEnabled($instantFeedbackAnswerFixationEnabled)
setHighscoreHints($a_hints)
Sets if the number of requested hints should be shown.
getPassword()
Returns the password for test access.
isShowGradingStatusEnabled()
setPasswordEnabled($passwordEnabled)
setPassScoring($a_pass_scoring=SCORE_LAST_PASS)
Sets the pass scoring.
isHighscoreAnon()
Gets if the highscores should be displayed anonymized.
setOfferingQuestionHintsEnabled($offeringQuestionHintsEnabled)
sets offering question hints enabled/disabled
getFixedQuestionSetTotalWorkingTime()
getShowSolutionAnswersOnly()
Returns if the full solution (including ILIAS content) should be presented to the solution or not.
setShowSolutionPrintview($a_printview=1)
Sets if the the solution printview should be presented to the user or not.
& evalTotalPersonsArray($name_sort_order="asc")
Returns all persons who started the test.
& evalStatistical($active_id)
Returns the statistical evaluation of the test for a specified user.
isExecutable($testSession, $user_id, $allowPassIncrease=false)
Checks if the test is executable by the given user.
const SCORE_REPORTING_IMMIDIATLY
& getTestParticipants()
Returns a list of all participants in a test.
getStartingTime()
Returns the starting time of the test.
canEditEctsGrades()
{boolean}
startingTimeReached()
Returns true if the starting time of a test is reached A starting time is not available for self asse...
saveManualFeedback($active_id, $question_id, $pass, $feedback, $finalized=false, $is_single_feedback=false)
Saves the manual feedback for a question in a test.
setListOfQuestions($a_value=true)
Sets if the the list of questions should be presented to the user or not.
& getTotalPointsPassedArray()
Returns an array with the total points of all users who passed the test This array could be used for ...
getShowPassDetails()
Returns if the pass details should be shown when a test is not finished.
getQuestionSetTypeTranslation(ilLanguage $lng, $questionSetType)
& evalResultsOverview()
Creates an associated array with the results of all participants of a test.
getResultsPresentation()
Returns the combined results presentation value.
$show_exam_id_in_test_pass_enabled
static _lookupAuthor($obj_id)
Gets the authors name of the ilObjTest object.
saveCompleteStatus(ilTestQuestionSetConfig $testQuestionSetConfig)
Checks if the test is complete and saves the status in the database.
getKioskMode()
Returns the kiosk mode.
getSequenceSettings()
SEQUENCE SETTING = POSTPONING ENABLED !!
static allObligationsAnswered($test_id, $active_id, $pass)
checks wether all questions marked as obligatory were answered within the test pass with given testId...
getShowSolutionFeedback()
Returns if the feedback should be presented to the solution or not.
static _getPassScoring($active_id)
Gets the pass scoring type.
setHighscoreTopNum($a_top_num)
Sets the number of entries which are to be shown in the top-rankings table.
getTimeExtensionsOfParticipants()
static getSingleManualFeedback($active_id, $question_id, $pass)
Retrieves the manual feedback for a question in a test.
getActivationStartingTime()
static _getQuestionCountAndPointsForPassOfParticipant($active_id, $pass)
const QUESTION_SET_TYPE_FIXED
type setting value for fixed question set
setHighscoreEnabled($a_enabled)
Sets if the highscore feature should be enabled.
duplicateQuestionForTest($question_id)
Takes a question and creates a copy of the question for use in the test.
setRedirectionMode($redirection_mode=0)
$showGradingStatusEnabled
hasSingleChoiceQuestions()
Returns TRUE if the test contains single choice results.
setMailNotification($a_notification)
Set mail notification settings.
isActiveTestSubmitted($user_id=null)
returns if the active for user_id has been submitted
setQuestionSetType($questionSetType)
setter for question set type
setReportingDate($reporting_date)
Sets the reporting date of the ilObjTest object.
static lookupQuestionSetType($objId)
lookup-er for question set type
moveQuestionAfterOLD($previous_question_id, $new_question_id)
setCharSelectorDefinition($definition='')
getKiosk()
Returns the kiosk mode.
getResultsForActiveId($active_id)
getShowSolutionDetails()
Returns if the solution details should be presented to the user or not.
setAuthor($author="")
Sets the authors name of the ilObjTest object.
setQuestionOrderAndObligations($orders, $obligations)
isTestQuestion($questionId)
$activation_starting_time
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
getAuthor()
Gets the authors name of the ilObjTest object.
$forceInstantFeedbackEnabled
getAnswerFeedbackPoints()
Returns 1 if answer specific feedback as reached points is activated.
randomSelectQuestions($nr_of_questions, $questionpool, $use_obj_id=0, $qpls="", $pass=null)
Returns a random selection of questions.
setIntroductionEnabled($introductionEnabled)
getProcessingTimeInSeconds($active_id="")
Returns the processing time for the test in seconds.
getFixedQuestionSetTotalPoints()
static lookupLastTestPassAccess($activeId, $passIndex)
inviteGroup($group_id)
Invites all users of a group to a test.
getScoreCutting()
Determines if the score of a question should be cut at 0 points or the score of the whole test.
getShowSolutionSuggested()
read()
read object data from db into object
getHighscorePercentage()
Gets if the percentage column should be shown.
const SCORE_REPORTING_FINISHED
addDefaults($a_name)
Adds the defaults of this test to the test defaults.
getCustomStyles()
Return the available custom styles.
setCertificateVisibility($a_value)
Sets the visibility settings of the certificate.
prepareTextareaOutput($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output in tests.
setListOfQuestionsEnd($a_value=true)
Sets if the the list of questions as the end page of the test.
getTestParticipantsForManualScoring($filter=null)
static _getMCScoring($active_id)
Gets the scoring type for multiple choice questions.
getHtmlQuestionContentPurifier()
setResetProcessingTime($reset=0)
Sets wheather the processing time should be reset or not.
const SCORE_REPORTING_AFTER_PASSED
moveQuestions($move_questions, $target_index, $insert_mode)
Move questions to another position.
static _getObjectIDFromTestID($test_id)
Returns the ILIAS test object id for a given test id.
setListOfQuestionsSettings($a_value=0)
Sets the settings for the list of questions options in the test properties This could contain one of ...
isSkillServiceToBeConsidered()
sendAdvancedNotification($active_id)
modifyExportIdentifier($a_tag, $a_param, $a_value)
Returns the installation id for a given identifier.
updateWorkingTime($times_id)
Update the working time of a test when a question is answered.
setActivationStartingTime($starting_time=null)
static isSkillManagementGloballyActivated()
getHighscoreHints()
Gets, if the column with the number of requested hints should be shown.
buildStatisticsAccessFilteredParticipantList()
getMCScoring()
Gets the scoring type for multiple choice questions.
getGenericAnswerFeedback()
Returns 1 if generic answer feedback is to be shown.
setObligationsEnabled($obligationsEnabled=true)
sets obligations enabled/disabled
setSkillServiceEnabled($skillServiceEnabled)
fromXML(ilQTIAssessment $assessment)
Receives parameters from a QTI parser and creates a valid ILIAS test object.
setHighscoreTopTable($a_top_table)
Sets if the top-rankings table should be shown.
static _setImportDirectory($a_import_dir=null)
set import directory
static _getMaxPass($active_id)
Retrieves the maximum pass of a given user for a given test in which the user answered at least one q...
isRandomTest()
Returns the fact wether this test is a random questions test or not.
getQuestionType($question_id)
Returns the question type of a question with a given id.
getShowSolutionPrintview()
Returns if the solution printview should be presented to the user or not.
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
static _getImportDirectory()
Get the import directory location of the test.
getShowInfo()
Gets whether the complete information page is shown or the required data only.
setActivationVisibility($a_value)
setQuestionSetSolved($value, $question_id, $user_id)
sets question solved state to value for given user_id
isFixedTest()
Returns the fact wether this test is a fixed question set test or not.
getMarkSchema()
{ASS_MarkSchema}
& _getCompleteWorkingTimeOfParticipants($test_id)
Returns the complete working time in seconds for all test participants.
deleteTest()
Deletes the test and all related objects, files and database entries.
deleteDefaults($test_default_id)
Deletes the defaults for a test.
getListOfQuestionsEnd()
Returns if the list of questions should be presented as the last page of the test.
getHighscoreEnabled()
Gets the setting which determines if the highscore feature is enabled.
getReportingDate()
Gets the reporting date of the ilObjTest object.
setForceJS($a_js=1)
Set whether JavaScript should be forced for tests.
isTestFinished($active_id)
returns if the active for user_id has been submitted
static _getBestPass($active_id)
Retrieves the best pass of a given user for a given test.
static _lookupRandomTest($a_obj_id)
Returns the fact wether the test with passed obj id is a random questions test or not.
const HIGHSCORE_SHOW_OWN_TABLE
setShowSolutionListComparison($a_comparison=false)
Set to TRUE, if the list of answers should be shown prior to finish the test.
getQuestionDataset($question_id)
Returns the dataset for a given question id.
getCharSelectorDefinition()
& getTestResult($active_id, $pass=null, $ordered_sequence=false, $considerHiddenQuestions=true, $considerOptionalQuestions=true)
Calculates the results of a test for a given user and returns an array with all test results.
getTitleOutput()
Returns the value of the title_output status.
getAggregatedResultsData()
Returns the aggregated test results.
isDynamicTest()
Returns the fact wether this test is a dynamic question set test or not.
setShowExamIdInTestResultsEnabled($show_exam_id_in_test_results_enabled)
checkQuestionParent($questionId)
setInstantFeedbackOptionsByArray($options)
getHighscoreAchievedTS()
Returns if date and time of the scores achievement should be displayed.
setActivationEndingTime($ending_time=null)
static getCompleteManualFeedback(int $question_id)
Retrieves the manual feedback for a question in a test.
& getQuestionTitlesAndIndexes()
Returns the titles of the test questions in question sequence.
getAllTestResults($participants, $prepareForCSV=true)
returns all test results for all participants
getListOfQuestions()
Returns if the list of questions should be presented to the user or not.
saveToDb($properties_only=false)
Saves a ilObjTest object to a database.
isMaxProcessingTimeReached($starting_time, $active_id)
Returns whether the maximum processing time for a test is reached or not.
isHTML($a_text)
Checks if a given string contains HTML or not.
moveQuestionAfter($question_to_move, $question_before)
logManualFeedback($active_id, $question_id, $feedback)
Creates a log for the manual feedback.
saveQuestionsToDb()
Saves the test questions to the database.
setShuffleQuestions($a_shuffle)
Sets the status of the shuffle_questions variable.
getUsePreviousAnswers()
Returns if the previous answers should be shown for a learner.
& getWorkedQuestions($active_id, $pass=null)
Gets the id's of all questions a user already worked through.
$char_selector_definition
setForceInstantFeedbackEnabled($forceInstantFeedbackEnabled)
getAvailableQuestions($arrFilter, $completeonly=0)
Calculates the available questions for a test.
getListOfQuestionsSettings()
Returns the settings for the list of questions options in the test properties This could contain one ...
removeTestResultsByActiveIds($activeIds)
getCharSelectorAvailability()
startWorkingTime($active_id, $pass)
Write the initial entry for the tests working time to the database.
isFollowupQuestionAnswerFixationEnabled()
getHighscoreTopNum($a_retval=10)
Gets the number of entries which are to be shown in the top-rankings table.
setBlockPassesAfterPassedEnabled($blockPassesAfterPassedEnabled)
setSpecificAnswerFeedback($specific_answer_feedback)
& processCSVRow($row, $quoteAll=false, $separator=";")
Processes an array as a CSV row and converts the array values to correct CSV values.
setMailNotificationType($a_type)
setTitleOutput($title_output=0)
Sets the status of the title output.
isOfferingQuestionHintsEnabled()
returns the fact wether offering hints is enabled or not
getCompleteWorkingTime($user_id)
Returns the complete working time in seconds a user worked on the test.
static buildExamId($active_id, $pass, $test_obj_id=null)
& getQuestionsOfTest($active_id)
Retrieves all the assigned questions for all test passes of a test participant.
getMailNotificationType()
setPassWaiting($pass_waiting)
removeQuestions($removeQuestionIds)
getForceJS()
Gets whether JavaScript should be forced for tests.
removeTestResults(ilTestParticipantData $participantData)
applyDefaults($test_defaults)
Applies given test defaults to this test.
disinviteUser($user_id)
Disinvites a user from a test.
setAnswerFeedbackPoints($answer_feedback_points=0)
Sets the answer specific feedback of reached points for the test.
getExportDirectory()
Get the location of the export directory for the test.
getInstantFeedbackOptionsAsArray()
setStartingTimeEnabled($starting_time_enabled)
setECTSGrades(array $a_ects_grades)
{}
static lookupQuestionSetTypeByActiveId($active_id)
returns the question set type of test relating to passed active id
& getQuestionsOfPass($active_id, $pass)
Retrieves all the assigned questions for a test participant in a given test pass.
deliverPDFfromHTML($content, $title=null)
Delivers a PDF file from XHTML.
getImagePathWeb()
Returns the web image path for web accessable images of a test The image path is under the web access...
static _getWorkingTimeOfParticipantForPass($active_id, $pass)
Returns the complete working time in seconds for a test participant.
static isQuestionObligationPossible($questionId)
checks wether the obligation for question with given id is possible or not
setActivationLimited($a_value)
_isComplete($obj_id)
Returns true, if a test is complete for use.
isShowExamIdInTestResultsEnabled()
areObligationsEnabled()
returns the fact wether obligations are enabled or not
const DEFAULT_PROCESSING_TIME_MINUTES
static _createImportDirectory()
creates data directory for import files (data_dir/tst_data/tst_<id>/import, depending on data directo...
create()
create test object
setShowSolutionSuggested($a_solution=false)
Set to TRUE, if the suggested solution should be shown in the solution.
getEndingTime()
Returns the ending time of the test.
static _getAvailableTests($use_object_id=false)
Returns the available tests for the active user.
setShowKioskModeTitle($a_title=false)
Set to true, if the full test title should be shown in kiosk mode.
setHighscoreOwnTable($a_own_table)
Sets if the table with the own ranking should be shown.
saveCertificateVisibility($a_value)
Saves the visibility settings of the certificate.
setShowGradingMarkEnabled($showGradingMarkEnabled)
getCompleteWorkingTimeOfParticipant($active_id)
Returns the complete working time in seconds for a test participant.
setStartingTime($starting_time=null)
Sets the starting time in database timestamp format for the test.
evalTotalPersons()
Returns the number of persons who started the test.
setEnableExamview($enable_examview)
static $isSkillManagementGloballyActivated
getScoreReporting()
Gets the score reporting of the ilObjTest object.
getMailNotification()
Get mail notification settings.
setSignSubmission($sign_submission)
setEnableArchiving($enable_archiving)
& _evalResultsOverview($test_id)
Creates an associated array with the results of all participants of a test.
setResultFilterTaxIds($resultFilterTaxIds)
$blockPassesAfterPassedEnabled
isInstantFeedbackAnswerFixationEnabled()
& getQuestionTitles()
Returns the titles of the test questions in question sequence.
getAllRTEContent()
Returns the content of all RTE enabled text areas in the test.
_getVisitTimeOfParticipant($test_id, $active_id)
Returns the first and last visit of a participant.
getSpecificAnswerFeedback()
getExportSettingsSingleChoiceShort()
setShowCancel($a_value=1)
Sets the cancel test button status.
getMarkSchemaForeignId()
{int}
addQTIMaterial(&$a_xml_writer, $a_material)
Creates a QTI material tag from a plain text or xhtml text.
& getAllQuestions($pass=null)
Returns all questions of a test in test order.
static _getUserIdFromActiveId($active_id)
isPluginActive($a_pname)
Checks wheather or not a question plugin with a given name is active.
& evalTotalParticipantsArray($name_sort_order="asc")
Returns all participants who started the test.
setShowSolutionAnswersOnly($a_full=true)
Set to true, if the full solution (including the ILIAS content pages) should be shown in the solution...
setAutosaveIval($autosave_ival)
getAnonymity()
Returns the anonymity status of the test.
deliverPDFfromFO($fo, $title=null)
Delivers a PDF file from a XSL-FO string.
static hasObligations($test_id)
returns the fact wether the test with given test id contains questions markes as obligatory or not
setTestFinalBroken($testFinalBroken)
setResultsPresentation($a_results_presentation=3)
Sets the combined results presentation value.
removeQuestion($question_id)
Removes a question from the test object.
setLimitUsersEnabled($limitUsersEnabled)
toXML()
Returns a QTI xml representation of the test.
static lookupPassResultsUpdateTimestamp($active_id, $pass)
hasAnyTestResult(ilTestSession $testSession)
isSingleChoiceTest()
Returns TRUE if the test contains single choice results only.
& evalResultsOverviewOfParticipant($active_id)
Creates an associated array with the results for a given participant of a test.
getShowCancel()
Returns wheather the cancel test button is shown or not.
getCertificateVisibility()
Returns the visibility settings of the certificate.
getInvitedParticipantList()
setHighscoreWTime($a_wtime)
Sets if the workingtime of the scores should be shown.
setNrOfTries($nr_of_tries=0)
Sets the nr of tries for the test.
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.
isBlockPassesAfterPassedEnabled()
setECTSOutput($a_ects_output)
{}
& getInvitedUsers($user_id="", $order="login, lastname, firstname")
Returns a list of all invited users in a test.
setProcessingTimeByMinutes($minutes)
removeTestResultsFromSoapLpAdministration($userIds)
static _lookupFinishedUserTests($a_user_id)
Gather all finished tests for user.
static _getScoreCutting($active_id)
Determines if the score of a question should be cut at 0 points or the score of the whole test.
setListOfQuestionsStart($a_value=true)
Sets if the the list of questions as the start page of the test.
setHighscoreAchievedTS($a_achieved_ts)
Sets if the date and time of the scores achievement should be displayed.
removeTestActives($activeIds)
getShowMarker()
Returns wheather the marker button is shown or not.
getImportMapping()
get array of (two) new created questions for import id
isSingleChoiceTestWithoutShuffle()
Returns TRUE if the test contains single choice results and no shuffle only.
setCharSelectorAvailability($availability)
setAnonymity($a_value=0)
Sets the anonymity status of the test.
checkMaximumAllowedUsers()
getShuffleQuestions()
Returns the status of the shuffle_questions variable.
setExportSettingsSingleChoiceShort($a_settings)
removeTestResultsByUserIds($userIds)
& getUserData($ids)
Returns a data of all users specified by id list.
isNewRandomTest()
Checks wheather the test is a new random test (using tst_rnd_cpy) or an old one.
getListOfQuestionsDescription()
Returns TRUE if the list of questions should be presented with the question descriptions.
getECTSGrade($passed_array, $reached_points, $max_points)
{Returns the ECTS grade for a number of reached points.string The ECTS grade short description}
getActiveIdOfUser($user_id="", $anonymous_id="")
Gets the active id of a given user.
$accessFilteredParticipantList
getCustomStyle()
Get the custom style.
checkMarks()
{boolean|string True or an error string which can be used for display purposes}
setShowSolutionFeedback($a_feedback=true)
Sets if the the feedback should be presented to the user in the solution or not.
recalculateScores($preserve_manscoring=false)
setEnabledViewMode($mode)
static isParticipantsLastPassActive($testRefId, $userId)
getSecondsUntilEndingTime()
Returns the seconds left from the actual time until the ending time.
isPassDeletionAllowed()
getter for the test setting passDeletionAllowed
getNrOfTries()
Returns the nr of tries for the test.
setShowExamviewHtml($show_examview_html)
const SCORE_REPORTING_DATE
setMCScoring($a_mc_scoring=SCORE_ZERO_POINTS_WHEN_UNANSWERED)
Sets the multiple choice scoring.
$offeringQuestionHintsEnabled
static _getSolvedQuestions($active_id, $question_fi=null)
get solved questions
static _lookupAnonymity($a_obj_id)
Returns the anonymity status of a test with a given object id.
setEnableProcessingTime($enable=0)
Sets the processing time enabled or disabled.
getActivationVisibility()
setUsePreviousAnswers($use_previous_answers=1)
Sets the status of the visibility of previous learner answers.
& getAvailableQuestionpools($use_object_id=false, $equal_points=false, $could_be_offline=false, $show_path=false, $with_questioncount=false, $permission="read")
Returns the available question pools for the active user.
setGenericAnswerFeedback($generic_answer_feedback=0)
Sets if the generic feedback is to be shown in the test.
static getManualFeedback($active_id, $question_id, $pass)
Retrieves the feedback comment for a question in a test if it is finalized.
inviteRole($role_id)
Invites all users of a role to a test.
getJavaScriptOutput()
Returns if Javascript should be chosen for drag & drop actions for the active user.
setListOfQuestionsDescription($a_value=true)
Sets the show_summary attribute to TRUE if the list of questions should be presented with the questio...
static isQuestionObligatory($question_id)
checks wether the question with given id is marked as obligatory or not
update()
update object data
canShowCertificate($testSession, $user_id, $active_id)
Checks whether the certificate button could be shown on the info page or not.
getTextAnswer($active_id, $question_id, $pass=null)
Returns the text answer of a given user for a given question.
userLookupFullName($user_id, $overwrite_anonymity=false, $sorted_order=false, $suffix="")
Returns the full name of a test user according to the anonymity status.
getNrOfResultsForPass($active_id, $pass)
Calculates the number of user results for a specific test pass.
isShowGradingMarkEnabled()
setExportSettings($a_settings)
setEndingTime($ending_time=null)
Sets the ending time in database timestamp format for the test.
getStartingTimeOfParticipants()
Note, this function should only be used if absolutely necessary, since it perform joins on tables tha...
addExtraTime($active_id, $minutes)
getAccessFilteredParticipantList()
static getPoolQuestionChangeListeners(ilDBInterface $db, $poolObjId)
cleanupMediaobjectUsage()
Cleans up the media objects for all text fields in a test which are using an RTE field.
setScoreReporting($score_reporting=0)
Sets the score reporting of the ilObjTest object.
isTestFinishedToViewResults($active_id, $currentpass)
Returns true if an active user completed a test pass and did not start a new pass.
static ensureParticipantsLastActivePassFinished($testObjId, $userId, $a_force_new_run=false)
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
hasNrOfTriesRestriction()
returns if the numbers of tries have to be checked
static _lookupTestObjIdForQuestionId($a_q_id)
Get test Object ID for question ID.
setCustomStyle($a_customStyle=null)
Set the custom style.
const SCORE_REPORTING_DISABLED
setTmpCopyWizardCopyId($tmpCopyWizardCopyId)
getVisitTimeOfParticipant($active_id)
Returns the first and last visit of a participant.
setAccessFilteredParticipantList($accessFilteredParticipantList)
getTitleFilenameCompliant()
returns the object title prepared to be used as a filename
getShowFinalStatement()
Returns whether the final statement should be shown or not.
questionMoveUp($question_id)
Moves a question up in order.
getProcessingTime()
Returns the processing time for the test.
setSequenceSettings($sequence_settings=0)
SEQUENCE SETTING = POSTPONING ENABLED !!
isForceInstantFeedbackEnabled()
& getCompleteWorkingTimeOfParticipants()
Returns the complete working time in seconds for all test participants.
getIntroduction()
Gets the introduction text of the ilObjTest object.
getAnswerFeedback()
Returns 1 if generic answer feedback is activated.
const HIGHSCORE_SHOW_TOP_TABLE
exportPagesXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export pages of test to xml (see ilias_co.dtd)
isScoreReportingEnabled()
setShowMarker($a_value=1)
Sets the marker button status.
static _lookupName($a_user_id)
lookup user name
static _lookupClientIP($a_user_id)
Lookup client ip.
Class ilObjectActivation.
const TIMINGS_DEACTIVATED
setTimingType($a_type)
Set timing type.
static getItem($a_ref_id)
Get item data.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static getInstance($a_obj_id)
Class ilObject Basic functions for all objects.
getType()
get object type @access public
getOwner()
get object owner
static _lookupObjId($a_id)
setOfflineStatus($a_status)
Set offline status.
static _lookupTitle($a_id)
lookup object title
setTitle($a_title)
set object title
deleteMetaData()
delete meta data entry
static _lookupDescription($a_id)
lookup object description
updateMetaData()
update meta data entry
setDescription($a_desc)
set object description
getOfflineStatus()
Get offline status.
getRefId()
get reference id @access public
getDescription()
get object description
cloneMetaData($target_obj)
Copy meta data.
getId()
get object id @access public
static _prepareCloneSelection($a_ref_ids, $new_type, $show_path=true)
Prepare copy wizard object selection.
static _lookupOwner($a_id)
lookup object owner
getTitle()
get object title @access public
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
static getPluginObject(string $a_ctype, string $a_cname, string $a_slot_id, string $a_pname)
getPresentationMaterial()
{ilQTIPresentationMaterial|null}
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
Replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
static _cleanupMediaObjectUsage($a_text, $a_usage_type, $a_usage_id)
Synchronises appearances of media objects in $a_text with media object usage table.
static factory($a_package, $a_timeout=0)
Creates an ilRpcClient instance to our ilServer.
Skill management settings.
special template class to simplify handling of ITX/PEAR
Base Exception for all Exceptions relating to Modules/Test.
Class ilTestMailNotification.
static getManageParticipantsUserFilter($refId)
static getAccessStatisticsUserFilter($refId)
isQuestionSetConfigured()
static isManScoringDone($activeId)
reads the flag wether manscoring is done for the given test active or not from the global settings (s...
static getDataDir()
get data directory (outside webspace)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static insertInstIntoID($a_value)
inserts installation id into ILIAS id
static prepareTextareaOutput($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free,...
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static _getObjectsByOperations($a_obj_type, $a_operation, $a_usr_id=0, $limit=0)
Get all objects of a specific type and check access This function is not recursive,...
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static 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.
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
const SCORE_ZERO_POINTS_WHEN_UNANSWERED
const COUNT_PARTIAL_SOLUTIONS
const TEST_FIXED_SEQUENCE
Test constants.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$a
thx to https://mlocati.github.io/php-cs-fixer-configurator for the examples
redirection script todo: (a better solution should control the processing via a xml file)
foreach($_POST as $key=> $value) $res