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';
 
  581        public function __construct($a_id = 0,$a_call_by_reference = 
true)
 
  586                $lng->loadLanguageModule(
"assessment");
 
  588                include_once 
"./Modules/Test/classes/class.assMarkSchema.php";
 
  590                $this->mark_schema->createSimpleSchema(
 
  591                        $lng->txt(
"failed_short"),
 
  592                        $lng->txt(
"failed_official"),
 
  595                        $lng->txt(
"passed_short"),
 
  596                        $lng->txt(
"passed_official"),
 
  602                $this->author = 
$ilUser->fullname;
 
  603                $this->introductionEnabled = 
false;
 
  604                $this->introduction = 
"";
 
  605                $this->questions = array();
 
  608                $this->instant_verification = 0;
 
  609                $this->answer_feedback_points = 0;
 
  610                $this->reporting_date = 
"";
 
  611                $this->nr_of_tries = 0;
 
  613                $this->use_previous_answers = 1;
 
  614                $this->title_output = 0;
 
  615                $this->starting_time = 
"";
 
  616                $this->ending_time = 
"";
 
  617                $this->processing_time = 
"";
 
  618                $this->enable_processing_time = 
"0";
 
  619                $this->reset_processing_time = 0;
 
  620                $this->ects_output = FALSE;
 
  621                $this->ects_fx     = NULL;
 
  622                $this->shuffle_questions = FALSE;
 
  623                $this->mailnottype = 0;
 
  624                $this->exportsettings = 0;
 
  625                $this->show_summary = 8;
 
  630                $this->answer_feedback = 0;
 
  631                $this->password = 
"";
 
  632                $this->certificate_visibility = 0;
 
  633                $this->allowedUsers = 
"";
 
  634                $this->_showfinalstatement = FALSE;
 
  635                $this->_finalstatement = 
"";
 
  636                $this->_showinfo = TRUE;
 
  637                $this->_forcejs = TRUE;
 
  638                $this->_customStyle = 
"";
 
  639                $this->allowedUsersTimeGap = 
"";
 
  640                $this->anonymity = 0;
 
  641                $this->show_cancel = 0;
 
  642                $this->show_marker = 0;
 
  643                $this->fixed_participants = 0;
 
  648                $this->testSession = FALSE;
 
  649                $this->testSequence = FALSE;
 
  650                $this->mailnotification = 0;
 
  651                $this->poolUsage = 1;
 
  653                $this->ects_grades = array(
 
  661                $this->autosave = FALSE;
 
  662                $this->autosave_ival = 30000;
 
  664                $this->enable_examview = 
false;
 
  665                $this->show_examview_html = 
false;
 
  666                $this->show_examview_pdf = 
false;
 
  667                $this->enable_archiving = 
false;
 
  669        $this->express_mode = 
false;
 
  670        $this->template_id = 
'';
 
  671                $this->redirection_mode = 0;
 
  672                $this->redirection_url = NULL;
 
  673                $this->show_exam_id_in_test_pass_enabled = 
false;
 
  674                $this->show_exam_id_in_test_results_enabled = 
false;
 
  675                $this->sign_submission = 
false;
 
  676                $this->char_selector_availability = 0;
 
  677                $this->char_selector_definition = 
null;
 
  679                $this->showGradingStatusEnabled = 
true;
 
  680                $this->showGradingMarkEnabled = 
true;
 
  682                $this->instantFeedbackAnswerFixationEnabled = 
false;
 
  684                $this->testFinalBroken = 
false;
 
  686                $this->
ilObject($a_id, $a_call_by_reference);
 
  712                if (!parent::update())
 
  727        function read($a_force_db = 
false)
 
  729                parent::read($a_force_db);
 
  743                if (!parent::delete())
 
  764                global $tree, 
$ilDB, $ilPluginAdmin;
 
  770                $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s",
 
  774                $active_array = array();
 
  777                        array_push($active_array, 
$row[
"active_id"]);
 
  780                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_active WHERE test_fi = %s",
 
  785                if (count($active_array))
 
  787                        foreach ($active_array as $active_id)
 
  789                                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_times WHERE active_fi = %s",
 
  794                                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_sequence WHERE active_fi = %s",
 
  801                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_mark WHERE test_fi = %s",
 
  806                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_tests WHERE test_id = %s",
 
  811                require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
  813                $testQuestionSetConfigFactory->getQuestionSetConfig()->removeQuestionSetRelatedData();
 
  816                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  818                $directory = $tst_data_dir.
"/tst_".$this->
getId();
 
  819                if (is_dir($directory))
 
  821                        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  824                include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
  830                foreach(
$mobs as $mob)
 
  855        function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
 
  895                if ($a_node_id==
$_GET[
"ref_id"])
 
  897                        $parent_obj =& $this->
ilias->obj_factory->getInstanceByRefId($a_node_id);
 
  898                        $parent_type = $parent_obj->getType();
 
  899                        if ($parent_type == $this->
getType())
 
  901                                $a_node_id = (int) $tree->getParentId($a_node_id);
 
  905                parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
 
  915                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  918                if (!is_writable($tst_data_dir))
 
  920                        $this->
ilias->raiseError(
"Test Data Directory (".$tst_data_dir
 
  921                                .
") not writeable.",$this->
ilias->error_obj->MESSAGE);
 
  925                $tst_dir = $tst_data_dir.
"/tst_".$this->
getId();
 
  927                if (!@is_dir($tst_dir))
 
  929                        $this->
ilias->raiseError(
"Creation of Test Directory failed.",$this->
ilias->error_obj->MESSAGE);
 
  932                $export_dir = $tst_dir.
"/export";
 
  934                if (!@is_dir($export_dir))
 
  936                        $this->
ilias->raiseError(
"Creation of Export Directory failed.",$this->
ilias->error_obj->MESSAGE);
 
  947                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
  958        function getExportFiles($dir)
 
  961                if(!@is_dir($dir) || !is_writeable($dir))
 
  977                        $files[] = 
$file->getBasename();
 
  990                if (strlen($a_import_dir))
 
  992                        $_SESSION[
"tst_import_dir"] = $a_import_dir;
 
 1008                if (strlen(
$_SESSION[
"tst_import_dir"]))
 
 1028                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 1032                if (!is_writable($tst_data_dir))
 
 1034                        $this->
ilias->raiseError(
"Test Data Directory (".$tst_data_dir
 
 1035                                .
") not writeable.",$this->
ilias->error_obj->FATAL);
 
 1039                $tst_dir = $tst_data_dir.
"/tst_import";
 
 1041                if (!@is_dir($tst_dir))
 
 1043                        $ilias->raiseError(
"Creation of test import directory failed.",
$ilias->error_obj->FATAL);
 
 1058                $result = 
$ilDB->queryF(
"SELECT DISTINCT(qpl_qst_type.type_tag) foundtypes FROM qpl_questions, tst_test_result, qpl_qst_type, tst_active WHERE tst_test_result.question_fi = qpl_questions.question_id AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id AND tst_test_result.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
 
 1065                        if (strcmp(
$row[
'foundtypes'], 
'assSingleChoice') == 0)
 
 1083                $result = 
$ilDB->queryF(
"SELECT DISTINCT(qpl_qst_type.type_tag) foundtypes FROM qpl_questions, tst_test_result, qpl_qst_type, tst_active WHERE tst_test_result.question_fi = qpl_questions.question_id AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id AND tst_test_result.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
 
 1090                        if (strcmp(
$row[
'foundtypes'], 
'assSingleChoice') == 0)
 
 1115                                SELECT  DISTINCT(qpl_qst_sc.shuffle) foundshuffles 
 1121                                WHERE   tst_test_result.question_fi = qpl_questions.question_id 
 1122                                AND             qpl_questions.question_type_fi = qpl_qst_type.question_type_id 
 1123                                AND             tst_test_result.active_fi = tst_active.active_id 
 1124                                AND             qpl_questions.question_id = qpl_qst_sc.question_fi 
 1125                                AND             tst_active.test_fi = %s 
 1126                                AND             qpl_qst_type.type_tag = %s 
 1128                        array(
'integer', 
'text'),
 
 1129                        array($this->
getTestId(), 
'assSingleChoice')
 
 1134                        return (
$row[
'foundshuffles'] == 0);
 
 1147                if( !count($this->mark_schema->mark_steps) )
 
 1168                global $tree, 
$ilDB, $ilPluginAdmin;
 
 1171                $test->loadFromDb();
 
 1173                require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 1176                return $test->isComplete( $testQuestionSetConfigFactory->getQuestionSetConfig() );
 
 1192                        if(!preg_match(
'/\d+/', $this->
getECTSFX()))
 
 1200                                SET ects_output = %s, ects_a = %s, ects_b = %s, ects_c = %s, ects_d = %s, ects_e = %s, ects_fx = %s 
 1201                                WHERE test_id = %s",
 
 1202                                array(
'text', 
'float', 
'float', 
'float', 
'float', 
'float', 
'float', 
'integer'),
 
 1205                                        $grades[
'A'], $grades[
'B'], $grades[
'C'], $grades[
'D'], $grades[
'E'],
 
 1222                if($this->
isComplete($testQuestionSetConfig))
 
 1229                                "UPDATE tst_tests SET complete = %s WHERE test_id = %s",
 
 1230                                array(
'text', 
'integer'),
 
 1231                                array($complete, $this->test_id)
 
 1256                include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
 1257                $completecontent = 
"";
 
 1260                        $completecontent .= $content;
 
 1273                global $tree, 
$ilDB, $ilPluginAdmin;
 
 1280                require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 1282                $testQuestionSetConfig = $testQuestionSetConfigFactory->getQuestionSetConfig();
 
 1284                include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1285                if ($this->test_id == -1)
 
 1288                        $next_id = 
$ilDB->nextId(
'tst_tests');
 
 1290                        $ilDB->insert(
'tst_tests', array(
 
 1291                                'test_id'                    => array(
'integer', $next_id),
 
 1292                                'obj_fi'                     => array(
'integer', $this->
getId()),
 
 1293                                'author'                     => array(
'text', $this->
getAuthor()),
 
 1297                                'showinfo'                   => array(
'integer', $this->
getShowInfo()),
 
 1298                                'forcejs'                    => array(
'integer', $this->
getForceJS()),
 
 1310                                'nr_of_tries'                => array(
'integer', $this->
getNrOfTries()),
 
 1311                                'kiosk'                      => array(
'integer', $this->
getKiosk()),
 
 1322                                'complete'                   => array(
'text', $this->
isComplete($testQuestionSetConfig)),
 
 1324                                'ects_a'                     => array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : NULL),
 
 1325                                'ects_b'                     => array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : NULL),
 
 1326                                'ects_c'                     => array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : NULL),
 
 1327                                'ects_d'                     => array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : NULL),
 
 1328                                'ects_e'                     => array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : NULL),
 
 1329                                'ects_fx'                    => array(
'float', $this->
getECTSFX()),
 
 1338                                'password'                   => array(
'text', $this->
getPassword()),
 
 1346                                'created'                    => array(
'integer', time()),
 
 1347                                'tstamp'                     => array(
'integer', time()),
 
 1349                                'template_id'                => array(
'integer', $this->
getTemplate()),
 
 1350                                'pool_usage'                 => array(
'integer', $this->
getPoolUsage()),
 
 1364                                'online_status'              => array(
'integer', (
int)$this->
isOnline()),
 
 1366                                'autosave'                   => array(
'integer', (
int)$this->
getAutosave()),
 
 1389                        $this->test_id = $next_id;
 
 1402                                $result = 
$ilDB->queryF(
"SELECT * FROM tst_tests WHERE test_id = %s",
 
 1404                                        array($this->test_id)
 
 1412                        $ilDB->update(
'tst_tests',
 
 1414                                                'author'                     => array(
'text', $this->
getAuthor()),
 
 1418                                                'showinfo'                   => array(
'integer', $this->
getShowInfo()),
 
 1419                                                'forcejs'                    => array(
'integer', $this->
getForceJS()),
 
 1431                                                'nr_of_tries'                => array(
'integer', $this->
getNrOfTries()),
 
 1432                                                'kiosk'                      => array(
'integer', $this->
getKiosk()),
 
 1443                                                'complete'                   => array(
'text', $this->
isComplete($testQuestionSetConfig)),
 
 1445                                                'ects_a'                     => array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : NULL),
 
 1446                                                'ects_b'                     => array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : NULL),
 
 1447                                                'ects_c'                     => array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : NULL),
 
 1448                                                'ects_d'                     => array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : NULL),
 
 1449                                                'ects_e'                     => array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : NULL),
 
 1450                                                'ects_fx'                    => array(
'float', $this->
getECTSFX()),
 
 1459                                                'password'                   => array(
'text', $this->
getPassword()),
 
 1467                                                'tstamp'                     => array(
'integer', time()),
 
 1469                                                'template_id'                => array(
'integer', $this->
getTemplate()),
 
 1470                                                'pool_usage'                 => array(
'integer', $this->
getPoolUsage()),
 
 1484                                                'online_status'              => array(
'integer', (
int)$this->
isOnline()),
 
 1486                                                'autosave'                   => array(
'integer', (
int)$this->
getAutosave()),
 
 1509                                                'test_id' => array(
'integer', (
int)$this->
getTestId())
 
 1513                        include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1516                                $logresult = 
