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';
 
  596    public function __construct($a_id = 0, $a_call_by_reference = 
true)
 
  603        $lng->loadLanguageModule(
"assessment");
 
  605        include_once 
"./Modules/Test/classes/class.assMarkSchema.php";
 
  607        $this->mark_schema->createSimpleSchema(
 
  608            $lng->txt(
"failed_short"),
 
  609            $lng->txt(
"failed_official"),
 
  612            $lng->txt(
"passed_short"),
 
  613            $lng->txt(
"passed_official"),
 
  619        $this->author = 
$ilUser->fullname;
 
  620        $this->introductionEnabled = 
false;
 
  621        $this->introduction = 
"";
 
  622        $this->questions = array();
 
  625        $this->instant_verification = 0;
 
  626        $this->answer_feedback_points = 0;
 
  627        $this->reporting_date = 
"";
 
  628        $this->nr_of_tries = 0;
 
  630        $this->use_previous_answers = 1;
 
  631        $this->title_output = 0;
 
  632        $this->starting_time = 
"";
 
  633        $this->ending_time = 
"";
 
  634        $this->processing_time = 
"";
 
  635        $this->enable_processing_time = 
"0";
 
  636        $this->reset_processing_time = 0;
 
  637        $this->ects_output = 
false;
 
  638        $this->ects_fx = 
null;
 
  639        $this->shuffle_questions = 
false;
 
  640        $this->mailnottype = 0;
 
  641        $this->exportsettings = 0;
 
  642        $this->show_summary = 8;
 
  647        $this->answer_feedback = 0;
 
  648        $this->password = 
"";
 
  649        $this->certificate_visibility = 0;
 
  650        $this->allowedUsers = 
"";
 
  651        $this->_showfinalstatement = 
false;
 
  652        $this->_finalstatement = 
"";
 
  653        $this->_showinfo = 
true;
 
  654        $this->_forcejs = 
true;
 
  655        $this->_customStyle = 
"";
 
  656        $this->allowedUsersTimeGap = 
"";
 
  657        $this->anonymity = 0;
 
  658        $this->show_cancel = 0;
 
  659        $this->show_marker = 0;
 
  660        $this->fixed_participants = 0;
 
  665        $this->testSession = 
false;
 
  666        $this->testSequence = 
false;
 
  667        $this->mailnotification = 0;
 
  668        $this->poolUsage = 1;
 
  670        $this->ects_grades = array(
 
  678        $this->autosave = 
false;
 
  679        $this->autosave_ival = 30000;
 
  681        $this->enable_examview = 
false;
 
  682        $this->show_examview_html = 
false;
 
  683        $this->show_examview_pdf = 
false;
 
  684        $this->enable_archiving = 
false;
 
  686        $this->express_mode = 
false;
 
  687        $this->template_id = 
'';
 
  688        $this->redirection_mode = 0;
 
  689        $this->redirection_url = 
null;
 
  690        $this->show_exam_id_in_test_pass_enabled = 
false;
 
  691        $this->show_exam_id_in_test_results_enabled = 
false;
 
  692        $this->sign_submission = 
false;
 
  693        $this->char_selector_availability = 0;
 
  694        $this->char_selector_definition = 
null;
 
  696        $this->showGradingStatusEnabled = 
true;
 
  697        $this->showGradingMarkEnabled = 
true;
 
  699        $this->followupQuestionAnswerFixationEnabled = 
false;
 
  700        $this->instantFeedbackAnswerFixationEnabled = 
false;
 
  702        $this->testFinalBroken = 
false;
 
  704        $this->tmpCopyWizardCopyId = 
null;
 
  706        parent::__construct($a_id, $a_call_by_reference);
 
  716        require_once 
'Services/Utilities/classes/class.ilUtil.php';
 
  786    public function delete()
 
  789        if (!parent::delete()) {
 
  799        require_once 
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
 
  801        $qsaImportFails->deleteRegisteredImportFails();
 
  802        require_once 
'Modules/Test/classes/class.ilTestSkillLevelThresholdImportFails.php';
 
  804        $sltImportFails->deleteRegisteredImportFails();
 
  819        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
  822        require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
  824        $participantData->load($this->
getTestId());
 
  827        $affectedRows = 
$ilDB->manipulateF(
 
  828            "DELETE FROM tst_mark WHERE test_fi = %s",
 
  833        $affectedRows = 
$ilDB->manipulateF(
 
  834            "DELETE FROM tst_tests WHERE test_id = %s",
 
  839        require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
  841        $testQuestionSetConfigFactory->getQuestionSetConfig()->removeQuestionSetRelatedData();
 
  844        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  846        $directory = $tst_data_dir . 
"/tst_" . $this->
getId();
 
  847        if (is_dir($directory)) {
 
  848            include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  851        include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
  857        foreach (
$mobs as $mob) {
 
  873        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  876        if (!is_writable($tst_data_dir)) {
 
  877            $this->
ilias->raiseError(
"Test Data Directory (" . $tst_data_dir
 
  878                . 
") not writeable.", $this->
ilias->error_obj->MESSAGE);
 
  882        $tst_dir = $tst_data_dir . 
"/tst_" . $this->
getId();
 
  884        if (!@is_dir($tst_dir)) {
 
  885            $this->
ilias->raiseError(
"Creation of Test Directory failed.", $this->
ilias->error_obj->MESSAGE);
 
  888        $export_dir = $tst_dir . 
"/export";
 
  890        if (!@is_dir($export_dir)) {
 
  891            $this->
ilias->raiseError(
"Creation of Export Directory failed.", $this->
ilias->error_obj->MESSAGE);
 
  902        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  913    public function getExportFiles($dir)
 
  916        if (!@is_dir($dir) || !is_writeable($dir)) {
 
  921        foreach (
new DirectoryIterator($dir) as $file) {
 
  925            if ($file->isDir()) {
 
  929            $files[] = $file->getBasename();
 
  942        if (strlen($a_import_dir)) {
 
  943            $_SESSION[
"tst_import_dir"] = $a_import_dir;
 
  957        if (strlen(
$_SESSION[
"tst_import_dir"])) {
 
  976        $ilias = 
$DIC[
'ilias'];
 
  977        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  981        if (!is_writable($tst_data_dir)) {
 
  982            $ilias->raiseError(
"Test Data Directory (" . $tst_data_dir
 
  983                . 
") not writeable.", $ilias->error_obj->FATAL);
 
  987        $tst_dir = $tst_data_dir . 
"/tst_import";
 
  989        if (!@is_dir($tst_dir)) {
 
  990            $ilias->raiseError(
"Creation of test import directory failed.", $ilias->error_obj->FATAL);
 
 1011            "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",
 
 1017            if (strcmp(
$row[
'foundtypes'], 
'assSingleChoice') == 0) {
 
 1036            "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",
 
 1040        if (
$result->numRows() == 1) {
 
 1042            if (strcmp(
$row[
'foundtypes'], 
'assSingleChoice') == 0) {
 
 1068                                SELECT  DISTINCT(qpl_qst_sc.shuffle) foundshuffles 
 1074                                WHERE   tst_test_result.question_fi = qpl_questions.question_id 
 1075                                AND             qpl_questions.question_type_fi = qpl_qst_type.question_type_id 
 1076                                AND             tst_test_result.active_fi = tst_active.active_id 
 1077                                AND             qpl_questions.question_id = qpl_qst_sc.question_fi 
 1078                                AND             tst_active.test_fi = %s 
 1079                                AND             qpl_qst_type.type_tag = %s 
 1081            array(
'integer', 
'text'),
 
 1082            array($this->
getTestId(), 
'assSingleChoice')
 
 1084        if (
$result->numRows() == 1) {
 
 1086            return (
$row[
'foundshuffles'] == 0);
 
 1099        if (!count($this->mark_schema->mark_steps)) {
 
 1121        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 1124        $test->loadFromDb();
 
 1126        require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 1129        return $test->isComplete($testQuestionSetConfigFactory->getQuestionSetConfig());
 
 1145            if (!preg_match(
'/\d+/', $this->
getECTSFX())) {
 
 1152                                SET ects_output = %s, ects_a = %s, ects_b = %s, ects_c = %s, ects_d = %s, ects_e = %s, ects_fx = %s 
 1153                                WHERE test_id = %s",
 
 1154                array(
'text', 
'float', 
'float', 
'float', 
'float', 
'float', 
'float', 
'integer'),
 
 1157                    $grades[
'A'], $grades[
'B'], $grades[
'C'], $grades[
'D'], $grades[
'E'],
 
 1175        if ($this->
isComplete($testQuestionSetConfig)) {
 
 1180                "UPDATE tst_tests SET complete = %s WHERE test_id = %s",
 
 1181                array(
'text', 
'integer'),
 
 1182                array($complete, $this->test_id)
 
 1207        include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
 1208        $completecontent = 
"";
 
 1210            $completecontent .= $content;
 
 1229        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 1236        require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 1238        $testQuestionSetConfig = $testQuestionSetConfigFactory->getQuestionSetConfig();
 
 1240        include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1241        if ($this->test_id == -1) {
 
 1243            $next_id = 
$ilDB->nextId(
'tst_tests');
 
 1245            $ilDB->insert(
'tst_tests', array(
 
 1246                'test_id' => array(
'integer', $next_id),
 
 1247                'obj_fi' => array(
'integer', $this->
getId()),
 
 1248                'author' => array(
'text', $this->
getAuthor()),
 
 1252                'showinfo' => array(
'integer', $this->
getShowInfo()),
 
 1253                'forcejs' => array(
'integer', $this->
getForceJS()),
 
 1265                'nr_of_tries' => array(
'integer', $this->
getNrOfTries()),
 
 1266                'kiosk' => array(
'integer', $this->
getKiosk()),
 
 1277                'complete' => array(
'text', $this->
isComplete($testQuestionSetConfig)),
 
 1279                'ects_a' => array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : 
null),
 
 1280                'ects_b' => array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : 
null),
 
 1281                'ects_c' => array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : 
null),
 
 1282                'ects_d' => array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : 
null),
 
 1283                'ects_e' => array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : 
null),
 
 1284                'ects_fx' => array(
'float', $this->
getECTSFX()),
 
 1293                'password' => array(
'text', $this->
getPassword()),
 
 1301                'created' => array(
'integer', time()),
 
 1302                'tstamp' => array(
'integer', time()),
 
 1304                'template_id' => array(
'integer', $this->
getTemplate()),
 
 1305                'pool_usage' => array(
'integer', $this->
getPoolUsage()),
 
 1320                'autosave' => array(
'integer', (
int) $this->
getAutosave()),
 
 1343                'pass_waiting' => array(
'text', (
string) $this->
getPassWaiting())
 
 1346            $this->test_id = $next_id;
 
 1356                    "SELECT * FROM tst_tests WHERE test_id = %s",
 
 1358                    array($this->test_id)
 
 1360                if (
$result->numRows() == 1) {
 
 1368                        'author' => array(
'text', $this->
getAuthor()),
 
 1372                        'showinfo' => array(
'integer', $this->
getShowInfo()),
 
 1373                        'forcejs' => array(
'integer', $this->
getForceJS()),
 
 1385                        'nr_of_tries' => array(
'integer', $this->
getNrOfTries()),
 
 1386                        'kiosk' => array(
'integer', $this->
getKiosk()),
 
 1397                        'complete' => array(
'text', $this->
isComplete($testQuestionSetConfig)),
 
 1399                        'ects_a' => array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : 
null),
 
 1400                        'ects_b' => array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : 
null),
 
 1401                        'ects_c' => array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : 
null),
 
 1402                        'ects_d' => array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : 
null),
 
 1403                        'ects_e' => array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : 
null),
 
 1404                        'ects_fx' => array(
'float', $this->
getECTSFX()),
 
 1413                        'password' => array(
'text', $this->
getPassword()),
 
 1421                        'tstamp' => array(
'integer', time()),
 
 1423                        'template_id' => array(
'integer', $this->
getTemplate()),
 
 1424                        'pool_usage' => array(
'integer', $this->
getPoolUsage()),
 
 1439                        'autosave' => array(
'integer', (
int) $this->
getAutosave()),
 
 1462                        'pass_waiting' => array(
'text', (
string) $this->
getPassWaiting())
 
 1465                        'test_id' => array(
'integer', (
int) $this->
getTestId())
 
 1469            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1471                $logresult = 
$ilDB->queryF(
 
 1472                    "SELECT * FROM tst_tests WHERE test_id = %s",
 
 1477                if ($logresult->numRows() == 1) {
 
 1478                    $newrow = 
$ilDB->fetchAssoc($logresult);
 
 1480                $changed_fields = array();
 
 1481                foreach ($oldrow as 
$key => $value) {
 
 1482                    if (strcmp($oldrow[
$key], $newrow[
$key]) != 0) {
 
 1483                        array_push($changed_fields, 
"$key: " . $oldrow[
$key] . 
" => " . $newrow[
$key]);
 
 1486                $changes = join(
", ", $changed_fields);
 
 1487                if (count($changed_fields) > 0) {
 
 1495                    $aresult = 
$ilDB->queryF(
 
 1496                        "SELECT active_id FROM tst_active WHERE test_fi = %s AND tries >= %s AND submitted = %s",
 
 1497                        array(
'integer', 
'integer', 
'integer'),
 
 1500                    while (
$row = 
$ilDB->fetchAssoc($aresult)) {
 
 1502                            "UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
 1503                            array(
'integer', 
'timestamp', 
'integer'),
 
 1504                            array(1, date(
'Y-m-d H:i:s'), 
$row[
"active_id"])
 
 1509                    $aresult = 
$ilDB->queryF(
 
 1510                        "SELECT active_id FROM tst_active WHERE test_fi = %s AND tries < %s AND submitted = %s",
 
 1511                        array(
'integer', 
'integer', 
'integer'),
 
 1514                    while (
$row = 
$ilDB->fetchAssoc($aresult)) {
 
 1516                            "UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
 1517                            array(
'integer', 
'timestamp', 
'integer'),
 
 1518                            array(0, 
null, 
$row[
"active_id"])
 
 1523                    $aresult = 
$ilDB->queryF(
 
 1524                        "SELECT active_id FROM tst_active WHERE test_fi = %s AND submitted = %s",
 
 1525                        array(
'integer', 
'integer'),
 
 1528                    while (
$row = 
$ilDB->fetchAssoc($aresult)) {
 
 1530                            "UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
 1531                            array(
'integer', 
'timestamp', 
'integer'),
 
 1532                            array(0, 
null, 
$row[
"active_id"])
 
 1540        include_once 
'Services/News/classes/class.ilNewsItem.php';
 
 1545            $newsItem->setContext($this->
getId(), 
'tst');
 
 1547            $newsItem->setTitle(
'new_test_online');
 
 1548            $newsItem->setContentIsLangVar(
true);
 
 1549            $newsItem->setContent(
'');
 
 1550            $newsItem->setUserId(
$ilUser->getId());
 
 1552            $newsItem->create();
 
 1559                $newsItem->setTitle(
'new_test_online');
 
 1560                $newsItem->setContentIsLangVar(
true);
 
 1561                $newsItem->setContent(
'');
 
 1562                $newsItem->update();
 
 1567        if ($this->ref_id) {
 
 1568            include_once 
"./Services/Object/classes/class.ilObjectActivation.php";
 
 1581            $item->update($this->ref_id);
 
 1584        if (!$properties_only) {
 
 1589            $this->mark_schema->saveToDb($this->test_id);
 
 1604        $oldquestions = array();
 
 1605        include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 1608                "SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
 
 1614                    array_push($oldquestions, 
$row[
"question_fi"]);
 
 1620        $currentQuestionsObligationsQuery = 
'SELECT question_fi, obligatory FROM tst_test_question WHERE test_fi = %s';
 
 1621        $rset = 
$ilDB->queryF($currentQuestionsObligationsQuery, array(
'integer'), array($this->
getTestId()));
 
 1622        while (
$row = 
$ilDB->fetchAssoc($rset)) {
 
 1623            $obligatoryQuestionState[
$row[
'question_fi']] = 
$row[
'obligatory'];
 
 1626        $affectedRows = 
$ilDB->manipulateF(
 
 1627            "DELETE FROM tst_test_question WHERE test_fi = %s",
 
 1632        foreach ($this->questions as 
$key => $value) {
 
 1634            if (!isset($obligatoryQuestionState[$value]) || is_null($obligatoryQuestionState[$value])) {
 
 1635                $obligatoryQuestionState[$value] = 0;
 
 1639            $next_id = 
$ilDB->nextId(
'tst_test_question');
 
 1640            $ilDB->insert(
'tst_test_question', array(
 
 1641                'test_question_id' => array(
'integer', $next_id),
 
 1642                'test_fi' => array(
'integer', $this->
getTestId()),
 
 1643                'question_fi' => array(
'integer', $value),
 
 1644                'sequence' => array(
'integer', 
$key),
 
 1645                'obligatory' => array(
'integer', $obligatoryQuestionState[$value]),
 
 1646                'tstamp' => array(
'integer', time())
 
 1649        include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1652                "SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
 
 1656            $newquestions = array();
 
 1659                    array_push($newquestions, 
$row[
"question_fi"]);
 
 1662            foreach ($oldquestions as 
$index => $question_id) {
 
 1663                if (strcmp($newquestions[
$index], $question_id) != 0) {
 
 1664                    $pos = array_search($question_id, $newquestions);
 
 1665                    if ($pos === 
false) {
 
 1672            foreach ($newquestions as 
$index => $question_id) {
 
 1673                if (array_search($question_id, $oldquestions) === 
false) {
 
 1690            'SELECT copy_id FROM tst_rnd_cpy WHERE tst_fi = %s',
 
 1694        return $result->numRows() > 0;
 
 1712        $rbacsystem = 
$DIC[
'rbacsystem'];
 
 1716        if (($questionpool != 0) && (!$use_obj_id)) {
 
 1722            "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",
 
 1726        $original_ids = array();
 
 1727        $paramtypes = array();
 
 1728        $paramvalues = array();
 
 1730            array_push($original_ids, 
$row[
'original_id']);
 
 1735        if (($questionpool == 0) && (!is_array($qpls))) {
 
 1736            include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 1738            if (count($available_pools)) {
 
 1739                $available = 
" AND " . 
$ilDB->in(
'obj_fi', $available_pools, 
false, 
'integer');
 
 1745        $constraint_qpls = 
"";
 
 1746        $result_array = array();
 
 1747        if ($questionpool == 0) {
 
 1748            if (is_array($qpls)) {
 
 1749                if (count($qpls) > 0) {
 
 1750                    $constraint_qpls = 
" AND " . 
$ilDB->in(
'obj_fi', $qpls, 
false, 
'integer');
 
 1755        $original_clause = 
"";
 
 1756        if (count($original_ids)) {
 
 1757            $original_clause = 
" AND " . 
$ilDB->in(
'question_id', $original_ids, 
true, 
'integer');
 
 1760        if ($questionpool == 0) {
 
 1762                "SELECT question_id FROM qpl_questions WHERE original_id IS NULL $available $constraint_qpls AND owner > %s AND complete = %s $original_clause",
 
 1763                array(
'integer', 
'text'),
 
 1768                "SELECT question_id FROM qpl_questions WHERE original_id IS NULL AND obj_fi = %s AND owner > %s AND complete = %s $original_clause",
 
 1769                array(
'integer',
'integer', 
'text'),
 
 1770                array($questionpool, 0, 
"1")
 
 1773        $found_ids = array();
 
 1775            array_push($found_ids, 
$row[
'question_id']);
 
 1777        $nr_of_questions = ($nr_of_questions > count($found_ids)) ? count($found_ids) : $nr_of_questions;
 
 1778        if ($nr_of_questions == 0) {
 
 1781        $rand_keys = array_rand($found_ids, $nr_of_questions);
 
 1783        if (is_array($rand_keys)) {
 
 1784            foreach ($rand_keys as 
$key) {
 
 1788            $result[$found_ids[$rand_keys]] = $found_ids[$rand_keys];
 
 1806            "SELECT test_result_id FROM tst_test_result WHERE active_fi = %s AND pass = %s",
 
 1807            array(
'integer',
'integer'),
 
 1808            array($active_id, 
$pass)
 
 1828            "SELECT test_random_question_id FROM tst_test_rnd_qst WHERE active_fi = %s AND pass = %s",
 
 1829            array(
'integer',
'integer'),
 
 1830            array($active_id, 
$pass)
 
 1832        return (
$result->numRows() > 0) ? true : 
false;
 
 1844            "SELECT * FROM tst_tests WHERE obj_fi = %s",
 
 1846            array($this->
getId())
 
 1848        if (
$result->numRows() == 1) {
 
 1855            include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
 1892                    "A" => 
$data->ects_a,
 
 1893                    "B" => 
$data->ects_b,
 
 1894                    "C" => 
$data->ects_c,
 
 1895                    "D" => 
$data->ects_d,
 
 1896                    "E" => 
$data->ects_e
 
 1900            $this->mark_schema->flush();
 
 1901            $this->mark_schema->loadFromDb($this->
getTestId());
 
 1959        if ($this->ref_id) {
 
 1960            include_once 
"./Services/Object/classes/class.ilObjectActivation.php";
 
 1962            switch ($activation[
"timing_type"]) {
 
 1989        $this->questions = array();
 
 1991            if (strcmp($active_id, 
"") == 0) {
 
 1994            if (is_null(
$pass)) {
 
 1998                "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",
 
 1999                array(
'integer', 
'integer'),
 
 2000                array($active_id, 
$pass)
 
 2006            if (
$result->numRows() == 0) {
 
 2008                    "SELECT tst_test_rnd_qst.* FROM tst_test_rnd_qst, qpl_questions WHERE tst_test_rnd_qst.active_fi = %s AND qpl_questions.question_id = tst_test_rnd_qst.question_fi AND tst_test_rnd_qst.pass = 0 ORDER BY sequence",
 
 2015                "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",
 
 2017                array($this->test_id)
 
 2022            $this->questions[
$index++] = 
$data[
"question_fi"];
 
 2050        return (strlen($this->introduction)) ? $this->introduction : 
null;
 
 2075        $this->_finalstatement = $a_statement;
 
 2087        $this->_showinfo = ($a_info) ? 1 : 0;
 
 2099        $this->_forcejs = ($a_js) ? 1 : 0;
 
 2111        $this->_customStyle = $a_customStyle;
 
 2123        return (strlen($this->_customStyle)) ? $this->_customStyle : 
null;
 
 2136        $css_path = str_replace(
"ta.css", 
"customstyles", $css_path) . 
"/";
 
 2137        $customstyles = array();
 
 2138        if (is_dir($css_path)) {
 
 2140            include_once 
"./Services/Utilities/classes/class.ilFileUtils.php";
 
 2150        return $customstyles;
 
 2165            if (file_exists($custom)) {
 
 2167                $custom = str_replace(
"ta.css", 
"customstyles/" . $this->
getCustomStyle(), $custom);
 
 2186        $this->_showfinalstatement = ($show) ? 1 : 0;
 
 2197        return (strlen($this->_finalstatement)) ? $this->_finalstatement : 
null;
 
 2209        return ($this->_showinfo) ? 1 : 0;
 
 2221        return ($this->_forcejs) ? 1 : 0;
 
 2233        return ($this->_showfinalstatement) ? 1 : 0;
 
 2253        return ($this->ects_output) ? 1 : 0;
 
 2261        $this->ects_output = $a_ects_output ? 1 : 0;
 
 2269        return (strlen($this->ects_fx)) ? $this->ects_fx : 
null;
 
 2277        $this->ects_fx = $a_ects_fx;
 
 2293        $this->ects_grades = $a_ects_grades;
 
 2303        return ($this->sequence_settings) ? $this->sequence_settings : 0;
 
 2353        switch ($instant_feedback) {
 
 2355                $this->instant_verification = 1;
 
 2358                $this->instant_verification = 0;
 
 2374            $this->answer_feedback = 1;
 
 2377            $this->answer_feedback = 0;
 
 2389        switch ($generic_answer_feedback) {
 
 2391            $this->answer_feedback = 1;
 
 2394            $this->answer_feedback = 0;
 
 2410                $this->answer_feedback_points = 1;
 
 2413                $this->answer_feedback_points = 0;
 
 2425            $this->reporting_date = 
'';
 
 2447        return ($this->score_reporting) ? $this->score_reporting : 0;
 
 2476        return ($this->instant_verification) ? $this->instant_verification : 0;
 
 2489        return ($this->answer_feedback) ? $this->answer_feedback : 0;
 
 2500        return ($this->answer_feedback) ? $this->answer_feedback : 0;
 
 2512        return ($this->answer_feedback_points) ? $this->answer_feedback_points : 0;
 
 2524        return ($this->count_system) ? $this->count_system : 0;
 
 2539            "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",
 
 2545            return $row[
"count_system"];
 
 2559        return ($this->mc_scoring) ? $this->mc_scoring : 0;
 
 2571        return ($this->score_cutting) ? $this->score_cutting : 0;
 
 2583        return ($this->pass_scoring) ? $this->pass_scoring : 0;
 
 2598            "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",
 
 2604            return $row[
"pass_scoring"];
 
 2621            "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",
 
 2627            return $row[
"mc_scoring"];
 
 2644            "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",
 
 2650            return $row[
"score_cutting"];
 
 2664        return (strlen($this->reporting_date)) ? $this->reporting_date : 
null;
 
 2676        return ($this->nr_of_tries) ? $this->nr_of_tries : 0;
 
 2688        return ($this->_kiosk) ? $this->_kiosk : 0;
 
 2701        $this->_kiosk = $kiosk;
 
 2713        if (($this->_kiosk & 1) > 0) {
 
 2730            $this->_kiosk = $this->_kiosk | 1;
 
 2733                $this->_kiosk = $this->_kiosk ^ 1;
 
 2747        if (($this->_kiosk & 2) > 0) {
 
 2763            $this->_kiosk = $this->_kiosk | 2;
 
 2766                $this->_kiosk = $this->_kiosk ^ 2;
 
 2780        if (($this->_kiosk & 4) > 0) {
 
 2795        if ($a_participant) {
 
 2796            $this->_kiosk = $this->_kiosk | 4;
 
 2799                $this->_kiosk = $this->_kiosk ^ 4;
 
 2813        return ($this->use_previous_answers) ? $this->use_previous_answers : 0;
 
 2825        return ($this->title_output) ? $this->title_output : 0;
 
 2842            "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",
 
 2848            return $row[
"title_output"];
 
 2879            "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",
 
 2889            if ($user_active_user_setting) {
 
 2890                $res = 
$ilUser->getPref(
"tst_use_previous_answers");
 
 2891                if (
$res !== 
false) {
 
 2908        return (strlen($this->processing_time)) ? $this->processing_time : 
null;
 
 2919        if (strlen($this->processing_time)) {
 
 2920            if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches)) {
 
 2921                if ((
int) $matches[1] + (
int) $matches[2] + (
int) $matches[3] == 0) {
 
 2925                        'hh' => $matches[1],
 
 2926                        'mm' => $matches[2],
 
 2927                        'ss' => $matches[3],
 
 2937        if (strlen($this->processing_time)) {
 
 2938            if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches)) {
 
 2939                return ($matches[1] * 60) + $matches[2];
 
 2955        if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $this->
getProcessingTime(), $matches)) {
 
 2957            return ($matches[1] * 3600) + ($matches[2] * 60) + $matches[3] + $extratime;
 
 2975            return $ending - $now;
 
 2990        return ($this->enable_processing_time) ? $this->enable_processing_time : 0;
 
 3002        return ($this->reset_processing_time) ? $this->reset_processing_time : 0;
 
 3030        return ($this->starting_time != 0) ? $this->starting_time : 0;
 
 3070        return ($this->ending_time != 0) ? $this->ending_time : 0;
 
 3107            $this->use_previous_answers = 1;
 
 3109            $this->use_previous_answers = 0;
 
 3141                $this->title_output = 1;
 
 3144                $this->title_output = 2;
 
 3147                $this->title_output = 0;
 
 3166        $this->processing_time = sprintf(
"%02d:%02d:00", floor($minutes / 60), $minutes % 60);
 
 3179            $this->enable_processing_time = 
"1";
 
 3181            $this->enable_processing_time = 
"0";
 
 3195            $this->reset_processing_time = 1;
 
 3197            $this->reset_processing_time = 0;
 
 3210        $this->count_system = $a_count_system;
 
 3238        return (strlen($this->password)) ? $this->password : 
null;
 
 3250        $this->password = $a_password;
 
 3262        $this->score_cutting = $a_score_cutting;
 
 3274        $this->mc_scoring = $a_mc_scoring;
 
 3286        switch ($a_pass_scoring) {
 
 3334            $DIC[
'ilPluginAdmin'],
 
 3338        foreach ($activeIds as $activeId) {
 
 3340            $passSelector->setActiveId($activeId);
 
 3342            foreach ($passSelector->getExistingPasses() as 
$pass) {
 
 3343                $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($activeId, 
$pass);
 
 3346                $testSequence->removeQuestion($questionId, $reindexedSequencePositionMap);
 
 3357        foreach ($removeQuestionIds as $value) {
 
 3374        include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3378        $question->delete($question_id);
 
 3397        require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
 3399        $participantData->setUserIdsFilter($userIds);
 
 3400        $participantData->load($this->
getTestId());
 
 3413            require_once 
'Services/Object/classes/class.ilObjectLP.php';
 
 3415            $testLP->setTestObject($this);
 
 3416            $testLP->resetLPDataForUserIds($participantData->
getUserIds(), 
false);
 
 3430        require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
 3432        $participantData->setUserIdsFilter($userIds);
 
 3433        $participantData->load($this->
getTestId());
 
 3435        $IN_userIds = 
$ilDB->in(
'usr_id', $participantData->getUserIds(), 
false, 
'integer');
 
 3437            "DELETE FROM usr_pref WHERE $IN_userIds AND keyword = %s",
 
 3439            array(
"tst_password_" . $this->
getTestId())
 
 3442        if (count($participantData->getActiveIds())) {
 
 3452        $IN_activeIds = 
$ilDB->in(
'active_fi', $activeIds, 
false, 
'integer');
 
 3454        $ilDB->manipulate(
"DELETE FROM tst_solutions WHERE $IN_activeIds");
 
 3455        $ilDB->manipulate(
"DELETE FROM tst_qst_solved WHERE $IN_activeIds");
 
 3456        $ilDB->manipulate(
"DELETE FROM tst_test_result WHERE $IN_activeIds");
 
 3457        $ilDB->manipulate(
"DELETE FROM tst_pass_result WHERE $IN_activeIds");
 
 3458        $ilDB->manipulate(
"DELETE FROM tst_result_cache WHERE $IN_activeIds");
 
 3459        $ilDB->manipulate(
"DELETE FROM tst_sequence WHERE $IN_activeIds");
 
 3460        $ilDB->manipulate(
"DELETE FROM tst_times WHERE $IN_activeIds");
 
 3463            $ilDB->manipulate(
"DELETE FROM tst_test_rnd_qst WHERE $IN_activeIds");
 
 3465            $ilDB->manipulate(
"DELETE FROM tst_seq_qst_tracking WHERE $IN_activeIds");
 
 3466            $ilDB->manipulate(
"DELETE FROM tst_seq_qst_answstatus WHERE $IN_activeIds");
 
 3467            $ilDB->manipulate(
"DELETE FROM tst_seq_qst_postponed WHERE $IN_activeIds");
 
 3468            $ilDB->manipulate(
"DELETE FROM tst_seq_qst_checked WHERE $IN_activeIds");
 
 3471        include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3473        foreach ($activeIds as $active_id) {
 
 3475            if (@is_dir(CLIENT_WEB_DIR . 
"/assessment/tst_" . $this->
getTestId() . 
"/$active_id")) {
 
 3484        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
 
 3493        $IN_activeIds = 
$ilDB->in(
'active_id', $activeIds, 
false, 
'integer');
 
 3494        $ilDB->manipulate(
"DELETE FROM tst_active WHERE $IN_activeIds");
 
 3511            "SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
 
 3512            array(
'integer', 
'integer'),
 
 3516        if (
$data->sequence > 1) {
 
 3519                "SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
 
 3520                array(
'integer',
'integer'),
 
 3525            $affectedRows = 
$ilDB->manipulateF(
 
 3526                "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3527                array(
'integer',
'integer'),
 
 3528                array(
$data->sequence, $data_previous->test_question_id)
 
 3531            $affectedRows = 
$ilDB->manipulateF(
 
 3532                "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3533                array(
'integer',
'integer'),
 
 3534                array(
$data->sequence - 1, 
$data->test_question_id)
 
 3536            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3558            "SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
 
 3559            array(
'integer',
'integer'),
 
 3564            "SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
 
 3565            array(
'integer',
'integer'),
 
 3568        if (
$result->numRows() == 1) {
 
 3572            $affectedRows = 
$ilDB->manipulateF(
 
 3573                "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3574                array(
'integer',
'integer'),
 
 3575                array(
$data->sequence, $data_next->test_question_id)
 
 3578            $affectedRows = 
$ilDB->manipulateF(
 
 3579                "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3580                array(
'integer',
'integer'),
 
 3581                array(
$data->sequence + 1, 
$data->test_question_id)
 
 3583            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3603        $duplicate_id = $question->duplicate(
true, 
null, 
null, 
null, $this->
getId());
 
 3605        return $duplicate_id;
 
 3620        #var_dump($question_id); 
 3622            $duplicate_id = $question_id;
 
 3629            "SELECT MAX(sequence) seq FROM tst_test_question WHERE test_fi=%s",
 
 3635        if (
$result->numRows() == 1) {
 
 3637            $sequence = 
$data->seq + 1;
 
 3640        $next_id = 
$ilDB->nextId(
'tst_test_question');
 
 3641        $affectedRows = 
$ilDB->manipulateF(
 
 3642            "INSERT INTO tst_test_question (test_question_id, test_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
 
 3643            array(
'integer', 
'integer',
'integer',
'integer',
'integer'),
 
 3644            array($next_id, $this->
getTestId(), $duplicate_id, $sequence, time())
 
 3646        if ($affectedRows == 1) {
 
 3647            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3653        $affectedRows = 
$ilDB->manipulateF(
 
 3654            "DELETE FROM tst_active WHERE test_fi = %s",
 
 3660        return $duplicate_id;
 
 3677                "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",
 
 3682                array_push($titles, 
$row[
"title"]);
 
 3702                "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",
 
 3707                $titles[
$row[
'question_id']] = 
$row[
"title"];
 
 3729            } elseif (isset($nr)) {
 
 3730                return $this->lng->txt(
"ass_question") . 
' ' . $nr;
 
 3732                return $this->lng->txt(
"ass_question");
 
 3754            "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",
 
 3774        $existing_questions = array();
 
 3777            if (is_null(
$pass)) {
 
 3781                "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",
 
 3782                array(
'integer',
'integer'),
 
 3783                array($active_id, 
$pass)
 
 3787                "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",
 
 3793            if (
$data->original_id === 
null) {
 
 3797            array_push($existing_questions, 
$data->original_id);
 
 3799        return $existing_questions;
 
 3814        if ($question_id < 1) {
 
 3818            "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",
 
 3822        if (
$result->numRows() == 1) {
 
 3824            return $data->type_tag;
 
 3841        $next_id = 
$ilDB->nextId(
'tst_times');
 
 3842        $affectedRows = 
$ilDB->manipulateF(
 
 3843            "INSERT INTO tst_times (times_id, active_fi, started, finished, pass, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
 
 3844            array(
'integer', 
'integer', 
'timestamp', 
'timestamp', 
'integer', 
'integer'),
 
 3845            array($next_id, $active_id, strftime(
"%Y-%m-%d %H:%M:%S"), strftime(
"%Y-%m-%d %H:%M:%S"), 
$pass, time())
 
 3861        $affectedRows = 
$ilDB->manipulateF(
 
 3862            "UPDATE tst_times SET finished = %s, tstamp = %s WHERE times_id = %s",
 
 3863            array(
'timestamp', 
'integer', 
'integer'),
 
 3864            array(strftime(
"%Y-%m-%d %H:%M:%S"), time(), $times_id)
 
 3880        if (is_null(
$pass)) {
 
 3882                "SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
 
 3883                array(
'integer',
'integer'),
 
 3884                array($active_id, 0)
 
 3888                "SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
 
 3889                array(
'integer',
'integer'),
 
 3890                array($active_id, 
$pass)
 
 3893        $result_array = array();
 
 3895            array_push($result_array, 
$row[
"question_fi"]);
 
 3897        return $result_array;
 
 3911        return ((($currentpass > 0) && ($num == 0)) || $this->
isTestFinished($active_id)) ? true : 
false;
 
 3926        $result_array = array();
 
 3930            if (count($this->questions) == 0) {
 
 3931                return $result_array;
 
 3933            if (is_null(
$pass)) {
 
 3937                "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'),
 
 3938                array(
'integer',
'integer'),
 
 3939                array($active_id, 
$pass)
 
 3942            if (count($this->questions) == 0) {
 
 3943                return $result_array;
 
 3945            $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'));
 
 3948            $result_array[
$row[
"question_id"]] = 
$row;
 
 3950        return $result_array;
 
 3972                "SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
 
 3973                array(
'integer',
'integer',
'text'),
 
 3976        } elseif (strlen($anonymous_id)) {
 
 3978                "SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
 
 3979                array(
'integer',
'integer',
'text'),
 
 3980                array($user_id, $this->test_id, $anonymous_id)
 
 3983            if (
$GLOBALS[
'DIC'][
'ilUser']->
getId() == ANONYMOUS_USER_ID) {
 
 3987                "SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
 
 3988                array(
'integer',
'integer'),
 
 3989                array($user_id, $this->test_id)
 
 3994            return $row[
"active_id"];
 
 4021            "SELECT tst_active.active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
 
 4022            array(
'integer', 
'integer'),
 
 4027            return $row[
"active_id"];
 
 4041        $keys = array_keys($array);
 
 4057    public function &
getTestResult($active_id, 
$pass = 
null, $ordered_sequence = 
false, $considerHiddenQuestions = 
true, $considerOptionalQuestions = 
true)
 
 4063        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 4067        if (is_null(
$pass)) {
 
 4071        require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
 4073        $testSession = $testSessionFactory->getSession($active_id);
 
 4075        require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 4077        $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($active_id, 
$pass);
 
 4080            require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 4082            $dynamicQuestionSetConfig->loadFromDb();
 
 4089            $testSequence->setConsiderHiddenQuestionsEnabled($considerHiddenQuestions);
 
 4090            $testSequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions);
 
 4095            if ($ordered_sequence) {
 
 4102        $arrResults = array();
 
 4105                        SELECT          tst_test_result.question_fi, 
 4106                                                tst_test_result.points reached, 
 4107                                                tst_test_result.hint_count requested_hints, 
 4108                                                tst_test_result.hint_points hint_points, 
 4109                                                tst_test_result.answered answered 
 4111                        FROM            tst_test_result 
 4113                        LEFT JOIN       tst_solutions 
 4114                        ON                      tst_solutions.active_fi = tst_test_result.active_fi 
 4115                        AND                     tst_solutions.question_fi = tst_test_result.question_fi 
 4117                        WHERE           tst_test_result.active_fi = %s 
 4118                        AND                     tst_test_result.pass = %s 
 4121        $solutionresult = 
$ilDB->queryF(
 
 4123            array(
'integer', 
'integer'),
 
 4124            array($active_id, 
$pass)
 
 4127        while (
$row = 
$ilDB->fetchAssoc($solutionresult)) {
 
 4128            $arrResults[ 
$row[
'question_fi'] ] = 
$row;
 
 4131        $numWorkedThrough = count($arrResults);
 
 4133        require_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 4135        $IN_question_ids = 
$ilDB->in(
'qpl_questions.question_id', $sequence, 
false, 
'integer');
 
 4138                        SELECT          qpl_questions.*, 
 4139                                                qpl_qst_type.type_tag, 
 4140                                                qpl_sol_sug.question_fi has_sug_sol 
 4145                        LEFT JOIN       qpl_sol_sug 
 4146                        ON                      qpl_sol_sug.question_fi = qpl_questions.question_id 
 4148                        WHERE           qpl_qst_type.question_type_id = qpl_questions.question_type_fi 
 4149                        AND                     $IN_question_ids 
 4154        $unordered = array();
 
 4158        $obligationsAnswered = 
true;
 
 4162                $row[
'points'] ? $arrResults[ 
$row[
'question_id'] ][
'reached'] / 
$row[
'points'] : 0
 
 4165            if ($percentvalue < 0) {
 
 4166                $percentvalue = 0.0;
 
 4172                "max" => round(
$row[
'points'], 2),
 
 4173                "reached" => round($arrResults[
$row[
'question_id']][
'reached'], 2),
 
 4174                'requested_hints' => $arrResults[
$row[
'question_id']][
'requested_hints'],
 
 4175                'hint_points' => $arrResults[
$row[
'question_id']][
'hint_points'],
 
 4176                "percent" => sprintf(
"%2.2f ", ($percentvalue) * 100) . 
"%",
 
 4178                "type" => 
$row[
"type_tag"],
 
 4179                "qid" => 
$row[
'question_id'],
 
 4180                "original_id" => 
$row[
"original_id"],
 
 4181                "workedthrough" => isset($arrResults[
$row[
'question_id']]) ? 1 : 0,
 
 4182                'answered' => $arrResults[
$row[
'question_id']][
'answered']
 
 4185            if (!$arrResults[ 
$row[
'question_id'] ][
'answered']) {
 
 4186                $obligationsAnswered = 
false;
 
 4189            $unordered[ 
$row[
'question_id'] ] = 
$data;
 
 4194        $numQuestionsTotal = count($unordered);
 
 4198        $pass_requested_hints = 0;
 
 4199        $pass_hint_points = 0;
 
 4204        foreach ($sequence as $qid) {
 
 4207            $pass_max += round($unordered[$qid][
'max'], 2);
 
 4208            $pass_reached += round($unordered[$qid][
'reached'], 2);
 
 4209            $pass_requested_hints += $unordered[$qid][
'requested_hints'];
 
 4210            $pass_hint_points += $unordered[$qid][
'hint_points'];
 
 4214            $unordered[$qid][
'nr'] = 
$key;
 
 4215            array_push($found, $unordered[$qid]);
 
 4224            if (
$results[
'reached_points'] < 0) {
 
 4228            if ($pass_reached < 0) {
 
 4233        $found[
'pass'][
'total_max_points'] = $pass_max;
 
 4234        $found[
'pass'][
'total_reached_points'] = $pass_reached;
 
 4235        $found[
'pass'][
'total_requested_hints'] = $pass_requested_hints;
 
 4236        $found[
'pass'][
'total_hint_points'] = $pass_hint_points;
 
 4237        $found[
'pass'][
'percent'] = ($pass_max > 0) ? $pass_reached / $pass_max : 0;
 
 4238        $found[
'pass'][
'obligationsAnswered'] = $obligationsAnswered;
 
 4239        $found[
'pass'][
'num_workedthrough'] = $numWorkedThrough;
 
 4240        $found[
'pass'][
'num_questions_total'] = $numQuestionsTotal;
 
 4242        $found[
"test"][
"total_max_points"] = 
$results[
'max_points'];
 
 4243        $found[
"test"][
"total_reached_points"] = 
$results[
'reached_points'];
 
 4244        $found[
"test"][
"total_requested_hints"] = 
$results[
'hint_count'];
 
 4245        $found[
"test"][
"total_hint_points"] = 
$results[
'hint_points'];
 
 4246        $found[
"test"][
"result_pass"] = 
$results[
'pass'];
 
 4247        $found[
'test'][
'result_tstamp'] = 
$results[
'tstamp'];
 
 4248        $found[
'test'][
'obligations_answered'] = 
$results[
'obligations_answered'];
 
 4250        if ((!$total_reached_points) or (!$total_max_points)) {
 
 4253            $percentage = ($total_reached_points / $total_max_points) * 100.0;
 
 4255            if ($percentage < 0) {
 
 4260        $found[
"test"][
"passed"] = 
$results[
'passed'];
 
 4277            "SELECT COUNT(active_id) total FROM tst_active WHERE test_fi = %s",
 
 4282        return $row[
"total"];
 
 4297            "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",
 
 4298            array(
'integer',
'integer'),
 
 4303            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"started"], $matches);
 
 4304            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4305            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"finished"], $matches);
 
 4306            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4307            $time += ($epoch_2 - $epoch_1);
 
 4336            "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",
 
 4343            if (!array_key_exists(
$row[
"active_fi"], $times)) {
 
 4344                $times[
$row[
"active_fi"]] = 0;
 
 4346            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"started"], $matches);
 
 4347            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4348            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"finished"], $matches);
 
 4349            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4350            $times[
$row[
"active_fi"]] += ($epoch_2 - $epoch_1);
 
 4367            "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",
 
 4368            array(
'integer',
'integer'),
 
 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            $time += ($epoch_2 - $epoch_1);
 
 4394            "SELECT * FROM tst_times WHERE active_fi = %s AND pass = %s ORDER BY started",
 
 4395            array(
'integer',
'integer'),
 
 4396            array($active_id, 
$pass)
 
 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);
 
 4435            "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",
 
 4436            array(
'integer',
'integer'),
 
 4442            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"started"], $matches);
 
 4443            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4444            if ($firstvisit == 0 || $epoch_1 < $firstvisit) {
 
 4445                $firstvisit = $epoch_1;
 
 4447            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"finished"], $matches);
 
 4448            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4449            if ($epoch_2 > $lastvisit) {
 
 4450                $lastvisit = $epoch_2;
 
 4453        return array(
"firstvisit" => $firstvisit, 
"lastvisit" => $lastvisit);
 
 4470            "SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.active_id = %s AND tst_active.active_id = tst_times.active_fi",
 
 4478            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row->started, $matches);
 
 4479            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4480            if (!$first_visit) {
 
 4481                $first_visit = $epoch_1;
 
 4483            if ($epoch_1 < $first_visit) {
 
 4484                $first_visit = $epoch_1;
 
 4486            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row->finished, $matches);
 
 4487            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4489                $last_visit = $epoch_2;
 
 4491            if ($epoch_2 > $last_visit) {
 
 4492                $last_visit = $epoch_2;
 
 4494            $times[
$row->active_fi] += ($epoch_2 - $epoch_1);
 
 4497        foreach ($times as 
$key => $value) {
 
 4498            $max_time += $value;
 
 4500        if ((!$test_result[
"test"][
"total_reached_points"]) or (!$test_result[
"test"][
"total_max_points"])) {
 
 4503            $percentage = ($test_result[
"test"][
"total_reached_points"] / $test_result[
"test"][
"total_max_points"]) * 100.0;
 
 4504            if ($percentage < 0) {
 
 4508        $mark_obj = $this->mark_schema->getMatchingMark($percentage);
 
 4509        $first_date = getdate($first_visit);
 
 4510        $last_date = getdate($last_visit);
 
 4511        $qworkedthrough = 0;
 
 4512        foreach ($test_result as 
$key => $value) {
 
 4513            if (preg_match(
"/\d+/", 
$key)) {
 
 4514                $qworkedthrough += $value[
"workedthrough"];
 
 4517        if (!$qworkedthrough) {
 
 4520            $atimeofwork = $max_time / $qworkedthrough;
 
 4523        $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
 
 4529            $result_mark = $mark_obj->getShortName();
 
 4531            if ($mark_obj->getPassed() && $obligationsAnswered) {
 
 4537        $percent_worked_through = 0;
 
 4538        if (count($this->questions)) {
 
 4539            $percent_worked_through = $qworkedthrough / count($this->questions);
 
 4541        $result_array = array(
 
 4542            "qworkedthrough" => $qworkedthrough,
 
 4543            "qmax" => count($this->questions),
 
 4544            "pworkedthrough" => $percent_worked_through,
 
 4545            "timeofwork" => $max_time,
 
 4546            "atimeofwork" => $atimeofwork,
 
 4547            "firstvisit" => $first_date,
 
 4548            "lastvisit" => $last_date,
 
 4549            "resultspoints" => $test_result[
"test"][
"total_reached_points"],
 
 4550            "maxpoints" => $test_result[
"test"][
"total_max_points"],
 
 4551            "resultsmarks" => $result_mark,
 
 4552            "passed" => $passed,
 
 4553            "distancemedian" => 
"0" 
 4555        foreach ($test_result as 
$key => $value) {
 
 4556            if (preg_match(
"/\d+/", 
$key)) {
 
 4557                $result_array[
$key] = $value;
 
 4560        return $result_array;
 
 4572        $totalpoints_array = array();
 
 4574        foreach ($all_users as $active_id => $user_name) {
 
 4576            $reached = $test_result[
"test"][
"total_reached_points"];
 
 4577            $total = $test_result[
"test"][
"total_max_points"];
 
 4579            $mark = $this->mark_schema->getMatchingMark($percentage * 100.0);
 
 4581            $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
 
 4584                if ($mark->getPassed() && $obligationsAnswered) {
 
 4585                    array_push($totalpoints_array, $test_result[
"test"][
"total_reached_points"]);
 
 4589        return $totalpoints_array;
 
 4602            "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",
 
 4606        $persons_array = array();
 
 4608            $name = $this->lng->txt(
"anonymous");
 
 4609            $fullname = $this->lng->txt(
"anonymous");
 
 4612                if (strlen(
$row[
"firstname"] . 
$row[
"lastname"] . 
$row[
"title"]) == 0) {
 
 4613                    $name = $this->lng->txt(
"deleted_user");
 
 4614                    $fullname = $this->lng->txt(
"deleted_user");
 
 4615                    $login = $this->lng->txt(
"unknown");
 
 4618                    if (
$row[
"user_fi"] == ANONYMOUS_USER_ID) {
 
 4619                        $name = $this->lng->txt(
"anonymous");
 
 4620                        $fullname = $this->lng->txt(
"anonymous");
 
 4622                        $name = trim(
$row[
"lastname"] . 
", " . 
$row[
"firstname"] . 
" " . 
$row[
"title"]);
 
 4623                        $fullname = trim(
$row[
"title"] . 
" " . 
$row[
"firstname"] . 
" " . 
$row[
"lastname"]);
 
 4627            $persons_array[
$row[
"active_id"]] = array(
 
 4629                "fullname" => $fullname,
 
 4633        return $persons_array;
 
 4647            "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),
 
 4651        $persons_array = array();
 
 4658                $persons_array[
$row[
"active_id"]] = $this->lng->txt(
"anonymous");
 
 4660                if (strlen(
$row[
"firstname"] . 
$row[
"lastname"] . 
$row[
"title"]) == 0) {
 
 4661                    $persons_array[
$row[
"active_id"]] = $this->lng->txt(
"deleted_user");
 
 4663                    if (
$row[
"user_fi"] == ANONYMOUS_USER_ID) {
 
 4664                        $persons_array[
$row[
"active_id"]] = 
$row[
"lastname"];
 
 4666                        $persons_array[
$row[
"active_id"]] = trim(
$row[
"lastname"] . 
", " . 
$row[
"firstname"] . 
" " . 
$row[
"title"]);
 
 4671        return $persons_array;
 
 4685            "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),
 
 4689        $persons_array = array();
 
 4692                $persons_array[
$row[
"active_id"]] = array(
"name" => $this->lng->txt(
"anonymous"));
 
 4694                if (strlen(
$row[
"firstname"] . 
$row[
"lastname"] . 
$row[
"title"]) == 0) {
 
 4695                    $persons_array[
$row[
"active_id"]] = array(
"name" => $this->lng->txt(
"deleted_user"));
 
 4697                    if (
$row[
"user_fi"] == ANONYMOUS_USER_ID) {
 
 4698                        $persons_array[
$row[
"active_id"]] = array(
"name" => 
$row[
"lastname"]);
 
 4700                        $persons_array[
$row[
"active_id"]] = array(
"name" => trim(
$row[
"lastname"] . 
", " . 
$row[
"firstname"] . 
" " . 
$row[
"title"]), 
"login" => 
$row[
"login"]);
 
 4705        return $persons_array;
 
 4721                "SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
 
 4722                "tst_test_rnd_qst.pass, qpl_questions.points " .
 
 4723                "FROM tst_test_rnd_qst, qpl_questions " .
 
 4724                "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
 
 4725                "AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence",
 
 4731                "SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
 
 4732                "qpl_questions.points " .
 
 4733                "FROM tst_test_question, tst_active, qpl_questions " .
 
 4734                "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
 
 4735                "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
 
 4743                array_push($qtest, 
$row);
 
 4762                "SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
 
 4763                "qpl_questions.points " .
 
 4764                "FROM tst_test_rnd_qst, qpl_questions " .
 
 4765                "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
 
 4766                "AND tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.pass = %s " .
 
 4767                "ORDER BY tst_test_rnd_qst.sequence",
 
 4768                array(
'integer', 
'integer'),
 
 4769                array($active_id, 
$pass)
 
 4773                "SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
 
 4774                "qpl_questions.points " .
 
 4775                "FROM tst_test_question, tst_active, qpl_questions " .
 
 4776                "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
 
 4777                "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
 
 4785                array_push($qpass, 
$row);
 
 4817        require_once 
'Modules/Test/classes/class.ilTestParticipantList.php';
 
 4818        require_once 
'Modules/Test/classes/class.ilTestParticipantAccessFilter.php';
 
 4830    public function getUnfilteredEvaluationData()
 
 4837        include_once 
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
 
 4838        include_once 
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
 
 4839        include_once 
"./Modules/Test/classes/class.ilTestEvaluationData.php";
 
 4844                        SELECT          tst_test_result.*, 
 4845                                                qpl_questions.original_id, 
 4846                                                qpl_questions.title questiontitle, 
 4847                                                qpl_questions.points maxpoints 
 4849                        FROM            tst_test_result, qpl_questions, tst_active 
 4851                        WHERE           tst_active.active_id = tst_test_result.active_fi 
 4852                        AND                     qpl_questions.question_id = tst_test_result.question_fi 
 4853                        AND                     tst_active.test_fi = %s 
 4855                        ORDER BY        tst_active.active_id ASC, tst_test_result.pass ASC, tst_test_result.tstamp DESC 
 4870            $participantObject = 
$data->getParticipant(
$row[
"active_fi"]);
 
 4876            $passObject = $participantObject->getPass(
$row[
"pass"]);
 
 4882            $passObject->addAnsweredQuestion(
 
 4883                $row[
"question_fi"],
 
 4892        foreach (array_keys(
$data->getParticipants()) as $active_id) {
 
 4894                for ($testpass = 0; $testpass <= 
$data->getParticipant($active_id)->getLastPass(); $testpass++) {
 
 4898                                                SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, qpl_questions.original_id, 
 4899                                                tst_test_rnd_qst.pass, qpl_questions.points, qpl_questions.title 
 4900                                                FROM tst_test_rnd_qst, qpl_questions 
 4901                                                WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id 
 4902                                                AND tst_test_rnd_qst.pass = %s 
 4903                                                AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence 
 4908                        array(
'integer',
'integer'),
 
 4909                        array($testpass, $active_id)
 
 4914                            $tpass = array_key_exists(
"pass", 
$row) ? 
$row[
"pass"] : 0;
 
 4916                            $data->getParticipant($active_id)->addQuestion(
 
 4917                                $row[
"original_id"],
 
 4918                                $row[
"question_fi"],
 
 4924                            $data->addQuestionTitle(
$row[
"question_fi"], 
$row[
"title"]);
 
 4929                $lastPass = 
$data->getParticipant($active_id)->getLastPass();
 
 4930                for ($testpass = 0; $testpass <= $lastPass; $testpass++) {
 
 4931                    require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 4933                        $DIC->repositoryTree(),
 
 4935                        $DIC[
'ilPluginAdmin'],
 
 4938                    $dynamicQuestionSetConfig->loadFromDb();
 
 4940                    require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 4942                    $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $testpass);
 
 4947                    $sequence = (array) 
$testSequence->getUserSequenceQuestions();
 
 4949                    $questionsIdsToRequest = array_diff(array_values($sequence), array_values($questionData));
 
 4950                    if (count($questionsIdsToRequest) > 0) {
 
 4951                        $questionIdsCondition = 
' ' . 
$DIC->database()->in(
'question_id', array_values($questionsIdsToRequest), 
false, 
'integer') . 
' ';
 
 4957                                                        WHERE {$questionIdsCondition}",
 
 4962                            $questionData[
$row[
'question_id']] = 
$row;
 
 4963                            $data->addQuestionTitle(
$row[
'question_id'], 
$row[
'title']);
 
 4967                    foreach ($sequence as $questionId) {
 
 4968                        if (!isset($questionData[$questionId])) {
 
 4972                        $row = $questionData[$questionId];
 
 4974                        $data->getParticipant(
 
 4977                            $row[
'original_id'],
 
 4978                            $row[
'question_id'],
 
 4987                                        SELECT tst_test_question.sequence, tst_test_question.question_fi, 
 4988                                        qpl_questions.points, qpl_questions.title, qpl_questions.original_id 
 4989                                        FROM tst_test_question, tst_active, qpl_questions 
 4990                                        WHERE tst_test_question.question_fi = qpl_questions.question_id 
 4991                                        AND tst_active.active_id = %s 
 4992                                        AND tst_active.test_fi = tst_test_question.test_fi 
 4993                                        ORDER BY tst_test_question.sequence 
 5003                    $questionsbysequence = array();
 
 5006                        $questionsbysequence[
$row[
"sequence"]] = 
$row;
 
 5009                    $seqresult = 
$ilDB->queryF(
 
 5010                        "SELECT * FROM tst_sequence WHERE active_fi = %s",
 
 5015                    while ($seqrow = 
$ilDB->fetchAssoc($seqresult)) {
 
 5016                        $questionsequence = unserialize($seqrow[
"sequence"]);
 
 5018                        foreach ($questionsequence as $sidx => $seq) {
 
 5019                            $data->getParticipant($active_id)->addQuestion(
 
 5020                                $questionsbysequence[$seq][
"original_id"],
 
 5021                                $questionsbysequence[$seq][
"question_fi"],
 
 5022                                $questionsbysequence[$seq][
"points"],
 
 5027                            $data->addQuestionTitle(
 
 5028                                $questionsbysequence[$seq][
"question_fi"],
 
 5029                                $questionsbysequence[$seq][
"title"]
 
 5041        foreach (array_keys(
$data->getParticipants()) as $active_id) {
 
 5042            $tstUserData = 
$data->getParticipant($active_id);
 
 5044            $percentage = $tstUserData->getReachedPointsInPercent();
 
 5046            $obligationsAnswered = $tstUserData->areObligationsAnswered();
 
 5048            $mark = $this->mark_schema->getMatchingMark($percentage);
 
 5050            if (is_object($mark)) {
 
 5051                $tstUserData->setMark($mark->getShortName());
 
 5052                $tstUserData->setMarkOfficial($mark->getOfficialName());
 
 5054                $tstUserData->setPassed(
 
 5055                    $mark->getPassed() && $tstUserData->areObligationsAnswered()
 
 5062                    $tstUserData->getReached(),
 
 5063                    $tstUserData->getMaxPoints()
 
 5066                $tstUserData->setECTSMark($ects_mark);
 
 5071            $tstUserData->setFirstVisit($visitingTime[
"firstvisit"]);
 
 5072            $tstUserData->setLastVisit($visitingTime[
"lastvisit"]);
 
 5090                                                SELECT          COUNT(qpl_questions.question_id) qcount, 
 5091                                                                        SUM(qpl_questions.points) qsum 
 5093                                                INNER JOIN      tst_tests 
 5094                                                ON                      tst_tests.test_id = tst_active.test_fi 
 5095                                                INNER JOIN      tst_dyn_quest_set_cfg 
 5096                                                ON          tst_dyn_quest_set_cfg.test_fi = tst_tests.test_id 
 5097                                                INNER JOIN  qpl_questions 
 5098                                                ON          qpl_questions.obj_fi = tst_dyn_quest_set_cfg.source_qpl_fi 
 5099                                                AND         qpl_questions.original_id IS NULL 
 5100                                                AND         qpl_questions.complete = %s 
 5101                                                WHERE           tst_active.active_id = %s 
 5103                    array(
'integer', 
'integer'),
 
 5104                    array(1, $active_id)
 
 5113                                                SELECT          tst_test_rnd_qst.pass, 
 5114                                                                        COUNT(tst_test_rnd_qst.question_fi) qcount, 
 5115                                                                        SUM(qpl_questions.points) qsum 
 5117                                                FROM            tst_test_rnd_qst, 
 5120                                                WHERE           tst_test_rnd_qst.question_fi = qpl_questions.question_id 
 5121                                                AND                     tst_test_rnd_qst.active_fi = %s 
 5124                                                GROUP BY        tst_test_rnd_qst.active_fi, 
 5125                                                                        tst_test_rnd_qst.pass 
 5127                    array(
'integer', 
'integer'),
 
 5128                    array($active_id, 
$pass)
 
 5137                                                SELECT          COUNT(tst_test_question.question_fi) qcount, 
 5138                                                                        SUM(qpl_questions.points) qsum 
 5140                                                FROM            tst_test_question, 
 5144                                                WHERE           tst_test_question.question_fi = qpl_questions.question_id 
 5145                                                AND                     tst_test_question.test_fi = tst_active.test_fi 
 5146                                                AND                     tst_active.active_id = %s 
 5148                                                GROUP BY        tst_test_question.test_fi 
 5158                throw new ilTestException(
"not supported question set type: $questionSetType");
 
 5163        if (is_array(
$row)) {
 
 5164            return array(
"count" => 
$row[
"qcount"], 
"points" => 
$row[
"qsum"]);
 
 5167        return array(
"count" => 0, 
"points" => 0);
 
 5172        include_once 
"./Modules/Test/classes/class.ilTestEvaluationData.php";
 
 5173        include_once 
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
 
 5174        include_once 
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
 
 5175        $data = $this->getUnfilteredEvaluationData();
 
 5176        if ($withStatistics) {
 
 5177            $data->calculateStatistics();
 
 5179        $data->setFilter($filterby, $filtertext);
 
 5206            "SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
 
 5207            "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
 
 5208            "qpl_questions.points maxpoints " .
 
 5209            "FROM tst_test_result, qpl_questions, tst_active " .
 
 5210            "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
 
 5211            "WHERE tst_active.active_id = tst_test_result.active_fi " .
 
 5212            "AND qpl_questions.question_id = tst_test_result.question_fi " .
 
 5213            "AND tst_active.test_fi = %s " .
 
 5214            "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
 
 5218        $overview = array();
 
 5220            if (!array_key_exists(
$row[
"active_fi"], $overview)) {
 
 5221                $overview[
$row[
"active_fi"]] = array();
 
 5222                $overview[
$row[
"active_fi"]][
"firstname"] = 
$row[
"firstname"];
 
 5223                $overview[
$row[
"active_fi"]][
"lastname"] = 
$row[
"lastname"];
 
 5224                $overview[
$row[
"active_fi"]][
"title"] = 
$row[
"title"];
 
 5225                $overview[
$row[
"active_fi"]][
"login"] = 
$row[
"login"];
 
 5226                $overview[
$row[
"active_fi"]][
"usr_id"] = 
$row[
"usr_id"];
 
 5227                $overview[
$row[
"active_fi"]][
"started"] = 
$row[
"started"];
 
 5228                $overview[
$row[
"active_fi"]][
"finished"] = 
$row[
"finished"];
 
 5230            if (!array_key_exists(
$row[
"pass"], $overview[
$row[
"active_fi"]])) {
 
 5231                $overview[
$row[
"active_fi"]][
$row[
"pass"]] = array();
 
 5232                $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"reached"] = 0;
 
 5233                $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"maxpoints"] = 
$row[
"maxpoints"];
 
 5235            array_push($overview[
$row[
"active_fi"]][
$row[
"pass"]], 
$row);
 
 5236            $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"reached"] += 
$row[
"points"];
 
 5254            "SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
 
 5255            "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
 
 5256            "qpl_questions.points maxpoints " .
 
 5257            "FROM tst_test_result, qpl_questions, tst_active " .
 
 5258            "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
 
 5259            "WHERE tst_active.active_id = tst_test_result.active_fi " .
 
 5260            "AND qpl_questions.question_id = tst_test_result.question_fi " .
 
 5261            "AND tst_active.test_fi = %s AND tst_active.active_id = %s" .
 
 5262            "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
 
 5263            array(
'integer', 
'integer'),
 
 5266        $overview = array();
 
 5268            if (!array_key_exists(
$row[
"active_fi"], $overview)) {
 
 5269                $overview[
$row[
"active_fi"]] = array();
 
 5270                $overview[
$row[
"active_fi"]][
"firstname"] = 
$row[
"firstname"];
 
 5271                $overview[
$row[
"active_fi"]][
"lastname"] = 
$row[
"lastname"];
 
 5272                $overview[
$row[
"active_fi"]][
"title"] = 
$row[
"title"];
 
 5273                $overview[
$row[
"active_fi"]][
"login"] = 
$row[
"login"];
 
 5274                $overview[
$row[
"active_fi"]][
"usr_id"] = 
$row[
"usr_id"];
 
 5275                $overview[
$row[
"active_fi"]][
"started"] = 
$row[
"started"];
 
 5276                $overview[
$row[
"active_fi"]][
"finished"] = 
$row[
"finished"];
 
 5278            if (!array_key_exists(
$row[
"pass"], $overview[
$row[
"active_fi"]])) {
 
 5279                $overview[
$row[
"active_fi"]][
$row[
"pass"]] = array();
 
 5280                $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"reached"] = 0;
 
 5281                $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"maxpoints"] = 
$row[
"maxpoints"];
 
 5283            array_push($overview[
$row[
"active_fi"]][
$row[
"pass"]], 
$row);
 
 5284            $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"reached"] += 
$row[
"points"];
 
 5303        if (strlen($firstname . $lastname . 
$title) == 0) {
 
 5304            $name = $this->lng->txt(
"deleted_user");
 
 5306            if ($user_id == ANONYMOUS_USER_ID) {
 
 5309                $name = trim($lastname . 
", " . $firstname . 
" " . 
$title);
 
 5312                $name = $this->lng->txt(
"anonymous");
 
 5335        if (strlen($firstname . $lastname . 
$title) == 0) {
 
 5338            if ($user_id == ANONYMOUS_USER_ID) {
 
 5341                $name = trim($lastname . 
", " . $firstname . 
" " . 
$title);
 
 5343            if ($is_anonymous) {
 
 5360        $query = 
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi";
 
 5362        if (is_array($activeIdsFilter) && count($activeIdsFilter)) {
 
 5363            $query .= 
" AND " . 
$DIC->database()->in(
'active_id', $activeIdsFilter, 
false, 
'integer');
 
 5369            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row->started, $matches);
 
 5370            $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 5371            preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row->finished, $matches);
 
 5372            $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 5373            $times[
$row->active_fi] += ($epoch_2 - $epoch_1);
 
 5377        foreach ($times as 
$key => $value) {
 
 5378            $max_time += $value;
 
 5382            $average_time = round($max_time / $counter);
 
 5386        return $average_time;
 
 5395    public function &
getAvailableQuestionpools($use_object_id = 
false, $equal_points = 
false, $could_be_offline = 
false, $show_path = 
false, $with_questioncount = 
false, $permission = 
"read")
 
 5397        include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 5409        $time_in_seconds = 0;
 
 5410        foreach ($this->questions as $question_id) {
 
 5412            $est_time = $question->getEstimatedWorkingTime();
 
 5413            $time_in_seconds += $est_time[
"h"] * 3600 + $est_time[
"m"] * 60 + $est_time[
"s"];
 
 5415        $hours = (int) ($time_in_seconds / 3600)        ;
 
 5416        $time_in_seconds = $time_in_seconds - ($hours * 3600);
 
 5417        $minutes = (int) ($time_in_seconds / 60);
 
 5418        $time_in_seconds = $time_in_seconds - ($minutes * 60);
 
 5419        $result = array(
"hh" => $hours, 
"mm" => $minutes, 
"ss" => $time_in_seconds);
 
 5431        return CLIENT_WEB_DIR . 
"/assessment/" . $this->
getId() . 
"/images/";
 
 5442        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 5457        if ((!$question_type) and ($question_id > 0)) {
 
 5461        if (!strlen($question_type)) {
 
 5465        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 5469        $question = 
new $question_type_gui();
 
 5471        if ($question_id > 0) {
 
 5472            $question->object->loadFromDb($question_id);
 
 5481            $question->object->feedbackOBJ = 
new $feedbackObjectClassname($question->object, 
$ilCtrl, 
$ilDB, 
$lng);
 
 5483            $assSettings = 
new ilSetting(
'assessment');
 
 5484            require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
 
 5486            $processLockerFactory->setQuestionId($question->object->getId());
 
 5487            $processLockerFactory->setUserId(
$ilUser->getId());
 
 5488            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 5490            $question->object->setProcessLocker($processLockerFactory->getLocker());
 
 5507        if (strcmp($question_id, 
"") != 0) {
 
 5508            include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 5523        $this->questions = array_values($this->questions);
 
 5524        $array_pos = array_search($target_index, $this->questions);
 
 5525        if ($insert_mode == 0) {
 
 5526            $part1 = array_slice($this->questions, 0, $array_pos);
 
 5527            $part2 = array_slice($this->questions, $array_pos);
 
 5528        } elseif ($insert_mode == 1) {
 
 5529            $part1 = array_slice($this->questions, 0, $array_pos + 1);
 
 5530            $part2 = array_slice($this->questions, $array_pos + 1);
 
 5532        foreach ($move_questions as $question_id) {
 
 5533            if (!(array_search($question_id, $part1) === 
false)) {
 
 5534                unset($part1[array_search($question_id, $part1)]);
 
 5536            if (!(array_search($question_id, $part2) === 
false)) {
 
 5537                unset($part2[array_search($question_id, $part2)]);
 
 5540        $part1 = array_values($part1);
 
 5541        $part2 = array_values($part2);
 
 5542        $new_array = array_values(array_merge($part1, $move_questions, $part2));
 
 5543        $this->questions = array();
 
 5545        foreach ($new_array as $question_id) {
 
 5546            $this->questions[$counter] = $question_id;
 
 5597        $pluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 5602        include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 5605        if (count($available_pools)) {
 
 5606            $available = 
" AND " . 
$ilDB->in(
'qpl_questions.obj_fi', $available_pools, 
false, 
'integer');
 
 5610        if ($completeonly) {
 
 5611            $available .= 
" AND qpl_questions.complete = " . 
$ilDB->quote(
"1", 
'text');
 
 5615        if (is_array($arrFilter)) {
 
 5616            if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title'])) {
 
 5617                $where .= 
" AND " . 
$ilDB->like(
'qpl_questions.title', 
'text', 
"%%" . $arrFilter[
'title'] . 
"%%");
 
 5619            if (array_key_exists(
'description', $arrFilter) && strlen($arrFilter[
'description'])) {
 
 5620                $where .= 
" AND " . 
$ilDB->like(
'qpl_questions.description', 
'text', 
"%%" . $arrFilter[
'description'] . 
"%%");
 
 5622            if (array_key_exists(
'author', $arrFilter) && strlen($arrFilter[
'author'])) {
 
 5623                $where .= 
" AND " . 
$ilDB->like(
'qpl_questions.author', 
'text', 
"%%" . $arrFilter[
'author'] . 
"%%");
 
 5625            if (array_key_exists(
'type', $arrFilter) && strlen($arrFilter[
'type'])) {
 
 5626                $where .= 
" AND qpl_qst_type.type_tag = " . 
$ilDB->quote($arrFilter[
'type'], 
'text');
 
 5628            if (array_key_exists(
'qpl', $arrFilter) && strlen($arrFilter[
'qpl'])) {
 
 5629                $where .= 
" AND " . 
$ilDB->like(
'object_data.title', 
'text', 
"%%" . $arrFilter[
'qpl'] . 
"%%");
 
 5634        $original_clause = 
" qpl_questions.original_id IS NULL";
 
 5635        if (count($original_ids)) {
 
 5636            $original_clause = 
" qpl_questions.original_id IS NULL AND " . 
$ilDB->in(
'qpl_questions.question_id', $original_ids, 
true, 
'integer');
 
 5639        $query_result = 
$ilDB->query(
" 
 5640                        SELECT          qpl_questions.*, qpl_questions.tstamp, 
 5641                                                qpl_qst_type.type_tag, qpl_qst_type.plugin, qpl_qst_type.plugin_name, 
 5642                                                object_data.title parent_title 
 5643                        FROM            qpl_questions, qpl_qst_type, object_data 
 5644                        WHERE $original_clause $available 
 5645                        AND object_data.obj_id = qpl_questions.obj_fi 
 5646                        AND qpl_questions.tstamp > 0 
 5647                        AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id 
 5651        $types = $this->getQuestionTypeTranslations();
 
 5652        if ($query_result->numRows()) {
 
 5653            while (
$row = 
$ilDB->fetchAssoc($query_result)) {
 
 5656                if (!
$row[
'plugin']) {
 
 5663                if (!$pluginAdmin->isActive(
IL_COMP_MODULE, 
'TestQuestionPool', 
'qst', 
$row[
'plugin_name'])) {
 
 5668                $row[ 
'ttype' ] = $pl->getQuestionTypeTranslation();
 
 5688        foreach ($assessment->objectives as $objectives) {
 
 5689            foreach ($objectives->materials as $material) {
 
 5704        foreach ($assessment->assessmentcontrol as $assessmentcontrol) {
 
 5705            switch ($assessmentcontrol->getSolutionswitch()) {
 
 5720        foreach ($assessment->qtimetadata as 
$metadata) {
 
 5744                case "sequence_settings":
 
 5747                case "solution_details":
 
 5750                case "print_bs_with_res":
 
 5759                case "pass_waiting":
 
 5763                    $this->
setKiosk($metadata[
"entry"]);
 
 5765                case "showfinalstatement":
 
 5778                case "highscore_enabled":
 
 5782                case "highscore_anon":
 
 5786                case "highscore_achieved_ts":
 
 5790                case "highscore_score":
 
 5794                case "highscore_percentage":
 
 5798                case "highscore_hints":
 
 5802                case "highscore_wtime":
 
 5806                case "highscore_own_table":
 
 5810                case "highscore_top_table":
 
 5814                case "highscore_top_num":
 
 5818                case "hide_previous_results":
 
 5825                case "use_previous_answers":
 
 5828                case "answer_feedback":
 
 5831                case "hide_title_points":
 
 5834                case "title_output":
 
 5837                case "question_set_type":
 
 5847                case "results_presentation":
 
 5850                case "reset_processing_time":
 
 5853                case "instant_verification":
 
 5856                case "follow_qst_answer_fixation":
 
 5859                case "instant_feedback_answer_fixation":
 
 5862                case "force_instant_feedback":
 
 5865                case "answer_feedback_points":
 
 5880                case "fixed_participants":
 
 5883                case "score_reporting":
 
 5886                case "shuffle_questions":
 
 5889                case "count_system":
 
 5895                case "mailnotification":
 
 5901                case "exportsettings":
 
 5904                case "score_cutting":
 
 5911                case "allowedUsers":
 
 5915                case "allowedUsersTimeGap":
 
 5918                case "pass_scoring":
 
 5921                case 'pass_deletion_allowed':
 
 5924                case "show_summary":
 
 5927                case "reporting_date":
 
 5929                    if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches)) {
 
 5930                        $this->
setReportingDate(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
 
 5933                case 'enable_processing_time':
 
 5936                case "processing_time":
 
 5939                case "starting_time":
 
 5941                    if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches)) {
 
 5942                        $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);
 
 5949                    if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches)) {
 
 5950                        $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);
 
 5955                case "enable_examview":
 
 5958                case 'show_examview_html':
 
 5961                case 'show_examview_pdf':
 
 5964                case 'redirection_mode':
 
 5967                case 'redirection_url':
 
 5970                case 'examid_in_kiosk':
 
 5971                case 'examid_in_test_pass':
 
 5974                case 'show_exam_id':
 
 5975                case 'examid_in_test_res':
 
 5978                case 'enable_archiving':
 
 5981                case 'sign_submission':
 
 5984                case 'char_selector_availability':
 
 5987                case 'char_selector_definition':
 
 5990                case 'skill_service':
 
 5993                case 'result_tax_filters':
 
 5996                case 'show_grading_status':
 
 5999                case 'show_grading_mark':
 
 6002                case 'activation_limited':
 
 6005                case 'activation_start_time':
 
 6008                case 'activation_end_time':
 
 6011                case 'activation_visibility':
 
 6017                case 'autosave_ival':
 
 6020                case 'offer_question_hints':
 
 6023                case 'instant_feedback_specific':
 
 6026                case 'obligations_enabled':
 
 6030            if (preg_match(
"/mark_step_\d+/", 
$metadata[
"label"])) {
 
 6032                preg_match(
"/<short>(.*?)<\/short>/", $xmlmark, $matches);
 
 6033                $mark_short = $matches[1];
 
 6034                preg_match(
"/<official>(.*?)<\/official>/", $xmlmark, $matches);
 
 6035                $mark_official = $matches[1];
 
 6036                preg_match(
"/<percentage>(.*?)<\/percentage>/", $xmlmark, $matches);
 
 6037                $mark_percentage = $matches[1];
 
 6038                preg_match(
"/<passed>(.*?)<\/passed>/", $xmlmark, $matches);
 
 6039                $mark_passed = $matches[1];
 
 6040                $this->mark_schema->addMarkStep($mark_short, $mark_official, $mark_percentage, $mark_passed);
 
 6044        if (is_array(
$_SESSION[
"import_mob_xhtml"])) {
 
 6045            include_once 
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
 
 6046            include_once 
"./Services/RTE/classes/class.ilRTE.php";
 
 6047            include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 6048            foreach (
$_SESSION[
"import_mob_xhtml"] as $mob) {
 
 6050                if (file_exists($importfile)) {
 
 6058                    $ilLog->write(
"Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
 
 6072        include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
 
 6076        $a_xml_writer->xmlSetDtdDef(
"<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">");
 
 6077        $a_xml_writer->xmlStartTag(
"questestinterop");
 
 6080            "ident" => 
"il_" . IL_INST_ID . 
"_tst_" . $this->
getTestId(),
 
 6083        $a_xml_writer->xmlStartTag(
"assessment", $attrs);
 
 6085        $a_xml_writer->xmlElement(
"qticomment", 
null, $this->
getDescription());
 
 6088        if ($this->enable_processing_time) {
 
 6089            preg_match(
"/(\d+):(\d+):(\d+)/", $this->processing_time, $matches);
 
 6090            $a_xml_writer->xmlElement(
"duration", 
null, sprintf(
"P0Y0M0DT%dH%dM%dS", $matches[1], $matches[2], $matches[3]));
 
 6094        $a_xml_writer->xmlStartTag(
"qtimetadata");
 
 6095        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6096        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"ILIAS_VERSION");
 
 6097        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
ilias->getSetting(
"ilias_version"));
 
 6098        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6101        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6102        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"anonymity");
 
 6103        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getAnonymity()));
 
 6104        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6106        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6107        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"use_pool");
 
 6108        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getPoolUsage() ? 1 : 0);
 
 6109        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6112        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6113        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"question_set_type");
 
 6115        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6118        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6119        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"sequence_settings");
 
 6121        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6124        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6125        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"author");
 
 6126        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getAuthor());
 
 6127        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6130        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6131        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"reset_processing_time");
 
 6133        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6136        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6137        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"count_system");
 
 6138        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getCountSystem());
 
 6139        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6142        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6143        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"mc_scoring");
 
 6144        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getMCScoring());
 
 6145        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6148        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6149        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"score_cutting");
 
 6150        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getScoreCutting());
 
 6151        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6154        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6155        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"password");
 
 6156        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getPassword());
 
 6157        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6160        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6161        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"allowedUsers");
 
 6162        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getAllowedUsers());
 
 6163        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6166        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6167        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"allowedUsersTimeGap");
 
 6169        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6172        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6173        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"pass_scoring");
 
 6174        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getPassScoring());
 
 6175        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6177        $a_xml_writer->xmlStartTag(
'qtimetadatafield');
 
 6178        $a_xml_writer->xmlElement(
'fieldlabel', 
null, 
'pass_deletion_allowed');
 
 6180        $a_xml_writer->xmlEndTag(
'qtimetadatafield');
 
 6184            $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6185            $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"reporting_date");
 
 6186            preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->reporting_date, $matches);
 
 6187            $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]));
 
 6188            $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6191        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6192        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"nr_of_tries");
 
 6193        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getNrOfTries()));
 
 6194        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6197        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6198        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"pass_waiting");
 
 6199        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getPassWaiting());
 
 6200        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6203        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6204        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"kiosk");
 
 6205        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getKiosk()));
 
 6206        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6210        $a_xml_writer->xmlStartTag(
'qtimetadatafield');
 
 6211        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"redirection_mode");
 
 6213        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6216        $a_xml_writer->xmlStartTag(
'qtimetadatafield');
 
 6217        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"redirection_url");
 
 6219        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6222        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6223        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"use_previous_answers");
 
 6225        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6228        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6229        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"title_output");
 
 6230        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getTitleOutput()));
 
 6231        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6234        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6235        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"results_presentation");
 
 6237        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6240        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6241        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"examid_in_test_pass");
 
 6243        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6246        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6247        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"examid_in_test_res");
 
 6249        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6252        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6253        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_summary");
 
 6255        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6258        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6259        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"score_reporting");
 
 6260        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getScoreReporting()));
 
 6261        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6263        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6264        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"solution_details");
 
 6266        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6267        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6268        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"print_bs_with_res");
 
 6270        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6273        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6274        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"instant_verification");
 
 6276        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6279        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6280        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"answer_feedback");
 
 6281        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getAnswerFeedback()));
 
 6282        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6285        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6286        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"answer_feedback_points");
 
 6288        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6291        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6292        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"follow_qst_answer_fixation");
 
 6294        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6297        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6298        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"instant_feedback_answer_fixation");
 
 6300        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6303        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6304        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"force_instant_feedback");
 
 6306        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6310        $highscore_metadata = array(
 
 6322        foreach ($highscore_metadata as $label => 
$data) {
 
 6323            $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6324            $a_xml_writer->xmlElement(
"fieldlabel", 
null, $label);
 
 6325            $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", 
$data[
'value']));
 
 6326            $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6330        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6331        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_cancel");
 
 6332        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getShowCancel()));
 
 6333        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6336        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6337        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_marker");
 
 6338        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getShowMarker()));
 
 6339        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6342        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6343        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"fixed_participants");
 
 6345        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6348        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6349        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"showfinalstatement");
 
 6350        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", (($this->
getShowFinalStatement()) ? 
"1" : 
"0")));
 
 6351        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6354        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6355        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"showinfo");
 
 6356        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", (($this->
getShowInfo()) ? 
"1" : 
"0")));
 
 6357        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6360        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6361        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"mailnotification");
 
 6363        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6366        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6367        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"mailnottype");
 
 6369        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6372        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6373        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"exportsettings");
 
 6374        $a_xml_writer->xmlElement(
"fieldentry", 
null, (
int) $this->
getExportSettings());
 
 6375        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6378        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6379        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"forcejs");
 
 6380        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", (($this->
getForceJS()) ? 
"1" : 
"0")));
 
 6381        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6384        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6385        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"customstyle");
 
 6386        $a_xml_writer->xmlElement(
"fieldentry", 
null, $this->
getCustomStyle());
 
 6387        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6390        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6391        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"shuffle_questions");
 
 6392        $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
"%d", $this->
getShuffleQuestions()));
 
 6393        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6396        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6397        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"processing_time");
 
 6399        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6402        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6403        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"enable_examview");
 
 6404        $a_xml_writer->xmlElement(
"fieldentry", 
null, (
int) $this->
getEnableExamview());
 
 6405        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6408        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6409        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_examview_html");
 
 6411        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6414        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6415        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_examview_pdf");
 
 6417        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6420        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6421        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"enable_archiving");
 
 6423        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6426        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6427        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"sign_submission");
 
 6428        $a_xml_writer->xmlElement(
"fieldentry", 
null, (
int) $this->
getSignSubmission());
 
 6429        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6432        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6433        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"char_selector_availability");
 
 6435        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6438        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6439        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"char_selector_definition");
 
 6441        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6444        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6445        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"skill_service");
 
 6447        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6450        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6451        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"result_tax_filters");
 
 6453        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6456        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6457        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_grading_status");
 
 6459        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6462        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6463        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"show_grading_mark");
 
 6465        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6470            $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6471            $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"starting_time");
 
 6473            $a_xml_writer->xmlElement(
"fieldentry", 
null, $backward_compatibility_format);
 
 6474            $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6478            $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6479            $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"ending_time");
 
 6481            $a_xml_writer->xmlElement(
"fieldentry", 
null, $backward_compatibility_format);
 
 6482            $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6487        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6488        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"activation_limited");
 
 6490        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6493        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6494        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"activation_start_time");
 
 6496        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6499        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6500        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"activation_end_time");
 
 6502        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6505        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6506        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"activation_visibility");
 
 6508        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6511        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6512        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"autosave");
 
 6513        $a_xml_writer->xmlElement(
"fieldentry", 
null, (
int) $this->
getAutosave());
 
 6514        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6517        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6518        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"autosave_ival");
 
 6519        $a_xml_writer->xmlElement(
"fieldentry", 
null, (
int) $this->
getAutosaveIval());
 
 6520        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6523        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6524        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"offer_question_hints");
 
 6526        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6529        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6530        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"instant_feedback_specific");
 
 6532        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6535        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6536        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"instant_feedback_answer_fixation");
 
 6538        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6541        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6542        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"obligations_enabled");
 
 6544        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6547        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6548        $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"enable_processing_time");
 
 6550        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6552        foreach ($this->mark_schema->mark_steps as 
$index => $mark) {
 
 6554            $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6555            $a_xml_writer->xmlElement(
"fieldlabel", 
null, 
"mark_step_$index");
 
 6556            $a_xml_writer->xmlElement(
"fieldentry", 
null, sprintf(
 
 6557                "<short>%s</short><official>%s</official><percentage>%.2f</percentage><passed>%d</passed>",
 
 6558                $mark->getShortName(),
 
 6559                $mark->getOfficialName(),
 
 6560                $mark->getMinimumLevel(),
 
 6563            $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6565        $a_xml_writer->xmlEndTag(
"qtimetadata");
 
 6568        $a_xml_writer->xmlStartTag(
"objectives");
 
 6570        $a_xml_writer->xmlEndTag(
"objectives");
 
 6575                "solutionswitch" => 
"Yes" 
 6580        $a_xml_writer->xmlElement(
"assessmentcontrol", $attrs, 
null);
 
 6584            $a_xml_writer->xmlStartTag(
"presentation_material");
 
 6585            $a_xml_writer->xmlStartTag(
"flow_mat");
 
 6587            $a_xml_writer->xmlEndTag(
"flow_mat");
 
 6588            $a_xml_writer->xmlEndTag(
"presentation_material");
 
 6594        $a_xml_writer->xmlElement(
"section", $attrs, 
null);
 
 6595        $a_xml_writer->xmlEndTag(
"assessment");
 
 6596        $a_xml_writer->xmlEndTag(
"questestinterop");
 
 6598        $xml = $a_xml_writer->xmlDumpMem(
false);
 
 6610        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $date_time, $matches);
 
 6611        $iso8601_period = sprintf(
"P%dY%dM%dDT%dH%dM%dS", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]);
 
 6612        return $iso8601_period;
 
 6626        $this->mob_ids = array();
 
 6627        $this->file_ids = array();
 
 6633        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Start Export Page Objects");
 
 6634        $ilBench->start(
"ContentObjectExport", 
"exportPageObjects");
 
 6636        $ilBench->stop(
"ContentObjectExport", 
"exportPageObjects");
 
 6637        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Finished Export Page Objects");
 
 6640        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Start Export Media Objects");
 
 6641        $ilBench->start(
"ContentObjectExport", 
"exportMediaObjects");
 
 6643        $ilBench->stop(
"ContentObjectExport", 
"exportMediaObjects");
 
 6644        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Finished Export Media Objects");
 
 6647        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Start Export File Items");
 
 6648        $ilBench->start(
"ContentObjectExport", 
"exportFileItems");
 
 6650        $ilBench->stop(
"ContentObjectExport", 
"exportFileItems");
 
 6651        $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Finished Export File Items");
 
 6662        include_once 
"./Services/MetaData/classes/class.ilMD2XML.php";
 
 6664        $md2xml->setExportMode(
true);
 
 6665        $md2xml->startExport();
 
 6666        $a_xml_writer->appendXML($md2xml->getXML());
 
 6676        if ($a_tag == 
"Identifier" && $a_param == 
"Entry") {
 
 6677            include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 6696        include_once 
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
 
 6698        foreach ($this->questions as $question_id) {
 
 6699            $ilBench->start(
"ContentObjectExport", 
"exportPageObject");
 
 6700            $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Page Object " . $question_id);
 
 6703            $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
 
 6707            $ilBench->start(
"ContentObjectExport", 
"exportPageObject_XML");
 
 6708            include_once 
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
 
 6710            $page_object->buildDom();
 
 6711            $page_object->insertInstIntoIDs($a_inst);
 
 6712            $mob_ids = $page_object->collectMediaObjects(
false);
 
 6713            require_once 
'Services/COPage/classes/class.ilPCFileList.php';
 
 6715            $xml = $page_object->getXMLFromDom(
false, 
false, 
false, 
"", 
true);
 
 6716            $xml = str_replace(
"&", 
"&", 
$xml);
 
 6717            $a_xml_writer->appendXML(
$xml);
 
 6718            $page_object->freeDom();
 
 6719            unset($page_object);
 
 6721            $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_XML");
 
 6724            $ilBench->start(
"ContentObjectExport", 
"exportPageObject_CollectMedia");
 
 6726            foreach ($mob_ids as $mob_id) {
 
 6727                $this->mob_ids[$mob_id] = $mob_id;
 
 6729            $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_CollectMedia");
 
 6732            $ilBench->start(
"ContentObjectExport", 
"exportPageObject_CollectFileItems");
 
 6734            foreach ($file_ids as $file_id) {
 
 6735                $this->file_ids[$file_id] = $file_id;
 
 6737            $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_CollectFileItems");
 
 6739            $a_xml_writer->xmlEndTag(
"PageObject");
 
 6742            $ilBench->stop(
"ContentObjectExport", 
"exportPageObject");
 
 6754        include_once 
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
 
 6756        foreach ($this->mob_ids as $mob_id) {
 
 6757            $expLog->write(date(
"[y-m-d H:i:s] ") . 
"Media Object " . $mob_id);
 
 6760                $media_obj->exportXML($a_xml_writer, $a_inst);
 
 6761                $media_obj->exportFiles($a_target_dir);
 
 6773        include_once 
"./Modules/File/classes/class.ilObjFile.php";
 
 6775        foreach ($this->file_ids as $file_id) {
 
 6776            $expLog->write(date(
"[y-m-d H:i:s] ") . 
"File Item " . $file_id);
 
 6777            $file_obj = 
new ilObjFile($file_id, 
false);
 
 6778            $file_obj->export($a_target_dir);
 
 6789        if (!is_array($this->import_mapping)) {
 
 6792            return $this->import_mapping;
 
 6817        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);
 
 6823    public static function _getECTSGrade($points_passed, $reached_points, $max_points, $a, $b, 
$c, 
$d, $e, $fx)
 
 6825        include_once 
"./Modules/Test/classes/class.ilStatistics.php";
 
 6828        $passed_statistics->setData($points_passed);
 
 6829        $ects_percentiles = array(
 
 6830            "A" => $passed_statistics->quantile($a),
 
 6831            "B" => $passed_statistics->quantile($b),
 
 6832            "C" => $passed_statistics->quantile(
$c),
 
 6833            "D" => $passed_statistics->quantile(
$d),
 
 6834            "E" => $passed_statistics->quantile($e)
 
 6836        if (count($points_passed) && ($reached_points >= $ects_percentiles[
"A"])) {
 
 6838        } elseif (count($points_passed) && ($reached_points >= $ects_percentiles[
"B"])) {
 
 6840        } elseif (count($points_passed) && ($reached_points >= $ects_percentiles[
"C"])) {
 
 6842        } elseif (count($points_passed) && ($reached_points >= $ects_percentiles[
"D"])) {
 
 6844        } elseif (count($points_passed) && ($reached_points >= $ects_percentiles[
"E"])) {
 
 6846        } elseif (strcmp($fx, 
"") != 0) {
 
 6847            if ($max_points > 0) {
 
 6848                $percentage = ($reached_points / $max_points) * 100.0;
 
 6849                if ($percentage < 0) {
 
 6855            if ($percentage >= $fx) {
 
 6870        return $this->mark_schema->checkMarks();
 
 6900        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 6903        require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 6920                if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getReportingDate(), $matches)) {
 
 6921                    $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 6923                    if ($now < $epoch_time) {
 
 6958        $md_life = &$md->getLifecycle();
 
 6960            if (strlen($a_author) == 0) {
 
 6963                $a_author = 
$ilUser->getFullname();
 
 6966            $md_life = &$md->addLifecycle();
 
 6968            $con = &$md_life->addContribute();
 
 6969            $con->setRole(
"Author");
 
 6971            $ent = &$con->addEntity();
 
 6972            $ent->setEntity($a_author);
 
 6984        parent::createMetaData();
 
 6998        include_once 
"./Services/MetaData/classes/class.ilMD.php";
 
 7000        $md_life = &$md->getLifecycle();
 
 7002            $ids = &$md_life->getContributeIds();
 
 7003            foreach ($ids as 
$id) {
 
 7004                $md_cont = &$md_life->getContribute(
$id);
 
 7005                if (strcmp($md_cont->getRole(), 
"Author") == 0) {
 
 7006                    $entids = &$md_cont->getEntityIds();
 
 7007                    foreach ($entids as $entid) {
 
 7008                        $md_ent = &$md_cont->getEntity($entid);
 
 7009                        array_push(
$author, $md_ent->getEntity());
 
 7027        include_once 
"./Services/MetaData/classes/class.ilMD.php";
 
 7028        $md = 
new ilMD($obj_id, 0, 
"tst");
 
 7029        $md_life = &$md->getLifecycle();
 
 7031            $ids = &$md_life->getContributeIds();
 
 7032            foreach ($ids as 
$id) {
 
 7033                $md_cont = &$md_life->getContribute(
$id);
 
 7034                if (strcmp($md_cont->getRole(), 
"Author") == 0) {
 
 7035                    $entids = &$md_cont->getEntityIds();
 
 7036                    foreach ($entids as $entid) {
 
 7037                        $md_ent = &$md_cont->getEntity($entid);
 
 7038                        array_push(
$author, $md_ent->getEntity());
 
 7058        $result_array = array();
 
 7070                if ($use_object_id) {
 
 7072                    $result_array[$obj_id] = $titles[
$ref_id];
 
 7078        return $result_array;
 
 7089    public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree = 
false)
 
 7093        $certificateLogger = 
$DIC->logger()->cert();
 
 7096        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 7102        $newObj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
 
 7103        $newObj->setTmpCopyWizardCopyId($a_copy_id);
 
 7109        if (!$cp_options->isRootNode($this->getRefId())) {
 
 7135        $newObj->setKiosk($this->
getKiosk());
 
 7190        $newObj->saveToDb();
 
 7199            $templateRepository,
 
 7200            $DIC->filesystem()->web(),
 
 7205        $cloneAction->cloneCertificate($this, $newObj);
 
 7208        $testQuestionSetConfigFactory->getQuestionSetConfig()->cloneQuestionSetRelatedData($newObj);
 
 7210        require_once 
'Modules/Test/classes/class.ilTestSkillLevelThresholdList.php';
 
 7212        $skillLevelThresholdList->setTestId($this->
getTestId());
 
 7213        $skillLevelThresholdList->loadFromDb();
 
 7214        $skillLevelThresholdList->cloneListForTest($newObj->getTestId());
 
 7216        $newObj->saveToDb();
 
 7217        $newObj->updateMetaData();
 
 7219        include_once(
'./Services/Tracking/classes/class.ilLPObjSettings.php');
 
 7221        $obj_settings->cloneSettings($newObj->getId());
 
 7240            $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 7249            $questionSetConfig->loadFromDb();
 
 7251            if ($questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
 
 7252                require_once 
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
 
 7253                require_once 
'Modules/Test/classes/class.ilTestRandomQuestionSetBuilderWithAmountPerPool.php';
 
 7254                require_once 
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
 
 7262                $sourcePoolDefinitionList->loadDefinitions();
 
 7264                $num = $sourcePoolDefinitionList->getQuestionAmount();
 
 7266                $num = $questionSetConfig->getQuestionAmountPerTest();
 
 7269            $num = count($this->questions);
 
 7288        if (strcmp($question_id, 
"") != 0) {
 
 7289            include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 7292        include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 7309            "SELECT obj_fi FROM tst_tests WHERE test_id = %s",
 
 7315            $object_id = 
$row[
"obj_fi"];
 
 7333            "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",
 
 7339            $object_id = 
$row[
"obj_fi"];
 
 7357            "SELECT test_id FROM tst_tests WHERE obj_fi = %s",
 
 7382        if (($active_id) && ($question_id)) {
 
 7383            if (is_null(
$pass)) {
 
 7384                include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 7388                "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
 7389                array(
'integer', 
'integer', 
'integer'),
 
 7390                array($active_id, $question_id, 
$pass)
 
 7392            if (
$result->numRows() == 1) {
 
 7415                "SELECT question_text FROM qpl_questions WHERE question_id = %s",
 
 7419            if (
$result->numRows() == 1) {
 
 7432        require_once 
'Modules/Test/classes/class.ilTestParticipantList.php';
 
 7436        return $participantList;
 
 7444        require_once 
'Modules/Test/classes/class.ilTestParticipantList.php';
 
 7448        return $participantList;
 
 7462        $result_array = array();
 
 7465            if (is_numeric($user_id)) {
 
 7467                    "SELECT tst_active.active_id, tst_active.tries, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
 
 7468                    "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 " .
 
 7469                    "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7470                    "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
 
 7472                    array(
'text', 
'text', 
'text', 
'integer', 
'integer'),
 
 7473                    array(
"", $this->lng->txt(
"anonymous"), 
"", $this->getTestId(), $user_id)
 
 7477                    "SELECT tst_active.active_id, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
 
 7478                    "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 " .
 
 7479                    "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7480                    "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
 
 7482                    array(
'text', 
'text', 
'text', 
'integer'),
 
 7483                    array(
"", $this->lng->txt(
"anonymous"), 
"", $this->getTestId())
 
 7487            if (is_numeric($user_id)) {
 
 7489                    "SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
 
 7490                    "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 " .
 
 7491                    "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7492                    "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
 
 7494                    array(
'integer', 
'integer'),
 
 7499                    "SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
 
 7500                    "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 " .
 
 7501                    "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7502                    "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
 
 7509        $result_array = array();
 
 7511            $result_array[
$row[
'usr_id']] = 
$row;
 
 7513        return $result_array;
 
 7529                                SELECT  tst_active.active_id, 
 7531                                                tst_active.user_fi usr_id, 
 7535                                                tst_active.submitted test_finished, 
 7536                                                usr_data.matriculation, 
 7538                                                tst_active.lastindex, 
 7539                                                COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes  
 7542                                ON tst_active.user_fi = usr_data.usr_id 
 7543                                WHERE tst_active.test_fi = %s 
 7544                                ORDER BY usr_data.lastname 
 7548                array(
'text', 
'text', 
'text', 
'integer'),
 
 7549                array(
"", $this->lng->txt(
"anonymous"), 
"", $this->getTestId())
 
 7553                                SELECT  tst_active.active_id, 
 7555                                                tst_active.user_fi usr_id, 
 7559                                                tst_active.submitted test_finished, 
 7560                                                usr_data.matriculation, 
 7562                                                tst_active.lastindex, 
 7563                                                COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes  
 7566                                ON tst_active.user_fi = usr_data.usr_id 
 7567                                WHERE tst_active.test_fi = %s 
 7568                                ORDER BY usr_data.lastname 
 7581            if (strlen(trim($participant[
"firstname"] . $participant[
"lastname"])) == 0) {
 
 7582                $data[
$index][
"lastname"] = $this->lng->txt(
"deleted_user");
 
 7593        include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 7595        if (count($scoring) == 0) {
 
 7600        $filtered_participants = array();
 
 7601        foreach ($participants as $active_id => $participant) {
 
 7602            $qstType_IN_manScoreableQstTypes = 
$ilDB->in(
'qpl_questions.question_type_fi', $scoring, 
false, 
'integer');
 
 7605                                SELECT          tst_test_result.manual 
 7607                                FROM            tst_test_result 
 7609                                INNER JOIN      qpl_questions 
 7610                                ON                      tst_test_result.question_fi = qpl_questions.question_id 
 7612                                WHERE           tst_test_result.active_fi = %s 
 7613                                AND                     $qstType_IN_manScoreableQstTypes 
 7627                        if ($participant->active) {
 
 7628                            $filtered_participants[$active_id] = $participant;
 
 7632                        if (!$participant->active) {
 
 7633                            $filtered_participants[$active_id] = $participant;
 
 7637                        $filtered_participants[$active_id] = $participant;
 
 7652                            $assessmentSetting = 
new ilSetting(
"assessment");
 
 7653                            $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
 
 7654                            if ($manscoring_done) {
 
 7655                                $filtered_participants[$active_id] = $participant;
 
 7668                            $assessmentSetting = 
new ilSetting(
"assessment");
 
 7669                            $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
 
 7670                            if (!$manscoring_done) {
 
 7671                                $filtered_participants[$active_id] = $participant;
 
 7679                            if (
$row[
"manual"]) {
 
 7683                        if (($found > 0) && ($found < $count)) {
 
 7684                            $filtered_participants[$active_id] = $participant;
 
 7688                        $filtered_participants[$active_id] = $participant;
 
 7693        return $filtered_participants;
 
 7708        if (!is_array($ids) || count($ids) == 0) {
 
 7714                "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",
 
 7715                array(
'text', 
'text', 
'text'),
 
 7716                array(
"", $this->lng->txt(
"anonymous"), 
"")
 
 7719            $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");
 
 7722        $result_array = array();
 
 7724            $result_array[
$row[
"usr_id"]] = 
$row;
 
 7726        return $result_array;
 
 7731        if (!is_array($ids) || count($ids) == 0) {
 
 7744        if (!is_array($ids) || count($ids) == 0) {
 
 7748        foreach ($ids as $obj_id) {
 
 7763        include_once 
"./Modules/Group/classes/class.ilObjGroup.php";
 
 7765        $members = $group->getGroupMemberIds();
 
 7766        include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 7767        foreach ($members as $user_id) {
 
 7783        include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 7784        foreach ($members as $user_id) {
 
 7802        $affectedRows = 
$ilDB->manipulateF(
 
 7803            "DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
 
 7804            array(
'integer', 
'integer'),
 
 7820        $affectedRows = 
$ilDB->manipulateF(
 
 7821            "DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
 
 7822            array(
'integer', 
'integer'),
 
 7825        $affectedRows = 
$ilDB->manipulateF(
 
 7826            "INSERT INTO tst_invited_user (test_fi, user_fi, clientip, tstamp) VALUES (%s, %s, %s, %s)",
 
 7827            array(
'integer', 
'integer', 
'text', 
'integer'),
 
 7828            array($this->
getTestId(), $user_id, (strlen($client_ip)) ? $client_ip : 
null, time())
 
 7838        $affectedRows = 
$ilDB->manipulateF(
 
 7839            "UPDATE tst_invited_user SET clientip = %s, tstamp = %s WHERE test_fi=%s and user_fi=%s",
 
 7840            array(
'text', 
'integer', 
'integer', 
'integer'),
 
 7841            array((strlen($client_ip)) ? $client_ip : 
null, time(), $this->
getTestId(), $user_id)
 
 7854        if (is_numeric($question_fi)) {
 
 7856                "SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s AND question_fi=%s",
 
 7857                array(
'integer', 
'integer'),
 
 7858                array($active_id, $question_fi)
 
 7862                "SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s",
 
 7867        $result_array = array();
 
 7869            $result_array[
$row[
"question_fi"]] = 
$row;
 
 7871        return $result_array;
 
 7884        $affectedRows = 
$ilDB->manipulateF(
 
 7885            "DELETE FROM tst_qst_solved WHERE active_fi = %s AND question_fi = %s",
 
 7886            array(
'integer', 
'integer'),
 
 7887            array($active_id, $question_id)
 
 7889        $affectedRows = 
$ilDB->manipulateF(
 
 7890            "INSERT INTO tst_qst_solved (solved, question_fi, active_fi) VALUES (%s, %s, %s)",
 
 7891            array(
'integer', 
'integer', 
'integer'),
 
 7892            array($value, $question_id, $active_id)
 
 7905            "SELECT submitted FROM tst_active WHERE active_id=%s AND submitted=%s",
 
 7906            array(
'integer', 
'integer'),
 
 7907            array($active_id, 1)
 
 7909        return $result->numRows() == 1;
 
 7921        if (!is_numeric($user_id)) {
 
 7926            "SELECT submitted FROM tst_active WHERE test_fi=%s AND user_fi=%s AND submitted=%s",
 
 7927            array(
'integer', 
'integer', 
'integer'),
 
 7930        return $result->numRows() == 1;
 
 7965            "user_id" => $this->lng->txt(
"user_id"),
 
 7966            "matriculation" => $this->lng->txt(
"matriculation"),
 
 7967            "lastname" => $this->lng->txt(
"lastname"),
 
 7968            "firstname" => $this->lng->txt(
"firstname"),
 
 7969            "login" => $this->lng->txt(
"login"),
 
 7970            "reached_points" => $this->lng->txt(
"tst_reached_points"),
 
 7971            "max_points" => $this->lng->txt(
"tst_maximum_points"),
 
 7972            "percent_value" => $this->lng->txt(
"tst_percent_solved"),
 
 7973            "mark" => $this->lng->txt(
"tst_mark"),
 
 7974            "ects" => $this->lng->txt(
"ects_grade")
 
 7977        if (count($participants)) {
 
 7981            foreach ($participants as $active_id => $user_rec) {
 
 7982                $mark = $ects_mark = 
'';
 
 7984                $reached_points = 0;
 
 7986                foreach ($this->questions as $value) {
 
 7988                    if (is_object($question)) {
 
 7989                        $max_points += $question->getMaximumPoints();
 
 7990                        $reached_points += $question->getReachedPoints($active_id);
 
 7993                if ($max_points > 0) {
 
 7994                    $percentvalue = $reached_points / $max_points;
 
 7995                    if ($percentvalue < 0) {
 
 7996                        $percentvalue = 0.0;
 
 8001                $mark_obj = $this->mark_schema->getMatchingMark($percentvalue * 100);
 
 8004                    $mark = $mark_obj->getOfficialName();
 
 8006                        $ects_mark = $this->
getECTSGrade($passed_array, $reached_points, $max_points);
 
 8010                    $user_rec[
'firstname'] = 
"";
 
 8011                    $user_rec[
'lastname'] = $this->lng->txt(
"anonymous");
 
 8014                    "user_id" => $user_rec[
'usr_id'],
 
 8015                    "matriculation" => $user_rec[
'matriculation'],
 
 8016                    "lastname" => $user_rec[
'lastname'],
 
 8017                    "firstname" => $user_rec[
'firstname'],
 
 8018                    "login" => $user_rec[
'login'],
 
 8019                    "reached_points" => $reached_points,
 
 8020                    "max_points" => $max_points,
 
 8021                    "percent_value" => $percentvalue,
 
 8023                    "ects" => $ects_mark
 
 8043        $resultarray = array();
 
 8044        foreach (
$row as $rowindex => $entry) {
 
 8049            if (strpos($entry, 
"\"") !== 
false) {
 
 8050                $entry = str_replace(
"\"", 
"\"\"", $entry);
 
 8053            if (strpos($entry, $separator) !== 
false) {
 
 8057            $entry = str_replace(chr(13) . chr(10), chr(10), $entry);
 
 8060                $entry = 
"\"" . $entry . 
"\"";
 
 8063            $resultarray[$rowindex] = $entry;
 
 8065        return $resultarray;
 
 8081            "SELECT tries FROM tst_active WHERE active_id = %s",
 
 8087            return $row[
"tries"];
 
 8107            "SELECT MAX(pass) maxpass FROM tst_pass_result WHERE active_fi = %s",
 
 8113            $max = 
$row[
"maxpass"];
 
 8131            "SELECT * FROM tst_pass_result WHERE active_fi = %s",
 
 8139                if (
$row[
"maxpoints"] > 0) {
 
 8140                    $factor = 
$row[
"points"] / 
$row[
"maxpoints"];
 
 8145                if ($factor > $bestfactor) {
 
 8147                    $bestfactor = $factor;
 
 8150            if (is_array($bestrow)) {
 
 8151                return $bestrow[
"pass"];
 
 8170        $counted_pass = 
null;
 
 8176        return $counted_pass;
 
 8195            $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
 8197            require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
 8199            $testSession = $testSessionFactory->getSession($active_id);
 
 8201            require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 8205            require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 8207            $dynamicQuestionSetConfig->loadFromDb();
 
 8218        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 8220        foreach ($this->questions as $value) {
 
 8222                $workedthrough += 1;
 
 8225        return $workedthrough;
 
 8239        if (is_null(
$pass)) {
 
 8244                        SELECT  tst_pass_result.tstamp pass_res_tstamp, 
 8245                                        tst_test_result.tstamp quest_res_tstamp 
 8247                        FROM tst_pass_result 
 8249                        LEFT JOIN tst_test_result 
 8250                        ON tst_test_result.active_fi = tst_pass_result.active_fi 
 8251                        AND tst_test_result.pass = tst_pass_result.pass 
 8253                        WHERE tst_pass_result.active_fi = %s 
 8254                        AND tst_pass_result.pass = %s 
 8256                        ORDER BY tst_test_result.tstamp DESC 
 8261            array(
'integer', 
'integer'),
 
 8262            array($active_id, 
$pass)
 
 8266            if (
$row[
'qres_tstamp']) {
 
 8267                return $row[
'quest_res_tstamp'];
 
 8270            return $row[
'pass_res_tstamp'];
 
 8287            "executable" => 
true,
 
 8288            "errormessage" => 
"" 
 8291            $result[
"executable"] = 
false;
 
 8296            $result[
"executable"] = 
false;
 
 8304            if ($active_id > 0) {
 
 8318                            $result[
"executable"] = 
false;
 
 8319                            $result[
"errormessage"] = $this->lng->txt(
"detail_max_processing_time_reached");
 
 8327        require_once 
'Modules/Test/classes/class.ilTestPassesSelector.php';
 
 8329        $testPassesSelector->setActiveId($active_id);
 
 8330        $testPassesSelector->setLastFinishedPass(
$testSession->getLastFinishedPass());
 
 8333            $closedPasses = $testPassesSelector->getClosedPasses();
 
 8336                $result[
"executable"] = 
false;
 
 8337                $result[
"errormessage"] = $this->lng->txt(
"maximum_nr_of_tries_reached");
 
 8342            $lastPass = $testPassesSelector->getLastFinishedPassTimestamp();
 
 8345                $time_values = explode(
":", $pass_waiting_string);
 
 8346                $next_pass_allowed = strtotime(
'+ ' . $time_values[0] . 
' Months + ' . $time_values[1] . 
' Days + ' . $time_values[2] . 
' Hours' . $time_values[3] . 
' Minutes', $lastPass);
 
 8348                if (time() < $next_pass_allowed) {
 
 8351                    $result[
"executable"] = 
false;
 
 8352                    $result[
"errormessage"] = sprintf($this->lng->txt(
'wait_for_next_pass_hint_msg'), $date);
 
 8365        require_once 
'Modules/Test/classes/class.ilTestPassesSelector.php';
 
 8368        $passSelector->setActiveId(
$testSession->getActiveId());
 
 8369        $passSelector->setLastFinishedPass(
$testSession->getLastFinishedPass());
 
 8371        return $passSelector->hasReportablePasses();
 
 8378        require_once 
'Modules/Test/classes/class.ilTestPassesSelector.php';
 
 8381        $passSelector->setActiveId(
$testSession->getActiveId());
 
 8382        $passSelector->setLastFinishedPass(
$testSession->getLastFinishedPass());
 
 8384        return $passSelector->hasExistingPasses();
 
 8399        if ($active_id < 1) {
 
 8402        if (
$pass === 
null) {
 
 8406            "SELECT tst_times.started FROM tst_times WHERE tst_times.active_fi = %s AND tst_times.pass = %s ORDER BY tst_times.started",
 
 8407            array(
'integer', 
'integer'),
 
 8408            array($active_id, 
$pass)
 
 8412            if (preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"started"], $matches)) {
 
 8413                return mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 8452                                                questtypes.type_tag, 
 8454                                                tstquest.obligatory, 
 8455                                                origquest.obj_fi orig_obj_fi 
 8457                        FROM            qpl_questions questions 
 8459                        INNER JOIN      qpl_qst_type questtypes 
 8460                        ON                      questtypes.question_type_id = questions.question_type_fi 
 8462                        INNER JOIN      tst_test_question tstquest 
 8463                        ON                      tstquest.question_fi = questions.question_id 
 8465                        LEFT JOIN       qpl_questions origquest 
 8466                        ON                      origquest.question_id = questions.original_id 
 8468                        WHERE           tstquest.test_fi = %s 
 8470                        ORDER BY        tstquest.sequence 
 8473        $query_result = 
$ilDB->queryF(
 
 8481        while (
$row = 
$ilDB->fetchAssoc($query_result)) {
 
 8499            if ($questionData[
'question_id'] != $questionId) {
 
 8513        $row = 
$DIC->database()->fetchAssoc(
$DIC->database()->queryF(
 
 8514            "SELECT COUNT(question_id) cnt FROM qpl_questions WHERE question_id = %s AND obj_fi = %s",
 
 8515            array(
'integer', 
'integer'),
 
 8516            array($questionId, $this->
getId())
 
 8519        return (
bool) 
$row[
'cnt'];
 
 8530            $points += $questionData[
'points'];
 
 8541        $totalWorkingTime = 
'00:00:00';
 
 8546                $questionData[
'working_time']
 
 8550        return $totalWorkingTime;
 
 8556    public function getPotentialRandomTestQuestions()
 
 8566                                                questtypes.type_tag, 
 8567                                                origquest.obj_fi orig_obj_fi 
 8569                        FROM            qpl_questions questions 
 8571                        INNER JOIN      qpl_qst_type questtypes 
 8572                        ON                      questtypes.question_type_id = questions.question_type_fi 
 8574                        INNER JOIN      tst_rnd_cpy tstquest 
 8575                        ON                      tstquest.qst_fi = questions.question_id 
 8577                        LEFT JOIN       qpl_questions origquest 
 8578                        ON                      origquest.question_id = questions.original_id 
 8580                        WHERE           tstquest.tst_fi = %s 
 8583        $query_result = 
$ilDB->queryF(
 
 8591        while (
$row = 
$ilDB->fetchAssoc($query_result)) {
 
 8610        return ($this->shuffle_questions) ? 1 : 0;
 
 8621        $this->shuffle_questions = ($a_shuffle) ? 1 : 0;
 
 8638        return ($this->show_summary) ? $this->show_summary : 0;
 
 8655        $this->show_summary = $a_value;
 
 8666        if (($this->show_summary & 1) > 0) {
 
 8682            $this->show_summary = 1;
 
 8684            $this->show_summary = 0;
 
 8696        if (($this->show_summary & 2) > 0) {
 
 8712            $this->show_summary = $this->show_summary | 2;
 
 8716                $this->show_summary = $this->show_summary ^ 2;
 
 8729        if (($this->show_summary & 4) > 0) {
 
 8745            $this->show_summary = $this->show_summary | 4;
 
 8749                $this->show_summary = $this->show_summary ^ 4;
 
 8762        if (($this->show_summary & 8) > 0) {
 
 8778            $this->show_summary = $this->show_summary | 8;
 
 8782                $this->show_summary = $this->show_summary ^ 8;
 
 8795        return ($this->results_presentation) ? $this->results_presentation : 0;
 
 8806        if (($this->results_presentation & 1) > 0) {
 
 8821        if (($this->results_presentation & 2) > 0) {
 
 8836        if (($this->results_presentation & 4) > 0) {
 
 8851        if (($this->results_presentation & 8) > 0) {
 
 8866        if (($this->results_presentation & 16) > 0) {
 
 8881        if (($this->results_presentation & 32) > 0) {
 
 8894        if (($this->results_presentation & 64) > 0) {
 
 8907        if (($this->results_presentation & 128) > 0) {
 
 8922        $this->results_presentation = $a_results_presentation;
 
 8936            $this->results_presentation = $this->results_presentation | 1;
 
 8939                $this->results_presentation = $this->results_presentation ^ 1;
 
 8953            $this->results_presentation = $this->results_presentation | 2;
 
 8956                $this->results_presentation = $this->results_presentation ^ 2;
 
 8981            $this->results_presentation = $this->results_presentation | 4;
 
 8984                $this->results_presentation = $this->results_presentation ^ 4;
 
 8998            $this->results_presentation = $this->results_presentation | 8;
 
 9001                $this->results_presentation = $this->results_presentation ^ 8;
 
 9015            $this->results_presentation = $this->results_presentation | 16;
 
 9018                $this->results_presentation = $this->results_presentation ^ 16;
 
 9032            $this->results_presentation = $this->results_presentation | 32;
 
 9035                $this->results_presentation = $this->results_presentation ^ 32;
 
 9049            $this->results_presentation = $this->results_presentation | 64;
 
 9052                $this->results_presentation = $this->results_presentation ^ 64;
 
 9064        if ($a_comparison) {
 
 9065            $this->results_presentation = $this->results_presentation | 128;
 
 9068                $this->results_presentation = $this->results_presentation ^ 128;
 
 9081            "SELECT user_fi FROM tst_active WHERE active_id = %s",
 
 9087            return $row[
"user_fi"];
 
 9111        return ($this->allowedUsers) ? $this->allowedUsers : 0;
 
 9116        $this->allowedUsers = $a_allowed_users;
 
 9121        return ($this->allowedUsersTimeGap) ? $this->allowedUsersTimeGap : 0;
 
 9126        $this->allowedUsersTimeGap = $a_allowed_users_time_gap;
 
 9136        if (($nr_of_users > 0) && ($time_gap > 0)) {
 
 9138            $time_border = $now - $time_gap;
 
 9139            $str_time_border = strftime(
"%Y%m%d%H%M%S", $time_border);
 
 9141                                SELECT DISTINCT tst_times.active_fi 
 9143                                INNER JOIN tst_active 
 9144                                ON tst_times.active_fi = tst_active.active_id 
 9146                                        tst_times.pass > tst_active.last_finished_pass OR tst_active.last_finished_pass IS NULL 
 9148                                WHERE tst_times.tstamp > %s 
 9149                                AND tst_active.test_fi = %s 
 9152            if (
$result->numRows() >= $nr_of_users) {
 
 9153                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 9171            "SELECT finished FROM tst_times WHERE active_fi = %s ORDER BY finished DESC",
 
 9177            return $row[
"finished"];
 
 9187            SELECT MAX(tst_times.tstamp) as last_pass_access 
 9189            WHERE active_fi = %s 
 9195            array(
'integer', 
'integer'),
 
 9196            array($activeId, $passIndex)
 
 9200            return $row[
'last_pass_access'];
 
 9215        if (preg_match(
"/<[^>]*?>/", $a_text)) {
 
 9232        for (
$i = 0; 
$i < $a_material->getMaterialCount(); 
$i++) {
 
 9233            $material = $a_material->getMaterial(
$i);
 
 9234            if (strcmp($material[
"type"], 
"mattext") == 0) {
 
 9235                $result .= $material[
"material"]->getContent();
 
 9237            if (strcmp($material[
"type"], 
"matimage") == 0) {
 
 9238                $matimage = $material[
"material"];
 
 9239                if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches)) {
 
 9241                    if (!is_array(
$_SESSION[
"import_mob_xhtml"])) {
 
 9242                        $_SESSION[
"import_mob_xhtml"] = array();
 
 9244                    array_push(
$_SESSION[
"import_mob_xhtml"], array(
"mob" => $matimage->getLabel(), 
"uri" => $matimage->getUri()));
 
 9264        include_once 
"./Services/RTE/classes/class.ilRTE.php";
 
 9265        include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 9267        $a_xml_writer->xmlStartTag(
"material");
 
 9269            "texttype" => 
"text/plain" 
 9271        if ($this->
isHTML($a_material)) {
 
 9272            $attrs[
"texttype"] = 
"text/xhtml";
 
 9277        foreach (
$mobs as $mob) {
 
 9278            $moblabel = 
"il_" . IL_INST_ID . 
"_mob_" . $mob;
 
 9279            if (strpos($a_material, 
"mm_$mob") !== 
false) {
 
 9283                        "label" => $moblabel,
 
 9284                        "uri" => 
"objects/" . 
"il_" . IL_INST_ID . 
"_mob_" . $mob . 
"/" . $mob_obj->getTitle()
 
 9287                $a_xml_writer->xmlElement(
"matimage", $imgattrs, 
null);
 
 9290        $a_xml_writer->xmlEndTag(
"material");
 
 9301        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 9316        $affectedRows = 
$ilDB->manipulateF(
 
 9317            "UPDATE tst_tests SET certificate_visibility = %s, tstamp = %s WHERE test_id = %s",
 
 9318            array(
'text', 
'integer', 
'integer'),
 
 9319            array($a_value, time(), $this->
getTestId())
 
 9331        return (strlen($this->certificate_visibility)) ? $this->certificate_visibility : 0;
 
 9342        $this->certificate_visibility = $a_value;
 
 9353        return ($this->anonymity) ? 1 : 0;
 
 9366                $this->anonymity = 1;
 
 9369                $this->anonymity = 0;
 
 9382        return ($this->show_cancel) ? 1 : 0;
 
 9395                $this->show_cancel = 1;
 
 9398                $this->show_cancel = 0;
 
 9411        return ($this->show_marker) ? 1 : 0;
 
 9424                $this->show_marker = 1;
 
 9427                $this->show_marker = 0;
 
 9440        return ($this->fixed_participants) ? 1 : 0;
 
 9453                $this->fixed_participants = 1;
 
 9456                $this->fixed_participants = 0;
 
 9474            "SELECT anonymity FROM tst_tests WHERE obj_fi = %s",
 
 9479            return $row[
'anonymity'];
 
 9496                        SELECT          tst_tests.question_set_type 
 9498                        INNER JOIN      tst_tests 
 9499                        ON                      tst_active.test_fi = tst_tests.test_id 
 9500                        WHERE           tst_active.active_id = %s 
 9506            return $row[
'question_set_type'];
 
 9522        throw new Exception(__METHOD__ . 
' is deprecated ... use ilObjTest::lookupQuestionSetTypeByActiveId() instead!');
 
 9528            "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",
 
 9533            return $row[
'random_test'];
 
 9548    public function userLookupFullName($user_id, $overwrite_anonymity = 
false, $sorted_order = 
false, $suffix = 
"")
 
 9551            return $this->lng->txt(
"anonymous") . $suffix;
 
 9553            include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 9555            if (strlen($uname[
"firstname"] . $uname[
"lastname"]) == 0) {
 
 9556                $uname[
"firstname"] = $this->lng->txt(
"deleted_user");
 
 9558            if ($sorted_order) {
 
 9559                return trim($uname[
"lastname"] . 
", " . $uname[
"firstname"]) . $suffix;
 
 9561                return trim($uname[
"firstname"] . 
" " . $uname[
"lastname"]) . $suffix;
 
 9576            return $this->lng->txt(
"tst_start_test");
 
 9581            if ($active_pass == 0) {
 
 9582                return $this->lng->txt(
"tst_start_test");
 
 9584                return $this->lng->txt(
"tst_start_new_test_pass");
 
 9587            return $this->lng->txt(
"tst_resume_test");
 
 9596    public function getAvailableDefaults()
 
 9607            "SELECT * FROM tst_test_defaults WHERE user_fi = %s ORDER BY name ASC",
 
 9611        $defaults = array();
 
 9613            $defaults[
$row[
"test_defaults_id"]] = 
$row;
 
 9636            "SELECT * FROM tst_test_defaults WHERE test_defaults_id = %s",
 
 9638            array($test_defaults_id)
 
 9640        if (
$result->numRows() == 1) {
 
 9658        $affectedRows = 
$ilDB->manipulateF(
 
 9659            "DELETE FROM tst_test_defaults WHERE test_defaults_id = %s",
 
 9661            array($test_default_id)
 
 9676        $testsettings = array(
 
 9770        $next_id = 
$ilDB->nextId(
'tst_test_defaults');
 
 9772            'tst_test_defaults',
 
 9774                'test_defaults_id' => array(
'integer', $next_id),
 
 9775                'name' => array(
'text', $a_name),
 
 9776                'user_fi' => array(
'integer', 
$ilUser->getId()),
 
 9777                'defaults' => array(
'clob', serialize($testsettings)),
 
 9778                'marks' => array(
'clob', serialize($this->mark_schema)),
 
 9779                'tstamp' => array(
'integer', time())
 
 9793        $testsettings = unserialize($test_defaults[
"defaults"]);
 
 9794        include_once 
"./Modules/Test/classes/class.assMarkSchema.php";
 
 9795        $this->mark_schema = unserialize($test_defaults[
"marks"]);
 
 9829        $this->
setKiosk($testsettings[
"Kiosk"]);
 
 9833        $this->
setECTSFX($testsettings[
"ECTSFX"]);
 
 9835        if (isset($testsettings[
"isRandomTest"])) {
 
 9836            if ($testsettings[
"isRandomTest"]) {
 
 9841        } elseif (isset($testsettings[
"questionSetType"])) {
 
 9863        if (isset($testsettings[
'examid_in_kiosk'])) {
 
 9868        if (isset($testsettings[
'show_exam_id'])) {
 
 9922        if (extension_loaded(
"tidy")) {
 
 9925                "output-xml" => 
true,
 
 9926                "numeric-entities" => 
true 
 9929            $tidy->parseString($print_output, 
$config, 
'utf8');
 
 9930            $tidy->cleanRepair();
 
 9931            $print_output = tidy_get_output($tidy);
 
 9932            $print_output = preg_replace(
"/^.*?(<html)/", 
"\\1", $print_output);
 
 9934            $print_output = str_replace(
" ", 
" ", $print_output);
 
 9935            $print_output = str_replace(
"⊗", 
"X", $print_output);
 
 9937        $xsl = file_get_contents(
"./Modules/Test/xml/question2fo.xsl");
 
 9942            'font-family="Helvetica, unifont"',
 
 9943            'font-family="' . 
$DIC[
'ilSetting']->
get(
'rpc_pdf_font', 
'Helvetica, unifont') . 
'"',
 
 9947        $args = array( 
'/_xml' => $print_output, 
'/_xsl' => $xsl );
 
 9950        $output = xslt_process($xh, 
"arg:/_xml", 
"arg:/_xsl", 
null, $args, 
$params);
 
 9964        $content = preg_replace(
"/href=\".*?\"/", 
"", $content);
 
 9965        $printbody = 
new ilTemplate(
"tpl.il_as_tst_print_body.html", 
true, 
true, 
"Modules/Test");
 
 9967        $printbody->setVariable(
"ADM_CONTENT", $content);
 
 9968        $printbody->setCurrentBlock(
"css_file");
 
 9970        $printbody->parseCurrentBlock();
 
 9971        $printbody->setCurrentBlock(
"css_file");
 
 9973        $printbody->parseCurrentBlock();
 
 9974        $printoutput = $printbody->get();
 
 9975        $html = str_replace(
"href=\"./", 
"href=\"" . ILIAS_HTTP_PATH . 
"/", $printoutput);
 
 9976        $html = preg_replace(
"/<div id=\"dontprint\">.*?<\\/div>/ims", 
"", 
$html);
 
 9977        if (extension_loaded(
"tidy")) {
 
 9980                "output-xml" => 
true,
 
 9981                "numeric-entities" => 
true 
 9985            $tidy->cleanRepair();
 
 9986            $html = tidy_get_output($tidy);
 
 9987            $html = preg_replace(
"/^.*?(<html)/", 
"\\1", 
$html);
 
 9989            $html = str_replace(
" ", 
" ", 
$html);
 
 9992        $html = preg_replace(
"/src=\".\\//ims", 
"src=\"" . ILIAS_HTTP_PATH . 
"/", 
$html);
 
10007        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
10009        $fp = fopen($fo_file, 
"w");
 
10013        include_once 
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
 
10019        } 
catch (Exception $e) {
 
10020            $ilLog->write(__METHOD__ . 
': ' . $e->getMessage());
 
10040            "SELECT feedback FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
10041            array(
'integer', 
'integer', 
'integer'),
 
10042            array($active_id, $question_id, 
$pass)
 
10046            include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
10062    public function saveManualFeedback($active_id, $question_id, 
$pass, $feedback)
 
10067        $affectedRows = 
$ilDB->manipulateF(
 
10068            "DELETE FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
10069            array(
'integer', 
'integer', 
'integer'),
 
10070            array($active_id, $question_id, 
$pass)
 
10073        if (strlen($feedback)) {
 
10074            $next_id = 
$ilDB->nextId(
'tst_manual_fb');
 
10079                                                       'manual_feedback_id' => array( 
'integer',        $next_id ),
 
10080                                                       'active_fi' => array( 
'integer',         $active_id ),
 
10081                                                       'question_fi' => array( 
'integer',       $question_id ),
 
10082                                                       'pass' => array( 
'integer',      
$pass),
 
10084                                                       'tstamp' => array( 
'integer',    time() ),
 
10087            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
10092                include_once 
"./Modules/Test/classes/class.ilObjTestAccess.php";
 
10094                include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
10122        include_once 
"./Modules/Test/classes/class.ilTestSequence.php";
 
10133        $this->test_id = $a_id;
 
10147        if (count($participants)) {
 
10148            foreach ($participants as $active_id => $user_rec) {
 
10150                $reached_points = 0;
 
10152                foreach ($this->questions as $value) {
 
10154                    if (is_object($question)) {
 
10155                        $max_points += $question->getMaximumPoints();
 
10156                        $reached_points += $question->getReachedPoints($active_id);
 
10157                        if ($max_points > 0) {
 
10158                            $percentvalue = $reached_points / $max_points;
 
10159                            if ($percentvalue < 0) {
 
10160                                $percentvalue = 0.0;
 
10166                            $user_rec[
'firstname'] = 
"";
 
10167                            $user_rec[
'lastname'] = $this->lng->txt(
"anonymous");
 
10170                            "user_id" => $user_rec[
'usr_id'],
 
10171                            "matriculation" => $user_rec[
'matriculation'],
 
10172                            "lastname" => $user_rec[
'lastname'],
 
10173                            "firstname" => $user_rec[
'firstname'],
 
10174                            "login" => $user_rec[
'login'],
 
10175                            "question_id" => $question->getId(),
 
10176                            "question_title" => $question->getTitle(),
 
10177                            "reached_points" => $reached_points,
 
10178                            "max_points" => $max_points
 
10197            "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",
 
10202        return $rec[
"obj_id"];
 
10214        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
10215        if ($ilPluginAdmin->isActive(
IL_COMP_MODULE, 
"TestQuestionPool", 
"qst", $a_pname)) {
 
10228            "SELECT passed FROM tst_result_cache WHERE active_fi = %s",
 
10234            return $row[
'passed'];
 
10237            $result_array = &$this->
getTestResult($active_id, $counted_pass);
 
10238            return $result_array[
"test"][
"passed"];
 
10254            if ($cert->isComplete()) {
 
10286    public function getParticipantsForTestAndQuestion(
$test_id, $question_id)
 
10293                        SELECT tst_test_result.active_fi, tst_test_result.question_fi, tst_test_result.pass  
10294                        FROM tst_test_result 
10295                        INNER JOIN tst_active ON tst_active.active_id = tst_test_result.active_fi AND tst_active.test_fi = %s  
10296                        INNER JOIN qpl_questions ON qpl_questions.question_id = tst_test_result.question_fi 
10297                        LEFT JOIN usr_data ON usr_data.usr_id = tst_active.user_fi 
10298                        WHERE tst_test_result.question_fi = %s 
10299                        ORDER BY usr_data.lastname ASC, usr_data.firstname ASC 
10304            array(
'integer', 
'integer'),
 
10307        $foundusers = array();
 
10314            if (!array_key_exists(
$row[
"active_fi"], $foundusers)) {
 
10315                $foundusers[
$row[
"active_fi"]] = array();
 
10317            array_push($foundusers[
$row[
"active_fi"]], array(
"pass" => 
$row[
"pass"], 
"qid" => 
$row[
"question_fi"]));
 
10319        return $foundusers;
 
10330        $foundParticipants = &
$data->getParticipants();
 
10331        $results = array(
"overview" => array(), 
"questions" => array());
 
10332        if (count($foundParticipants)) {
 
10333            $results[
"overview"][$this->lng->txt(
"tst_eval_total_persons")] = count($foundParticipants);
 
10334            $total_finished = 
$data->getTotalFinishedParticipants();
 
10335            $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished")] = $total_finished;
 
10337            $diff_seconds = $average_time;
 
10338            $diff_hours = floor($diff_seconds / 3600);
 
10339            $diff_seconds -= $diff_hours * 3600;
 
10340            $diff_minutes = floor($diff_seconds / 60);
 
10341            $diff_seconds -= $diff_minutes * 60;
 
10342            $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
 
10344            $total_passed_reached = 0;
 
10345            $total_passed_max = 0;
 
10346            $total_passed_time = 0;
 
10347            foreach ($foundParticipants as $userdata) {
 
10348                if ($userdata->getPassed()) {
 
10350                    $total_passed_reached += $userdata->getReached();
 
10351                    $total_passed_max += $userdata->getMaxpoints();
 
10352                    $total_passed_time += $userdata->getTimeOfWork();
 
10355            $average_passed_reached = $total_passed ? $total_passed_reached / $total_passed : 0;
 
10356            $average_passed_max = $total_passed ? $total_passed_max / $total_passed : 0;
 
10357            $average_passed_time = $total_passed ? $total_passed_time / $total_passed : 0;
 
10358            $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed")] = $total_passed;
 
10359            $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);
 
10360            $average_time = $average_passed_time;
 
10361            $diff_seconds = $average_time;
 
10362            $diff_hours = floor($diff_seconds / 3600);
 
10363            $diff_seconds -= $diff_hours * 3600;
 
10364            $diff_minutes = floor($diff_seconds / 60);
 
10365            $diff_seconds -= $diff_minutes * 60;
 
10366            $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
 
10369        foreach (
$data->getQuestionTitles() as $question_id => $question_title) {
 
10373            foreach ($foundParticipants as $userdata) {
 
10374                for (
$i = 0; 
$i <= $userdata->getLastPass(); 
$i++) {
 
10375                    if (is_object($userdata->getPass(
$i))) {
 
10376                        $question = &$userdata->getPass(
$i)->getAnsweredQuestionByQuestionId($question_id);
 
10377                        if (is_array($question)) {
 
10379                            $reached += $question[
"reached"];
 
10380                            $max += $question[
"points"];
 
10385            $percent = $max ? $reached / $max * 100.0 : 0;
 
10386            $results[
"questions"][$question_id] = array(
 
10388                sprintf(
"%.2f", $answered ? $reached / $answered : 0) . 
" " . strtolower($this->lng->txt(
"of")) . 
" " . sprintf(
"%.2f", $answered ? $max / $answered : 0),
 
10389                sprintf(
"%.2f", $percent) . 
"%",
 
10391                sprintf(
"%.2f", $answered ? $reached / $answered : 0),
 
10392                sprintf(
"%.2f", $answered ? $max / $answered : 0),
 
10404        require_once 
'Modules/Test/classes/class.ilTestExportFactory.php';
 
10406        $test_exp = $expFactory->getExporter(
'xml');
 
10407        return $test_exp->buildExportFile();
 
10425        $this->mailnotification = $a_notification;
 
10430        include_once 
"./Modules/Test/classes/class.ilTestMailNotification.php";
 
10435        $mail->sendSimpleNotification($owner_id, $this->
getTitle(), $usr_data);
 
10445        include_once 
"./Modules/Test/classes/class.ilObjTestGUI.php";
 
10446        include_once 
"./Modules/Test/classes/tables/class.ilEvaluationAllTableGUI.php";
 
10448        return $table_gui->getSelectedColumns();
 
10453        include_once 
"./Modules/Test/classes/class.ilTestMailNotification.php";
 
10462        require_once 
'Modules/Test/classes/class.ilTestExportFactory.php';
 
10464        $exportObj = $expFactory->getExporter(
'results');
 
10465        $exportObj->setForcedAccessFilteredParticipantList($participantList);
 
10466        $file = $exportObj->exportToExcel($deliver = 
false, 
'active_id', $active_id, $passedonly = 
false);
 
10467        include_once 
"./Services/Mail/classes/class.ilFileDataMail.php";
 
10469        $fd->copyAttachmentFile($file, 
"result_" . $active_id . 
".xls");
 
10470        $file_names[] = 
"result_" . $active_id . 
".xls";
 
10472        $mail->sendAdvancedNotification($owner_id, $this->
getTitle(), $usr_data, $file_names);
 
10474        if (count($file_names)) {
 
10475            $fd->unlinkFiles($file_names);
 
10487        $query = 
"SELECT usr_id FROM usr_data";
 
10490            $activequery = sprintf(
 
10491                "SELECT user_fi FROM tst_active WHERE test_fi = %s AND user_fi = %s",
 
10492                $ilDB->quote($this->getTestId()),
 
10495            $activeresult = 
$ilDB->query($activequery);
 
10496            if ($activeresult->numRows() == 0) {
 
10497                $user_id = 
$data[
'usr_id'];
 
10498                if ($user_id != 13) {
 
10499                    include_once 
"./Modules/Test/classes/class.ilTestSession.php";
 
10506                    $random = new \ilRandom();
 
10507                    $nr_of_passes = $random->int(1, $passes);
 
10510                        include_once 
"./Modules/Test/classes/class.ilTestSequence.php";
 
10518                        for ($seq = 1; $seq <= count($this->questions); $seq++) {
 
10519                            $question_id = 
$testSequence->getQuestionForSequence($seq);
 
10521                            $assSettings = 
new ilSetting(
'assessment');
 
10522                            require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
 
10524                            $processLockerFactory->setQuestionId($objQuestion->getId());
 
10525                            $processLockerFactory->setUserId(
$testSession->getUserId());
 
10526                            include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
10528                            $objQuestion->setProcessLocker($processLockerFactory->getLocker());
 
10535                        $testSession->setSubmittedTimestamp(date(
'Y-m-d H:i:s'));
 
10539                    if ($number == 0) {
 
10554                        FROM            tst_result_cache 
10555                        WHERE           active_fi = %s 
10565            include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
10571                                FROM            tst_result_cache 
10572                                WHERE           active_fi = %s 
10589        if ($this->mailnottype == 1) {
 
10599            $this->mailnottype = 1;
 
10601            $this->mailnottype = 0;
 
10607        if ($this->exportsettings) {
 
10617            $this->exportsettings = $a_settings;
 
10619            $this->exportsettings = 0;
 
10625        if (($this->exportsettings & 1) > 0) {
 
10635            $this->exportsettings = $this->exportsettings | 1;
 
10638                $this->exportsettings = $this->exportsettings ^ 1;
 
10645        return $this->enabled_view_mode;
 
10650        $this->enabled_view_mode = $mode;
 
10665        $new_array = array();
 
10668        $query = 
'SELECT question_fi  FROM tst_test_question WHERE test_fi = %s';
 
10669        $types = array(
'integer');
 
10672        $new_question_id += 1;
 
10679            $qid = 
$row[
'question_fi'];
 
10681            if ($qid == $new_question_id) {
 
10683            } elseif ($qid == $previous_question_id) {
 
10684                $new_array[$position++] = $qid;
 
10685                $new_array[$position++] = $new_question_id;
 
10688                $new_array[$position++] = $qid;
 
10692        $update_query = 
'UPDATE tst_test_question SET sequence = %s WHERE test_fi = %s AND question_fi = %s';
 
10693        $update_types = array(
'integer', 
'integer', 
'integer');
 
10695        foreach ($new_array as $position => $qid) {
 
10696            $ilDB->manipulateF(
 
10721            $values[] = 
'instant_feedback_specific';
 
10724            $values[] = 
'instant_feedback_generic';
 
10727            $values[] = 
'instant_feedback_points';
 
10730            $values[] = 
'instant_feedback_solution';
 
10754                'pass_details' => 
'setShowPassDetails',
 
10755                'solution_details' => 
'setShowSolutionDetails',
 
10756                'solution_printview' => 
'setShowSolutionPrintview',
 
10757                'solution_feedback' => 
'setShowSolutionFeedback',
 
10758                'solution_answers_only' => 
'setShowSolutionAnswersOnly',
 
10759                'solution_signature' => 
'setShowSolutionSignature',
 
10760                'solution_suggested' => 
'setShowSolutionSuggested',
 
10762        foreach ($setter as 
$key => $setter) {
 
10778        $this->poolUsage = (boolean) $usage;
 
10789        $pluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
10791        require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
10793        $questionSetConfig = $qscFactory->getQuestionSetConfig();
 
10796        $reindexedSequencePositionMap = $questionSetConfig->reindexQuestionOrdering();
 
10800        return $reindexedSequencePositionMap;
 
10812        foreach ($orders as 
$id => $position) {
 
10816                isset($obligations[
$id]) && $obligations[
$id] ? 1 : 0
 
10820                                UPDATE          tst_test_question 
10823                                WHERE           question_fi = %s 
10826            $ilDB->manipulateF(
 
10828                array(
'integer', 
'integer', 
'integer'),
 
10829                array(
$i, $obligatory, 
$id)
 
10841        if ($question_before) {
 
10842            $query = 
'SELECT sequence, test_fi FROM tst_test_question WHERE question_fi = %s';
 
10843            $types = array(
'integer');
 
10844            $values = array($question_before);
 
10848        if (!$question_before || ($rset && !(
$row = 
$ilDB->fetchAssoc($rset)))) {
 
10855        $update = 
'UPDATE tst_test_question SET sequence = sequence + 1 WHERE sequence > %s AND test_fi = %s';
 
10856        $types = array(
'integer', 
'integer');
 
10860        $update = 
'UPDATE tst_test_question SET sequence = %s WHERE question_fi = %s';
 
10861        $types = array(
'integer', 
'integer');
 
10862        $values = array(
$row[
'sequence'] + 1, $question_to_move);
 
10875        $IN_questions = 
$ilDB->in(
'q1.question_id', array_keys(
$questions), 
false, 
'integer');
 
10878                        SELECT          count(q1.question_id) cnt 
10880                        FROM            qpl_questions q1 
10882                        INNER JOIN      qpl_questions q2 
10883                        ON                      q2.question_id = q1.original_id 
10885                        WHERE           $IN_questions 
10886                        AND                     q1.obj_fi = q2.obj_fi 
10893        return $row[
'cnt'] > 0;
 
10908            "SELECT test_fi,MAX(pass) AS pass FROM tst_active" .
 
10909            " JOIN tst_pass_result ON (tst_pass_result.active_fi = tst_active.active_id)" .
 
10910            " WHERE user_fi=%s" .
 
10911            " GROUP BY test_fi",
 
10912            array(
'integer', 
'integer'),
 
10913            array($a_user_id, 1)
 
10918            $all[$obj_id] = (bool) 
$row[
"pass"];
 
10929        return $this->online;
 
10934        $this->online = (bool) $a_online;
 
10955        $this->print_best_solution_with_result = (bool) $status;
 
10985        $this->activation_visibility = (bool) $a_value;
 
10995        return (
bool) $this->activation_limited;
 
11000        $this->activation_limited = (bool) $a_value;
 
11012        $this->_highscore_enabled = (bool) $a_enabled;
 
11022        return (
bool) $this->_highscore_enabled;
 
11034        $this->_highscore_anon = (bool) $a_anon;
 
11048        return (
bool) $this->_highscore_anon;
 
11075        $this->_highscore_achieved_ts = (bool) $a_achieved_ts;
 
11085        return (
bool) $this->_highscore_achieved_ts;
 
11095        $this->_highscore_score = (bool) $a_score;
 
11105        return (
bool) $this->_highscore_score;
 
11115        $this->_highscore_percentage = (bool) $a_percentage;
 
11125        return (
bool) $this->_highscore_percentage;
 
11135        $this->_highscore_hints = (bool) $a_hints;
 
11145        return (
bool) $this->_highscore_hints;
 
11155        $this->_highscore_wtime = (bool) $a_wtime;
 
11165        return (
bool) $this->_highscore_wtime;
 
11175        $this->_highscore_own_table = (bool) $a_own_table;
 
11185        return (
bool) $this->_highscore_own_table;
 
11195        $this->_highscore_top_table = (bool) $a_top_table;
 
11205        return (
bool) $this->_highscore_top_table;
 
11216        $this->_highscore_top_num = (int) $a_top_num;
 
11229        $retval = $a_retval;
 
11230        if ((
int) $this->_highscore_top_num != 0) {
 
11231            $retval = $this->_highscore_top_num;
 
11285        switch ($specific_answer_feedback) {
 
11287                $this->specific_answer_feedback = 1;
 
11290                $this->specific_answer_feedback = 0;
 
11297        switch ($this->specific_answer_feedback) {
 
11333        require_once(
'Modules/TestQuestionPool/classes/class.assQuestion.php');
 
11341        $obligationPossible = call_user_func(array($classConcreteQuestion, 
'isObligationPossible'), $questionId);
 
11343        return $obligationPossible;
 
11357        $rset = 
$ilDB->queryF(
'SELECT obligatory FROM tst_test_question WHERE question_fi = %s', array(
'integer'), array($question_id));
 
11360            return (
bool) 
$row[
'obligatory'];
 
11383        $rset = 
$ilDB->queryF(
 
11384            'SELECT obligations_answered FROM tst_pass_result WHERE active_fi = %s AND pass = %s',
 
11385            array(
'integer', 
'integer'),
 
11386            array($active_id, 
$pass)
 
11390            return (
bool) 
$row[
'obligations_answered'];
 
11409        $rset = 
$ilDB->queryF(
 
11410            'SELECT count(*) cnt FROM tst_test_question WHERE test_fi = %s AND obligatory = 1',
 
11417        return (
bool) 
$row[
'cnt'] > 0;
 
11460    #region Examview / PDF Examview 
11523        return (strlen($this->activation_starting_time)) ? $this->activation_starting_time : 
null;
 
11528        return (strlen($this->activation_ending_time)) ? $this->activation_ending_time : 
null;
 
11543        $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",
 
11548            $times[
$row[
'active_fi']] = 
$row[
'started'];
 
11560            "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",
 
11565            $times[
$row[
'active_fi']] = 
$row[
'additionaltime'];
 
11576            "SELECT additionaltime FROM tst_addtime WHERE active_fi = %s",
 
11580        if (
$result->numRows() > 0) {
 
11582            return $row[
'additionaltime'];
 
11591        require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
11594        $participantData->setParticipantAccessFilter(
 
11599            $participantData->setActiveIdsFilter(array($active_id));
 
11602        $participantData->load($this->
getTestId());
 
11604        foreach ($participantData->getActiveIds() as $active_id) {
 
11606                "SELECT active_fi FROM tst_addtime WHERE active_fi = %s",
 
11611            if (
$result->numRows() > 0) {
 
11612                $DIC->database()->manipulateF(
 
11613                    "DELETE FROM tst_addtime WHERE active_fi = %s",
 
11619            $DIC->database()->manipulateF(
 
11620                "UPDATE tst_active SET tries = %s, submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
11621                array(
'integer',
'integer',
'timestamp',
'integer'),
 
11622                array(0, 0, 
null, $active_id)
 
11625            $DIC->database()->manipulateF(
 
11626                "INSERT INTO tst_addtime (active_fi, additionaltime, tstamp) VALUES (%s, %s, %s)",
 
11627                array(
'integer',
'integer',
'integer'),
 
11628                array($active_id, $minutes, time())
 
11631            require_once 
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
 
11657    public function getMaxPassOfTest()
 
11666                        SELECT MAX(tst_pass_result.pass) + 1 max_res 
11667                        FROM tst_pass_result  
11668                        INNER JOIN tst_active ON tst_active.active_id = tst_pass_result.active_fi 
11669                        WHERE test_fi = ' . 
$ilDB->quote($this->
getTestId(), 
'integer') . 
' 
11673        return (
int) 
$data[
'max_res'];
 
11686        $exam_id_query = 
'SELECT exam_id FROM tst_pass_result WHERE active_fi = %s AND pass = %s';
 
11687        $exam_id_result = 
$ilDB->queryF($exam_id_query, array( 
'integer', 
'integer' ), array( $active_id, 
$pass ));
 
11688        if (
$ilDB->numRows($exam_id_result) == 1) {
 
11689            $exam_id_row = 
$ilDB->fetchAssoc($exam_id_result);
 
11691            if ($exam_id_row[
'exam_id'] != 
null) {
 
11692                return $exam_id_row[
'exam_id'];
 
11710        $inst_id = 
$ilSetting->get(
'inst_id', 
null);
 
11712        if ($test_obj_id === 
null) {
 
11715            $obj_id = $test_obj_id;
 
11718        $examId = 
'I' . $inst_id . 
'_T' . $obj_id . 
'_A' . $active_id . 
'_P' . 
$pass;
 
11770        $this->char_selector_availability = (int) $availability;
 
11786        $this->char_selector_definition = $definition;
 
11830        $query = 
"SELECT question_set_type FROM tst_tests WHERE obj_fi = %s";
 
11889                return $lng->txt(
'tst_question_set_type_fixed');
 
11892                return $lng->txt(
'tst_question_set_type_random');
 
11895                return $lng->txt(
'tst_question_set_type_dynamic');
 
11912        require_once 
'class.ilTestScoring.php';
 
11914        $scoring->setPreserveManualScores($preserve_manscoring);
 
11915        $scoring->recalculateSolutions();
 
11920        require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
11922        $questionChangeListeners = array(
 
11926        return $questionChangeListeners;
 
11937                        INNER JOIN tst_tests 
11938                        ON test_id = test_fi 
11947            $objIds[] = (int) 
$row[
'obj_fi'];
 
11979        if (!self::isSkillManagementGloballyActivated()) {
 
11990        if (self::$isSkillManagementGloballyActivated === 
null) {
 
11991            include_once 
'Services/Skill/classes/class.ilSkillManagementSettings.php';
 
11994            self::$isSkillManagementGloballyActivated = $skmgSet->isActivated();
 
12062        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
12068        $activeId = $testOBJ->getActiveIdOfUser($userId);
 
12070        require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
12073        require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
12076        $testSession = $testSessionFactory->getSession($activeId);
 
12081        if ($a_force_new_run) {
 
12096        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
12103        $activeId = $testOBJ->getActiveIdOfUser($userId);
 
12105        require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
12108        $testSessionFactory->reset();
 
12110        require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
12113        $testSession = $testSessionFactory->getSession($activeId);
 
12136    public function adjustTestSequence()
 
12145                        SELECT COUNT(test_question_id) cnt 
12146                        FROM tst_test_question 
12154        $questCount = 
$row[
'cnt'];
 
12159                                FROM tst_active tac 
12160                                INNER JOIN tst_sequence tseq 
12161                                        ON tseq.active_fi = tac.active_id 
12162                                WHERE tac.test_fi = %s 
12165            $partRes = 
$ilDB->queryF(
 
12171            while (
$row = 
$ilDB->fetchAssoc($partRes)) {
 
12172                $sequence = @unserialize(
$row[
'sequence']);
 
12175                    $sequence = array();
 
12178                $sequence = array_filter($sequence, 
function ($value) use ($questCount) {
 
12179                    return $value <= $questCount;
 
12182                $num_seq = count($sequence);
 
12183                if ($questCount > $num_seq) {
 
12184                    $diff = $questCount - $num_seq;
 
12185                    for (
$i = 1; 
$i <= $diff; 
$i++) {
 
12186                        $sequence[$num_seq + 
$i - 1] = $num_seq + 
$i;
 
12190                $new_sequence = serialize($sequence);
 
12192                $ilDB->update(
'tst_sequence', array(
 
12193                    'sequence' => array(
'clob', $new_sequence)
 
12195                    'active_fi' => array(
'integer', 
$row[
'active_fi']),
 
12196                    'pass' => array(
'integer', 
$row[
'pass'])
 
12200            $new_sequence = serialize($questCount > 0 ? range(1, $questCount) : array());
 
12204                                FROM tst_active tac 
12205                                INNER JOIN tst_sequence tseq 
12206                                        ON tseq.active_fi = tac.active_id 
12207                                WHERE tac.test_fi = %s 
12210            $part_rest = 
$ilDB->queryF(
 
12216            while (
$row = 
$ilDB->fetchAssoc($part_rest)) {
 
12217                $ilDB->update(
'tst_sequence', array(
 
12218                    'sequence' => array(
'clob', $new_sequence)
 
12220                    'active_fi' => array(
'integer', 
$row[
'active_fi']),
 
12221                    'pass' => array(
'integer', 
$row[
'pass'])
 
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 _getInstance($a_copy_id)
Get instance of copy wizard options.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
TableGUI class for evaluation of all users.
static recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
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 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
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...
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()
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.
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)
& 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)
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.
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)
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.
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 manual feedback for a question in a test.
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()
createRandomSolutions($number)
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 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.
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
update($pash, $contents, Config $config)
redirection script todo: (a better solution should control the processing via a xml file)
if(isset($_REQUEST['delete'])) $list
foreach($_POST as $key=> $value) $res