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';
758 if (!parent::update())
789 if (!parent::delete())
800 require_once
'Modules/TestQuestionPool/classes/questions/class.ilAssQuestionSkillAssignmentImportFails.php';
802 $qsaImportFails->deleteRegisteredImportFails();
803 require_once
'Modules/Test/classes/class.ilTestSkillLevelThresholdImportFails.php';
805 $sltImportFails->deleteRegisteredImportFails();
817 global $tree,
$ilDB, $ilPluginAdmin,
$lng;
819 require_once
'Modules/Test/classes/class.ilTestParticipantData.php';
821 $participantData->load($this->
getTestId());
824 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_mark WHERE test_fi = %s",
829 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_tests WHERE test_id = %s",
834 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
836 $testQuestionSetConfigFactory->getQuestionSetConfig()->removeQuestionSetRelatedData();
839 include_once
"./Services/Utilities/classes/class.ilUtil.php";
841 $directory = $tst_data_dir.
"/tst_".$this->
getId();
842 if (is_dir($directory))
844 include_once
"./Services/Utilities/classes/class.ilUtil.php";
847 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
853 foreach(
$mobs as $mob)
871 include_once
"./Services/Utilities/classes/class.ilUtil.php";
874 if (!is_writable($tst_data_dir))
876 $this->
ilias->raiseError(
"Test Data Directory (".$tst_data_dir
877 .
") not writeable.",$this->
ilias->error_obj->MESSAGE);
881 $tst_dir = $tst_data_dir.
"/tst_".$this->
getId();
883 if (!@is_dir($tst_dir))
885 $this->
ilias->raiseError(
"Creation of Test Directory failed.",$this->
ilias->error_obj->MESSAGE);
888 $export_dir = $tst_dir.
"/export";
890 if (!@is_dir($export_dir))
892 $this->
ilias->raiseError(
"Creation of Export Directory failed.",$this->
ilias->error_obj->MESSAGE);
903 include_once
"./Services/Utilities/classes/class.ilUtil.php";
914 function getExportFiles($dir)
917 if(!@is_dir($dir) || !is_writeable($dir))
923 foreach(
new DirectoryIterator($dir) as
$file)
933 $files[] = $file->getBasename();
946 if (strlen($a_import_dir))
948 $_SESSION[
"tst_import_dir"] = $a_import_dir;
984 include_once
"./Services/Utilities/classes/class.ilUtil.php";
988 if (!is_writable($tst_data_dir))
990 $ilias->raiseError(
"Test Data Directory (".$tst_data_dir
991 .
") not writeable.", $ilias->error_obj->FATAL);
995 $tst_dir = $tst_data_dir.
"/tst_import";
997 if (!@is_dir($tst_dir))
999 $ilias->raiseError(
"Creation of test import directory failed.",$ilias->error_obj->FATAL);
1018 $result = $ilDB->queryF(
"SELECT DISTINCT(qpl_qst_type.type_tag) foundtypes FROM qpl_questions, tst_test_result, qpl_qst_type, tst_active WHERE tst_test_result.question_fi = qpl_questions.question_id AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id AND tst_test_result.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
1025 if (strcmp(
$row[
'foundtypes'],
'assSingleChoice') == 0)
1043 $result = $ilDB->queryF(
"SELECT DISTINCT(qpl_qst_type.type_tag) foundtypes FROM qpl_questions, tst_test_result, qpl_qst_type, tst_active WHERE tst_test_result.question_fi = qpl_questions.question_id AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id AND tst_test_result.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
1050 if (strcmp(
$row[
'foundtypes'],
'assSingleChoice') == 0)
1075 SELECT DISTINCT(qpl_qst_sc.shuffle) foundshuffles 1081 WHERE tst_test_result.question_fi = qpl_questions.question_id 1082 AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id 1083 AND tst_test_result.active_fi = tst_active.active_id 1084 AND qpl_questions.question_id = qpl_qst_sc.question_fi 1085 AND tst_active.test_fi = %s 1086 AND qpl_qst_type.type_tag = %s 1088 array(
'integer',
'text'),
1094 return (
$row[
'foundshuffles'] == 0);
1107 if( !count($this->mark_schema->mark_steps) )
1128 global $tree,
$ilDB, $ilPluginAdmin;
1131 $test->loadFromDb();
1133 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
1136 return $test->isComplete( $testQuestionSetConfigFactory->getQuestionSetConfig() );
1152 if(!preg_match(
'/\d+/', $this->
getECTSFX()))
1160 SET ects_output = %s, ects_a = %s, ects_b = %s, ects_c = %s, ects_d = %s, ects_e = %s, ects_fx = %s 1161 WHERE test_id = %s",
1162 array(
'text',
'float',
'float',
'float',
'float',
'float',
'float',
'integer'),
1165 $grades[
'A'], $grades[
'B'], $grades[
'C'], $grades[
'D'], $grades[
'E'],
1182 if($this->
isComplete($testQuestionSetConfig))
1189 "UPDATE tst_tests SET complete = %s WHERE test_id = %s",
1190 array(
'text',
'integer'),
1191 array($complete, $this->test_id)
1216 include_once(
"./Services/RTE/classes/class.ilRTE.php");
1217 $completecontent =
"";
1220 $completecontent .= $content;
1233 global $tree,
$ilDB, $ilPluginAdmin;
1240 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
1242 $testQuestionSetConfig = $testQuestionSetConfigFactory->getQuestionSetConfig();
1244 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1245 if ($this->test_id == -1)
1248 $next_id = $ilDB->nextId(
'tst_tests');
1250 $ilDB->insert(
'tst_tests',
array(
1251 'test_id' =>
array(
'integer', $next_id),
1252 'obj_fi' =>
array(
'integer', $this->
getId()),
1282 'complete' =>
array(
'text', $this->
isComplete($testQuestionSetConfig)),
1284 'ects_a' =>
array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : NULL),
1285 'ects_b' =>
array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : NULL),
1286 'ects_c' =>
array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : NULL),
1287 'ects_d' =>
array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : NULL),
1288 'ects_e' =>
array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : NULL),
1324 'online_status' =>
array(
'integer', (
int)$this->
isOnline()),
1351 $this->test_id = $next_id;
1364 $result = $ilDB->queryF(
"SELECT * FROM tst_tests WHERE test_id = %s",
1366 array($this->test_id)
1370 $oldrow = $ilDB->fetchAssoc(
$result);
1374 $ilDB->update(
'tst_tests',
1405 'complete' =>
array(
'text', $this->
isComplete($testQuestionSetConfig)),
1407 'ects_a' =>
array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : NULL),
1408 'ects_b' =>
array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : NULL),
1409 'ects_c' =>
array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : NULL),
1410 'ects_d' =>
array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : NULL),
1411 'ects_e' =>
array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : NULL),
1446 'online_status' =>
array(
'integer', (
int)$this->
isOnline()),
1477 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1480 $logresult = $ilDB->queryF(
"SELECT * FROM tst_tests WHERE test_id = %s",
1485 if ($logresult->numRows() == 1)
1487 $newrow = $ilDB->fetchAssoc($logresult);
1489 $changed_fields =
array();
1490 foreach ($oldrow as $key => $value)
1492 if (strcmp($oldrow[$key], $newrow[$key]) != 0)
1494 array_push($changed_fields,
"$key: " . $oldrow[$key] .
" => " . $newrow[$key]);
1497 $changes = join($changed_fields,
", ");
1498 if (count($changed_fields) > 0)
1509 $aresult = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s AND tries >= %s AND submitted = %s",
1510 array(
'integer',
'integer',
'integer'),
1513 while (
$row = $ilDB->fetchAssoc($aresult))
1515 $ilDB->manipulateF(
"UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
1516 array(
'integer',
'timestamp',
'integer'),
1522 $aresult = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s AND tries < %s AND submitted = %s",
1523 array(
'integer',
'integer',
'integer'),
1526 while (
$row = $ilDB->fetchAssoc($aresult))
1528 $ilDB->manipulateF(
"UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
1529 array(
'integer',
'timestamp',
'integer'),
1537 $aresult = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s AND submitted = %s",
1538 array(
'integer',
'integer'),
1541 while (
$row = $ilDB->fetchAssoc($aresult))
1543 $ilDB->manipulateF(
"UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
1544 array(
'integer',
'timestamp',
'integer'),
1553 include_once
'Services/News/classes/class.ilNewsItem.php';
1558 $newsItem->setContext($this->
getId(),
'tst');
1560 $newsItem->setTitle(
'new_test_online');
1561 $newsItem->setContentIsLangVar(
true);
1562 $newsItem->setContent(
'');
1563 $newsItem->setUserId($ilUser->getId());
1565 $newsItem->create();
1577 $newsItem->setTitle(
'new_test_online');
1578 $newsItem->setContentIsLangVar(
true);
1579 $newsItem->setContent(
'');
1580 $newsItem->update();
1587 include_once
"./Services/Object/classes/class.ilObjectActivation.php";
1603 $item->update($this->ref_id);
1606 if (!$properties_only)
1613 $this->mark_schema->saveToDb($this->test_id);
1627 $oldquestions =
array();
1628 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
1631 $result = $ilDB->queryF(
"SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
1639 array_push($oldquestions,
$row[
"question_fi"]);
1645 $currentQuestionsObligationsQuery =
'SELECT question_fi, obligatory FROM tst_test_question WHERE test_fi = %s';
1646 $rset = $ilDB->queryF($currentQuestionsObligationsQuery,
array(
'integer'),
array($this->
getTestId()));
1647 while (
$row = $ilDB->fetchAssoc($rset)) {
1648 $obligatoryQuestionState[
$row[
'question_fi']] = $row[
'obligatory'];
1651 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_test_question WHERE test_fi = %s",
1656 foreach ($this->questions as $key => $value)
1659 if( !isset($obligatoryQuestionState[$value]) || is_null($obligatoryQuestionState[$value]) )
1661 $obligatoryQuestionState[$value] = 0;
1665 $next_id = $ilDB->nextId(
'tst_test_question');
1666 $ilDB->insert(
'tst_test_question',
array(
1667 'test_question_id' =>
array(
'integer', $next_id),
1669 'question_fi' =>
array(
'integer', $value),
1670 'sequence' =>
array(
'integer', $key),
1671 'obligatory' =>
array(
'integer', $obligatoryQuestionState[$value]),
1675 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1678 $result = $ilDB->queryF(
"SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
1682 $newquestions =
array();
1687 array_push($newquestions,
$row[
"question_fi"]);
1690 foreach ($oldquestions as $index => $question_id)
1692 if (strcmp($newquestions[$index], $question_id) != 0)
1694 $pos = array_search($question_id, $newquestions);
1705 foreach ($newquestions as $index => $question_id)
1707 if (array_search($question_id, $oldquestions) === FALSE)
1723 $result = $ilDB->queryF(
'SELECT copy_id FROM tst_rnd_cpy WHERE tst_fi = %s',
1727 return $result->numRows() > 0;
1751 $result = $ilDB->queryF(
"SELECT qpl_questions.original_id FROM qpl_questions, tst_test_question WHERE qpl_questions.question_id = tst_test_question.question_fi AND qpl_questions.tstamp > 0 AND tst_test_question.test_fi = %s",
1755 $original_ids =
array();
1756 $paramtypes =
array();
1757 $paramvalues =
array();
1760 array_push($original_ids,
$row[
'original_id']);
1765 if (($questionpool == 0) && (!is_array($qpls)))
1767 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
1769 if (count($available_pools))
1771 $available =
" AND " . $ilDB->in(
'obj_fi', $available_pools,
false,
'integer');
1779 $constraint_qpls =
"";
1780 $result_array =
array();
1781 if ($questionpool == 0)
1783 if (is_array($qpls))
1785 if (count($qpls) > 0)
1787 $constraint_qpls =
" AND " . $ilDB->in(
'obj_fi', $qpls,
false,
'integer');
1792 $original_clause =
"";
1793 if (count($original_ids))
1795 $original_clause =
" AND " . $ilDB->in(
'question_id', $original_ids,
true,
'integer');
1798 if ($questionpool == 0)
1800 $result = $ilDB->queryF(
"SELECT question_id FROM qpl_questions WHERE original_id IS NULL $available $constraint_qpls AND owner > %s AND complete = %s $original_clause",
1801 array(
'integer',
'text'),
1807 $result = $ilDB->queryF(
"SELECT question_id FROM qpl_questions WHERE original_id IS NULL AND obj_fi = %s AND owner > %s AND complete = %s $original_clause",
1808 array(
'integer',
'integer',
'text'),
1809 array($questionpool, 0,
"1")
1812 $found_ids =
array();
1815 array_push($found_ids,
$row[
'question_id']);
1817 $nr_of_questions = ($nr_of_questions > count($found_ids)) ? count($found_ids) : $nr_of_questions;
1818 if ($nr_of_questions == 0)
return array();
1819 $rand_keys = array_rand($found_ids, $nr_of_questions);
1821 if (is_array($rand_keys))
1823 foreach ($rand_keys as $key)
1825 $result[$found_ids[$key]] = $found_ids[$key];
1830 $result[$found_ids[$rand_keys]] = $found_ids[$rand_keys];
1846 $result = $ilDB->queryF(
"SELECT test_result_id FROM tst_test_result WHERE active_fi = %s AND pass = %s",
1847 array(
'integer',
'integer'),
1866 $result = $ilDB->queryF(
"SELECT test_random_question_id FROM tst_test_rnd_qst WHERE active_fi = %s AND pass = %s",
1867 array(
'integer',
'integer'),
1870 return (
$result->numRows() > 0) ?
true :
false;
1880 $result = $ilDB->queryF(
"SELECT * FROM tst_tests WHERE obj_fi = %s",
1893 include_once(
"./Services/RTE/classes/class.ilRTE.php");
1930 "A" =>
$data->ects_a,
1931 "B" =>
$data->ects_b,
1932 "C" =>
$data->ects_c,
1933 "D" =>
$data->ects_d,
1934 "E" =>
$data->ects_e
1938 $this->mark_schema->flush();
1939 $this->mark_schema->loadFromDb($this->
getTestId());
1999 include_once
"./Services/Object/classes/class.ilObjectActivation.php";
2001 switch($activation[
"timing_type"])
2028 $this->questions =
array();
2031 if (strcmp($active_id,
"") == 0)
2037 $pass = self::_getPass($active_id);
2039 $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.* FROM tst_test_rnd_qst, qpl_questions WHERE tst_test_rnd_qst.active_fi = %s AND qpl_questions.question_id = tst_test_rnd_qst.question_fi AND tst_test_rnd_qst.pass = %s ORDER BY sequence",
2040 array(
'integer',
'integer'),
2049 $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.* FROM tst_test_rnd_qst, qpl_questions WHERE tst_test_rnd_qst.active_fi = %s AND qpl_questions.question_id = tst_test_rnd_qst.question_fi AND tst_test_rnd_qst.pass = 0 ORDER BY sequence",
2057 $result = $ilDB->queryF(
"SELECT tst_test_question.* FROM tst_test_question, qpl_questions WHERE tst_test_question.test_fi = %s AND qpl_questions.question_id = tst_test_question.question_fi ORDER BY sequence",
2059 array($this->test_id)
2065 $this->questions[$index++] =
$data[
"question_fi"];
2093 return (strlen($this->introduction)) ? $this->introduction : NULL;
2118 $this->_finalstatement = $a_statement;
2130 $this->_showinfo = ($a_info) ? 1 : 0;
2142 $this->_forcejs = ($a_js) ? 1 : 0;
2154 $this->_customStyle = $a_customStyle;
2166 return (strlen($this->_customStyle)) ? $this->_customStyle : NULL;
2179 $css_path = str_replace(
"ta.css",
"customstyles", $css_path) .
"/";
2180 $customstyles =
array();
2181 if (is_dir($css_path))
2184 include_once
"./Services/Utilities/classes/class.ilFileUtils.php";
2190 if (strpos($filename,
".css"))
2192 array_push($customstyles, $filename);
2197 return $customstyles;
2212 $custom = str_replace(
"ta.css",
"customstyles/" . $this->
getCustomStyle(), $default);
2213 if (file_exists($custom))
2216 $custom = str_replace(
"ta.css",
"customstyles/" . $this->
getCustomStyle(), $custom);
2239 $this->_showfinalstatement = ($show) ? 1 : 0;
2250 return (strlen($this->_finalstatement)) ? $this->_finalstatement : NULL;
2262 return ($this->_showinfo) ? 1 : 0;
2274 return ($this->_forcejs) ? 1 : 0;
2286 return ($this->_showfinalstatement) ? 1 : 0;
2306 return ($this->ects_output) ? 1 : 0;
2314 $this->ects_output = $a_ects_output ? 1 : 0;
2322 return (strlen($this->ects_fx)) ? $this->ects_fx : NULL;
2330 $this->ects_fx = $a_ects_fx;
2346 $this->ects_grades = $a_ects_grades;
2356 return ($this->sequence_settings) ? $this->sequence_settings : 0;
2406 switch ($instant_feedback)
2409 $this->instant_verification = 1;
2412 $this->instant_verification = 0;
2426 switch ($answer_feedback)
2429 $this->answer_feedback = 1;
2432 $this->answer_feedback = 0;
2444 switch ($generic_answer_feedback)
2447 $this->answer_feedback = 1;
2450 $this->answer_feedback = 0;
2464 switch ($answer_feedback_points)
2467 $this->answer_feedback_points = 1;
2470 $this->answer_feedback_points = 0;
2481 if(!$reporting_date)
2483 $this->reporting_date =
'';
2506 return ($this->score_reporting) ? $this->score_reporting : 0;
2523 return ($this->instant_verification) ? $this->instant_verification : 0;
2536 return ($this->answer_feedback) ? $this->answer_feedback : 0;
2547 return ($this->answer_feedback) ? $this->answer_feedback : 0;
2559 return ($this->answer_feedback_points) ? $this->answer_feedback_points : 0;
2571 return ($this->count_system) ? $this->count_system : 0;
2584 $result = $ilDB->queryF(
"SELECT tst_tests.count_system FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_active.test_fi = tst_tests.test_id",
2591 return $row[
"count_system"];
2605 return ($this->mc_scoring) ? $this->mc_scoring : 0;
2617 return ($this->score_cutting) ? $this->score_cutting : 0;
2629 return ($this->pass_scoring) ? $this->pass_scoring : 0;
2642 $result = $ilDB->queryF(
"SELECT tst_tests.pass_scoring FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
2649 return $row[
"pass_scoring"];
2664 $result = $ilDB->queryF(
"SELECT tst_tests.mc_scoring FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_active.test_fi = tst_tests.test_id",
2671 return $row[
"mc_scoring"];
2686 $result = $ilDB->queryF(
"SELECT tst_tests.score_cutting FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_tests.test_id = tst_active.test_fi",
2693 return $row[
"score_cutting"];
2707 return (strlen($this->reporting_date)) ? $this->reporting_date : NULL;
2719 return ($this->nr_of_tries) ? $this->nr_of_tries : 0;
2731 return ($this->_kiosk) ? $this->_kiosk : 0;
2744 $this->_kiosk = $kiosk;
2756 if (($this->_kiosk & 1) > 0)
2777 $this->_kiosk = $this->_kiosk | 1;
2783 $this->_kiosk = $this->_kiosk ^ 1;
2797 if (($this->_kiosk & 2) > 0)
2817 $this->_kiosk = $this->_kiosk | 2;
2823 $this->_kiosk = $this->_kiosk ^ 2;
2837 if (($this->_kiosk & 4) > 0)
2857 $this->_kiosk = $this->_kiosk | 4;
2863 $this->_kiosk = $this->_kiosk ^ 4;
2877 return ($this->use_previous_answers) ? $this->use_previous_answers : 0;
2889 return ($this->title_output) ? $this->title_output : 0;
2904 $result = $ilDB->queryF(
"SELECT tst_tests.title_output FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
2911 return $row[
"title_output"];
2920 return self::_getUsePreviousAnswers($activeId,
true);
2938 $use_previous_answers = 1;
2940 $result = $ilDB->queryF(
"SELECT tst_tests.use_previous_answers FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
2947 $use_previous_answers =
$row[
"use_previous_answers"];
2950 if ($use_previous_answers == 1)
2952 if ($user_active_user_setting)
2954 $res = $ilUser->getPref(
"tst_use_previous_answers");
2957 $use_previous_answers =
$res;
2973 return (strlen($this->processing_time)) ? $this->processing_time : NULL;
2984 if (strlen($this->processing_time))
2986 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches))
2988 if ((
int)$matches[1]+(
int)$matches[2]+(
int)$matches[3] == 0)
2995 'hh' => $matches[1],
2996 'mm' => $matches[2],
2997 'ss' => $matches[3],
3007 if (strlen($this->processing_time))
3009 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches))
3011 return ($matches[1] * 60) + $matches[2];
3015 return self::DEFAULT_PROCESSING_TIME_MINUTES;
3027 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $this->
getProcessingTime(), $matches))
3030 return ($matches[1] * 3600) + ($matches[2] * 60) + $matches[3] + $extratime;
3051 return $ending - $now;
3068 return ($this->enable_processing_time) ? $this->enable_processing_time : 0;
3080 return ($this->reset_processing_time) ? $this->reset_processing_time : 0;
3108 return ($this->starting_time != 0) ? $this->starting_time : 0;
3148 return ($this->ending_time != 0) ? $this->ending_time : 0;
3184 if ($use_previous_answers)
3186 $this->use_previous_answers = 1;
3190 $this->use_previous_answers = 0;
3220 switch ($title_output)
3223 $this->title_output = 1;
3226 $this->title_output = 2;
3229 $this->title_output = 0;
3248 $this->processing_time = sprintf(
"%02d:%02d:00", floor($minutes/60), $minutes%60);
3261 $this->enable_processing_time =
"1";
3263 $this->enable_processing_time =
"0";
3278 $this->reset_processing_time = 1;
3282 $this->reset_processing_time = 0;
3295 $this->count_system = $a_count_system;
3323 return (strlen($this->password)) ? $this->password : NULL;
3335 $this->password = $a_password;
3347 $this->score_cutting = $a_score_cutting;
3359 $this->mc_scoring = $a_mc_scoring;
3371 switch ($a_pass_scoring)
3414 foreach ($removeQuestionIds as $value) {
3431 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3436 $question->delete($question_id);
3454 require_once
'Modules/Test/classes/class.ilTestParticipantData.php';
3456 $participantData->setUserIds($userIds);
3457 $participantData->load($this->
getTestId());
3472 require_once
'Services/Object/classes/class.ilObjectLP.php';
3474 $testLP->setTestObject($this);
3475 $testLP->resetLPDataForUserIds($participantData->
getUserIds(),
false);
3488 require_once
'Modules/Test/classes/class.ilTestParticipantData.php';
3490 $participantData->setUserIds($userIds);
3491 $participantData->load($this->
getTestId());
3493 $IN_userIds = $ilDB->in(
'usr_id', $participantData->getUserIds(),
false,
'integer');
3494 $ilDB->manipulateF(
"DELETE FROM usr_pref WHERE $IN_userIds AND keyword = %s",
3498 if( count($participantData->getActiveIds()) )
3508 $IN_activeIds = $ilDB->in(
'active_fi', $activeIds,
false,
'integer');
3510 $ilDB->manipulate(
"DELETE FROM tst_solutions WHERE $IN_activeIds");
3511 $ilDB->manipulate(
"DELETE FROM tst_qst_solved WHERE $IN_activeIds");
3512 $ilDB->manipulate(
"DELETE FROM tst_test_result WHERE $IN_activeIds");
3513 $ilDB->manipulate(
"DELETE FROM tst_pass_result WHERE $IN_activeIds");
3514 $ilDB->manipulate(
"DELETE FROM tst_result_cache WHERE $IN_activeIds");
3515 $ilDB->manipulate(
"DELETE FROM tst_sequence WHERE $IN_activeIds");
3516 $ilDB->manipulate(
"DELETE FROM tst_times WHERE $IN_activeIds");
3520 $ilDB->manipulate(
"DELETE FROM tst_test_rnd_qst WHERE $IN_activeIds");
3524 $ilDB->manipulate(
"DELETE FROM tst_seq_qst_tracking WHERE $IN_activeIds");
3525 $ilDB->manipulate(
"DELETE FROM tst_seq_qst_answstatus WHERE $IN_activeIds");
3526 $ilDB->manipulate(
"DELETE FROM tst_seq_qst_postponed WHERE $IN_activeIds");
3527 $ilDB->manipulate(
"DELETE FROM tst_seq_qst_checked WHERE $IN_activeIds");
3530 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3532 foreach ($activeIds as $active_id)
3535 if (@is_dir(CLIENT_WEB_DIR .
"/assessment/tst_" . $this->
getTestId() .
"/$active_id"))
3546 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
3554 $IN_activeIds = $ilDB->in(
'active_id', $activeIds,
false,
'integer');
3555 $ilDB->manipulate(
"DELETE FROM tst_active WHERE $IN_activeIds");
3570 $result = $ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
3571 array(
'integer',
'integer'),
3575 if (
$data->sequence > 1)
3578 $result = $ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
3579 array(
'integer',
'integer'),
3582 $data_previous = $ilDB->fetchObject(
$result);
3584 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
3585 array(
'integer',
'integer'),
3586 array(
$data->sequence, $data_previous->test_question_id)
3589 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
3590 array(
'integer',
'integer'),
3593 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3614 $result = $ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
3615 array(
'integer',
'integer'),
3619 $result = $ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
3620 array(
'integer',
'integer'),
3626 $data_next = $ilDB->fetchObject(
$result);
3628 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
3629 array(
'integer',
'integer'),
3630 array(
$data->sequence, $data_next->test_question_id)
3633 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
3634 array(
'integer',
'integer'),
3637 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3657 $duplicate_id = $question->duplicate(
true, null, null, null, $this->
getId());
3659 return $duplicate_id;
3673 #var_dump($question_id); 3676 $duplicate_id = $question_id;
3684 $result = $ilDB->queryF(
"SELECT MAX(sequence) seq FROM tst_test_question WHERE test_fi=%s",
3693 $sequence =
$data->seq + 1;
3696 $next_id = $ilDB->nextId(
'tst_test_question');
3697 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_test_question (test_question_id, test_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
3698 array(
'integer',
'integer',
'integer',
'integer',
'integer'),
3701 if ($affectedRows == 1)
3703 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3710 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_active WHERE test_fi = %s",
3716 return $duplicate_id;
3732 $result = $ilDB->queryF(
"SELECT qpl_questions.title FROM tst_test_question, qpl_questions WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id ORDER BY tst_test_question.sequence",
3738 array_push($titles,
$row[
"title"]);
3757 $result = $ilDB->queryF(
"SELECT qpl_questions.title, qpl_questions.question_id FROM tst_test_question, qpl_questions WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id ORDER BY tst_test_question.sequence",
3763 $titles[
$row[
'question_id']] = $row[
"title"];
3791 return $this->lng->txt(
"ass_question").
' ' . $nr;
3795 return $this->lng->txt(
"ass_question");
3818 $result = $ilDB->queryF(
"SELECT qpl_questions.*, qpl_qst_type.type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
3837 $existing_questions =
array();
3842 $result = $ilDB->queryF(
"SELECT qpl_questions.original_id FROM qpl_questions, tst_test_rnd_qst WHERE tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.question_fi = qpl_questions.question_id AND tst_test_rnd_qst.pass = %s",
3843 array(
'integer',
'integer'),
3849 $result = $ilDB->queryF(
"SELECT qpl_questions.original_id FROM qpl_questions, tst_test_question WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id",
3856 if(
$data->original_id === null )
3861 array_push($existing_questions,
$data->original_id);
3863 return $existing_questions;
3877 if ($question_id < 1)
return -1;
3878 $result = $ilDB->queryF(
"SELECT type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
3885 return $data->type_tag;
3903 $next_id = $ilDB->nextId(
'tst_times');
3904 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_times (times_id, active_fi, started, finished, pass, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
3905 array(
'integer',
'integer',
'timestamp',
'timestamp',
'integer',
'integer'),
3906 array($next_id, $active_id, strftime(
"%Y-%m-%d %H:%M:%S"), strftime(
"%Y-%m-%d %H:%M:%S"),
$pass,
time())
3921 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_times SET finished = %s, tstamp = %s WHERE times_id = %s",
3922 array(
'timestamp',
'integer',
'integer'),
3923 array(strftime(
"%Y-%m-%d %H:%M:%S"),
time(), $times_id)
3940 $result = $ilDB->queryF(
"SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
3941 array(
'integer',
'integer'),
3942 array($active_id, 0)
3947 $result = $ilDB->queryF(
"SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
3948 array(
'integer',
'integer'),
3952 $result_array =
array();
3955 array_push($result_array,
$row[
"question_fi"]);
3957 return $result_array;
3971 return ((($currentpass > 0) && ($num == 0)) || $this->
isTestFinished($active_id)) ? true :
false;
3985 $result_array =
array();
3990 if (count($this->questions) == 0)
return $result_array;
3993 $pass = self::_getPass($active_id);
3995 $result = $ilDB->queryF(
"SELECT qpl_questions.* FROM qpl_questions, tst_test_rnd_qst WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id AND tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.pass = %s AND " . $ilDB->in(
'qpl_questions.question_id', $this->questions,
false,
'integer'),
3996 array(
'integer',
'integer'),
4002 if (count($this->questions) == 0)
return $result_array;
4003 $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'));
4007 $result_array[
$row[
"question_id"]] =
$row;
4009 return $result_array;
4025 if (!$user_id) $user_id = $ilUser->getId();
4028 $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
4029 array(
'integer',
'integer',
'text'),
4033 else if (strlen($anonymous_id))
4035 $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
4036 array(
'integer',
'integer',
'text'),
4037 array($user_id, $this->test_id, $anonymous_id)
4042 if (
$GLOBALS[
'DIC'][
'ilUser']->
getId() == ANONYMOUS_USER_ID)
4046 $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
4047 array(
'integer',
'integer'),
4048 array($user_id, $this->test_id)
4054 return $row[
"active_id"];
4076 $user_id = $ilUser->id;
4082 $result = $ilDB->queryF(
"SELECT tst_active.active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
4083 array(
'integer',
'integer'),
4084 array($user_id, $test_id)
4089 return $row[
"active_id"];
4105 $keys = array_keys($array);
4108 foreach ($keys as $key)
4122 function &
getTestResult($active_id,
$pass = NULL, $ordered_sequence = FALSE, $considerHiddenQuestions =
true, $considerOptionalQuestions =
true)
4124 global $tree,
$ilDB,
$lng, $ilPluginAdmin;
4128 if( is_null(
$pass) )
4133 require_once
'Modules/Test/classes/class.ilTestSessionFactory.php';
4135 $testSession = $testSessionFactory->getSession($active_id);
4137 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
4139 $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($active_id,
$pass);
4143 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
4145 $dynamicQuestionSetConfig->loadFromDb();
4147 $testSequence->loadFromDb($dynamicQuestionSetConfig);
4150 $sequence = $testSequence->getUserSequenceQuestions();
4154 $testSequence->setConsiderHiddenQuestionsEnabled($considerHiddenQuestions);
4155 $testSequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions);
4157 $testSequence->loadFromDb();
4158 $testSequence->loadQuestions();
4160 if( $ordered_sequence )
4162 $sequence = $testSequence->getOrderedSequenceQuestions();
4166 $sequence = $testSequence->getUserSequenceQuestions();
4170 $arrResults =
array();
4173 SELECT tst_test_result.question_fi, 4174 tst_test_result.points reached, 4175 tst_test_result.hint_count requested_hints, 4176 tst_test_result.hint_points hint_points, 4177 tst_test_result.answered answered 4179 FROM tst_test_result 4181 LEFT JOIN tst_solutions 4182 ON tst_solutions.active_fi = tst_test_result.active_fi 4183 AND tst_solutions.question_fi = tst_test_result.question_fi 4185 WHERE tst_test_result.active_fi = %s 4186 AND tst_test_result.pass = %s 4189 $solutionresult = $ilDB->queryF(
4193 while(
$row = $ilDB->fetchAssoc($solutionresult) )
4195 $arrResults[
$row[
'question_fi'] ] =
$row;
4198 $numWorkedThrough = count($arrResults);
4200 require_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
4202 $IN_question_ids = $ilDB->in(
'qpl_questions.question_id', $sequence,
false,
'integer');
4205 SELECT qpl_questions.*, 4206 qpl_qst_type.type_tag, 4207 qpl_sol_sug.question_fi has_sug_sol 4212 LEFT JOIN qpl_sol_sug 4213 ON qpl_sol_sug.question_fi = qpl_questions.question_id 4215 WHERE qpl_qst_type.question_type_id = qpl_questions.question_type_fi 4216 AND $IN_question_ids 4221 $unordered =
array();
4225 $obligationsAnswered =
true;
4230 $row[
'points'] ? $arrResults[
$row[
'question_id'] ][
'reached'] /
$row[
'points'] : 0
4233 if( $percentvalue < 0 ) $percentvalue = 0.0;
4238 "max" => round(
$row[
'points'], 2),
4239 "reached" => round($arrResults[
$row[
'question_id']][
'reached'],2),
4240 'requested_hints' => $arrResults[$row[
'question_id']][
'requested_hints'],
4241 'hint_points' => $arrResults[$row[
'question_id']][
'hint_points'],
4242 "percent" => sprintf(
"%2.2f ", ($percentvalue) * 100) .
"%",
4244 "type" => $row[
"type_tag"],
4245 "qid" => $row[
'question_id'],
4246 "original_id" => $row[
"original_id"],
4247 "workedthrough" => isset($arrResults[$row[
'question_id']]) ? 1 : 0,
4248 'answered' => $arrResults[$row[
'question_id']][
'answered']
4251 if( !$arrResults[ $row[
'question_id'] ][
'answered'] )
4253 $obligationsAnswered =
false;
4256 $unordered[ $row[
'question_id'] ] =
$data;
4261 $numQuestionsTotal = count($unordered);
4265 $pass_requested_hints = 0;
4266 $pass_hint_points = 0;
4271 foreach( $sequence as $qid )
4275 $pass_max += round($unordered[$qid][
'max'], 2);
4276 $pass_reached += round($unordered[$qid][
'reached'], 2);
4277 $pass_requested_hints += $unordered[$qid][
'requested_hints'];
4278 $pass_hint_points += $unordered[$qid][
'hint_points'];
4282 $unordered[$qid][
'nr'] = $key;
4283 array_push($found, $unordered[$qid]);
4293 if(
$results[
'reached_points'] < 0 )
4298 if( $pass_reached < 0 ) $pass_reached = 0;
4301 $found[
'pass'][
'total_max_points'] = $pass_max;
4302 $found[
'pass'][
'total_reached_points'] = $pass_reached;
4303 $found[
'pass'][
'total_requested_hints'] = $pass_requested_hints;
4304 $found[
'pass'][
'total_hint_points'] = $pass_hint_points;
4305 $found[
'pass'][
'percent'] = ($pass_max > 0) ? $pass_reached / $pass_max : 0;
4306 $found[
'pass'][
'obligationsAnswered'] = $obligationsAnswered;
4307 $found[
'pass'][
'num_workedthrough'] = $numWorkedThrough;
4308 $found[
'pass'][
'num_questions_total'] = $numQuestionsTotal;
4310 $found[
"test"][
"total_max_points"] =
$results[
'max_points'];
4311 $found[
"test"][
"total_reached_points"] =
$results[
'reached_points'];
4312 $found[
"test"][
"total_requested_hints"] =
$results[
'hint_count'];
4313 $found[
"test"][
"total_hint_points"] =
$results[
'hint_points'];
4314 $found[
"test"][
"result_pass"] =
$results[
'pass'];
4315 $found[
'test'][
'result_tstamp'] =
$results[
'tstamp'];
4316 $found[
'test'][
'obligations_answered'] =
$results[
'obligations_answered'];
4318 if( (!$total_reached_points)
or (!$total_max_points) )
4324 $percentage = ($total_reached_points / $total_max_points) * 100.0;
4326 if( $percentage < 0 ) $percentage = 0.0;
4329 $found[
"test"][
"passed"] =
$results[
'passed'];
4344 $result = $ilDB->queryF(
"SELECT COUNT(active_id) total FROM tst_active WHERE test_fi = %s",
4349 return $row[
"total"];
4362 $result = $ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi AND tst_active.user_fi = %s",
4363 array(
'integer',
'integer'),
4369 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4370 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4371 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4372 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4373 $time += ($epoch_2 - $epoch_1);
4400 $result = $ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi ORDER BY tst_times.active_fi, tst_times.started",
4408 if (!array_key_exists(
$row[
"active_fi"], $times))
4410 $times[
$row[
"active_fi"]] = 0;
4412 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4413 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4414 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4415 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4416 $times[
$row[
"active_fi"]] += ($epoch_2 - $epoch_1);
4431 $result = $ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi AND tst_active.active_id = %s ORDER BY tst_times.active_fi, tst_times.started",
4432 array(
'integer',
'integer'),
4438 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4439 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4440 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4441 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4442 $time += ($epoch_2 - $epoch_1);
4457 $result = $ilDB->queryF(
"SELECT * FROM tst_times WHERE active_fi = %s AND pass = %s ORDER BY started",
4458 array(
'integer',
'integer'),
4464 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4465 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4466 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4467 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4468 $time += ($epoch_2 - $epoch_1);
4497 $result = $ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi AND tst_active.active_id = %s ORDER BY tst_times.started",
4498 array(
'integer',
'integer'),
4499 array($test_id, $active_id)
4505 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4506 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4507 if ($firstvisit == 0 || $epoch_1 < $firstvisit) $firstvisit = $epoch_1;
4508 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4509 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4510 if ($epoch_2 > $lastvisit) $lastvisit = $epoch_2;
4512 return array(
"firstvisit" => $firstvisit,
"lastvisit" => $lastvisit);
4527 $result = $ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.active_id = %s AND tst_active.active_id = tst_times.active_fi",
4536 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row->started, $matches);
4537 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4538 if (!$first_visit) {
4539 $first_visit = $epoch_1;
4541 if ($epoch_1 < $first_visit) {
4542 $first_visit = $epoch_1;
4544 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row->finished, $matches);
4545 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4547 $last_visit = $epoch_2;
4549 if ($epoch_2 > $last_visit) {
4550 $last_visit = $epoch_2;
4552 $times[
$row->active_fi] += ($epoch_2 - $epoch_1);
4555 foreach ($times as $key => $value) {
4556 $max_time += $value;
4558 if ((!$test_result[
"test"][
"total_reached_points"])
or (!$test_result[
"test"][
"total_max_points"]))
4564 $percentage = ($test_result[
"test"][
"total_reached_points"] / $test_result[
"test"][
"total_max_points"]) * 100.0;
4565 if ($percentage < 0) $percentage = 0.0;
4567 $mark_obj = $this->mark_schema->getMatchingMark($percentage);
4568 $first_date = getdate($first_visit);
4569 $last_date = getdate($last_visit);
4570 $qworkedthrough = 0;
4571 foreach ($test_result as $key => $value)
4573 if (preg_match(
"/\d+/", $key))
4575 $qworkedthrough += $value[
"workedthrough"];
4578 if (!$qworkedthrough)
4584 $atimeofwork = $max_time / $qworkedthrough;
4587 $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
4594 $result_mark = $mark_obj->getShortName();
4596 if( $mark_obj->getPassed() && $obligationsAnswered )
4605 $percent_worked_through = 0;
4606 if (count($this->questions))
4608 $percent_worked_through = $qworkedthrough / count($this->questions);
4610 $result_array =
array(
4611 "qworkedthrough" => $qworkedthrough,
4612 "qmax" => count($this->questions),
4613 "pworkedthrough" => $percent_worked_through,
4614 "timeofwork" => $max_time,
4615 "atimeofwork" => $atimeofwork,
4616 "firstvisit" => $first_date,
4617 "lastvisit" => $last_date,
4618 "resultspoints" => $test_result[
"test"][
"total_reached_points"],
4619 "maxpoints" => $test_result[
"test"][
"total_max_points"],
4620 "resultsmarks" => $result_mark,
4621 "passed" => $passed,
4622 "distancemedian" =>
"0" 4624 foreach ($test_result as $key => $value)
4626 if (preg_match(
"/\d+/", $key))
4628 $result_array[$key] = $value;
4631 return $result_array;
4643 $totalpoints_array =
array();
4645 foreach ($all_users as $active_id => $user_name)
4648 $reached = $test_result[
"test"][
"total_reached_points"];
4649 $total = $test_result[
"test"][
"total_max_points"];
4651 $mark = $this->mark_schema->getMatchingMark($percentage*100.0);
4653 $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
4657 if( $mark->getPassed() && $obligationsAnswered )
4659 array_push($totalpoints_array, $test_result[
"test"][
"total_reached_points"]);
4663 return $totalpoints_array;
4674 $result = $ilDB->queryF(
"SELECT tst_active.active_id, usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login FROM tst_active LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id WHERE tst_active.test_fi = %s ORDER BY usr_data.lastname ASC",
4678 $persons_array =
array();
4681 $name = $this->lng->txt(
"anonymous");
4682 $fullname = $this->lng->txt(
"anonymous");
4686 if (strlen(
$row[
"firstname"].
$row[
"lastname"].
$row[
"title"]) == 0)
4688 $name = $this->lng->txt(
"deleted_user");
4689 $fullname = $this->lng->txt(
"deleted_user");
4690 $login = $this->lng->txt(
"unknown");
4694 $login = $row[
"login"];
4695 if ($row[
"user_fi"] == ANONYMOUS_USER_ID)
4697 $name = $this->lng->txt(
"anonymous");
4698 $fullname = $this->lng->txt(
"anonymous");
4702 $name = trim($row[
"lastname"] .
", " . $row[
"firstname"] .
" " . $row[
"title"]);
4703 $fullname = trim($row[
"title"] .
" " . $row[
"firstname"] .
" " . $row[
"lastname"]);
4707 $persons_array[
$row[
"active_id"]] =
array(
4709 "fullname" => $fullname,
4713 return $persons_array;
4725 $result = $ilDB->queryF(
"SELECT tst_active.active_id, usr_data.firstname, usr_data.lastname, usr_data.title FROM tst_active LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id WHERE tst_active.test_fi = %s ORDER BY usr_data.lastname " . strtoupper($name_sort_order),
4729 $persons_array =
array();
4734 $persons_array[
$row[
"active_id"]] = $this->lng->txt(
"anonymous");
4738 if (strlen(
$row[
"firstname"].
$row[
"lastname"].
$row[
"title"]) == 0)
4740 $persons_array[$row[
"active_id"]] = $this->lng->txt(
"deleted_user");
4744 if ($row[
"user_fi"] == ANONYMOUS_USER_ID)
4746 $persons_array[$row[
"active_id"]] = $row[
"lastname"];
4750 $persons_array[$row[
"active_id"]] = trim($row[
"lastname"] .
", " . $row[
"firstname"] .
" " . $row[
"title"]);
4755 return $persons_array;
4767 $result = $ilDB->queryF(
"SELECT tst_active.active_id, usr_data.login, usr_data.firstname, usr_data.lastname, usr_data.title FROM tst_active LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id WHERE tst_active.test_fi = %s ORDER BY usr_data.lastname " . strtoupper($name_sort_order),
4771 $persons_array =
array();
4776 $persons_array[
$row[
"active_id"]] =
array(
"name" => $this->lng->txt(
"anonymous"));
4780 if (strlen(
$row[
"firstname"].
$row[
"lastname"].
$row[
"title"]) == 0)
4782 $persons_array[$row[
"active_id"]] =
array(
"name" => $this->lng->txt(
"deleted_user"));
4786 if ($row[
"user_fi"] == ANONYMOUS_USER_ID)
4788 $persons_array[$row[
"active_id"]] =
array(
"name" => $row[
"lastname"]);
4792 $persons_array[$row[
"active_id"]] =
array(
"name" => trim($row[
"lastname"] .
", " . $row[
"firstname"] .
" " . $row[
"title"]),
"login" => $row[
"login"]);
4797 return $persons_array;
4810 $result = $ilDB->queryF(
"SELECT COUNT(active_id) total FROM tst_active WHERE test_fi = %s AND submitted = %s",
4811 array(
'integer',
'integer'),
4815 return $row[
"total"];
4830 $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
4831 "tst_test_rnd_qst.pass, qpl_questions.points " .
4832 "FROM tst_test_rnd_qst, qpl_questions " .
4833 "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
4834 "AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence",
4841 $result = $ilDB->queryF(
"SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
4842 "qpl_questions.points " .
4843 "FROM tst_test_question, tst_active, qpl_questions " .
4844 "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
4845 "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
4855 array_push($qtest,
$row);
4873 $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
4874 "qpl_questions.points " .
4875 "FROM tst_test_rnd_qst, qpl_questions " .
4876 "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
4877 "AND tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.pass = %s " .
4878 "ORDER BY tst_test_rnd_qst.sequence",
4879 array(
'integer',
'integer'),
4885 $result = $ilDB->queryF(
"SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
4886 "qpl_questions.points " .
4887 "FROM tst_test_question, tst_active, qpl_questions " .
4888 "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
4889 "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
4899 array_push($qpass,
$row);
4905 function getUnfilteredEvaluationData()
4910 $ilDB = $DIC->database();
4912 include_once
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
4913 include_once
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
4914 include_once
"./Modules/Test/classes/class.ilTestEvaluationData.php";
4919 SELECT tst_test_result.*, 4920 qpl_questions.original_id, 4921 qpl_questions.title questiontitle, 4922 qpl_questions.points maxpoints 4924 FROM tst_test_result, qpl_questions, tst_active 4926 WHERE tst_active.active_id = tst_test_result.active_fi 4927 AND qpl_questions.question_id = tst_test_result.question_fi 4928 AND tst_active.test_fi = %s 4930 ORDER BY tst_active.active_id ASC, tst_test_result.pass ASC, tst_test_result.tstamp DESC 4944 $participantObject =
$data->getParticipant(
$row[
"active_fi"]);
4951 $passObject = $participantObject->getPass(
$row[
"pass"]);
4958 $passObject->addAnsweredQuestion(
4963 foreach( array_keys(
$data->getParticipants()) as $active_id )
4967 for( $testpass = 0; $testpass <=
$data->getParticipant($active_id)->getLastPass(); $testpass++ )
4970 $result =
$ilDB->queryF(
"SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, qpl_questions.original_id, " .
4971 "tst_test_rnd_qst.pass, qpl_questions.points, qpl_questions.title " .
4972 "FROM tst_test_rnd_qst, qpl_questions " .
4973 "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
4974 "AND tst_test_rnd_qst.pass = %s " .
4975 "AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence",
4976 array(
'integer',
'integer'),
4977 array($testpass, $active_id)
4983 $tpass = array_key_exists(
"pass",
$row) ?
$row[
"pass"] : 0;
4984 $data->getParticipant($active_id)->addQuestion(
$row[
"original_id"],
$row[
"question_fi"],
$row[
"points"],
$row[
"sequence"], $tpass);
4985 $data->addQuestionTitle(
$row[
"question_fi"],
$row[
"title"]);
4992 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
4993 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
4994 require_once
'Modules/Test/classes/class.ilTestDynamicQuestionSetFilterSelection.php';
4996 $lastPass =
$data->getParticipant($active_id)->getLastPass();
4997 for($testpass = 0; $testpass <= $lastPass; $testpass++)
4999 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
5001 $DIC->repositoryTree(), $DIC->database(), $DIC[
'ilPluginAdmin'], $this
5005 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
5006 $testSequenceFactory =
new ilTestSequenceFactory($DIC->database(), $DIC->language(), $DIC[
'ilPluginAdmin'], $this);
5009 $testSequence->loadFromDb($dynamicQuestionSetConfig);
5012 $sequence = (
array)$testSequence->getUserSequenceQuestions();
5014 $questionsIdsToRequest = array_diff(array_values($sequence), array_values($questionData));
5015 if(count($questionsIdsToRequest) > 0)
5017 $questionIdsCondition =
' ' . $DIC->database()->in(
'question_id', array_values($questionsIdsToRequest),
false,
'integer') .
' ';
5019 $res = $DIC->database()->queryF(
" 5022 WHERE {$questionIdsCondition}",
5026 while(
$row = $DIC->database()->fetchAssoc(
$res))
5028 $questionData[
$row[
'question_id']] =
$row;
5029 $data->addQuestionTitle($row[
'question_id'], $row[
'title']);
5033 foreach($sequence as $questionId)
5035 if(!isset($questionData[$questionId]))
5040 $row = $questionData[$questionId];
5042 $data->getParticipant(
5043 $active_id)->addQuestion(
$row[
'original_id'],
$row[
'question_id'],
$row[
'points'],
5051 $result =
$ilDB->queryF(
"SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
5052 "qpl_questions.points, qpl_questions.title, qpl_questions.original_id " .
5053 "FROM tst_test_question, tst_active, qpl_questions " .
5054 "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
5055 "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi ORDER BY tst_test_question.sequence",
5061 $questionsbysequence =
array();
5065 $questionsbysequence[
$row[
"sequence"]] =
$row;
5068 $seqresult =
$ilDB->queryF(
"SELECT * FROM tst_sequence WHERE active_fi = %s",
5073 while ($seqrow =
$ilDB->fetchAssoc($seqresult))
5075 $questionsequence = unserialize($seqrow[
"sequence"]);
5076 foreach ($questionsequence as $sidx => $seq)
5078 $data->getParticipant($active_id)->addQuestion($questionsbysequence[$seq][
"original_id"], $questionsbysequence[$seq][
"question_fi"], $questionsbysequence[$seq][
"points"], $sidx + 1, $seqrow[
"pass"]);
5079 $data->addQuestionTitle($questionsbysequence[$seq][
"question_fi"], $questionsbysequence[$seq][
"title"]);
5091 foreach( array_keys(
$data->getParticipants()) as $active_id )
5093 $tstUserData =
$data->getParticipant($active_id);
5095 $percentage = $tstUserData->getReachedPointsInPercent();
5097 $obligationsAnswered = $tstUserData->areObligationsAnswered();
5099 $mark = $this->mark_schema->getMatchingMark($percentage);
5101 if (is_object($mark))
5103 $tstUserData->setMark($mark->getShortName());
5104 $tstUserData->setMarkOfficial($mark->getOfficialName());
5106 $tstUserData->setPassed(
5107 $mark->getPassed() && $tstUserData->areObligationsAnswered()
5114 $passed_array, $tstUserData->getReached(), $tstUserData->getMaxPoints()
5117 $tstUserData->setECTSMark($ects_mark);
5122 $tstUserData->setFirstVisit($visitingTime[
"firstvisit"]);
5123 $tstUserData->setLastVisit($visitingTime[
"lastvisit"]);
5139 $res = $ilDB->queryF(
" 5140 SELECT COUNT(qpl_questions.question_id) qcount, 5141 SUM(qpl_questions.points) qsum 5143 INNER JOIN tst_tests 5144 ON tst_tests.test_id = tst_active.test_fi 5145 INNER JOIN tst_dyn_quest_set_cfg 5146 ON tst_dyn_quest_set_cfg.test_fi = tst_tests.test_id 5147 INNER JOIN qpl_questions 5148 ON qpl_questions.obj_fi = tst_dyn_quest_set_cfg.source_qpl_fi 5149 AND qpl_questions.original_id IS NULL 5150 AND qpl_questions.complete = %s 5151 WHERE tst_active.active_id = %s 5153 array(
'integer',
'integer'),
5154 array(1, $active_id)
5161 $res = $ilDB->queryF(
" 5162 SELECT tst_test_rnd_qst.pass, 5163 COUNT(tst_test_rnd_qst.question_fi) qcount, 5164 SUM(qpl_questions.points) qsum 5166 FROM tst_test_rnd_qst, 5169 WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id 5170 AND tst_test_rnd_qst.active_fi = %s 5173 GROUP BY tst_test_rnd_qst.active_fi, 5174 tst_test_rnd_qst.pass 5176 array(
'integer',
'integer'),
5184 $res = $ilDB->queryF(
" 5185 SELECT COUNT(tst_test_question.question_fi) qcount, 5186 SUM(qpl_questions.points) qsum 5188 FROM tst_test_question, 5192 WHERE tst_test_question.question_fi = qpl_questions.question_id 5193 AND tst_test_question.test_fi = tst_active.test_fi 5194 AND tst_active.active_id = %s 5196 GROUP BY tst_test_question.test_fi 5206 throw new ilTestException(
"not supported question set type: $questionSetType");
5211 if( is_array(
$row) )
5213 return array(
"count" =>
$row[
"qcount"],
"points" =>
$row[
"qsum"]);
5216 return array(
"count" => 0,
"points" => 0);
5221 include_once
"./Modules/Test/classes/class.ilTestEvaluationData.php";
5222 include_once
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
5223 include_once
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
5224 $data = $this->getUnfilteredEvaluationData();
5225 if ($withStatistics)
5227 $data->calculateStatistics();
5229 $data->setFilter($filterby, $filtertext);
5254 $result = $ilDB->queryF(
"SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
5255 "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
5256 "qpl_questions.points maxpoints " .
5257 "FROM tst_test_result, qpl_questions, tst_active " .
5258 "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
5259 "WHERE tst_active.active_id = tst_test_result.active_fi " .
5260 "AND qpl_questions.question_id = tst_test_result.question_fi " .
5261 "AND tst_active.test_fi = %s " .
5262 "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
5266 $overview =
array();
5269 if (!array_key_exists(
$row[
"active_fi"], $overview))
5272 $overview[$row[
"active_fi"]][
"firstname"] = $row[
"firstname"];
5273 $overview[$row[
"active_fi"]][
"lastname"] = $row[
"lastname"];
5274 $overview[$row[
"active_fi"]][
"title"] = $row[
"title"];
5275 $overview[$row[
"active_fi"]][
"login"] = $row[
"login"];
5276 $overview[$row[
"active_fi"]][
"usr_id"] = $row[
"usr_id"];
5277 $overview[$row[
"active_fi"]][
"started"] = $row[
"started"];
5278 $overview[$row[
"active_fi"]][
"finished"] = $row[
"finished"];
5280 if (!array_key_exists(
$row[
"pass"], $overview[
$row[
"active_fi"]]))
5282 $overview[$row[
"active_fi"]][$row[
"pass"]] =
array();
5283 $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] = 0;
5284 $overview[$row[
"active_fi"]][$row[
"pass"]][
"maxpoints"] = $row[
"maxpoints"];
5286 array_push($overview[$row[
"active_fi"]][$row[
"pass"]], $row);
5287 $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] += $row[
"points"];
5303 $result = $ilDB->queryF(
"SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
5304 "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
5305 "qpl_questions.points maxpoints " .
5306 "FROM tst_test_result, qpl_questions, tst_active " .
5307 "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
5308 "WHERE tst_active.active_id = tst_test_result.active_fi " .
5309 "AND qpl_questions.question_id = tst_test_result.question_fi " .
5310 "AND tst_active.test_fi = %s AND tst_active.active_id = %s" .
5311 "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
5312 array(
'integer',
'integer'),
5315 $overview =
array();
5318 if (!array_key_exists(
$row[
"active_fi"], $overview))
5321 $overview[$row[
"active_fi"]][
"firstname"] = $row[
"firstname"];
5322 $overview[$row[
"active_fi"]][
"lastname"] = $row[
"lastname"];
5323 $overview[$row[
"active_fi"]][
"title"] = $row[
"title"];
5324 $overview[$row[
"active_fi"]][
"login"] = $row[
"login"];
5325 $overview[$row[
"active_fi"]][
"usr_id"] = $row[
"usr_id"];
5326 $overview[$row[
"active_fi"]][
"started"] = $row[
"started"];
5327 $overview[$row[
"active_fi"]][
"finished"] = $row[
"finished"];
5329 if (!array_key_exists(
$row[
"pass"], $overview[
$row[
"active_fi"]]))
5331 $overview[$row[
"active_fi"]][$row[
"pass"]] =
array();
5332 $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] = 0;
5333 $overview[$row[
"active_fi"]][$row[
"pass"]][
"maxpoints"] = $row[
"maxpoints"];
5335 array_push($overview[$row[
"active_fi"]][$row[
"pass"]], $row);
5336 $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] += $row[
"points"];
5355 if (strlen($firstname.$lastname.$title) == 0)
5357 $name = $this->lng->txt(
"deleted_user");
5361 if ($user_id == ANONYMOUS_USER_ID)
5367 $name = trim($lastname .
", " . $firstname .
" " .
$title);
5371 $name = $this->lng->txt(
"anonymous");
5393 if (strlen($firstname.$lastname.$title) == 0)
5395 $name = $lng->txt(
"deleted_user");
5399 if ($user_id == ANONYMOUS_USER_ID)
5405 $name = trim($lastname .
", " . $firstname .
" " .
$title);
5409 $name = $lng->txt(
"anonymous");
5425 $result = $ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi",
5432 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row->started, $matches);
5433 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
5434 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row->finished, $matches);
5435 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
5436 $times[
$row->active_fi] += ($epoch_2 - $epoch_1);
5440 foreach ($times as $key => $value)
5442 $max_time += $value;
5447 $average_time = round($max_time /
$counter);
5453 return $average_time;
5462 function &
getAvailableQuestionpools($use_object_id =
false, $equal_points =
false, $could_be_offline =
false, $show_path = FALSE, $with_questioncount = FALSE, $permission =
"read")
5464 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
5476 $time_in_seconds = 0;
5477 foreach ($this->questions as $question_id)
5480 $est_time = $question->getEstimatedWorkingTime();
5481 $time_in_seconds += $est_time[
"h"] * 3600 + $est_time[
"m"] * 60 + $est_time[
"s"];
5483 $hours = (int)($time_in_seconds / 3600) ;
5484 $time_in_seconds = $time_in_seconds - ($hours * 3600);
5485 $minutes = (int)($time_in_seconds / 60);
5486 $time_in_seconds = $time_in_seconds - ($minutes * 60);
5487 $result =
array(
"hh" => $hours,
"mm" => $minutes,
"ss" => $time_in_seconds);
5499 return CLIENT_WEB_DIR .
"/assessment/" . $this->
getId() .
"/images/";
5510 include_once
"./Services/Utilities/classes/class.ilUtil.php";
5525 if ((!$question_type)
and ($question_id > 0))
5530 if (!strlen($question_type))
return null;
5532 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
5536 $question =
new $question_type_gui();
5538 if ($question_id > 0)
5540 $question->object->loadFromDb($question_id);
5545 $question->object->feedbackOBJ =
new $feedbackObjectClassname($question->object, $ilCtrl, $ilDB, $lng);
5547 $assSettings =
new ilSetting(
'assessment');
5548 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
5550 $processLockerFactory->setQuestionId($question->object->getId());
5551 $processLockerFactory->setUserId($ilUser->getId());
5552 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
5554 $question->object->setProcessLocker($processLockerFactory->getLocker());
5571 if (strcmp($question_id,
"") != 0)
5573 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
5588 $this->questions = array_values($this->questions);
5589 $array_pos = array_search($target_index, $this->questions);
5590 if ($insert_mode == 0)
5592 $part1 = array_slice($this->questions, 0, $array_pos);
5593 $part2 = array_slice($this->questions, $array_pos);
5595 else if ($insert_mode == 1)
5597 $part1 = array_slice($this->questions, 0, $array_pos + 1);
5598 $part2 = array_slice($this->questions, $array_pos + 1);
5600 foreach ($move_questions as $question_id)
5602 if (!(array_search($question_id, $part1) === FALSE))
5604 unset($part1[array_search($question_id, $part1)]);
5606 if (!(array_search($question_id, $part2) === FALSE))
5608 unset($part2[array_search($question_id, $part2)]);
5611 $part1 = array_values($part1);
5612 $part2 = array_values($part2);
5613 $new_array = array_values(array_merge($part1, $move_questions, $part2));
5614 $this->questions =
array();
5616 foreach ($new_array as $question_id)
5618 $this->questions[
$counter] = $question_id;
5677 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
5680 if (count($available_pools))
5682 $available =
" AND " . $ilDB->in(
'qpl_questions.obj_fi', $available_pools,
false,
'integer');
5690 $available .=
" AND qpl_questions.complete = " . $ilDB->quote(
"1",
'text');
5694 if (is_array($arrFilter))
5696 if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title']))
5698 $where .=
" AND " . $ilDB->like(
'qpl_questions.title',
'text',
"%%" . $arrFilter[
'title'] .
"%%");
5700 if (array_key_exists(
'description', $arrFilter) && strlen($arrFilter[
'description']))
5702 $where .=
" AND " . $ilDB->like(
'qpl_questions.description',
'text',
"%%" . $arrFilter[
'description'] .
"%%");
5704 if (array_key_exists(
'author', $arrFilter) && strlen($arrFilter[
'author']))
5706 $where .=
" AND " . $ilDB->like(
'qpl_questions.author',
'text',
"%%" . $arrFilter[
'author'] .
"%%");
5708 if (array_key_exists(
'type', $arrFilter) && strlen($arrFilter[
'type']))
5710 $where .=
" AND qpl_qst_type.type_tag = " . $ilDB->quote($arrFilter[
'type'],
'text');
5712 if (array_key_exists(
'qpl', $arrFilter) && strlen($arrFilter[
'qpl']))
5714 $where .=
" AND " . $ilDB->like(
'object_data.title',
'text',
"%%" . $arrFilter[
'qpl'] .
"%%");
5719 $original_clause =
" qpl_questions.original_id IS NULL";
5720 if (count($original_ids))
5722 $original_clause =
" qpl_questions.original_id IS NULL AND " . $ilDB->in(
'qpl_questions.question_id', $original_ids,
true,
'integer');
5725 $query_result = $ilDB->query(
" 5726 SELECT qpl_questions.*, qpl_questions.tstamp, 5727 qpl_qst_type.type_tag, qpl_qst_type.plugin, qpl_qst_type.plugin_name, 5728 object_data.title parent_title 5729 FROM qpl_questions, qpl_qst_type, object_data 5730 WHERE $original_clause $available 5731 AND object_data.obj_id = qpl_questions.obj_fi 5732 AND qpl_questions.tstamp > 0 5733 AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id 5737 $types = $this->getQuestionTypeTranslations();
5738 if ($query_result->numRows())
5740 while (
$row = $ilDB->fetchAssoc($query_result))
5744 if( !
$row[
'plugin'] )
5752 if( !$pluginAdmin->isActive(
IL_COMP_MODULE,
'TestQuestionPool',
'qst',
$row[
'plugin_name']) )
5758 $row[
'ttype' ] = $pl->getQuestionTypeTranslation();
5778 foreach ($assessment->objectives as $objectives)
5780 foreach ($objectives->materials as $material)
5797 foreach ($assessment->assessmentcontrol as $assessmentcontrol)
5799 switch ($assessmentcontrol->getSolutionswitch())
5815 foreach ($assessment->qtimetadata as $metadata)
5817 switch ($metadata[
"label"])
5821 $type = $metadata[
"entry"];
5842 case "sequence_settings":
5845 case "solution_details":
5848 case "print_bs_with_res":
5857 case "pass_waiting":
5861 $this->
setKiosk($metadata[
"entry"]);
5863 case "showfinalstatement":
5876 case "highscore_enabled":
5880 case "highscore_anon":
5884 case "highscore_achieved_ts":
5888 case "highscore_score":
5892 case "highscore_percentage":
5896 case "highscore_hints":
5900 case "highscore_wtime":
5904 case "highscore_own_table":
5908 case "highscore_top_table":
5912 case "highscore_top_num":
5916 case "hide_previous_results":
5917 if ($metadata[
"entry"] == 0)
5926 case "use_previous_answers":
5929 case "answer_feedback":
5932 case "hide_title_points":
5935 case "title_output":
5938 case "question_set_type":
5942 if( $metadata[
"entry"] )
5951 case "results_presentation":
5954 case "reset_processing_time":
5957 case "instant_verification":
5960 case "instant_feedback_answer_fixation":
5963 case "force_instant_feedback":
5966 case "answer_feedback_points":
5981 case "fixed_participants":
5984 case "score_reporting":
5987 case "shuffle_questions":
5990 case "count_system":
5996 case "mailnotification":
6002 case "exportsettings":
6005 case "score_cutting":
6012 case "allowedUsers":
6016 case "allowedUsersTimeGap":
6019 case "pass_scoring":
6022 case 'pass_deletion_allowed':
6025 case "show_summary":
6028 case "reporting_date":
6029 $iso8601period = $metadata[
"entry"];
6030 if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
6032 $this->
setReportingDate(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
6035 case 'enable_processing_time':
6038 case "processing_time":
6041 case "starting_time":
6042 $iso8601period = $metadata[
"entry"];
6043 if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
6045 $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);
6051 $iso8601period = $metadata[
"entry"];
6052 if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
6054 $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);
6059 case "enable_examview":
6062 case 'show_examview_html':
6065 case 'show_examview_pdf':
6068 case 'redirection_mode':
6071 case 'redirection_url':
6074 case 'examid_in_kiosk':
6075 case 'examid_in_test_pass':
6078 case 'show_exam_id':
6079 case 'examid_in_test_res':
6082 case 'enable_archiving':
6085 case 'sign_submission':
6088 case 'char_selector_availability':
6091 case 'char_selector_definition':
6094 case 'skill_service':
6097 case 'result_tax_filters':
6100 case 'show_grading_status':
6103 case 'show_grading_mark':
6106 case 'activation_limited':
6109 case 'activation_start_time':
6112 case 'activation_end_time':
6115 case 'activation_visibility':
6121 case 'autosave_ival':
6124 case 'offer_question_hints':
6127 case 'instant_feedback_specific':
6130 case 'obligations_enabled':
6134 if (preg_match(
"/mark_step_\d+/", $metadata[
"label"]))
6136 $xmlmark = $metadata[
"entry"];
6137 preg_match(
"/<short>(.*?)<\/short>/", $xmlmark, $matches);
6138 $mark_short = $matches[1];
6139 preg_match(
"/<official>(.*?)<\/official>/", $xmlmark, $matches);
6140 $mark_official = $matches[1];
6141 preg_match(
"/<percentage>(.*?)<\/percentage>/", $xmlmark, $matches);
6142 $mark_percentage = $matches[1];
6143 preg_match(
"/<passed>(.*?)<\/passed>/", $xmlmark, $matches);
6144 $mark_passed = $matches[1];
6145 $this->mark_schema->addMarkStep($mark_short, $mark_official, $mark_percentage, $mark_passed);
6149 if (is_array(
$_SESSION[
"import_mob_xhtml"]))
6151 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
6152 include_once
"./Services/RTE/classes/class.ilRTE.php";
6153 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
6154 foreach (
$_SESSION[
"import_mob_xhtml"] as $mob)
6157 if (file_exists($importfile))
6167 $ilLog->write(
"Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
6181 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
6185 $a_xml_writer->xmlSetDtdDef(
"<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">");
6186 $a_xml_writer->xmlStartTag(
"questestinterop");
6189 "ident" =>
"il_".IL_INST_ID.
"_tst_".$this->getTestId(),
6192 $a_xml_writer->xmlStartTag(
"assessment", $attrs);
6194 $a_xml_writer->xmlElement(
"qticomment", NULL, $this->
getDescription());
6197 if ($this->enable_processing_time)
6199 preg_match(
"/(\d+):(\d+):(\d+)/", $this->processing_time, $matches);
6200 $a_xml_writer->xmlElement(
"duration", NULL, sprintf(
"P0Y0M0DT%dH%dM%dS", $matches[1], $matches[2], $matches[3]));
6204 $a_xml_writer->xmlStartTag(
"qtimetadata");
6205 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6206 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"ILIAS_VERSION");
6207 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
ilias->getSetting(
"ilias_version"));
6208 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6211 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6212 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"anonymity");
6213 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getAnonymity()));
6214 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6216 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6217 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"use_pool");
6218 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getPoolUsage() ? 1 : 0);
6219 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6222 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6223 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"question_set_type");
6225 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6228 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6229 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"sequence_settings");
6231 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6234 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6235 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"author");
6236 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getAuthor());
6237 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6240 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6241 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"reset_processing_time");
6243 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6246 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6247 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"count_system");
6248 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getCountSystem());
6249 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6252 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6253 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"mc_scoring");
6254 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getMCScoring());
6255 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6258 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6259 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"score_cutting");
6260 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getScoreCutting());
6261 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6264 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6265 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"password");
6266 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getPassword());
6267 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6270 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6271 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"allowedUsers");
6272 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getAllowedUsers());
6273 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6276 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6277 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"allowedUsersTimeGap");
6279 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6282 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6283 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"pass_scoring");
6284 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getPassScoring());
6285 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6287 $a_xml_writer->xmlStartTag(
'qtimetadatafield');
6288 $a_xml_writer->xmlElement(
'fieldlabel', NULL,
'pass_deletion_allowed');
6290 $a_xml_writer->xmlEndTag(
'qtimetadatafield');
6295 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6296 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"reporting_date");
6297 preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->reporting_date, $matches);
6298 $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]));
6299 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6302 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6303 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"nr_of_tries");
6304 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getNrOfTries()));
6305 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6308 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6309 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"pass_waiting");
6310 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getPassWaiting());
6311 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6314 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6315 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"kiosk");
6316 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getKiosk()));
6317 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6321 $a_xml_writer->xmlStartTag(
'qtimetadatafield');
6322 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"redirection_mode");
6324 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6327 $a_xml_writer->xmlStartTag(
'qtimetadatafield');
6328 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"redirection_url");
6330 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6333 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6334 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"use_previous_answers");
6336 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6339 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6340 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"title_output");
6341 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getTitleOutput()));
6342 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6345 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6346 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"results_presentation");
6348 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6351 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6352 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"examid_in_test_pass");
6354 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6357 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6358 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"examid_in_test_res");
6360 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6363 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6364 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_summary");
6366 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6369 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6370 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"score_reporting");
6371 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getScoreReporting()));
6372 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6374 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6375 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"solution_details");
6377 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6378 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6379 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"print_bs_with_res");
6381 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6384 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6385 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"instant_verification");
6387 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6390 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6391 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"answer_feedback");
6392 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getAnswerFeedback()));
6393 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6396 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6397 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"answer_feedback_points");
6399 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6402 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6403 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"instant_feedback_answer_fixation");
6405 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6408 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6409 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"force_instant_feedback");
6411 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6415 $highscore_metadata =
array(
6427 foreach($highscore_metadata as $label =>
$data)
6429 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6430 $a_xml_writer->xmlElement(
"fieldlabel", NULL, $label);
6431 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d",
$data[
'value']));
6432 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6436 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6437 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_cancel");
6438 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getShowCancel()));
6439 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6442 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6443 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_marker");
6444 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getShowMarker()));
6445 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6448 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6449 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"fixed_participants");
6451 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6454 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6455 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"showfinalstatement");
6456 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", (($this->
getShowFinalStatement()) ?
"1" :
"0")));
6457 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6460 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6461 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"showinfo");
6462 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", (($this->
getShowInfo()) ?
"1" :
"0")));
6463 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6466 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6467 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"mailnotification");
6469 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6472 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6473 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"mailnottype");
6475 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6478 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6479 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"exportsettings");
6481 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6484 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6485 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"forcejs");
6486 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", (($this->
getForceJS()) ?
"1" :
"0")));
6487 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6490 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6491 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"customstyle");
6492 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getCustomStyle());
6493 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6496 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6497 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"shuffle_questions");
6498 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getShuffleQuestions()));
6499 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6502 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6503 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"processing_time");
6505 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6508 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6509 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"enable_examview");
6511 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6514 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6515 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_examview_html");
6517 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6520 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6521 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_examview_pdf");
6523 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6526 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6527 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"enable_archiving");
6529 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6532 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6533 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"sign_submission");
6535 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6538 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6539 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"char_selector_availability");
6541 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6544 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6545 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"char_selector_definition");
6547 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6550 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6551 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"skill_service");
6553 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6556 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6557 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"result_tax_filters");
6559 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6562 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6563 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_grading_status");
6565 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6568 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6569 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_grading_mark");
6571 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6577 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6578 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"starting_time");
6580 $a_xml_writer->xmlElement(
"fieldentry", NULL, $backward_compatibility_format);
6581 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6586 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6587 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"ending_time");
6589 $a_xml_writer->xmlElement(
"fieldentry", NULL, $backward_compatibility_format);
6590 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6595 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6596 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"activation_limited");
6598 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6601 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6602 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"activation_start_time");
6604 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6607 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6608 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"activation_end_time");
6610 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6613 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6614 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"activation_visibility");
6616 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6619 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6620 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"autosave");
6621 $a_xml_writer->xmlElement(
"fieldentry", NULL, (
int)$this->
getAutosave());
6622 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6625 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6626 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"autosave_ival");
6627 $a_xml_writer->xmlElement(
"fieldentry", NULL, (
int)$this->
getAutosaveIval());
6628 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6631 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6632 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"offer_question_hints");
6634 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6637 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6638 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"instant_feedback_specific");
6640 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6643 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6644 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"instant_feedback_answer_fixation");
6646 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6649 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6650 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"obligations_enabled");
6652 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6655 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6656 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"enable_processing_time");
6658 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6660 foreach ($this->mark_schema->mark_steps as $index => $mark)
6663 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6664 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"mark_step_$index");
6665 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
6666 "<short>%s</short><official>%s</official><percentage>%.2f</percentage><passed>%d</passed>",
6667 $mark->getShortName(), $mark->getOfficialName(), $mark->getMinimumLevel(), $mark->getPassed()
6669 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6671 $a_xml_writer->xmlEndTag(
"qtimetadata");
6674 $a_xml_writer->xmlStartTag(
"objectives");
6676 $a_xml_writer->xmlEndTag(
"objectives");
6682 "solutionswitch" =>
"Yes" 6689 $a_xml_writer->xmlElement(
"assessmentcontrol", $attrs, NULL);
6694 $a_xml_writer->xmlStartTag(
"presentation_material");
6695 $a_xml_writer->xmlStartTag(
"flow_mat");
6697 $a_xml_writer->xmlEndTag(
"flow_mat");
6698 $a_xml_writer->xmlEndTag(
"presentation_material");
6704 $a_xml_writer->xmlElement(
"section", $attrs, NULL);
6705 $a_xml_writer->xmlEndTag(
"assessment");
6706 $a_xml_writer->xmlEndTag(
"questestinterop");
6708 $xml = $a_xml_writer->xmlDumpMem(FALSE);
6720 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/", $date_time, $matches);
6721 $iso8601_period = sprintf(
"P%dY%dM%dDT%dH%dM%dS", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]);
6722 return $iso8601_period;
6735 $this->mob_ids =
array();
6736 $this->file_ids =
array();
6742 $expLog->write(
date(
"[y-m-d H:i:s] ").
"Start Export Page Objects");
6743 $ilBench->start(
"ContentObjectExport",
"exportPageObjects");
6745 $ilBench->stop(
"ContentObjectExport",
"exportPageObjects");
6746 $expLog->write(
date(
"[y-m-d H:i:s] ").
"Finished Export Page Objects");
6749 $expLog->write(
date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
6750 $ilBench->start(
"ContentObjectExport",
"exportMediaObjects");
6752 $ilBench->stop(
"ContentObjectExport",
"exportMediaObjects");
6753 $expLog->write(
date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
6756 $expLog->write(
date(
"[y-m-d H:i:s] ").
"Start Export File Items");
6757 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
6759 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
6760 $expLog->write(
date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
6771 include_once
"./Services/MetaData/classes/class.ilMD2XML.php";
6773 $md2xml->setExportMode(
true);
6774 $md2xml->startExport();
6775 $a_xml_writer->appendXML($md2xml->getXML());
6785 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
6787 include_once
"./Services/Utilities/classes/class.ilUtil.php";
6805 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
6807 foreach ($this->questions as $question_id)
6809 $ilBench->start(
"ContentObjectExport",
"exportPageObject");
6810 $expLog->write(
date(
"[y-m-d H:i:s] ").
"Page Object ".$question_id);
6813 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
6817 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML");
6818 include_once
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
6820 $page_object->buildDom();
6821 $page_object->insertInstIntoIDs($a_inst);
6822 $mob_ids = $page_object->collectMediaObjects(
false);
6823 require_once
'Services/COPage/classes/class.ilPCFileList.php';
6825 $xml = $page_object->getXMLFromDom(
false,
false,
false,
"",
true);
6826 $xml = str_replace(
"&",
"&", $xml);
6827 $a_xml_writer->appendXML($xml);
6828 $page_object->freeDom();
6829 unset ($page_object);
6831 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML");
6834 $ilBench->start(
"ContentObjectExport",
"exportPageObject_CollectMedia");
6836 foreach($mob_ids as $mob_id)
6838 $this->mob_ids[$mob_id] = $mob_id;
6840 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_CollectMedia");
6843 $ilBench->start(
"ContentObjectExport",
"exportPageObject_CollectFileItems");
6845 foreach($file_ids as $file_id)
6847 $this->file_ids[$file_id] = $file_id;
6849 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_CollectFileItems");
6851 $a_xml_writer->xmlEndTag(
"PageObject");
6854 $ilBench->stop(
"ContentObjectExport",
"exportPageObject");
6868 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
6870 foreach ($this->mob_ids as $mob_id)
6872 $expLog->write(
date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
6876 $media_obj->exportXML($a_xml_writer, $a_inst);
6877 $media_obj->exportFiles($a_target_dir);
6889 include_once
"./Modules/File/classes/class.ilObjFile.php";
6891 foreach ($this->file_ids as $file_id)
6893 $expLog->write(
date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
6894 $file_obj =
new ilObjFile($file_id,
false);
6895 $file_obj->export($a_target_dir);
6906 if (!is_array($this->import_mapping))
6912 return $this->import_mapping;
6937 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);
6943 public static function _getECTSGrade($points_passed, $reached_points, $max_points, $a, $b, $c,
$d, $e, $fx)
6945 include_once
"./Modules/Test/classes/class.ilStatistics.php";
6948 $passed_statistics->setData($points_passed);
6949 $ects_percentiles =
array 6951 "A" => $passed_statistics->quantile($a),
6952 "B" => $passed_statistics->quantile($b),
6953 "C" => $passed_statistics->quantile($c),
6954 "D" => $passed_statistics->quantile(
$d),
6955 "E" => $passed_statistics->quantile($e)
6957 if (count($points_passed) && ($reached_points >= $ects_percentiles[
"A"]))
6961 else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"B"]))
6965 else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"C"]))
6969 else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"D"]))
6973 else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"E"]))
6977 else if (strcmp($fx,
"") != 0)
6979 if ($max_points > 0)
6981 $percentage = ($reached_points / $max_points) * 100.0;
6982 if ($percentage < 0) $percentage = 0.0;
6988 if ($percentage >= $fx)
7008 return $this->mark_schema->checkMarks();
7036 global
$ilDB, $ilPluginAdmin, $tree;
7038 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
7058 if(preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getReportingDate(), $matches))
7060 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
7062 if($now < $epoch_time)
7100 $md_life =& $md->getLifecycle();
7103 if (strlen($a_author) == 0)
7106 $a_author = $ilUser->getFullname();
7109 $md_life =& $md->addLifecycle();
7111 $con =& $md_life->addContribute();
7112 $con->setRole(
"Author");
7114 $ent =& $con->addEntity();
7115 $ent->setEntity($a_author);
7127 parent::createMetaData();
7141 include_once
"./Services/MetaData/classes/class.ilMD.php";
7143 $md_life =& $md->getLifecycle();
7146 $ids =& $md_life->getContributeIds();
7147 foreach ($ids as
$id)
7149 $md_cont =& $md_life->getContribute($id);
7150 if (strcmp($md_cont->getRole(),
"Author") == 0)
7152 $entids =& $md_cont->getEntityIds();
7153 foreach ($entids as $entid)
7155 $md_ent =& $md_cont->getEntity($entid);
7156 array_push($author, $md_ent->getEntity());
7161 return join($author,
",");
7174 include_once
"./Services/MetaData/classes/class.ilMD.php";
7175 $md =
new ilMD($obj_id, 0,
"tst");
7176 $md_life =& $md->getLifecycle();
7179 $ids =& $md_life->getContributeIds();
7180 foreach ($ids as
$id)
7182 $md_cont =& $md_life->getContribute($id);
7183 if (strcmp($md_cont->getRole(),
"Author") == 0)
7185 $entids =& $md_cont->getEntityIds();
7186 foreach ($entids as $entid)
7188 $md_ent =& $md_cont->getEntity($entid);
7189 array_push($author, $md_ent->getEntity());
7194 return join($author,
",");
7208 $result_array =
array();
7218 $result_array[$obj_id] = $titles[
$ref_id];
7226 return $result_array;
7237 public function cloneObject($a_target_id,$a_copy_id = 0, $a_omit_tree =
false)
7245 $newObj = parent::cloneObject($a_target_id,$a_copy_id, $a_omit_tree);
7246 $newObj->setTmpCopyWizardCopyId($a_copy_id);
7252 if(!$cp_options->isRootNode($this->getRefId()))
7254 $newObj->setOnline($this->
isOnline());
7279 $newObj->setKiosk($this->
getKiosk());
7330 $newObj->saveToDb();
7333 include_once
"./Services/Certificate/classes/class.ilCertificate.php";
7334 include_once
"./Modules/Test/classes/class.ilTestCertificateAdapter.php";
7337 $cert->cloneCertificate($newcert);
7339 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
7341 $testQuestionSetConfigFactory->getQuestionSetConfig()->cloneQuestionSetRelatedData($newObj);
7343 require_once
'Modules/Test/classes/class.ilTestSkillLevelThresholdList.php';
7345 $skillLevelThresholdList->setTestId($this->
getTestId());
7346 $skillLevelThresholdList->loadFromDb();
7347 $skillLevelThresholdList->cloneListForTest($newObj->getTestId());
7349 $newObj->saveToDb();
7350 $newObj->updateMetaData();
7352 include_once(
'./Services/Tracking/classes/class.ilLPObjSettings.php');
7354 $obj_settings->cloneSettings($newObj->getId());
7371 global $tree,
$ilDB, $ilPluginAdmin;
7374 $tree, $ilDB, $ilPluginAdmin, $this
7377 $questionSetConfig->loadFromDb();
7379 if( $questionSetConfig->isQuestionAmountConfigurationModePerPool() )
7381 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
7382 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetBuilderWithAmountPerPool.php';
7383 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
7389 $sourcePoolDefinitionList->loadDefinitions();
7391 $num = $sourcePoolDefinitionList->getQuestionAmount();
7395 $num = $questionSetConfig->getQuestionAmountPerTest();
7400 $num = count($this->questions);
7418 if (strcmp($question_id,
"") != 0)
7420 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
7423 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
7438 $result = $ilDB->queryF(
"SELECT obj_fi FROM tst_tests WHERE test_id = %s",
7445 $object_id =
$row[
"obj_fi"];
7461 $result = $ilDB->queryF(
"SELECT tst_tests.obj_fi FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
7468 $object_id =
$row[
"obj_fi"];
7484 $result = $ilDB->queryF(
"SELECT test_id FROM tst_tests WHERE obj_fi = %s",
7491 $test_id =
$row[
"test_id"];
7509 if (($active_id) && ($question_id))
7513 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
7516 $result = $ilDB->queryF(
"SELECT value1 FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
7517 array(
'integer',
'integer',
'integer'),
7543 $result = $ilDB->queryF(
"SELECT question_text FROM qpl_questions WHERE question_id = %s",
7566 $result_array =
array();
7570 if (is_numeric($user_id))
7572 $result = $ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
7573 "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 " .
7574 "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
7575 "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
7577 array(
'text',
'text',
'text',
'integer',
'integer'),
7578 array(
"", $this->lng->txt(
"anonymous"),
"", $this->
getTestId(), $user_id)
7583 $result = $ilDB->queryF(
"SELECT tst_active.active_id, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
7584 "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 " .
7585 "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
7586 "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
7588 array(
'text',
'text',
'text',
'integer'),
7595 if (is_numeric($user_id))
7597 $result = $ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
7598 "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 " .
7599 "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
7600 "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
7602 array(
'integer',
'integer'),
7608 $result = $ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
7609 "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 " .
7610 "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
7611 "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
7618 $result_array =
array();
7621 $result_array[
$row[
'usr_id']]=
$row;
7623 return $result_array;
7639 SELECT tst_active.active_id, 7641 tst_active.user_fi usr_id, 7645 tst_active.submitted test_finished, 7646 usr_data.matriculation, 7648 tst_active.lastindex, 7649 COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes 7652 ON tst_active.user_fi = usr_data.usr_id 7653 WHERE tst_active.test_fi = %s 7654 ORDER BY usr_data.lastname 7657 array(
'text',
'text',
'text',
'integer'),
7664 SELECT tst_active.active_id, 7666 tst_active.user_fi usr_id, 7670 tst_active.submitted test_finished, 7671 usr_data.matriculation, 7673 tst_active.lastindex, 7674 COALESCE(tst_active.last_finished_pass, -1) <> tst_active.last_started_pass unfinished_passes 7677 ON tst_active.user_fi = usr_data.usr_id 7678 WHERE tst_active.test_fi = %s 7679 ORDER BY usr_data.lastname 7690 foreach (
$data as $index => $participant)
7692 if (strlen(trim($participant[
"firstname"].$participant[
"lastname"])) == 0)
7694 $data[$index][
"lastname"] = $this->lng->txt(
"deleted_user");
7704 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
7706 if (count($scoring) == 0)
return array();
7709 $filtered_participants =
array();
7710 foreach ($participants as $active_id => $participant)
7712 $qstType_IN_manScoreableQstTypes = $ilDB->in(
'qpl_questions.question_type_fi', $scoring,
false,
'integer');
7715 SELECT tst_test_result.manual 7717 FROM tst_test_result 7719 INNER JOIN qpl_questions 7720 ON tst_test_result.question_fi = qpl_questions.question_id 7722 WHERE tst_test_result.active_fi = %s 7723 AND $qstType_IN_manScoreableQstTypes 7727 $queryString,
array(
"integer"),
array($active_id)
7737 if ($participant->active) $filtered_participants[$active_id] = $participant;
7740 if (!$participant->active) $filtered_participants[$active_id] = $participant;
7743 $filtered_participants[$active_id] = $participant;
7758 $assessmentSetting =
new ilSetting(
"assessment");
7759 $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
7760 if ($manscoring_done) $filtered_participants[$active_id] = $participant;
7772 $assessmentSetting =
new ilSetting(
"assessment");
7773 $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
7774 if (!$manscoring_done) $filtered_participants[$active_id] = $participant;
7782 if (
$row[
"manual"]) $found++;
7784 if (($found > 0) && ($found < $count)) $filtered_participants[$active_id] = $participant;
7787 $filtered_participants[$active_id] = $participant;
7792 return $filtered_participants;
7806 if (!is_array($ids) || count($ids) ==0)
return array();
7810 $result = $ilDB->queryF(
"SELECT usr_id, %s login, %s lastname, %s firstname, client_ip clientip FROM usr_data WHERE " . $ilDB->in(
'usr_id', $ids,
false,
'integer') .
" ORDER BY login",
7811 array(
'text',
'text',
'text'),
7812 array(
"", $this->lng->txt(
"anonymous"),
"")
7817 $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");
7820 $result_array =
array();
7823 $result_array[
$row[
"usr_id"]]=
$row;
7825 return $result_array;
7830 if (!is_array($ids) || count($ids) ==0)
return array();
7842 if (!is_array($ids) || count($ids) ==0)
return array();
7844 foreach ($ids as $obj_id)
7860 include_once
"./Modules/Group/classes/class.ilObjGroup.php";
7862 $members = $group->getGroupMemberIds();
7863 include_once
'./Services/User/classes/class.ilObjUser.php';
7864 foreach ($members as $user_id)
7879 $members = $rbacreview->assignedUsers($role_id);
7880 include_once
'./Services/User/classes/class.ilObjUser.php';
7881 foreach ($members as $user_id)
7899 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
7900 array(
'integer',
'integer'),
7915 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
7916 array(
'integer',
'integer'),
7919 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_invited_user (test_fi, user_fi, clientip, tstamp) VALUES (%s, %s, %s, %s)",
7920 array(
'integer',
'integer',
'text',
'integer'),
7921 array($this->
getTestId(), $user_id, (strlen($client_ip)) ? $client_ip : NULL,
time())
7930 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_invited_user SET clientip = %s, tstamp = %s WHERE test_fi=%s and user_fi=%s",
7931 array(
'text',
'integer',
'integer',
'integer'),
7932 array((strlen($client_ip)) ? $client_ip : NULL,
time(), $this->
getTestId(), $user_id)
7944 if (is_numeric($question_fi))
7946 $result = $ilDB->queryF(
"SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s AND question_fi=%s",
7947 array(
'integer',
'integer'),
7948 array($active_id, $question_fi)
7953 $result = $ilDB->queryF(
"SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s",
7958 $result_array =
array();
7961 $result_array[
$row[
"question_fi"]]=
$row;
7963 return $result_array;
7975 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_qst_solved WHERE active_fi = %s AND question_fi = %s",
7976 array(
'integer',
'integer'),
7977 array($active_id, $question_id)
7979 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_qst_solved (solved, question_fi, active_fi) VALUES (%s, %s, %s)",
7980 array(
'integer',
'integer',
'integer'),
7981 array($value, $question_id, $active_id)
7992 $result = $ilDB->queryF(
"SELECT submitted FROM tst_active WHERE active_id=%s AND submitted=%s",
7993 array(
'integer',
'integer'),
7994 array($active_id, 1)
7996 return $result->numRows() == 1;
8007 if (!is_numeric($user_id))
8008 $user_id = $ilUser->getId();
8010 $result = $ilDB->queryF(
"SELECT submitted FROM tst_active WHERE test_fi=%s AND user_fi=%s AND submitted=%s",
8011 array(
'integer',
'integer',
'integer'),
8014 return $result->numRows() == 1;
8049 "user_id" => $this->lng->txt(
"user_id"),
8050 "matriculation" => $this->lng->txt(
"matriculation"),
8051 "lastname" => $this->lng->txt(
"lastname"),
8052 "firstname" => $this->lng->txt(
"firstname"),
8053 "login" =>$this->lng->txt(
"login"),
8054 "reached_points" => $this->lng->txt(
"tst_reached_points"),
8055 "max_points" => $this->lng->txt(
"tst_maximum_points"),
8056 "percent_value" => $this->lng->txt(
"tst_percent_solved"),
8057 "mark" => $this->lng->txt(
"tst_mark"),
8058 "ects" => $this->lng->txt(
"ects_grade")
8061 if (count($participants))
8067 foreach ($participants as $active_id => $user_rec)
8069 $mark = $ects_mark =
'';
8071 $reached_points = 0;
8073 foreach ($this->questions as $value)
8076 if (is_object($question))
8078 $max_points += $question->getMaximumPoints();
8079 $reached_points += $question->getReachedPoints($active_id);
8082 if ($max_points > 0)
8084 $percentvalue = $reached_points / $max_points;
8085 if ($percentvalue < 0) $percentvalue = 0.0;
8091 $mark_obj = $this->mark_schema->getMatchingMark($percentvalue * 100);
8095 $mark = $mark_obj->getOfficialName();
8098 $ects_mark = $this->
getECTSGrade($passed_array, $reached_points, $max_points);
8103 $user_rec[
'firstname'] =
"";
8104 $user_rec[
'lastname'] = $this->lng->txt(
"anonymous");
8107 "user_id"=>$user_rec[
'usr_id'],
8108 "matriculation" => $user_rec[
'matriculation'],
8109 "lastname" => $user_rec[
'lastname'],
8110 "firstname" => $user_rec[
'firstname'],
8111 "login"=>$user_rec[
'login'],
8112 "reached_points" => $reached_points,
8113 "max_points" => $max_points,
8114 "percent_value" => $percentvalue,
8116 "ects" => $ects_mark
8136 $resultarray =
array();
8137 foreach (
$row as $rowindex => $entry)
8144 if (strpos($entry,
"\"") !== FALSE)
8146 $entry = str_replace(
"\"",
"\"\"", $entry);
8149 if (strpos($entry, $separator) !== FALSE)
8154 $entry = str_replace(chr(13).chr(10), chr(10), $entry);
8158 $entry =
"\"" . $entry .
"\"";
8161 $resultarray[$rowindex] = $entry;
8163 return $resultarray;
8177 $result = $ilDB->queryF(
"SELECT tries FROM tst_active WHERE active_id = %s",
8184 return $row[
"tries"];
8204 $result = $ilDB->queryF(
"SELECT MAX(pass) maxpass FROM tst_pass_result WHERE active_fi = %s",
8211 $max =
$row[
"maxpass"];
8229 $result = $ilDB->queryF(
"SELECT * FROM tst_pass_result WHERE active_fi = %s",
8239 if(
$row[
"maxpoints"] > 0)
8241 $factor =
$row[
"points"] /
$row[
"maxpoints"];
8248 if($factor > $bestfactor)
8251 $bestfactor = $factor;
8254 if (is_array($bestrow))
8256 return $bestrow[
"pass"];
8279 $counted_pass = NULL;
8288 return $counted_pass;
8304 global $tree,
$ilDB,
$lng, $ilPluginAdmin;
8306 require_once
'Modules/Test/classes/class.ilTestSessionFactory.php';
8308 $testSession = $testSessionFactory->getSession($active_id);
8310 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
8312 $testSequence = $testSequenceFactory->getSequenceByTestSession($testSession);
8314 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
8316 $dynamicQuestionSetConfig->loadFromDb();
8318 $testSequence->loadFromDb($dynamicQuestionSetConfig);
8321 return $testSequence->getTrackedQuestionCount();
8328 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
8330 foreach ($this->questions as $value)
8334 $workedthrough += 1;
8337 return $workedthrough;
8359 SELECT tst_pass_result.tstamp pass_res_tstamp, 8360 tst_test_result.tstamp quest_res_tstamp 8362 FROM tst_pass_result 8364 LEFT JOIN tst_test_result 8365 ON tst_test_result.active_fi = tst_pass_result.active_fi 8366 AND tst_test_result.pass = tst_pass_result.pass 8368 WHERE tst_pass_result.active_fi = %s 8369 AND tst_pass_result.pass = %s 8371 ORDER BY tst_test_result.tstamp DESC 8375 array(
'integer',
'integer'),
8381 if(
$row[
'qres_tstamp'] )
8383 return $row[
'quest_res_tstamp'];
8386 return $row[
'pass_res_tstamp'];
8403 "executable" =>
true,
8404 "errormessage" =>
"" 8408 $result[
"executable"] =
false;
8414 $result[
"executable"] =
false;
8437 $testSession->increasePass();
8438 $testSession->setLastSequence(0);
8439 $testSession->saveToDb();
8443 $result[
"executable"] =
false;
8444 $result[
"errormessage"] = $this->lng->txt(
"detail_max_processing_time_reached");
8451 require_once
'Modules/Test/classes/class.ilTestPassesSelector.php';
8453 $testPassesSelector->setActiveId($active_id);
8454 $testPassesSelector->setLastFinishedPass($testSession->getLastFinishedPass());
8458 $closedPasses = $testPassesSelector->getClosedPasses();
8462 $result[
"executable"] =
false;
8463 $result[
"errormessage"] = $this->lng->txt(
"maximum_nr_of_tries_reached");
8469 $lastPass = $testPassesSelector->getLastFinishedPassTimestamp();
8473 $time_values = explode(
":", $pass_waiting_string);
8474 $next_pass_allowed = strtotime(
'+ ' . $time_values[0] .
' Months + ' . $time_values[1] .
' Days + ' . $time_values[2] .
' Hours' . $time_values[3] .
' Minutes', $lastPass);
8476 if(
time() < $next_pass_allowed)
8480 $result[
"executable"] =
false;
8481 $result[
"errormessage"] = sprintf($this->lng->txt(
'wait_for_next_pass_hint_msg'), $date);
8503 case self::SCORE_REPORTING_IMMIDIATLY:
8504 case self::SCORE_REPORTING_FINISHED:
8508 case self::SCORE_REPORTING_DATE:
8515 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getReportingDate(), $matches))
8517 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
8519 if ($now < $epoch_time)
8533 $active_id = $testSession->getActiveId();
8538 $notimeleft = FALSE;
8567 if ($active_id < 1)
return FALSE;
8572 $result = $ilDB->queryF(
"SELECT tst_times.started FROM tst_times WHERE tst_times.active_fi = %s AND tst_times.pass = %s ORDER BY tst_times.started",
8573 array(
'integer',
'integer'),
8579 if (preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches))
8581 return mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
8629 questtypes.type_tag, 8631 tstquest.obligatory, 8632 origquest.obj_fi orig_obj_fi 8634 FROM qpl_questions questions 8636 INNER JOIN qpl_qst_type questtypes 8637 ON questtypes.question_type_id = questions.question_type_fi 8639 INNER JOIN tst_test_question tstquest 8640 ON tstquest.question_fi = questions.question_id 8642 LEFT JOIN qpl_questions origquest 8643 ON origquest.question_id = questions.original_id 8645 WHERE tstquest.test_fi = %s 8647 ORDER BY tstquest.sequence 8650 $query_result = $ilDB->queryF(
8654 $questions =
array();
8656 while (
$row = $ilDB->fetchAssoc($query_result))
8660 $question[
'obligationPossible'] = self::isQuestionObligationPossible(
$row[
'question_id']);
8662 $questions[] = $question;
8672 $row = $DIC->database()->fetchAssoc($DIC->database()->queryF(
8673 "SELECT COUNT(question_id) cnt FROM qpl_questions WHERE question_id = %s AND obj_fi = %s",
8677 return (
bool)
$row[
'cnt'];
8683 public function getPotentialRandomTestQuestions()
8692 questtypes.type_tag, 8693 origquest.obj_fi orig_obj_fi 8695 FROM qpl_questions questions 8697 INNER JOIN qpl_qst_type questtypes 8698 ON questtypes.question_type_id = questions.question_type_fi 8700 INNER JOIN tst_rnd_cpy tstquest 8701 ON tstquest.qst_fi = questions.question_id 8703 LEFT JOIN qpl_questions origquest 8704 ON origquest.question_id = questions.original_id 8706 WHERE tstquest.tst_fi = %s 8709 $query_result = $ilDB->queryF(
8713 $questions =
array();
8715 while (
$row = $ilDB->fetchAssoc($query_result))
8719 $question[
'obligationPossible'] = self::isQuestionObligationPossible(
$row[
'question_id']);
8721 $questions[] = $question;
8735 return ($this->shuffle_questions) ? 1 : 0;
8746 $this->shuffle_questions = ($a_shuffle) ? 1 : 0;
8763 return ($this->show_summary) ? $this->show_summary : 0;
8780 $this->show_summary = $a_value;
8791 if (($this->show_summary & 1) > 0)
8811 $this->show_summary = 1;
8815 $this->show_summary = 0;
8827 if (($this->show_summary & 2) > 0)
8847 $this->show_summary = $this->show_summary | 2;
8853 $this->show_summary = $this->show_summary ^ 2;
8866 if (($this->show_summary & 4) > 0)
8886 $this->show_summary = $this->show_summary | 4;
8892 $this->show_summary = $this->show_summary ^ 4;
8905 if (($this->show_summary & 8) > 0)
8925 $this->show_summary = $this->show_summary | 8;
8931 $this->show_summary = $this->show_summary ^ 8;
8944 return ($this->results_presentation) ? $this->results_presentation : 0;
8955 if (($this->results_presentation & 1) > 0)
8973 if (($this->results_presentation & 2) > 0)
8991 if (($this->results_presentation & 4) > 0)
9009 if (($this->results_presentation & 8) > 0)
9027 if (($this->results_presentation & 16) > 0)
9045 if (($this->results_presentation & 32) > 0)
9061 if (($this->results_presentation & 64) > 0)
9077 if(($this->results_presentation & 128) > 0)
9095 $this->results_presentation = $a_results_presentation;
9110 $this->results_presentation = $this->results_presentation | 1;
9116 $this->results_presentation = $this->results_presentation ^ 1;
9131 $this->results_presentation = $this->results_presentation | 2;
9137 $this->results_presentation = $this->results_presentation ^ 2;
9163 $this->results_presentation = $this->results_presentation | 4;
9169 $this->results_presentation = $this->results_presentation ^ 4;
9184 $this->results_presentation = $this->results_presentation | 8;
9190 $this->results_presentation = $this->results_presentation ^ 8;
9205 $this->results_presentation = $this->results_presentation | 16;
9211 $this->results_presentation = $this->results_presentation ^ 16;
9226 $this->results_presentation = $this->results_presentation | 32;
9232 $this->results_presentation = $this->results_presentation ^ 32;
9247 $this->results_presentation = $this->results_presentation | 64;
9253 $this->results_presentation = $this->results_presentation ^ 64;
9267 $this->results_presentation = $this->results_presentation | 128;
9273 $this->results_presentation = $this->results_presentation ^ 128;
9284 $result = $ilDB->queryF(
"SELECT user_fi FROM tst_active WHERE active_id = %s",
9291 return $row[
"user_fi"];
9317 return ($this->allowedUsers) ? $this->allowedUsers : 0;
9322 $this->allowedUsers = $a_allowed_users;
9327 return ($this->allowedUsersTimeGap) ? $this->allowedUsersTimeGap : 0;
9332 $this->allowedUsersTimeGap = $a_allowed_users_time_gap;
9341 if (($nr_of_users > 0) && ($time_gap > 0))
9344 $time_border = $now - $time_gap;
9345 $str_time_border = strftime(
"%Y%m%d%H%M%S", $time_border);
9347 SELECT DISTINCT tst_times.active_fi 9349 INNER JOIN tst_active 9350 ON tst_times.active_fi = tst_active.active_id 9352 tst_times.pass > tst_active.last_finished_pass OR tst_active.last_finished_pass IS NULL 9354 WHERE tst_times.tstamp > %s 9355 AND tst_active.test_fi = %s 9358 if (
$result->numRows() >= $nr_of_users)
9360 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
9379 $result = $ilDB->queryF(
"SELECT finished FROM tst_times WHERE active_fi = %s ORDER BY finished DESC",
9386 return $row[
"finished"];
9400 if (preg_match(
"/<[^>]*?>/", $a_text))
9420 for ($i = 0; $i < $a_material->getMaterialCount(); $i++)
9422 $material = $a_material->getMaterial($i);
9423 if (strcmp($material[
"type"],
"mattext") == 0)
9425 $result .= $material[
"material"]->getContent();
9427 if (strcmp($material[
"type"],
"matimage") == 0)
9429 $matimage = $material[
"material"];
9430 if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches))
9434 array_push(
$_SESSION[
"import_mob_xhtml"],
array(
"mob" => $matimage->getLabel(),
"uri" => $matimage->getUri()));
9439 $ilLog->write(print_r(
$_SESSION[
"import_mob_xhtml"],
true));
9453 include_once
"./Services/RTE/classes/class.ilRTE.php";
9454 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
9456 $a_xml_writer->xmlStartTag(
"material");
9458 "texttype" =>
"text/plain" 9460 if ($this->
isHTML($a_material))
9462 $attrs[
"texttype"] =
"text/xhtml";
9467 foreach (
$mobs as $mob)
9469 $moblabel =
"il_" . IL_INST_ID .
"_mob_" . $mob;
9470 if (strpos($a_material,
"mm_$mob") !== FALSE)
9476 "label" => $moblabel,
9477 "uri" =>
"objects/" .
"il_" . IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle()
9480 $a_xml_writer->xmlElement(
"matimage", $imgattrs, NULL);
9483 $a_xml_writer->xmlEndTag(
"material");
9494 include_once
"./Services/Utilities/classes/class.ilUtil.php";
9508 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_tests SET certificate_visibility = %s, tstamp = %s WHERE test_id = %s",
9509 array(
'text',
'integer',
'integer'),
9522 return (strlen($this->certificate_visibility)) ? $this->certificate_visibility : 0;
9533 $this->certificate_visibility = $a_value;
9544 return ($this->anonymity) ? 1 : 0;
9558 $this->anonymity = 1;
9561 $this->anonymity = 0;
9574 return ($this->show_cancel) ? 1 : 0;
9588 $this->show_cancel = 1;
9591 $this->show_cancel = 0;
9604 return ($this->show_marker) ? 1 : 0;
9618 $this->show_marker = 1;
9621 $this->show_marker = 0;
9634 return ($this->fixed_participants) ? 1 : 0;
9648 $this->fixed_participants = 1;
9651 $this->fixed_participants = 0;
9667 $result = $ilDB->queryF(
"SELECT anonymity FROM tst_tests WHERE obj_fi = %s",
9673 return $row[
'anonymity'];
9689 SELECT tst_tests.question_set_type 9691 INNER JOIN tst_tests 9692 ON tst_active.test_fi = tst_tests.test_id 9693 WHERE tst_active.active_id = %s 9698 while(
$row = $ilDB->fetchAssoc(
$res))
9700 return $row[
'question_set_type'];
9716 throw new Exception(__METHOD__.
' is deprecated ... use ilObjTest::lookupQuestionSetTypeByActiveId() instead!');
9720 $result = $ilDB->queryF(
"SELECT tst_tests.random_test FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_active.test_fi = tst_tests.test_id",
9726 return $row[
'random_test'];
9745 return $this->lng->txt(
"anonymous") . $suffix;
9749 include_once
'./Services/User/classes/class.ilObjUser.php';
9751 if (strlen($uname[
"firstname"].$uname[
"lastname"]) == 0) $uname[
"firstname"] = $this->lng->txt(
"deleted_user");
9754 return trim($uname[
"lastname"] .
", " . $uname[
"firstname"]) . $suffix;
9758 return trim($uname[
"firstname"] .
" " . $uname[
"lastname"]) . $suffix;
9774 return $this->lng->txt(
"tst_start_test");
9776 $active_pass = self::_getPass($active_id);
9780 if ($active_pass == 0)
9782 return $this->lng->txt(
"tst_start_test");
9786 return $this->lng->txt(
"tst_start_new_test_pass");
9791 return $this->lng->txt(
"tst_resume_test");
9800 public function getAvailableDefaults()
9809 "SELECT * FROM tst_test_defaults WHERE user_fi = %s ORDER BY name ASC",
9811 array($ilUser->getId())
9813 $defaults =
array();
9816 $defaults[
$row[
"test_defaults_id"]] =
$row;
9830 return self::_getTestDefaults($test_defaults_id);
9837 $result = $ilDB->queryF(
"SELECT * FROM tst_test_defaults WHERE test_defaults_id = %s",
9839 array($test_defaults_id)
9861 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_test_defaults WHERE test_defaults_id = %s",
9863 array($test_default_id)
9877 $testsettings =
array(
9970 $next_id = $ilDB->nextId(
'tst_test_defaults');
9972 'tst_test_defaults',
9974 'test_defaults_id' =>
array(
'integer', $next_id),
9975 'name' =>
array(
'text', $a_name),
9976 'user_fi' =>
array(
'integer', $ilUser->getId()),
9977 'defaults' =>
array(
'clob', serialize($testsettings)),
9978 'marks' =>
array(
'clob', serialize($this->mark_schema)),
9993 $testsettings = unserialize($test_defaults[
"defaults"]);
9994 include_once
"./Modules/Test/classes/class.assMarkSchema.php";
9995 $this->mark_schema = unserialize($test_defaults[
"marks"]);
10003 $this->
setForceJS($testsettings[
"ForceJS"]);
10029 $this->
setKiosk($testsettings[
"Kiosk"]);
10033 $this->
setECTSFX($testsettings[
"ECTSFX"]);
10035 if( isset($testsettings[
"isRandomTest"]) )
10037 if( $testsettings[
"isRandomTest"] )
10046 elseif( isset($testsettings[
"questionSetType"]) )
10069 if( isset($testsettings[
'examid_in_kiosk']) )
10077 if( isset($testsettings[
'show_exam_id']) )
10133 if (extension_loaded(
"tidy"))
10137 "output-xml" =>
true,
10138 "numeric-entities" =>
true 10140 $tidy =
new tidy();
10141 $tidy->parseString($print_output,
$config,
'utf8');
10142 $tidy->cleanRepair();
10143 $print_output = tidy_get_output($tidy);
10144 $print_output = preg_replace(
"/^.*?(<html)/",
"\\1", $print_output);
10148 $print_output = str_replace(
" ",
" ", $print_output);
10149 $print_output = str_replace(
"⊗",
"X", $print_output);
10151 $xsl = file_get_contents(
"./Modules/Test/xml/question2fo.xsl");
10154 $xsl = str_replace(
10155 'font-family="Helvetica, unifont"',
10156 'font-family="'.
$GLOBALS[
'ilSetting']->
get(
'rpc_pdf_font',
'Helvetica, unifont').
'"',
10160 $args =
array(
'/_xml' => $print_output,
'/_xsl' => $xsl );
10163 $output = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl", NULL, $args,
$params);
10177 $content = preg_replace(
"/href=\".*?\"/",
"", $content);
10178 $printbody =
new ilTemplate(
"tpl.il_as_tst_print_body.html", TRUE, TRUE,
"Modules/Test");
10180 $printbody->setVariable(
"ADM_CONTENT", $content);
10181 $printbody->setCurrentBlock(
"css_file");
10183 $printbody->parseCurrentBlock();
10184 $printbody->setCurrentBlock(
"css_file");
10186 $printbody->parseCurrentBlock();
10187 $printoutput = $printbody->get();
10188 $html = str_replace(
"href=\"./",
"href=\"" . ILIAS_HTTP_PATH .
"/", $printoutput);
10189 $html = preg_replace(
"/<div id=\"dontprint\">.*?<\\/div>/ims",
"",
$html);
10190 if (extension_loaded(
"tidy"))
10194 "output-xml" =>
true,
10195 "numeric-entities" =>
true 10197 $tidy =
new tidy();
10199 $tidy->cleanRepair();
10200 $html = tidy_get_output($tidy);
10201 $html = preg_replace(
"/^.*?(<html)/",
"\\1",
$html);
10205 $html = str_replace(
" ",
" ",
$html);
10206 $html = str_replace(
"⊗",
"X",
$html);
10208 $html = preg_replace(
"/src=\".\\//ims",
"src=\"" . ILIAS_HTTP_PATH .
"/",
$html);
10222 include_once
"./Services/Utilities/classes/class.ilUtil.php";
10224 $fp = fopen($fo_file,
"w"); fwrite($fp, $fo); fclose($fp);
10226 include_once
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
10236 $ilLog->write(__METHOD__.
': '.$e->getMessage());
10254 $result = $ilDB->queryF(
"SELECT feedback FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
10255 array(
'integer',
'integer',
'integer'),
10261 include_once(
"./Services/RTE/classes/class.ilRTE.php");
10277 function saveManualFeedback($active_id, $question_id,
$pass, $feedback)
10281 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
10282 array(
'integer',
'integer',
'integer'),
10286 if (strlen($feedback))
10288 $next_id = $ilDB->nextId(
'tst_manual_fb');
10291 'manual_feedback_id' =>
array(
'integer', $next_id ),
10292 'active_fi' =>
array(
'integer', $active_id ),
10293 'question_fi' =>
array(
'integer', $question_id ),
10296 'tstamp' =>
array(
'integer',
time() ),
10299 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
10303 include_once
"./Modules/Test/classes/class.ilObjTestAccess.php";
10305 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
10332 include_once
"./Modules/Test/classes/class.ilTestSequence.php";
10343 $this->test_id = $a_id;
10357 if (count($participants))
10359 foreach ($participants as $active_id => $user_rec)
10362 $reached_points = 0;
10364 foreach ($this->questions as $value)
10367 if (is_object($question))
10369 $max_points += $question->getMaximumPoints();
10370 $reached_points += $question->getReachedPoints($active_id);
10371 if ($max_points > 0)
10373 $percentvalue = $reached_points / $max_points;
10374 if ($percentvalue < 0) $percentvalue = 0.0;
10382 $user_rec[
'firstname'] =
"";
10383 $user_rec[
'lastname'] = $this->lng->txt(
"anonymous");
10386 "user_id"=>$user_rec[
'usr_id'],
10387 "matriculation" => $user_rec[
'matriculation'],
10388 "lastname" => $user_rec[
'lastname'],
10389 "firstname" => $user_rec[
'firstname'],
10390 "login"=>$user_rec[
'login'],
10391 "question_id" => $question->getId(),
10392 "question_title" => $question->getTitle(),
10393 "reached_points" => $reached_points,
10394 "max_points" => $max_points
10411 $result = $ilDB->queryF(
"SELECT t.obj_fi obj_id FROM tst_test_question q, tst_tests t WHERE q.test_fi = t.test_id AND q.question_fi = %s",
10415 $rec = $ilDB->fetchAssoc(
$result);
10416 return $rec[
"obj_id"];
10427 global $ilPluginAdmin;
10428 if ($ilPluginAdmin->isActive(
IL_COMP_MODULE,
"TestQuestionPool",
"qst", $a_pname))
10442 $result = $ilDB->queryF(
"SELECT passed FROM tst_result_cache WHERE active_fi = %s",
10449 return $row[
'passed'];
10454 $result_array =& $this->
getTestResult($active_id, $counted_pass);
10455 return $result_array[
"test"][
"passed"];
10468 include_once
"./Services/Certificate/classes/class.ilCertificate.php";
10469 include_once
"./Modules/Test/classes/class.ilTestCertificateAdapter.php";
10471 if ($cert->isComplete())
10513 public function getParticipantsForTestAndQuestion($test_id, $question_id)
10519 SELECT tst_test_result.active_fi, tst_test_result.question_fi, tst_test_result.pass 10520 FROM tst_test_result 10521 INNER JOIN tst_active ON tst_active.active_id = tst_test_result.active_fi AND tst_active.test_fi = %s 10522 INNER JOIN qpl_questions ON qpl_questions.question_id = tst_test_result.question_fi 10523 LEFT JOIN usr_data ON usr_data.usr_id = tst_active.user_fi 10524 WHERE tst_test_result.question_fi = %s 10525 ORDER BY usr_data.lastname ASC, usr_data.firstname ASC 10529 array(
'integer',
'integer'),
10530 array($test_id, $question_id)
10532 $foundusers =
array();
10536 if (!array_key_exists(
$row[
"active_fi"], $foundusers))
10538 $foundusers[
$row[
"active_fi"]] =
array();
10540 array_push($foundusers[
$row[
"active_fi"]],
array(
"pass" => $row[
"pass"],
"qid" => $row[
"question_fi"]));
10542 return $foundusers;
10553 $foundParticipants =&
$data->getParticipants();
10555 if (count($foundParticipants))
10557 $results[
"overview"][$this->lng->txt(
"tst_eval_total_persons")] = count($foundParticipants);
10559 $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished")] = $total_finished;
10561 $diff_seconds = $average_time;
10562 $diff_hours = floor($diff_seconds/3600);
10563 $diff_seconds -= $diff_hours * 3600;
10564 $diff_minutes = floor($diff_seconds/60);
10565 $diff_seconds -= $diff_minutes * 60;
10566 $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
10568 $total_passed_reached = 0;
10569 $total_passed_max = 0;
10570 $total_passed_time = 0;
10571 foreach ($foundParticipants as $userdata)
10573 if ($userdata->getPassed())
10576 $total_passed_reached += $userdata->getReached();
10577 $total_passed_max += $userdata->getMaxpoints();
10578 $total_passed_time += $userdata->getTimeOfWork();
10581 $average_passed_reached = $total_passed ? $total_passed_reached / $total_passed : 0;
10582 $average_passed_max = $total_passed ? $total_passed_max / $total_passed : 0;
10583 $average_passed_time = $total_passed ? $total_passed_time / $total_passed : 0;
10584 $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed")] = $total_passed;
10585 $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);
10586 $average_time = $average_passed_time;
10587 $diff_seconds = $average_time;
10588 $diff_hours = floor($diff_seconds/3600);
10589 $diff_seconds -= $diff_hours * 3600;
10590 $diff_minutes = floor($diff_seconds/60);
10591 $diff_seconds -= $diff_minutes * 60;
10592 $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
10595 foreach (
$data->getQuestionTitles() as $question_id => $question_title)
10600 foreach ($foundParticipants as $userdata)
10602 for ($i = 0; $i <= $userdata->getLastPass(); $i++)
10604 if (is_object($userdata->getPass($i)))
10606 $question =& $userdata->getPass($i)->getAnsweredQuestionByQuestionId($question_id);
10607 if (is_array($question))
10610 $reached += $question[
"reached"];
10611 $max += $question[
"points"];
10616 $percent = $max ? $reached/$max * 100.0 : 0;
10620 sprintf(
"%.2f", $answered ? $reached / $answered : 0) .
" " . strtolower($this->lng->txt(
"of")) .
" " . sprintf(
"%.2f", $answered ? $max / $answered : 0),
10621 sprintf(
"%.2f", $percent) .
"%",
10623 sprintf(
"%.2f", $answered ? $reached / $answered : 0),
10624 sprintf(
"%.2f", $answered ? $max / $answered : 0),
10636 require_once
'Modules/Test/classes/class.ilTestExportFactory.php';
10638 $test_exp = $expFactory->getExporter(
'xml');
10639 return $test_exp->buildExportFile();
10657 $this->mailnotification = $a_notification;
10662 include_once
"./Modules/Test/classes/class.ilTestMailNotification.php";
10667 $mail->sendSimpleNotification($owner_id, $this->
getTitle(), $usr_data);
10677 include_once
"./Modules/Test/classes/class.ilObjTestGUI.php";
10678 include_once
"./Modules/Test/classes/tables/class.ilEvaluationAllTableGUI.php";
10680 return $table_gui->getSelectedColumns();
10685 include_once
"./Modules/Test/classes/class.ilTestMailNotification.php";
10691 require_once
'Modules/Test/classes/class.ilTestExportFactory.php';
10693 $exportObj = $expFactory->getExporter(
'results');
10694 $file = $exportObj->exportToExcel($deliver = FALSE,
'active_id', $active_id, $passedonly = FALSE);
10695 include_once
"./Services/Mail/classes/class.ilFileDataMail.php";
10697 $fd->copyAttachmentFile(
$file,
"result_" . $active_id .
".xls");
10698 $file_names[] =
"result_" . $active_id .
".xls";
10700 $mail->sendAdvancedNotification($owner_id, $this->
getTitle(), $usr_data, $file_names);
10702 if(count($file_names))
10704 $fd->unlinkFiles($file_names);
10715 $query =
"SELECT usr_id FROM usr_data";
10719 $activequery = sprintf(
"SELECT user_fi FROM tst_active WHERE test_fi = %s AND user_fi = %s",
10720 $ilDB->quote($this->getTestId()),
10721 $ilDB->quote(
$data[
'usr_id'])
10723 $activeresult = $ilDB->query($activequery);
10724 if ($activeresult->numRows() == 0)
10726 $user_id =
$data[
'usr_id'];
10727 if ($user_id != 13)
10729 include_once
"./Modules/Test/classes/class.ilTestSession.php";
10731 $testSession->setRefId($this->
getRefId());
10732 $testSession->setTestId($this->
getTestId());
10733 $testSession->setUserId($user_id);
10734 $testSession->saveToDb();
10736 $nr_of_passes = rand(1, $passes);
10737 $active_id = $testSession->getActiveId();
10740 include_once
"./Modules/Test/classes/class.ilTestSequence.php";
10742 $testSequence->loadFromDb();
10743 $testSequence->loadQuestions();
10744 if (!$testSequence->hasSequence())
10747 $testSequence->saveToDb();
10749 for ($seq = 1; $seq <= count($this->questions); $seq++)
10751 $question_id = $testSequence->getQuestionForSequence($seq);
10753 $assSettings =
new ilSetting(
'assessment');
10754 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
10756 $processLockerFactory->setQuestionId($objQuestion->getId());
10757 $processLockerFactory->setUserId($testSession->getUserId());
10758 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
10760 $objQuestion->setProcessLocker($processLockerFactory->getLocker());
10761 $objQuestion->createRandomSolution($testSession->getActiveId(),
$pass);
10763 $testSession->increasePass();
10764 $testSession->setLastSequence(0);
10765 $testSession->setLastFinishedPass(
$pass);
10766 $testSession->setSubmitted(1);
10767 $testSession->setSubmittedTimestamp(
date(
'Y-m-d H:i:s'));
10768 $testSession->saveToDb();
10771 if ($number == 0)
return;
10783 FROM tst_result_cache 10784 WHERE active_fi = %s 10793 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
10799 FROM tst_result_cache 10800 WHERE active_fi = %s 10816 if ($this->mailnottype == 1)
10830 $this->mailnottype = 1;
10834 $this->mailnottype = 0;
10840 if ($this->exportsettings)
10854 $this->exportsettings = $a_settings;
10858 $this->exportsettings = 0;
10864 if (($this->exportsettings & 1) > 0)
10878 $this->exportsettings = $this->exportsettings | 1;
10884 $this->exportsettings = $this->exportsettings ^ 1;
10890 return $this->enabled_view_mode;
10894 $this->enabled_view_mode = $mode;
10906 $new_array =
array();
10909 $query =
'SELECT question_fi FROM tst_test_question WHERE test_fi = %s';
10910 $types =
array(
'integer');
10913 $new_question_id += 1;
10917 $res = $ilDB->queryF(
$query, $types, $values);
10918 while(
$row = $ilDB->fetchAssoc(
$res)) {
10920 $qid =
$row[
'question_fi'];
10922 if ($qid == $new_question_id) {
10925 else if ($qid == $previous_question_id) {
10926 $new_array[$position++] = $qid;
10927 $new_array[$position++] = $new_question_id;
10931 $new_array[$position++] = $qid;
10935 $update_query =
'UPDATE tst_test_question SET sequence = %s WHERE test_fi = %s AND question_fi = %s';
10936 $update_types =
array(
'integer',
'integer',
'integer');
10938 foreach($new_array as $position => $qid) {
10939 $ilDB->manipulateF(
10971 'pass_details' =>
'setShowPassDetails',
10972 'solution_details' =>
'setShowSolutionDetails',
10973 'solution_printview' =>
'setShowSolutionPrintview',
10974 'solution_feedback' =>
'setShowSolutionFeedback',
10975 'solution_answers_only' =>
'setShowSolutionAnswersOnly',
10976 'solution_signature' =>
'setShowSolutionSignature',
10977 'solution_suggested' =>
'setShowSolutionSuggested',
10979 foreach($setter as $key => $setter) {
10994 $this->poolUsage = (boolean)$usage;
11003 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
11005 $questionSetConfig = $qscFactory->getQuestionSetConfig();
11008 $questionSetConfig->reindexQuestionOrdering();
11021 foreach($orders as
$id => $position)
11026 isset($obligations[
$id]) && $obligations[
$id] ? 1 : 0
11030 UPDATE tst_test_question 11033 WHERE question_fi = %s 11036 $ilDB->manipulateF(
11037 $query,
array(
'integer',
'integer',
'integer'),
array($i, $obligatory, $id)
11047 if ($question_before) {
11048 $query =
'SELECT sequence, test_fi FROM tst_test_question WHERE question_fi = %s';
11049 $types =
array(
'integer');
11050 $values =
array($question_before);
11051 $rset = $ilDB->queryF(
$query, $types, $values);
11054 if (!$question_before || ($rset && !(
$row = $ilDB->fetchAssoc($rset)))) {
11061 $update =
'UPDATE tst_test_question SET sequence = sequence + 1 WHERE sequence > %s AND test_fi = %s';
11062 $types =
array(
'integer',
'integer');
11064 $ilDB->manipulateF($update, $types, $values);
11066 $update =
'UPDATE tst_test_question SET sequence = %s WHERE question_fi = %s';
11067 $types =
array(
'integer',
'integer');
11068 $values =
array(
$row[
'sequence'] + 1, $question_to_move);
11069 $ilDB->manipulateF($update, $types, $values);
11080 $IN_questions = $ilDB->in(
'q1.question_id', array_keys($questions),
false,
'integer');
11083 SELECT count(q1.question_id) cnt 11085 FROM qpl_questions q1 11087 INNER JOIN qpl_questions q2 11088 ON q2.question_id = q1.original_id 11090 WHERE $IN_questions 11091 AND q1.obj_fi = q2.obj_fi 11094 $rset = $ilDB->query(
$query);
11096 $row = $ilDB->fetchAssoc($rset);
11098 return $row[
'cnt'] > 0;
11111 $result = $ilDB->queryF(
"SELECT test_fi,MAX(pass) AS pass FROM tst_active".
11112 " JOIN tst_pass_result ON (tst_pass_result.active_fi = tst_active.active_id)".
11113 " WHERE user_fi=%s".
11114 " GROUP BY test_fi",
11115 array(
'integer',
'integer'),
11116 array($a_user_id, 1)
11121 $obj_id = self::_getObjectIDFromTestID(
$row[
"test_fi"]);
11122 $all[$obj_id] = (bool)
$row[
"pass"];
11138 $this->online = (bool)$a_online;
11159 $this->print_best_solution_with_result = (bool) $status;
11189 $this->activation_visibility = (bool) $a_value;
11199 return (
bool)$this->activation_limited;
11204 $this->activation_limited = (bool)$a_value;
11216 $this->_highscore_enabled = (bool)$a_enabled;
11226 return (
bool) $this->_highscore_enabled;
11238 $this->_highscore_anon = (bool)$a_anon;
11252 return (
bool) $this->_highscore_anon;
11282 $this->_highscore_achieved_ts = (bool)$a_achieved_ts;
11292 return (
bool) $this->_highscore_achieved_ts;
11302 $this->_highscore_score = (bool)$a_score;
11312 return (
bool) $this->_highscore_score;
11322 $this->_highscore_percentage = (bool)$a_percentage;
11332 return (
bool) $this->_highscore_percentage;
11342 $this->_highscore_hints = (bool)$a_hints;
11352 return (
bool) $this->_highscore_hints;
11362 $this->_highscore_wtime = (bool)$a_wtime;
11372 return (
bool) $this->_highscore_wtime;
11382 $this->_highscore_own_table = (bool)$a_own_table;
11392 return (
bool) $this->_highscore_own_table;
11402 $this->_highscore_top_table = (bool)$a_top_table;
11412 return (
bool) $this->_highscore_top_table;
11423 $this->_highscore_top_num = (int)$a_top_num;
11436 $retval = $a_retval;
11437 if ( (
int) $this->_highscore_top_num != 0)
11439 $retval = $this->_highscore_top_num;
11453 return self::HIGHSCORE_SHOW_ALL_TABLES;
11457 return self::HIGHSCORE_SHOW_TOP_TABLE;
11462 return self::HIGHSCORE_SHOW_OWN_TABLE;
11474 case self::HIGHSCORE_SHOW_ALL_TABLES:
11479 case self::HIGHSCORE_SHOW_TOP_TABLE:
11484 case self::HIGHSCORE_SHOW_OWN_TABLE:
11495 switch ($specific_answer_feedback)
11498 $this->specific_answer_feedback = 1;
11501 $this->specific_answer_feedback = 0;
11508 switch ($this->specific_answer_feedback)
11545 require_once(
'Modules/TestQuestionPool/classes/class.assQuestion.php');
11553 $obligationPossible = call_user_func(
array($classConcreteQuestion,
'isObligationPossible'), $questionId);
11555 return $obligationPossible;
11568 $rset = $ilDB->queryF(
'SELECT obligatory FROM tst_test_question WHERE question_fi = %s',
array(
'integer'),
array($question_id));
11570 if(
$row = $ilDB->fetchAssoc($rset) )
11572 return (
bool)
$row[
'obligatory'];
11594 $rset = $ilDB->queryF(
11595 'SELECT obligations_answered FROM tst_pass_result WHERE active_fi = %s AND pass = %s',
11596 array(
'integer',
'integer'),
11600 if(
$row = $ilDB->fetchAssoc($rset) )
11602 return (
bool)
$row[
'obligations_answered'];
11605 return !self::hasObligations($test_id);
11620 $rset = $ilDB->queryF(
11621 'SELECT count(*) cnt FROM tst_test_question WHERE test_fi = %s AND obligatory = 1',
11625 $row = $ilDB->fetchAssoc($rset);
11627 return (
bool)
$row[
'cnt'] > 0;
11670 #region Examview / PDF Examview 11733 return (strlen($this->activation_starting_time)) ? $this->activation_starting_time : NULL;
11738 return (strlen($this->activation_ending_time)) ? $this->activation_ending_time : NULL;
11746 $result = $ilDB->query(
"SELECT tst_times.active_fi, tst_times.started FROM tst_times, tst_active WHERE tst_times.active_fi = tst_active.active_id ORDER BY tst_times.tstamp DESC");
11749 $times[
$row[
'active_fi']] = $row[
'started'];
11759 $result = $ilDB->queryF(
"SELECT tst_addtime.active_fi, tst_addtime.additionaltime FROM tst_addtime, tst_active WHERE tst_addtime.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
11765 $times[
$row[
'active_fi']] = $row[
'additionaltime'];
11774 $result = $ilDB->queryF(
"SELECT additionaltime FROM tst_addtime WHERE active_fi = %s",
11781 return $row[
'additionaltime'];
11790 $participants =
array();
11791 if ($active_id == 0)
11793 $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s",
11799 array_push($participants,
$row[
'active_id']);
11804 array_push($participants, $active_id);
11806 foreach ($participants as $active_id)
11808 $result = $ilDB->queryF(
"SELECT active_fi FROM tst_addtime WHERE active_fi = %s",
11814 $ilDB->manipulateF(
"DELETE FROM tst_addtime WHERE active_fi = %s",
11820 $ilDB->manipulateF(
"UPDATE tst_active SET tries = %s, submitted = %s, submittimestamp = %s WHERE active_id = %s",
11821 array(
'integer',
'integer',
'timestamp',
'integer'),
11822 array(0, 0, NULL, $active_id)
11825 $ilDB->manipulateF(
"INSERT INTO tst_addtime (active_fi, additionaltime, tstamp) VALUES (%s, %s, %s)",
11826 array(
'integer',
'integer',
'integer'),
11830 require_once
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
11857 public function getMaxPassOfTest()
11865 SELECT MAX(tst_pass_result.pass) + 1 max_res 11866 FROM tst_pass_result 11867 INNER JOIN tst_active ON tst_active.active_id = tst_pass_result.active_fi 11868 WHERE test_fi = '.$ilDB->quote($this->
getTestId(),
'integer').
' 11872 return (
int)
$data[
'max_res'];
11884 $exam_id_query =
'SELECT exam_id FROM tst_pass_result WHERE active_fi = %s AND pass = %s';
11885 $exam_id_result = $ilDB->queryF( $exam_id_query,
array(
'integer',
'integer' ),
array( $active_id,
$pass ) );
11886 if ($ilDB->numRows( $exam_id_result ) == 1)
11888 $exam_id_row = $ilDB->fetchAssoc( $exam_id_result );
11890 if ($exam_id_row[
'exam_id'] != null)
11892 return $exam_id_row[
'exam_id'];
11909 $inst_id = $ilSetting->get(
'inst_id', null );
11911 if($test_obj_id === null)
11913 $obj_id = self::_getObjectIDFromActiveID($active_id);
11917 $obj_id = $test_obj_id;
11920 $examId =
'I' . $inst_id .
'_T' . $obj_id .
'_A' . $active_id .
'_P' .
$pass;
11972 $this->char_selector_availability = (int) $availability;
11988 $this->char_selector_definition = $definition;
12031 $query =
"SELECT question_set_type FROM tst_tests WHERE obj_fi = %s";
12037 while(
$row = $ilDB->fetchAssoc(
$res) )
12084 return self::lookupQuestionSetType($a_obj_id) == self::QUESTION_SET_TYPE_RANDOM;
12092 return $lng->
txt(
'tst_question_set_type_fixed');
12095 return $lng->
txt(
'tst_question_set_type_random');
12098 return $lng->
txt(
'tst_question_set_type_dynamic');
12131 require_once
'class.ilTestScoring.php';
12133 $scoring->setPreserveManualScores($preserve_manscoring);
12134 $scoring->recalculateSolutions();
12139 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
12141 $questionChangeListeners =
array(
12145 return $questionChangeListeners;
12155 INNER JOIN tst_tests 12156 ON test_id = test_fi 12164 while(
$row = $ilDB->fetchAssoc(
$res) )
12166 $objIds[] = (int)
$row[
'obj_fi'];
12199 if( !self::isSkillManagementGloballyActivated() )
12211 if( self::$isSkillManagementGloballyActivated === null )
12213 include_once
'Services/Skill/classes/class.ilSkillManagementSettings.php';
12216 self::$isSkillManagementGloballyActivated = $skmgSet->isActivated();
12219 return self::$isSkillManagementGloballyActivated;
12277 $activeId = $testOBJ->getActiveIdOfUser($userId);
12279 require_once
'Modules/Test/classes/class.ilTestSessionFactory.php';
12282 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
12285 $testSession = $testSessionFactory->getSession($activeId);
12286 $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $testSession->getPass());
12287 $testSequence->loadFromDb();
12290 if($a_force_new_run)
12292 if( $testSequence->hasSequence() )
12294 $testSession->increasePass();
12296 $testSession->setLastSequence(0);
12297 $testSession->saveToDb();
12311 $activeId = $testOBJ->getActiveIdOfUser($userId);
12313 require_once
'Modules/Test/classes/class.ilTestSessionFactory.php';
12316 $testSessionFactory->reset();
12318 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
12321 $testSession = $testSessionFactory->getSession($activeId);
12322 $testSequence = $testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $testSession->getPass());
12323 $testSequence->loadFromDb();
12325 return $testSequence->hasSequence();
setStartingTime($starting_time=NULL)
Sets the starting time in database timestamp format for the test.
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.
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.
setRedirectionUrl($redirection_url=NULL)
setMailNotification($a_notification)
Set mail notification settings.
saveToDb($properties_only=FALSE)
Saves a ilObjTest object to a database.
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)
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...
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()
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...
setQuestionOrderAndObligations($orders, $obligations)
setRedirectionMode($redirection_mode=0)
processPrintoutput2FO($print_output)
Convert a print output to XSL-FO.
static _addLog($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=FALSE, $test_ref_id=NULL)
Add an assessment log entry.
setQuestionSetType($questionSetType)
setter for question set type
setECTSOutput($a_ects_output)
{}
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.
cloneObject($a_target_id, $a_copy_id=0, $a_omit_tree=false)
Clone object permissions, put in tree ...
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
setListOfQuestionsDescription($a_value=TRUE)
Sets the show_summary attribute to TRUE if the list of questions should be presented with the questio...
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...
getTestParticipantsForManualScoring($filter=NULL)
& getParticipants()
Returns all persons who started the test.
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.
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.
setListOfQuestionsStart($a_value=TRUE)
Sets if the the list of questions as the start page of the test.
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.
setListOfQuestions($a_value=TRUE)
Sets if the the list of questions should be presented to the user or not.
setTmpCopyWizardCopyId($tmpCopyWizardCopyId)
updateMetaData()
update meta data entry
static _getPassScoring($active_id)
Gets the pass scoring type.
setCharSelectorDefinition($definition='')
Class ilObject Basic functions for all objects.
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.
& 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.
setShowSolutionAnswersOnly($a_full=TRUE)
Set to true, if the full solution (including the ILIAS content pages) should be shown in the solution...
setKioskMode($a_kiosk=FALSE)
Sets the kiosk mode for the test.
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...
setShowSolutionSignature($a_signature=FALSE)
Set to TRUE, if the signature field should be shown in the solution.
& 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)
setEndingTime($ending_time=NULL)
Sets the ending time in database timestamp format for the test.
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.
prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE, $omitNl2BrWhenTextArea=false)
Prepares a string for a text area output in tests.
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...
static _getBestPass($active_id)
Retrieves the best pass of a given user for a given test.
for($col=0; $col< 50; $col++) $d
static _lookupAnonymity($a_obj_id)
Returns the anonymity status of a test with a given object id.
setShowKioskModeParticipant($a_participant=FALSE)
Set to true, if the participant's name should be shown in kiosk mode.
& getAllQuestions($pass=NULL)
Returns all questions of a test in test order.
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.
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.
& getCompleteEvaluationData($withStatistics=TRUE, $filterby="", $filtertext="")
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}
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.
$instantFeedbackAnswerFixationEnabled
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
setCustomStyle($a_customStyle=NULL)
Set the custom style.
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
getAnsweredQuestionCount($active_id, $pass=NULL)
Retrieves the number of answered questions for a given user in a given test.
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)
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)
getVisitTimeOfParticipant($active_id)
Returns the first and last visit of a participant.
static _getAvailableTests($use_object_id=FALSE)
Returns the available tests for the active user.
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.
isExecutable($testSession, $user_id, $allowPassIncrease=FALSE)
Checks if the test is executable by the given user.
setProcessingTime($processing_time="00:00:00")
Sets the processing time for the test.
$forceInstantFeedbackEnabled
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)
if(!is_array($argv)) $options
getHighscoreAnon()
Gets if the highscores should be anonymized per setting.
setExportSettings($a_settings)
static _getQuestionCountAndPointsForPassOfParticipant($active_id, $pass)
removeQuestion($question_id)
Removes a question from the test object.
getId()
get object id public
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.
deliverPDFfromHTML($content, $title=NULL)
Delivers a PDF file from XHTML.
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
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.
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.
& processCSVRow($row, $quoteAll=FALSE, $separator=";")
Processes an array as a CSV row and converts the array values to correct CSV values.
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()
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.
static _getSolvedQuestions($active_id, $question_fi=null)
get solved questions
buildIso8601PeriodFromUnixtimeForExportCompatibility($unix_timestamp)
canShowSolutionPrintview($user_id=NULL)
Calculates if a user may see the solution printview of his/her test results.
static formatDate(ilDateTime $date)
Format a date public.
setAllowedUsersTimeGap($a_allowed_users_time_gap)
getTitle()
get object title public
applyDefaults($test_defaults)
Applies given test defaults to this test.
randomSelectQuestions($nr_of_questions, $questionpool, $use_obj_id=0, $qpls="", $pass=NULL)
Returns a random selection of questions.
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.
loadQuestions($active_id="", $pass=NULL)
Load the test question id's from the database.
isBestSolutionPrintedWithResult()
& getExistingQuestions($pass=NULL)
Get the id's of the questions which are already part of the test.
$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.
static ensureParticipantsLastActivePassFinished($testObjId, $userId, $a_force_new_run=FALSE)
setECTSGrades(array $a_ects_grades)
{}
userLookupFullName($user_id, $overwrite_anonymity=FALSE, $sorted_order=FALSE, $suffix="")
Returns the full name of a test user according to the anonymity status.
removeTestResultsFromSoapLpAdministration($userIds)
getMarkSchema()
{ASS_MarkSchema}
getAggregatedResultsData()
Returns the aggregated test results.
static _lookupAuthor($obj_id)
Gets the authors name of the ilObjTest object.
& 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.
getStartingTime()
Returns the starting time of the test.
getStartingTimeOfParticipants()
setAnonymity($a_value=0)
Sets the anonymity status of the test.
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
setShowSolutionFeedback($a_feedback=TRUE)
Sets if the the feedback should be presented to the user in the solution or not.
isInstantFeedbackAnswerFixationEnabled()
$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.
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)
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.
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
getEndingTime()
Returns the ending time of the test.
setListOfQuestionsEnd($a_value=TRUE)
Sets if the the list of questions as the end page 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)
getScoreCutting()
Determines if the score of a question should be cut at 0 points or the score of the whole test...
setShowSolutionSuggested($a_solution=FALSE)
Set to TRUE, if the suggested solution should be shown in the solution.
getCharSelectorAvailability()
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.
setShowSolutionListComparison($a_comparison=FALSE)
Set to TRUE, if the list of answers should be shown prior to finish the test.
setOfferingQuestionHintsEnabled($offeringQuestionHintsEnabled)
sets offering question hints enabled/disabled
checkMaximumAllowedUsers()
moveQuestions($move_questions, $target_index, $insert_mode)
Move questions to another position.
getSequenceByActiveIdAndPass($activeId, $pass)
creates and returns an instance of a test sequence that corresponds to the current test mode and give...
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...
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.
setShowKioskModeTitle($a_title=FALSE)
Set to true, if the full test title should be shown in kiosk mode.
saveAuthorToMetadata($a_author="")
Saves an authors name into the lifecycle metadata if no lifecycle metadata exists This will only be c...
setActivationStartingTime($starting_time=NULL)
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.
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)
getTextAnswer($active_id, $question_id, $pass=NULL)
Returns the text answer of a given user for a given question.
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
getHighscoreScore()
Gets if the score column should be shown.
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.
& getWorkedQuestions($active_id, $pass=NULL)
Gets the id's of all questions a user already worked through.
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)
getPassFinishDate($active_id, $pass)
Retrieves the number of answered questions for a given user in a given test.
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)
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 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. ...
getForceJS()
Gets whether JavaScript should be forced for tests.
Class ilObjectActivation.
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.
isComplete(ilTestQuestionSetConfig $testQuestionSetConfig)
Returns true, if a test is complete for use and can be set online.
setActivationEndingTime($ending_time=NULL)
static getFeedbackClassNameByQuestionType($questionType)
static _getQuestionTitle($question_id)
Returns the question title of a question with a given id.
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.
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()
setPassword($a_password=NULL)
Sets the password for test access.
setListOfQuestionsSettings($a_value=0)
Sets the settings for the list of questions options in the test properties This could contain one of ...
static _setImportDirectory($a_import_dir=null)
set import directory
static _getTestDefaults($test_defaults_id)
read()
read object data from db into object
& 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...
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.
$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.