$ilDB->queryF(
"SELECT * FROM tst_tests WHERE test_id = %s",
 
 1521                                if ($logresult->numRows() == 1)
 
 1523                                        $newrow = 
$ilDB->fetchAssoc($logresult);
 
 1525                                $changed_fields = array();
 
 1526                                foreach ($oldrow as $key => $value)
 
 1528                                        if (strcmp($oldrow[$key], $newrow[$key]) != 0)
 
 1530                                                array_push($changed_fields, 
"$key: " . $oldrow[$key] . 
" => " . $newrow[$key]);
 
 1533                                $changes = join($changed_fields, 
", ");
 
 1534                                if (count($changed_fields) > 0)
 
 1545                                        $aresult = 
$ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s AND tries >= %s AND submitted = %s",
 
 1546                                                array(
'integer', 
'integer', 
'integer'),
 
 1549                                        while (
$row = $ilDB->fetchAssoc($aresult))
 
 1551                                                $ilDB->manipulateF(
"UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
 1552                                                        array(
'integer', 
'timestamp', 
'integer'),
 
 1553                                                        array(1, date(
'Y-m-d H:i:s'), 
$row[
"active_id"])
 
 1558                                        $aresult = 
$ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s AND tries < %s AND submitted = %s",
 
 1559                                                array(
'integer', 
'integer', 
'integer'),
 
 1562                                        while (
$row = $ilDB->fetchAssoc($aresult))
 
 1564                                                $ilDB->manipulateF(
"UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
 1565                                                        array(
'integer', 
'timestamp', 
'integer'),
 
 1566                                                        array(0, NULL, 
$row[
"active_id"])
 
 1573                                        $aresult = 
$ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s AND submitted = %s",
 
 1574                                                array(
'integer', 
'integer'),
 
 1577                                        while (
$row = $ilDB->fetchAssoc($aresult))
 
 1579                                                $ilDB->manipulateF(
"UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
 1580                                                        array(
'integer', 
'timestamp', 
'integer'),
 
 1581                                                        array(0, NULL, 
$row[
"active_id"])
 
 1591                        include_once 
"./Services/Object/classes/class.ilObjectActivation.php";          
 
 1607                        $item->update($this->ref_id);           
 
 1610                if (!$properties_only)
 
 1623                                $this->mark_schema->saveToDb($this->test_id);
 
 1638                $oldquestions = array();
 
 1639                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 1642                        $result = 
$ilDB->queryF(
"SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
 
 1650                                        array_push($oldquestions, 
$row[
"question_fi"]);
 
 1656                $currentQuestionsObligationsQuery = 
'SELECT question_fi, obligatory FROM tst_test_question WHERE test_fi = %s';
 
 1657                $rset = 
$ilDB->queryF($currentQuestionsObligationsQuery, array(
'integer'), array($this->
getTestId()));
 
 1658                while (
$row = $ilDB->fetchAssoc($rset)) {
 
 1659                        $obligatoryQuestionState[
$row[
'question_fi']] = 
$row[
'obligatory'];
 
 1662                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_test_question WHERE test_fi = %s",
 
 1667                foreach ($this->questions as $key => $value) 
 
 1670                        if( !isset($obligatoryQuestionState[$value]) || is_null($obligatoryQuestionState[$value]) )
 
 1672                                $obligatoryQuestionState[$value] = 0;
 
 1676                        $next_id = 
$ilDB->nextId(
'tst_test_question');
 
 1677                        $ilDB->insert(
'tst_test_question', array(
 
 1678                                'test_question_id' => array(
'integer', $next_id),
 
 1679                                'test_fi' => array(
'integer', $this->
getTestId()),
 
 1680                                'question_fi' => array(
'integer', $value),
 
 1681                                'sequence' => array(
'integer', $key),
 
 1682                                'obligatory' => array(
'integer', $obligatoryQuestionState[$value]),
 
 1683                                'tstamp' => array(
'integer', time())
 
 1686                include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 1689                        $result = 
$ilDB->queryF(
"SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
 
 1693                        $newquestions = array();
 
 1698                                        array_push($newquestions, 
$row[
"question_fi"]);
 
 1701                        foreach ($oldquestions as $index => $question_id)
 
 1703                                if (strcmp($newquestions[$index], $question_id) != 0)
 
 1705                                        $pos = array_search($question_id, $newquestions);
 
 1716                        foreach ($newquestions as $index => $question_id)
 
 1718                                if (array_search($question_id, $oldquestions) === FALSE)
 
 1734                $result = 
$ilDB->queryF(
'SELECT copy_id FROM tst_rnd_cpy WHERE tst_fi = %s',
 
 1738                return $result->numRows() > 0;
 
 1762                $result = 
$ilDB->queryF(
"SELECT qpl_questions.original_id FROM qpl_questions, tst_test_question WHERE qpl_questions.question_id = tst_test_question.question_fi AND qpl_questions.tstamp > 0 AND tst_test_question.test_fi = %s",
 
 1766                $original_ids = array();
 
 1767                $paramtypes = array();
 
 1768                $paramvalues = array();
 
 1771                        array_push($original_ids, 
$row[
'original_id']);
 
 1776                if (($questionpool == 0) && (!is_array($qpls)))
 
 1778                        include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 1780                        if (count($available_pools))
 
 1782                                $available = 
" AND " . 
$ilDB->in(
'obj_fi', $available_pools, 
false, 
'integer');
 
 1790                $constraint_qpls = 
"";
 
 1791                $result_array = array();
 
 1792                if ($questionpool == 0)
 
 1794                        if (is_array($qpls))
 
 1796                                if (count($qpls) > 0)
 
 1798                                        $constraint_qpls = 
" AND " . 
$ilDB->in(
'obj_fi', $qpls, 
false, 
'integer');
 
 1803                $original_clause = 
"";
 
 1804                if (count($original_ids))
 
 1806                        $original_clause = 
" AND " . 
$ilDB->in(
'question_id', $original_ids, 
true, 
'integer');
 
 1809                if ($questionpool == 0)
 
 1811                        $result = 
$ilDB->queryF(
"SELECT question_id FROM qpl_questions WHERE original_id IS NULL $available $constraint_qpls AND owner > %s AND complete = %s $original_clause",
 
 1812                                array(
'integer', 
'text'),
 
 1818                        $result = 
$ilDB->queryF(
"SELECT question_id FROM qpl_questions WHERE original_id IS NULL AND obj_fi = %s AND owner > %s AND complete = %s $original_clause",
 
 1819                                array(
'integer',
'integer', 
'text'),
 
 1820                                array($questionpool, 0, 
"1")
 
 1823                $found_ids = array();
 
 1826                        array_push($found_ids, 
$row[
'question_id']);
 
 1828                $nr_of_questions = ($nr_of_questions > count($found_ids)) ? count($found_ids) : $nr_of_questions;
 
 1829                if ($nr_of_questions == 0) 
return array();
 
 1830                $rand_keys = array_rand($found_ids, $nr_of_questions);
 
 1832                if (is_array($rand_keys))
 
 1834                        foreach ($rand_keys as $key)
 
 1836                                $result[$found_ids[$key]] = $found_ids[$key];
 
 1841                        $result[$found_ids[$rand_keys]] = $found_ids[$rand_keys];
 
 1857                $result = 
$ilDB->queryF(
"SELECT test_result_id FROM tst_test_result WHERE active_fi = %s AND pass = %s",
 
 1858                        array(
'integer',
'integer'),
 
 1859                        array($active_id, 
$pass)
 
 1877                $result = 
$ilDB->queryF(
"SELECT test_random_question_id FROM tst_test_rnd_qst WHERE active_fi = %s AND pass = %s",
 
 1878                        array(
'integer',
'integer'),
 
 1879                        array($active_id, 
$pass)
 
 1881                return (
$result->numRows() > 0) ? true : 
false;
 
 1891                $result = 
$ilDB->queryF(
"SELECT * FROM tst_tests WHERE obj_fi = %s",
 
 1893                        array($this->
getId())
 
 1904                        include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
 1941                                        "A" => 
$data->ects_a,
 
 1942                                        "B" => 
$data->ects_b,
 
 1943                                        "C" => 
$data->ects_c,
 
 1944                                        "D" => 
$data->ects_d,
 
 1945                                        "E" => 
$data->ects_e
 
 1949                        $this->mark_schema->flush();
 
 1950                        $this->mark_schema->loadFromDb($this->
getTestId());
 
 2007                        include_once 
"./Services/Object/classes/class.ilObjectActivation.php";
 
 2009                        switch($activation[
"timing_type"])
 
 2036        $this->questions = array();
 
 2037        if (strcmp($active_id, 
"") == 0)
 
 2047                $result = 
$ilDB->queryF(
"SELECT tst_test_rnd_qst.* FROM tst_test_rnd_qst, qpl_questions WHERE tst_test_rnd_qst.active_fi = %s AND qpl_questions.question_id = tst_test_rnd_qst.question_fi AND tst_test_rnd_qst.pass = %s ORDER BY sequence",
 
 2048                        array(
'integer', 
'integer'),
 
 2049                        array($active_id, 
$pass)
 
 2057                        $result = 
$ilDB->queryF(
"SELECT tst_test_rnd_qst.* FROM tst_test_rnd_qst, qpl_questions WHERE tst_test_rnd_qst.active_fi = %s AND qpl_questions.question_id = tst_test_rnd_qst.question_fi AND tst_test_rnd_qst.pass = 0 ORDER BY sequence",
 
 2065                $result = 
$ilDB->queryF(
"SELECT tst_test_question.* FROM tst_test_question, qpl_questions WHERE tst_test_question.test_fi = %s AND qpl_questions.question_id = tst_test_question.question_fi ORDER BY sequence",
 
 2067                        array($this->test_id)
 
 2073                $this->questions[$index++] = 
$data[
"question_fi"];
 
 2101                return (strlen($this->introduction)) ? $this->introduction : NULL;
 
 2126                $this->_finalstatement = $a_statement;
 
 2138                $this->_showinfo = ($a_info) ? 1 : 0;
 
 2150                $this->_forcejs = ($a_js) ? 1 : 0;
 
 2162                $this->_customStyle = $a_customStyle;
 
 2174                return (strlen($this->_customStyle)) ? $this->_customStyle : NULL;
 
 2187                $css_path = str_replace(
"ta.css", 
"customstyles", $css_path) . 
"/";
 
 2188                $customstyles = array();
 
 2189                if (is_dir($css_path))
 
 2192                        include_once 
"./Services/Utilities/classes/class.ilFileUtils.php";
 
 2205                return $customstyles;
 
 2220                        $custom = str_replace(
"ta.css", 
"customstyles/" . $this->
getCustomStyle(), $default);
 
 2221                        if (file_exists($custom))
 
 2224                                $custom = str_replace(
"ta.css", 
"customstyles/" . $this->
getCustomStyle(), $custom);
 
 2247                $this->_showfinalstatement = ($show) ? 1 : 0;
 
 2258                return (strlen($this->_finalstatement)) ? $this->_finalstatement : NULL;
 
 2270                return ($this->_showinfo) ? 1 : 0;
 
 2282                return ($this->_forcejs) ? 1 : 0;
 
 2294                return ($this->_showfinalstatement) ? 1 : 0;
 
 2314                return ($this->ects_output) ? 1 : 0;
 
 2322                $this->ects_output = $a_ects_output ? 1 : 0;
 
 2330                return (strlen($this->ects_fx)) ? $this->ects_fx : NULL;
 
 2338                $this->ects_fx = $a_ects_fx;
 
 2354                $this->ects_grades = $a_ects_grades;
 
 2364                return ($this->sequence_settings) ? $this->sequence_settings : 0;
 
 2414                switch ($instant_feedback)
 
 2417                                $this->instant_verification = 1;
 
 2420                                $this->instant_verification = 0;
 
 2437                        $this->answer_feedback = 1;
 
 2440                        $this->answer_feedback = 0;
 
 2453        switch ($generic_answer_feedback)
 
 2456                        $this->answer_feedback = 1;
 
 2459                        $this->answer_feedback = 0;
 
 2476                                $this->answer_feedback_points = 1;
 
 2479                                $this->answer_feedback_points = 0;
 
 2492                        $this->reporting_date = 
'';
 
 2515                return ($this->score_reporting) ? $this->score_reporting : 0;
 
 2532                return ($this->instant_verification) ? $this->instant_verification : 0;
 
 2545                return ($this->answer_feedback) ? $this->answer_feedback : 0;
 
 2558                return ($this->answer_feedback) ? $this->answer_feedback : 0;
 
 2570        return ($this->answer_feedback_points) ? $this->answer_feedback_points : 0;
 
 2582                return ($this->count_system) ? $this->count_system : 0;
 
 2595                $result = 
$ilDB->queryF(
"SELECT tst_tests.count_system FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_active.test_fi = tst_tests.test_id",
 
 2602                        return $row[
"count_system"];
 
 2616                return ($this->mc_scoring) ? $this->mc_scoring : 0;
 
 2628                return ($this->score_cutting) ? $this->score_cutting : 0;
 
 2640                return ($this->pass_scoring) ? $this->pass_scoring : 0;
 
 2653                $result = 
$ilDB->queryF(
"SELECT tst_tests.pass_scoring FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
 
 2660                        return $row[
"pass_scoring"];
 
 2675                $result = 
$ilDB->queryF(
"SELECT tst_tests.mc_scoring FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_active.test_fi = tst_tests.test_id",
 
 2682                        return $row[
"mc_scoring"];
 
 2697                $result = 
$ilDB->queryF(
"SELECT tst_tests.score_cutting FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_tests.test_id = tst_active.test_fi",
 
 2704                        return $row[
"score_cutting"];
 
 2718                return (strlen($this->reporting_date)) ? $this->reporting_date : NULL;
 
 2730                return ($this->nr_of_tries) ? $this->nr_of_tries : 0;
 
 2742                return ($this->_kiosk) ? $this->_kiosk : 0;
 
 2755                $this->_kiosk = $kiosk;
 
 2767                if (($this->_kiosk & 1) > 0)
 
 2788                        $this->_kiosk = $this->_kiosk | 1;
 
 2794                                $this->_kiosk = $this->_kiosk ^ 1;
 
 2808                if (($this->_kiosk & 2) > 0)
 
 2828                        $this->_kiosk = $this->_kiosk | 2;
 
 2834                                $this->_kiosk = $this->_kiosk ^ 2;
 
 2848                if (($this->_kiosk & 4) > 0)
 
 2868                        $this->_kiosk = $this->_kiosk | 4;
 
 2874                                $this->_kiosk = $this->_kiosk ^ 4;
 
 2888                return ($this->use_previous_answers) ? $this->use_previous_answers : 0;
 
 2900                return ($this->title_output) ? $this->title_output : 0;
 
 2915                $result = 
$ilDB->queryF(
"SELECT tst_tests.title_output FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
 
 2922                        return $row[
"title_output"];
 
 2943                $result = 
$ilDB->queryF(
"SELECT tst_tests.use_previous_answers FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
 
 2955                        if ($user_active_user_setting)
 
 2957                                $res = 
$ilUser->getPref(
"tst_use_previous_answers");
 
 2976                return (strlen($this->processing_time)) ? $this->processing_time : NULL;
 
 2987                if (strlen($this->processing_time))
 
 2989                        if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches))
 
 2991                                if ((
int)$matches[1]+(
int)$matches[2]+(
int)$matches[3] == 0)
 
 2998                                                'hh' => $matches[1],
 
 2999                                                'mm' => $matches[2],
 
 3000                                                'ss' => $matches[3],
 
 3010                if (strlen($this->processing_time))
 
 3012                        if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches))
 
 3014                                return ($matches[1] * 60) + $matches[2];
 
 3030                if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $this->
getProcessingTime(), $matches))
 
 3033                        return ($matches[1] * 3600) + ($matches[2] * 60) + $matches[3] + $extratime;
 
 3050                        if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getEndingTime(), $matches))
 
 3052                                $ending = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 3054                                return $ending - $now;
 
 3071                return ($this->enable_processing_time) ? $this->enable_processing_time : 0;
 
 3083                return ($this->reset_processing_time) ? $this->reset_processing_time : 0;
 
 3111                return (strlen($this->starting_time)) ? $this->starting_time : NULL;
 
 3151                return (strlen($this->ending_time)) ? $this->ending_time : NULL;
 
 3189                        $this->use_previous_answers = 1;
 
 3193                        $this->use_previous_answers = 0;
 
 3226                                $this->title_output = 1;
 
 3229                                $this->title_output = 2;
 
 3232                                $this->title_output = 0;
 
 3251                $this->processing_time = sprintf(
"%02d:%02d:00", floor($minutes/60), $minutes%60);
 
 3264                        $this->enable_processing_time = 
"1";
 
 3266                        $this->enable_processing_time = 
"0";
 
 3281                        $this->reset_processing_time = 1;
 
 3285                        $this->reset_processing_time = 0;
 
 3298                $this->count_system = $a_count_system;
 
 3326                return (strlen($this->password)) ? $this->password : NULL;
 
 3338                $this->password = $a_password;
 
 3350                $this->score_cutting = $a_score_cutting;
 
 3362                $this->mc_scoring = $a_mc_scoring;
 
 3374                switch ($a_pass_scoring)
 
 3395                include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3400                $question->delete($question_id);
 
 3420                        $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_solutions WHERE tst_solutions.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s) AND tst_solutions.question_fi = %s",
 
 3421                                array(
'integer',
'integer'),
 
 3424                        $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_qst_solved WHERE tst_qst_solved.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s) AND tst_qst_solved.question_fi = %s",
 
 3425                                array(
'integer',
'integer'),
 
 3428                        $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_test_result WHERE tst_test_result.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s) AND tst_test_result.question_fi = %s",
 
 3429                                array(
'integer',
'integer'),
 
 3432                        $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_pass_result WHERE tst_pass_result.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s)",
 
 3437                        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
 
 3442                        $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_solutions WHERE tst_solutions.active_fi IN  (SELECT active_id FROM tst_active WHERE test_fi = %s)",
 
 3446                        $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_qst_solved WHERE tst_qst_solved.active_fi IN  (SELECT active_id FROM tst_active WHERE test_fi = %s)",
 
 3450                        $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_test_result WHERE tst_test_result.active_fi IN  (SELECT active_id FROM tst_active WHERE test_fi = %s)",
 
 3454                        $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_pass_result WHERE tst_pass_result.active_fi IN  (SELECT active_id FROM tst_active WHERE test_fi = %s)",
 
 3459                        $query = 
"SELECT active_id FROM tst_active WHERE test_fi = %s";
 
 3461                        $activeIds = array();
 
 3464                                $activeIds[] = 
$row[
'active_id'];
 
 3467                        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
 
 3470                        include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3477                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_sequence WHERE tst_sequence.active_fi IN  (SELECT active_id FROM tst_active WHERE test_fi = %s)",
 
 3484                        $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_test_rnd_qst WHERE tst_test_rnd_qst.active_fi IN  (SELECT active_id FROM tst_active WHERE test_fi = %s)",
 
 3491                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_active WHERE test_fi = %s",
 
 3497                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM usr_pref WHERE keyword = %s",
 
 3499                        array(
"tst_password_".$this->
getTestId())
 
 3504                if (@is_dir(CLIENT_WEB_DIR . 
"/assessment/tst_" . $this->
getTestId()))
 
 3520                        require_once 
'Services/Object/classes/class.ilObjectLP.php';
 
 3522                        $testLP->resetLPDataForUserIds($participantData->
getUserIds(), 
false);
 
 3535                require_once 
'Modules/Test/classes/class.ilTestParticipantData.php';
 
 3537                $participantData->setUserIds($userIds);
 
 3538                $participantData->load($this->
getTestId());
 
 3540                $IN_userIds = 
$ilDB->in(
'usr_id', $participantData->getUserIds(), 
false, 
'integer');
 
 3541                $ilDB->manipulateF(
"DELETE FROM usr_pref WHERE $IN_userIds AND keyword = %s",
 
 3542                        array(
'text'), array(
"tst_password_".$this->
getTestId())
 
 3545                if( count($participantData->getActiveIds()) )
 
 3555                $IN_activeIds = 
$ilDB->in(
'active_fi', $activeIds, 
false, 
'integer');
 
 3557                $ilDB->manipulate(
"DELETE FROM tst_solutions WHERE $IN_activeIds");
 
 3558                $ilDB->manipulate(
"DELETE FROM tst_qst_solved WHERE $IN_activeIds");
 
 3559                $ilDB->manipulate(
"DELETE FROM tst_test_result WHERE $IN_activeIds");
 
 3560                $ilDB->manipulate(
"DELETE FROM tst_pass_result WHERE $IN_activeIds");
 
 3561                $ilDB->manipulate(
"DELETE FROM tst_result_cache WHERE $IN_activeIds");
 
 3562                $ilDB->manipulate(
"DELETE FROM tst_sequence WHERE $IN_activeIds");
 
 3566                        $ilDB->manipulate(
"DELETE FROM tst_test_rnd_qst WHERE $IN_activeIds");
 
 3570                        $ilDB->manipulate(
"DELETE FROM tst_seq_qst_tracking WHERE $IN_activeIds");
 
 3571                        $ilDB->manipulate(
"DELETE FROM tst_seq_qst_answstatus WHERE $IN_activeIds");
 
 3572                        $ilDB->manipulate(
"DELETE FROM tst_seq_qst_postponed WHERE $IN_activeIds");
 
 3573                        $ilDB->manipulate(
"DELETE FROM tst_seq_qst_checked WHERE $IN_activeIds");
 
 3576                include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3578                foreach ($activeIds as $active_id)
 
 3582                        if (@is_dir(CLIENT_WEB_DIR . 
"/assessment/tst_" . $this->
getTestId() . 
"/$active_id"))
 
 3593                require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
 
 3601                $IN_activeIds = 
$ilDB->in(
'active_id', $activeIds, 
false, 
'integer');
 
 3602                $ilDB->manipulate(
"DELETE FROM tst_active WHERE $IN_activeIds");
 
 3612                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_solutions WHERE active_fi = %s",
 
 3616                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_qst_solved WHERE active_fi = %s",
 
 3620                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_test_result WHERE active_fi = %s",
 
 3624                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_pass_result WHERE active_fi = %s",
 
 3631                        $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_test_rnd_qst WHERE active_fi = %s",
 
 3637                include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3643                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_sequence WHERE active_fi = %s",
 
 3649                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_active WHERE active_id = %s",
 
 3657                        $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM usr_pref WHERE usr_id = %s AND keyword = %s",
 
 3658                                array(
'integer', 
'text'),
 
 3659                                array($user_id, 
"tst_password_".$this->
getTestId())
 
 3665                if (@is_dir(CLIENT_WEB_DIR . 
"/assessment/tst_" . $this->
getTestId() . 
"/$active_id"))
 
 3670                require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
 
 3686                $result = 
$ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
 
 3687                        array(
'integer', 
'integer'),
 
 3691                if (
$data->sequence > 1) 
 
 3694                        $result = 
$ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
 
 3695                                array(
'integer',
'integer'),
 
 3700                        $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3701                                array(
'integer',
'integer'),
 
 3702                                array(
$data->sequence, $data_previous->test_question_id)
 
 3705                        $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3706                                array(
'integer',
'integer'),
 
 3707                                array(
$data->sequence - 1, 
$data->test_question_id)
 
 3709                        include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3730                $result = 
$ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
 
 3731                        array(
'integer',
'integer'),
 
 3735                $result = 
$ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
 
 3736                        array(
'integer',
'integer'),
 
 3744                        $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3745                                array(
'integer',
'integer'),
 
 3746                                array(
$data->sequence, $data_next->test_question_id)
 
 3749                        $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
 
 3750                                array(
'integer',
'integer'),
 
 3751                                array(
$data->sequence + 1, 
$data->test_question_id)
 
 3753                        include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3773                $duplicate_id = $question->duplicate(
true, 
null, 
null, 
null, $this->
getId());
 
 3775                return $duplicate_id;
 
 3789#var_dump($question_id); 
 3792                        $duplicate_id = $question_id;
 
 3800                $result = 
$ilDB->queryF(
"SELECT MAX(sequence) seq FROM tst_test_question WHERE test_fi=%s",
 
 3809                        $sequence = 
$data->seq + 1;
 
 3812                $next_id = 
$ilDB->nextId(
'tst_test_question');
 
 3813                $affectedRows = 
$ilDB->manipulateF(
"INSERT INTO tst_test_question (test_question_id, test_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
 
 3814                        array(
'integer', 
'integer',
'integer',
'integer',
'integer'),
 
 3815                        array($next_id, $this->
getTestId(), $duplicate_id, $sequence, time())
 
 3817                if ($affectedRows == 1) 
 
 3819                        include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 3826                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_active WHERE test_fi = %s",
 
 3832                return $duplicate_id;
 
 3848                        $result = 
$ilDB->queryF(
"SELECT qpl_questions.title FROM tst_test_question, qpl_questions WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id ORDER BY tst_test_question.sequence",
 
 3854                                array_push($titles, 
$row[
"title"]);
 
 3873                        $result = 
$ilDB->queryF(
"SELECT qpl_questions.title, qpl_questions.question_id FROM tst_test_question, qpl_questions WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id ORDER BY tst_test_question.sequence",
 
 3879                                $titles[
$row[
'question_id']] = 
$row[
"title"];
 
 3897                        return $this->lng->txt(
"ass_question");
 
 3917                $result = 
$ilDB->queryF(
"SELECT qpl_questions.*, qpl_qst_type.type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
 
 3936                $existing_questions = array();
 
 3941                        $result = 
$ilDB->queryF(
"SELECT qpl_questions.original_id FROM qpl_questions, tst_test_rnd_qst WHERE tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.question_fi = qpl_questions.question_id AND tst_test_rnd_qst.pass = %s",
 
 3942                                array(
'integer',
'integer'),
 
 3943                                array($active_id, 
$pass)
 
 3948                        $result = 
$ilDB->queryF(
"SELECT qpl_questions.original_id FROM qpl_questions, tst_test_question WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id",
 
 3955                        if( 
$data->original_id === 
null )
 
 3960                        array_push($existing_questions, 
$data->original_id);
 
 3962                return $existing_questions;
 
 3976                if ($question_id < 1) 
return -1;
 
 3977                $result = 
$ilDB->queryF(
"SELECT type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
 
 3984                        return $data->type_tag;
 
 4002                $next_id = 
$ilDB->nextId(
'tst_times');
 
 4003                $affectedRows = 
$ilDB->manipulateF(
"INSERT INTO tst_times (times_id, active_fi, started, finished, pass, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
 
 4004                        array(
'integer', 
'integer', 
'timestamp', 
'timestamp', 
'integer', 
'integer'),
 
 4005                        array($next_id, $active_id, strftime(
"%Y-%m-%d %H:%M:%S"), strftime(
"%Y-%m-%d %H:%M:%S"), 
$pass, time())
 
 4020                $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_times SET finished = %s, tstamp = %s WHERE times_id = %s",
 
 4021                        array(
'timestamp', 
'integer', 
'integer'),
 
 4022                        array(strftime(
"%Y-%m-%d %H:%M:%S"), time(), $times_id)
 
 4039                        $result = 
$ilDB->queryF(
"SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
 
 4040                                array(
'integer',
'integer'),
 
 4041                                array($active_id, 0)
 
 4046                        $result = 
$ilDB->queryF(
"SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
 
 4047                                array(
'integer',
'integer'),
 
 4048                                array($active_id, 
$pass)
 
 4051                $result_array = array();
 
 4054                        array_push($result_array, 
$row[
"question_fi"]);
 
 4056                return $result_array;
 
 4070                return ((($currentpass > 0) && ($num == 0)) || $this->
isTestFinished($active_id)) ? true : 
false;
 
 4084                $result_array = array();
 
 4089                        if (count($this->questions) == 0) 
return $result_array;
 
 4094                        $result = 
$ilDB->queryF(
"SELECT qpl_questions.* FROM qpl_questions, tst_test_rnd_qst WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id AND tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.pass = %s AND " . 
$ilDB->in(
'qpl_questions.question_id', $this->questions, 
false, 
'integer'),
 
 4095                                array(
'integer',
'integer'),
 
 4096                                array($active_id, 
$pass)
 
 4101                        if (count($this->questions) == 0) 
return $result_array;
 
 4102                        $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'));
 
 4106                        $result_array[
$row[
"question_id"]] = 
$row;
 
 4108                return $result_array;
 
 4124                        if (!$user_id) $user_id = 
$ilUser->getId();
 
 4127                                $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
 
 4128                                        array(
'integer',
'integer',
'text'),
 
 4132                        else if (strlen($anonymous_id))
 
 4134                                $result = 
$ilDB->queryF(
"SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
 
 4135                                        array(
'integer',
'integer',
'text'),
 
 4136                                        array($user_id, $this->test_id, $anonymous_id)
 
 4141                                if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
 
 4145                                $result = 
$ilDB->queryF(
"SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
 
 4146                                        array(
'integer',
'integer'),
 
 4147                                        array($user_id, $this->test_id)
 
 4153                                return $row[
"active_id"];
 
 4181                $result = 
$ilDB->queryF(
"SELECT tst_active.active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
 
 4182                        array(
'integer', 
'integer'),
 
 4188                        return $row[
"active_id"];
 
 4204                $keys = array_keys($array);
 
 4207                foreach ($keys as $key)
 
 4223                global $tree, 
$ilDB, 
$lng, $ilPluginAdmin;
 
 4227                if( is_null(
$pass) )
 
 4232                require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
 4234                $testSession = $testSessionFactory->getSession($active_id);
 
 4236                require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 4242                        require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 4244                        $dynamicQuestionSetConfig->loadFromDb();
 
 4256                        if( $ordered_sequence )
 
 4266                $arrResults = array();
 
 4269                        SELECT          tst_test_result.question_fi, 
 4270                                                tst_test_result.points reached, 
 4271                                                tst_test_result.hint_count requested_hints, 
 4272                                                tst_test_result.hint_points hint_points, 
 4273                                                tst_test_result.answered answered 
 4275                        FROM            tst_test_result 
 4277                        LEFT JOIN       tst_solutions 
 4278                        ON                      tst_solutions.active_fi = tst_test_result.active_fi 
 4279                        AND                     tst_solutions.question_fi = tst_test_result.question_fi 
 4281                        WHERE           tst_test_result.active_fi = %s 
 4282                        AND                     tst_test_result.pass = %s 
 4285                $solutionresult = 
$ilDB->queryF(
 
 4286                        $query, array(
'integer', 
'integer'), array($active_id, 
$pass)
 
 4289                while( 
$row = 
$ilDB->fetchAssoc($solutionresult) )
 
 4291                        $arrResults[ 
$row[
'question_fi'] ] = 
$row;
 
 4294                $numWorkedThrough = count($arrResults);
 
 4296                require_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 4298                $IN_question_ids = 
$ilDB->in(
'qpl_questions.question_id', $sequence, 
false, 
'integer');
 
 4301                        SELECT          qpl_questions.*, 
 4302                                                qpl_qst_type.type_tag, 
 4303                                                qpl_sol_sug.question_fi has_sug_sol 
 4308                        LEFT JOIN       qpl_sol_sug 
 4309                        ON                      qpl_sol_sug.question_fi = qpl_questions.question_id 
 4311                        WHERE           qpl_qst_type.question_type_id = qpl_questions.question_type_fi 
 4312                        AND                     $IN_question_ids 
 4317                $unordered = array();
 
 4321                $obligationsAnswered = 
true;
 
 4326                                $row[
'points'] ? $arrResults[ 
$row[
'question_id'] ][
'reached'] / 
$row[
'points'] : 0
 
 4329                        if( $percentvalue < 0 ) $percentvalue = 0.0;
 
 4334                                "max" => round(
$row[
'points'], 2),
 
 4335                                "reached" => round($arrResults[
$row[
'question_id']][
'reached'],2),
 
 4336                                'requested_hints' => $arrResults[
$row[
'question_id']][
'requested_hints'],
 
 4337                                'hint_points' => $arrResults[
$row[
'question_id']][
'hint_points'],
 
 4338                                "percent" => sprintf(
"%2.2f ", ($percentvalue) * 100) . 
"%",
 
 4340                                "type" => 
$row[
"type_tag"],
 
 4341                                "qid" => 
$row[
'question_id'],
 
 4342                                "original_id" => 
$row[
"original_id"],
 
 4343                                "workedthrough" => isset($arrResults[
$row[
'question_id']]) ? 1 : 0,
 
 4344                                'answered' => $arrResults[
$row[
'question_id']][
'answered']
 
 4347                        if( !$arrResults[ 
$row[
'question_id'] ][
'answered'] )
 
 4349                                $obligationsAnswered = 
false;
 
 4352                        $unordered[ 
$row[
'question_id'] ] = 
$data;
 
 4359                $pass_requested_hints = 0;
 
 4360                $pass_hint_points = 0;
 
 4365                foreach( $sequence as $qid )
 
 4369                        $pass_max += round($unordered[$qid][
'max'], 2);
 
 4370                        $pass_reached += round($unordered[$qid][
'reached'], 2);
 
 4371                        $pass_requested_hints += $unordered[$qid][
'requested_hints'];
 
 4372                        $pass_hint_points += $unordered[$qid][
'hint_points'];
 
 4376                        $unordered[$qid][
'nr'] = $key;
 
 4377                        array_push($found, $unordered[$qid]);
 
 4387                        if( 
$results[
'reached_points'] < 0 )
 
 4392                        if( $pass_reached < 0 ) $pass_reached = 0;
 
 4395                $found[
'pass'][
'total_max_points'] = $pass_max;
 
 4396                $found[
'pass'][
'total_reached_points'] = $pass_reached;
 
 4397                $found[
'pass'][
'total_requested_hints'] = $pass_requested_hints;
 
 4398                $found[
'pass'][
'total_hint_points'] = $pass_hint_points;
 
 4399                $found[
'pass'][
'percent'] = ($pass_max > 0) ? $pass_reached / $pass_max : 0;
 
 4400                $found[
'pass'][
'obligationsAnswered'] = $obligationsAnswered;
 
 4401                $found[
'pass'][
'num_workedthrough'] = $numWorkedThrough;
 
 4403                $found[
"test"][
"total_max_points"] = 
$results[
'max_points'];
 
 4404                $found[
"test"][
"total_reached_points"] = 
$results[
'reached_points'];
 
 4405                $found[
"test"][
"total_requested_hints"] = 
$results[
'hint_count'];
 
 4406                $found[
"test"][
"total_hint_points"] = 
$results[
'hint_points'];
 
 4407                $found[
"test"][
"result_pass"] = 
$results[
'pass'];
 
 4408                $found[
'test'][
'obligations_answered'] = 
$results[
'obligations_answered'];
 
 4410                if( (!$total_reached_points) or (!$total_max_points) )
 
 4416                        $percentage = ($total_reached_points / $total_max_points) * 100.0;
 
 4418                        if( $percentage < 0 ) $percentage = 0.0;
 
 4421                $found[
"test"][
"passed"] = 
$results[
'passed'];
 
 4436                $result = 
$ilDB->queryF(
"SELECT COUNT(active_id) total FROM tst_active WHERE test_fi = %s",
 
 4441                return $row[
"total"];
 
 4454                $result = 
$ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi AND tst_active.user_fi = %s",
 
 4455                        array(
'integer',
'integer'),
 
 4461                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"started"], $matches);
 
 4462                        $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4463                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"finished"], $matches);
 
 4464                        $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4465                        $time += ($epoch_2 - $epoch_1);
 
 4492                $result = 
$ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi ORDER BY tst_times.active_fi, tst_times.started",
 
 4500                        if (!array_key_exists(
$row[
"active_fi"], $times))
 
 4502                                $times[
$row[
"active_fi"]] = 0;
 
 4504                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"started"], $matches);
 
 4505                        $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4506                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"finished"], $matches);
 
 4507                        $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4508                        $times[
$row[
"active_fi"]] += ($epoch_2 - $epoch_1);
 
 4523                $result = 
$ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi AND tst_active.active_id = %s ORDER BY tst_times.active_fi, tst_times.started",
 
 4524                        array(
'integer',
'integer'),
 
 4530                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"started"], $matches);
 
 4531                        $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4532                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"finished"], $matches);
 
 4533                        $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4534                        $time += ($epoch_2 - $epoch_1);
 
 4549                $result = 
$ilDB->queryF(
"SELECT * FROM tst_times WHERE active_fi = %s AND pass = %s ORDER BY started",
 
 4550                        array(
'integer',
'integer'),
 
 4551                        array($active_id, 
$pass)
 
 4556                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"started"], $matches);
 
 4557                        $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4558                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"finished"], $matches);
 
 4559                        $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4560                        $time += ($epoch_2 - $epoch_1);
 
 4589                $result = 
$ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi AND tst_active.active_id = %s ORDER BY tst_times.started",
 
 4590                        array(
'integer',
'integer'),
 
 4597                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"started"], $matches);
 
 4598                        $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4599                        if ($firstvisit == 0 || $epoch_1 < $firstvisit) $firstvisit = $epoch_1;
 
 4600                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"finished"], $matches);
 
 4601                        $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4602                        if ($epoch_2 > $lastvisit) $lastvisit = $epoch_2;
 
 4604                return array(
"firstvisit" => $firstvisit, 
"lastvisit" => $lastvisit);
 
 4619                $result = 
$ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.active_id = %s AND tst_active.active_id = tst_times.active_fi",
 
 4628                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row->started, $matches);
 
 4629                        $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4630                        if (!$first_visit) {
 
 4631                                $first_visit = $epoch_1;
 
 4633                        if ($epoch_1 < $first_visit) {
 
 4634                                $first_visit = $epoch_1;
 
 4636                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row->finished, $matches);
 
 4637                        $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 4639                                $last_visit = $epoch_2;
 
 4641                        if ($epoch_2 > $last_visit) {
 
 4642                                $last_visit = $epoch_2;
 
 4644                        $times[
$row->active_fi] += ($epoch_2 - $epoch_1);
 
 4647                foreach ($times as $key => $value) {
 
 4648                        $max_time += $value;
 
 4650                if ((!$test_result[
"test"][
"total_reached_points"]) or (!$test_result[
"test"][
"total_max_points"]))
 
 4656                        $percentage = ($test_result[
"test"][
"total_reached_points"] / $test_result[
"test"][
"total_max_points"]) * 100.0;
 
 4657                        if ($percentage < 0) $percentage = 0.0;
 
 4659                $mark_obj = $this->mark_schema->getMatchingMark($percentage);
 
 4660                $first_date = getdate($first_visit);
 
 4661                $last_date = getdate($last_visit);
 
 4662                $qworkedthrough = 0;
 
 4663                foreach ($test_result as $key => $value)
 
 4665                        if (preg_match(
"/\d+/", $key))
 
 4667                                $qworkedthrough += $value[
"workedthrough"];
 
 4670                if (!$qworkedthrough)
 
 4676                        $atimeofwork = $max_time / $qworkedthrough;
 
 4679                $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
 
 4686                        $result_mark = $mark_obj->getShortName();
 
 4688                        if( $mark_obj->getPassed() && $obligationsAnswered )
 
 4697                $percent_worked_through = 0;
 
 4698                if (count($this->questions))
 
 4700                        $percent_worked_through = $qworkedthrough / count($this->questions);
 
 4702                $result_array = array(
 
 4703                        "qworkedthrough" => $qworkedthrough,
 
 4704                        "qmax" => count($this->questions),
 
 4705                        "pworkedthrough" => $percent_worked_through,
 
 4706                        "timeofwork" => $max_time,
 
 4707                        "atimeofwork" => $atimeofwork,
 
 4708                        "firstvisit" => $first_date,
 
 4709                        "lastvisit" => $last_date,
 
 4710                        "resultspoints" => $test_result[
"test"][
"total_reached_points"],
 
 4711                        "maxpoints" => $test_result[
"test"][
"total_max_points"],
 
 4712                        "resultsmarks" => $result_mark,
 
 4713                        "passed" => $passed,
 
 4714                        "distancemedian" => 
"0" 
 4716                foreach ($test_result as $key => $value)
 
 4718                        if (preg_match(
"/\d+/", $key))
 
 4720                                $result_array[$key] = $value;
 
 4723                return $result_array;
 
 4735                $totalpoints_array = array();
 
 4737                foreach ($all_users as $active_id => $user_name)
 
 4740                        $reached = $test_result[
"test"][
"total_reached_points"];
 
 4741                        $total = $test_result[
"test"][
"total_max_points"];
 
 4743                        $mark = $this->mark_schema->getMatchingMark($percentage*100.0);
 
 4745                        $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
 
 4749                                if( $mark->getPassed() && $obligationsAnswered )
 
 4751                                        array_push($totalpoints_array, $test_result[
"test"][
"total_reached_points"]);
 
 4755                return $totalpoints_array;
 
 4766                $result = 
$ilDB->queryF(
"SELECT tst_active.active_id, usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login FROM tst_active LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id WHERE tst_active.test_fi = %s ORDER BY usr_data.lastname ASC",
 
 4770                $persons_array = array();
 
 4773                        $name = $this->lng->txt(
"anonymous");
 
 4774                        $fullname = $this->lng->txt(
"anonymous");
 
 4778                                if (strlen(
$row[
"firstname"].
$row[
"lastname"].
$row[
"title"]) == 0)
 
 4780                                        $name = $this->lng->txt(
"deleted_user");
 
 4781                                        $fullname = $this->lng->txt(
"deleted_user");
 
 4782                                        $login = $this->lng->txt(
"unknown");
 
 4786                                        $login = 
$row[
"login"];
 
 4787                                        if (
$row[
"user_fi"] == ANONYMOUS_USER_ID)
 
 4789                                                $name = $this->lng->txt(
"anonymous");
 
 4790                                                $fullname = $this->lng->txt(
"anonymous");
 
 4794                                                $name = trim(
$row[
"lastname"] . 
", " . 
$row[
"firstname"] . 
" " .  
$row[
"title"]);
 
 4795                                                $fullname = trim(
$row[
"title"] . 
" " . 
$row[
"firstname"] . 
" " .  
$row[
"lastname"]);
 
 4799                        $persons_array[
$row[
"active_id"]] = array(
 
 4801                                "fullname" => $fullname,
 
 4805                return $persons_array;
 
 4817                $result = 
$ilDB->queryF(
"SELECT tst_active.active_id, usr_data.firstname, usr_data.lastname, usr_data.title FROM tst_active LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id WHERE tst_active.test_fi = %s ORDER BY usr_data.lastname " . strtoupper($name_sort_order),
 
 4821                $persons_array = array();
 
 4826                                $persons_array[
$row[
"active_id"]] = $this->lng->txt(
"anonymous");
 
 4830                                if (strlen(
$row[
"firstname"].
$row[
"lastname"].
$row[
"title"]) == 0)
 
 4832                                        $persons_array[
$row[
"active_id"]] = $this->lng->txt(
"deleted_user");
 
 4836                                        if (
$row[
"user_fi"] == ANONYMOUS_USER_ID)
 
 4838                                                $persons_array[
$row[
"active_id"]] = 
$row[
"lastname"];
 
 4842                                                $persons_array[
$row[
"active_id"]] = trim(
$row[
"lastname"] . 
", " . 
$row[
"firstname"] . 
" " .  
$row[
"title"]);
 
 4847                return $persons_array;
 
 4859                $result = 
$ilDB->queryF(
"SELECT tst_active.active_id, usr_data.login, usr_data.firstname, usr_data.lastname, usr_data.title FROM tst_active LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id WHERE tst_active.test_fi = %s ORDER BY usr_data.lastname " . strtoupper($name_sort_order),
 
 4863                $persons_array = array();
 
 4868                                $persons_array[
$row[
"active_id"]] = array(
"name" => $this->lng->txt(
"anonymous"));
 
 4872                                if (strlen(
$row[
"firstname"].
$row[
"lastname"].
$row[
"title"]) == 0)
 
 4874                                        $persons_array[
$row[
"active_id"]] = array(
"name" => $this->lng->txt(
"deleted_user"));
 
 4878                                        if (
$row[
"user_fi"] == ANONYMOUS_USER_ID)
 
 4880                                                $persons_array[
$row[
"active_id"]] = array(
"name" => 
$row[
"lastname"]);
 
 4884                                                $persons_array[
$row[
"active_id"]] = array(
"name" => trim(
$row[
"lastname"] . 
", " . 
$row[
"firstname"] . 
" " .  
$row[
"title"]), 
"login" => 
$row[
"login"]);
 
 4889                return $persons_array;
 
 4902                $result = 
$ilDB->queryF(
"SELECT COUNT(active_id) total FROM tst_active WHERE test_fi = %s AND submitted = %s",
 
 4903                        array(
'integer', 
'integer'),
 
 4907                return $row[
"total"];
 
 4922                        $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
 
 4923                                "tst_test_rnd_qst.pass, qpl_questions.points " .
 
 4924                                "FROM tst_test_rnd_qst, qpl_questions " .
 
 4925                                "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
 
 4926                                "AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence",
 
 4933                        $result = 
$ilDB->queryF(
"SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
 
 4934                                "qpl_questions.points " .
 
 4935                                "FROM tst_test_question, tst_active, qpl_questions " .
 
 4936                                "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
 
 4937                                "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
 
 4947                                array_push($qtest, 
$row);
 
 4965                        $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
 
 4966                                "qpl_questions.points " .
 
 4967                                "FROM tst_test_rnd_qst, qpl_questions " .
 
 4968                                "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
 
 4969                                "AND tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.pass = %s " .
 
 4970                                "ORDER BY tst_test_rnd_qst.sequence",
 
 4971                                array(
'integer', 
'integer'),
 
 4972                                array($active_id, 
$pass)
 
 4977                        $result = 
$ilDB->queryF(
"SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
 
 4978                                "qpl_questions.points " .
 
 4979                                "FROM tst_test_question, tst_active, qpl_questions " .
 
 4980                                "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
 
 4981                                "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
 
 4991                                array_push($qpass, 
$row);
 
 4997        function getUnfilteredEvaluationData()
 
 5002                $ilDB = $DIC->database();
 
 5004                include_once 
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
 
 5005                include_once 
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
 
 5006                include_once 
"./Modules/Test/classes/class.ilTestEvaluationData.php";
 
 5011                        SELECT          tst_test_result.*, 
 5012                                                qpl_questions.original_id, 
 5013                                                qpl_questions.title questiontitle, 
 5014                                                qpl_questions.points maxpoints 
 5016                        FROM            tst_test_result, qpl_questions, tst_active 
 5018                        WHERE           tst_active.active_id = tst_test_result.active_fi 
 5019                        AND                     qpl_questions.question_id = tst_test_result.question_fi 
 5020                        AND                     tst_active.test_fi = %s 
 5022                        ORDER BY        tst_active.active_id ASC, tst_test_result.pass ASC, tst_test_result.tstamp DESC 
 5036                        $participantObject = 
$data->getParticipant(
$row[
"active_fi"]);
 
 5043                        $passObject = $participantObject->getPass(
$row[
"pass"]);
 
 5050                        $passObject->addAnsweredQuestion(
 
 5055                foreach( array_keys(
$data->getParticipants()) as $active_id )
 
 5059                                for( $testpass = 0; $testpass <= 
$data->getParticipant($active_id)->getLastPass(); $testpass++ )
 
 5062                                        $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, qpl_questions.original_id, " .
 
 5063                                                "tst_test_rnd_qst.pass, qpl_questions.points, qpl_questions.title " .
 
 5064                                                "FROM tst_test_rnd_qst, qpl_questions " .
 
 5065                                                "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
 
 5066                                                "AND tst_test_rnd_qst.pass = %s " .
 
 5067                                                "AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence",
 
 5068                                                array(
'integer',
'integer'),
 
 5069                                                array($testpass, $active_id)
 
 5075                                                        $tpass = array_key_exists(
"pass", 
$row) ? 
$row[
"pass"] : 0;
 
 5076                                                        $data->getParticipant($active_id)->addQuestion(
$row[
"original_id"], 
$row[
"question_fi"], 
$row[
"points"], 
$row[
"sequence"], $tpass);
 
 5077                                                        $data->addQuestionTitle(
$row[
"question_fi"], 
$row[
"title"]);
 
 5084                                require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 5085                                require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 5086                                require_once 
'Modules/Test/classes/class.ilTestDynamicQuestionSetFilterSelection.php';
 
 5088                                $lastPass = 
$data->getParticipant($active_id)->getLastPass();
 
 5089                                for($testpass = 0; $testpass <= $lastPass; $testpass++)
 
 5091                                        require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 5093                                                $DIC->repositoryTree(), $DIC->database(), $DIC[
'ilPluginAdmin'], $this
 
 5095                                        $dynamicQuestionSetConfig->loadFromDb();
 
 5097                                        require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 5098                                        $testSequenceFactory = 
new ilTestSequenceFactory($DIC->database(), $DIC->language(), $DIC[
'ilPluginAdmin'], $this);
 
 5099                                        $testSequence        = $testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $testpass);
 
 5104                                        $sequence = (array)
$testSequence->getUserSequenceQuestions();
 
 5106                                        $questionsIdsToRequest = array_diff(array_values($sequence), array_values($questionData));
 
 5107                                        if(count($questionsIdsToRequest) > 0)
 
 5109                                                $questionIdsCondition = 
' ' . $DIC->database()->in(
'question_id', array_values($questionsIdsToRequest), 
false, 
'integer') . 
' ';
 
 5111                                                $res = $DIC->database()->queryF(
" 
 5114                                                        WHERE {$questionIdsCondition}",
 
 5118                                                while(
$row = $DIC->database()->fetchAssoc(
$res))
 
 5120                                                        $questionData[
$row[
'question_id']] = 
$row;
 
 5121                                                        $data->addQuestionTitle(
$row[
'question_id'], 
$row[
'title']);
 
 5125                                        foreach($sequence as $questionId)
 
 5127                                                if(!isset($questionData[$questionId]))
 
 5132                                                $row = $questionData[$questionId];
 
 5134                                                $data->getParticipant(
 
 5135                                                        $active_id)->addQuestion(
$row[
'original_id'], 
$row[
'question_id'], 
$row[
'points'],
 
 5143                                $result = 
$ilDB->queryF(
"SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
 
 5144                                        "qpl_questions.points, qpl_questions.title, qpl_questions.original_id " .
 
 5145                                        "FROM tst_test_question, tst_active, qpl_questions " .
 
 5146                                        "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
 
 5147                                        "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi ORDER BY tst_test_question.sequence",
 
 5153                                        $questionsbysequence = array();
 
 5157                                                $questionsbysequence[
$row[
"sequence"]] = 
$row;
 
 5160                                        $seqresult = 
$ilDB->queryF(
"SELECT * FROM tst_sequence WHERE active_fi = %s",
 
 5165                                        while ($seqrow = 
$ilDB->fetchAssoc($seqresult))
 
 5167                                                $questionsequence = unserialize($seqrow[
"sequence"]);
 
 5168                                                foreach ($questionsequence as $sidx => $seq)
 
 5170                                                        $data->getParticipant($active_id)->addQuestion($questionsbysequence[$seq][
"original_id"], $questionsbysequence[$seq][
"question_fi"], $questionsbysequence[$seq][
"points"], $sidx + 1, $seqrow[
"pass"]);
 
 5171                                                        $data->addQuestionTitle($questionsbysequence[$seq][
"question_fi"], $questionsbysequence[$seq][
"title"]);
 
 5183                foreach( array_keys(
$data->getParticipants()) as $active_id )
 
 5185                        $tstUserData = 
$data->getParticipant($active_id);
 
 5187                        $percentage = $tstUserData->getReachedPointsInPercent();
 
 5189                        $obligationsAnswered = $tstUserData->areObligationsAnswered();
 
 5191                        $mark = $this->mark_schema->getMatchingMark($percentage);
 
 5193                        if (is_object($mark))
 
 5195                                $tstUserData->setMark($mark->getShortName());
 
 5196                                $tstUserData->setMarkOfficial($mark->getOfficialName());
 
 5198                                $tstUserData->setPassed(
 
 5199                                        $mark->getPassed() && $tstUserData->areObligationsAnswered()
 
 5206                                                $passed_array, $tstUserData->getReached(), $tstUserData->getMaxPoints()
 
 5209                                $tstUserData->setECTSMark($ects_mark);
 
 5214                        $tstUserData->setFirstVisit($visitingTime[
"firstvisit"]);
 
 5215                        $tstUserData->setLastVisit($visitingTime[
"lastvisit"]);
 
 5232                                                SELECT          COUNT(qpl_questions.question_id) qcount, 
 5233                                                                        SUM(qpl_questions.points) qsum 
 5235                                                INNER JOIN      tst_tests 
 5236                                                ON                      tst_tests.test_id = tst_active.test_fi 
 5237                                                INNER JOIN      tst_dyn_quest_set_cfg 
 5238                                                ON          tst_dyn_quest_set_cfg.test_fi = tst_tests.test_id 
 5239                                                INNER JOIN  qpl_questions 
 5240                                                ON          qpl_questions.obj_fi = tst_dyn_quest_set_cfg.source_qpl_fi 
 5241                                                AND         qpl_questions.original_id IS NULL 
 5242                                                AND         qpl_questions.complete = %s 
 5243                                                WHERE           tst_active.active_id = %s 
 5245                                        array(
'integer', 
'integer'),
 
 5246                                        array(1, $active_id)
 
 5254                                                SELECT          tst_test_rnd_qst.pass, 
 5255                                                                        COUNT(tst_test_rnd_qst.question_fi) qcount, 
 5256                                                                        SUM(qpl_questions.points) qsum 
 5258                                                FROM            tst_test_rnd_qst, 
 5261                                                WHERE           tst_test_rnd_qst.question_fi = qpl_questions.question_id 
 5262                                                AND                     tst_test_rnd_qst.active_fi = %s 
 5265                                                GROUP BY        tst_test_rnd_qst.active_fi, 
 5266                                                                        tst_test_rnd_qst.pass 
 5268                                        array(
'integer', 
'integer'),
 
 5269                                        array($active_id, 
$pass)
 
 5277                                                SELECT          COUNT(tst_test_question.question_fi) qcount, 
 5278                                                                        SUM(qpl_questions.points) qsum 
 5280                                                FROM            tst_test_question, 
 5284                                                WHERE           tst_test_question.question_fi = qpl_questions.question_id 
 5285                                                AND                     tst_test_question.test_fi = tst_active.test_fi 
 5286                                                AND                     tst_active.active_id = %s 
 5288                                                GROUP BY        tst_test_question.test_fi 
 5298                                throw new ilTestException(
"not supported question set type: $questionSetType");
 
 5303                if( is_array(
$row) )
 
 5305                        return array(
"count" => 
$row[
"qcount"], 
"points" => 
$row[
"qsum"]);
 
 5308                return array(
"count" => 0, 
"points" => 0);
 
 5313                include_once 
"./Modules/Test/classes/class.ilTestEvaluationData.php";
 
 5314                include_once 
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
 
 5315                include_once 
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
 
 5316                $data = $this->getUnfilteredEvaluationData();
 
 5317                if ($withStatistics)
 
 5319                        $data->calculateStatistics();
 
 5321                $data->setFilter($filterby, $filtertext);
 
 5346                $result = 
$ilDB->queryF(
"SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
 
 5347                        "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
 
 5348                        "qpl_questions.points maxpoints " .
 
 5349                        "FROM tst_test_result, qpl_questions, tst_active " .
 
 5350                        "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
 
 5351                        "WHERE tst_active.active_id = tst_test_result.active_fi " .
 
 5352                        "AND qpl_questions.question_id = tst_test_result.question_fi " .
 
 5353                        "AND tst_active.test_fi = %s " .
 
 5354                        "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
 
 5358                $overview = array();
 
 5361                        if (!array_key_exists(
$row[
"active_fi"], $overview))
 
 5363                                $overview[
$row[
"active_fi"]] = array();
 
 5364                                $overview[
$row[
"active_fi"]][
"firstname"] = 
$row[
"firstname"];
 
 5365                                $overview[
$row[
"active_fi"]][
"lastname"] = 
$row[
"lastname"];
 
 5366                                $overview[
$row[
"active_fi"]][
"title"] = 
$row[
"title"];
 
 5367                                $overview[
$row[
"active_fi"]][
"login"] = 
$row[
"login"];
 
 5368                                $overview[
$row[
"active_fi"]][
"usr_id"] = 
$row[
"usr_id"];
 
 5369                                $overview[
$row[
"active_fi"]][
"started"] = 
$row[
"started"];
 
 5370                                $overview[
$row[
"active_fi"]][
"finished"] = 
$row[
"finished"];
 
 5372                        if (!array_key_exists(
$row[
"pass"], $overview[
$row[
"active_fi"]]))
 
 5374                                $overview[
$row[
"active_fi"]][
$row[
"pass"]] = array();
 
 5375                                $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"reached"] = 0;
 
 5376                                $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"maxpoints"] = 
$row[
"maxpoints"];
 
 5378                        array_push($overview[
$row[
"active_fi"]][
$row[
"pass"]], 
$row);
 
 5379                        $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"reached"] += 
$row[
"points"];
 
 5395                $result = 
$ilDB->queryF(
"SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
 
 5396                        "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
 
 5397                        "qpl_questions.points maxpoints " .
 
 5398                        "FROM tst_test_result, qpl_questions, tst_active " .
 
 5399                        "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
 
 5400                        "WHERE tst_active.active_id = tst_test_result.active_fi " .
 
 5401                        "AND qpl_questions.question_id = tst_test_result.question_fi " .
 
 5402                        "AND tst_active.test_fi = %s AND tst_active.active_id = %s" .
 
 5403                        "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
 
 5404                        array(
'integer', 
'integer'),
 
 5407                $overview = array();
 
 5410                        if (!array_key_exists(
$row[
"active_fi"], $overview))
 
 5412                                $overview[
$row[
"active_fi"]] = array();
 
 5413                                $overview[
$row[
"active_fi"]][
"firstname"] = 
$row[
"firstname"];
 
 5414                                $overview[
$row[
"active_fi"]][
"lastname"] = 
$row[
"lastname"];
 
 5415                                $overview[
$row[
"active_fi"]][
"title"] = 
$row[
"title"];
 
 5416                                $overview[
$row[
"active_fi"]][
"login"] = 
$row[
"login"];
 
 5417                                $overview[
$row[
"active_fi"]][
"usr_id"] = 
$row[
"usr_id"];
 
 5418                                $overview[
$row[
"active_fi"]][
"started"] = 
$row[
"started"];
 
 5419                                $overview[
$row[
"active_fi"]][
"finished"] = 
$row[
"finished"];
 
 5421                        if (!array_key_exists(
$row[
"pass"], $overview[
$row[
"active_fi"]]))
 
 5423                                $overview[
$row[
"active_fi"]][
$row[
"pass"]] = array();
 
 5424                                $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"reached"] = 0;
 
 5425                                $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"maxpoints"] = 
$row[
"maxpoints"];
 
 5427                        array_push($overview[
$row[
"active_fi"]][
$row[
"pass"]], 
$row);
 
 5428                        $overview[
$row[
"active_fi"]][
$row[
"pass"]][
"reached"] += 
$row[
"points"];
 
 5447                if (strlen($firstname.$lastname.$title) == 0)
 
 5449                        $name = $this->lng->txt(
"deleted_user");
 
 5453                        if ($user_id == ANONYMOUS_USER_ID)
 
 5459                                $name = trim($lastname . 
", " . $firstname . 
" " .  
$title);
 
 5463                                $name = $this->lng->txt(
"anonymous");
 
 5485                if (strlen($firstname.$lastname.$title) == 0)
 
 5487                        $name = 
$lng->txt(
"deleted_user");
 
 5491                        if ($user_id == ANONYMOUS_USER_ID)
 
 5497                                $name = trim($lastname . 
", " . $firstname . 
" " .  
$title);
 
 5501                                $name = 
$lng->txt(
"anonymous");
 
 5517                $result = 
$ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi",
 
 5524                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row->started, $matches);
 
 5525                        $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 5526                        preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row->finished, $matches);
 
 5527                        $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 5528                        $times[
$row->active_fi] += ($epoch_2 - $epoch_1);
 
 5532                foreach ($times as $key => $value)
 
 5534                        $max_time += $value;
 
 5539                        $average_time = round($max_time / $counter);
 
 5545                return $average_time;
 
 5554        function &
getAvailableQuestionpools($use_object_id = 
false, $equal_points = 
false, $could_be_offline = 
false, $show_path = FALSE, $with_questioncount = FALSE, $permission = 
"read")
 
 5556                include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 5568                $time_in_seconds = 0;
 
 5569                foreach ($this->questions as $question_id)
 
 5572                        $est_time = $question->getEstimatedWorkingTime();
 
 5573                        $time_in_seconds += $est_time[
"h"] * 3600 + $est_time[
"m"] * 60 + $est_time[
"s"];
 
 5575                $hours = (int)($time_in_seconds / 3600) ;
 
 5576                $time_in_seconds = $time_in_seconds - ($hours * 3600);
 
 5577                $minutes = (int)($time_in_seconds / 60);
 
 5578                $time_in_seconds = $time_in_seconds - ($minutes * 60);
 
 5579                $result = array(
"hh" => $hours, 
"mm" => $minutes, 
"ss" => $time_in_seconds);
 
 5591                return CLIENT_WEB_DIR . 
"/assessment/" . $this->
getId() . 
"/images/";
 
 5602                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 5617                if ((!$question_type) and ($question_id > 0))
 
 5622                if (!strlen($question_type)) 
return null;
 
 5624                include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 5628                $question = 
new $question_type_gui();
 
 5632                if ($question_id > 0)
 
 5634                        $question->object->loadFromDb($question_id);
 
 5639                        $question->object->feedbackOBJ = 
new $feedbackObjectClassname($question->object, 
$ilCtrl, 
$ilDB, 
$lng);
 
 5641                        $assSettings = 
new ilSetting(
'assessment');
 
 5642                        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
 
 5644                        $processLockerFactory->setQuestionId($question->object->getId());
 
 5645                        $processLockerFactory->setUserId(
$ilUser->getId());
 
 5646                        include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
 5648                        $question->object->setProcessLocker($processLockerFactory->getLocker());
 
 5665                if (strcmp($question_id, 
"") != 0)
 
 5667                        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 5682                $this->questions = array_values($this->questions);
 
 5683                $array_pos = array_search($target_index, $this->questions);
 
 5684                if ($insert_mode == 0)
 
 5686                        $part1 = array_slice($this->questions, 0, $array_pos);
 
 5687                        $part2 = array_slice($this->questions, $array_pos);
 
 5689                else if ($insert_mode == 1)
 
 5691                        $part1 = array_slice($this->questions, 0, $array_pos + 1);
 
 5692                        $part2 = array_slice($this->questions, $array_pos + 1);
 
 5694                foreach ($move_questions as $question_id)
 
 5696                        if (!(array_search($question_id, $part1) === FALSE))
 
 5698                                unset($part1[array_search($question_id, $part1)]);
 
 5700                        if (!(array_search($question_id, $part2) === FALSE))
 
 5702                                unset($part2[array_search($question_id, $part2)]);
 
 5705                $part1 = array_values($part1);
 
 5706                $part2 = array_values($part2);
 
 5707                $new_array = array_values(array_merge($part1, $move_questions, $part2));
 
 5708                $this->questions = array();
 
 5710                foreach ($new_array as $question_id)
 
 5712                        $this->questions[$counter] = $question_id;
 
 5730                        if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getStartingTime(), $matches))
 
 5732                                $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 5734                                if ($now < $epoch_time)
 
 5755                        if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getEndingTime(), $matches))
 
 5757                                $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 5759                                if ($now > $epoch_time)
 
 5779                include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 5782                if (count($available_pools))
 
 5784                        $available = 
" AND " . 
$ilDB->in(
'qpl_questions.obj_fi', $available_pools, 
false, 
'integer');
 
 5792                        $available .= 
" AND qpl_questions.complete = " . 
$ilDB->quote(
"1", 
'text');
 
 5796                if (is_array($arrFilter))
 
 5798                        if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title']))
 
 5800                                $where .= 
" AND " . 
$ilDB->like(
'qpl_questions.title', 
'text', 
"%%" . $arrFilter[
'title'] . 
"%%");
 
 5802                        if (array_key_exists(
'description', $arrFilter) && strlen($arrFilter[
'description']))
 
 5804                                $where .= 
" AND " . 
$ilDB->like(
'qpl_questions.description', 
'text', 
"%%" . $arrFilter[
'description'] . 
"%%");
 
 5806                        if (array_key_exists(
'author', $arrFilter) && strlen($arrFilter[
'author']))
 
 5808                                $where .= 
" AND " . 
$ilDB->like(
'qpl_questions.author', 
'text', 
"%%" . $arrFilter[
'author'] . 
"%%");
 
 5810                        if (array_key_exists(
'type', $arrFilter) && strlen($arrFilter[
'type']))
 
 5812                                $where .= 
" AND qpl_qst_type.type_tag = " . 
$ilDB->quote($arrFilter[
'type'], 
'text');
 
 5814                        if (array_key_exists(
'qpl', $arrFilter) && strlen($arrFilter[
'qpl']))
 
 5816                                $where .= 
" AND " . 
$ilDB->like(
'object_data.title', 
'text', 
"%%" . $arrFilter[
'qpl'] . 
"%%");
 
 5821                $original_clause = 
" qpl_questions.original_id IS NULL";
 
 5822                if (count($original_ids))
 
 5824                        $original_clause = 
" qpl_questions.original_id IS NULL AND " . 
$ilDB->in(
'qpl_questions.question_id',  $original_ids, 
true, 
'integer');
 
 5827                $query_result = 
$ilDB->query(
 
 5828                        "SELECT qpl_questions.*, qpl_questions.tstamp, qpl_qst_type.type_tag, qpl_qst_type.plugin, object_data.title qpl " .
 
 5829                        "FROM qpl_questions, qpl_qst_type, object_data WHERE $original_clause $available AND " .
 
 5830                        "object_data.obj_id = qpl_questions.obj_fi AND qpl_questions.tstamp > 0 AND " .
 
 5831                        "qpl_questions.question_type_fi = qpl_qst_type.question_type_id$where");
 
 5834                if ($query_result->numRows())
 
 5836                        while (
$row = 
$ilDB->fetchAssoc($query_result))
 
 5838                                $row[
'ttype'] = $types[
$row[
'type_tag']];
 
 5843                                                array_push($rows, 
$row);
 
 5848                                        array_push($rows, 
$row);
 
 5860                global $ilPluginAdmin;
 
 5862                $lng->loadLanguageModule(
"assessment");
 
 5867                        if (
$row[
"plugin"] == 0)
 
 5869                                $types[
$row[
'type_tag']] = 
$lng->txt(
$row[
"type_tag"]);
 
 5873                                $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE, 
"TestQuestionPool", 
"qst");
 
 5874                                foreach ($pl_names as $pl_name)
 
 5877                                        if (strcmp($pl->getQuestionType(), 
$row[
"type_tag"]) == 0)
 
 5879                                                $types[
$row[
'type_tag']] = $pl->getQuestionTypeTranslation();
 
 5900                foreach ($assessment->objectives as $objectives)
 
 5902                        foreach ($objectives->materials as $material)
 
 5919                foreach ($assessment->assessmentcontrol as $assessmentcontrol)
 
 5921                        switch ($assessmentcontrol->getSolutionswitch())
 
 5937                foreach ($assessment->qtimetadata as 
$metadata)
 
 5964                                case "sequence_settings":
 
 5967                                case "solution_details":
 
 5970                                case "print_bs_with_res":
 
 5980                                        $this->
setKiosk($metadata[
"entry"]);
 
 5982                                case "showfinalstatement":
 
 5995                                case "highscore_enabled":
 
 5999                                case "highscore_anon":
 
 6003                                case "highscore_achieved_ts":
 
 6007                                case "highscore_score":
 
 6011                                case "highscore_percentage":
 
 6015                                case "highscore_hints":
 
 6019                                case "highscore_wtime":
 
 6023                                case "highscore_own_table":
 
 6027                                case "highscore_top_table":
 
 6031                                case "highscore_top_num":
 
 6035                                case "hide_previous_results":
 
 6045                                case "use_previous_answers":
 
 6048                                case "answer_feedback":
 
 6051                                case "hide_title_points":
 
 6054                                case "title_output":
 
 6057                                case "question_set_type":
 
 6070                                case "results_presentation":
 
 6073                                case "reset_processing_time":
 
 6076                                case "instant_verification":
 
 6079                                case "answer_feedback_points":
 
 6091                                case "fixed_participants":
 
 6094                                case "score_reporting":
 
 6097                                case "shuffle_questions":
 
 6100                                case "count_system":
 
 6106                                case "mailnotification":
 
 6112                                case "exportsettings":
 
 6115                                case "score_cutting":
 
 6122                                case "allowedUsers":
 
 6126                                case "allowedUsersTimeGap":
 
 6129                                case "pass_scoring":
 
 6132                                case "show_summary":
 
 6135                                case "reporting_date":
 
 6137                                        if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
 
 6139                                                $this->
setReportingDate(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
 
 6142                                case 'enable_processing_time': 
 
 6145                                case "processing_time":
 
 6148                                case "starting_time":
 
 6150                                        if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
 
 6152                                                $this->
setStartingTime(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
 
 6158                                        if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
 
 6160                                                $this->
setEndingTime(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
 
 6164                                case "enable_examview":
 
 6167                                case 'show_examview_html':
 
 6170                                case 'show_examview_pdf':
 
 6173                                case 'redirection_mode':
 
 6176                                case 'redirection_url':
 
 6179                                case 'examid_in_kiosk':
 
 6180                                case 'examid_in_test_pass':
 
 6183                                case 'show_exam_id':
 
 6184                                case 'examid_in_test_res':
 
 6187                                case 'enable_archiving':
 
 6190                                case 'sign_submission':
 
 6193                                case 'char_selector_availability':
 
 6196                                case 'char_selector_definition':
 
 6199                                case 'skill_service':
 
 6202                                case 'result_tax_filters':
 
 6205                                case 'show_grading_status':
 
 6208                                case 'show_grading_mark':
 
 6211                                case 'activation_limited': 
 
 6214                                case 'activation_start_time':
 
 6217                                case 'activation_end_time': 
 
 6220                                case 'activation_visibility': 
 
 6226                                case 'autosave_ival': 
 
 6229                                case 'offer_question_hints': 
 
 6232                                case 'instant_feedback_specific': 
 
 6235                                case 'instant_feedback_answer_fixation': 
 
 6238                                case 'obligations_enabled': 
 
 6242                        if (preg_match(
"/mark_step_\d+/", 
$metadata[
"label"]))
 
 6245                                preg_match(
"/<short>(.*?)<\/short>/", $xmlmark, $matches);
 
 6246                                $mark_short = $matches[1];
 
 6247                                preg_match(
"/<official>(.*?)<\/official>/", $xmlmark, $matches);
 
 6248                                $mark_official = $matches[1];
 
 6249                                preg_match(
"/<percentage>(.*?)<\/percentage>/", $xmlmark, $matches);
 
 6250                                $mark_percentage = $matches[1];
 
 6251                                preg_match(
"/<passed>(.*?)<\/passed>/", $xmlmark, $matches);
 
 6252                                $mark_passed = $matches[1];
 
 6253                                $this->mark_schema->addMarkStep($mark_short, $mark_official, $mark_percentage, $mark_passed);
 
 6257                if (is_array(
$_SESSION[
"import_mob_xhtml"]))
 
 6259                        include_once 
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
 
 6260                        include_once 
"./Services/RTE/classes/class.ilRTE.php";
 
 6261                        include_once 
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
 
 6262                        foreach (
$_SESSION[
"import_mob_xhtml"] as $mob)
 
 6265                                if (file_exists($importfile))
 
 6275                                        $ilLog->write(
"Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
 
 6289                include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
 
 6293                $a_xml_writer->xmlSetDtdDef(
"<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">");
 
 6294                $a_xml_writer->xmlStartTag(
"questestinterop");
 
 6297                        "ident" => 
"il_".IL_INST_ID.
"_tst_".$this->getTestId(),
 
 6298                        "title" => $this->getTitle()
 
 6300                $a_xml_writer->xmlStartTag(
"assessment", $attrs);
 
 6302                $a_xml_writer->xmlElement(
"qticomment", NULL, $this->
getDescription());
 
 6305                if ($this->enable_processing_time)
 
 6307                        preg_match(
"/(\d+):(\d+):(\d+)/", $this->processing_time, $matches);
 
 6308                        $a_xml_writer->xmlElement(
"duration", NULL, sprintf(
"P0Y0M0DT%dH%dM%dS", $matches[1], $matches[2], $matches[3]));
 
 6312                $a_xml_writer->xmlStartTag(
"qtimetadata");
 
 6313                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6314                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"ILIAS_VERSION");
 
 6315                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
ilias->getSetting(
"ilias_version"));
 
 6316                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6319                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6320                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"anonymity");
 
 6321                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getAnonymity()));
 
 6322                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6325                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6326                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"question_set_type");
 
 6328                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6331                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6332                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"sequence_settings");
 
 6334                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6337                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6338                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"author");
 
 6339                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getAuthor());
 
 6340                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6343                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6344                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"reset_processing_time");
 
 6346                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6349                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6350                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"count_system");
 
 6351                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getCountSystem());
 
 6352                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6355                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6356                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"mc_scoring");
 
 6357                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getMCScoring());
 
 6358                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6361                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6362                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"score_cutting");
 
 6363                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getScoreCutting());
 
 6364                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6367                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6368                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"password");
 
 6369                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getPassword());
 
 6370                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6373                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6374                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"allowedUsers");
 
 6375                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getAllowedUsers());
 
 6376                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6379                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6380                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"allowedUsersTimeGap");
 
 6382                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6385                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6386                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"pass_scoring");
 
 6387                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getPassScoring());
 
 6388                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6393                        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6394                        $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"reporting_date");
 
 6395                        preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->reporting_date, $matches);
 
 6396                        $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]));
 
 6397                        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6400                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6401                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"nr_of_tries");
 
 6402                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getNrOfTries()));
 
 6403                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6406                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6407                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"kiosk");
 
 6408                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getKiosk()));
 
 6409                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6413                $a_xml_writer->xmlStartTag(
'qtimetadatafield');
 
 6414                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"redirection_mode");
 
 6416                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6419                $a_xml_writer->xmlStartTag(
'qtimetadatafield');
 
 6420                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"redirection_url");
 
 6422                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6425                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6426                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"use_previous_answers");
 
 6428                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6431                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6432                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"title_output");
 
 6433                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getTitleOutput()));
 
 6434                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6437                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6438                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"results_presentation");
 
 6440                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6443                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6444                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"examid_in_test_pass");
 
 6446                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6449                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6450                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"examid_in_test_res");
 
 6452                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6455                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6456                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"show_summary");
 
 6458                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6461                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6462                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"score_reporting");
 
 6463                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getScoreReporting()));
 
 6464                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6466                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6467                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"solution_details");
 
 6469                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6470                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6471                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"print_bs_with_res");
 
 6473                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6476                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6477                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"instant_verification");
 
 6479                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6482                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6483                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"answer_feedback");
 
 6484                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getAnswerFeedback()));
 
 6485                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6488                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6489                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"answer_feedback_points");
 
 6491                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6494                $highscore_metadata = array(
 
 6506                foreach($highscore_metadata as $label => 
$data)
 
 6508                        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6509                        $a_xml_writer->xmlElement(
"fieldlabel", NULL, $label);
 
 6510                        $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", 
$data[
'value']));
 
 6511                        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6515                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6516                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"show_cancel");
 
 6517                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getShowCancel()));
 
 6518                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6521                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6522                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"show_marker");
 
 6523                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getShowMarker()));
 
 6524                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6527                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6528                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"fixed_participants");
 
 6530                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6533                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6534                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"showfinalstatement");
 
 6535                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", (($this->
