4 require_once
'Services/Object/classes/class.ilObject.php';
5 require_once
'Modules/Test/classes/inc.AssessmentConstants.php';
6 require_once
'Modules/Test/interfaces/interface.ilMarkSchemaAware.php';
7 require_once
'Modules/Test/interfaces/interface.ilEctsGradesEnabled.php';
8 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionType.php';
598 public function __construct($a_id = 0, $a_call_by_reference =
true)
603 $lng->loadLanguageModule(
"assessment");
605 include_once
"./Modules/Test/classes/class.assMarkSchema.php";
607 $this->mark_schema->createSimpleSchema(
608 $lng->txt(
"failed_short"),
609 $lng->txt(
"failed_official"),
612 $lng->txt(
"passed_short"),
613 $lng->txt(
"passed_official"),
619 $this->author = $ilUser->fullname;
620 $this->introductionEnabled =
false;
621 $this->introduction =
"";
622 $this->questions =
array();
625 $this->instant_verification = 0;
626 $this->answer_feedback_points = 0;
627 $this->reporting_date =
"";
628 $this->nr_of_tries = 0;
630 $this->use_previous_answers = 1;
631 $this->title_output = 0;
632 $this->starting_time =
"";
633 $this->ending_time =
"";
634 $this->processing_time =
"";
635 $this->enable_processing_time =
"0";
636 $this->reset_processing_time = 0;
637 $this->ects_output =
false;
638 $this->ects_fx = null;
639 $this->shuffle_questions =
false;
640 $this->mailnottype = 0;
641 $this->exportsettings = 0;
642 $this->show_summary = 8;
647 $this->answer_feedback = 0;
648 $this->password =
"";
649 $this->certificate_visibility = 0;
650 $this->allowedUsers =
"";
651 $this->_showfinalstatement =
false;
652 $this->_finalstatement =
"";
653 $this->_showinfo =
true;
654 $this->_forcejs =
true;
655 $this->_customStyle =
"";
656 $this->allowedUsersTimeGap =
"";
657 $this->anonymity = 0;
658 $this->show_cancel = 0;
659 $this->show_marker = 0;
660 $this->fixed_participants = 0;
665 $this->testSession =
false;
666 $this->testSequence =
false;
667 $this->mailnotification = 0;
668 $this->poolUsage = 1;
670 $this->ects_grades =
array(
678 $this->autosave =
false;
679 $this->autosave_ival = 30000;
681 $this->enable_examview =
false;
682 $this->show_examview_html =
false;
683 $this->show_examview_pdf =
false;
684 $this->enable_archiving =
false;
686 $this->express_mode =
false;
687 $this->template_id =
'';
688 $this->redirection_mode = 0;
689 $this->redirection_url = null;
690 $this->show_exam_id_in_test_pass_enabled =
false;
691 $this->show_exam_id_in_test_results_enabled =
false;
692 $this->sign_submission =
false;
693 $this->char_selector_availability = 0;
694 $this->char_selector_definition = null;
696 $this->showGradingStatusEnabled =
true;
697 $this->showGradingMarkEnabled =
true;
699 $this->instantFeedbackAnswerFixationEnabled =
false;
701 $this->testFinalBroken =
false;
703 $this->tmpCopyWizardCopyId = null;
705 parent::__construct($a_id, $a_call_by_reference);
715 require_once
'Services/Utilities/classes/class.ilUtil.php';
784 public function delete()
787 if (!parent::delete()) {
797 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
799 $qsaImportFails->deleteRegisteredImportFails();
800 require_once
'Modules/Test/classes/class.ilTestSkillLevelThresholdImportFails.php';
802 $sltImportFails->deleteRegisteredImportFails();
816 require_once
'Modules/Test/classes/class.ilTestParticipantData.php';
818 $participantData->load($this->
getTestId());
821 $affectedRows = $ilDB->manipulateF(
822 "DELETE FROM tst_mark WHERE test_fi = %s",
827 $affectedRows = $ilDB->manipulateF(
828 "DELETE FROM tst_tests WHERE test_id = %s",
833 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
835 $testQuestionSetConfigFactory->getQuestionSetConfig()->removeQuestionSetRelatedData();
838 include_once
"./Services/Utilities/classes/class.ilUtil.php";
840 $directory = $tst_data_dir .
"/tst_" . $this->
getId();
841 if (is_dir($directory)) {
842 include_once
"./Services/Utilities/classes/class.ilUtil.php";
845 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
851 foreach (
$mobs as $mob) {
867 include_once
"./Services/Utilities/classes/class.ilUtil.php";
870 if (!is_writable($tst_data_dir)) {
871 $this->
ilias->raiseError(
"Test Data Directory (" . $tst_data_dir
872 .
") not writeable.", $this->
ilias->error_obj->MESSAGE);
876 $tst_dir = $tst_data_dir .
"/tst_" . $this->
getId();
878 if (!@is_dir($tst_dir)) {
879 $this->
ilias->raiseError(
"Creation of Test Directory failed.", $this->
ilias->error_obj->MESSAGE);
882 $export_dir = $tst_dir .
"/export";
884 if (!@is_dir($export_dir)) {
885 $this->
ilias->raiseError(
"Creation of Export Directory failed.", $this->
ilias->error_obj->MESSAGE);
896 include_once
"./Services/Utilities/classes/class.ilUtil.php";
907 public function getExportFiles($dir)
910 if (!@is_dir($dir) || !is_writeable($dir)) {
919 if ($file->isDir()) {
923 $files[] = $file->getBasename();
936 if (strlen($a_import_dir)) {
937 $_SESSION[
"tst_import_dir"] = $a_import_dir;
951 if (strlen(
$_SESSION[
"tst_import_dir"])) {
970 include_once
"./Services/Utilities/classes/class.ilUtil.php";
974 if (!is_writable($tst_data_dir)) {
975 $ilias->raiseError(
"Test Data Directory (" . $tst_data_dir
976 .
") not writeable.", $ilias->error_obj->FATAL);
980 $tst_dir = $tst_data_dir .
"/tst_import";
982 if (!@is_dir($tst_dir)) {
983 $ilias->raiseError(
"Creation of test import directory failed.", $ilias->error_obj->FATAL);
1003 "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",
1009 if (strcmp(
$row[
'foundtypes'],
'assSingleChoice') == 0) {
1027 "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",
1031 if (
$result->numRows() == 1) {
1033 if (strcmp(
$row[
'foundtypes'],
'assSingleChoice') == 0) {
1058 SELECT DISTINCT(qpl_qst_sc.shuffle) foundshuffles 1064 WHERE tst_test_result.question_fi = qpl_questions.question_id 1065 AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id 1066 AND tst_test_result.active_fi = tst_active.active_id 1067 AND qpl_questions.question_id = qpl_qst_sc.question_fi 1068 AND tst_active.test_fi = %s 1069 AND qpl_qst_type.type_tag = %s 1071 array(
'integer',
'text'),
1074 if (
$result->numRows() == 1) {
1076 return (
$row[
'foundshuffles'] == 0);
1089 if (!count($this->mark_schema->mark_steps)) {
1111 $test->loadFromDb();
1113 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
1116 return $test->isComplete($testQuestionSetConfigFactory->getQuestionSetConfig());
1131 if (!preg_match(
'/\d+/', $this->
getECTSFX())) {
1138 SET ects_output = %s, ects_a = %s, ects_b = %s, ects_c = %s, ects_d = %s, ects_e = %s, ects_fx = %s 1139 WHERE test_id = %s",
1140 array(
'text',
'float',
'float',
'float',
'float',
'float',
'float',
'integer'),
1143 $grades[
'A'], $grades[
'B'], $grades[
'C'], $grades[
'D'], $grades[
'E'],
1160 if ($this->
isComplete($testQuestionSetConfig)) {
1165 "UPDATE tst_tests SET complete = %s WHERE test_id = %s",
1166 array(
'text',
'integer'),
1167 array($complete, $this->test_id)
1192 include_once(
"./Services/RTE/classes/class.ilRTE.php");
1193 $completecontent =
"";
1195 $completecontent .= $content;
1218 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
1220 $testQuestionSetConfig = $testQuestionSetConfigFactory->getQuestionSetConfig();
1222 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1223 if ($this->test_id == -1) {
1225 $next_id = $ilDB->nextId(
'tst_tests');
1227 $ilDB->insert(
'tst_tests',
array(
1228 'test_id' =>
array(
'integer', $next_id),
1229 'obj_fi' =>
array(
'integer', $this->
getId()),
1259 'complete' =>
array(
'text', $this->
isComplete($testQuestionSetConfig)),
1261 'ects_a' =>
array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : null),
1262 'ects_b' =>
array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : null),
1263 'ects_c' =>
array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : null),
1264 'ects_d' =>
array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : null),
1265 'ects_e' =>
array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : null),
1301 'online_status' =>
array(
'integer', (
int) $this->
isOnline()),
1328 $this->test_id = $next_id;
1338 "SELECT * FROM tst_tests WHERE test_id = %s",
1340 array($this->test_id)
1342 if (
$result->numRows() == 1) {
1343 $oldrow = $ilDB->fetchAssoc(
$result);
1379 'complete' =>
array(
'text', $this->
isComplete($testQuestionSetConfig)),
1381 'ects_a' =>
array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : null),
1382 'ects_b' =>
array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : null),
1383 'ects_c' =>
array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : null),
1384 'ects_d' =>
array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : null),
1385 'ects_e' =>
array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : null),
1420 'online_status' =>
array(
'integer', (
int) $this->
isOnline()),
1451 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1453 $logresult = $ilDB->queryF(
1454 "SELECT * FROM tst_tests WHERE test_id = %s",
1459 if ($logresult->numRows() == 1) {
1460 $newrow = $ilDB->fetchAssoc($logresult);
1462 $changed_fields =
array();
1463 foreach ($oldrow as
$key => $value) {
1464 if (strcmp($oldrow[
$key], $newrow[$key]) != 0) {
1465 array_push($changed_fields,
"$key: " . $oldrow[$key] .
" => " . $newrow[$key]);
1468 $changes = join($changed_fields,
", ");
1469 if (count($changed_fields) > 0) {
1477 $aresult = $ilDB->queryF(
1478 "SELECT active_id FROM tst_active WHERE test_fi = %s AND tries >= %s AND submitted = %s",
1479 array(
'integer',
'integer',
'integer'),
1482 while (
$row = $ilDB->fetchAssoc($aresult)) {
1484 "UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
1485 array(
'integer',
'timestamp',
'integer'),
1491 $aresult = $ilDB->queryF(
1492 "SELECT active_id FROM tst_active WHERE test_fi = %s AND tries < %s AND submitted = %s",
1493 array(
'integer',
'integer',
'integer'),
1496 while (
$row = $ilDB->fetchAssoc($aresult)) {
1498 "UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
1499 array(
'integer',
'timestamp',
'integer'),
1505 $aresult = $ilDB->queryF(
1506 "SELECT active_id FROM tst_active WHERE test_fi = %s AND submitted = %s",
1507 array(
'integer',
'integer'),
1510 while (
$row = $ilDB->fetchAssoc($aresult)) {
1512 "UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
1513 array(
'integer',
'timestamp',
'integer'),
1522 include_once
'Services/News/classes/class.ilNewsItem.php';
1526 $newsItem->setContext($this->
getId(),
'tst');
1528 $newsItem->setTitle(
'new_test_online');
1529 $newsItem->setContentIsLangVar(
true);
1530 $newsItem->setContent(
'');
1531 $newsItem->setUserId($ilUser->getId());
1533 $newsItem->create();
1540 $newsItem->setTitle(
'new_test_online');
1541 $newsItem->setContentIsLangVar(
true);
1542 $newsItem->setContent(
'');
1543 $newsItem->update();
1548 if ($this->ref_id) {
1549 include_once
"./Services/Object/classes/class.ilObjectActivation.php";
1562 $item->update($this->ref_id);
1565 if (!$properties_only) {
1570 $this->mark_schema->saveToDb($this->test_id);
1584 $oldquestions =
array();
1585 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
1588 "SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
1594 array_push($oldquestions,
$row[
"question_fi"]);
1600 $currentQuestionsObligationsQuery =
'SELECT question_fi, obligatory FROM tst_test_question WHERE test_fi = %s';
1601 $rset = $ilDB->queryF($currentQuestionsObligationsQuery,
array(
'integer'),
array($this->
getTestId()));
1602 while (
$row = $ilDB->fetchAssoc($rset)) {
1603 $obligatoryQuestionState[
$row[
'question_fi']] = $row[
'obligatory'];
1606 $affectedRows = $ilDB->manipulateF(
1607 "DELETE FROM tst_test_question WHERE test_fi = %s",
1612 foreach ($this->questions as
$key => $value) {
1614 if (!isset($obligatoryQuestionState[$value]) || is_null($obligatoryQuestionState[$value])) {
1615 $obligatoryQuestionState[$value] = 0;
1619 $next_id = $ilDB->nextId(
'tst_test_question');
1620 $ilDB->insert(
'tst_test_question',
array(
1621 'test_question_id' =>
array(
'integer', $next_id),
1623 'question_fi' =>
array(
'integer', $value),
1625 'obligatory' =>
array(
'integer', $obligatoryQuestionState[$value]),
1629 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1632 "SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
1636 $newquestions =
array();
1639 array_push($newquestions,
$row[
"question_fi"]);
1642 foreach ($oldquestions as
$index => $question_id) {
1643 if (strcmp($newquestions[
$index], $question_id) != 0) {
1644 $pos = array_search($question_id, $newquestions);
1645 if ($pos ===
false) {
1652 foreach ($newquestions as
$index => $question_id) {
1653 if (array_search($question_id, $oldquestions) ===
false) {
1669 'SELECT copy_id FROM tst_rnd_cpy WHERE tst_fi = %s',
1673 return $result->numRows() > 0;
1694 if (($questionpool != 0) && (!$use_obj_id)) {
1700 "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",
1704 $original_ids =
array();
1705 $paramtypes =
array();
1706 $paramvalues =
array();
1708 array_push($original_ids,
$row[
'original_id']);
1713 if (($questionpool == 0) && (!is_array($qpls))) {
1714 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
1716 if (count($available_pools)) {
1717 $available =
" AND " . $ilDB->in(
'obj_fi', $available_pools,
false,
'integer');
1723 $constraint_qpls =
"";
1724 $result_array =
array();
1725 if ($questionpool == 0) {
1726 if (is_array($qpls)) {
1727 if (count($qpls) > 0) {
1728 $constraint_qpls =
" AND " . $ilDB->in(
'obj_fi', $qpls,
false,
'integer');
1733 $original_clause =
"";
1734 if (count($original_ids)) {
1735 $original_clause =
" AND " . $ilDB->in(
'question_id', $original_ids,
true,
'integer');
1738 if ($questionpool == 0) {
1740 "SELECT question_id FROM qpl_questions WHERE original_id IS NULL $available $constraint_qpls AND owner > %s AND complete = %s $original_clause",
1741 array(
'integer',
'text'),
1746 "SELECT question_id FROM qpl_questions WHERE original_id IS NULL AND obj_fi = %s AND owner > %s AND complete = %s $original_clause",
1747 array(
'integer',
'integer',
'text'),
1748 array($questionpool, 0,
"1")
1751 $found_ids =
array();
1753 array_push($found_ids,
$row[
'question_id']);
1755 $nr_of_questions = ($nr_of_questions > count($found_ids)) ? count($found_ids) : $nr_of_questions;
1756 if ($nr_of_questions == 0) {
1759 $rand_keys = array_rand($found_ids, $nr_of_questions);
1761 if (is_array($rand_keys)) {
1762 foreach ($rand_keys as
$key) {
1766 $result[$found_ids[$rand_keys]] = $found_ids[$rand_keys];
1783 "SELECT test_result_id FROM tst_test_result WHERE active_fi = %s AND pass = %s",
1784 array(
'integer',
'integer'),
1804 "SELECT test_random_question_id FROM tst_test_rnd_qst WHERE active_fi = %s AND pass = %s",
1805 array(
'integer',
'integer'),
1808 return (
$result->numRows() > 0) ?
true :
false;
1819 "SELECT * FROM tst_tests WHERE obj_fi = %s",
1823 if (
$result->numRows() == 1) {
1830 include_once(
"./Services/RTE/classes/class.ilRTE.php");
1867 "A" =>
$data->ects_a,
1868 "B" =>
$data->ects_b,
1869 "C" =>
$data->ects_c,
1870 "D" =>
$data->ects_d,
1871 "E" =>
$data->ects_e
1875 $this->mark_schema->flush();
1876 $this->mark_schema->loadFromDb($this->
getTestId());
1934 if ($this->ref_id) {
1935 include_once
"./Services/Object/classes/class.ilObjectActivation.php";
1937 switch ($activation[
"timing_type"]) {
1963 $this->questions =
array();
1965 if (strcmp($active_id,
"") == 0) {
1968 if (is_null(
$pass)) {
1969 $pass = self::_getPass($active_id);
1972 "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",
1973 array(
'integer',
'integer'),
1980 if (
$result->numRows() == 0) {
1982 "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",
1989 "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",
1991 array($this->test_id)
1996 $this->questions[
$index++] =
$data[
"question_fi"];
2024 return (strlen($this->introduction)) ? $this->introduction : null;
2049 $this->_finalstatement = $a_statement;
2061 $this->_showinfo = ($a_info) ? 1 : 0;
2073 $this->_forcejs = ($a_js) ? 1 : 0;
2085 $this->_customStyle = $a_customStyle;
2097 return (strlen($this->_customStyle)) ? $this->_customStyle : null;
2110 $css_path = str_replace(
"ta.css",
"customstyles", $css_path) .
"/";
2111 $customstyles =
array();
2112 if (is_dir($css_path)) {
2114 include_once
"./Services/Utilities/classes/class.ilFileUtils.php";
2118 if (strpos($filename,
".css")) {
2119 array_push($customstyles, $filename);
2124 return $customstyles;
2138 $custom = str_replace(
"ta.css",
"customstyles/" . $this->
getCustomStyle(), $default);
2139 if (file_exists($custom)) {
2141 $custom = str_replace(
"ta.css",
"customstyles/" . $this->
getCustomStyle(), $custom);
2160 $this->_showfinalstatement = ($show) ? 1 : 0;
2171 return (strlen($this->_finalstatement)) ? $this->_finalstatement : null;
2183 return ($this->_showinfo) ? 1 : 0;
2195 return ($this->_forcejs) ? 1 : 0;
2207 return ($this->_showfinalstatement) ? 1 : 0;
2227 return ($this->ects_output) ? 1 : 0;
2235 $this->ects_output = $a_ects_output ? 1 : 0;
2243 return (strlen($this->ects_fx)) ? $this->ects_fx : null;
2251 $this->ects_fx = $a_ects_fx;
2267 $this->ects_grades = $a_ects_grades;
2277 return ($this->sequence_settings) ? $this->sequence_settings : 0;
2327 switch ($instant_feedback) {
2329 $this->instant_verification = 1;
2332 $this->instant_verification = 0;
2348 $this->answer_feedback = 1;
2351 $this->answer_feedback = 0;
2363 switch ($generic_answer_feedback) {
2365 $this->answer_feedback = 1;
2368 $this->answer_feedback = 0;
2384 $this->answer_feedback_points = 1;
2387 $this->answer_feedback_points = 0;
2399 $this->reporting_date =
'';
2420 return ($this->score_reporting) ? $this->score_reporting : 0;
2437 return ($this->instant_verification) ? $this->instant_verification : 0;
2450 return ($this->answer_feedback) ? $this->answer_feedback : 0;
2461 return ($this->answer_feedback) ? $this->answer_feedback : 0;
2473 return ($this->answer_feedback_points) ? $this->answer_feedback_points : 0;
2485 return ($this->count_system) ? $this->count_system : 0;
2499 "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",
2505 return $row[
"count_system"];
2519 return ($this->mc_scoring) ? $this->mc_scoring : 0;
2531 return ($this->score_cutting) ? $this->score_cutting : 0;
2543 return ($this->pass_scoring) ? $this->pass_scoring : 0;
2557 "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",
2563 return $row[
"pass_scoring"];
2579 "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",
2585 return $row[
"mc_scoring"];
2601 "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",
2607 return $row[
"score_cutting"];
2621 return (strlen($this->reporting_date)) ? $this->reporting_date : null;
2633 return ($this->nr_of_tries) ? $this->nr_of_tries : 0;
2645 return ($this->_kiosk) ? $this->_kiosk : 0;
2658 $this->_kiosk = $kiosk;
2670 if (($this->_kiosk & 1) > 0) {
2687 $this->_kiosk = $this->_kiosk | 1;
2690 $this->_kiosk = $this->_kiosk ^ 1;
2704 if (($this->_kiosk & 2) > 0) {
2720 $this->_kiosk = $this->_kiosk | 2;
2723 $this->_kiosk = $this->_kiosk ^ 2;
2737 if (($this->_kiosk & 4) > 0) {
2752 if ($a_participant) {
2753 $this->_kiosk = $this->_kiosk | 4;
2756 $this->_kiosk = $this->_kiosk ^ 4;
2770 return ($this->use_previous_answers) ? $this->use_previous_answers : 0;
2782 return ($this->title_output) ? $this->title_output : 0;
2798 "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",
2804 return $row[
"title_output"];
2813 return self::_getUsePreviousAnswers($activeId,
true);
2834 "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",
2844 if ($user_active_user_setting) {
2845 $res = $ilUser->getPref(
"tst_use_previous_answers");
2846 if (
$res !==
false) {
2863 return (strlen($this->processing_time)) ? $this->processing_time : null;
2874 if (strlen($this->processing_time)) {
2875 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches)) {
2876 if ((
int) $matches[1]+(
int) $matches[2]+(
int) $matches[3] == 0) {
2880 'hh' => $matches[1],
2881 'mm' => $matches[2],
2882 'ss' => $matches[3],
2892 if (strlen($this->processing_time)) {
2893 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches)) {
2894 return ($matches[1] * 60) + $matches[2];
2898 return self::DEFAULT_PROCESSING_TIME_MINUTES;
2910 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $this->
getProcessingTime(), $matches)) {
2912 return ($matches[1] * 3600) + ($matches[2] * 60) + $matches[3] + $extratime;
2930 return $ending - $now;
2945 return ($this->enable_processing_time) ? $this->enable_processing_time : 0;
2957 return ($this->reset_processing_time) ? $this->reset_processing_time : 0;
2985 return ($this->starting_time != 0) ? $this->starting_time : 0;
3025 return ($this->ending_time != 0) ? $this->ending_time : 0;
3062 $this->use_previous_answers = 1;
3064 $this->use_previous_answers = 0;
3096 $this->title_output = 1;
3099 $this->title_output = 2;
3102 $this->title_output = 0;
3121 $this->processing_time = sprintf(
"%02d:%02d:00", floor($minutes/60), $minutes%60);
3134 $this->enable_processing_time =
"1";
3136 $this->enable_processing_time =
"0";
3150 $this->reset_processing_time = 1;
3152 $this->reset_processing_time = 0;
3165 $this->count_system = $a_count_system;
3193 return (strlen($this->password)) ? $this->password : null;
3205 $this->password = $a_password;
3217 $this->score_cutting = $a_score_cutting;
3229 $this->mc_scoring = $a_mc_scoring;
3241 switch ($a_pass_scoring) {
3282 foreach ($removeQuestionIds as $value) {
3299 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3303 $question->delete($question_id);
3321 require_once
'Modules/Test/classes/class.ilTestParticipantData.php';
3323 $participantData->setUserIds($userIds);
3324 $participantData->load($this->
getTestId());
3337 require_once
'Services/Object/classes/class.ilObjectLP.php';
3339 $testLP->setTestObject($this);
3340 $testLP->resetLPDataForUserIds($participantData->
getUserIds(),
false);
3352 require_once
'Modules/Test/classes/class.ilTestParticipantData.php';
3354 $participantData->setUserIds($userIds);
3355 $participantData->load($this->
getTestId());
3357 $IN_userIds = $ilDB->in(
'usr_id', $participantData->getUserIds(),
false,
'integer');
3359 "DELETE FROM usr_pref WHERE $IN_userIds AND keyword = %s",
3364 if (count($participantData->getActiveIds())) {
3373 $IN_activeIds = $ilDB->in(
'active_fi', $activeIds,
false,
'integer');
3375 $ilDB->manipulate(
"DELETE FROM tst_solutions WHERE $IN_activeIds");
3376 $ilDB->manipulate(
"DELETE FROM tst_qst_solved WHERE $IN_activeIds");
3377 $ilDB->manipulate(
"DELETE FROM tst_test_result WHERE $IN_activeIds");
3378 $ilDB->manipulate(
"DELETE FROM tst_pass_result WHERE $IN_activeIds");
3379 $ilDB->manipulate(
"DELETE FROM tst_result_cache WHERE $IN_activeIds");
3380 $ilDB->manipulate(
"DELETE FROM tst_sequence WHERE $IN_activeIds");
3381 $ilDB->manipulate(
"DELETE FROM tst_times WHERE $IN_activeIds");
3384 $ilDB->manipulate(
"DELETE FROM tst_test_rnd_qst WHERE $IN_activeIds");
3386 $ilDB->manipulate(
"DELETE FROM tst_seq_qst_tracking WHERE $IN_activeIds");
3387 $ilDB->manipulate(
"DELETE FROM tst_seq_qst_answstatus WHERE $IN_activeIds");
3388 $ilDB->manipulate(
"DELETE FROM tst_seq_qst_postponed WHERE $IN_activeIds");
3389 $ilDB->manipulate(
"DELETE FROM tst_seq_qst_checked WHERE $IN_activeIds");
3392 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3394 foreach ($activeIds as $active_id) {
3396 if (@is_dir(CLIENT_WEB_DIR .
"/assessment/tst_" . $this->
getTestId() .
"/$active_id")) {
3405 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
3413 $IN_activeIds = $ilDB->in(
'active_id', $activeIds,
false,
'integer');
3414 $ilDB->manipulate(
"DELETE FROM tst_active WHERE $IN_activeIds");
3430 "SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
3431 array(
'integer',
'integer'),
3435 if (
$data->sequence > 1) {
3438 "SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
3439 array(
'integer',
'integer'),
3442 $data_previous = $ilDB->fetchObject(
$result);
3444 $affectedRows = $ilDB->manipulateF(
3445 "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
3446 array(
'integer',
'integer'),
3447 array(
$data->sequence, $data_previous->test_question_id)
3450 $affectedRows = $ilDB->manipulateF(
3451 "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
3452 array(
'integer',
'integer'),
3455 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3476 "SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
3477 array(
'integer',
'integer'),
3482 "SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
3483 array(
'integer',
'integer'),
3486 if (
$result->numRows() == 1) {
3488 $data_next = $ilDB->fetchObject(
$result);
3490 $affectedRows = $ilDB->manipulateF(
3491 "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
3492 array(
'integer',
'integer'),
3493 array(
$data->sequence, $data_next->test_question_id)
3496 $affectedRows = $ilDB->manipulateF(
3497 "UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
3498 array(
'integer',
'integer'),
3501 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3520 $duplicate_id = $question->duplicate(
true, null, null, null, $this->
getId());
3522 return $duplicate_id;
3536 #var_dump($question_id); 3538 $duplicate_id = $question_id;
3545 "SELECT MAX(sequence) seq FROM tst_test_question WHERE test_fi=%s",
3551 if (
$result->numRows() == 1) {
3553 $sequence =
$data->seq + 1;
3556 $next_id = $ilDB->nextId(
'tst_test_question');
3557 $affectedRows = $ilDB->manipulateF(
3558 "INSERT INTO tst_test_question (test_question_id, test_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
3559 array(
'integer',
'integer',
'integer',
'integer',
'integer'),
3562 if ($affectedRows == 1) {
3563 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3569 $affectedRows = $ilDB->manipulateF(
3570 "DELETE FROM tst_active WHERE test_fi = %s",
3576 return $duplicate_id;
3592 "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",
3597 array_push($titles,
$row[
"title"]);
3616 "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",
3621 $titles[
$row[
'question_id']] = $row[
"title"];
3643 } elseif (isset($nr)) {
3644 return $this->lng->txt(
"ass_question") .
' ' . $nr;
3646 return $this->lng->txt(
"ass_question");
3667 "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",
3686 $existing_questions =
array();
3689 if (is_null(
$pass)) {
3693 "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",
3694 array(
'integer',
'integer'),
3699 "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",
3705 if (
$data->original_id === null) {
3709 array_push($existing_questions,
$data->original_id);
3711 return $existing_questions;
3725 if ($question_id < 1) {
3729 "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",
3733 if (
$result->numRows() == 1) {
3735 return $data->type_tag;
3751 $next_id = $ilDB->nextId(
'tst_times');
3752 $affectedRows = $ilDB->manipulateF(
3753 "INSERT INTO tst_times (times_id, active_fi, started, finished, pass, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
3754 array(
'integer',
'integer',
'timestamp',
'timestamp',
'integer',
'integer'),
3755 array($next_id, $active_id, strftime(
"%Y-%m-%d %H:%M:%S"), strftime(
"%Y-%m-%d %H:%M:%S"),
$pass,
time())
3770 $affectedRows = $ilDB->manipulateF(
3771 "UPDATE tst_times SET finished = %s, tstamp = %s WHERE times_id = %s",
3772 array(
'timestamp',
'integer',
'integer'),
3773 array(strftime(
"%Y-%m-%d %H:%M:%S"),
time(), $times_id)
3788 if (is_null(
$pass)) {
3790 "SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
3791 array(
'integer',
'integer'),
3792 array($active_id, 0)
3796 "SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
3797 array(
'integer',
'integer'),
3801 $result_array =
array();
3803 array_push($result_array,
$row[
"question_fi"]);
3805 return $result_array;
3819 return ((($currentpass > 0) && ($num == 0)) || $this->
isTestFinished($active_id)) ? true :
false;
3833 $result_array =
array();
3837 if (count($this->questions) == 0) {
3838 return $result_array;
3840 if (is_null(
$pass)) {
3841 $pass = self::_getPass($active_id);
3844 "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'),
3845 array(
'integer',
'integer'),
3849 if (count($this->questions) == 0) {
3850 return $result_array;
3852 $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'));
3855 $result_array[
$row[
"question_id"]] =
$row;
3857 return $result_array;
3874 $user_id = $ilUser->getId();
3878 "SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
3879 array(
'integer',
'integer',
'text'),
3882 } elseif (strlen($anonymous_id)) {
3884 "SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
3885 array(
'integer',
'integer',
'text'),
3886 array($user_id, $this->test_id, $anonymous_id)
3889 if (
$GLOBALS[
'DIC'][
'ilUser']->
getId() == ANONYMOUS_USER_ID) {
3893 "SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
3894 array(
'integer',
'integer'),
3895 array($user_id, $this->test_id)
3900 return $row[
"active_id"];
3920 $user_id = $ilUser->id;
3926 "SELECT tst_active.active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
3927 array(
'integer',
'integer'),
3932 return $row[
"active_id"];
3946 $keys = array_keys($array);
3962 public function &
getTestResult($active_id,
$pass = null, $ordered_sequence =
false, $considerHiddenQuestions =
true, $considerOptionalQuestions =
true)
3968 if (is_null(
$pass)) {
3972 require_once
'Modules/Test/classes/class.ilTestSessionFactory.php';
3974 $testSession = $testSessionFactory->getSession($active_id);
3976 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
3978 $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($active_id,
$pass);
3981 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
3983 $dynamicQuestionSetConfig->loadFromDb();
3990 $testSequence->setConsiderHiddenQuestionsEnabled($considerHiddenQuestions);
3991 $testSequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions);
3996 if ($ordered_sequence) {
4003 $arrResults =
array();
4006 SELECT tst_test_result.question_fi, 4007 tst_test_result.points reached, 4008 tst_test_result.hint_count requested_hints, 4009 tst_test_result.hint_points hint_points, 4010 tst_test_result.answered answered 4012 FROM tst_test_result 4014 LEFT JOIN tst_solutions 4015 ON tst_solutions.active_fi = tst_test_result.active_fi 4016 AND tst_solutions.question_fi = tst_test_result.question_fi 4018 WHERE tst_test_result.active_fi = %s 4019 AND tst_test_result.pass = %s 4022 $solutionresult = $ilDB->queryF(
4024 array(
'integer',
'integer'),
4028 while (
$row = $ilDB->fetchAssoc($solutionresult)) {
4029 $arrResults[
$row[
'question_fi'] ] =
$row;
4032 $numWorkedThrough = count($arrResults);
4034 require_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
4036 $IN_question_ids = $ilDB->in(
'qpl_questions.question_id', $sequence,
false,
'integer');
4039 SELECT qpl_questions.*, 4040 qpl_qst_type.type_tag, 4041 qpl_sol_sug.question_fi has_sug_sol 4046 LEFT JOIN qpl_sol_sug 4047 ON qpl_sol_sug.question_fi = qpl_questions.question_id 4049 WHERE qpl_qst_type.question_type_id = qpl_questions.question_type_fi 4050 AND $IN_question_ids 4055 $unordered =
array();
4059 $obligationsAnswered =
true;
4063 $row[
'points'] ? $arrResults[
$row[
'question_id'] ][
'reached'] /
$row[
'points'] : 0
4066 if ($percentvalue < 0) {
4067 $percentvalue = 0.0;
4073 "max" => round(
$row[
'points'], 2),
4074 "reached" => round($arrResults[
$row[
'question_id']][
'reached'], 2),
4075 'requested_hints' => $arrResults[$row[
'question_id']][
'requested_hints'],
4076 'hint_points' => $arrResults[$row[
'question_id']][
'hint_points'],
4077 "percent" => sprintf(
"%2.2f ", ($percentvalue) * 100) .
"%",
4079 "type" => $row[
"type_tag"],
4080 "qid" => $row[
'question_id'],
4081 "original_id" => $row[
"original_id"],
4082 "workedthrough" => isset($arrResults[$row[
'question_id']]) ? 1 : 0,
4083 'answered' => $arrResults[$row[
'question_id']][
'answered']
4086 if (!$arrResults[ $row[
'question_id'] ][
'answered']) {
4087 $obligationsAnswered =
false;
4090 $unordered[ $row[
'question_id'] ] =
$data;
4095 $numQuestionsTotal = count($unordered);
4099 $pass_requested_hints = 0;
4100 $pass_hint_points = 0;
4105 foreach ($sequence as $qid) {
4108 $pass_max += round($unordered[$qid][
'max'], 2);
4109 $pass_reached += round($unordered[$qid][
'reached'], 2);
4110 $pass_requested_hints += $unordered[$qid][
'requested_hints'];
4111 $pass_hint_points += $unordered[$qid][
'hint_points'];
4115 $unordered[$qid][
'nr'] =
$key;
4116 array_push($found, $unordered[$qid]);
4125 if (
$results[
'reached_points'] < 0) {
4129 if ($pass_reached < 0) {
4134 $found[
'pass'][
'total_max_points'] = $pass_max;
4135 $found[
'pass'][
'total_reached_points'] = $pass_reached;
4136 $found[
'pass'][
'total_requested_hints'] = $pass_requested_hints;
4137 $found[
'pass'][
'total_hint_points'] = $pass_hint_points;
4138 $found[
'pass'][
'percent'] = ($pass_max > 0) ? $pass_reached / $pass_max : 0;
4139 $found[
'pass'][
'obligationsAnswered'] = $obligationsAnswered;
4140 $found[
'pass'][
'num_workedthrough'] = $numWorkedThrough;
4141 $found[
'pass'][
'num_questions_total'] = $numQuestionsTotal;
4143 $found[
"test"][
"total_max_points"] =
$results[
'max_points'];
4144 $found[
"test"][
"total_reached_points"] =
$results[
'reached_points'];
4145 $found[
"test"][
"total_requested_hints"] =
$results[
'hint_count'];
4146 $found[
"test"][
"total_hint_points"] =
$results[
'hint_points'];
4147 $found[
"test"][
"result_pass"] =
$results[
'pass'];
4148 $found[
'test'][
'result_tstamp'] =
$results[
'tstamp'];
4149 $found[
'test'][
'obligations_answered'] =
$results[
'obligations_answered'];
4151 if ((!$total_reached_points) or (!$total_max_points)) {
4154 $percentage = ($total_reached_points / $total_max_points) * 100.0;
4156 if ($percentage < 0) {
4161 $found[
"test"][
"passed"] =
$results[
'passed'];
4177 "SELECT COUNT(active_id) total FROM tst_active WHERE test_fi = %s",
4182 return $row[
"total"];
4196 "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",
4197 array(
'integer',
'integer'),
4202 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4203 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4204 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4205 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4206 $time += ($epoch_2 - $epoch_1);
4234 "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",
4241 if (!array_key_exists(
$row[
"active_fi"], $times)) {
4242 $times[
$row[
"active_fi"]] = 0;
4244 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4245 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4246 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4247 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4248 $times[
$row[
"active_fi"]] += ($epoch_2 - $epoch_1);
4264 "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",
4265 array(
'integer',
'integer'),
4270 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4271 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4272 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4273 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4274 $time += ($epoch_2 - $epoch_1);
4290 "SELECT * FROM tst_times WHERE active_fi = %s AND pass = %s ORDER BY started",
4291 array(
'integer',
'integer'),
4296 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4297 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4298 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4299 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4300 $time += ($epoch_2 - $epoch_1);
4330 "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",
4331 array(
'integer',
'integer'),
4337 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4338 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4339 if ($firstvisit == 0 || $epoch_1 < $firstvisit) {
4340 $firstvisit = $epoch_1;
4342 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4343 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4344 if ($epoch_2 > $lastvisit) {
4345 $lastvisit = $epoch_2;
4348 return array(
"firstvisit" => $firstvisit,
"lastvisit" => $lastvisit);
4364 "SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.active_id = %s AND tst_active.active_id = tst_times.active_fi",
4372 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row->started, $matches);
4373 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4374 if (!$first_visit) {
4375 $first_visit = $epoch_1;
4377 if ($epoch_1 < $first_visit) {
4378 $first_visit = $epoch_1;
4380 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row->finished, $matches);
4381 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4383 $last_visit = $epoch_2;
4385 if ($epoch_2 > $last_visit) {
4386 $last_visit = $epoch_2;
4388 $times[
$row->active_fi] += ($epoch_2 - $epoch_1);
4391 foreach ($times as
$key => $value) {
4392 $max_time += $value;
4394 if ((!$test_result[
"test"][
"total_reached_points"]) or (!$test_result[
"test"][
"total_max_points"])) {
4397 $percentage = ($test_result[
"test"][
"total_reached_points"] / $test_result[
"test"][
"total_max_points"]) * 100.0;
4398 if ($percentage < 0) {
4402 $mark_obj = $this->mark_schema->getMatchingMark($percentage);
4403 $first_date = getdate($first_visit);
4404 $last_date = getdate($last_visit);
4405 $qworkedthrough = 0;
4406 foreach ($test_result as
$key => $value) {
4407 if (preg_match(
"/\d+/",
$key)) {
4408 $qworkedthrough += $value[
"workedthrough"];
4411 if (!$qworkedthrough) {
4414 $atimeofwork = $max_time / $qworkedthrough;
4417 $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
4423 $result_mark = $mark_obj->getShortName();
4425 if ($mark_obj->getPassed() && $obligationsAnswered) {
4431 $percent_worked_through = 0;
4432 if (count($this->questions)) {
4433 $percent_worked_through = $qworkedthrough / count($this->questions);
4435 $result_array =
array(
4436 "qworkedthrough" => $qworkedthrough,
4437 "qmax" => count($this->questions),
4438 "pworkedthrough" => $percent_worked_through,
4439 "timeofwork" => $max_time,
4440 "atimeofwork" => $atimeofwork,
4441 "firstvisit" => $first_date,
4442 "lastvisit" => $last_date,
4443 "resultspoints" => $test_result[
"test"][
"total_reached_points"],
4444 "maxpoints" => $test_result[
"test"][
"total_max_points"],
4445 "resultsmarks" => $result_mark,
4446 "passed" => $passed,
4447 "distancemedian" =>
"0" 4449 foreach ($test_result as
$key => $value) {
4450 if (preg_match(
"/\d+/",
$key)) {
4451 $result_array[
$key] = $value;
4454 return $result_array;
4466 $totalpoints_array =
array();
4468 foreach ($all_users as $active_id => $user_name) {
4470 $reached = $test_result[
"test"][
"total_reached_points"];
4471 $total = $test_result[
"test"][
"total_max_points"];
4473 $mark = $this->mark_schema->getMatchingMark($percentage*100.0);
4475 $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
4478 if ($mark->getPassed() && $obligationsAnswered) {
4479 array_push($totalpoints_array, $test_result[
"test"][
"total_reached_points"]);
4483 return $totalpoints_array;
4495 "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",
4499 $persons_array =
array();
4501 $name = $this->lng->txt(
"anonymous");
4502 $fullname = $this->lng->txt(
"anonymous");
4505 if (strlen(
$row[
"firstname"] .
$row[
"lastname"] .
$row[
"title"]) == 0) {
4506 $name = $this->lng->txt(
"deleted_user");
4507 $fullname = $this->lng->txt(
"deleted_user");
4508 $login = $this->lng->txt(
"unknown");
4510 $login = $row[
"login"];
4511 if ($row[
"user_fi"] == ANONYMOUS_USER_ID) {
4512 $name = $this->lng->txt(
"anonymous");
4513 $fullname = $this->lng->txt(
"anonymous");
4515 $name = trim($row[
"lastname"] .
", " . $row[
"firstname"] .
" " . $row[
"title"]);
4516 $fullname = trim($row[
"title"] .
" " . $row[
"firstname"] .
" " . $row[
"lastname"]);
4520 $persons_array[
$row[
"active_id"]] =
array(
4522 "fullname" => $fullname,
4526 return $persons_array;
4539 "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),
4543 $persons_array =
array();
4546 $persons_array[
$row[
"active_id"]] = $this->lng->txt(
"anonymous");
4548 if (strlen(
$row[
"firstname"] .
$row[
"lastname"] .
$row[
"title"]) == 0) {
4549 $persons_array[$row[
"active_id"]] = $this->lng->txt(
"deleted_user");
4551 if ($row[
"user_fi"] == ANONYMOUS_USER_ID) {
4552 $persons_array[$row[
"active_id"]] = $row[
"lastname"];
4554 $persons_array[$row[
"active_id"]] = trim($row[
"lastname"] .
", " . $row[
"firstname"] .
" " . $row[
"title"]);
4559 return $persons_array;
4572 "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),
4576 $persons_array =
array();
4579 $persons_array[
$row[
"active_id"]] =
array(
"name" => $this->lng->txt(
"anonymous"));
4581 if (strlen(
$row[
"firstname"] .
$row[
"lastname"] .
$row[
"title"]) == 0) {
4582 $persons_array[$row[
"active_id"]] =
array(
"name" => $this->lng->txt(
"deleted_user"));
4584 if ($row[
"user_fi"] == ANONYMOUS_USER_ID) {
4585 $persons_array[$row[
"active_id"]] =
array(
"name" => $row[
"lastname"]);
4587 $persons_array[$row[
"active_id"]] =
array(
"name" => trim($row[
"lastname"] .
", " . $row[
"firstname"] .
" " . $row[
"title"]),
"login" => $row[
"login"]);
4592 return $persons_array;
4606 "SELECT COUNT(active_id) total FROM tst_active WHERE test_fi = %s AND submitted = %s",
4607 array(
'integer',
'integer'),
4611 return $row[
"total"];
4626 "SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
4627 "tst_test_rnd_qst.pass, qpl_questions.points " .
4628 "FROM tst_test_rnd_qst, qpl_questions " .
4629 "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
4630 "AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence",
4636 "SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
4637 "qpl_questions.points " .
4638 "FROM tst_test_question, tst_active, qpl_questions " .
4639 "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
4640 "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
4648 array_push($qtest,
$row);
4666 "SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
4667 "qpl_questions.points " .
4668 "FROM tst_test_rnd_qst, qpl_questions " .
4669 "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
4670 "AND tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.pass = %s " .
4671 "ORDER BY tst_test_rnd_qst.sequence",
4672 array(
'integer',
'integer'),
4677 "SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
4678 "qpl_questions.points " .
4679 "FROM tst_test_question, tst_active, qpl_questions " .
4680 "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
4681 "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
4689 array_push($qpass,
$row);
4695 public function getUnfilteredEvaluationData()
4700 $ilDB = $DIC->database();
4702 include_once
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
4703 include_once
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
4704 include_once
"./Modules/Test/classes/class.ilTestEvaluationData.php";
4709 SELECT tst_test_result.*, 4710 qpl_questions.original_id, 4711 qpl_questions.title questiontitle, 4712 qpl_questions.points maxpoints 4714 FROM tst_test_result, qpl_questions, tst_active 4716 WHERE tst_active.active_id = tst_test_result.active_fi 4717 AND qpl_questions.question_id = tst_test_result.question_fi 4718 AND tst_active.test_fi = %s 4720 ORDER BY tst_active.active_id ASC, tst_test_result.pass ASC, tst_test_result.tstamp DESC 4735 $participantObject =
$data->getParticipant(
$row[
"active_fi"]);
4741 $passObject = $participantObject->getPass(
$row[
"pass"]);
4747 $passObject->addAnsweredQuestion(
4748 $row[
"question_fi"],
4757 foreach (array_keys(
$data->getParticipants()) as $active_id) {
4759 for ($testpass = 0; $testpass <=
$data->getParticipant($active_id)->getLastPass(); $testpass++) {
4763 SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, qpl_questions.original_id, 4764 tst_test_rnd_qst.pass, qpl_questions.points, qpl_questions.title 4765 FROM tst_test_rnd_qst, qpl_questions 4766 WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id 4767 AND tst_test_rnd_qst.pass = %s 4768 AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence 4773 array(
'integer',
'integer'),
4774 array($testpass, $active_id)
4779 $tpass = array_key_exists(
"pass",
$row) ?
$row[
"pass"] : 0;
4781 $data->getParticipant($active_id)->addQuestion(
4782 $row[
"original_id"],
4783 $row[
"question_fi"],
4789 $data->addQuestionTitle(
$row[
"question_fi"],
$row[
"title"]);
4794 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
4795 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
4796 require_once
'Modules/Test/classes/class.ilTestDynamicQuestionSetFilterSelection.php';
4798 $lastPass =
$data->getParticipant($active_id)->getLastPass();
4799 for ($testpass = 0; $testpass <= $lastPass; $testpass++) {
4800 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
4802 $DIC->repositoryTree(),
4804 $DIC[
'ilPluginAdmin'],
4809 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
4810 $testSequenceFactory =
new ilTestSequenceFactory($DIC->database(), $DIC->language(), $DIC[
'ilPluginAdmin'], $this);
4811 $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $testpass);
4813 $testSequence->loadFromDb($dynamicQuestionSetConfig);
4816 $sequence = (
array) $testSequence->getUserSequenceQuestions();
4818 $questionsIdsToRequest = array_diff(array_values($sequence), array_values($questionData));
4819 if (count($questionsIdsToRequest) > 0) {
4820 $questionIdsCondition =
' ' . $DIC->database()->in(
'question_id', array_values($questionsIdsToRequest),
false,
'integer') .
' ';
4822 $res = $DIC->database()->queryF(
4826 WHERE {$questionIdsCondition}",
4830 while (
$row = $DIC->database()->fetchAssoc(
$res)) {
4831 $questionData[
$row[
'question_id']] =
$row;
4832 $data->addQuestionTitle($row[
'question_id'], $row[
'title']);
4836 foreach ($sequence as $questionId) {
4837 if (!isset($questionData[$questionId])) {
4841 $row = $questionData[$questionId];
4843 $data->getParticipant(
4846 $row[
'original_id'],
4847 $row[
'question_id'],
4856 SELECT tst_test_question.sequence, tst_test_question.question_fi, 4857 qpl_questions.points, qpl_questions.title, qpl_questions.original_id 4858 FROM tst_test_question, tst_active, qpl_questions 4859 WHERE tst_test_question.question_fi = qpl_questions.question_id 4860 AND tst_active.active_id = %s 4861 AND tst_active.test_fi = tst_test_question.test_fi 4862 ORDER BY tst_test_question.sequence 4872 $questionsbysequence =
array();
4875 $questionsbysequence[
$row[
"sequence"]] =
$row;
4878 $seqresult =
$ilDB->queryF(
4879 "SELECT * FROM tst_sequence WHERE active_fi = %s",
4884 while ($seqrow =
$ilDB->fetchAssoc($seqresult)) {
4885 $questionsequence = unserialize($seqrow[
"sequence"]);
4887 foreach ($questionsequence as $sidx => $seq) {
4888 $data->getParticipant($active_id)->addQuestion(
4889 $questionsbysequence[$seq][
"original_id"],
4890 $questionsbysequence[$seq][
"question_fi"],
4891 $questionsbysequence[$seq][
"points"],
4896 $data->addQuestionTitle(
4897 $questionsbysequence[$seq][
"question_fi"],
4898 $questionsbysequence[$seq][
"title"]
4910 foreach (array_keys(
$data->getParticipants()) as $active_id) {
4911 $tstUserData =
$data->getParticipant($active_id);
4913 $percentage = $tstUserData->getReachedPointsInPercent();
4915 $obligationsAnswered = $tstUserData->areObligationsAnswered();
4917 $mark = $this->mark_schema->getMatchingMark($percentage);
4919 if (is_object($mark)) {
4920 $tstUserData->setMark($mark->getShortName());
4921 $tstUserData->setMarkOfficial($mark->getOfficialName());
4923 $tstUserData->setPassed(
4924 $mark->getPassed() && $tstUserData->areObligationsAnswered()
4931 $tstUserData->getReached(),
4932 $tstUserData->getMaxPoints()
4935 $tstUserData->setECTSMark($ects_mark);
4940 $tstUserData->setFirstVisit($visitingTime[
"firstvisit"]);
4941 $tstUserData->setLastVisit($visitingTime[
"lastvisit"]);
4956 $res = $ilDB->queryF(
4958 SELECT COUNT(qpl_questions.question_id) qcount, 4959 SUM(qpl_questions.points) qsum 4961 INNER JOIN tst_tests 4962 ON tst_tests.test_id = tst_active.test_fi 4963 INNER JOIN tst_dyn_quest_set_cfg 4964 ON tst_dyn_quest_set_cfg.test_fi = tst_tests.test_id 4965 INNER JOIN qpl_questions 4966 ON qpl_questions.obj_fi = tst_dyn_quest_set_cfg.source_qpl_fi 4967 AND qpl_questions.original_id IS NULL 4968 AND qpl_questions.complete = %s 4969 WHERE tst_active.active_id = %s 4971 array(
'integer',
'integer'),
4972 array(1, $active_id)
4979 $res = $ilDB->queryF(
4981 SELECT tst_test_rnd_qst.pass, 4982 COUNT(tst_test_rnd_qst.question_fi) qcount, 4983 SUM(qpl_questions.points) qsum 4985 FROM tst_test_rnd_qst, 4988 WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id 4989 AND tst_test_rnd_qst.active_fi = %s 4992 GROUP BY tst_test_rnd_qst.active_fi, 4993 tst_test_rnd_qst.pass 4995 array(
'integer',
'integer'),
5003 $res = $ilDB->queryF(
5005 SELECT COUNT(tst_test_question.question_fi) qcount, 5006 SUM(qpl_questions.points) qsum 5008 FROM tst_test_question, 5012 WHERE tst_test_question.question_fi = qpl_questions.question_id 5013 AND tst_test_question.test_fi = tst_active.test_fi 5014 AND tst_active.active_id = %s 5016 GROUP BY tst_test_question.test_fi 5026 throw new ilTestException(
"not supported question set type: $questionSetType");
5031 if (is_array(
$row)) {
5032 return array(
"count" =>
$row[
"qcount"],
"points" =>
$row[
"qsum"]);
5035 return array(
"count" => 0,
"points" => 0);
5040 include_once
"./Modules/Test/classes/class.ilTestEvaluationData.php";
5041 include_once
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
5042 include_once
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
5043 $data = $this->getUnfilteredEvaluationData();
5044 if ($withStatistics) {
5045 $data->calculateStatistics();
5047 $data->setFilter($filterby, $filtertext);
5073 "SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
5074 "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
5075 "qpl_questions.points maxpoints " .
5076 "FROM tst_test_result, qpl_questions, tst_active " .
5077 "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
5078 "WHERE tst_active.active_id = tst_test_result.active_fi " .
5079 "AND qpl_questions.question_id = tst_test_result.question_fi " .
5080 "AND tst_active.test_fi = %s " .
5081 "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
5085 $overview =
array();
5087 if (!array_key_exists(
$row[
"active_fi"], $overview)) {
5089 $overview[$row[
"active_fi"]][
"firstname"] = $row[
"firstname"];
5090 $overview[$row[
"active_fi"]][
"lastname"] = $row[
"lastname"];
5091 $overview[$row[
"active_fi"]][
"title"] = $row[
"title"];
5092 $overview[$row[
"active_fi"]][
"login"] = $row[
"login"];
5093 $overview[$row[
"active_fi"]][
"usr_id"] = $row[
"usr_id"];
5094 $overview[$row[
"active_fi"]][
"started"] = $row[
"started"];
5095 $overview[$row[
"active_fi"]][
"finished"] = $row[
"finished"];
5097 if (!array_key_exists(
$row[
"pass"], $overview[
$row[
"active_fi"]])) {
5098 $overview[$row[
"active_fi"]][$row[
"pass"]] =
array();
5099 $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] = 0;
5100 $overview[$row[
"active_fi"]][$row[
"pass"]][
"maxpoints"] = $row[
"maxpoints"];
5102 array_push($overview[$row[
"active_fi"]][$row[
"pass"]], $row);
5103 $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] += $row[
"points"];
5120 "SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
5121 "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
5122 "qpl_questions.points maxpoints " .
5123 "FROM tst_test_result, qpl_questions, tst_active " .
5124 "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
5125 "WHERE tst_active.active_id = tst_test_result.active_fi " .
5126 "AND qpl_questions.question_id = tst_test_result.question_fi " .
5127 "AND tst_active.test_fi = %s AND tst_active.active_id = %s" .
5128 "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
5129 array(
'integer',
'integer'),
5132 $overview =
array();
5134 if (!array_key_exists(
$row[
"active_fi"], $overview)) {
5136 $overview[$row[
"active_fi"]][
"firstname"] = $row[
"firstname"];
5137 $overview[$row[
"active_fi"]][
"lastname"] = $row[
"lastname"];
5138 $overview[$row[
"active_fi"]][
"title"] = $row[
"title"];
5139 $overview[$row[
"active_fi"]][
"login"] = $row[
"login"];
5140 $overview[$row[
"active_fi"]][
"usr_id"] = $row[
"usr_id"];
5141 $overview[$row[
"active_fi"]][
"started"] = $row[
"started"];
5142 $overview[$row[
"active_fi"]][
"finished"] = $row[
"finished"];
5144 if (!array_key_exists(
$row[
"pass"], $overview[
$row[
"active_fi"]])) {
5145 $overview[$row[
"active_fi"]][$row[
"pass"]] =
array();
5146 $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] = 0;
5147 $overview[$row[
"active_fi"]][$row[
"pass"]][
"maxpoints"] = $row[
"maxpoints"];
5149 array_push($overview[$row[
"active_fi"]][$row[
"pass"]], $row);
5150 $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] += $row[
"points"];
5169 if (strlen($firstname . $lastname .
$title) == 0) {
5170 $name = $this->lng->txt(
"deleted_user");
5172 if ($user_id == ANONYMOUS_USER_ID) {
5175 $name = trim($lastname .
", " . $firstname .
" " . $title);
5178 $name = $this->lng->txt(
"anonymous");
5200 if (strlen($firstname . $lastname .
$title) == 0) {
5201 $name = $lng->txt(
"deleted_user");
5203 if ($user_id == ANONYMOUS_USER_ID) {
5206 $name = trim($lastname .
", " . $firstname .
" " . $title);
5208 if ($is_anonymous) {
5209 $name = $lng->txt(
"anonymous");
5226 "SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi",
5232 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row->started, $matches);
5233 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
5234 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row->finished, $matches);
5235 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
5236 $times[
$row->active_fi] += ($epoch_2 - $epoch_1);
5240 foreach ($times as
$key => $value) {
5241 $max_time += $value;
5245 $average_time = round($max_time /
$counter);
5249 return $average_time;
5258 public function &
getAvailableQuestionpools($use_object_id =
false, $equal_points =
false, $could_be_offline =
false, $show_path =
false, $with_questioncount =
false, $permission =
"read")
5260 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
5272 $time_in_seconds = 0;
5273 foreach ($this->questions as $question_id) {
5275 $est_time = $question->getEstimatedWorkingTime();
5276 $time_in_seconds += $est_time[
"h"] * 3600 + $est_time[
"m"] * 60 + $est_time[
"s"];
5278 $hours = (int) ($time_in_seconds / 3600) ;
5279 $time_in_seconds = $time_in_seconds - ($hours * 3600);
5280 $minutes = (int) ($time_in_seconds / 60);
5281 $time_in_seconds = $time_in_seconds - ($minutes * 60);
5282 $result =
array(
"hh" => $hours,
"mm" => $minutes,
"ss" => $time_in_seconds);
5294 return CLIENT_WEB_DIR .
"/assessment/" . $this->
getId() .
"/images/";
5305 include_once
"./Services/Utilities/classes/class.ilUtil.php";
5320 if ((!$question_type) and ($question_id > 0)) {
5324 if (!strlen($question_type)) {
5328 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
5332 $question =
new $question_type_gui();
5334 if ($question_id > 0) {
5335 $question->object->loadFromDb($question_id);
5340 $question->object->feedbackOBJ =
new $feedbackObjectClassname($question->object, $ilCtrl, $ilDB, $lng);
5342 $assSettings =
new ilSetting(
'assessment');
5343 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
5345 $processLockerFactory->setQuestionId($question->object->getId());
5346 $processLockerFactory->setUserId($ilUser->getId());
5347 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
5349 $question->object->setProcessLocker($processLockerFactory->getLocker());
5366 if (strcmp($question_id,
"") != 0) {
5367 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
5382 $this->questions = array_values($this->questions);
5383 $array_pos = array_search($target_index, $this->questions);
5384 if ($insert_mode == 0) {
5385 $part1 = array_slice($this->questions, 0, $array_pos);
5386 $part2 = array_slice($this->questions, $array_pos);
5387 } elseif ($insert_mode == 1) {
5388 $part1 = array_slice($this->questions, 0, $array_pos + 1);
5389 $part2 = array_slice($this->questions, $array_pos + 1);
5391 foreach ($move_questions as $question_id) {
5392 if (!(array_search($question_id, $part1) ===
false)) {
5393 unset($part1[array_search($question_id, $part1)]);
5395 if (!(array_search($question_id, $part2) ===
false)) {
5396 unset($part2[array_search($question_id, $part2)]);
5399 $part1 = array_values($part1);
5400 $part2 = array_values($part2);
5401 $new_array = array_values(array_merge($part1, $move_questions, $part2));
5402 $this->questions =
array();
5404 foreach ($new_array as $question_id) {
5405 $this->questions[
$counter] = $question_id;
5460 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
5463 if (count($available_pools)) {
5464 $available =
" AND " . $ilDB->in(
'qpl_questions.obj_fi', $available_pools,
false,
'integer');
5468 if ($completeonly) {
5469 $available .=
" AND qpl_questions.complete = " . $ilDB->quote(
"1",
'text');
5473 if (is_array($arrFilter)) {
5474 if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title'])) {
5475 $where .=
" AND " . $ilDB->like(
'qpl_questions.title',
'text',
"%%" . $arrFilter[
'title'] .
"%%");
5477 if (array_key_exists(
'description', $arrFilter) && strlen($arrFilter[
'description'])) {
5478 $where .=
" AND " . $ilDB->like(
'qpl_questions.description',
'text',
"%%" . $arrFilter[
'description'] .
"%%");
5480 if (array_key_exists(
'author', $arrFilter) && strlen($arrFilter[
'author'])) {
5481 $where .=
" AND " . $ilDB->like(
'qpl_questions.author',
'text',
"%%" . $arrFilter[
'author'] .
"%%");
5483 if (array_key_exists(
'type', $arrFilter) && strlen($arrFilter[
'type'])) {
5484 $where .=
" AND qpl_qst_type.type_tag = " . $ilDB->quote($arrFilter[
'type'],
'text');
5486 if (array_key_exists(
'qpl', $arrFilter) && strlen($arrFilter[
'qpl'])) {
5487 $where .=
" AND " . $ilDB->like(
'object_data.title',
'text',
"%%" . $arrFilter[
'qpl'] .
"%%");
5492 $original_clause =
" qpl_questions.original_id IS NULL";
5493 if (count($original_ids)) {
5494 $original_clause =
" qpl_questions.original_id IS NULL AND " . $ilDB->in(
'qpl_questions.question_id', $original_ids,
true,
'integer');
5497 $query_result = $ilDB->query(
" 5498 SELECT qpl_questions.*, qpl_questions.tstamp, 5499 qpl_qst_type.type_tag, qpl_qst_type.plugin, qpl_qst_type.plugin_name, 5500 object_data.title parent_title 5501 FROM qpl_questions, qpl_qst_type, object_data 5502 WHERE $original_clause $available 5503 AND object_data.obj_id = qpl_questions.obj_fi 5504 AND qpl_questions.tstamp > 0 5505 AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id 5509 $types = $this->getQuestionTypeTranslations();
5510 if ($query_result->numRows()) {
5511 while (
$row = $ilDB->fetchAssoc($query_result)) {
5514 if (!
$row[
'plugin']) {
5521 if (!$pluginAdmin->isActive(
IL_COMP_MODULE,
'TestQuestionPool',
'qst',
$row[
'plugin_name'])) {
5526 $row[
'ttype' ] = $pl->getQuestionTypeTranslation();
5546 foreach ($assessment->objectives as $objectives) {
5547 foreach ($objectives->materials as $material) {
5562 foreach ($assessment->assessmentcontrol as $assessmentcontrol) {
5563 switch ($assessmentcontrol->getSolutionswitch()) {
5578 foreach ($assessment->qtimetadata as
$metadata) {
5579 switch ($metadata[
"label"]) {
5582 $type = $metadata[
"entry"];
5602 case "sequence_settings":
5605 case "solution_details":
5608 case "print_bs_with_res":
5617 case "pass_waiting":
5621 $this->
setKiosk($metadata[
"entry"]);
5623 case "showfinalstatement":
5636 case "highscore_enabled":
5640 case "highscore_anon":
5644 case "highscore_achieved_ts":
5648 case "highscore_score":
5652 case "highscore_percentage":
5656 case "highscore_hints":
5660 case "highscore_wtime":
5664 case "highscore_own_table":
5668 case "highscore_top_table":
5672 case "highscore_top_num":
5676 case "hide_previous_results":
5677 if ($metadata[
"entry"] == 0) {
5683 case "use_previous_answers":
5686 case "answer_feedback":
5689 case "hide_title_points":
5692 case "title_output":
5695 case "question_set_type":
5699 if ($metadata[
"entry"]) {
5705 case "results_presentation":
5708 case "reset_processing_time":
5711 case "instant_verification":
5714 case "instant_feedback_answer_fixation":
5717 case "force_instant_feedback":
5720 case "answer_feedback_points":
5735 case "fixed_participants":
5738 case "score_reporting":
5741 case "shuffle_questions":
5744 case "count_system":
5750 case "mailnotification":
5756 case "exportsettings":
5759 case "score_cutting":
5766 case "allowedUsers":
5770 case "allowedUsersTimeGap":
5773 case "pass_scoring":
5776 case 'pass_deletion_allowed':
5779 case "show_summary":
5782 case "reporting_date":
5783 $iso8601period = $metadata[
"entry"];
5784 if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches)) {
5785 $this->
setReportingDate(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
5788 case 'enable_processing_time':
5791 case "processing_time":
5794 case "starting_time":
5795 $iso8601period = $metadata[
"entry"];
5796 if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches)) {
5797 $date_time =
new ilDateTime(sprintf(
"%02d-%02d-%02d %02d:%02d:%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]),
IL_CAL_DATETIME);
5803 $iso8601period = $metadata[
"entry"];
5804 if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches)) {
5805 $date_time =
new ilDateTime(sprintf(
"%02d-%02d-%02d %02d:%02d:%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]),
IL_CAL_DATETIME);
5810 case "enable_examview":
5813 case 'show_examview_html':
5816 case 'show_examview_pdf':
5819 case 'redirection_mode':
5822 case 'redirection_url':
5825 case 'examid_in_kiosk':
5826 case 'examid_in_test_pass':
5829 case 'show_exam_id':
5830 case 'examid_in_test_res':
5833 case 'enable_archiving':
5836 case 'sign_submission':
5839 case 'char_selector_availability':
5842 case 'char_selector_definition':
5845 case 'skill_service':
5848 case 'result_tax_filters':
5851 case 'show_grading_status':
5854 case 'show_grading_mark':
5857 case 'activation_limited':
5860 case 'activation_start_time':
5863 case 'activation_end_time':
5866 case 'activation_visibility':
5872 case 'autosave_ival':
5875 case 'offer_question_hints':
5878 case 'instant_feedback_specific':
5881 case 'obligations_enabled':
5885 if (preg_match(
"/mark_step_\d+/", $metadata[
"label"])) {
5886 $xmlmark = $metadata[
"entry"];
5887 preg_match(
"/<short>(.*?)<\/short>/", $xmlmark, $matches);
5888 $mark_short = $matches[1];
5889 preg_match(
"/<official>(.*?)<\/official>/", $xmlmark, $matches);
5890 $mark_official = $matches[1];
5891 preg_match(
"/<percentage>(.*?)<\/percentage>/", $xmlmark, $matches);
5892 $mark_percentage = $matches[1];
5893 preg_match(
"/<passed>(.*?)<\/passed>/", $xmlmark, $matches);
5894 $mark_passed = $matches[1];
5895 $this->mark_schema->addMarkStep($mark_short, $mark_official, $mark_percentage, $mark_passed);
5899 if (is_array(
$_SESSION[
"import_mob_xhtml"])) {
5900 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
5901 include_once
"./Services/RTE/classes/class.ilRTE.php";
5902 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
5903 foreach (
$_SESSION[
"import_mob_xhtml"] as $mob) {
5905 if (file_exists($importfile)) {
5912 $ilLog->write(
"Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
5926 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
5930 $a_xml_writer->xmlSetDtdDef(
"<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">");
5931 $a_xml_writer->xmlStartTag(
"questestinterop");
5934 "ident" =>
"il_" . IL_INST_ID .
"_tst_" . $this->
getTestId(),
5937 $a_xml_writer->xmlStartTag(
"assessment", $attrs);
5939 $a_xml_writer->xmlElement(
"qticomment", null, $this->
getDescription());
5942 if ($this->enable_processing_time) {
5943 preg_match(
"/(\d+):(\d+):(\d+)/", $this->processing_time, $matches);
5944 $a_xml_writer->xmlElement(
"duration", null, sprintf(
"P0Y0M0DT%dH%dM%dS", $matches[1], $matches[2], $matches[3]));
5948 $a_xml_writer->xmlStartTag(
"qtimetadata");
5949 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
5950 $a_xml_writer->xmlElement(
"fieldlabel", null,
"ILIAS_VERSION");
5951 $a_xml_writer->xmlElement(
"fieldentry", null, $this->
ilias->getSetting(
"ilias_version"));
5952 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
5955 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
5956 $a_xml_writer->xmlElement(
"fieldlabel", null,
"anonymity");
5957 $a_xml_writer->xmlElement(
"fieldentry", null, sprintf(
"%d", $this->
getAnonymity()));
5958 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
5960 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
5961 $a_xml_writer->xmlElement(
"fieldlabel", null,
"use_pool");
5962 $a_xml_writer->xmlElement(
"fieldentry", null, $this->
getPoolUsage() ? 1 : 0);
5963 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
5966 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
5967 $a_xml_writer->xmlElement(
"fieldlabel", null,
"question_set_type");
5969 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
5972 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
5973 $a_xml_writer->xmlElement(
"fieldlabel", null,
"sequence_settings");
5975 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
5978 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
5979 $a_xml_writer->xmlElement(
"fieldlabel", null,
"author");
5980 $a_xml_writer->xmlElement(
"fieldentry", null, $this->
getAuthor());
5981 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
5984 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
5985 $a_xml_writer->xmlElement(
"fieldlabel", null,
"reset_processing_time");
5987 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
5990 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
5991 $a_xml_writer->xmlElement(
"fieldlabel", null,
"count_system");
5992 $a_xml_writer->xmlElement(
"fieldentry", null, $this->
getCountSystem());
5993 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
5996 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
5997 $a_xml_writer->xmlElement(
"fieldlabel", null,
"mc_scoring");
5998 $a_xml_writer->xmlElement(
"fieldentry", null, $this->
getMCScoring());
5999 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6002 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6003 $a_xml_writer->xmlElement(
"fieldlabel", null,
"score_cutting");
6004 $a_xml_writer->xmlElement(
"fieldentry", null, $this->
getScoreCutting());
6005 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6008 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6009 $a_xml_writer->xmlElement(
"fieldlabel", null,
"password");
6010 $a_xml_writer->xmlElement(
"fieldentry", null, $this->
getPassword());
6011 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6014 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6015 $a_xml_writer->xmlElement(
"fieldlabel", null,
"allowedUsers");
6016 $a_xml_writer->xmlElement(
"fieldentry", null, $this->
getAllowedUsers());
6017 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6020 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6021 $a_xml_writer->xmlElement(
"fieldlabel", null,
"allowedUsersTimeGap");
6023 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6026 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6027 $a_xml_writer->xmlElement(
"fieldlabel", null,
"pass_scoring");
6028 $a_xml_writer->xmlElement(
"fieldentry", null, $this->
getPassScoring());
6029 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6031 $a_xml_writer->xmlStartTag(
'qtimetadatafield');
6032 $a_xml_writer->xmlElement(
'fieldlabel', null,
'pass_deletion_allowed');
6034 $a_xml_writer->xmlEndTag(
'qtimetadatafield');
6038 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6039 $a_xml_writer->xmlElement(
"fieldlabel", null,
"reporting_date");
6040 preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->reporting_date, $matches);
6041 $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]));
6042 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6045 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6046 $a_xml_writer->xmlElement(
"fieldlabel", null,
"nr_of_tries");
6047 $a_xml_writer->xmlElement(
"fieldentry", null, sprintf(
"%d", $this->
getNrOfTries()));
6048 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6051 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6052 $a_xml_writer->xmlElement(
"fieldlabel", null,
"pass_waiting");
6053 $a_xml_writer->xmlElement(
"fieldentry", null, $this->
getPassWaiting());
6054 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6057 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6058 $a_xml_writer->xmlElement(
"fieldlabel", null,
"kiosk");
6059 $a_xml_writer->xmlElement(
"fieldentry", null, sprintf(
"%d", $this->
getKiosk()));
6060 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6064 $a_xml_writer->xmlStartTag(
'qtimetadatafield');
6065 $a_xml_writer->xmlElement(
"fieldlabel", null,
"redirection_mode");
6067 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6070 $a_xml_writer->xmlStartTag(
'qtimetadatafield');
6071 $a_xml_writer->xmlElement(
"fieldlabel", null,
"redirection_url");
6073 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6076 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6077 $a_xml_writer->xmlElement(
"fieldlabel", null,
"use_previous_answers");
6079 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6082 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6083 $a_xml_writer->xmlElement(
"fieldlabel", null,
"title_output");
6084 $a_xml_writer->xmlElement(
"fieldentry", null, sprintf(
"%d", $this->
getTitleOutput()));
6085 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6088 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6089 $a_xml_writer->xmlElement(
"fieldlabel", null,
"results_presentation");
6091 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6094 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6095 $a_xml_writer->xmlElement(
"fieldlabel", null,
"examid_in_test_pass");
6097 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6100 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6101 $a_xml_writer->xmlElement(
"fieldlabel", null,
"examid_in_test_res");
6103 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6106 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6107 $a_xml_writer->xmlElement(
"fieldlabel", null,
"show_summary");
6109 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6112 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6113 $a_xml_writer->xmlElement(
"fieldlabel", null,
"score_reporting");
6114 $a_xml_writer->xmlElement(
"fieldentry", null, sprintf(
"%d", $this->
getScoreReporting()));
6115 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6117 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6118 $a_xml_writer->xmlElement(
"fieldlabel", null,
"solution_details");
6120 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6121 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6122 $a_xml_writer->xmlElement(
"fieldlabel", null,
"print_bs_with_res");
6124 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6127 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6128 $a_xml_writer->xmlElement(
"fieldlabel", null,
"instant_verification");
6130 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6133 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6134 $a_xml_writer->xmlElement(
"fieldlabel", null,
"answer_feedback");
6135 $a_xml_writer->xmlElement(
"fieldentry", null, sprintf(
"%d", $this->
getAnswerFeedback()));
6136 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6139 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6140 $a_xml_writer->xmlElement(
"fieldlabel", null,
"answer_feedback_points");
6142 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6145 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6146 $a_xml_writer->xmlElement(
"fieldlabel", null,
"instant_feedback_answer_fixation");
6148 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6151 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6152 $a_xml_writer->xmlElement(
"fieldlabel", null,
"force_instant_feedback");
6154 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6158 $highscore_metadata =
array(
6170 foreach ($highscore_metadata as $label =>
$data) {
6171 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6172 $a_xml_writer->xmlElement(
"fieldlabel", null, $label);
6173 $a_xml_writer->xmlElement(
"fieldentry", null, sprintf(
"%d",
$data[
'value']));
6174 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6178 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6179 $a_xml_writer->xmlElement(
"fieldlabel", null,
"show_cancel");
6180 $a_xml_writer->xmlElement(
"fieldentry", null, sprintf(
"%d", $this->
getShowCancel()));
6181 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6184 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6185 $a_xml_writer->xmlElement(
"fieldlabel", null,
"show_marker");
6186 $a_xml_writer->xmlElement(
"fieldentry", null, sprintf(
"%d", $this->
getShowMarker()));
6187 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6190 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6191 $a_xml_writer->xmlElement(
"fieldlabel", null,
"fixed_participants");
6193 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6196 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6197 $a_xml_writer->xmlElement(
"fieldlabel", null,
"showfinalstatement");
6198 $a_xml_writer->xmlElement(
"fieldentry", null, sprintf(
"%d", (($this->
getShowFinalStatement()) ?
"1" :
"0")));
6199 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6202 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6203 $a_xml_writer->xmlElement(
"fieldlabel", null,
"showinfo");
6204 $a_xml_writer->xmlElement(
"fieldentry", null, sprintf(
"%d", (($this->
getShowInfo()) ?
"1" :
"0")));
6205 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6208 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6209 $a_xml_writer->xmlElement(
"fieldlabel", null,
"mailnotification");
6211 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6214 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6215 $a_xml_writer->xmlElement(
"fieldlabel", null,
"mailnottype");
6217 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6220 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6221 $a_xml_writer->xmlElement(
"fieldlabel", null,
"exportsettings");
6222 $a_xml_writer->xmlElement(
"fieldentry", null, (
int) $this->
getExportSettings());
6223 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6226 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6227 $a_xml_writer->xmlElement(
"fieldlabel", null,
"forcejs");
6228 $a_xml_writer->xmlElement(
"fieldentry", null, sprintf(
"%d", (($this->
getForceJS()) ?
"1" :
"0")));
6229 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6232 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6233 $a_xml_writer->xmlElement(
"fieldlabel", null,
"customstyle");
6234 $a_xml_writer->xmlElement(
"fieldentry", null, $this->
getCustomStyle());
6235 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6238 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6239 $a_xml_writer->xmlElement(
"fieldlabel", null,
"shuffle_questions");
6240 $a_xml_writer->xmlElement(
"fieldentry", null, sprintf(
"%d", $this->
getShuffleQuestions()));
6241 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6244 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6245 $a_xml_writer->xmlElement(
"fieldlabel", null,
"processing_time");
6247 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6250 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6251 $a_xml_writer->xmlElement(
"fieldlabel", null,
"enable_examview");
6252 $a_xml_writer->xmlElement(
"fieldentry", null, (
int) $this->
getEnableExamview());
6253 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6256 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6257 $a_xml_writer->xmlElement(
"fieldlabel", null,
"show_examview_html");
6259 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6262 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6263 $a_xml_writer->xmlElement(
"fieldlabel", null,
"show_examview_pdf");
6265 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6268 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6269 $a_xml_writer->xmlElement(
"fieldlabel", null,
"enable_archiving");
6271 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6274 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6275 $a_xml_writer->xmlElement(
"fieldlabel", null,
"sign_submission");
6276 $a_xml_writer->xmlElement(
"fieldentry", null, (
int) $this->
getSignSubmission());
6277 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6280 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6281 $a_xml_writer->xmlElement(
"fieldlabel", null,
"char_selector_availability");
6283 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6286 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6287 $a_xml_writer->xmlElement(
"fieldlabel", null,
"char_selector_definition");
6289 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6292 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6293 $a_xml_writer->xmlElement(
"fieldlabel", null,
"skill_service");
6295 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6298 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6299 $a_xml_writer->xmlElement(
"fieldlabel", null,
"result_tax_filters");
6301 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6304 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6305 $a_xml_writer->xmlElement(
"fieldlabel", null,
"show_grading_status");
6307 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6310 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6311 $a_xml_writer->xmlElement(
"fieldlabel", null,
"show_grading_mark");
6313 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6318 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6319 $a_xml_writer->xmlElement(
"fieldlabel", null,
"starting_time");
6321 $a_xml_writer->xmlElement(
"fieldentry", null, $backward_compatibility_format);
6322 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6326 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6327 $a_xml_writer->xmlElement(
"fieldlabel", null,
"ending_time");
6329 $a_xml_writer->xmlElement(
"fieldentry", null, $backward_compatibility_format);
6330 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6335 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6336 $a_xml_writer->xmlElement(
"fieldlabel", null,
"activation_limited");
6338 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6341 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6342 $a_xml_writer->xmlElement(
"fieldlabel", null,
"activation_start_time");
6344 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6347 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6348 $a_xml_writer->xmlElement(
"fieldlabel", null,
"activation_end_time");
6350 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6353 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6354 $a_xml_writer->xmlElement(
"fieldlabel", null,
"activation_visibility");
6356 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6359 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6360 $a_xml_writer->xmlElement(
"fieldlabel", null,
"autosave");
6361 $a_xml_writer->xmlElement(
"fieldentry", null, (
int) $this->
getAutosave());
6362 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6365 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6366 $a_xml_writer->xmlElement(
"fieldlabel", null,
"autosave_ival");
6367 $a_xml_writer->xmlElement(
"fieldentry", null, (
int) $this->
getAutosaveIval());
6368 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6371 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6372 $a_xml_writer->xmlElement(
"fieldlabel", null,
"offer_question_hints");
6374 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6377 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6378 $a_xml_writer->xmlElement(
"fieldlabel", null,
"instant_feedback_specific");
6380 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6383 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6384 $a_xml_writer->xmlElement(
"fieldlabel", null,
"instant_feedback_answer_fixation");
6386 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6389 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6390 $a_xml_writer->xmlElement(
"fieldlabel", null,
"obligations_enabled");
6392 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6395 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6396 $a_xml_writer->xmlElement(
"fieldlabel", null,
"enable_processing_time");
6398 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6400 foreach ($this->mark_schema->mark_steps as
$index => $mark) {
6402 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6403 $a_xml_writer->xmlElement(
"fieldlabel", null,
"mark_step_$index");
6404 $a_xml_writer->xmlElement(
"fieldentry", null, sprintf(
6405 "<short>%s</short><official>%s</official><percentage>%.2f</percentage><passed>%d</passed>",
6406 $mark->getShortName(),
6407 $mark->getOfficialName(),
6408 $mark->getMinimumLevel(),
6411 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6413 $a_xml_writer->xmlEndTag(
"qtimetadata");
6416 $a_xml_writer->xmlStartTag(
"objectives");
6418 $a_xml_writer->xmlEndTag(
"objectives");
6423 "solutionswitch" =>
"Yes" 6428 $a_xml_writer->xmlElement(
"assessmentcontrol", $attrs, null);
6432 $a_xml_writer->xmlStartTag(
"presentation_material");
6433 $a_xml_writer->xmlStartTag(
"flow_mat");
6435 $a_xml_writer->xmlEndTag(
"flow_mat");
6436 $a_xml_writer->xmlEndTag(
"presentation_material");
6442 $a_xml_writer->xmlElement(
"section", $attrs, null);
6443 $a_xml_writer->xmlEndTag(
"assessment");
6444 $a_xml_writer->xmlEndTag(
"questestinterop");
6446 $xml = $a_xml_writer->xmlDumpMem(
false);
6458 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $date_time, $matches);
6459 $iso8601_period = sprintf(
"P%dY%dM%dDT%dH%dM%dS", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]);
6460 return $iso8601_period;
6473 $this->mob_ids =
array();
6474 $this->file_ids =
array();
6480 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Start Export Page Objects");
6481 $ilBench->start(
"ContentObjectExport",
"exportPageObjects");
6483 $ilBench->stop(
"ContentObjectExport",
"exportPageObjects");
6484 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Finished Export Page Objects");
6487 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Start Export Media Objects");
6488 $ilBench->start(
"ContentObjectExport",
"exportMediaObjects");
6490 $ilBench->stop(
"ContentObjectExport",
"exportMediaObjects");
6491 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Finished Export Media Objects");
6494 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Start Export File Items");
6495 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
6497 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
6498 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Finished Export File Items");
6509 include_once
"./Services/MetaData/classes/class.ilMD2XML.php";
6511 $md2xml->setExportMode(
true);
6512 $md2xml->startExport();
6513 $a_xml_writer->appendXML($md2xml->getXML());
6523 if ($a_tag ==
"Identifier" && $a_param ==
"Entry") {
6524 include_once
"./Services/Utilities/classes/class.ilUtil.php";
6542 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
6544 foreach ($this->questions as $question_id) {
6545 $ilBench->start(
"ContentObjectExport",
"exportPageObject");
6546 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Page Object " . $question_id);
6549 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
6553 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML");
6554 include_once
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
6556 $page_object->buildDom();
6557 $page_object->insertInstIntoIDs($a_inst);
6558 $mob_ids = $page_object->collectMediaObjects(
false);
6559 require_once
'Services/COPage/classes/class.ilPCFileList.php';
6561 $xml = $page_object->getXMLFromDom(
false,
false,
false,
"",
true);
6562 $xml = str_replace(
"&",
"&", $xml);
6563 $a_xml_writer->appendXML($xml);
6564 $page_object->freeDom();
6565 unset($page_object);
6567 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML");
6570 $ilBench->start(
"ContentObjectExport",
"exportPageObject_CollectMedia");
6572 foreach ($mob_ids as $mob_id) {
6573 $this->mob_ids[$mob_id] = $mob_id;
6575 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_CollectMedia");
6578 $ilBench->start(
"ContentObjectExport",
"exportPageObject_CollectFileItems");
6580 foreach ($file_ids as $file_id) {
6581 $this->file_ids[$file_id] = $file_id;
6583 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_CollectFileItems");
6585 $a_xml_writer->xmlEndTag(
"PageObject");
6588 $ilBench->stop(
"ContentObjectExport",
"exportPageObject");
6600 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
6602 foreach ($this->mob_ids as $mob_id) {
6603 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"Media Object " . $mob_id);
6606 $media_obj->exportXML($a_xml_writer, $a_inst);
6607 $media_obj->exportFiles($a_target_dir);
6619 include_once
"./Modules/File/classes/class.ilObjFile.php";
6621 foreach ($this->file_ids as $file_id) {
6622 $expLog->write(
date(
"[y-m-d H:i:s] ") .
"File Item " . $file_id);
6623 $file_obj =
new ilObjFile($file_id,
false);
6624 $file_obj->export($a_target_dir);
6635 if (!is_array($this->import_mapping)) {
6638 return $this->import_mapping;
6663 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);
6669 public static function _getECTSGrade($points_passed, $reached_points, $max_points, $a, $b, $c,
$d, $e, $fx)
6671 include_once
"./Modules/Test/classes/class.ilStatistics.php";
6674 $passed_statistics->setData($points_passed);
6675 $ects_percentiles =
array(
6676 "A" => $passed_statistics->quantile($a),
6677 "B" => $passed_statistics->quantile($b),
6678 "C" => $passed_statistics->quantile($c),
6679 "D" => $passed_statistics->quantile(
$d),
6680 "E" => $passed_statistics->quantile($e)
6682 if (count($points_passed) && ($reached_points >= $ects_percentiles[
"A"])) {
6684 } elseif (count($points_passed) && ($reached_points >= $ects_percentiles[
"B"])) {
6686 } elseif (count($points_passed) && ($reached_points >= $ects_percentiles[
"C"])) {
6688 } elseif (count($points_passed) && ($reached_points >= $ects_percentiles[
"D"])) {
6690 } elseif (count($points_passed) && ($reached_points >= $ects_percentiles[
"E"])) {
6692 } elseif (strcmp($fx,
"") != 0) {
6693 if ($max_points > 0) {
6694 $percentage = ($reached_points / $max_points) * 100.0;
6695 if ($percentage < 0) {
6701 if ($percentage >= $fx) {
6716 return $this->mark_schema->checkMarks();
6746 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
6763 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getReportingDate(), $matches)) {
6764 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
6766 if ($now < $epoch_time) {
6801 $md_life =&$md->getLifecycle();
6803 if (strlen($a_author) == 0) {
6805 $a_author = $ilUser->getFullname();
6808 $md_life =&$md->addLifecycle();
6810 $con =&$md_life->addContribute();
6811 $con->setRole(
"Author");
6813 $ent =&$con->addEntity();
6814 $ent->setEntity($a_author);
6826 parent::createMetaData();
6840 include_once
"./Services/MetaData/classes/class.ilMD.php";
6842 $md_life =&$md->getLifecycle();
6844 $ids =&$md_life->getContributeIds();
6845 foreach ($ids as
$id) {
6846 $md_cont =&$md_life->getContribute($id);
6847 if (strcmp($md_cont->getRole(),
"Author") == 0) {
6848 $entids =&$md_cont->getEntityIds();
6849 foreach ($entids as $entid) {
6850 $md_ent =&$md_cont->getEntity($entid);
6851 array_push(
$author, $md_ent->getEntity());
6869 include_once
"./Services/MetaData/classes/class.ilMD.php";
6870 $md =
new ilMD($obj_id, 0,
"tst");
6871 $md_life =&$md->getLifecycle();
6873 $ids =&$md_life->getContributeIds();
6874 foreach ($ids as
$id) {
6875 $md_cont =&$md_life->getContribute($id);
6876 if (strcmp($md_cont->getRole(),
"Author") == 0) {
6877 $entids =&$md_cont->getEntityIds();
6878 foreach ($entids as $entid) {
6879 $md_ent =&$md_cont->getEntity($entid);
6880 array_push(
$author, $md_ent->getEntity());
6899 $result_array =
array();
6901 if (count($tests)) {
6904 if ($use_object_id) {
6906 $result_array[$obj_id] = $titles[
$ref_id];
6912 return $result_array;
6923 public function cloneObject($a_target_id, $a_copy_id = 0, $a_omit_tree =
false)
6931 $newObj = parent::cloneObject($a_target_id, $a_copy_id, $a_omit_tree);
6932 $newObj->setTmpCopyWizardCopyId($a_copy_id);
6938 if (!$cp_options->isRootNode($this->getRefId())) {
6939 $newObj->setOnline($this->
isOnline());
6964 $newObj->setKiosk($this->
getKiosk());
7018 $newObj->saveToDb();
7021 include_once
"./Services/Certificate/classes/class.ilCertificate.php";
7022 include_once
"./Modules/Test/classes/class.ilTestCertificateAdapter.php";
7025 $cert->cloneCertificate($newcert);
7027 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
7029 $testQuestionSetConfigFactory->getQuestionSetConfig()->cloneQuestionSetRelatedData($newObj);
7031 require_once
'Modules/Test/classes/class.ilTestSkillLevelThresholdList.php';
7033 $skillLevelThresholdList->setTestId($this->
getTestId());
7034 $skillLevelThresholdList->loadFromDb();
7035 $skillLevelThresholdList->cloneListForTest($newObj->getTestId());
7037 $newObj->saveToDb();
7038 $newObj->updateMetaData();
7040 include_once(
'./Services/Tracking/classes/class.ilLPObjSettings.php');
7042 $obj_settings->cloneSettings($newObj->getId());
7067 $questionSetConfig->loadFromDb();
7069 if ($questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
7070 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
7071 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetBuilderWithAmountPerPool.php';
7072 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
7080 $sourcePoolDefinitionList->loadDefinitions();
7082 $num = $sourcePoolDefinitionList->getQuestionAmount();
7084 $num = $questionSetConfig->getQuestionAmountPerTest();
7087 $num = count($this->questions);
7105 if (strcmp($question_id,
"") != 0) {
7106 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
7109 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
7125 "SELECT obj_fi FROM tst_tests WHERE test_id = %s",
7131 $object_id =
$row[
"obj_fi"];
7148 "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",
7154 $object_id =
$row[
"obj_fi"];
7171 "SELECT test_id FROM tst_tests WHERE obj_fi = %s",
7195 if (($active_id) && ($question_id)) {
7196 if (is_null(
$pass)) {
7197 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
7201 "SELECT value1 FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
7202 array(
'integer',
'integer',
'integer'),
7205 if (
$result->numRows() == 1) {
7227 "SELECT question_text FROM qpl_questions WHERE question_id = %s",
7231 if (
$result->numRows() == 1) {
7249 $result_array =
array();
7252 if (is_numeric($user_id)) {
7254 "SELECT tst_active.active_id, tst_active.tries, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
7255 "tst_active.submitted test_finished, matriculation, COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes FROM usr_data, tst_invited_user " .
7256 "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
7257 "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
7259 array(
'text',
'text',
'text',
'integer',
'integer'),
7260 array(
"", $this->lng->txt(
"anonymous"),
"", $this->
getTestId(), $user_id)
7264 "SELECT tst_active.active_id, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
7265 "tst_active.submitted test_finished, matriculation, COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes FROM usr_data, tst_invited_user " .
7266 "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
7267 "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
7269 array(
'text',
'text',
'text',
'integer'),
7274 if (is_numeric($user_id)) {
7276 "SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
7277 "tst_active.submitted test_finished, matriculation, COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes FROM usr_data, tst_invited_user " .
7278 "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
7279 "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
7281 array(
'integer',
'integer'),
7286 "SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
7287 "tst_active.submitted test_finished, matriculation, COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes FROM usr_data, tst_invited_user " .
7288 "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
7289 "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
7296 $result_array =
array();
7298 $result_array[
$row[
'usr_id']]=
$row;
7300 return $result_array;
7315 SELECT tst_active.active_id, 7317 tst_active.user_fi usr_id, 7321 tst_active.submitted test_finished, 7322 usr_data.matriculation, 7324 tst_active.lastindex, 7325 COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes 7328 ON tst_active.user_fi = usr_data.usr_id 7329 WHERE tst_active.test_fi = %s 7330 ORDER BY usr_data.lastname 7334 array(
'text',
'text',
'text',
'integer'),
7339 SELECT tst_active.active_id, 7341 tst_active.user_fi usr_id, 7345 tst_active.submitted test_finished, 7346 usr_data.matriculation, 7348 tst_active.lastindex, 7349 COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes 7352 ON tst_active.user_fi = usr_data.usr_id 7353 WHERE tst_active.test_fi = %s 7354 ORDER BY usr_data.lastname 7367 if (strlen(trim($participant[
"firstname"] . $participant[
"lastname"])) == 0) {
7368 $data[
$index][
"lastname"] = $this->lng->txt(
"deleted_user");
7378 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
7380 if (count($scoring) == 0) {
7385 $filtered_participants =
array();
7386 foreach ($participants as $active_id => $participant) {
7387 $qstType_IN_manScoreableQstTypes = $ilDB->in(
'qpl_questions.question_type_fi', $scoring,
false,
'integer');
7390 SELECT tst_test_result.manual 7392 FROM tst_test_result 7394 INNER JOIN qpl_questions 7395 ON tst_test_result.question_fi = qpl_questions.question_id 7397 WHERE tst_test_result.active_fi = %s 7398 AND $qstType_IN_manScoreableQstTypes 7412 if ($participant->active) {
7413 $filtered_participants[$active_id] = $participant;
7417 if (!$participant->active) {
7418 $filtered_participants[$active_id] = $participant;
7422 $filtered_participants[$active_id] = $participant;
7437 $assessmentSetting =
new ilSetting(
"assessment");
7438 $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
7439 if ($manscoring_done) {
7440 $filtered_participants[$active_id] = $participant;
7453 $assessmentSetting =
new ilSetting(
"assessment");
7454 $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
7455 if (!$manscoring_done) {
7456 $filtered_participants[$active_id] = $participant;
7464 if (
$row[
"manual"]) {
7468 if (($found > 0) && ($found < $count)) {
7469 $filtered_participants[$active_id] = $participant;
7473 $filtered_participants[$active_id] = $participant;
7478 return $filtered_participants;
7492 if (!is_array($ids) || count($ids) ==0) {
7498 "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",
7499 array(
'text',
'text',
'text'),
7500 array(
"", $this->lng->txt(
"anonymous"),
"")
7503 $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");
7506 $result_array =
array();
7508 $result_array[
$row[
"usr_id"]]=
$row;
7510 return $result_array;
7515 if (!is_array($ids) || count($ids) ==0) {
7528 if (!is_array($ids) || count($ids) ==0) {
7532 foreach ($ids as $obj_id) {
7547 include_once
"./Modules/Group/classes/class.ilObjGroup.php";
7549 $members = $group->getGroupMemberIds();
7550 include_once
'./Services/User/classes/class.ilObjUser.php';
7551 foreach ($members as $user_id) {
7565 $members = $rbacreview->assignedUsers($role_id);
7566 include_once
'./Services/User/classes/class.ilObjUser.php';
7567 foreach ($members as $user_id) {
7584 $affectedRows = $ilDB->manipulateF(
7585 "DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
7586 array(
'integer',
'integer'),
7601 $affectedRows = $ilDB->manipulateF(
7602 "DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
7603 array(
'integer',
'integer'),
7606 $affectedRows = $ilDB->manipulateF(
7607 "INSERT INTO tst_invited_user (test_fi, user_fi, clientip, tstamp) VALUES (%s, %s, %s, %s)",
7608 array(
'integer',
'integer',
'text',
'integer'),
7609 array($this->
getTestId(), $user_id, (strlen($client_ip)) ? $client_ip : null,
time())
7618 $affectedRows = $ilDB->manipulateF(
7619 "UPDATE tst_invited_user SET clientip = %s, tstamp = %s WHERE test_fi=%s and user_fi=%s",
7620 array(
'text',
'integer',
'integer',
'integer'),
7621 array((strlen($client_ip)) ? $client_ip : null,
time(), $this->
getTestId(), $user_id)
7633 if (is_numeric($question_fi)) {
7635 "SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s AND question_fi=%s",
7636 array(
'integer',
'integer'),
7637 array($active_id, $question_fi)
7641 "SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s",
7646 $result_array =
array();
7648 $result_array[
$row[
"question_fi"]]=
$row;
7650 return $result_array;
7662 $affectedRows = $ilDB->manipulateF(
7663 "DELETE FROM tst_qst_solved WHERE active_fi = %s AND question_fi = %s",
7664 array(
'integer',
'integer'),
7665 array($active_id, $question_id)
7667 $affectedRows = $ilDB->manipulateF(
7668 "INSERT INTO tst_qst_solved (solved, question_fi, active_fi) VALUES (%s, %s, %s)",
7669 array(
'integer',
'integer',
'integer'),
7670 array($value, $question_id, $active_id)
7682 "SELECT submitted FROM tst_active WHERE active_id=%s AND submitted=%s",
7683 array(
'integer',
'integer'),
7684 array($active_id, 1)
7686 return $result->numRows() == 1;
7697 if (!is_numeric($user_id)) {
7698 $user_id = $ilUser->getId();
7702 "SELECT submitted FROM tst_active WHERE test_fi=%s AND user_fi=%s AND submitted=%s",
7703 array(
'integer',
'integer',
'integer'),
7706 return $result->numRows() == 1;
7741 "user_id" => $this->lng->txt(
"user_id"),
7742 "matriculation" => $this->lng->txt(
"matriculation"),
7743 "lastname" => $this->lng->txt(
"lastname"),
7744 "firstname" => $this->lng->txt(
"firstname"),
7745 "login" =>$this->lng->txt(
"login"),
7746 "reached_points" => $this->lng->txt(
"tst_reached_points"),
7747 "max_points" => $this->lng->txt(
"tst_maximum_points"),
7748 "percent_value" => $this->lng->txt(
"tst_percent_solved"),
7749 "mark" => $this->lng->txt(
"tst_mark"),
7750 "ects" => $this->lng->txt(
"ects_grade")
7753 if (count($participants)) {
7757 foreach ($participants as $active_id => $user_rec) {
7758 $mark = $ects_mark =
'';
7760 $reached_points = 0;
7762 foreach ($this->questions as $value) {
7764 if (is_object($question)) {
7765 $max_points += $question->getMaximumPoints();
7766 $reached_points += $question->getReachedPoints($active_id);
7769 if ($max_points > 0) {
7770 $percentvalue = $reached_points / $max_points;
7771 if ($percentvalue < 0) {
7772 $percentvalue = 0.0;
7777 $mark_obj = $this->mark_schema->getMatchingMark($percentvalue * 100);
7780 $mark = $mark_obj->getOfficialName();
7782 $ects_mark = $this->
getECTSGrade($passed_array, $reached_points, $max_points);
7786 $user_rec[
'firstname'] =
"";
7787 $user_rec[
'lastname'] = $this->lng->txt(
"anonymous");
7790 "user_id"=>$user_rec[
'usr_id'],
7791 "matriculation" => $user_rec[
'matriculation'],
7792 "lastname" => $user_rec[
'lastname'],
7793 "firstname" => $user_rec[
'firstname'],
7794 "login"=>$user_rec[
'login'],
7795 "reached_points" => $reached_points,
7796 "max_points" => $max_points,
7797 "percent_value" => $percentvalue,
7799 "ects" => $ects_mark
7819 $resultarray =
array();
7820 foreach (
$row as $rowindex => $entry) {
7825 if (strpos($entry,
"\"") !==
false) {
7826 $entry = str_replace(
"\"",
"\"\"", $entry);
7829 if (strpos($entry, $separator) !==
false) {
7833 $entry = str_replace(chr(13) . chr(10), chr(10), $entry);
7836 $entry =
"\"" . $entry .
"\"";
7839 $resultarray[$rowindex] = $entry;
7841 return $resultarray;
7856 "SELECT tries FROM tst_active WHERE active_id = %s",
7862 return $row[
"tries"];
7881 "SELECT MAX(pass) maxpass FROM tst_pass_result WHERE active_fi = %s",
7887 $max =
$row[
"maxpass"];
7904 "SELECT * FROM tst_pass_result WHERE active_fi = %s",
7912 if (
$row[
"maxpoints"] > 0) {
7913 $factor =
$row[
"points"] /
$row[
"maxpoints"];
7918 if ($factor > $bestfactor) {
7920 $bestfactor = $factor;
7923 if (is_array($bestrow)) {
7924 return $bestrow[
"pass"];
7943 $counted_pass = null;
7949 return $counted_pass;
7966 require_once
'Modules/Test/classes/class.ilTestSessionFactory.php';
7968 $testSession = $testSessionFactory->getSession($active_id);
7970 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
7974 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
7976 $dynamicQuestionSetConfig->loadFromDb();
7987 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
7989 foreach ($this->questions as $value) {
7991 $workedthrough += 1;
7994 return $workedthrough;
8007 if (is_null(
$pass)) {
8012 SELECT tst_pass_result.tstamp pass_res_tstamp, 8013 tst_test_result.tstamp quest_res_tstamp 8015 FROM tst_pass_result 8017 LEFT JOIN tst_test_result 8018 ON tst_test_result.active_fi = tst_pass_result.active_fi 8019 AND tst_test_result.pass = tst_pass_result.pass 8021 WHERE tst_pass_result.active_fi = %s 8022 AND tst_pass_result.pass = %s 8024 ORDER BY tst_test_result.tstamp DESC 8029 array(
'integer',
'integer'),
8034 if (
$row[
'qres_tstamp']) {
8035 return $row[
'quest_res_tstamp'];
8038 return $row[
'pass_res_tstamp'];
8055 "executable" =>
true,
8056 "errormessage" =>
"" 8059 $result[
"executable"] =
false;
8064 $result[
"executable"] =
false;
8072 if ($active_id > 0) {
8086 $result[
"executable"] =
false;
8087 $result[
"errormessage"] = $this->lng->txt(
"detail_max_processing_time_reached");
8094 require_once
'Modules/Test/classes/class.ilTestPassesSelector.php';
8096 $testPassesSelector->setActiveId($active_id);
8097 $testPassesSelector->setLastFinishedPass(
$testSession->getLastFinishedPass());
8100 $closedPasses = $testPassesSelector->getClosedPasses();
8103 $result[
"executable"] =
false;
8104 $result[
"errormessage"] = $this->lng->txt(
"maximum_nr_of_tries_reached");
8109 $lastPass = $testPassesSelector->getLastFinishedPassTimestamp();
8112 $time_values = explode(
":", $pass_waiting_string);
8113 $next_pass_allowed = strtotime(
'+ ' . $time_values[0] .
' Months + ' . $time_values[1] .
' Days + ' . $time_values[2] .
' Hours' . $time_values[3] .
' Minutes', $lastPass);
8115 if (
time() < $next_pass_allowed) {
8118 $result[
"executable"] =
false;
8119 $result[
"errormessage"] = sprintf($this->lng->txt(
'wait_for_next_pass_hint_msg'), $date);
8140 case self::SCORE_REPORTING_IMMIDIATLY:
8141 case self::SCORE_REPORTING_FINISHED:
8145 case self::SCORE_REPORTING_DATE:
8151 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getReportingDate(), $matches)) {
8152 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
8154 if ($now < $epoch_time) {
8168 if ($active_id > 0) {
8171 $notimeleft =
false;
8199 if ($active_id < 1) {
8202 if (
$pass === null) {
8206 "SELECT tst_times.started FROM tst_times WHERE tst_times.active_fi = %s AND tst_times.pass = %s ORDER BY tst_times.started",
8207 array(
'integer',
'integer'),
8212 if (preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches)) {
8213 return mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
8251 questtypes.type_tag, 8253 tstquest.obligatory, 8254 origquest.obj_fi orig_obj_fi 8256 FROM qpl_questions questions 8258 INNER JOIN qpl_qst_type questtypes 8259 ON questtypes.question_type_id = questions.question_type_fi 8261 INNER JOIN tst_test_question tstquest 8262 ON tstquest.question_fi = questions.question_id 8264 LEFT JOIN qpl_questions origquest 8265 ON origquest.question_id = questions.original_id 8267 WHERE tstquest.test_fi = %s 8269 ORDER BY tstquest.sequence 8272 $query_result = $ilDB->queryF(
8280 while (
$row = $ilDB->fetchAssoc($query_result)) {
8283 $question[
'obligationPossible'] = self::isQuestionObligationPossible(
$row[
'question_id']);
8295 $row = $DIC->database()->fetchAssoc($DIC->database()->queryF(
8296 "SELECT COUNT(question_id) cnt FROM qpl_questions WHERE question_id = %s AND obj_fi = %s",
8297 array(
'integer',
'integer'),
8301 return (
bool)
$row[
'cnt'];
8307 public function getPotentialRandomTestQuestions()
8316 questtypes.type_tag, 8317 origquest.obj_fi orig_obj_fi 8319 FROM qpl_questions questions 8321 INNER JOIN qpl_qst_type questtypes 8322 ON questtypes.question_type_id = questions.question_type_fi 8324 INNER JOIN tst_rnd_cpy tstquest 8325 ON tstquest.qst_fi = questions.question_id 8327 LEFT JOIN qpl_questions origquest 8328 ON origquest.question_id = questions.original_id 8330 WHERE tstquest.tst_fi = %s 8333 $query_result = $ilDB->queryF(
8341 while (
$row = $ilDB->fetchAssoc($query_result)) {
8344 $question[
'obligationPossible'] = self::isQuestionObligationPossible(
$row[
'question_id']);
8360 return ($this->shuffle_questions) ? 1 : 0;
8371 $this->shuffle_questions = ($a_shuffle) ? 1 : 0;
8388 return ($this->show_summary) ? $this->show_summary : 0;
8405 $this->show_summary = $a_value;
8416 if (($this->show_summary & 1) > 0) {
8432 $this->show_summary = 1;
8434 $this->show_summary = 0;
8446 if (($this->show_summary & 2) > 0) {
8462 $this->show_summary = $this->show_summary | 2;
8466 $this->show_summary = $this->show_summary ^ 2;
8479 if (($this->show_summary & 4) > 0) {
8495 $this->show_summary = $this->show_summary | 4;
8499 $this->show_summary = $this->show_summary ^ 4;
8512 if (($this->show_summary & 8) > 0) {
8528 $this->show_summary = $this->show_summary | 8;
8532 $this->show_summary = $this->show_summary ^ 8;
8545 return ($this->results_presentation) ? $this->results_presentation : 0;
8556 if (($this->results_presentation & 1) > 0) {
8571 if (($this->results_presentation & 2) > 0) {
8586 if (($this->results_presentation & 4) > 0) {
8601 if (($this->results_presentation & 8) > 0) {
8616 if (($this->results_presentation & 16) > 0) {
8631 if (($this->results_presentation & 32) > 0) {
8644 if (($this->results_presentation & 64) > 0) {
8657 if (($this->results_presentation & 128) > 0) {
8672 $this->results_presentation = $a_results_presentation;
8686 $this->results_presentation = $this->results_presentation | 1;
8689 $this->results_presentation = $this->results_presentation ^ 1;
8703 $this->results_presentation = $this->results_presentation | 2;
8706 $this->results_presentation = $this->results_presentation ^ 2;
8731 $this->results_presentation = $this->results_presentation | 4;
8734 $this->results_presentation = $this->results_presentation ^ 4;
8748 $this->results_presentation = $this->results_presentation | 8;
8751 $this->results_presentation = $this->results_presentation ^ 8;
8765 $this->results_presentation = $this->results_presentation | 16;
8768 $this->results_presentation = $this->results_presentation ^ 16;
8782 $this->results_presentation = $this->results_presentation | 32;
8785 $this->results_presentation = $this->results_presentation ^ 32;
8799 $this->results_presentation = $this->results_presentation | 64;
8802 $this->results_presentation = $this->results_presentation ^ 64;
8814 if ($a_comparison) {
8815 $this->results_presentation = $this->results_presentation | 128;
8818 $this->results_presentation = $this->results_presentation ^ 128;
8830 "SELECT user_fi FROM tst_active WHERE active_id = %s",
8836 return $row[
"user_fi"];
8860 return ($this->allowedUsers) ? $this->allowedUsers : 0;
8865 $this->allowedUsers = $a_allowed_users;
8870 return ($this->allowedUsersTimeGap) ? $this->allowedUsersTimeGap : 0;
8875 $this->allowedUsersTimeGap = $a_allowed_users_time_gap;
8884 if (($nr_of_users > 0) && ($time_gap > 0)) {
8886 $time_border = $now - $time_gap;
8887 $str_time_border = strftime(
"%Y%m%d%H%M%S", $time_border);
8889 SELECT DISTINCT tst_times.active_fi 8891 INNER JOIN tst_active 8892 ON tst_times.active_fi = tst_active.active_id 8894 tst_times.pass > tst_active.last_finished_pass OR tst_active.last_finished_pass IS NULL 8896 WHERE tst_times.tstamp > %s 8897 AND tst_active.test_fi = %s 8900 if (
$result->numRows() >= $nr_of_users) {
8901 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
8918 "SELECT finished FROM tst_times WHERE active_fi = %s ORDER BY finished DESC",
8924 return $row[
"finished"];
8934 SELECT MAX(tst_times.tstamp) as last_pass_access 8936 WHERE active_fi = %s 8940 $res = $DIC->database()->queryF(
8942 array(
'integer',
'integer'),
8943 array($activeId, $passIndex)
8946 while (
$row = $DIC->database()->fetchAssoc(
$res)) {
8947 return $row[
'last_pass_access'];
8962 if (preg_match(
"/<[^>]*?>/", $a_text)) {
8979 for (
$i = 0;
$i < $a_material->getMaterialCount();
$i++) {
8980 $material = $a_material->getMaterial(
$i);
8981 if (strcmp($material[
"type"],
"mattext") == 0) {
8982 $result .= $material[
"material"]->getContent();
8984 if (strcmp($material[
"type"],
"matimage") == 0) {
8985 $matimage = $material[
"material"];
8986 if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches)) {
8988 if (!is_array(
$_SESSION[
"import_mob_xhtml"])) {
8991 array_push(
$_SESSION[
"import_mob_xhtml"],
array(
"mob" => $matimage->getLabel(),
"uri" => $matimage->getUri()));
8996 $ilLog->write(print_r(
$_SESSION[
"import_mob_xhtml"],
true));
9010 include_once
"./Services/RTE/classes/class.ilRTE.php";
9011 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
9013 $a_xml_writer->xmlStartTag(
"material");
9015 "texttype" =>
"text/plain" 9017 if ($this->
isHTML($a_material)) {
9018 $attrs[
"texttype"] =
"text/xhtml";
9023 foreach (
$mobs as $mob) {
9024 $moblabel =
"il_" . IL_INST_ID .
"_mob_" . $mob;
9025 if (strpos($a_material,
"mm_$mob") !==
false) {
9029 "label" => $moblabel,
9030 "uri" =>
"objects/" .
"il_" . IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle()
9033 $a_xml_writer->xmlElement(
"matimage", $imgattrs, null);
9036 $a_xml_writer->xmlEndTag(
"material");
9047 include_once
"./Services/Utilities/classes/class.ilUtil.php";
9061 $affectedRows = $ilDB->manipulateF(
9062 "UPDATE tst_tests SET certificate_visibility = %s, tstamp = %s WHERE test_id = %s",
9063 array(
'text',
'integer',
'integer'),
9076 return (strlen($this->certificate_visibility)) ? $this->certificate_visibility : 0;
9087 $this->certificate_visibility = $a_value;
9098 return ($this->anonymity) ? 1 : 0;
9111 $this->anonymity = 1;
9114 $this->anonymity = 0;
9127 return ($this->show_cancel) ? 1 : 0;
9140 $this->show_cancel = 1;
9143 $this->show_cancel = 0;
9156 return ($this->show_marker) ? 1 : 0;
9169 $this->show_marker = 1;
9172 $this->show_marker = 0;
9185 return ($this->fixed_participants) ? 1 : 0;
9198 $this->fixed_participants = 1;
9201 $this->fixed_participants = 0;
9218 "SELECT anonymity FROM tst_tests WHERE obj_fi = %s",
9223 return $row[
'anonymity'];
9239 SELECT tst_tests.question_set_type 9241 INNER JOIN tst_tests 9242 ON tst_active.test_fi = tst_tests.test_id 9243 WHERE tst_active.active_id = %s 9248 while (
$row = $ilDB->fetchAssoc(
$res)) {
9249 return $row[
'question_set_type'];
9265 throw new Exception(__METHOD__ .
' is deprecated ... use ilObjTest::lookupQuestionSetTypeByActiveId() instead!');
9270 "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",
9275 return $row[
'random_test'];
9290 public function userLookupFullName($user_id, $overwrite_anonymity =
false, $sorted_order =
false, $suffix =
"")
9293 return $this->lng->txt(
"anonymous") . $suffix;
9295 include_once
'./Services/User/classes/class.ilObjUser.php';
9297 if (strlen($uname[
"firstname"] . $uname[
"lastname"]) == 0) {
9298 $uname[
"firstname"] = $this->lng->txt(
"deleted_user");
9300 if ($sorted_order) {
9301 return trim($uname[
"lastname"] .
", " . $uname[
"firstname"]) . $suffix;
9303 return trim($uname[
"firstname"] .
" " . $uname[
"lastname"]) . $suffix;
9318 return $this->lng->txt(
"tst_start_test");
9320 $active_pass = self::_getPass($active_id);
9323 if ($active_pass == 0) {
9324 return $this->lng->txt(
"tst_start_test");
9326 return $this->lng->txt(
"tst_start_new_test_pass");
9329 return $this->lng->txt(
"tst_resume_test");
9338 public function getAvailableDefaults()
9347 "SELECT * FROM tst_test_defaults WHERE user_fi = %s ORDER BY name ASC",
9349 array($ilUser->getId())
9351 $defaults =
array();
9353 $defaults[
$row[
"test_defaults_id"]] =
$row;
9367 return self::_getTestDefaults($test_defaults_id);
9375 "SELECT * FROM tst_test_defaults WHERE test_defaults_id = %s",
9377 array($test_defaults_id)
9379 if (
$result->numRows() == 1) {
9396 $affectedRows = $ilDB->manipulateF(
9397 "DELETE FROM tst_test_defaults WHERE test_defaults_id = %s",
9399 array($test_default_id)
9413 $testsettings =
array(
9506 $next_id = $ilDB->nextId(
'tst_test_defaults');
9508 'tst_test_defaults',
9510 'test_defaults_id' =>
array(
'integer', $next_id),
9511 'name' =>
array(
'text', $a_name),
9512 'user_fi' =>
array(
'integer', $ilUser->getId()),
9513 'defaults' =>
array(
'clob', serialize($testsettings)),
9514 'marks' =>
array(
'clob', serialize($this->mark_schema)),
9529 $testsettings = unserialize($test_defaults[
"defaults"]);
9530 include_once
"./Modules/Test/classes/class.assMarkSchema.php";
9531 $this->mark_schema = unserialize($test_defaults[
"marks"]);
9565 $this->
setKiosk($testsettings[
"Kiosk"]);
9569 $this->
setECTSFX($testsettings[
"ECTSFX"]);
9571 if (isset($testsettings[
"isRandomTest"])) {
9572 if ($testsettings[
"isRandomTest"]) {
9577 } elseif (isset($testsettings[
"questionSetType"])) {
9599 if (isset($testsettings[
'examid_in_kiosk'])) {
9604 if (isset($testsettings[
'show_exam_id'])) {
9657 if (extension_loaded(
"tidy")) {
9660 "output-xml" =>
true,
9661 "numeric-entities" =>
true 9664 $tidy->parseString($print_output,
$config,
'utf8');
9665 $tidy->cleanRepair();
9666 $print_output = tidy_get_output($tidy);
9667 $print_output = preg_replace(
"/^.*?(<html)/",
"\\1", $print_output);
9669 $print_output = str_replace(
" ",
" ", $print_output);
9670 $print_output = str_replace(
"⊗",
"X", $print_output);
9672 $xsl = file_get_contents(
"./Modules/Test/xml/question2fo.xsl");
9676 'font-family="Helvetica, unifont"',
9677 'font-family="' .
$GLOBALS[
'ilSetting']->
get(
'rpc_pdf_font',
'Helvetica, unifont') .
'"',
9681 $args =
array(
'/_xml' => $print_output,
'/_xsl' => $xsl );
9684 $output = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl", null, $args,
$params);
9698 $content = preg_replace(
"/href=\".*?\"/",
"", $content);
9699 $printbody =
new ilTemplate(
"tpl.il_as_tst_print_body.html",
true,
true,
"Modules/Test");
9701 $printbody->setVariable(
"ADM_CONTENT", $content);
9702 $printbody->setCurrentBlock(
"css_file");
9704 $printbody->parseCurrentBlock();
9705 $printbody->setCurrentBlock(
"css_file");
9707 $printbody->parseCurrentBlock();
9708 $printoutput = $printbody->get();
9709 $html = str_replace(
"href=\"./",
"href=\"" . ILIAS_HTTP_PATH .
"/", $printoutput);
9710 $html = preg_replace(
"/<div id=\"dontprint\">.*?<\\/div>/ims",
"",
$html);
9711 if (extension_loaded(
"tidy")) {
9714 "output-xml" =>
true,
9715 "numeric-entities" =>
true 9719 $tidy->cleanRepair();
9720 $html = tidy_get_output($tidy);
9721 $html = preg_replace(
"/^.*?(<html)/",
"\\1",
$html);
9723 $html = str_replace(
" ",
" ",
$html);
9726 $html = preg_replace(
"/src=\".\\//ims",
"src=\"" . ILIAS_HTTP_PATH .
"/",
$html);
9740 include_once
"./Services/Utilities/classes/class.ilUtil.php";
9742 $fp = fopen($fo_file,
"w");
9746 include_once
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
9753 $ilLog->write(__METHOD__ .
': ' . $e->getMessage());
9772 "SELECT feedback FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
9773 array(
'integer',
'integer',
'integer'),
9778 include_once(
"./Services/RTE/classes/class.ilRTE.php");
9794 public function saveManualFeedback($active_id, $question_id,
$pass, $feedback)
9798 $affectedRows = $ilDB->manipulateF(
9799 "DELETE FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
9800 array(
'integer',
'integer',
'integer'),
9804 if (strlen($feedback)) {
9805 $next_id = $ilDB->nextId(
'tst_manual_fb');
9810 'manual_feedback_id' =>
array(
'integer', $next_id ),
9811 'active_fi' =>
array(
'integer', $active_id ),
9812 'question_fi' =>
array(
'integer', $question_id ),
9818 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
9821 include_once
"./Modules/Test/classes/class.ilObjTestAccess.php";
9823 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
9850 include_once
"./Modules/Test/classes/class.ilTestSequence.php";
9861 $this->test_id = $a_id;
9875 if (count($participants)) {
9876 foreach ($participants as $active_id => $user_rec) {
9878 $reached_points = 0;
9880 foreach ($this->questions as $value) {
9882 if (is_object($question)) {
9883 $max_points += $question->getMaximumPoints();
9884 $reached_points += $question->getReachedPoints($active_id);
9885 if ($max_points > 0) {
9886 $percentvalue = $reached_points / $max_points;
9887 if ($percentvalue < 0) {
9888 $percentvalue = 0.0;
9894 $user_rec[
'firstname'] =
"";
9895 $user_rec[
'lastname'] = $this->lng->txt(
"anonymous");
9898 "user_id"=>$user_rec[
'usr_id'],
9899 "matriculation" => $user_rec[
'matriculation'],
9900 "lastname" => $user_rec[
'lastname'],
9901 "firstname" => $user_rec[
'firstname'],
9902 "login"=>$user_rec[
'login'],
9903 "question_id" => $question->getId(),
9904 "question_title" => $question->getTitle(),
9905 "reached_points" => $reached_points,
9906 "max_points" => $max_points
9924 "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",
9928 $rec = $ilDB->fetchAssoc(
$result);
9929 return $rec[
"obj_id"];
9940 global $ilPluginAdmin;
9941 if ($ilPluginAdmin->isActive(
IL_COMP_MODULE,
"TestQuestionPool",
"qst", $a_pname)) {
9953 "SELECT passed FROM tst_result_cache WHERE active_fi = %s",
9959 return $row[
'passed'];
9962 $result_array =&$this->
getTestResult($active_id, $counted_pass);
9963 return $result_array[
"test"][
"passed"];
9975 include_once
"./Services/Certificate/classes/class.ilCertificate.php";
9976 include_once
"./Modules/Test/classes/class.ilTestCertificateAdapter.php";
9978 if ($cert->isComplete()) {
10010 public function getParticipantsForTestAndQuestion(
$test_id, $question_id)
10016 SELECT tst_test_result.active_fi, tst_test_result.question_fi, tst_test_result.pass 10017 FROM tst_test_result 10018 INNER JOIN tst_active ON tst_active.active_id = tst_test_result.active_fi AND tst_active.test_fi = %s 10019 INNER JOIN qpl_questions ON qpl_questions.question_id = tst_test_result.question_fi 10020 LEFT JOIN usr_data ON usr_data.usr_id = tst_active.user_fi 10021 WHERE tst_test_result.question_fi = %s 10022 ORDER BY usr_data.lastname ASC, usr_data.firstname ASC 10027 array(
'integer',
'integer'),
10030 $foundusers =
array();
10033 if (!array_key_exists(
$row[
"active_fi"], $foundusers)) {
10034 $foundusers[
$row[
"active_fi"]] =
array();
10036 array_push($foundusers[
$row[
"active_fi"]],
array(
"pass" => $row[
"pass"],
"qid" => $row[
"question_fi"]));
10038 return $foundusers;
10049 $foundParticipants =&
$data->getParticipants();
10051 if (count($foundParticipants)) {
10052 $results[
"overview"][$this->lng->txt(
"tst_eval_total_persons")] = count($foundParticipants);
10054 $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished")] = $total_finished;
10056 $diff_seconds = $average_time;
10057 $diff_hours = floor($diff_seconds/3600);
10058 $diff_seconds -= $diff_hours * 3600;
10059 $diff_minutes = floor($diff_seconds/60);
10060 $diff_seconds -= $diff_minutes * 60;
10061 $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
10063 $total_passed_reached = 0;
10064 $total_passed_max = 0;
10065 $total_passed_time = 0;
10066 foreach ($foundParticipants as
$userdata) {
10067 if ($userdata->getPassed()) {
10069 $total_passed_reached += $userdata->getReached();
10070 $total_passed_max += $userdata->getMaxpoints();
10071 $total_passed_time += $userdata->getTimeOfWork();
10074 $average_passed_reached = $total_passed ? $total_passed_reached / $total_passed : 0;
10075 $average_passed_max = $total_passed ? $total_passed_max / $total_passed : 0;
10076 $average_passed_time = $total_passed ? $total_passed_time / $total_passed : 0;
10077 $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed")] = $total_passed;
10078 $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);
10079 $average_time = $average_passed_time;
10080 $diff_seconds = $average_time;
10081 $diff_hours = floor($diff_seconds/3600);
10082 $diff_seconds -= $diff_hours * 3600;
10083 $diff_minutes = floor($diff_seconds/60);
10084 $diff_seconds -= $diff_minutes * 60;
10085 $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
10088 foreach (
$data->getQuestionTitles() as $question_id => $question_title) {
10092 foreach ($foundParticipants as
$userdata) {
10093 for (
$i = 0;
$i <= $userdata->getLastPass();
$i++) {
10094 if (is_object($userdata->getPass(
$i))) {
10095 $question =&$userdata->getPass(
$i)->getAnsweredQuestionByQuestionId($question_id);
10096 if (is_array($question)) {
10098 $reached += $question[
"reached"];
10099 $max += $question[
"points"];
10104 $percent = $max ? $reached/$max * 100.0 : 0;
10108 sprintf(
"%.2f", $answered ? $reached / $answered : 0) .
" " . strtolower($this->lng->txt(
"of")) .
" " . sprintf(
"%.2f", $answered ? $max / $answered : 0),
10109 sprintf(
"%.2f", $percent) .
"%",
10111 sprintf(
"%.2f", $answered ? $reached / $answered : 0),
10112 sprintf(
"%.2f", $answered ? $max / $answered : 0),
10124 require_once
'Modules/Test/classes/class.ilTestExportFactory.php';
10126 $test_exp = $expFactory->getExporter(
'xml');
10127 return $test_exp->buildExportFile();
10145 $this->mailnotification = $a_notification;
10150 include_once
"./Modules/Test/classes/class.ilTestMailNotification.php";
10155 $mail->sendSimpleNotification($owner_id, $this->
getTitle(), $usr_data);
10165 include_once
"./Modules/Test/classes/class.ilObjTestGUI.php";
10166 include_once
"./Modules/Test/classes/tables/class.ilEvaluationAllTableGUI.php";
10168 return $table_gui->getSelectedColumns();
10173 include_once
"./Modules/Test/classes/class.ilTestMailNotification.php";
10179 require_once
'Modules/Test/classes/class.ilTestExportFactory.php';
10181 $exportObj = $expFactory->getExporter(
'results');
10182 $file = $exportObj->exportToExcel($deliver =
false,
'active_id', $active_id, $passedonly =
false);
10183 include_once
"./Services/Mail/classes/class.ilFileDataMail.php";
10185 $fd->copyAttachmentFile(
$file,
"result_" . $active_id .
".xls");
10186 $file_names[] =
"result_" . $active_id .
".xls";
10188 $mail->sendAdvancedNotification($owner_id, $this->
getTitle(), $usr_data, $file_names);
10190 if (count($file_names)) {
10191 $fd->unlinkFiles($file_names);
10202 $query =
"SELECT usr_id FROM usr_data";
10205 $activequery = sprintf(
10206 "SELECT user_fi FROM tst_active WHERE test_fi = %s AND user_fi = %s",
10207 $ilDB->quote($this->getTestId()),
10208 $ilDB->quote(
$data[
'usr_id'])
10210 $activeresult = $ilDB->query($activequery);
10211 if ($activeresult->numRows() == 0) {
10212 $user_id =
$data[
'usr_id'];
10213 if ($user_id != 13) {
10214 include_once
"./Modules/Test/classes/class.ilTestSession.php";
10221 $random = new \ilRandom();
10222 $nr_of_passes = $random->int(1, $passes);
10225 include_once
"./Modules/Test/classes/class.ilTestSequence.php";
10233 for ($seq = 1; $seq <= count($this->questions); $seq++) {
10234 $question_id =
$testSequence->getQuestionForSequence($seq);
10236 $assSettings =
new ilSetting(
'assessment');
10237 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
10239 $processLockerFactory->setQuestionId($objQuestion->getId());
10240 $processLockerFactory->setUserId(
$testSession->getUserId());
10241 include_once(
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
10243 $objQuestion->setProcessLocker($processLockerFactory->getLocker());
10254 if ($number == 0) {
10268 FROM tst_result_cache 10269 WHERE active_fi = %s 10279 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
10285 FROM tst_result_cache 10286 WHERE active_fi = %s 10303 if ($this->mailnottype == 1) {
10313 $this->mailnottype = 1;
10315 $this->mailnottype = 0;
10321 if ($this->exportsettings) {
10331 $this->exportsettings = $a_settings;
10333 $this->exportsettings = 0;
10339 if (($this->exportsettings & 1) > 0) {
10349 $this->exportsettings = $this->exportsettings | 1;
10352 $this->exportsettings = $this->exportsettings ^ 1;
10359 return $this->enabled_view_mode;
10364 $this->enabled_view_mode = $mode;
10379 $new_array =
array();
10382 $query =
'SELECT question_fi FROM tst_test_question WHERE test_fi = %s';
10383 $types =
array(
'integer');
10386 $new_question_id += 1;
10390 $res = $ilDB->queryF(
$query, $types, $values);
10391 while (
$row = $ilDB->fetchAssoc(
$res)) {
10392 $qid =
$row[
'question_fi'];
10394 if ($qid == $new_question_id) {
10396 } elseif ($qid == $previous_question_id) {
10397 $new_array[$position++] = $qid;
10398 $new_array[$position++] = $new_question_id;
10401 $new_array[$position++] = $qid;
10405 $update_query =
'UPDATE tst_test_question SET sequence = %s WHERE test_fi = %s AND question_fi = %s';
10406 $update_types =
array(
'integer',
'integer',
'integer');
10408 foreach ($new_array as $position => $qid) {
10409 $ilDB->manipulateF(
10439 'pass_details' =>
'setShowPassDetails',
10440 'solution_details' =>
'setShowSolutionDetails',
10441 'solution_printview' =>
'setShowSolutionPrintview',
10442 'solution_feedback' =>
'setShowSolutionFeedback',
10443 'solution_answers_only' =>
'setShowSolutionAnswersOnly',
10444 'solution_signature' =>
'setShowSolutionSignature',
10445 'solution_suggested' =>
'setShowSolutionSuggested',
10447 foreach ($setter as
$key => $setter) {
10463 $this->poolUsage = (boolean) $usage;
10472 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
10474 $questionSetConfig = $qscFactory->getQuestionSetConfig();
10477 $questionSetConfig->reindexQuestionOrdering();
10490 foreach ($orders as
$id => $position) {
10494 isset($obligations[
$id]) && $obligations[
$id] ? 1 : 0
10498 UPDATE tst_test_question 10501 WHERE question_fi = %s 10504 $ilDB->manipulateF(
10506 array(
'integer',
'integer',
'integer'),
10518 if ($question_before) {
10519 $query =
'SELECT sequence, test_fi FROM tst_test_question WHERE question_fi = %s';
10520 $types =
array(
'integer');
10521 $values =
array($question_before);
10522 $rset = $ilDB->queryF(
$query, $types, $values);
10525 if (!$question_before || ($rset && !(
$row = $ilDB->fetchAssoc($rset)))) {
10532 $update =
'UPDATE tst_test_question SET sequence = sequence + 1 WHERE sequence > %s AND test_fi = %s';
10533 $types =
array(
'integer',
'integer');
10535 $ilDB->manipulateF($update, $types, $values);
10537 $update =
'UPDATE tst_test_question SET sequence = %s WHERE question_fi = %s';
10538 $types =
array(
'integer',
'integer');
10539 $values =
array(
$row[
'sequence'] + 1, $question_to_move);
10540 $ilDB->manipulateF($update, $types, $values);
10551 $IN_questions = $ilDB->in(
'q1.question_id', array_keys(
$questions),
false,
'integer');
10554 SELECT count(q1.question_id) cnt 10556 FROM qpl_questions q1 10558 INNER JOIN qpl_questions q2 10559 ON q2.question_id = q1.original_id 10561 WHERE $IN_questions 10562 AND q1.obj_fi = q2.obj_fi 10565 $rset = $ilDB->query(
$query);
10567 $row = $ilDB->fetchAssoc($rset);
10569 return $row[
'cnt'] > 0;
10583 "SELECT test_fi,MAX(pass) AS pass FROM tst_active" .
10584 " JOIN tst_pass_result ON (tst_pass_result.active_fi = tst_active.active_id)" .
10585 " WHERE user_fi=%s" .
10586 " GROUP BY test_fi",
10587 array(
'integer',
'integer'),
10588 array($a_user_id, 1)
10592 $obj_id = self::_getObjectIDFromTestID(
$row[
"test_fi"]);
10593 $all[$obj_id] = (bool)
$row[
"pass"];
10609 $this->online = (bool) $a_online;
10630 $this->print_best_solution_with_result = (bool) $status;
10660 $this->activation_visibility = (bool) $a_value;
10670 return (
bool) $this->activation_limited;
10675 $this->activation_limited = (bool) $a_value;
10687 $this->_highscore_enabled = (bool) $a_enabled;
10697 return (
bool) $this->_highscore_enabled;
10709 $this->_highscore_anon = (bool) $a_anon;
10723 return (
bool) $this->_highscore_anon;
10750 $this->_highscore_achieved_ts = (bool) $a_achieved_ts;
10760 return (
bool) $this->_highscore_achieved_ts;
10770 $this->_highscore_score = (bool) $a_score;
10780 return (
bool) $this->_highscore_score;
10790 $this->_highscore_percentage = (bool) $a_percentage;
10800 return (
bool) $this->_highscore_percentage;
10810 $this->_highscore_hints = (bool) $a_hints;
10820 return (
bool) $this->_highscore_hints;
10830 $this->_highscore_wtime = (bool) $a_wtime;
10840 return (
bool) $this->_highscore_wtime;
10850 $this->_highscore_own_table = (bool) $a_own_table;
10860 return (
bool) $this->_highscore_own_table;
10870 $this->_highscore_top_table = (bool) $a_top_table;
10880 return (
bool) $this->_highscore_top_table;
10891 $this->_highscore_top_num = (int) $a_top_num;
10904 $retval = $a_retval;
10905 if ((
int) $this->_highscore_top_num != 0) {
10906 $retval = $this->_highscore_top_num;
10919 return self::HIGHSCORE_SHOW_ALL_TABLES;
10923 return self::HIGHSCORE_SHOW_TOP_TABLE;
10928 return self::HIGHSCORE_SHOW_OWN_TABLE;
10939 case self::HIGHSCORE_SHOW_ALL_TABLES:
10944 case self::HIGHSCORE_SHOW_TOP_TABLE:
10949 case self::HIGHSCORE_SHOW_OWN_TABLE:
10960 switch ($specific_answer_feedback) {
10962 $this->specific_answer_feedback = 1;
10965 $this->specific_answer_feedback = 0;
10972 switch ($this->specific_answer_feedback) {
11008 require_once(
'Modules/TestQuestionPool/classes/class.assQuestion.php');
11016 $obligationPossible = call_user_func(
array($classConcreteQuestion,
'isObligationPossible'), $questionId);
11018 return $obligationPossible;
11031 $rset = $ilDB->queryF(
'SELECT obligatory FROM tst_test_question WHERE question_fi = %s',
array(
'integer'),
array($question_id));
11033 if (
$row = $ilDB->fetchAssoc($rset)) {
11034 return (
bool)
$row[
'obligatory'];
11056 $rset = $ilDB->queryF(
11057 'SELECT obligations_answered FROM tst_pass_result WHERE active_fi = %s AND pass = %s',
11058 array(
'integer',
'integer'),
11062 if (
$row = $ilDB->fetchAssoc($rset)) {
11063 return (
bool)
$row[
'obligations_answered'];
11066 return !self::hasObligations(
$test_id);
11081 $rset = $ilDB->queryF(
11082 'SELECT count(*) cnt FROM tst_test_question WHERE test_fi = %s AND obligatory = 1',
11087 $row = $ilDB->fetchAssoc($rset);
11089 return (
bool)
$row[
'cnt'] > 0;
11132 #region Examview / PDF Examview 11195 return (strlen($this->activation_starting_time)) ? $this->activation_starting_time : null;
11200 return (strlen($this->activation_ending_time)) ? $this->activation_ending_time : null;
11208 $result = $ilDB->queryF(
"SELECT tst_times.active_fi, tst_times.started FROM tst_times, tst_active WHERE tst_times.active_fi = tst_active.active_id AND tst_active.test_fi = %s ORDER BY tst_times.tstamp DESC",
11213 $times[
$row[
'active_fi']] = $row[
'started'];
11224 "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",
11229 $times[
$row[
'active_fi']] = $row[
'additionaltime'];
11239 "SELECT additionaltime FROM tst_addtime WHERE active_fi = %s",
11243 if (
$result->numRows() > 0) {
11245 return $row[
'additionaltime'];
11254 $participants =
array();
11255 if ($active_id == 0) {
11257 "SELECT active_id FROM tst_active WHERE test_fi = %s",
11262 array_push($participants,
$row[
'active_id']);
11265 array_push($participants, $active_id);
11267 foreach ($participants as $active_id) {
11269 "SELECT active_fi FROM tst_addtime WHERE active_fi = %s",
11273 if (
$result->numRows() > 0) {
11274 $ilDB->manipulateF(
11275 "DELETE FROM tst_addtime WHERE active_fi = %s",
11281 $ilDB->manipulateF(
11282 "UPDATE tst_active SET tries = %s, submitted = %s, submittimestamp = %s WHERE active_id = %s",
11283 array(
'integer',
'integer',
'timestamp',
'integer'),
11284 array(0, 0, null, $active_id)
11287 $ilDB->manipulateF(
11288 "INSERT INTO tst_addtime (active_fi, additionaltime, tstamp) VALUES (%s, %s, %s)",
11289 array(
'integer',
'integer',
'integer'),
11293 require_once
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
11319 public function getMaxPassOfTest()
11327 SELECT MAX(tst_pass_result.pass) + 1 max_res 11328 FROM tst_pass_result 11329 INNER JOIN tst_active ON tst_active.active_id = tst_pass_result.active_fi 11330 WHERE test_fi = ' . $ilDB->quote($this->
getTestId(),
'integer') .
' 11334 return (
int)
$data[
'max_res'];
11346 $exam_id_query =
'SELECT exam_id FROM tst_pass_result WHERE active_fi = %s AND pass = %s';
11347 $exam_id_result = $ilDB->queryF($exam_id_query,
array(
'integer',
'integer' ),
array( $active_id,
$pass ));
11348 if ($ilDB->numRows($exam_id_result) == 1) {
11349 $exam_id_row = $ilDB->fetchAssoc($exam_id_result);
11351 if ($exam_id_row[
'exam_id'] != null) {
11352 return $exam_id_row[
'exam_id'];
11369 $inst_id = $ilSetting->get(
'inst_id', null);
11371 if ($test_obj_id === null) {
11372 $obj_id = self::_getObjectIDFromActiveID($active_id);
11374 $obj_id = $test_obj_id;
11377 $examId =
'I' . $inst_id .
'_T' . $obj_id .
'_A' . $active_id .
'_P' .
$pass;
11429 $this->char_selector_availability = (int) $availability;
11445 $this->char_selector_definition = $definition;
11488 $query =
"SELECT question_set_type FROM tst_tests WHERE obj_fi = %s";
11494 while (
$row = $ilDB->fetchAssoc(
$res)) {
11540 return self::lookupQuestionSetType($a_obj_id) == self::QUESTION_SET_TYPE_RANDOM;
11547 return $lng->
txt(
'tst_question_set_type_fixed');
11550 return $lng->
txt(
'tst_question_set_type_random');
11553 return $lng->
txt(
'tst_question_set_type_dynamic');
11583 require_once
'class.ilTestScoring.php';
11585 $scoring->setPreserveManualScores($preserve_manscoring);
11586 $scoring->recalculateSolutions();
11591 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
11593 $questionChangeListeners =
array(
11597 return $questionChangeListeners;
11607 INNER JOIN tst_tests 11608 ON test_id = test_fi 11616 while (
$row = $ilDB->fetchAssoc(
$res)) {
11617 $objIds[] = (int)
$row[
'obj_fi'];
11649 if (!self::isSkillManagementGloballyActivated()) {
11660 if (self::$isSkillManagementGloballyActivated === null) {
11661 include_once
'Services/Skill/classes/class.ilSkillManagementSettings.php';
11664 self::$isSkillManagementGloballyActivated = $skmgSet->isActivated();
11667 return self::$isSkillManagementGloballyActivated;
11725 $activeId = $testOBJ->getActiveIdOfUser($userId);
11727 require_once
'Modules/Test/classes/class.ilTestSessionFactory.php';
11730 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
11733 $testSession = $testSessionFactory->getSession($activeId);
11738 if ($a_force_new_run) {
11757 $activeId = $testOBJ->getActiveIdOfUser($userId);
11759 require_once
'Modules/Test/classes/class.ilTestSessionFactory.php';
11762 $testSessionFactory->reset();
11764 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
11767 $testSession = $testSessionFactory->getSession($activeId);
11790 public function adjustTestSequence()
11798 SELECT COUNT(test_question_id) cnt 11799 FROM tst_test_question 11806 $row = $ilDB->fetchAssoc($questRes);
11807 $questCount =
$row[
'cnt'];
11812 FROM tst_active tac 11813 INNER JOIN tst_sequence tseq 11814 ON tseq.active_fi = tac.active_id 11815 WHERE tac.test_fi = %s 11818 $partRes = $ilDB->queryF(
11824 while (
$row = $ilDB->fetchAssoc($partRes)) {
11825 $sequence = @unserialize(
$row[
'sequence']);
11828 $sequence =
array();
11831 $sequence = array_filter($sequence,
function ($value) use ($questCount) {
11832 return $value <= $questCount;
11835 $num_seq = count($sequence);
11836 if ($questCount > $num_seq) {
11837 $diff = $questCount - $num_seq;
11838 for (
$i = 1;
$i <= $diff;
$i++) {
11839 $sequence[$num_seq +
$i - 1] = $num_seq +
$i;
11843 $new_sequence = serialize($sequence);
11845 $ilDB->update(
'tst_sequence',
array(
11846 'sequence' =>
array(
'clob', $new_sequence)
11848 'active_fi' =>
array(
'integer',
$row[
'active_fi']),
11849 'pass' =>
array(
'integer',
$row[
'pass'])
11853 $new_sequence = serialize($questCount > 0 ?
range(1, $questCount) :
array());
11857 FROM tst_active tac 11858 INNER JOIN tst_sequence tseq 11859 ON tseq.active_fi = tac.active_id 11860 WHERE tac.test_fi = %s 11863 $part_rest = $ilDB->queryF(
11869 while (
$row = $ilDB->fetchAssoc($part_rest)) {
11870 $ilDB->update(
'tst_sequence',
array(
11871 'sequence' =>
array(
'clob', $new_sequence)
11873 'active_fi' =>
array(
'integer',
$row[
'active_fi']),
11874 'pass' =>
array(
'integer',
$row[
'pass'])
setAllowedUsers($a_allowed_users)
static _getUserIdFromActiveId($active_id)
isShowGradingMarkEnabled()
setAnswerFeedback($answer_feedback=0)
Sets the generic feedback for the test Use setGenericAnswerFeedback instead.
saveCertificateVisibility($a_value)
Saves the visibility settings of the certificate.
static _lookupName($a_user_id)
lookup user name
getExportDirectory()
Get the location of the export directory for the test.
& getWorkedQuestions($active_id, $pass=null)
Gets the id's of all questions a user already worked through.
setHighscoreTopTable($a_top_table)
Sets if the top-rankings table should be shown.
setPassScoring($a_pass_scoring=SCORE_LAST_PASS)
Sets the pass scoring.
static getPluginObject($a_ctype, $a_cname, $a_slot_id, $a_pname)
Get plugin object.
setSkillServiceEnabled($skillServiceEnabled)
getListOfQuestionsDescription()
Returns TRUE if the list of questions should be presented with the question descriptions.
setOldOnlineStatus($oldOnlineStatus)
getScoreReporting()
Gets the score reporting of the ilObjTest object.
getCharSelectorDefinition()
getTimeExtensionsOfParticipants()
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
isHTML($a_text)
Checks if a given string contains HTML or not.
const SCORE_REPORTING_DISABLED
inviteRole($role_id)
Invites all users of a role to a test.
static _getWorkingTimeOfParticipantForPass($active_id, $pass)
Returns the complete working time in seconds for a test participant.
static _getAvailableQuestionpools($use_object_id=false, $equal_points=false, $could_be_offline=false, $showPath=false, $with_questioncount=false, $permission="read", $usr_id="")
Returns the available question pools for the active user.
setMailNotification($a_notification)
Set mail notification settings.
isDynamicTest()
Returns the fact wether this test is a dynamic question set test or not.
static deliverData($a_data, $a_filename, $mime="application/octet-stream", $charset="")
deliver data for download via browser.
setEnableExamview($enable_examview)
isTestFinished($active_id)
returns if the active for user_id has been submitted
static getPoolQuestionChangeListeners(ilDBInterface $db, $poolObjId)
setPassword($a_password=null)
Sets the password for test access.
& processCSVRow($row, $quoteAll=false, $separator=";")
Processes an array as a CSV row and converts the array values to correct CSV values.
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
static _getOriginalId($question_id)
Returns the original id of a question.
createMetaData()
Create meta data entry.
getActivationVisibility()
getHighscoreOwnTable()
Gets if the own rankings table should be shown.
setPassDeletionAllowed($passDeletionAllowed)
setter for the test setting passDeletionAllowed
getECTSOutput()
{int|bool}
_getTitleOutput($active_id)
Returns the value of the title_output status.
setOnline($a_online=true)
getFixedParticipants()
Returns the fixed participants status.
static _getObjectIDFromTestID($test_id)
Returns the ILIAS test object id for a given test id.
setShowExamIdInTestPassEnabled($show_exam_id_in_test_pass_enabled)
setForceInstantFeedbackEnabled($forceInstantFeedbackEnabled)
deliverPDFfromFO($fo, $title=null)
Delivers a PDF file from a XSL-FO string.
getReportingDate()
Gets the reporting date of the ilObjTest object.
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
static _updateTestResultCache($active_id, ilAssQuestionProcessLocker $processLocker=null)
Move this to a proper place.
getCustomStyle()
Get the custom style.
getResultsPresentation()
Returns the combined results presentation value.
const DEFAULT_PROCESSING_TIME_MINUTES
static allObligationsAnswered($test_id, $active_id, $pass)
checks wether all questions marked as obligatory were answered within the test pass with given testId...
setShowKioskModeTitle($a_title=false)
Set to true, if the full test title should be shown in kiosk mode.
logAction($logtext="", $question_id="")
Logs an action into the Test&Assessment log.
getProcessingTimeAsMinutes()
static _getPass($active_id)
Retrieves the actual pass of a given user for a given test.
isPassDeletionAllowed()
getter for the test setting passDeletionAllowed
static _getParticipantData($active_id)
Retrieves a participant name from active id.
_buildName($is_anonymous, $user_id, $firstname, $lastname, $title)
Builds a user name for the output depending on test type and existence of the user.
removeTestResultsByUserIds($userIds)
setShowExamviewPdf($show_examview_pdf)
setShowPassDetails($a_details=1)
Sets if the pass details should be shown when a test is not finished.
& createQuestionGUI($question_type, $question_id=-1)
Creates a question GUI instance of a given question type.
isShowExamIdInTestPassEnabled()
setQuestionOrderAndObligations($orders, $obligations)
setRedirectionMode($redirection_mode=0)
processPrintoutput2FO($print_output)
Convert a print output to XSL-FO.
setQuestionSetType($questionSetType)
setter for question set type
setECTSOutput($a_ects_output)
{}
setActivationEndingTime($ending_time=null)
getTestStyleLocation($mode="output")
get full style sheet file name (path inclusive) of current user
static _prepareCloneSelection($a_ref_ids, $new_type, $show_path=true)
Prepare copy wizard object selection.
static _getQuestionType($question_id)
Returns the question type of a question with a given id.
checkQuestionParent($questionId)
static _getSolutionMaxPass($question_id, $active_id)
Returns the maximum pass a users question solution.
static _lookupTestObjIdForQuestionId($a_q_id)
Get test Object ID for question ID.
saveCompleteStatus(ilTestQuestionSetConfig $testQuestionSetConfig)
Checks if the test is complete and saves the status in the database.
$online
the object's online status
setReportingDate($reporting_date)
Sets the reporting date of the ilObjTest object.
getQuestionTitle($title, $nr=null)
Returns the title of a test question and checks if the title output is allowed.
setShowSolutionDetails($a_details=1)
Sets if the the solution details should be presented to the user or not.
canShowCertificate($testSession, $user_id, $active_id)
Checks whether the certificate button could be shown on the info page or not.
getMailNotification()
Get mail notification settings.
& evalStatistical($active_id)
Returns the statistical evaluation of the test for a specified user.
& getInvitedUsers($user_id="", $order="login, lastname, firstname")
Returns a list of all invited users in a test.
setCertificateVisibility($a_value)
Sets the visibility settings of the certificate.
getEnableProcessingTime()
Returns the state of the processing time (enabled/disabled)
getProcessingTimeAsArray()
Returns the processing time for the test.
const QUESTION_SET_TYPE_RANDOM
type setting value for random question set
getListOfQuestionsStart()
Returns if the list of questions should be presented as the first page of the test.
static _lookupRandomTest($a_obj_id)
Returns the fact wether the test with passed obj id is a random questions test or not...
& getParticipants()
Returns all persons who started the test.
Skill management settings.
getCompleteWorkingTimeOfParticipant($active_id)
Returns the complete working time in seconds for a test participant.
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
This class handles all operations on files (attachments) in directory ilias_data/mail.
loadFromDb()
loads the question set config for current test from the database
setResultFilterTaxIds($resultFilterTaxIds)
getCertificateVisibility()
Returns the visibility settings of the certificate.
loadFromDb()
Loads a ilObjTest object from a database.
setShuffleQuestions($a_shuffle)
Sets the status of the shuffle_questions variable.
setFixedParticipants($a_value=1)
Sets the fixed participants status.
fromXML(ilQTIAssessment $assessment)
Receives parameters from a QTI parser and creates a valid ILIAS test object.
getPresentationMaterial()
{ilQTIPresentationMaterial|null}
getShowSolutionFeedback()
Returns if the feedback should be presented to the solution or not.
setTmpCopyWizardCopyId($tmpCopyWizardCopyId)
updateMetaData()
update meta data entry
static _getPassScoring($active_id)
Gets the pass scoring type.
static lookupPassResultsUpdateTimestamp($active_id, $pass)
& getExistingQuestions($pass=null)
Get the id's of the questions which are already part of the test.
setCharSelectorDefinition($definition='')
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...
getShowKioskModeParticipant()
Returns the status of the kiosk mode participant.
static $isSkillManagementGloballyActivated
setHighscoreScore($a_score)
Sets if the actual score should be displayed.
static factory($a_package, $a_timeout=0)
Creates an ilRpcClient instance to our ilServer.
insertQuestion(ilTestQuestionSetConfig $testQuestionSetConfig, $question_id, $linkOnly=false)
Insert a question in the list of questions.
getQuestionSetTypeTranslation(ilLanguage $lng, $questionSetType)
getHighscoreAchievedTS()
Returns if date and time of the scores achievement should be displayed.
getTestId()
Gets the database id of the additional test data.
setHighscoreWTime($a_wtime)
Sets if the workingtime of the scores should be shown.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
& evalTotalPersonsArray($name_sort_order="asc")
Returns all persons who started the test.
_isComplete($obj_id)
Returns true, if a test is complete for use.
Class ilTestMailNotification.
static getItem($a_ref_id)
Get item data.
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, instead it parses the serialized rbac_pa entries.
getListOfQuestionsSettings()
Returns the settings for the list of questions options in the test properties This could contain one ...
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
getShowInfo()
Gets whether the complete information page is shown or the required data only.
& getQuestionTitlesAndIndexes()
Returns the titles of the test questions in question sequence.
getMailNotificationType()
isNewRandomTest()
Checks wheather the test is a new random test (using tst_rnd_cpy) or an old one.
getJavaScriptOutput()
Returns if Javascript should be chosen for drag & drop actions for the active user.
setPassWaiting($pass_waiting)
const TIMINGS_DEACTIVATED
getECTSGrade($passed_array, $reached_points, $max_points)
{Returns the ECTS grade for a number of reached points.An array with the points of all users who pass...
getShowSolutionAnswersOnly()
Returns if the full solution (including ILIAS content) should be presented to the solution or not...
& createTestSequence($active_id, $pass, $shuffle)
static getPoolQuestionChangeListener(ilDBInterface $db, $poolObjId)
setFinalStatement($a_statement="")
Sets the final statement text of the ilObjTest object.
& _evalResultsOverview($test_id)
Creates an associated array with the results of all participants of a test.
& getQuestionsOfTest($active_id)
Retrieves all the assigned questions for all test passes of a test participant.
setScoreCutting($a_score_cutting=SCORE_CUT_QUESTION)
Sets the type of score cutting.
sendAdvancedNotification($active_id)
getXMLZip()
Get zipped xml file for test.
setResetProcessingTime($reset=0)
Sets wheather the processing time should be reset or not.
setCharSelectorAvailability($availability)
setShowMarker($a_value=1)
Sets the marker button status.
inviteUser($user_id, $client_ip="")
Invites a user to a test.
static _lookupTitle($a_id)
lookup object title
getAnonymity()
Returns the anonymity status of the test.
toXML()
Returns a QTI xml representation of the test.
isScoreReportingAvailable()
getQuestionCount()
Returns the number of questions in the test.
setEndingTimeEnabled($ending_time_enabled)
setActivationLimited($a_value)
$showGradingStatusEnabled
TableGUI class for evaluation of all users.
setSpecificAnswerFeedback($specific_answer_feedback)
getShuffleQuestions()
Returns the status of the shuffle_questions variable.
static _lookupClientIP($a_user_id)
Lookup client ip.
$offeringQuestionHintsEnabled
setTestId($a_id)
Sets the test ID.
create()
create test object
isPreviousSolutionReuseEnabled($activeId)
isShowExamIdInTestResultsEnabled()
_getVisitTimeOfParticipant($test_id, $active_id)
Returns the first and last visit of a participant.
& getTestParticipants()
Returns a list of all participants in a test.
getCompleteWorkingTime($user_id)
Returns the complete working time in seconds a user worked on the test.
getShowSolutionDetails()
Returns if the solution details should be presented to the user or not.
getImagePathWeb()
Returns the web image path for web accessable images of a test The image path is under the web access...
startingTimeReached()
Returns true if the starting time of a test is reached A starting time is not available for self asse...
questionMoveDown($question_id)
Moves a question down in order.
getOwner()
get object owner
getHighscoreWTime()
Gets if the column with the workingtime should be shown.
isSingleChoiceTest()
Returns TRUE if the test contains single choice results only.
getActiveIdOfUser($user_id="", $anonymous_id="")
Gets the active id of a given user.
static _getObjectIDFromActiveID($active_id)
Returns the ILIAS test object id for a given active id.
setShowGradingStatusEnabled($showGradingStatusEnabled)
$participantDataExist
holds the fact wether participant data exists or not DO NOT USE TIS PROPERTY DRIRECTLY ALWAYS USE ilO...
static getASCIIFilename($a_filename)
convert utf8 to ascii filename
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...
setRedirectionUrl($redirection_url=null)
static _getBestPass($active_id)
Retrieves the best pass of a given user for a given test.
static _lookupAnonymity($a_obj_id)
Returns the anonymity status of a test with a given object id.
setEndingTime($ending_time=null)
Sets the ending time in database timestamp format for the test.
getShowSolutionListComparison()
setQuestionSetSolved($value, $question_id, $user_id)
sets question solved state to value for given user_id
Base Exception for all Exceptions relating to Modules/Test.
setListOfQuestionsStart($a_value=true)
Sets if the the list of questions as the start page of the test.
loadQuestions($active_id="", $pass=null)
Load the test question id's from the database.
getHighscoreTopTable()
Gets, if the top-rankings table should be shown.
setMailNotificationType($a_type)
setTitle($a_title)
set object title
startWorkingTime($active_id, $pass)
Write the initial entry for the tests working time to the database.
setObligationsEnabled($obligationsEnabled=true)
sets obligations enabled/disabled
setHighscoreOwnTable($a_own_table)
Sets if the table with the own ranking should be shown.
setTitleOutput($title_output=0)
Sets the status of the title output.
disinviteUser($user_id)
Disinvites a user from a test.
setShowSolutionPrintview($a_printview=1)
Sets if the the solution printview should be presented to the user or not.
areObligationsEnabled()
returns the fact wether obligations are enabled or not
& getQuestionTitles()
Returns the titles of the test questions in question sequence.
& evalResultsOverview()
Creates an associated array with the results of all participants of a test.
getSequenceSettings()
SEQUENCE SETTING = POSTPONING ENABLED !!
static _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
isMaxProcessingTimeReached($starting_time, $active_id)
Returns whether the maximum processing time for a test is reached or not.
& _getCompleteWorkingTimeOfParticipants($test_id)
Returns the complete working time in seconds for all test participants.
canShowTestResults($testSession)
isRandomTest()
Returns the fact wether this test is a random questions test or not.
canViewResults()
Returns true, if the test results can be viewed.
setTestFinalBroken($testFinalBroken)
getHighscorePercentage()
Gets if the percentage column should be shown.
isFixedTest()
Returns the fact wether this test is a fixed question set test or not.
checkMarks()
{boolean|string True or an error string which can be used for display purposes}
setShowKioskModeParticipant($a_participant=false)
Set to true, if the participant's name should be shown in kiosk mode.
static isQuestionObligatory($question_id)
checks wether the question with given id is marked as obligatory or not
updateWorkingTime($times_id)
Update the working time of a test when a question is answered.
isExecutable($testSession, $user_id, $allowPassIncrease=false)
Checks if the test is executable by the given user.
$instantFeedbackAnswerFixationEnabled
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
static _getLogLanguage()
retrieve the log language for assessment logging
setSignSubmission($sign_submission)
$char_selector_definition
static completeMissingPluginName($questionTypeData)
getSpecificAnswerFeedback()
getImportMapping()
get array of (two) new created questions for import id
static _getMaxPass($active_id)
Retrieves the maximum pass of a given user for a given test in which the user answered at least one q...
if(!is_dir( $entity_dir)) exit("Fatal Error ([A-Za-z0-9]+)\+" &#(? foreach( $entity_files as $file) $output
setProcessingTimeByMinutes($minutes)
addDefaults($a_name)
Adds the defaults of this test to the test defaults.
getCountSystem()
Gets the count system for the calculation of points.
const SCORE_REPORTING_IMMIDIATLY
getIntroduction()
Gets the introduction text of the ilObjTest object.
getMarkSchemaForeignId()
{int}
setNrOfTries($nr_of_tries=0)
Sets the nr of tries for the test.
setScoreReporting($score_reporting=0)
Sets the score reporting of the ilObjTest object.
__construct($a_id=0, $a_call_by_reference=true)
Constructor.
removeTestResults(ilTestParticipantData $participantData)
setStartingTime($starting_time=null)
Sets the starting time in database timestamp format for the test.
setAnswerFeedbackPoints($answer_feedback_points=0)
Sets the answer specific feedback of reached points for the test.
getHighscoreHints()
Gets, if the column with the number of requested hints should be shown.
static _enabledAssessmentLogging()
check wether assessment logging is enabled or not
setShowCancel($a_value=1)
Sets the cancel test button status.
getQuestiontext($question_id)
Returns the question text for a given question.
static _getInstance($a_copy_id)
Get instance of copy wizard options.
getShowKioskModeTitle()
Returns the status of the kiosk mode title.
buildName($user_id, $firstname, $lastname, $title)
Builds a user name for the output depending on test type and existence of the user.
& getTestDefaults($test_defaults_id)
Returns the test defaults for a given id.
setLimitUsersEnabled($limitUsersEnabled)
setAutosaveIval($autosave_ival)
setExportSettingsSingleChoiceShort($a_settings)
setCustomStyle($a_customStyle=null)
Set the custom style.
getVisitTimeOfParticipant($active_id)
Returns the first and last visit of a participant.
getListOfQuestions()
Returns if the list of questions should be presented to the user or not.
QTIMaterialToString($a_material)
Reads an QTI material tag an creates a text string.
setProcessingTime($processing_time="00:00:00")
Sets the processing time for the test.
$forceInstantFeedbackEnabled
foreach($_POST as $key=> $value) $res
setCountSystem($a_count_system=COUNT_PARTIAL_SOLUTIONS)
Sets the count system for the calculation of points.
createRandomSolutions($number)
getAllTestResults($participants, $prepareForCSV=true)
returns all test results for all participants
getResetProcessingTime()
Returns wheather the processing time should be reset or not.
setScoringFeedbackOptionsByArray($options)
setShowSolutionSuggested($a_solution=false)
Set to TRUE, if the suggested solution should be shown in the solution.
getHighscoreAnon()
Gets if the highscores should be anonymized per setting.
getTestParticipantsForManualScoring($filter=null)
setExportSettings($a_settings)
saveToDb($properties_only=false)
Saves a ilObjTest object to a database.
static _getQuestionCountAndPointsForPassOfParticipant($active_id, $pass)
removeQuestion($question_id)
Removes a question from the test object.
getId()
get object id public
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 _addLog($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=false, $test_ref_id=null)
Add an assessment log entry.
setHighscoreTopNum($a_top_num)
Sets the number of entries which are to be shown in the top-rankings table.
canShowEctsGrades()
{boolean}
setActivationVisibility($a_value)
hasQuestionsWithoutQuestionpool()
evalTotalPersons()
Returns the number of persons who started the test.
hasSingleChoiceQuestions()
Returns TRUE if the test contains single choice results.
static _getScoreCutting($active_id)
Determines if the score of a question should be cut at 0 points or the score of the whole test...
getStartingTimeOfUser($active_id, $pass=null)
Returns the unix timestamp of the time a user started a test.
getShowMarker()
Returns wheather the marker button is shown or not.
sendSimpleNotification($active_id)
getShowSolutionPrintview()
Returns if the solution printview should be presented to the user or not.
const SCORE_ZERO_POINTS_WHEN_UNANSWERED
getAnswerFeedback()
Returns 1 if generic answer feedback is activated.
hasNrOfTriesRestriction()
returns if the numbers of tries have to be checked
getTitleOutput()
Returns the value of the title_output status.
addExtraTime($active_id, $minutes)
const COUNT_PARTIAL_SOLUTIONS
getAuthor()
Gets the authors name of the ilObjTest object.
static _getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
static _lookupDescription($a_id)
lookup object description
randomSelectQuestions($nr_of_questions, $questionpool, $use_obj_id=0, $qpls="", $pass=null)
Returns a random selection of questions.
getUsePreviousAnswers()
Returns if the previous answers should be shown for a learner.
getShowPassDetails()
Returns if the pass details should be shown when a test is not finished.
static getManualFeedback($active_id, $question_id, $pass)
Retrieves the manual feedback for a question in a test.
evalTotalFinished()
Returns the number of total finished tests.
isTestFinishedToViewResults($active_id, $currentpass)
Returns true if an active user completed a test pass and did not start a new pass.
getShowFinalStatement()
Returns whether the final statement should be shown or not.
static ensureParticipantsLastActivePassFinished($testObjId, $userId, $a_force_new_run=false)
addQTIMaterial(&$a_xml_writer, $a_material)
Creates a QTI material tag from a plain text or xhtml text.
setTemplate($template_id)
questionMoveUp($question_id)
Moves a question up in order.
static _lookupObjId($a_id)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
special template class to simplify handling of ITX/PEAR
setShowInfo($a_info=1)
Set whether the complete information page is shown or the required data only.
static collectFileItems($a_page, $a_domdoc)
Get all file items that are used within the page.
getEvaluationAdditionalFields()
Gets additional user fields that should be shown in the user evaluation.
getShowSolutionSuggested()
& getAllQuestions($pass=null)
Returns all questions of a test in test order.
setShowSolutionFeedback($a_feedback=true)
Sets if the the feedback should be presented to the user in the solution or not.
isSkillServiceToBeConsidered()
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
static _getCountSystem($active_id)
Gets the count system for the calculation of points.
setInstantFeedbackSolution($instant_feedback=0)
Sets the instant feedback for the solution.
setListOfQuestions($a_value=true)
Sets if the the list of questions should be presented to the user or not.
static _getSolvedQuestions($active_id, $question_fi=null)
get solved questions
buildIso8601PeriodFromUnixtimeForExportCompatibility($unix_timestamp)
setAllowedUsersTimeGap($a_allowed_users_time_gap)
getTitle()
get object title public
applyDefaults($test_defaults)
Applies given test defaults to this test.
getDescription()
get object description
getProcessingTime()
Returns the processing time for the test.
isOfferingQuestionHintsEnabled()
returns the fact wether offering hints is enabled or not
removeTestActives($activeIds)
exportXMLMediaObjects(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export media objects to xml (see ilias_co.dtd)
hasRandomQuestionsForPass($active_id, $pass)
Checkes wheather a random test has already created questions for a given pass or not.
redirection script todo: (a better solution should control the processing via a xml file) ...
cloneMetaData($target_obj)
Copy meta data.
xmlHeader()
Writes xml header public.
getAnsweredQuestionCount($active_id, $pass=null)
Retrieves the number of answered questions for a given user in a given test.
isBestSolutionPrintedWithResult()
$activation_starting_time
static isSkillManagementGloballyActivated()
getAnswerFeedbackPoints()
Returns 1 if answer specific feedback as reached points is activated.
static _lookupOwner($a_id)
lookup object owner
createExportDirectory()
creates data directory for export files (data_dir/tst_data/tst_<id>/export, depending on data directo...
getStartTestLabel($active_id)
Returns the "Start the Test" label for the Info page.
setECTSGrades(array $a_ects_grades)
{}
removeTestResultsFromSoapLpAdministration($userIds)
getMarkSchema()
{ASS_MarkSchema}
getAggregatedResultsData()
Returns the aggregated test results.
static _lookupAuthor($obj_id)
Gets the authors name of the ilObjTest object.
getStartingTime()
Returns the starting time of the test.
getStartingTimeOfParticipants()
setAnonymity($a_value=0)
Sets the anonymity status of the test.
static lookupLastTestPassAccess($activeId, $passIndex)
getShowSolutionSignature()
Returns if the signature field should be shown in the test results.
getAllRTEContent()
Returns the content of all RTE enabled text areas in the test.
static removeTrailingPathSeparators($path)
static isQuestionObligationPossible($questionId)
checks wether the obligation for question with given id is possible or not
static _lookupFinishedUserTests($a_user_id)
Gather all finished tests for user.
pcArrayShuffle($array)
Shuffles the values of a given array.
getType()
get object type public
static _getTestIDFromObjectID($object_id)
Returns the ILIAS test id for a given object id.
getInstantFeedbackSolution()
Returns 1 if the correct solution will be shown after answering a question.
Create styles array
The data for the language used.
getFinalStatement()
Gets the final statement.
setKiosk($kiosk=0)
Sets the kiosk mode for the test.
isHighscoreAnon()
Gets if the highscores should be displayed anonymized.
inviteGroup($group_id)
Invites all users of a group to a test.
setUsePreviousAnswers($use_previous_answers=1)
Sets the status of the visibility of previous learner answers.
setTimingType($a_type)
Set timing type.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
setResultsPresentation($a_results_presentation=3)
Sets the combined results presentation value.
const SCORE_REPORTING_FINISHED
isInstantFeedbackAnswerFixationEnabled()
prepareTextareaOutput($txt_output, $prepare_for_latex_output=false, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output in tests.
$char_selector_availability
static _createImportDirectory()
creates data directory for import files (data_dir/tst_data/tst_<id>/import, depending on data directo...
static _getECTSGrade($points_passed, $reached_points, $max_points, $a, $b, $c, $d, $e, $fx)
{Returns the ECTS grade for a number of reached points.The points reached in the test The maximum num...
const TEST_FIXED_SEQUENCE
Test constants.
update($pash, $contents, Config $config)
getPassword()
Returns the password for test access.
getNrOfTries()
Returns the nr of tries for the test.
duplicateQuestionForTest($question_id)
Takes a question and creates a copy of the question for use in the test.
setForceJS($a_js=1)
Set whether JavaScript should be forced for tests.
setPostponingEnabled($postponingEnabled)
isScoreReportingEnabled()
static hasObligations($test_id)
returns the fact wether the test with given test id contains questions markes as obligatory or not ...
setHighscoreHints($a_hints)
Sets if the number of requested hints should be shown.
isForceInstantFeedbackEnabled()
setEnableProcessingTime($enable=0)
Sets the processing time enabled or disabled.
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
& getTotalPointsPassedArray()
Returns an array with the total points of all users who passed the test This array could be used for ...
static _getSuggestedSolutionOutput($question_id)
Returns the output of the suggested solution.
getQuestionDataset($question_id)
Returns the dataset for a given question id.
_getLastAccess($active_id)
evalTotalStartedAverageTime()
Returns the average processing time for all started tests.
getResultsForActiveId($active_id)
setResultsPresentationOptionsByArray($options)
static getFirstNewsIdForContext( $a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id="", $a_context_sub_obj_type="")
Get first new id of news set related to a certain context.
setEnabledViewMode($mode)
getQuestionSetType()
getter for question set type
const SCORE_REPORTING_DATE
setHighscoreAchievedTS($a_achieved_ts)
Sets if the date and time of the scores achievement should be displayed.
getGenericAnswerFeedback()
Returns 1 if generic answer feedback is to be shown.
setShowSolutionListComparison($a_comparison=false)
Set to TRUE, if the list of answers should be shown prior to finish the test.
setEnableArchiving($enable_archiving)
getEstimatedWorkingTime()
Returns the estimated working time for the test calculated from the working time of the contained que...
isSingleChoiceTestWithoutShuffle()
Returns TRUE if the test contains single choice results and no shuffle only.
isQuestionSetConfigured()
$show_exam_id_in_test_pass_enabled
static deleteNewsOfContext( $a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id=0, $a_context_sub_obj_type="")
Delete all news of a context.
getEndingTime()
Returns the ending time of the test.
setPasswordEnabled($passwordEnabled)
setShowExamviewHtml($show_examview_html)
getActivationStartingTime()
getAvailableQuestions($arrFilter, $completeonly=0)
Calculates the available questions for a test.
& getUserData($ids)
Returns a data of all users specified by id list.
static getDataDir()
get data directory (outside webspace)
getTextAnswer($active_id, $question_id, $pass=null)
Returns the text answer of a given user for a given question.
getScoreCutting()
Determines if the score of a question should be cut at 0 points or the score of the whole test...
getCharSelectorAvailability()
setKioskMode($a_kiosk=false)
Sets the kiosk mode for the test.
getTitleFilenameCompliant()
returns the object title prepared to be used as a filename
getCustomStyles()
Return the available custom styles.
const HIGHSCORE_SHOW_TOP_TABLE
cleanupMediaobjectUsage()
Cleans up the media objects for all text fields in a test which are using an RTE field.
_lookupRandomTestFromActiveId($active_id)
Returns the random status of a test with a given object id.
static _getManualScoring()
Retrieve the manual scoring settings.
deleteTest()
Deletes the test and all related objects, files and database entries.
setShowSolutionAnswersOnly($a_full=true)
Set to true, if the full solution (including the ILIAS content pages) should be shown in the solution...
static _getAvailableTests($use_object_id=false)
Returns the available tests for the active user.
setOfferingQuestionHintsEnabled($offeringQuestionHintsEnabled)
sets offering question hints enabled/disabled
checkMaximumAllowedUsers()
moveQuestions($move_questions, $target_index, $insert_mode)
Move questions to another position.
exportPagesXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export pages of test to xml (see ilias_co.dtd)
recalculateScores($preserve_manscoring=false)
static _getMCScoring($active_id)
Gets the scoring type for multiple choice questions.
& evalTotalParticipantsArray($name_sort_order="asc")
Returns all participants who started the test.
$print_best_solution_with_result
setPrintBestSolutionWithResult($status)
getKioskMode()
Returns the kiosk mode.
const HIGHSCORE_SHOW_OWN_TABLE
setMCScoring($a_mc_scoring=SCORE_ZERO_POINTS_WHEN_UNANSWERED)
Sets the multiple choice scoring.
getExportSettingsSingleChoiceShort()
deleteDefaults($test_default_id)
Deletes the defaults for a test.
update()
update object data
endingTimeReached()
Returns true if the ending time of a test is reached An ending time is not available for self assessm...
& getTestResult($active_id, $pass=null, $ordered_sequence=false, $considerHiddenQuestions=true, $considerOptionalQuestions=true)
Calculates the results of a test for a given user and returns an array with all test results...
getActivationEndingTime()
const QUESTION_SET_TYPE_FIXED
type setting value for fixed question set
isActiveTestSubmitted($user_id=null)
returns if the active for user_id has been submitted
setHighscoreAnon($a_anon)
Sets if the highscores should be anonymized.
modifyExportIdentifier($a_tag, $a_param, $a_value)
Returns the installation id for a given identifier.
saveAuthorToMetadata($a_author="")
Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be c...
getRefId()
get reference id public
getQuestionType($question_id)
Returns the question type of a question with a given id.
static buildExamId($active_id, $pass, $test_obj_id=null)
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
static insertInstIntoID($a_value)
inserts installation id into ILIAS id
setGenericAnswerFeedback($generic_answer_feedback=0)
Sets if the generic feedback is to be shown in the test.
removeTestResultsByActiveIds($activeIds)
setShowExamIdInTestResultsEnabled($show_exam_id_in_test_results_enabled)
getSecondsUntilEndingTime()
Returns the seconds left from the actual time until the ending time.
deleteMetaData()
delete meta data entry
& getCompleteWorkingTimeOfParticipants()
Returns the complete working time in seconds for all test participants.
& getCompleteEvaluationData($withStatistics=true, $filterby="", $filtertext="")
static getGuiClassNameByQuestionType($questionType)
canEditEctsGrades()
{boolean}
getProcessingTimeInSeconds($active_id="")
Returns the processing time for the test in seconds.
static _cleanupMediaObjectUsage($a_text, $a_usage_type, $a_usage_id)
Synchronises appearances of media objects in $a_text with media object usage table.
setDescription($a_desc)
set object description
getShowCancel()
Returns wheather the cancel test button is shown or not.
setIntroduction($introduction="")
Sets the introduction text of the ilObjTest object.
getNrOfResultsForPass($active_id, $pass)
Calculates the number of user results for a specific test pass.
setClientIP($user_id, $client_ip)
static recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
isShowGradingStatusEnabled()
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
A class defining mark schemas for assessment test objects.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
canShowSolutionPrintview($user_id=null)
Calculates if a user may see the solution printview of his/her test results.
getHighscoreScore()
Gets if the score column should be shown.
setActivationStartingTime($starting_time=null)
static getTestObjIdsWithActiveForUserId($userId)
getListOfQuestionsEnd()
Returns if the list of questions should be presented as the last page of the test.
isPluginActive($a_pname)
Checks wheather or not a question plugin with a given name is active.
txt($a_topic, $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setHighscoreEnabled($a_enabled)
Sets if the highscore feature should be enabled.
static isParticipantsLastPassActive($testRefId, $userId)
& evalResultsOverviewOfParticipant($active_id)
Creates an associated array with the results for a given participant of a test.
saveQuestionsToDb()
Saves the test questions to the database.
getMCScoring()
Gets the scoring type for multiple choice questions.
setShowGradingMarkEnabled($showGradingMarkEnabled)
getHighscoreEnabled()
Gets the setting which determines if the highscore feature is enabled.
setAuthor($author="")
Sets the authors name of the ilObjTest object.
getKiosk()
Returns the kiosk mode.
moveQuestionAfterOLD($previous_question_id, $new_question_id)
setInstantFeedbackAnswerFixationEnabled($instantFeedbackAnswerFixationEnabled)
moveQuestionAfter($question_to_move, $question_before)
setHighscorePercentage($a_percentage)
Sets if the percentages of the scores pass should be shown.
setIntroductionEnabled($introductionEnabled)
static _getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
static lookupQuestionSetType($objId)
lookup-er for question set type
static lookupQuestionSetTypeByActiveId($active_id)
returns the question set type of test relating to passed active id
const QUESTION_SET_TYPE_DYNAMIC
type setting value for dynamic question set (continues testing mode)
deliverPDFfromHTML($content, $title=null)
Delivers a PDF file from XHTML.
static getInstance($a_obj_id)
getDetailedTestResults($participants)
returns all test results for all participants
const HIGHSCORE_SHOW_ALL_TABLES
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
isNrOfTriesReached($tries)
returns if number of tries are reached
removeQuestions($removeQuestionIds)
exportXMLPageObjects(&$a_xml_writer, $a_inst, &$expLog)
export page objects to xml (see ilias_co.dtd)
& getQuestionsOfPass($active_id, $pass)
Retrieves all the assigned questions for a test participant in a given test pass. ...
setListOfQuestionsDescription($a_value=true)
Sets the show_summary attribute to TRUE if the list of questions should be presented with the questio...
getForceJS()
Gets whether JavaScript should be forced for tests.
Class ilObjectActivation.
isComplete(ilTestQuestionSetConfig $testQuestionSetConfig)
Returns true, if a test is complete for use and can be set online.
static getFeedbackClassNameByQuestionType($questionType)
static _getQuestionTitle($question_id)
Returns the question title of a question with a given id.
setShowFinalStatement($show=0)
Sets whether the final statement should be shown or not.
static deleteRequestsByActiveIds($activeIds)
Deletes all hint requests relating to a testactive included in given active ids.
Test certificate adapter.
setSequenceSettings($sequence_settings=0)
SEQUENCE SETTING = POSTPONING ENABLED !!
reindexFixedQuestionOrdering()
setListOfQuestionsSettings($a_value=0)
Sets the settings for the list of questions options in the test properties This could contain one of ...
setListOfQuestionsEnd($a_value=true)
Sets if the the list of questions as the end page of the test.
static _setImportDirectory($a_import_dir=null)
set import directory
static _getTestDefaults($test_defaults_id)
read()
read object data from db into object
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
setShowSolutionSignature($a_signature=false)
Set to TRUE, if the signature field should be shown in the solution.
userLookupFullName($user_id, $overwrite_anonymity=false, $sorted_order=false, $suffix="")
Returns the full name of a test user according to the anonymity status.
static _getActiveIdOfUser($user_id="", $test_id="")
Gets the active id of the tst_active table for the active user.
setStartingTimeEnabled($starting_time_enabled)
getHighscoreTopNum($a_retval=10)
Gets the number of entries which are to be shown in the top-rankings table.
static _getImportDirectory()
Get the import directory location of the test.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
& 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.
$show_exam_id_in_test_results_enabled
getImagePath()
Returns the image path for web accessable images of a test The image path is under the CLIENT_WEB_DIR...
static lookupExamId($active_id, $pass)
getPassScoring()
Gets the pass scoring type.