getShowFinalStatement()) ? 
"1" : 
"0")));
 
 6536                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6539                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6540                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"showinfo");
 
 6541                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", (($this->
getShowInfo()) ? 
"1" : 
"0")));
 
 6542                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6545                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6546                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"mailnotification");
 
 6548                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6551                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6552                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"mailnottype");
 
 6554                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6557                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6558                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"exportsettings");
 
 6560                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6563                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6564                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"forcejs");
 
 6565                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", (($this->
getForceJS()) ? 
"1" : 
"0")));
 
 6566                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6569                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6570                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"customstyle");
 
 6571                $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getCustomStyle());
 
 6572                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6575                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6576                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"shuffle_questions");
 
 6577                $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getShuffleQuestions()));
 
 6578                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6581                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6582                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"processing_time");
 
 6584                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6587                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6588                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"enable_examview");
 
 6590                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6593                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6594                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"show_examview_html");
 
 6596                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6599                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6600                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"show_examview_pdf");
 
 6602                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6605                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6606                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"enable_archiving");
 
 6608                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6611                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6612                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"sign_submission");
 
 6614                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6617                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6618                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"char_selector_availability");
 
 6620                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6623                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6624                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"char_selector_definition");
 
 6626                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6629                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6630                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"skill_service");
 
 6632                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6635                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6636                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"result_tax_filters");
 
 6638                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6641                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6642                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"show_grading_status");
 
 6644                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6647                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6648                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"show_grading_mark");
 
 6650                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6656                        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6657                        $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"starting_time");
 
 6658                        preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->starting_time, $matches);
 
 6659                        $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]));
 
 6660                        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6665                        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6666                        $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"ending_time");
 
 6667                        preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->ending_time, $matches);
 
 6668                        $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]));
 
 6669                        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6674                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6675                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"activation_limited");
 
 6677                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6680                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6681                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"activation_start_time");
 
 6683                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6686                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6687                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"activation_end_time");
 
 6689                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6692                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6693                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"activation_visibility");
 
 6695                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6698                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6699                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"autosave");
 
 6700                $a_xml_writer->xmlElement(
"fieldentry", NULL, (
int)$this->
getAutosave());
 
 6701                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6704                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6705                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"autosave_ival");
 
 6706                $a_xml_writer->xmlElement(
"fieldentry", NULL, (
int)$this->
getAutosaveIval());
 
 6707                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6710                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6711                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"offer_question_hints");
 
 6713                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6716                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6717                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"instant_feedback_specific");
 
 6719                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6722                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6723                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"instant_feedback_answer_fixation");
 
 6725                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6728                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6729                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"obligations_enabled");
 
 6731                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6734                $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6735                $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"enable_processing_time");
 
 6737                $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6739                foreach ($this->mark_schema->mark_steps as $index => $mark)
 
 6742                        $a_xml_writer->xmlStartTag(
"qtimetadatafield");
 
 6743                        $a_xml_writer->xmlElement(
"fieldlabel", NULL, 
"mark_step_$index");
 
 6744                        $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
 
 6745                                "<short>%s</short><official>%s</official><percentage>%.2f</percentage><passed>%d</passed>",
 
 6746                                $mark->getShortName(), $mark->getOfficialName(), $mark->getMinimumLevel(), $mark->getPassed()
 
 6748                        $a_xml_writer->xmlEndTag(
"qtimetadatafield");
 
 6750                $a_xml_writer->xmlEndTag(
"qtimetadata");
 
 6753                $a_xml_writer->xmlStartTag(
"objectives");
 
 6755                $a_xml_writer->xmlEndTag(
"objectives");
 
 6761                                "solutionswitch" => 
"Yes" 
 6768                $a_xml_writer->xmlElement(
"assessmentcontrol", $attrs, NULL);
 
 6773                        $a_xml_writer->xmlStartTag(
"presentation_material");
 
 6774                        $a_xml_writer->xmlStartTag(
"flow_mat");
 
 6776                        $a_xml_writer->xmlEndTag(
"flow_mat");
 
 6777                        $a_xml_writer->xmlEndTag(
"presentation_material");
 
 6783                $a_xml_writer->xmlElement(
"section", $attrs, NULL);
 
 6784                $a_xml_writer->xmlEndTag(
"assessment");
 
 6785                $a_xml_writer->xmlEndTag(
"questestinterop");
 
 6787                $xml = $a_xml_writer->xmlDumpMem(FALSE);
 
 6789                foreach ($this->questions as $question_id)
 
 6792                        $qti_question = $question->toXML(
false);
 
 6793                        $qti_question = preg_replace(
"/<questestinterop>/", 
"", $qti_question);
 
 6794                        $qti_question = preg_replace(
"/<\/questestinterop>/", 
"", $qti_question);
 
 6795                        if (strpos($xml, 
"</section>") !== 
false)
 
 6797                                $xml = str_replace(
"</section>", 
"$qti_question</section>", $xml);
 
 6801                                $xml = str_replace(
"<section ident=\"1\"/>", 
"<section ident=\"1\">\n$qti_question</section>", $xml);
 
 6817                $this->mob_ids = array();
 
 6818                $this->file_ids = array();
 
 6821                $attrs[
"Type"] = 
"Test";
 
 6822                $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
 
 6828                $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Page Objects");
 
 6829                $ilBench->start(
"ContentObjectExport", 
"exportPageObjects");
 
 6831                $ilBench->stop(
"ContentObjectExport", 
"exportPageObjects");
 
 6832                $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Page Objects");
 
 6835                $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
 
 6836                $ilBench->start(
"ContentObjectExport", 
"exportMediaObjects");
 
 6838                $ilBench->stop(
"ContentObjectExport", 
"exportMediaObjects");
 
 6839                $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
 
 6842                $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
 
 6843                $ilBench->start(
"ContentObjectExport", 
"exportFileItems");
 
 6845                $ilBench->stop(
"ContentObjectExport", 
"exportFileItems");
 
 6846                $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
 
 6848                $a_xml_writer->xmlEndTag(
"ContentObject");
 
 6859                include_once 
"./Services/MetaData/classes/class.ilMD2XML.php";
 
 6861                $md2xml->setExportMode(
true);
 
 6862                $md2xml->startExport();
 
 6863                $a_xml_writer->appendXML($md2xml->getXML());
 
 6873                if ($a_tag == 
"Identifier" && $a_param == 
"Entry")
 
 6875                        include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 6893                include_once 
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
 
 6895                foreach ($this->questions as $question_id)
 
 6897                        $ilBench->start(
"ContentObjectExport", 
"exportPageObject");
 
 6898                        $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$question_id);
 
 6901                        $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
 
 6905                        $ilBench->start(
"ContentObjectExport", 
"exportPageObject_XML");
 
 6906                        include_once 
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
 
 6908                        $page_object->buildDom();
 
 6909                        $page_object->insertInstIntoIDs($a_inst);
 
 6910                        $mob_ids = $page_object->collectMediaObjects(
false);
 
 6911                        require_once 
'Services/COPage/classes/class.ilPCFileList.php';
 
 6913                        $xml = $page_object->getXMLFromDom(
false, 
false, 
false, 
"", 
true);
 
 6914                        $xml = str_replace(
"&",
"&", $xml);
 
 6915                        $a_xml_writer->appendXML($xml);
 
 6916                        $page_object->freeDom();
 
 6917                        unset ($page_object);
 
 6919                        $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_XML");
 
 6922                        $ilBench->start(
"ContentObjectExport", 
"exportPageObject_CollectMedia");
 
 6924                        foreach($mob_ids as $mob_id)
 
 6926                                $this->mob_ids[$mob_id] = $mob_id;
 
 6928                        $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_CollectMedia");
 
 6931                        $ilBench->start(
"ContentObjectExport", 
"exportPageObject_CollectFileItems");
 
 6933                        foreach($file_ids as $file_id)
 
 6935                                $this->file_ids[$file_id] = $file_id;
 
 6937                        $ilBench->stop(
"ContentObjectExport", 
"exportPageObject_CollectFileItems");
 
 6939                        $a_xml_writer->xmlEndTag(
"PageObject");
 
 6942                        $ilBench->stop(
"ContentObjectExport", 
"exportPageObject");
 
 6956                include_once 
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
 
 6958                foreach ($this->mob_ids as $mob_id)
 
 6960                        $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
 
 6964                                $media_obj->exportXML($a_xml_writer, $a_inst);
 
 6965                                $media_obj->exportFiles($a_target_dir);
 
 6977                include_once 
"./Modules/File/classes/class.ilObjFile.php";
 
 6979                foreach ($this->file_ids as $file_id)
 
 6981                        $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
 
 6982                        $file_obj = 
new ilObjFile($file_id, 
false);
 
 6983                        $file_obj->export($a_target_dir);
 
 6994                if (!is_array($this->import_mapping))
 
 7000                        return $this->import_mapping;
 
 7017                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);
 
 7023        public static function _getECTSGrade($points_passed, $reached_points, $max_points, $a, $b, $c, 
$d, $e, $fx)
 
 7025                include_once 
"./Modules/Test/classes/class.ilStatistics.php";
 
 7028                $passed_statistics->setData($points_passed);
 
 7029                $ects_percentiles = array
 
 7031                        "A" => $passed_statistics->quantile($a),
 
 7032                        "B" => $passed_statistics->quantile($b),
 
 7033                        "C" => $passed_statistics->quantile($c),
 
 7034                        "D" => $passed_statistics->quantile(
$d),
 
 7035                        "E" => $passed_statistics->quantile($e)
 
 7037                if (count($points_passed) && ($reached_points >= $ects_percentiles[
"A"]))
 
 7041                else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"B"]))
 
 7045                else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"C"]))
 
 7049                else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"D"]))
 
 7053                else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"E"]))
 
 7057                else if (strcmp($fx, 
"") != 0)
 
 7059                        if ($max_points > 0)
 
 7061                                $percentage = ($reached_points / $max_points) * 100.0;
 
 7062                                if ($percentage < 0) $percentage = 0.0;
 
 7068                        if ($percentage >= $fx)
 
 7088                return $this->mark_schema->checkMarks();
 
 7116                global 
$ilDB, $ilPluginAdmin, $tree;
 
 7118                require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 7138                                if(preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getReportingDate(), $matches))
 
 7140                                        $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 7142                                        if($now < $epoch_time)
 
 7180                $md_life =& $md->getLifecycle();
 
 7183                        if (strlen($a_author) == 0)
 
 7186                                $a_author = 
$ilUser->getFullname();
 
 7189                        $md_life =& $md->addLifecycle();
 
 7191                        $con =& $md_life->addContribute();
 
 7192                        $con->setRole(
"Author");
 
 7194                        $ent =& $con->addEntity();
 
 7195                        $ent->setEntity($a_author);
 
 7207                parent::createMetaData();
 
 7221                include_once 
"./Services/MetaData/classes/class.ilMD.php";
 
 7223                $md_life =& $md->getLifecycle();
 
 7226                        $ids =& $md_life->getContributeIds();
 
 7227                        foreach ($ids as 
$id)
 
 7229                                $md_cont =& $md_life->getContribute(
$id);
 
 7230                                if (strcmp($md_cont->getRole(), 
"Author") == 0)
 
 7232                                        $entids =& $md_cont->getEntityIds();
 
 7233                                        foreach ($entids as $entid)
 
 7235                                                $md_ent =& $md_cont->getEntity($entid);
 
 7236                                                array_push(
$author, $md_ent->getEntity());
 
 7254                include_once 
"./Services/MetaData/classes/class.ilMD.php";
 
 7255                $md =& 
new ilMD($obj_id, 0, 
"tst");
 
 7256                $md_life =& $md->getLifecycle();
 
 7259                        $ids =& $md_life->getContributeIds();
 
 7260                        foreach ($ids as 
$id)
 
 7262                                $md_cont =& $md_life->getContribute(
$id);
 
 7263                                if (strcmp($md_cont->getRole(), 
"Author") == 0)
 
 7265                                        $entids =& $md_cont->getEntityIds();
 
 7266                                        foreach ($entids as $entid)
 
 7268                                                $md_ent =& $md_cont->getEntity($entid);
 
 7269                                                array_push(
$author, $md_ent->getEntity());
 
 7288                $result_array = array();
 
 7298                                        $result_array[$obj_id] = $titles[
$ref_id];
 
 7306                return $result_array;
 
 7317        public function cloneObject($a_target_id,$a_copy_id = 0)
 
 7325                $newObj = parent::cloneObject($a_target_id,$a_copy_id);
 
 7331                if(!$cp_options->isRootNode($this->getRefId()))
 
 7333                        $newObj->setOnline($this->
isOnline());
 
 7358                $newObj->setKiosk($this->
getKiosk());
 
 7403                $newObj->saveToDb();
 
 7406                include_once 
"./Services/Certificate/classes/class.ilCertificate.php";
 
 7407                include_once 
"./Modules/Test/classes/class.ilTestCertificateAdapter.php";
 
 7410                $cert->cloneCertificate($newcert);
 
 7412                require_once 
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
 
 7414                $testQuestionSetConfigFactory->getQuestionSetConfig()->cloneQuestionSetRelatedData($newObj);
 
 7416                $newObj->saveToDb();
 
 7417                $newObj->updateMetaData();
 
 7419                include_once(
'./Services/Tracking/classes/class.ilLPObjSettings.php');
 
 7421                $obj_settings->cloneSettings($newObj->getId());
 
 7438                        global $tree, 
$ilDB, $ilPluginAdmin;
 
 7441                                $tree, 
$ilDB, $ilPluginAdmin, $this
 
 7444                        $questionSetConfig->loadFromDb();
 
 7446                        if( $questionSetConfig->isQuestionAmountConfigurationModePerPool() )
 
 7448                                require_once 
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
 
 7449                                require_once 
'Modules/Test/classes/class.ilTestRandomQuestionSetBuilderWithAmountPerPool.php';
 
 7450                                require_once 
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
 
 7456                                $sourcePoolDefinitionList->loadDefinitions();
 
 7458                                $num = $sourcePoolDefinitionList->getQuestionAmount();
 
 7462                                $num = $questionSetConfig->getQuestionAmountPerTest();
 
 7467                        $num = count($this->questions);
 
 7485                if (strcmp($question_id, 
"") != 0)
 
 7487                        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 7490                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 7505                $result = 
$ilDB->queryF(
"SELECT obj_fi FROM tst_tests WHERE test_id = %s",
 
 7512                        $object_id = 
$row[
"obj_fi"];
 
 7528                $result = 
$ilDB->queryF(
"SELECT tst_tests.obj_fi FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
 
 7535                        $object_id = 
$row[
"obj_fi"];
 
 7551                $result = 
$ilDB->queryF(
"SELECT test_id FROM tst_tests WHERE obj_fi = %s",
 
 7576                if (($active_id) && ($question_id))
 
 7580                                include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 7583                        $result = 
$ilDB->queryF(
"SELECT value1 FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
 7584                                array(
'integer', 
'integer', 
'integer'),
 
 7585                                array($active_id, $question_id, 
$pass)
 
 7610                        $result = 
$ilDB->queryF(
"SELECT question_text FROM qpl_questions WHERE question_id = %s",
 
 7633                $result_array = array();
 
 7637                        if (is_numeric($user_id))
 
 7639                                $result = 
$ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
 
 7640                                        "tst_active.submitted test_finished, matriculation FROM usr_data, tst_invited_user " .
 
 7641                                        "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7642                                        "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
 
 7644                                        array(
'text', 
'text', 
'text', 
'integer', 
'integer'),
 
 7645                                        array(
"", $this->lng->txt(
"anonymous"), 
"", $this->getTestId(), $user_id)
 
 7650                                $result = 
$ilDB->queryF(
"SELECT tst_active.active_id, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
 
 7651                                        "tst_active.submitted test_finished, matriculation FROM usr_data, tst_invited_user " .
 
 7652                                        "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7653                                        "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
 
 7655                                        array(
'text', 
'text', 
'text', 
'integer'),
 
 7656                                        array(
"", $this->lng->txt(
"anonymous"), 
"", $this->getTestId())
 
 7662                        if (is_numeric($user_id))
 
 7664                                $result = 
$ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
 
 7665                                        "tst_active.submitted test_finished, matriculation FROM usr_data, tst_invited_user " .
 
 7666                                        "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7667                                        "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
 
 7669                                        array(
'integer', 
'integer'),
 
 7675                                $result = 
$ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
 
 7676                                        "tst_active.submitted test_finished, matriculation FROM usr_data, tst_invited_user " .
 
 7677                                        "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
 
 7678                                        "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
 
 7685                $result_array = array();
 
 7688                        $result_array[
$row[
'usr_id']]= 
$row;
 
 7690                return $result_array;
 
 7705                        $result = $ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, tst_active.user_fi usr_id, %s login, %s lastname, %s firstname, tst_active.submitted test_finished, usr_data.matriculation, usr_data.active ".
 
 7706                                "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),
 
 7707                                array(
'text', 
'text', 
'text', 
'integer'),
 
 7708                                array(
"", $this->lng->txt(
"anonymous"), 
"", $this->getTestId())
 
 7713                        $result = 
$ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, tst_active.user_fi usr_id, usr_data.login, usr_data.lastname, usr_data.firstname, tst_active.submitted test_finished, usr_data.matriculation, usr_data.active ".
 
 7714                                "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),
 
 7724                foreach (
$data as $index => $participant)
 
 7726                        if (strlen(trim($participant[
"firstname"].$participant[
"lastname"])) == 0)
 
 7728                                $data[$index][
"lastname"] = $this->lng->txt(
"deleted_user");
 
 7738                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 7740                if (count($scoring) == 0) 
return array();
 
 7743                $filtered_participants = array();
 
 7744                foreach ($participants as $active_id => $participant)
 
 7746                        $qstType_IN_manScoreableQstTypes = 
$ilDB->in(
'qpl_questions.question_type_fi', $scoring, 
false, 
'integer');
 
 7749                                SELECT          tst_test_result.manual 
 7751                                FROM            tst_test_result 
 7753                                INNER JOIN      qpl_questions 
 7754                                ON                      tst_test_result.question_fi = qpl_questions.question_id 
 7756                                WHERE           tst_test_result.active_fi = %s 
 7757                                AND                     $qstType_IN_manScoreableQstTypes 
 7761                                        $queryString, array(
"integer"), array($active_id)
 
 7771                                                if ($participant->active) $filtered_participants[$active_id] = $participant;
 
 7774                                                if (!$participant->active) $filtered_participants[$active_id] = $participant;
 
 7777                                                $filtered_participants[$active_id] = $participant;
 
 7792                                                        $assessmentSetting = 
new ilSetting(
"assessment");
 
 7793                                                        $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
 
 7794                                                        if ($manscoring_done) $filtered_participants[$active_id] = $participant;
 
 7806                                                        $assessmentSetting = 
new ilSetting(
"assessment");
 
 7807                                                        $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
 
 7808                                                        if (!$manscoring_done) $filtered_participants[$active_id] = $participant;
 
 7816                                                        if (
$row[
"manual"]) $found++;
 
 7818                                                if (($found > 0) && ($found < $count)) $filtered_participants[$active_id] = $participant;
 
 7821                                                $filtered_participants[$active_id] = $participant;
 
 7826                return $filtered_participants;
 
 7840                if (!is_array($ids) || count($ids) ==0) 
return array();
 
 7844                        $result = $ilDB->queryF(
"SELECT usr_id, %s login, %s lastname, %s firstname, client_ip clientip FROM usr_data WHERE " . 
$ilDB->in(
'usr_id', $ids, 
false, 
'integer') . 
" ORDER BY login",
 
 7845                                array(
'text', 
'text', 
'text'),
 
 7846                                array(
"", $this->lng->txt(
"anonymous"), 
"")
 
 7851                        $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");
 
 7854                $result_array = array();
 
 7857                        $result_array[
$row[
"usr_id"]]= 
$row;
 
 7859                return $result_array;
 
 7864                if (!is_array($ids) || count($ids) ==0) 
return array();
 
 7876                if (!is_array($ids) || count($ids) ==0) 
return array();
 
 7878                foreach ($ids as $obj_id)
 
 7894                include_once 
"./Modules/Group/classes/class.ilObjGroup.php";
 
 7896                $members = $group->getGroupMemberIds();
 
 7897                include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 7898                foreach ($members as $user_id)
 
 7913                $members =  $rbacreview->assignedUsers($role_id,
"usr_id");
 
 7914                include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 7915                foreach ($members as $user_id)
 
 7933                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
 
 7934                        array(
'integer', 
'integer'),
 
 7949                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
 
 7950                        array(
'integer', 
'integer'),
 
 7953                $affectedRows = 
$ilDB->manipulateF(
"INSERT INTO tst_invited_user (test_fi, user_fi, clientip, tstamp) VALUES (%s, %s, %s, %s)",
 
 7954                        array(
'integer', 
'integer', 
'text', 
'integer'),
 
 7955                        array($this->
getTestId(), $user_id, (strlen($client_ip)) ? $client_ip : NULL, time())
 
 7964                $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_invited_user SET clientip = %s, tstamp = %s WHERE test_fi=%s and user_fi=%s",
 
 7965                        array(
'text', 
'integer', 
'integer', 
'integer'),
 
 7966                        array((strlen($client_ip)) ? $client_ip : NULL, time(), $this->
getTestId(), $user_id)
 
 7978                if (is_numeric($question_fi))
 
 7980                        $result = 
$ilDB->queryF(
"SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s AND question_fi=%s",
 
 7981                                array(
'integer', 
'integer'),
 
 7982                                array($active_id, $question_fi)
 
 7987                        $result = 
$ilDB->queryF(
"SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s",
 
 7992                $result_array = array();
 
 7995                        $result_array[
$row[
"question_fi"]]= 
$row;
 
 7997                return $result_array;
 
 8009                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_qst_solved WHERE active_fi = %s AND question_fi = %s",
 
 8010                        array(
'integer', 
'integer'),
 
 8011                        array($active_id, $question_id)
 
 8013                $affectedRows = 
$ilDB->manipulateF(
"INSERT INTO tst_qst_solved (solved, question_fi, active_fi) VALUES (%s, %s, %s)",
 
 8014                        array(
'integer', 
'integer', 
'integer'),
 
 8015                        array($value, $question_id, $active_id)
 
 8026                $result = 
$ilDB->queryF(
"SELECT submitted FROM tst_active WHERE active_id=%s AND submitted=%s",
 
 8027                        array(
'integer', 
'integer'),
 
 8028                        array($active_id, 1)
 
 8030                return $result->numRows() == 1;
 
 8041                if (!is_numeric($user_id))
 
 8044                $result = 
$ilDB->queryF(
"SELECT submitted FROM tst_active WHERE test_fi=%s AND user_fi=%s AND submitted=%s",
 
 8045                        array(
'integer', 
'integer', 
'integer'),
 
 8048                return $result->numRows() == 1;
 
 8083                        "user_id" => $this->lng->txt(
"user_id"),
 
 8084                        "matriculation" =>  $this->lng->txt(
"matriculation"),
 
 8085                        "lastname" =>  $this->lng->txt(
"lastname"),
 
 8086                        "firstname" => $this->lng->txt(
"firstname"),
 
 8087                        "login" =>$this->lng->txt(
"login"),
 
 8088                        "reached_points" => $this->lng->txt(
"tst_reached_points"),
 
 8089                        "max_points" => $this->lng->txt(
"tst_maximum_points"),
 
 8090                        "percent_value" => $this->lng->txt(
"tst_percent_solved"),
 
 8091                        "mark" => $this->lng->txt(
"tst_mark"),
 
 8092                        "ects" => $this->lng->txt(
"ects_grade")
 
 8095                if (count($participants))
 
 8101                        foreach ($participants as $active_id => $user_rec)
 
 8104                                $reached_points = 0;
 
 8106                                foreach ($this->questions as $value)
 
 8109                                        if (is_object($question))
 
 8111                                                $max_points += $question->getMaximumPoints();
 
 8112                                                $reached_points += $question->getReachedPoints($active_id);
 
 8115                                if ($max_points > 0)
 
 8117                                        $percentvalue = $reached_points / $max_points;
 
 8118                                        if ($percentvalue < 0) $percentvalue = 0.0;
 
 8124                                $mark_obj = $this->mark_schema->getMatchingMark($percentvalue * 100);
 
 8128                                        $mark = $mark_obj->getOfficialName();
 
 8129                                        $ects_mark = $this->
getECTSGrade($passed_array, $reached_points, $max_points);
 
 8133                                        $user_rec[
'firstname'] = 
"";
 
 8134                                        $user_rec[
'lastname'] = $this->lng->txt(
"anonymous");
 
 8137                                        "user_id"=>$user_rec[
'usr_id'],
 
 8138                                        "matriculation" =>  $user_rec[
'matriculation'],
 
 8139                                        "lastname" =>  $user_rec[
'lastname'],
 
 8140                                        "firstname" => $user_rec[
'firstname'],
 
 8141                                        "login"=>$user_rec[
'login'],
 
 8142                                        "reached_points" => $reached_points,
 
 8143                                        "max_points" => $max_points,
 
 8144                                        "percent_value" => $percentvalue,
 
 8146                                        "ects" => $ects_mark
 
 8166                $resultarray = array();
 
 8167                foreach (
$row as $rowindex => $entry)
 
 8174                        if (strpos($entry, 
"\"") !== FALSE)
 
 8176                                $entry = str_replace(
"\"", 
"\"\"", $entry);
 
 8184                        $entry = str_replace(chr(13).chr(10), chr(10), $entry);
 
 8188                            $entry = 
"\"" . $entry . 
"\"";
 
 8191                        $resultarray[$rowindex] = $entry;
 
 8193                return $resultarray;
 
 8207                $result = 
$ilDB->queryF(
"SELECT tries FROM tst_active WHERE active_id = %s",
 
 8214                        return $row[
"tries"];
 
 8234                        $result = 
$ilDB->queryF(
"SELECT MAX(pass) maxpass FROM tst_pass_result WHERE active_fi = %s",
 
 8241                                $max = 
$row[
"maxpass"];
 
 8264                $result = 
$ilDB->queryF(
"SELECT * FROM tst_pass_result WHERE active_fi = %s",
 
 8274                                if(
$row[
"maxpoints"] > 0)
 
 8276                                        $factor = 
$row[
"points"] / 
$row[
"maxpoints"];
 
 8283                                if($factor > $bestfactor)
 
 8286                                        $bestfactor = $factor;
 
 8289                        if (is_array($bestrow))
 
 8291                                return $bestrow[
"pass"];
 
 8314                $counted_pass = NULL;
 
 8323                return $counted_pass;
 
 8339                        global $tree, 
$ilDB, 
$lng, $ilPluginAdmin;
 
 8341                        require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
 8343                        $testSession = $testSessionFactory->getSession($active_id);
 
 8345                        require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
 8349                        require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
 8351                        $dynamicQuestionSetConfig->loadFromDb();
 
 8363                include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
 8365                foreach ($this->questions as $value)
 
 8369                                $workedthrough += 1;
 
 8372                return $workedthrough;
 
 8394                        SELECT  tst_pass_result.tstamp pass_res_tstamp, 
 8395                                        tst_test_result.tstamp quest_res_tstamp 
 8397                        FROM tst_pass_result 
 8399                        LEFT JOIN tst_test_result 
 8400                        ON tst_test_result.active_fi = tst_pass_result.active_fi 
 8401                        AND tst_test_result.pass = tst_pass_result.pass 
 8403                        WHERE tst_pass_result.active_fi = %s 
 8404                        AND tst_pass_result.pass = %s 
 8406                        ORDER BY tst_test_result.tstamp DESC 
 8410                        array(
'integer', 
'integer'),
 
 8411                        array($active_id, 
$pass)
 
 8416                        if( 
$row[
'qres_tstamp'] )
 
 8418                                return $row[
'quest_res_tstamp'];
 
 8421                        return $row[
'pass_res_tstamp'];
 
 8438                        "executable" => 
true,
 
 8439                        "errormessage" => 
"" 
 8443                        $result[
"executable"] = 
false;
 
 8449                        $result[
"executable"] = 
false;
 
 8478                                                        $result[
"executable"] = 
false;
 
 8479                                                        $result[
"errormessage"] = $this->lng->txt(
"detail_max_processing_time_reached");
 
 8489                        require_once 
'Modules/Test/classes/class.ilTestPassesSelector.php';
 
 8491                        $testPassesSelector->setActiveId($active_id);
 
 8492                        $testPassesSelector->setLastFinishedPass(
$testSession->getLastFinishedPass());
 
 8494                        $closedPasses = $testPassesSelector->getClosedPasses();
 
 8498                                $result[
"executable"] = 
false;
 
 8499                                $result[
"errormessage"] = $this->lng->txt(
"maximum_nr_of_tries_reached");
 
 8519                        if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getReportingDate(), $matches))
 
 8521                                $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 8523                                if ($now < $epoch_time)
 
 8539                $notimeleft = FALSE;
 
 8568                if ($active_id < 1) 
return FALSE;
 
 8573                $result = 
$ilDB->queryF(
"SELECT tst_times.started FROM tst_times WHERE tst_times.active_fi = %s AND tst_times.pass = %s ORDER BY tst_times.started",
 
 8574                        array(
'integer', 
'integer'),
 
 8575                        array($active_id, 
$pass)
 
 8580                        if (preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", 
$row[
"started"], $matches))
 
 8582                                return mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
 
 8630                                                questtypes.type_tag, 
 8632                                                tstquest.obligatory, 
 8633                                                origquest.obj_fi orig_obj_fi 
 8635                        FROM            qpl_questions questions 
 8637                        INNER JOIN      qpl_qst_type questtypes 
 8638                        ON                      questtypes.question_type_id = questions.question_type_fi 
 8640                        INNER JOIN      tst_test_question tstquest 
 8641                        ON                      tstquest.question_fi = questions.question_id 
 8643                        LEFT JOIN       qpl_questions origquest 
 8644                        ON                      origquest.question_id = questions.original_id 
 8646                        WHERE           tstquest.test_fi = %s 
 8648                        ORDER BY        tstquest.sequence 
 8651                $query_result = 
$ilDB->queryF(
 
 8655                $questions = array();
 
 8657                while (
$row = 
$ilDB->fetchAssoc($query_result))
 
 8672        public function getPotentialRandomTestQuestions()
 
 8681                                                questtypes.type_tag, 
 8682                                                origquest.obj_fi orig_obj_fi 
 8684                        FROM            qpl_questions questions 
 8686                        INNER JOIN      qpl_qst_type questtypes 
 8687                        ON                      questtypes.question_type_id = questions.question_type_fi 
 8689                        INNER JOIN      tst_rnd_cpy tstquest 
 8690                        ON                      tstquest.qst_fi = questions.question_id 
 8692                        LEFT JOIN       qpl_questions origquest 
 8693                        ON                      origquest.question_id = questions.original_id 
 8695                        WHERE           tstquest.tst_fi = %s 
 8698                $query_result = 
$ilDB->queryF(
 
 8702                $questions = array();
 
 8704                while (
$row = 
$ilDB->fetchAssoc($query_result))
 
 8724                return ($this->shuffle_questions) ? 1 : 0;
 
 8735                $this->shuffle_questions = ($a_shuffle) ? 1 : 0;
 
 8752                return ($this->show_summary) ? $this->show_summary : 0;
 
 8769                $this->show_summary = $a_value;
 
 8780                if (($this->show_summary & 1) > 0)
 
 8800                        $this->show_summary = 1;
 
 8804                        $this->show_summary = 0;
 
 8816                if (($this->show_summary & 2) > 0)
 
 8836                        $this->show_summary = $this->show_summary | 2;
 
 8842                                $this->show_summary = $this->show_summary ^ 2;
 
 8855                if (($this->show_summary & 4) > 0)
 
 8875                        $this->show_summary = $this->show_summary | 4;
 
 8881                                $this->show_summary = $this->show_summary ^ 4;
 
 8894                        if (($this->show_summary & 8) > 0)
 
 8914                                $this->show_summary = $this->show_summary | 8;
 
 8920                                        $this->show_summary = $this->show_summary ^ 8;
 
 8933                return ($this->results_presentation) ? $this->results_presentation : 0;
 
 8944                if (($this->results_presentation & 1) > 0)
 
 8962                if (($this->results_presentation & 2) > 0)
 
 8980                if (($this->results_presentation & 4) > 0)
 
 8998                if (($this->results_presentation & 8) > 0)
 
 9016                        if (($this->results_presentation & 16) > 0)
 
 9034                        if (($this->results_presentation & 32) > 0)
 
 9050                if (($this->results_presentation & 64) > 0)
 
 9066                if(($this->results_presentation & 128) > 0)
 
 9084                $this->results_presentation = $a_results_presentation;
 
 9099                        $this->results_presentation = $this->results_presentation | 1;
 
 9105                                $this->results_presentation = $this->results_presentation ^ 1;
 
 9120                        $this->results_presentation = $this->results_presentation | 2;
 
 9126                                $this->results_presentation = $this->results_presentation ^ 2;
 
 9152                        $this->results_presentation = $this->results_presentation | 4;
 
 9158                                $this->results_presentation = $this->results_presentation ^ 4;
 
 9173                        $this->results_presentation = $this->results_presentation | 8;
 
 9179                                $this->results_presentation = $this->results_presentation ^ 8;
 
 9194                                $this->results_presentation = $this->results_presentation | 16;
 
 9200                                        $this->results_presentation = $this->results_presentation ^ 16;
 
 9215                                $this->results_presentation = $this->results_presentation | 32;
 
 9221                                        $this->results_presentation = $this->results_presentation ^ 32;
 
 9236                        $this->results_presentation = $this->results_presentation | 64;
 
 9242                                $this->results_presentation = $this->results_presentation ^ 64;
 
 9256                        $this->results_presentation = $this->results_presentation | 128;
 
 9262                                $this->results_presentation = $this->results_presentation ^ 128;
 
 9273                $result = 
$ilDB->queryF(
"SELECT user_fi FROM tst_active WHERE active_id = %s",
 
 9280                        return $row[
"user_fi"];
 
 9306                return ($this->allowedUsers) ? $this->allowedUsers : 0;
 
 9311                $this->allowedUsers = $a_allowed_users;
 
 9316                return ($this->allowedUsersTimeGap) ? $this->allowedUsersTimeGap : 0;
 
 9321                $this->allowedUsersTimeGap = $a_allowed_users_time_gap;
 
 9330                if (($nr_of_users > 0) && ($time_gap > 0))
 
 9333                        $time_border = $now - $time_gap;
 
 9334                        $str_time_border = strftime(
"%Y%m%d%H%M%S", $time_border);
 
 9336                                SELECT DISTINCT tst_times.active_fi 
 9338                                INNER JOIN tst_active 
 9339                                ON tst_times.active_fi = tst_active.active_id 
 9341                                        tst_times.pass > tst_active.last_finished_pass OR tst_active.last_finished_pass IS NULL 
 9343                                WHERE tst_times.tstamp > %s 
 9344                                AND tst_active.test_fi = %s 
 9347                        if (
$result->numRows() >= $nr_of_users)
 
 9349                                include_once 
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
 
 9368                $result = 
$ilDB->queryF(
"SELECT finished FROM tst_times WHERE active_fi = %s ORDER BY finished DESC",
 
 9375                        return $row[
"finished"];
 
 9389                if (preg_match(
"/<[^>]*?>/", $a_text))
 
 9409                for ($i = 0; $i < $a_material->getMaterialCount(); $i++)
 
 9411                        $material = $a_material->getMaterial($i);
 
 9412                        if (strcmp($material[
"type"], 
"mattext") == 0)
 
 9414                                $result .= $material[
"material"]->getContent();
 
 9416                        if (strcmp($material[
"type"], 
"matimage") == 0)
 
 9418                                $matimage = $material[
"material"];
 
 9419                                if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches))
 
 9422                                        if (!is_array(
$_SESSION[
"import_mob_xhtml"])) 
$_SESSION[
"import_mob_xhtml"] = array();
 
 9423                                        array_push(
$_SESSION[
"import_mob_xhtml"], array(
"mob" => $matimage->getLabel(), 
"uri" => $matimage->getUri()));
 
 9442                include_once 
"./Services/RTE/classes/class.ilRTE.php";
 
 9443                include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
 
 9445                $a_xml_writer->xmlStartTag(
"material");
 
 9447                        "texttype" => 
"text/plain" 
 9449                if ($this->
isHTML($a_material))
 
 9451                        $attrs[
"texttype"] = 
"text/xhtml";
 
 9456                foreach (
$mobs as $mob)
 
 9458                        $moblabel = 
"il_" . IL_INST_ID . 
"_mob_" . $mob;
 
 9459                        if (strpos($a_material, 
"mm_$mob") !== FALSE)
 
 9465                                                "label" => $moblabel,
 
 9466                                                "uri" => 
"objects/" . 
"il_" . IL_INST_ID . 
"_mob_" . $mob . 
"/" . $mob_obj->getTitle()
 
 9469                                $a_xml_writer->xmlElement(
"matimage", $imgattrs, NULL);
 
 9472                $a_xml_writer->xmlEndTag(
"material");
 
 9483                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
 9497                $affectedRows = 
$ilDB->manipulateF(
"UPDATE tst_tests SET certificate_visibility = %s, tstamp = %s WHERE test_id = %s",
 
 9498                        array(
'text', 
'integer', 
'integer'),
 
 9499                        array($a_value, time(), $this->
getTestId())
 
 9511                return (strlen($this->certificate_visibility)) ? $this->certificate_visibility : 0;
 
 9522                $this->certificate_visibility = $a_value;
 
 9533                return ($this->anonymity) ? 1 : 0;
 
 9547                                $this->anonymity = 1;
 
 9550                                $this->anonymity = 0;
 
 9563                return ($this->show_cancel) ? 1 : 0;
 
 9577                                $this->show_cancel = 1;
 
 9580                                $this->show_cancel = 0;
 
 9593                return ($this->show_marker) ? 1 : 0;
 
 9607                                $this->show_marker = 1;
 
 9610                                $this->show_marker = 0;
 
 9623                return ($this->fixed_participants) ? 1 : 0;
 
 9637                                $this->fixed_participants = 1;
 
 9640                                $this->fixed_participants = 0;
 
 9656                $result = 
$ilDB->queryF(
"SELECT anonymity FROM tst_tests WHERE obj_fi = %s",
 
 9662                        return $row[
'anonymity'];
 
 9678                        SELECT          tst_tests.question_set_type 
 9680                        INNER JOIN      tst_tests 
 9681                        ON                      tst_active.test_fi = tst_tests.test_id 
 9682                        WHERE           tst_active.active_id = %s 
 9689                        return $row[
'question_set_type'];
 
 9705                throw new Exception(__METHOD__.
' is deprecated ... use ilObjTest::lookupQuestionSetTypeByActiveId() instead!');
 
 9709                $result = 
$ilDB->queryF(
"SELECT tst_tests.random_test FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_active.test_fi = tst_tests.test_id",
 
 9715                        return $row[
'random_test'];
 
 9734                        return $this->lng->txt(
"anonymous") . $suffix;
 
 9738                        include_once 
'./Services/User/classes/class.ilObjUser.php';
 
 9740                        if (strlen($uname[
"firstname"].$uname[
"lastname"]) == 0) $uname[
"firstname"] = $this->lng->txt(
"deleted_user");
 
 9743                                return trim($uname[
"lastname"] . 
", " . $uname[
"firstname"]) .  $suffix;
 
 9747                                return trim($uname[
"firstname"] . 
" " . $uname[
"lastname"]) .  $suffix;
 
 9763                        return $this->lng->txt(
"tst_start_test");
 
 9765                $active_pass = $this->
_getPass($active_id);
 
 9769                        if ($active_pass == 0)
 
 9771                                return $this->lng->txt(
"tst_start_test");
 
 9775                                return $this->lng->txt(
"tst_start_new_test_pass");
 
 9780                        return $this->lng->txt(
"tst_resume_test");
 
 9789        public function getAvailableDefaults()
 
 9798                        "SELECT * FROM tst_test_defaults WHERE user_fi = %s ORDER BY name ASC",
 
 9802                $defaults = array();
 
 9805                        $defaults[
$row[
"test_defaults_id"]] = 
$row;
 
 9826                $result = 
$ilDB->queryF(
"SELECT * FROM tst_test_defaults WHERE test_defaults_id = %s",
 
 9828                        array($test_defaults_id)
 
 9850                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_test_defaults WHERE test_defaults_id = %s",
 
 9852                        array($test_default_id)
 
 9866                $testsettings = array(
 
 9957                $next_id = 
$ilDB->nextId(
'tst_test_defaults');
 
 9959                        'tst_test_defaults',
 
 9961                                'test_defaults_id' => array(
'integer', $next_id),
 
 9962                                'name'             => array(
'text', $a_name),
 
 9963                                'user_fi'          => array(
'integer', 
$ilUser->getId()),
 
 9964                                'defaults'         => array(
'clob', serialize($testsettings)),
 
 9965                                'marks'            => array(
'clob', serialize($this->mark_schema)),
 
 9966                                'tstamp'           => array(
'integer', time())
 
 9980                $testsettings = unserialize($test_defaults[
"defaults"]);
 
 9981                include_once 
"./Modules/Test/classes/class.assMarkSchema.php";
 
 9982                $this->mark_schema = unserialize($test_defaults[
"marks"]);
 
10016                $this->
setKiosk($testsettings[
"Kiosk"]);
 
10020                $this->
setECTSFX($testsettings[
"ECTSFX"]);
 
10022                if( isset($testsettings[
"isRandomTest"]) )
 
10024                        if( $testsettings[
"isRandomTest"] )
 
10033                elseif( isset($testsettings[
"questionSetType"]) )
 
10056                if( isset($testsettings[
'examid_in_kiosk']) )
 
10064                if( isset($testsettings[
'show_exam_id']) )
 
10118                if (extension_loaded(
"tidy"))
 
10122                                "output-xml"     => 
true,
 
10123                                "numeric-entities" => 
true 
10125                        $tidy = 
new tidy();
 
10126                        $tidy->parseString($print_output, $config, 
'utf8');
 
10127                        $tidy->cleanRepair();
 
10128                        $print_output = tidy_get_output($tidy);
 
10129                        $print_output = preg_replace(
"/^.*?(<html)/", 
"\\1", $print_output);
 
10133                        $print_output = str_replace(
" ", 
" ", $print_output);
 
10134                        $print_output = str_replace(
"⊗", 
"X", $print_output);
 
10136                $xsl = file_get_contents(
"./Modules/Test/xml/question2fo.xsl");
 
10139                $xsl = str_replace(
 
10140                                'font-family="Helvetica, unifont"',
 
10141                                'font-family="'.
$GLOBALS[
'ilSetting']->
get(
'rpc_pdf_font',
'Helvetica, unifont').
'"',
 
10145                $args = array( 
'/_xml' => $print_output, 
'/_xsl' => $xsl );
 
10148                $output = xslt_process($xh, 
"arg:/_xml", 
"arg:/_xsl", NULL, $args, $params);
 
10162                $content = preg_replace(
"/href=\".*?\"/", 
"", $content);
 
10163                $printbody = 
new ilTemplate(
"tpl.il_as_tst_print_body.html", TRUE, TRUE, 
"Modules/Test");
 
10165                $printbody->setVariable(
"ADM_CONTENT", $content);
 
10166                $printbody->setCurrentBlock(
"css_file");
 
10168                $printbody->parseCurrentBlock();
 
10169                $printbody->setCurrentBlock(
"css_file");
 
10171                $printbody->parseCurrentBlock();
 
10172                $printoutput = $printbody->get();
 
10173                $html = str_replace(
"href=\"./", 
"href=\"" . ILIAS_HTTP_PATH . 
"/", $printoutput);
 
10174                $html = preg_replace(
"/<div id=\"dontprint\">.*?<\\/div>/ims", 
"", $html);
 
10175                if (extension_loaded(
"tidy"))
 
10179                                "output-xml"     => 
true,
 
10180                                "numeric-entities" => 
true 
10182                        $tidy = 
new tidy();
 
10183                        $tidy->parseString($html, $config, 
'utf8');
 
10184                        $tidy->cleanRepair();
 
10185                        $html = tidy_get_output($tidy);
 
10186                        $html = preg_replace(
"/^.*?(<html)/", 
"\\1", $html);
 
10190                        $html = str_replace(
" ", 
" ", $html);
 
10191                        $html = str_replace(
"⊗", 
"X", $html);
 
10193                $html = preg_replace(
"/src=\".\\//ims", 
"src=\"" . ILIAS_HTTP_PATH . 
"/", $html);
 
10207                include_once 
"./Services/Utilities/classes/class.ilUtil.php";
 
10209                $fp = fopen($fo_file, 
"w"); fwrite($fp, $fo); fclose($fp);
 
10211                include_once 
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
 
10221                        $ilLog->write(__METHOD__.
': '.$e->getMessage());
 
10226                        $ilLog->write(__METHOD__.
': '.$e->getMessage());
 
10253                $result = 
$ilDB->queryF(
"SELECT feedback FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
10254                        array(
'integer', 
'integer', 
'integer'),
 
10255                        array($active_id, $question_id, 
$pass)
 
10260                        include_once(
"./Services/RTE/classes/class.ilRTE.php");
 
10276        function saveManualFeedback($active_id, $question_id, 
$pass, $feedback)
 
10280                $affectedRows = 
$ilDB->manipulateF(
"DELETE FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
 
10281                        array(
'integer', 
'integer', 
'integer'),
 
10282                        array($active_id, $question_id, 
$pass)
 
10285                if (strlen($feedback))
 
10287                        $next_id = 
$ilDB->nextId(
'tst_manual_fb');
 
10290                                                                                                           'manual_feedback_id'         => array( 
'integer',    $next_id ),
 
10291                                                                                                           'active_fi'                          => array( 
'integer',    $active_id ),
 
10292                                                                                                           'question_fi'                        => array( 
'integer',    $question_id ),
 
10293                                                                                                           'pass'                                       => array( 
'integer',    
$pass),
 
10295                                                                                                           'tstamp'                                     => array( 
'integer',    time() ),
 
10298                        include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
 
10302                                include_once 
"./Modules/Test/classes/class.ilObjTestAccess.php";
 
10304                                include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
10339                include_once 
"./Modules/Test/classes/class.ilTestSequence.php";
 
10350                $this->test_id = $a_id;
 
10364                if (count($participants))
 
10366                        foreach ($participants as $active_id => $user_rec)
 
10369                                $reached_points = 0;
 
10371                                foreach ($this->questions as $value)
 
10374                                        if (is_object($question))
 
10376                                                $max_points += $question->getMaximumPoints();
 
10377                                                $reached_points += $question->getReachedPoints($active_id);
 
10378                                                if ($max_points > 0)
 
10380                                                        $percentvalue = $reached_points / $max_points;
 
10381                                                        if ($percentvalue < 0) $percentvalue = 0.0;
 
10389                                                        $user_rec[
'firstname'] = 
"";
 
10390                                                        $user_rec[
'lastname'] = $this->lng->txt(
"anonymous");
 
10393                                                        "user_id"=>$user_rec[
'usr_id'],
 
10394                                                        "matriculation" =>  $user_rec[
'matriculation'],
 
10395                                                        "lastname" =>  $user_rec[
'lastname'],
 
10396                                                        "firstname" => $user_rec[
'firstname'],
 
10397                                                        "login"=>$user_rec[
'login'],
 
10398                                                        "question_id" => $question->getId(),
 
10399                                                        "question_title" => $question->getTitle(),
 
10400                                                        "reached_points" => $reached_points,
 
10401                                                        "max_points" => $max_points
 
10418                $result = 
$ilDB->queryF(
"SELECT t.obj_fi obj_id FROM tst_test_question q, tst_tests t WHERE q.test_fi = t.test_id AND q.question_fi = %s",
 
10423                return $rec[
"obj_id"];
 
10434                global $ilPluginAdmin;
 
10435                if ($ilPluginAdmin->isActive(
IL_COMP_MODULE, 
"TestQuestionPool", 
"qst", $a_pname))
 
10449                $result = 
$ilDB->queryF(
"SELECT passed FROM tst_result_cache WHERE active_fi = %s",
 
10456                        return $row[
'passed'];
 
10461                        $result_array =& $this->
getTestResult($active_id, $counted_pass);
 
10462                        return $result_array[
"test"][
"passed"];
 
10475                        include_once 
"./Services/Certificate/classes/class.ilCertificate.php";
 
10476                        include_once 
"./Modules/Test/classes/class.ilTestCertificateAdapter.php";
 
10478                        if ($cert->isComplete())
 
10520        public function getParticipantsForTestAndQuestion(
$test_id, $question_id)
 
10526                        SELECT tst_test_result.active_fi, tst_test_result.question_fi, tst_test_result.pass  
10527                        FROM tst_test_result, tst_active, qpl_questions  
10528                        WHERE tst_active.active_id = tst_test_result.active_fi  
10529                        AND tst_active.test_fi = %s  
10530                        AND tst_test_result.question_fi = qpl_questions.question_id  
10531                        AND tst_test_result.question_fi = %s";
 
10534                        array(
'integer', 
'integer'),
 
10537                $foundusers = array();
 
10541                        if (!array_key_exists(
$row[
"active_fi"], $foundusers))
 
10543                                $foundusers[
$row[
"active_fi"]] = array();
 
10545                        array_push($foundusers[
$row[
"active_fi"]], array(
"pass" => 
$row[
"pass"], 
"qid" => 
$row[
"question_fi"]));
 
10547                return $foundusers;
 
10558                $foundParticipants =& 
$data->getParticipants();
 
10559                $results = array(
"overview" => array(), 
"questions" => array());
 
10560                if (count($foundParticipants)) 
 
10562                        $results[
"overview"][$this->lng->txt(
"tst_eval_total_persons")] = count($foundParticipants);
 
10564                        $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished")] = $total_finished;
 
10566                        $diff_seconds = $average_time;
 
10567                        $diff_hours    = floor($diff_seconds/3600);
 
10568                        $diff_seconds -= $diff_hours   * 3600;
 
10569                        $diff_minutes  = floor($diff_seconds/60);
 
10570                        $diff_seconds -= $diff_minutes * 60;
 
10571                        $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
 
10573                        $total_passed_reached = 0;
 
10574                        $total_passed_max = 0;
 
10575                        $total_passed_time = 0;
 
10576                        foreach ($foundParticipants as $userdata)
 
10578                                if ($userdata->getPassed()) 
 
10581                                        $total_passed_reached += $userdata->getReached();
 
10582                                        $total_passed_max += $userdata->getMaxpoints();
 
10583                                        $total_passed_time += $userdata->getTimeOfWork();
 
10586                        $average_passed_reached = $total_passed ? $total_passed_reached / $total_passed : 0;
 
10587                        $average_passed_max = $total_passed ? $total_passed_max / $total_passed : 0;
 
10588                        $average_passed_time = $total_passed ? $total_passed_time / $total_passed : 0;
 
10589                        $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed")] = $total_passed;
 
10590                        $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);
 
10591                        $average_time = $average_passed_time;
 
10592                        $diff_seconds = $average_time;
 
10593                        $diff_hours    = floor($diff_seconds/3600);
 
10594                        $diff_seconds -= $diff_hours   * 3600;
 
10595                        $diff_minutes  = floor($diff_seconds/60);
 
10596                        $diff_seconds -= $diff_minutes * 60;
 
10597                        $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
 
10600                foreach (
$data->getQuestionTitles() as $question_id => $question_title)
 
10605                        foreach ($foundParticipants as $userdata)
 
10607                                for ($i = 0; $i <= $userdata->getLastPass(); $i++)
 
10609                                        if (is_object($userdata->getPass($i)))
 
10611                                                $question =& $userdata->getPass($i)->getAnsweredQuestionByQuestionId($question_id);
 
10612                                                if (is_array($question))
 
10615                                                        $reached += $question[
"reached"];
 
10616                                                        $max += $question[
"points"];
 
10621                        $percent = $max ? $reached/$max * 100.0 : 0;
 
10623                        $results[
"questions"][$question_id] = array(
 
10625                                sprintf(
"%.2f", $answered ? $reached / $answered : 0) . 
" " . strtolower($this->lng->txt(
"of")) . 
" " . sprintf(
"%.2f", $answered ? $max / $answered : 0),
 
10626                                sprintf(
"%.2f", $percent) . 
"%",
 
10628                                sprintf(
"%.2f", $answered ? $reached / $answered : 0),
 
10629                                sprintf(
"%.2f", $answered ? $max / $answered : 0),
 
10641                include_once(
"./Modules/Test/classes/class.ilTestExport.php");
 
10643                return $test_exp->buildExportFile();
 
10661                $this->mailnotification = $a_notification;
 
10666                include_once 
"./Modules/Test/classes/class.ilTestMailNotification.php";
 
10671                $mail->sendSimpleNotification($owner_id, $this->
getTitle(), $usr_data);
 
10681                include_once 
"./Modules/Test/classes/class.ilObjTestGUI.php";
 
10682                include_once 
"./Modules/Test/classes/tables/class.ilEvaluationAllTableGUI.php";
 
10684                return $table_gui->getSelectedColumns();
 
10689                include_once 
"./Modules/Test/classes/class.ilTestMailNotification.php";
 
10695                include_once 
"./Modules/Test/classes/class.ilTestExport.php";
 
10697                $file = $exportObj->exportToExcel($deliver = FALSE, 
'active_id', $active_id, $passedonly = FALSE);
 
10698                include_once 
"./Services/Mail/classes/class.ilFileDataMail.php";
 
10700                $fd->copyAttachmentFile(
$file, 
"result_" . $active_id . 
".xls");
 
10701                $file_names[] = 
"result_" . $active_id . 
".xls";
 
10703                $mail->sendAdvancedNotification($owner_id, $this->
getTitle(), $usr_data, $file_names);
 
10705                if(count($file_names))
 
10707                        $fd->unlinkFiles($file_names);
 
10718                $query = 
"SELECT usr_id FROM usr_data";
 
10722                        $activequery = sprintf(
"SELECT user_fi FROM tst_active WHERE test_fi = %s AND user_fi = %s",
 
10723                                $ilDB->quote($this->getTestId()),
 
10726                        $activeresult = 
$ilDB->query($activequery);
 
10727                        if ($activeresult->numRows() == 0)
 
10729                                $user_id = 
$data[
'usr_id'];
 
10730                                if ($user_id != 13)
 
10732                                        include_once 
"./Modules/Test/classes/class.ilTestSession.php";
 
10736                                        $testSession->setTestId($this->
getTestId());
 
10737                                        $testSession->setUserId($user_id);
 
10740                                        $nr_of_passes = rand(1, $passes);
 
10744                                                include_once 
"./Modules/Test/classes/class.ilTestSequence.php";
 
10746                                                if (!$testSequence->hasSequence())
 
10751                                                for ($seq = 1; $seq <= count($this->questions); $seq++)
 
10753                                                        $question_id = 
$testSequence->getQuestionForSequence($seq);
 
10757                                                if (
$pass < $nr_of_passes - 1)
 
10766                                                        $testSession->setSubmittedTimestamp(date(
'Y-m-d H:i:s'));
 
10771                                        if ($number == 0) 
return;
 
10783                        FROM            tst_result_cache 
10784                        WHERE           active_fi = %s 
10788                        $query, array(
'integer'), array($active_id)
 
10793                        include_once 
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
 
10799                                FROM            tst_result_cache 
10800                                WHERE           active_fi = %s 
10804                                $query, array(
'integer'), array($active_id)
 
10816                if ($this->mailnottype == 1)
 
10830                        $this->mailnottype = 1;
 
10834                        $this->mailnottype = 0;
 
10840                if ($this->exportsettings)
 
10854                        $this->exportsettings = $a_settings;
 
10858                        $this->exportsettings = 0;
 
10864                if (($this->exportsettings & 1) > 0)
 
10878                        $this->exportsettings = $this->exportsettings | 1;
 
10884                                $this->exportsettings = $this->exportsettings ^ 1;
 
10890            return $this->enabled_view_mode;
 
10894            $this->enabled_view_mode = $mode;
 
10906            $new_array = array();
 
10909            $query = 
'SELECT question_fi  FROM tst_test_question WHERE test_fi = %s';
 
10910            $types = array(
'integer');
 
10913            $new_question_id += 1;
 
10920                $qid = 
$row[
'question_fi'];
 
10922                if ($qid == $new_question_id) {
 
10925                else if ($qid == $previous_question_id) {
 
10926                    $new_array[$position++] = $qid;
 
10927                    $new_array[$position++] =  $new_question_id;
 
10931                    $new_array[$position++] = $qid;
 
10935            $update_query = 
'UPDATE tst_test_question SET sequence = %s WHERE test_fi = %s AND question_fi = %s';
 
10936            $update_types = array(
'integer', 
'integer', 
'integer');
 
10938            foreach($new_array as $position => $qid) {
 
10939                $ilDB->manipulateF(
 
10973                'pass_details' => 
'setShowPassDetails',
 
10974                'solution_details' => 
'setShowSolutionDetails',
 
10975                'solution_printview' => 
'setShowSolutionPrintview',
 
10976                'solution_feedback' => 
'setShowSolutionFeedback',
 
10977                'solution_answers_only' => 
'setShowSolutionAnswersOnly',
 
10978                'solution_signature' => 
'setShowSolutionSignature',
 
10979                'solution_suggested' => 
'setShowSolutionSuggested',
 
10981            foreach($setter as $key => $setter) {
 
10996            $this->poolUsage = (boolean)$usage;
 
11007            foreach($orders as 
$id => $position)
 
11012                                isset($obligations[
$id]) && $obligations[
$id] ? 1 : 0
 
11016                                UPDATE          tst_test_question 
11019                                WHERE           question_fi = %s 
11022                        $ilDB->manipulateF(
 
11023                                $query, array(
'integer', 
'integer', 
'integer'), array($i, $obligatory, 
$id)
 
11033            if ($question_before) {
 
11034                $query = 
'SELECT sequence, test_fi FROM tst_test_question WHERE question_fi = %s';
 
11035                $types = array(
'integer');
 
11036                $values = array($question_before);
 
11040            if (!$question_before || ($rset && !(
$row = 
$ilDB->fetchAssoc($rset)))) {
 
11047            $update = 
'UPDATE tst_test_question SET sequence = sequence + 1 WHERE sequence > %s AND test_fi = %s';
 
11048            $types = array(
'integer', 
'integer');
 
11049            $values = array(
$row[
'sequence'], 
$row[
'test_fi']);
 
11050            $ilDB->manipulateF($update, $types, $values);
 
11052            $update = 
'UPDATE tst_test_question SET sequence = %s WHERE question_fi = %s';
 
11053            $types = array(
'integer', 
'integer');
 
11054            $values = array(
$row[
'sequence'] + 1, $question_to_move);
 
11055            $ilDB->manipulateF($update, $types, $values);
 
11065                $IN_questions = 
$ilDB->in(
'q1.question_id', array_keys(
$questions), 
false, 
'integer');
 
11068                        SELECT          count(q1.question_id) cnt 
11070                        FROM            qpl_questions q1 
11072                        INNER JOIN      qpl_questions q2 
11073                        ON                      q2.question_id = q1.original_id 
11075                        WHERE           $IN_questions 
11076                        AND                     q1.obj_fi = q2.obj_fi 
11083                return $row[
'cnt'] > 0;
 
11096                $result = 
$ilDB->queryF(
"SELECT test_fi,MAX(pass) AS pass FROM tst_active".
 
11097                        " JOIN tst_pass_result ON (tst_pass_result.active_fi = tst_active.active_id)".
 
11098                        " WHERE user_fi=%s".
 
11099                        " GROUP BY test_fi",
 
11100                        array(
'integer', 
'integer'),
 
11101                        array($a_user_id, 1)
 
11107                        $all[$obj_id] = (bool)
$row[
"pass"];
 
11123                $this->online = (bool)$a_online;
 
11128                $this->print_best_solution_with_result = (bool) $status;
 
11158                $this->activation_visibility = (bool) $a_value;
 
11168           return (
bool)$this->activation_limited;
 
11173           $this->activation_limited = (bool)$a_value;
 
11185                $this->_highscore_enabled = (bool)$a_enabled;
 
11195                return (
bool) $this->_highscore_enabled;
 
11207                $this->_highscore_anon = (bool)$a_anon;
 
11221                return (
bool) $this->_highscore_anon;
 
11251                $this->_highscore_achieved_ts = (bool)$a_achieved_ts;
 
11261                return (
bool) $this->_highscore_achieved_ts;
 
11271                $this->_highscore_score = (bool)$a_score;
 
11281                return (
bool) $this->_highscore_score;
 
11291                $this->_highscore_percentage = (bool)$a_percentage;
 
11301                return (
bool) $this->_highscore_percentage;
 
11311                $this->_highscore_hints = (bool)$a_hints;
 
11321                return (
bool) $this->_highscore_hints;
 
11331                $this->_highscore_wtime = (bool)$a_wtime;
 
11341                return (
bool) $this->_highscore_wtime;
 
11351                $this->_highscore_own_table = (bool)$a_own_table;
 
11361                return (
bool) $this->_highscore_own_table;
 
11371                $this->_highscore_top_table = (bool)$a_top_table;
 
11381                return (
bool) $this->_highscore_top_table;
 
11392                $this->_highscore_top_num = (int)$a_top_num;
 
11405                $retval = $a_retval;
 
11406                if ( (
int) $this->_highscore_top_num != 0)
 
11408                        $retval = $this->_highscore_top_num;
 
11464                switch ($specific_answer_feedback)
 
11467                                $this->specific_answer_feedback = 1;
 
11470                                $this->specific_answer_feedback = 0;
 
11477                switch ($this->specific_answer_feedback)
 
11514                require_once(
'Modules/TestQuestionPool/classes/class.assQuestion.php');
 
11522                $obligationPossible = call_user_func(array($classConcreteQuestion, 
'isObligationPossible'), $questionId);
 
11524                return $obligationPossible;
 
11537            $rset = 
$ilDB->queryF(
'SELECT obligatory FROM tst_test_question WHERE question_fi = %s', array(
'integer'), array($question_id));
 
11541                        return (
bool) 
$row[
'obligatory'];
 
11563            $rset = 
$ilDB->queryF(
 
11564                    'SELECT obligations_answered FROM tst_pass_result WHERE active_fi = %s AND pass = %s',
 
11565                    array(
'integer', 
'integer'),
 
11566                    array($active_id, 
$pass)
 
11571                        return (
bool)
$row[
'obligations_answered'];
 
11589                $rset = 
$ilDB->queryF(
 
11590                        'SELECT count(*) cnt FROM tst_test_question WHERE test_fi = %s AND obligatory = 1',
 
11596                return (
bool)
$row[
'cnt'] > 0;
 
11639        #region Examview / PDF Examview 
11702                return (strlen($this->activation_starting_time)) ? $this->activation_starting_time : NULL;
 
11707                return (strlen($this->activation_ending_time)) ? $this->activation_ending_time : NULL;
 
11715                $result = 
$ilDB->query(
"SELECT tst_times.active_fi, tst_times.started FROM tst_times, tst_active WHERE tst_times.active_fi = tst_active.active_id ORDER BY tst_times.tstamp DESC");
 
11718                        $times[
$row[
'active_fi']] = 
$row[
'started'];
 
11728                $result = 
$ilDB->queryF(
"SELECT tst_addtime.active_fi, tst_addtime.additionaltime FROM tst_addtime, tst_active WHERE tst_addtime.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
 
11734                        $times[
$row[
'active_fi']] = 
$row[
'additionaltime'];
 
11743                $result = 
$ilDB->queryF(
"SELECT additionaltime FROM tst_addtime WHERE active_fi = %s",
 
11750                        return $row[
'additionaltime'];
 
11759                $participants = array();
 
11760                if ($active_id == 0)
 
11762                        $result = 
$ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s",
 
11768                                array_push($participants, 
$row[
'active_id']);
 
11773                        array_push($participants, $active_id);
 
11775                foreach ($participants as $active_id)
 
11777                        $result = 
$ilDB->queryF(
"SELECT active_fi FROM tst_addtime WHERE active_fi = %s",
 
11783                                $ilDB->manipulateF(
"DELETE FROM tst_addtime WHERE active_fi = %s",
 
11789                        $ilDB->manipulateF(
"UPDATE tst_active SET tries = %s, submitted = %s, submittimestamp = %s WHERE active_id = %s",
 
11790                                array(
'integer',
'integer',
'timestamp',
'integer'),
 
11791                                array(0, 0, NULL, $active_id)
 
11794                        $ilDB->manipulateF(
"INSERT INTO tst_addtime (active_fi, additionaltime, tstamp) VALUES (%s, %s, %s)",
 
11795                                array(
'integer',
'integer',
'integer'),
 
11796                                array($active_id, $minutes, time())
 
11799                        require_once 
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
 
11826        public function getMaxPassOfTest()
 
11834                        SELECT MAX(tst_pass_result.pass) + 1 max_res 
11835                        FROM tst_pass_result  
11836                        INNER JOIN tst_active ON tst_active.active_id = tst_pass_result.active_fi 
11837                        WHERE test_fi = '.$ilDB->quote($this->
getTestId(), 
'integer').
' 
11841                return (
int)
$data[
'max_res'];
 
11854                $exam_id_query  = 
'SELECT exam_id FROM tst_pass_result WHERE active_fi = %s AND pass = %s';
 
11855                $exam_id_result = 
$ilDB->queryF( $exam_id_query, array( 
'integer', 
'integer' ), array( $active_id, 
$pass ) );
 
11856                if (
$ilDB->numRows( $exam_id_result ) == 1)
 
11858                        $exam_id_row = 
$ilDB->fetchAssoc( $exam_id_result );
 
11860                        if ($exam_id_row[
'exam_id'] != 
null)
 
11862                                return $exam_id_row[
'exam_id'];
 
11880                $inst_id = 
$ilSetting->get( 
'inst_id', 
null );
 
11882                if($test_obj_id === 
null)
 
11888                        $obj_id  = $test_obj_id;
 
11891                $examId = 
'I' . $inst_id . 
'_T' . $obj_id . 
'_A' . $active_id . 
'_P' . 
$pass;
 
11943                $this->char_selector_availability = (int) $availability;
 
11959                $this->char_selector_definition = $definition;
 
12002                $query = 
"SELECT question_set_type FROM tst_tests WHERE obj_fi = %s";
 
12063                                return $lng->txt(
'tst_question_set_type_fixed');
 
12066                                return $lng->txt(
'tst_question_set_type_random');
 
12069                                return $lng->txt(
'tst_question_set_type_dynamic');
 
12102                require_once 
'class.ilTestScoring.php';
 
12104                $scoring->setPreserveManualScores($preserve_manscoring);
 
12105                $scoring->recalculateSolutions();
 
12110                require_once 
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
 
12112                $questionChangeListeners = array(
 
12116                return $questionChangeListeners;
 
12126                        INNER JOIN tst_tests 
12127                        ON test_id = test_fi 
12137                        $objIds[] = (int)
$row[
'obj_fi'];
 
12170                if( !self::isSkillManagementGloballyActivated() )
 
12182                if( self::$isSkillManagementGloballyActivated === 
null )
 
12184                        include_once 
'Services/Skill/classes/class.ilSkillManagementSettings.php';
 
12187                        self::$isSkillManagementGloballyActivated = $skmgSet->isActivated();
 
12232                $activeId = $testOBJ->getActiveIdOfUser($userId);
 
12234                require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
12237                require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
12240                $testSession = $testSessionFactory->getSession($activeId);
 
12245                if($a_force_new_run)
 
12266                $activeId = $testOBJ->getActiveIdOfUser($userId);
 
12268                require_once 
'Modules/Test/classes/class.ilTestSessionFactory.php';
 
12271                $testSessionFactory->reset();
 
12273                require_once 
'Modules/Test/classes/class.ilTestSequenceFactory.php';
 
12276                $testSession = $testSessionFactory->getSession($activeId);
 
A class defining mark schemas for assessment test objects.
isError($data, $code=null)
Tell whether a value is a PEAR error.
_getQuestionTitle($question_id)
Returns the question title of a question with a given id.
static getFeedbackClassNameByQuestionType($questionType)
static _getOriginalId($question_id)
Returns the original id of a question.
_getSolutionMaxPass($question_id, $active_id)
Returns the maximum pass a users question solution.
_updateTestResultCache($active_id, ilAssQuestionProcessLocker $processLocker=null)
@TODO Move this to a proper place.
static _getSuggestedSolutionOutput($question_id)
Returns the output of the suggested solution.
static getGuiClassNameByQuestionType($questionType)
static _isWorkedThrough($active_id, $question_id, $pass=NULL)
Returns true if the question was worked through in the given pass Worked through means that the user ...
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
_getQuestionType($question_id)
Returns the question type of a question with a given id.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
deleteRequestsByActiveIds($activeIds)
Deletes all hint requests relating to a testactive included in given active ids.
deleteRequestsByQuestionIds($questionIds)
Deletes all hint requests relating to a question included in given question ids.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
TableGUI class for evaluation of all users.
This class handles all operations on files (attachments) in directory ilias_data/mail.
recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
_addLog($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=FALSE, $test_ref_id=NULL)
Add an assessment log entry.
_getLogLanguage()
retrieve the log language for assessment logging
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
_getManualScoring()
Retrieve the manual scoring settings.
& _getAvailableQuestionpools($use_object_id=FALSE, $equal_points=FALSE, $could_be_offline=FALSE, $showPath=FALSE, $with_questioncount=FALSE, $permission="read", $usr_id="")
Returns the available question pools for the active user.
_getParticipantData($active_id)
Retrieves a participant name from active id.
static getPoolQuestionChangeListener(ilDB $db, $poolObjId)
static _getECTSGrade($points_passed, $reached_points, $max_points, $a, $b, $c, $d, $e, $fx)
{Returns the ECTS grade for a number of reached points.string The ECTS grade short description}
setHighscorePercentage($a_percentage)
Sets if the percentages of the scores pass should be shown.
setShowSolutionFeedback($a_feedback=TRUE)
Sets if the the feedback should be presented to the user in the solution or not.
getResetProcessingTime()
Returns wheather the processing time should be reset or not.
_buildName($is_anonymous, $user_id, $firstname, $lastname, $title)
Builds a user name for the output depending on test type and existence of the user.
getActivationEndingTime()
& _getAvailableTests($use_object_id=FALSE)
Returns the available tests for the active user.
setPrintBestSolutionWithResult($status)
setAnswerFeedback($answer_feedback=0)
Sets the generic feedback for the test @deprecate Use setGenericAnswerFeedback instead.
__construct($a_id=0, $a_call_by_reference=true)
Constructor.
_getPassScoring($active_id)
Gets the pass scoring type.
setIntroduction($introduction="")
Sets the introduction text of the ilObjTest object.
exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog)
export page objects to xml (see ilias_co.dtd)
getProcessingTimeAsMinutes()
getEstimatedWorkingTime()
Returns the estimated working time for the test calculated from the working time of the contained que...
setShowInfo($a_info=1)
Set whether the complete information page is shown or the required data only.
const QUESTION_SET_TYPE_DYNAMIC
type setting value for dynamic question set (continues testing mode)
getTestId()
Gets the database id of the additional test data.
getECTSOutput()
{int|bool}
& createQuestionGUI($question_type, $question_id=-1)
Creates a question GUI instance of a given question type.
endingTimeReached()
Returns true if the ending time of a test is reached An ending time is not available for self assessm...
canShowTestResults($testSession, $user_id)
setClientIP($user_id, $client_ip)
setAllowedUsersTimeGap($a_allowed_users_time_gap)
getQuestionSetType()
getter for question set type
getQuestionTitle($title)
Returns the title of a test question and checks if the title output is allowed.
setTestId($a_id)
Sets the test ID.
& getExistingQuestions($pass=NULL)
Get the id's of the questions which are already part of the test.
getShowKioskModeParticipant()
Returns the status of the kiosk mode participant.
setKiosk($kiosk=0)
Sets the kiosk mode for the test.
getHighscoreWTime()
Gets if the column with the workingtime should be shown.
getHighscoreOwnTable()
Gets if the own rankings table should be shown.
getShowKioskModeTitle()
Returns the status of the kiosk mode title.
hasRandomQuestionsForPass($active_id, $pass)
Checkes wheather a random test has already created questions for a given pass or not.
getHighscoreTopTable()
Gets, if the top-rankings table should be shown.
getCountSystem()
Gets the count system for the calculation of points.
isShowExamIdInTestPassEnabled()
setPostponingEnabled($postponingEnabled)
setInstantFeedbackSolution($instant_feedback=0)
Sets the instant feedback for the solution.
getEnableProcessingTime()
Returns the state of the processing time (enabled/disabled)
_getObjectIDFromTestID($test_id)
Returns the ILIAS test object id for a given test id.
getListOfQuestionsStart()
Returns if the list of questions should be presented as the first page of the test.
& getCompleteEvaluationData($withStatistics=TRUE, $filterby="", $filtertext="")
loadFromDb()
Loads a ilObjTest object from a database.
pcArrayShuffle($array)
Shuffles the values of a given array.
_getTitleOutput($active_id)
Returns the value of the title_output status.
$char_selector_availability
isComplete(ilTestQuestionSetConfig $testQuestionSetConfig)
Returns true, if a test is complete for use and can be set online.
getInstantFeedbackSolution()
Returns 1 if the correct solution will be shown after answering a question.
setFinalStatement($a_statement="")
Sets the final statement text of the ilObjTest object.
setFixedParticipants($a_value=1)
Sets the fixed participants status.
& getTestResult($active_id, $pass=NULL, $ordered_sequence=FALSE)
Calculates the results of a test for a given user and returns an array with all test results.
getStartingTimeOfUser($active_id, $pass=null)
Returns the unix timestamp of the time a user started a test.
_getLastAccess($active_id)
getStartTestLabel($active_id)
Returns the "Start the Test" label for the Info page.
static _getTestDefaults($test_defaults_id)
setOnline($a_online=true)
_getActiveIdOfUser($user_id="", $test_id="")
Gets the active id of the tst_active table for the active user.
& getParticipants()
Returns all persons who started the test.
setProcessingTime($processing_time="00:00:00")
Sets the processing time for the test.
setHighscoreAnon($a_anon)
Sets if the highscores should be anonymized.
setScoringFeedbackOptionsByArray($options)
getDetailedTestResults($participants)
returns all test results for all participants
_getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
setActivationEndingTime($ending_time=NULL)
setAllowedUsers($a_allowed_users)
isNrOfTriesReached($tries)
returns if number of tries are reached
_lookupAnonymity($a_obj_id)
Returns the anonymity status of a test with a given object id.
static getTestObjIdsWithActiveForUserId($userId)
setTemplate($template_id)
setShowExamviewPdf($show_examview_pdf)
_getCountSystem($active_id)
Gets the count system for the calculation of points.
setShowExamIdInTestPassEnabled($show_exam_id_in_test_pass_enabled)
inviteUser($user_id, $client_ip="")
Invites a user to a test.
setScoreCutting($a_score_cutting=SCORE_CUT_QUESTION)
Sets the type of score cutting.
getQuestionCount()
Returns the number of questions in the test.
create($a_upload=false)
create test object
getQuestiontext($question_id)
Returns the question text for a given question.
setResultsPresentationOptionsByArray($options)
QTIMaterialToString($a_material)
Reads an QTI material tag an creates a text string.
& getTestDefaults($test_defaults_id)
Returns the test defaults for a given id.
const QUESTION_SET_TYPE_RANDOM
type setting value for random question set
prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output in tests.
saveAuthorToMetadata($a_author="")
Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be c...
processPrintoutput2FO($print_output)
Convert a print output to XSL-FO.
setPassDeletionAllowed($passDeletionAllowed)
setter for the test setting passDeletionAllowed
setHighscoreScore($a_score)
Sets if the actual score should be displayed.
const HIGHSCORE_SHOW_ALL_TABLES
sendSimpleNotification($active_id)
getXMLZip()
Get zipped xml file for test.
getShowSolutionListComparison()
loadQuestions($active_id="", $pass=NULL)
Load the test question id's from the database.
createExportDirectory()
creates data directory for export files (data_dir/tst_data/tst_<id>/export, depending on data directo...
setShowGradingStatusEnabled($showGradingStatusEnabled)
& getAvailableQuestionpools($use_object_id=false, $equal_points=false, $could_be_offline=false, $show_path=FALSE, $with_questioncount=FALSE, $permission="read")
Returns the available question pools for the active user.
setListOfQuestionsStart($a_value=TRUE)
Sets if the the list of questions as the start page of the test.
_getImportDirectory()
Get the import directory location of the test.
getFixedParticipants()
Returns the fixed participants status.
isBestSolutionPrintedWithResult()
getAnsweredQuestionCount($active_id, $pass=NULL)
Retrieves the number of answered questions for a given user in a given test.
_lookupRandomTestFromActiveId($active_id)
Returns the random status of a test with a given object id.
setShowSolutionDetails($a_details=1)
Sets if the the solution details should be presented to the user or not.
& createTestSequence($active_id, $pass, $shuffle)
$show_exam_id_in_test_results_enabled
getFinalStatement()
Gets the final statement.
getProcessingTimeAsArray()
Returns the processing time for the test.
deliverPDFfromHTML($content, $title=NULL)
Delivers a PDF file from XHTML.
questionMoveDown($question_id)
Moves a question down in order.
setShowFinalStatement($show=0)
Sets whether the final statement should be shown or not.
logAction($logtext="", $question_id="")
Logs an action into the Test&Assessment log.
createMetaData()
Create meta data entry.
getEvaluationAdditionalFields()
Gets additional user fields that should be shown in the user evaluation.
setListOfQuestionsDescription($a_value=TRUE)
Sets the show_summary attribute to TRUE if the list of questions should be presented with the questio...
setEndingTimeEnabled($ending_time_enabled)
setShowPassDetails($a_details=1)
Sets if the pass details should be shown when a test is not finished.
isScoreReportingAvailable()
insertQuestion(ilTestQuestionSetConfig $testQuestionSetConfig, $question_id, $linkOnly=false)
Insert a question in the list of questions.
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
buildName($user_id, $firstname, $lastname, $title)
Builds a user name for the output depending on test type and existence of the user.
hasQuestionsWithoutQuestionpool()
$print_best_solution_with_result
setCountSystem($a_count_system=COUNT_PARTIAL_SOLUTIONS)
Sets the count system for the calculation of points.
setStartingTime($starting_time=NULL)
Sets the starting time in database timestamp format for the test.
_getQuestionCountAndPointsForPassOfParticipant($active_id, $pass)
$instantFeedbackAnswerFixationEnabled
removeAllTestEditings($question_id="")
Removes all references to the question in executed tests in case the question has been changed.
setShowSolutionSuggested($a_solution=FALSE)
Set to TRUE, if the suggested solution should be shown in the solution.
getImagePath()
Returns the image path for web accessable images of a test The image path is under the CLIENT_WEB_DIR...
setActivationStartingTime($starting_time=NULL)
getShowSolutionSignature()
Returns if the signature field should be shown in the test results.
getHighscoreAnon()
Gets if the highscores should be anonymized per setting.
exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export media objects to xml (see ilias_co.dtd)
getPassScoring()
Gets the pass scoring type.
setInstantFeedbackAnswerFixationEnabled($instantFeedbackAnswerFixationEnabled)
setHighscoreHints($a_hints)
Sets if the number of requested hints should be shown.
getPassword()
Returns the password for test access.
isShowGradingStatusEnabled()
setPasswordEnabled($passwordEnabled)
setPassScoring($a_pass_scoring=SCORE_LAST_PASS)
Sets the pass scoring.
isHighscoreAnon()
Gets if the highscores should be displayed anonymized.
setOfferingQuestionHintsEnabled($offeringQuestionHintsEnabled)
sets offering question hints enabled/disabled
randomSelectQuestions($nr_of_questions, $questionpool, $use_obj_id=0, $qpls="", $pass=NULL)
Returns a random selection of questions.
setShowSolutionListComparison($a_comparison=FALSE)
Set to TRUE, if the list of answers should be shown prior to finish the test.
getShowSolutionAnswersOnly()
Returns if the full solution (including ILIAS content) should be presented to the solution or not.
setShowSolutionPrintview($a_printview=1)
Sets if the the solution printview should be presented to the user or not.
_setImportDirectory($a_import_dir=null)
set import directory
& evalTotalPersonsArray($name_sort_order="asc")
Returns all persons who started the test.
& evalStatistical($active_id)
Returns the statistical evaluation of the test for a specified user.
const SCORE_REPORTING_IMMIDIATLY
& getTestParticipants()
Returns a list of all participants in a test.
getStartingTime()
Returns the starting time of the test.
canEditEctsGrades()
{boolean}
startingTimeReached()
Returns true if the starting time of a test is reached A starting time is not available for self asse...
& getTotalPointsPassedArray()
Returns an array with the total points of all users who passed the test This array could be used for ...
_getSolvedQuestions($active_id, $question_fi=null)
get solved questions
getShowPassDetails()
Returns if the pass details should be shown when a test is not finished.
getQuestionSetTypeTranslation(ilLanguage $lng, $questionSetType)
& evalResultsOverview()
Creates an associated array with the results of all participants of a test.
getResultsPresentation()
Returns the combined results presentation value.
$show_exam_id_in_test_pass_enabled
saveCompleteStatus(ilTestQuestionSetConfig $testQuestionSetConfig)
Checks if the test is complete and saves the status in the database.
getKioskMode()
Returns the kiosk mode.
getSequenceSettings()
SEQUENCE SETTING = POSTPONING ENABLED !!
static allObligationsAnswered($test_id, $active_id, $pass)
checks wether all questions marked as obligatory were answered within the test pass with given testId...
_getBestPass($active_id)
Retrieves the best pass of a given user for a given test.
getShowSolutionFeedback()
Returns if the feedback should be presented to the solution or not.
setShowSolutionSignature($a_signature=FALSE)
Set to TRUE, if the signature field should be shown in the solution.
setHighscoreTopNum($a_top_num)
Sets the number of entries which are to be shown in the top-rankings table.
evalTotalFinished()
Returns the number of total finished tests.
getTimeExtensionsOfParticipants()
getActivationStartingTime()
evalTotalStartedAverageTime()
Returns the average processing time for all started tests.
removeTestResultsForUser($user_id)
const QUESTION_SET_TYPE_FIXED
type setting value for fixed question set
setHighscoreEnabled($a_enabled)
Sets if the highscore feature should be enabled.
duplicateQuestionForTest($question_id)
Takes a question and creates a copy of the question for use in the test.
setRedirectionMode($redirection_mode=0)
$showGradingStatusEnabled
hasSingleChoiceQuestions()
Returns TRUE if the test contains single choice results.
setMailNotification($a_notification)
Set mail notification settings.
isActiveTestSubmitted($user_id=null)
returns if the active for user_id has been submitted
setQuestionSetType($questionSetType)
setter for question set type
setReportingDate($reporting_date)
Sets the reporting date of the ilObjTest object.
static lookupQuestionSetType($objId)
lookup-er for question set type
moveQuestionAfterOLD($previous_question_id, $new_question_id)
setCharSelectorDefinition($definition='')
saveToDb($properties_only=FALSE)
Saves a ilObjTest object to a database.
setCustomStyle($a_customStyle=NULL)
Set the custom style.
setKioskMode($a_kiosk=FALSE)
Sets the kiosk mode for the test.
getKiosk()
Returns the kiosk mode.
getResultsForActiveId($active_id)
isExecutable($testSession, $user_id, $allowPassIncrease=FALSE)
Checks if the test is executable by the given user.
getShowSolutionDetails()
Returns if the solution details should be presented to the user or not.
setAuthor($author="")
Sets the authors name of the ilObjTest object.
setQuestionOrderAndObligations($orders, $obligations)
setListOfQuestions($a_value=TRUE)
Sets if the the list of questions should be presented to the user or not.
$activation_starting_time
getAuthor()
Gets the authors name of the ilObjTest object.
getAnswerFeedbackPoints()
Returns 1 if answer specific feedback as reached points is activated.
setIntroductionEnabled($introductionEnabled)
getProcessingTimeInSeconds($active_id="")
Returns the processing time for the test in seconds.
inviteGroup($group_id)
Invites all users of a group to a test.
getScoreCutting()
Determines if the score of a question should be cut at 0 points or the score of the whole test.
_lookupTestObjIdForQuestionId($a_q_id)
Get test Object ID for question ID.
getShowSolutionSuggested()
getHighscorePercentage()
Gets if the percentage column should be shown.
const SCORE_REPORTING_FINISHED
addDefaults($a_name)
Adds the defaults of this test to the test defaults.
getCustomStyles()
Return the available custom styles.
setCertificateVisibility($a_value)
Sets the visibility settings of the certificate.
_getMCScoring($active_id)
Gets the scoring type for multiple choice questions.
setResetProcessingTime($reset=0)
Sets wheather the processing time should be reset or not.
moveQuestions($move_questions, $target_index, $insert_mode)
Move questions to another position.
setListOfQuestionsSettings($a_value=0)
Sets the settings for the list of questions options in the test properties This could contain one of ...
isSkillServiceToBeConsidered()
sendAdvancedNotification($active_id)
modifyExportIdentifier($a_tag, $a_param, $a_value)
Returns the installation id for a given identifier.
updateWorkingTime($times_id)
Update the working time of a test when a question is answered.
static isSkillManagementGloballyActivated()
getHighscoreHints()
Gets, if the column with the number of requested hints should be shown.
getMCScoring()
Gets the scoring type for multiple choice questions.
getGenericAnswerFeedback()
Returns 1 if generic answer feedback is to be shown.
setObligationsEnabled($obligationsEnabled=true)
sets obligations enabled/disabled
setSkillServiceEnabled($skillServiceEnabled)
fromXML(ilQTIAssessment $assessment)
Receives parameters from a QTI parser and creates a valid ILIAS test object.
setHighscoreTopTable($a_top_table)
Sets if the top-rankings table should be shown.
isRandomTest()
Returns the fact wether this test is a random questions test or not.
getQuestionType($question_id)
Returns the question type of a question with a given id.
_lookupAuthor($obj_id)
Gets the authors name of the ilObjTest object.
getShowSolutionPrintview()
Returns if the solution printview should be presented to the user or not.
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
getShowInfo()
Gets whether the complete information page is shown or the required data only.
setListOfQuestionsEnd($a_value=TRUE)
Sets if the the list of questions as the end page of the test.
setActivationVisibility($a_value)
setQuestionSetSolved($value, $question_id, $user_id)
sets question solved state to value for given user_id
isFixedTest()
Returns the fact wether this test is a fixed question set test or not.
getMarkSchema()
{ASS_MarkSchema}
& _getCompleteWorkingTimeOfParticipants($test_id)
Returns the complete working time in seconds for all test participants.
deleteTest()
Deletes the test and all related objects, files and database entries.
deleteDefaults($test_default_id)
Deletes the defaults for a test.
getListOfQuestionsEnd()
Returns if the list of questions should be presented as the last page of the test.
getHighscoreEnabled()
Gets the setting which determines if the highscore feature is enabled.
getReportingDate()
Gets the reporting date of the ilObjTest object.
setForceJS($a_js=1)
Set whether JavaScript should be forced for tests.
isTestFinished($active_id)
returns if the active for user_id has been submitted
static _lookupRandomTest($a_obj_id)
Returns the fact wether the test with passed obj id is a random questions test or not.
const HIGHSCORE_SHOW_OWN_TABLE
getQuestionDataset($question_id)
Returns the dataset for a given question id.
getCharSelectorDefinition()
getTitleOutput()
Returns the value of the title_output status.
getAggregatedResultsData()
Returns the aggregated test results.
isDynamicTest()
Returns the fact wether this test is a dynamic question set test or not.
setShowExamIdInTestResultsEnabled($show_exam_id_in_test_results_enabled)
getHighscoreAchievedTS()
Returns if date and time of the scores achievement should be displayed.
& getQuestionTitlesAndIndexes()
Returns the titles of the test questions in question sequence.
getAllTestResults($participants, $prepareForCSV=true)
returns all test results for all participants
getListOfQuestions()
Returns if the list of questions should be presented to the user or not.
canViewResults()
Returns true, if the test results can be viewed.
isMaxProcessingTimeReached($starting_time, $active_id)
Returns whether the maximum processing time for a test is reached or not.
isHTML($a_text)
Checks if a given string contains HTML or not.
moveQuestionAfter($question_to_move, $question_before)
saveQuestionsToDb()
Saves the test questions to the database.
setShuffleQuestions($a_shuffle)
Sets the status of the shuffle_questions variable.
getUsePreviousAnswers()
Returns if the previous answers should be shown for a learner.
$char_selector_definition
getAvailableQuestions($arrFilter, $completeonly=0)
Calculates the available questions for a test.
getListOfQuestionsSettings()
Returns the settings for the list of questions options in the test properties This could contain one ...
removeTestResultsByActiveIds($activeIds)
getCharSelectorAvailability()
startWorkingTime($active_id, $pass)
Write the initial entry for the tests working time to the database.
getHighscoreTopNum($a_retval=10)
Gets the number of entries which are to be shown in the top-rankings table.
setSpecificAnswerFeedback($specific_answer_feedback)
setMailNotificationType($a_type)
static ensureParticipantsLastActivePassFinished($testObjId, $userId, $a_force_new_run=FALSE)
setTitleOutput($title_output=0)
Sets the status of the title output.
isOfferingQuestionHintsEnabled()
returns the fact wether offering hints is enabled or not
getCompleteWorkingTime($user_id)
Returns the complete working time in seconds a user worked on the test.
static buildExamId($active_id, $pass, $test_obj_id=null)
& processCSVRow($row, $quoteAll=FALSE, $separator=";")
Processes an array as a CSV row and converts the array values to correct CSV values.
& getQuestionsOfTest($active_id)
Retrieves all the assigned questions for all test passes of a test participant.
getMailNotificationType()
lookupExamId($active_id, $pass)
getForceJS()
Gets whether JavaScript should be forced for tests.
setPassword($a_password=NULL)
Sets the password for test access.
read($a_force_db=false)
read object data from db into object
removeTestResults(ilTestParticipantData $participantData)
applyDefaults($test_defaults)
Applies given test defaults to this test.
disinviteUser($user_id)
Disinvites a user from a test.
setAnswerFeedbackPoints($answer_feedback_points=0)
Sets the answer specific feedback of reached points for the test.
getExportDirectory()
Get the location of the export directory for the test.
setStartingTimeEnabled($starting_time_enabled)
setECTSGrades(array $a_ects_grades)
{}
static lookupQuestionSetTypeByActiveId($active_id)
returns the question set type of test relating to passed active id
& getQuestionsOfPass($active_id, $pass)
Retrieves all the assigned questions for a test participant in a given test pass.
getImagePathWeb()
Returns the web image path for web accessable images of a test The image path is under the web access...
static isQuestionObligationPossible($questionId)
checks wether the obligation for question with given id is possible or not
setActivationLimited($a_value)
_isComplete($obj_id)
Returns true, if a test is complete for use.
isShowExamIdInTestResultsEnabled()
areObligationsEnabled()
returns the fact wether obligations are enabled or not
const DEFAULT_PROCESSING_TIME_MINUTES
getEndingTime()
Returns the ending time of the test.
_getMaxPass($active_id)
Retrieves the maximum pass of a given user for a given test in which the user answered at least one q...
setHighscoreOwnTable($a_own_table)
Sets if the table with the own ranking should be shown.
saveCertificateVisibility($a_value)
Saves the visibility settings of the certificate.
setShowGradingMarkEnabled($showGradingMarkEnabled)
& _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
getCompleteWorkingTimeOfParticipant($active_id)
Returns the complete working time in seconds for a test participant.
evalTotalPersons()
Returns the number of persons who started the test.
setEnableExamview($enable_examview)
notify($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
notifys an object about an event occured Based on the event happend, each object may decide how it re...
static $isSkillManagementGloballyActivated
getScoreReporting()
Gets the score reporting of the ilObjTest object.
getMailNotification()
Get mail notification settings.
setSignSubmission($sign_submission)
setEndingTime($ending_time=NULL)
Sets the ending time in database timestamp format for the test.
setEnableArchiving($enable_archiving)
& _evalResultsOverview($test_id)
Creates an associated array with the results of all participants of a test.
_getObjectIDFromActiveID($active_id)
Returns the ILIAS test object id for a given active id.
setResultFilterTaxIds($resultFilterTaxIds)
isInstantFeedbackAnswerFixationEnabled()
& getQuestionTitles()
Returns the titles of the test questions in question sequence.
getAllRTEContent()
Returns the content of all RTE enabled text areas in the test.
_getVisitTimeOfParticipant($test_id, $active_id)
Returns the first and last visit of a participant.
getSpecificAnswerFeedback()
getExportSettingsSingleChoiceShort()
setShowCancel($a_value=1)
Sets the cancel test button status.
getMarkSchemaForeignId()
{int}
addQTIMaterial(&$a_xml_writer, $a_material)
Creates a QTI material tag from a plain text or xhtml text.
static _getUserIdFromActiveId($active_id)
isPluginActive($a_pname)
Checks wheather or not a question plugin with a given name is active.
& evalTotalParticipantsArray($name_sort_order="asc")
Returns all participants who started the test.
setAutosaveIval($autosave_ival)
getAnonymity()
Returns the anonymity status of the test.
static isParticipantsLastPassActive($testObjId, $userId)
deliverPDFfromFO($fo, $title=null)
Delivers a PDF file from a XSL-FO string.
static hasObligations($test_id)
returns the fact wether the test with given test id contains questions markes as obligatory or not
setTestFinalBroken($testFinalBroken)
setResultsPresentation($a_results_presentation=3)
Sets the combined results presentation value.
removeQuestion($question_id)
Removes a question from the test object.
setLimitUsersEnabled($limitUsersEnabled)
& getWorkedQuestions($active_id, $pass=NULL)
Gets the id's of all questions a user already worked through.
toXML()
Returns a QTI xml representation of the test.
isSingleChoiceTest()
Returns TRUE if the test contains single choice results only.
& evalResultsOverviewOfParticipant($active_id)
Creates an associated array with the results for a given participant of a test.
getShowCancel()
Returns wheather the cancel test button is shown or not.
getCertificateVisibility()
Returns the visibility settings of the certificate.
setHighscoreWTime($a_wtime)
Sets if the workingtime of the scores should be shown.
setShowSolutionAnswersOnly($a_full=TRUE)
Set to true, if the full solution (including the ILIAS content pages) should be shown in the solution...
setNrOfTries($nr_of_tries=0)
Sets the nr of tries for the test.
getTestStyleLocation($mode="output")
get full style sheet file name (path inclusive) of current user
$participantDataExist
holds the fact wether participant data exists or not DO NOT USE TIS PROPERTY DRIRECTLY ALWAYS USE ilO...
getHighscoreScore()
Gets if the score column should be shown.
getPassFinishDate($active_id, $pass)
Retrieves the number of answered questions for a given user in a given test.
setECTSOutput($a_ects_output)
{}
& getInvitedUsers($user_id="", $order="login, lastname, firstname")
Returns a list of all invited users in a test.
setProcessingTimeByMinutes($minutes)
static _lookupFinishedUserTests($a_user_id)
Gather all finished tests for user.
static getPoolQuestionChangeListeners(ilDB $db, $poolObjId)
canShowSolutionPrintview($user_id=NULL)
Calculates if a user may see the solution printview of his/her test results.
setRedirectionUrl($redirection_url=NULL)
setHighscoreAchievedTS($a_achieved_ts)
Sets if the date and time of the scores achievement should be displayed.
removeTestActives($activeIds)
getShowMarker()
Returns wheather the marker button is shown or not.
getImportMapping()
get array of (two) new created questions for import id
isSingleChoiceTestWithoutShuffle()
Returns TRUE if the test contains single choice results and no shuffle only.
setCharSelectorAvailability($availability)
setAnonymity($a_value=0)
Sets the anonymity status of the test.
checkMaximumAllowedUsers()
getShuffleQuestions()
Returns the status of the shuffle_questions variable.
setShowKioskModeTitle($a_title=FALSE)
Set to true, if the full test title should be shown in kiosk mode.
_getTestIDFromObjectID($object_id)
Returns the ILIAS test id for a given object id.
$online
the object's online status
setExportSettingsSingleChoiceShort($a_settings)
& getQuestionTypeTranslations()
removeTestResultsByUserIds($userIds)
& getUserData($ids)
Returns a data of all users specified by id list.
isNewRandomTest()
Checks wheather the test is a new random test (using tst_rnd_cpy) or an old one.
getListOfQuestionsDescription()
Returns TRUE if the list of questions should be presented with the question descriptions.
getECTSGrade($passed_array, $reached_points, $max_points)
{Returns the ECTS grade for a number of reached points.string The ECTS grade short description}
getActiveIdOfUser($user_id="", $anonymous_id="")
Gets the active id of a given user.
getCustomStyle()
Get the custom style.
checkMarks()
{boolean|string True or an error string which can be used for display purposes}
recalculateScores($preserve_manscoring=false)
setEnabledViewMode($mode)
getSecondsUntilEndingTime()
Returns the seconds left from the actual time until the ending time.
isPassDeletionAllowed()
getter for the test setting passDeletionAllowed
getNrOfTries()
Returns the nr of tries for the test.
_getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
setShowExamviewHtml($show_examview_html)
const SCORE_REPORTING_DATE
setMCScoring($a_mc_scoring=SCORE_ZERO_POINTS_WHEN_UNANSWERED)
Sets the multiple choice scoring.
$offeringQuestionHintsEnabled
getTextAnswer($active_id, $question_id, $pass=NULL)
Returns the text answer of a given user for a given question.
setEnableProcessingTime($enable=0)
Sets the processing time enabled or disabled.
getActivationVisibility()
setUsePreviousAnswers($use_previous_answers=1)
Sets the status of the visibility of previous learner answers.
setGenericAnswerFeedback($generic_answer_feedback=0)
Sets if the generic feedback is to be shown in the test.
static getManualFeedback($active_id, $question_id, $pass)
Retrieves the manual feedback for a question in a test.
inviteRole($role_id)
Invites all users of a role to a test.
_getScoreCutting($active_id)
Determines if the score of a question should be cut at 0 points or the score of the whole test.
getJavaScriptOutput()
Returns if Javascript should be chosen for drag & drop actions for the active user.
static isQuestionObligatory($question_id)
checks wether the question with given id is marked as obligatory or not
getTestParticipantsForManualScoring($filter=NULL)
update()
update object data
canShowCertificate($testSession, $user_id, $active_id)
Checks whether the certificate button could be shown on the info page or not.
setShowKioskModeParticipant($a_participant=FALSE)
Set to true, if the participant's name should be shown in kiosk mode.
getNrOfResultsForPass($active_id, $pass)
Calculates the number of user results for a specific test pass.
isShowGradingMarkEnabled()
createRandomSolutions($number)
setExportSettings($a_settings)
getStartingTimeOfParticipants()
addExtraTime($active_id, $minutes)
cleanupMediaobjectUsage()
Cleans up the media objects for all text fields in a test which are using an RTE field.
userLookupFullName($user_id, $overwrite_anonymity=FALSE, $sorted_order=FALSE, $suffix="")
Returns the full name of a test user according to the anonymity status.
setScoreReporting($score_reporting=0)
Sets the score reporting of the ilObjTest object.
isTestFinishedToViewResults($active_id, $currentpass)
Returns true if an active user completed a test pass and did not start a new pass.
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
hasNrOfTriesRestriction()
returns if the numbers of tries have to be checked
const SCORE_REPORTING_DISABLED
getVisitTimeOfParticipant($active_id)
Returns the first and last visit of a participant.
& getAllQuestions($pass=NULL)
Returns all questions of a test in test order.
getShowFinalStatement()
Returns whether the final statement should be shown or not.
questionMoveUp($question_id)
Moves a question up in order.
getProcessingTime()
Returns the processing time for the test.
setSequenceSettings($sequence_settings=0)
SEQUENCE SETTING = POSTPONING ENABLED !!
& getCompleteWorkingTimeOfParticipants()
Returns the complete working time in seconds for all test participants.
_getWorkingTimeOfParticipantForPass($active_id, $pass)
Returns the complete working time in seconds for a test participant.
getIntroduction()
Gets the introduction text of the ilObjTest object.
getAnswerFeedback()
Returns 1 if generic answer feedback is activated.
_createImportDirectory()
creates data directory for import files (data_dir/tst_data/tst_<id>/import, depending on data directo...
const HIGHSCORE_SHOW_TOP_TABLE
exportPagesXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export pages of test to xml (see ilias_co.dtd)
isScoreReportingEnabled()
setShowMarker($a_value=1)
Sets the marker button status.
static _lookupName($a_user_id)
lookup user name
_lookupClientIP($a_user_id)
Lookup client ip.
Class ilObjectActivation.
const TIMINGS_DEACTIVATED
setTimingType($a_type)
Set timing type.
static getItem($a_ref_id)
Get item data.
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static getInstance($a_obj_id)
Class ilObject Basic functions for all objects.
getType()
get object type @access public
getOwner()
get object owner
static _lookupObjId($a_id)
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone object permissions, put in tree ...
static _lookupTitle($a_id)
lookup object title
setTitle($a_title)
set object title
ilObject($a_id=0, $a_reference=true)
Constructor @access public.
deleteMetaData()
delete meta data entry
static _lookupDescription($a_id)
lookup object description
_lookupOwner($a_id)
lookup object owner
setDescription($a_desc)
set object description
getRefId()
get reference id @access public
getDescription()
get object description
cloneMetaData($target_obj)
Copy meta data.
getId()
get object id @access public
static _prepareCloneSelection($a_ref_ids, $new_type, $show_path=true)
Prepare copy wizard object selection.
getTitle()
get object title @access public
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
getPresentationMaterial()
{ilQTIPresentationMaterial|null}
static _replaceMediaObjectImageSrc($a_text, $a_direction=0, $nic=IL_INST_ID)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
_cleanupMediaObjectUsage($a_text, $a_usage_type, $a_usage_id)
synchronises appearances of media objects in $a_text with media object usage table
static factory($a_package)
Create an XML_RPC2 client instance.
Skill management settings.
special template class to simplify handling of ITX/PEAR
Test certificate adapter.
Base Exception for all Exceptions relating to Modules/Test.
Class ilTestMailNotification.
isQuestionSetConfigured()
static getDataDir()
get data directory (outside webspace)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static insertInstIntoID($a_value)
inserts installation id into ILIAS id
static prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free,...
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
static _getObjectsByOperations($a_obj_type, $a_operation, $a_usr_id=0, $limit=0)
Get all objects of a specific type and check access This function is not recursive,...
static ilTempnam()
Create a temporary file in an ILIAS writable directory.
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
static removeTrailingPathSeparators($path)
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
xmlHeader()
Writes xml header @access public.
const SCORE_ZERO_POINTS_WHEN_UNANSWERED
const COUNT_PARTIAL_SOLUTIONS
const TEST_FIXED_SEQUENCE
Test constants.
redirection script todo: (a better solution should control the processing via a xml file)
if(!is_array($argv)) $options
const ILIAS_ABSOLUTE_PATH