4 include_once
"./Services/Object/classes/class.ilObject.php";
5 include_once
"./Modules/Test/classes/inc.AssessmentConstants.php";
515 public function __construct($a_id = 0,$a_call_by_reference =
true)
520 $lng->loadLanguageModule(
"assessment");
522 include_once
"./Modules/Test/classes/class.assMarkSchema.php";
524 $this->mark_schema->createSimpleSchema(
525 $lng->txt(
"failed_short"),
526 $lng->txt(
"failed_official"),
529 $lng->txt(
"passed_short"),
530 $lng->txt(
"passed_official"),
536 $this->author = $ilUser->fullname;
537 $this->introduction =
"";
538 $this->questions = array();
541 $this->instant_verification = 0;
542 $this->answer_feedback_points = 0;
543 $this->reporting_date =
"";
544 $this->nr_of_tries = 0;
546 $this->use_previous_answers = 1;
547 $this->title_output = 0;
548 $this->starting_time =
"";
549 $this->ending_time =
"";
550 $this->processing_time =
"00:00:00";
551 $this->enable_processing_time =
"0";
552 $this->reset_processing_time = 0;
553 $this->ects_output = 0;
554 $this->ects_fx = NULL;
555 $this->shuffle_questions = FALSE;
556 $this->mailnottype = 0;
557 $this->exportsettings = 0;
558 $this->show_summary = 8;
563 $this->answer_feedback = 0;
564 $this->password =
"";
565 $this->certificate_visibility = 0;
566 $this->allowedUsers =
"";
567 $this->_showfinalstatement = FALSE;
568 $this->_finalstatement =
"";
569 $this->_showinfo = TRUE;
570 $this->_forcejs = FALSE;
571 $this->_customStyle =
"";
572 $this->allowedUsersTimeGap =
"";
573 $this->anonymity = 0;
574 $this->show_cancel = 0;
575 $this->show_marker = 0;
576 $this->fixed_participants = 0;
581 $this->testSession = FALSE;
582 $this->testSequence = FALSE;
583 $this->mailnotification = 0;
584 $this->poolUsage = 1;
586 $this->ects_grades = array(
594 $this->autosave = FALSE;
595 $this->autosave_ival = 30000;
597 $this->enable_examview =
false;
598 $this->show_examview_html =
false;
599 $this->show_examview_pdf =
false;
600 $this->enable_archiving =
false;
602 $this->express_mode =
false;
603 $this->template_id =
'';
604 $this->redirection_mode = 0;
605 $this->redirection_url = NULL;
606 $this->show_exam_id_in_test_pass_enabled =
false;
607 $this->show_exam_id_in_test_results_enabled =
false;
608 $this->sign_submission =
false;
609 $this->char_selector_availability = 0;
610 $this->char_selector_definition = null;
612 $this->testFinalBroken =
false;
614 $this->
ilObject($a_id, $a_call_by_reference);
640 if (!parent::update())
655 function read($a_force_db =
false)
657 parent::read($a_force_db);
671 if (!parent::delete())
692 global $tree, $ilDB, $ilPluginAdmin;
698 $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s",
702 $active_array = array();
705 array_push($active_array,
$row[
"active_id"]);
708 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_active WHERE test_fi = %s",
713 if (count($active_array))
715 foreach ($active_array as $active_id)
717 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_times WHERE active_fi = %s",
722 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_sequence WHERE active_fi = %s",
729 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_mark WHERE test_fi = %s",
734 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_tests WHERE test_id = %s",
739 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
741 $testQuestionSetConfigFactory->getQuestionSetConfig()->removeQuestionSetRelatedData();
744 include_once
"./Services/Utilities/classes/class.ilUtil.php";
746 $directory = $tst_data_dir.
"/tst_".$this->
getId();
747 if (is_dir($directory))
749 include_once
"./Services/Utilities/classes/class.ilUtil.php";
752 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
758 foreach(
$mobs as $mob)
797 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
837 if ($a_node_id==
$_GET[
"ref_id"])
839 $parent_obj =& $this->
ilias->obj_factory->getInstanceByRefId($a_node_id);
840 $parent_type = $parent_obj->getType();
841 if ($parent_type == $this->
getType())
843 $a_node_id = (int) $tree->getParentId($a_node_id);
847 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
857 include_once
"./Services/Utilities/classes/class.ilUtil.php";
860 if (!is_writable($tst_data_dir))
862 $this->
ilias->raiseError(
"Test Data Directory (".$tst_data_dir
863 .
") not writeable.",$this->
ilias->error_obj->MESSAGE);
867 $tst_dir = $tst_data_dir.
"/tst_".$this->
getId();
869 if (!@is_dir($tst_dir))
871 $this->
ilias->raiseError(
"Creation of Test Directory failed.",$this->
ilias->error_obj->MESSAGE);
874 $export_dir = $tst_dir.
"/export";
876 if (!@is_dir($export_dir))
878 $this->
ilias->raiseError(
"Creation of Export Directory failed.",$this->
ilias->error_obj->MESSAGE);
889 include_once
"./Services/Utilities/classes/class.ilUtil.php";
900 function getExportFiles($dir)
903 if(!@is_dir($dir) || !is_writeable($dir))
919 $files[] = $file->getBasename();
932 if (strlen($a_import_dir))
934 $_SESSION[
"tst_import_dir"] = $a_import_dir;
970 include_once
"./Services/Utilities/classes/class.ilUtil.php";
974 if (!is_writable($tst_data_dir))
976 $this->
ilias->raiseError(
"Test Data Directory (".$tst_data_dir
977 .
") not writeable.",$this->
ilias->error_obj->FATAL);
981 $tst_dir = $tst_data_dir.
"/tst_import";
983 if (!@is_dir($tst_dir))
985 $ilias->raiseError(
"Creation of test import directory failed.",$ilias->error_obj->FATAL);
1000 $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",
1007 if (strcmp(
$row[
'foundtypes'],
'assSingleChoice') == 0)
1025 $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",
1032 if (strcmp(
$row[
'foundtypes'],
'assSingleChoice') == 0)
1057 SELECT DISTINCT(qpl_qst_sc.shuffle) foundshuffles 1063 WHERE tst_test_result.question_fi = qpl_questions.question_id 1064 AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id 1065 AND tst_test_result.active_fi = tst_active.active_id 1066 AND qpl_questions.question_id = qpl_qst_sc.question_fi 1067 AND tst_active.test_fi = %s 1068 AND qpl_qst_type.type_tag = %s 1070 array(
'integer',
'text'),
1071 array($this->
getTestId(),
'assSingleChoice')
1076 return (
$row[
'foundshuffles'] == 0);
1089 if( !count($this->mark_schema->mark_steps) )
1110 global $tree, $ilDB, $ilPluginAdmin;
1113 $test->loadFromDb();
1115 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
1118 return $test->isComplete( $testQuestionSetConfigFactory->getQuestionSetConfig() );
1126 function saveECTSStatus($ects_output = 0, $fx_support =
"", $ects_a = 90, $ects_b = 65, $ects_c = 35, $ects_d = 10, $ects_e = 0)
1129 if ($this->test_id > 0)
1131 $fx_support = preg_replace(
"/,/",
".", $fx_support);
1132 if (preg_match(
"/\d+/", $fx_support))
1134 $fx_support = $fx_support;
1140 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_tests SET ects_output = %s, ects_a = %s, ects_b = %s, ects_c = %s, ects_d = %s, ects_e = %s, ects_fx = %s WHERE test_id = %s",
1141 array(
'text',
'float',
'float',
'float',
'float',
'float',
'float',
'integer'),
1142 array($ects_output, $ects_a, $ects_b, $ects_c, $ects_d, $ects_e, $fx_support, $this->
getTestId())
1145 $this->ects_fx = $fx_support;
1159 if ($this->
isComplete($testQuestionSetConfig))
1163 if ($this->test_id > 0)
1165 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_tests SET complete = %s WHERE test_id = %s",
1166 array(
'text',
'integer'),
1167 array($complete, $this->test_id)
1192 include_once(
"./Services/RTE/classes/class.ilRTE.php");
1193 $completecontent =
"";
1196 $completecontent .= $content;
1209 global $tree, $ilDB, $ilPluginAdmin;
1216 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
1218 $testQuestionSetConfig = $testQuestionSetConfigFactory->getQuestionSetConfig();
1220 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1221 if ($this->test_id == -1)
1224 $next_id = $ilDB->nextId(
'tst_tests');
1226 $ilDB->insert(
'tst_tests', array(
1227 'test_id' => array(
'integer', $next_id),
1228 'obj_fi' => array(
'integer', $this->
getId()),
1229 'author' => array(
'text', $this->
getAuthor()),
1232 'showinfo' => array(
'integer', $this->
getShowInfo()),
1233 'forcejs' => array(
'integer', $this->
getForceJS()),
1245 'nr_of_tries' => array(
'integer', $this->
getNrOfTries()),
1246 'kiosk' => array(
'integer', $this->
getKiosk()),
1255 'complete' => array(
'text', $this->
isComplete($testQuestionSetConfig)),
1257 'ects_a' => array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : NULL),
1258 'ects_b' => array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : NULL),
1259 'ects_c' => array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : NULL),
1260 'ects_d' => array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : NULL),
1261 'ects_e' => array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : NULL),
1262 'ects_fx' => array(
'float', $this->
getECTSFX()),
1270 'password' => array(
'text', $this->
getPassword()),
1277 'created' => array(
'integer', time()),
1278 'tstamp' => array(
'integer', time()),
1280 'template_id' => array(
'integer', $this->
getTemplate()),
1281 'pool_usage' => array(
'integer', $this->
getPoolUsage()),
1295 'online_status' => array(
'integer', (
int)$this->
isOnline()),
1297 'autosave' => array(
'integer', (
int)$this->
getAutosave()),
1315 $this->test_id = $next_id;
1328 $result = $ilDB->queryF(
"SELECT * FROM tst_tests WHERE test_id = %s",
1330 array($this->test_id)
1334 $oldrow = $ilDB->fetchAssoc(
$result);
1338 $ilDB->update(
'tst_tests',
1340 'author' => array(
'text', $this->
getAuthor()),
1343 'showinfo' => array(
'integer', $this->
getShowInfo()),
1344 'forcejs' => array(
'integer', $this->
getForceJS()),
1356 'nr_of_tries' => array(
'integer', $this->
getNrOfTries()),
1357 'kiosk' => array(
'integer', $this->
getKiosk()),
1366 'complete' => array(
'text', $this->
isComplete($testQuestionSetConfig)),
1368 'ects_a' => array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : NULL),
1369 'ects_b' => array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : NULL),
1370 'ects_c' => array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : NULL),
1371 'ects_d' => array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : NULL),
1372 'ects_e' => array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : NULL),
1373 'ects_fx' => array(
'float', $this->
getECTSFX()),
1381 'password' => array(
'text', $this->
getPassword()),
1390 'tstamp' => array(
'integer', time()),
1392 'template_id' => array(
'integer', $this->
getTemplate()),
1393 'pool_usage' => array(
'integer', $this->
getPoolUsage()),
1407 'online_status' => array(
'integer', (
int)$this->
isOnline()),
1409 'autosave' => array(
'integer', (
int)$this->
getAutosave()),
1427 'test_id' => array(
'integer', (
int)$this->
getTestId())
1431 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1434 $logresult = $ilDB->queryF(
"SELECT * FROM tst_tests WHERE test_id = %s",
1439 if ($logresult->numRows() == 1)
1441 $newrow = $ilDB->fetchAssoc($logresult);
1443 $changed_fields = array();
1444 foreach ($oldrow as $key => $value)
1446 if (strcmp($oldrow[$key], $newrow[$key]) != 0)
1448 array_push($changed_fields,
"$key: " . $oldrow[$key] .
" => " . $newrow[$key]);
1451 $changes = join($changed_fields,
", ");
1452 if (count($changed_fields) > 0)
1463 $aresult = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s AND tries >= %s AND submitted = %s",
1464 array(
'integer',
'integer',
'integer'),
1467 while (
$row = $ilDB->fetchAssoc($aresult))
1469 $ilDB->manipulateF(
"UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
1470 array(
'integer',
'timestamp',
'integer'),
1471 array(1, date(
'Y-m-d H:i:s'),
$row[
"active_id"])
1476 $aresult = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s AND tries < %s AND submitted = %s",
1477 array(
'integer',
'integer',
'integer'),
1480 while (
$row = $ilDB->fetchAssoc($aresult))
1482 $ilDB->manipulateF(
"UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
1483 array(
'integer',
'timestamp',
'integer'),
1484 array(0, NULL,
$row[
"active_id"])
1491 $aresult = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s AND submitted = %s",
1492 array(
'integer',
'integer'),
1495 while (
$row = $ilDB->fetchAssoc($aresult))
1497 $ilDB->manipulateF(
"UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
1498 array(
'integer',
'timestamp',
'integer'),
1499 array(0, NULL,
$row[
"active_id"])
1509 include_once
"./Services/Object/classes/class.ilObjectActivation.php";
1525 $item->update($this->ref_id);
1528 if (!$properties_only)
1533 $ilias->raiseError(
$result->getMessage());
1541 $this->mark_schema->saveToDb($this->test_id);
1556 $oldquestions = array();
1557 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
1560 $result = $ilDB->queryF(
"SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
1568 array_push($oldquestions,
$row[
"question_fi"]);
1574 $currentQuestionsObligationsQuery =
'SELECT question_fi, obligatory FROM tst_test_question WHERE test_fi = %s';
1575 $rset = $ilDB->queryF($currentQuestionsObligationsQuery, array(
'integer'), array($this->
getTestId()));
1576 while (
$row = $ilDB->fetchAssoc($rset)) {
1577 $obligatoryQuestionState[
$row[
'question_fi']] = $row[
'obligatory'];
1580 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_test_question WHERE test_fi = %s",
1585 foreach ($this->questions as $key => $value)
1588 if( !isset($obligatoryQuestionState[$value]) || is_null($obligatoryQuestionState[$value]) )
1590 $obligatoryQuestionState[$value] = 0;
1594 $next_id = $ilDB->nextId(
'tst_test_question');
1595 $ilDB->insert(
'tst_test_question', array(
1596 'test_question_id' => array(
'integer', $next_id),
1597 'test_fi' => array(
'integer', $this->
getTestId()),
1598 'question_fi' => array(
'integer', $value),
1599 'sequence' => array(
'integer', $key),
1600 'obligatory' => array(
'integer', $obligatoryQuestionState[$value]),
1601 'tstamp' => array(
'integer', time())
1604 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1607 $result = $ilDB->queryF(
"SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
1611 $newquestions = array();
1616 array_push($newquestions,
$row[
"question_fi"]);
1619 foreach ($oldquestions as $index => $question_id)
1621 if (strcmp($newquestions[$index], $question_id) != 0)
1623 $pos = array_search($question_id, $newquestions);
1634 foreach ($newquestions as $index => $question_id)
1636 if (array_search($question_id, $oldquestions) === FALSE)
1652 $result = $ilDB->queryF(
'SELECT copy_id FROM tst_rnd_cpy WHERE tst_fi = %s',
1656 return $result->numRows() > 0;
1680 $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",
1684 $original_ids = array();
1685 $paramtypes = array();
1686 $paramvalues = array();
1689 array_push($original_ids,
$row[
'original_id']);
1694 if (($questionpool == 0) && (!is_array($qpls)))
1696 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
1698 if (count($available_pools))
1700 $available =
" AND " . $ilDB->in(
'obj_fi', $available_pools,
false,
'integer');
1708 $constraint_qpls =
"";
1709 $result_array = array();
1710 if ($questionpool == 0)
1712 if (is_array($qpls))
1714 if (count($qpls) > 0)
1716 $constraint_qpls =
" AND " . $ilDB->in(
'obj_fi', $qpls,
false,
'integer');
1721 $original_clause =
"";
1722 if (count($original_ids))
1724 $original_clause =
" AND " . $ilDB->in(
'question_id', $original_ids,
true,
'integer');
1727 if ($questionpool == 0)
1729 $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",
1730 array(
'integer',
'text'),
1736 $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",
1737 array(
'integer',
'integer',
'text'),
1738 array($questionpool, 0,
"1")
1741 $found_ids = array();
1744 array_push($found_ids,
$row[
'question_id']);
1746 $nr_of_questions = ($nr_of_questions > count($found_ids)) ? count($found_ids) : $nr_of_questions;
1747 if ($nr_of_questions == 0)
return array();
1748 $rand_keys = array_rand($found_ids, $nr_of_questions);
1750 if (is_array($rand_keys))
1752 foreach ($rand_keys as $key)
1754 $result[$found_ids[$key]] = $found_ids[$key];
1759 $result[$found_ids[$rand_keys]] = $found_ids[$rand_keys];
1775 $result = $ilDB->queryF(
"SELECT test_result_id FROM tst_test_result WHERE active_fi = %s AND pass = %s",
1776 array(
'integer',
'integer'),
1777 array($active_id,
$pass)
1795 $result = $ilDB->queryF(
"SELECT test_random_question_id FROM tst_test_rnd_qst WHERE active_fi = %s AND pass = %s",
1796 array(
'integer',
'integer'),
1797 array($active_id,
$pass)
1799 return (
$result->numRows() > 0) ?
true :
false;
1809 $result = $ilDB->queryF(
"SELECT * FROM tst_tests WHERE obj_fi = %s",
1811 array($this->
getId())
1822 include_once(
"./Services/RTE/classes/class.ilRTE.php");
1856 "A" =>
$data->ects_a,
1857 "B" =>
$data->ects_b,
1858 "C" =>
$data->ects_c,
1859 "D" =>
$data->ects_d,
1860 "E" =>
$data->ects_e
1864 $this->mark_schema->flush();
1865 $this->mark_schema->loadFromDb($this->
getTestId());
1915 include_once
"./Services/Object/classes/class.ilObjectActivation.php";
1917 switch($activation[
"timing_type"])
1944 $this->questions = array();
1945 if (strcmp($active_id,
"") == 0)
1955 $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",
1956 array(
'integer',
'integer'),
1957 array($active_id,
$pass)
1965 $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",
1973 $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",
1975 array($this->test_id)
1981 $this->questions[$index++] =
$data[
"question_fi"];
2006 $this->_finalstatement = $a_statement;
2018 $this->_showinfo = ($a_info) ? 1 : 0;
2030 $this->_forcejs = ($a_js) ? 1 : 0;
2042 $this->_customStyle = $a_customStyle;
2054 return (strlen($this->_customStyle)) ? $this->_customStyle : NULL;
2067 $css_path = str_replace(
"ta.css",
"customstyles", $css_path) .
"/";
2068 $customstyles = array();
2069 if (is_dir($css_path))
2072 include_once
"./Services/Utilities/classes/class.ilFileUtils.php";
2078 if (strpos($filename,
".css"))
2080 array_push($customstyles, $filename);
2085 return $customstyles;
2100 $custom = str_replace(
"ta.css",
"customstyles/" . $this->
getCustomStyle(), $default);
2101 if (file_exists($custom))
2104 $custom = str_replace(
"ta.css",
"customstyles/" . $this->
getCustomStyle(), $custom);
2127 $this->_showfinalstatement = ($show) ? 1 : 0;
2138 return (strlen($this->introduction)) ? $this->introduction : NULL;
2149 return (strlen($this->_finalstatement)) ? $this->_finalstatement : NULL;
2161 return ($this->_showinfo) ? 1 : 0;
2173 return ($this->_forcejs) ? 1 : 0;
2185 return ($this->_showfinalstatement) ? 1 : 0;
2209 return ($this->ects_output) ? 1 : 0;
2221 $this->ects_output = $a_ects_output ? 1 : 0;
2233 return (strlen($this->ects_fx)) ? $this->ects_fx : NULL;
2245 $this->ects_fx = $a_ects_fx;
2269 if (is_array($a_ects_grades))
2271 $this->ects_grades = $a_ects_grades;
2308 switch ($instant_feedback)
2311 $this->instant_verification = 1;
2314 $this->instant_verification = 0;
2328 switch ($answer_feedback)
2331 $this->answer_feedback = 1;
2334 $this->answer_feedback = 0;
2347 switch ($generic_answer_feedback)
2350 $this->answer_feedback = 1;
2353 $this->answer_feedback = 0;
2367 switch ($answer_feedback_points)
2370 $this->answer_feedback_points = 1;
2373 $this->answer_feedback_points = 0;
2387 if (!$reporting_date)
2389 $this->reporting_date =
"";
2390 $this->ects_output = 0;
2408 return ($this->sequence_settings) ? $this->sequence_settings : 0;
2420 return ($this->score_reporting) ? $this->score_reporting : 0;
2432 return ($this->instant_verification) ? $this->instant_verification : 0;
2445 return ($this->answer_feedback) ? $this->answer_feedback : 0;
2458 return ($this->answer_feedback) ? $this->answer_feedback : 0;
2470 return ($this->answer_feedback_points) ? $this->answer_feedback_points : 0;
2482 return ($this->count_system) ? $this->count_system : 0;
2495 $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",
2502 return $row[
"count_system"];
2516 return ($this->mc_scoring) ? $this->mc_scoring : 0;
2528 return ($this->score_cutting) ? $this->score_cutting : 0;
2540 return (strlen($this->password)) ? $this->password : NULL;
2552 return ($this->pass_scoring) ? $this->pass_scoring : 0;
2565 $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",
2572 return $row[
"pass_scoring"];
2587 $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",
2594 return $row[
"mc_scoring"];
2609 $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",
2616 return $row[
"score_cutting"];
2630 return (strlen($this->reporting_date)) ? $this->reporting_date : NULL;
2642 return ($this->nr_of_tries) ? $this->nr_of_tries : 0;
2654 return ($this->_kiosk) ? $this->_kiosk : 0;
2667 $this->_kiosk = $kiosk;
2679 if (($this->_kiosk & 1) > 0)
2700 $this->_kiosk = $this->_kiosk | 1;
2706 $this->_kiosk = $this->_kiosk ^ 1;
2720 if (($this->_kiosk & 2) > 0)
2740 $this->_kiosk = $this->_kiosk | 2;
2746 $this->_kiosk = $this->_kiosk ^ 2;
2760 if (($this->_kiosk & 4) > 0)
2780 $this->_kiosk = $this->_kiosk | 4;
2786 $this->_kiosk = $this->_kiosk ^ 4;
2800 return ($this->use_previous_answers) ? $this->use_previous_answers : 0;
2812 return ($this->title_output) ? $this->title_output : 0;
2827 $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",
2834 return $row[
"title_output"];
2853 $use_previous_answers = 1;
2855 $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",
2862 $use_previous_answers =
$row[
"use_previous_answers"];
2865 if ($use_previous_answers == 1)
2867 if ($user_active_user_setting)
2869 $res = $ilUser->getPref(
"tst_use_previous_answers");
2872 $use_previous_answers =
$res;
2888 return (strlen($this->processing_time)) ? $this->processing_time : NULL;
2899 if (strlen($this->processing_time))
2901 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches))
2903 if ((
int)$matches[1]+(
int)$matches[2]+(
int)$matches[3] == 0)
2910 'hh' => $matches[1],
2911 'mm' => $matches[2],
2912 'ss' => $matches[3],
2929 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $this->
getProcessingTime(), $matches))
2932 return ($matches[1] * 3600) + ($matches[2] * 60) + $matches[3] + $extratime;
2949 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getEndingTime(), $matches))
2951 $ending = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
2953 return $ending - $now;
2970 return ($this->enable_processing_time) ? $this->enable_processing_time : 0;
2982 return ($this->reset_processing_time) ? $this->reset_processing_time : 0;
2994 return (strlen($this->starting_time)) ? $this->starting_time : NULL;
3006 return (strlen($this->ending_time)) ? $this->ending_time : NULL;
3030 if ($use_previous_answers)
3032 $this->use_previous_answers = 1;
3036 $this->use_previous_answers = 0;
3066 switch ($title_output)
3069 $this->title_output = 1;
3072 $this->title_output = 2;
3075 $this->title_output = 0;
3102 $this->enable_processing_time =
"1";
3104 $this->enable_processing_time =
"0";
3119 $this->reset_processing_time = 1;
3123 $this->reset_processing_time = 0;
3160 $this->count_system = $a_count_system;
3172 $this->password = $a_password;
3184 $this->score_cutting = $a_score_cutting;
3196 $this->mc_scoring = $a_mc_scoring;
3208 switch ($a_pass_scoring)
3229 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3234 $question->delete($question_id);
3254 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_solutions WHERE tst_solutions.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s) AND tst_solutions.question_fi = %s",
3255 array(
'integer',
'integer'),
3258 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_qst_solved WHERE tst_qst_solved.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s) AND tst_qst_solved.question_fi = %s",
3259 array(
'integer',
'integer'),
3262 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_test_result WHERE tst_test_result.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s) AND tst_test_result.question_fi = %s",
3263 array(
'integer',
'integer'),
3266 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_pass_result WHERE tst_pass_result.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s)",
3271 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
3276 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_solutions WHERE tst_solutions.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s)",
3280 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_qst_solved WHERE tst_qst_solved.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s)",
3284 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_test_result WHERE tst_test_result.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s)",
3288 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_pass_result WHERE tst_pass_result.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s)",
3293 $query =
"SELECT active_id FROM tst_active WHERE test_fi = %s";
3295 $activeIds = array();
3296 while(
$row = $ilDB->fetchAssoc(
$res) )
3298 $activeIds[] =
$row[
'active_id'];
3301 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
3304 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3311 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_sequence WHERE tst_sequence.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s)",
3318 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_test_rnd_qst WHERE tst_test_rnd_qst.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s)",
3325 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_active WHERE test_fi = %s",
3331 $affectedRows = $ilDB->manipulateF(
"DELETE FROM usr_pref WHERE keyword = %s",
3333 array(
"tst_password_".$this->
getTestId())
3338 if (@is_dir(CLIENT_WEB_DIR .
"/assessment/tst_" . $this->
getTestId()))
3354 require_once
'Services/Object/classes/class.ilObjectLP.php';
3356 $testLP->resetLPDataForUserIds($participantData->
getUserIds(),
false);
3369 require_once
'Modules/Test/classes/class.ilTestParticipantData.php';
3371 $participantData->setUserIds($userIds);
3372 $participantData->load($this->
getTestId());
3374 $IN_userIds = $ilDB->in(
'usr_id', $participantData->getUserIds(),
false,
'integer');
3375 $ilDB->manipulateF(
"DELETE FROM usr_pref WHERE $IN_userIds AND keyword = %s",
3376 array(
'text'), array(
"tst_password_".$this->
getTestId())
3379 if( count($participantData->getActiveIds()) )
3389 $IN_activeIds = $ilDB->in(
'active_fi', $activeIds,
false,
'integer');
3391 $ilDB->manipulate(
"DELETE FROM tst_solutions WHERE $IN_activeIds");
3392 $ilDB->manipulate(
"DELETE FROM tst_qst_solved WHERE $IN_activeIds");
3393 $ilDB->manipulate(
"DELETE FROM tst_test_result WHERE $IN_activeIds");
3394 $ilDB->manipulate(
"DELETE FROM tst_pass_result WHERE $IN_activeIds");
3395 $ilDB->manipulate(
"DELETE FROM tst_result_cache WHERE $IN_activeIds");
3396 $ilDB->manipulate(
"DELETE FROM tst_sequence WHERE $IN_activeIds");
3400 $ilDB->manipulate(
"DELETE FROM tst_test_rnd_qst WHERE $IN_activeIds");
3404 $ilDB->manipulate(
"DELETE FROM tst_seq_qst_tracking WHERE $IN_activeIds");
3405 $ilDB->manipulate(
"DELETE FROM tst_seq_qst_answstatus WHERE $IN_activeIds");
3406 $ilDB->manipulate(
"DELETE FROM tst_seq_qst_postponed WHERE $IN_activeIds");
3407 $ilDB->manipulate(
"DELETE FROM tst_seq_qst_checked WHERE $IN_activeIds");
3410 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3412 foreach ($activeIds as $active_id)
3416 if (@is_dir(CLIENT_WEB_DIR .
"/assessment/tst_" . $this->
getTestId() .
"/$active_id"))
3427 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
3435 $IN_activeIds = $ilDB->in(
'active_id', $activeIds,
false,
'integer');
3436 $ilDB->manipulate(
"DELETE FROM tst_active WHERE $IN_activeIds");
3446 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_solutions WHERE active_fi = %s",
3450 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_qst_solved WHERE active_fi = %s",
3454 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_test_result WHERE active_fi = %s",
3458 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_pass_result WHERE active_fi = %s",
3465 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_test_rnd_qst WHERE active_fi = %s",
3471 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3477 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_sequence WHERE active_fi = %s",
3483 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_active WHERE active_id = %s",
3491 $affectedRows = $ilDB->manipulateF(
"DELETE FROM usr_pref WHERE usr_id = %s AND keyword = %s",
3492 array(
'integer',
'text'),
3493 array($user_id,
"tst_password_".$this->
getTestId())
3499 if (@is_dir(CLIENT_WEB_DIR .
"/assessment/tst_" . $this->
getTestId() .
"/$active_id"))
3504 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
3520 $result = $ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
3521 array(
'integer',
'integer'),
3525 if (
$data->sequence > 1)
3528 $result = $ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
3529 array(
'integer',
'integer'),
3532 $data_previous = $ilDB->fetchObject(
$result);
3534 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
3535 array(
'integer',
'integer'),
3536 array(
$data->sequence, $data_previous->test_question_id)
3539 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
3540 array(
'integer',
'integer'),
3541 array(
$data->sequence - 1,
$data->test_question_id)
3543 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3564 $result = $ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
3565 array(
'integer',
'integer'),
3569 $result = $ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
3570 array(
'integer',
'integer'),
3576 $data_next = $ilDB->fetchObject(
$result);
3578 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
3579 array(
'integer',
'integer'),
3580 array(
$data->sequence, $data_next->test_question_id)
3583 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
3584 array(
'integer',
'integer'),
3585 array(
$data->sequence + 1,
$data->test_question_id)
3587 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3607 $duplicate_id = $question->duplicate(
true, null, null, null, $this->
getId());
3609 return $duplicate_id;
3623 #var_dump($question_id); 3626 $duplicate_id = $question_id;
3634 $result = $ilDB->queryF(
"SELECT MAX(sequence) seq FROM tst_test_question WHERE test_fi=%s",
3643 $sequence =
$data->seq + 1;
3646 $next_id = $ilDB->
nextId(
'tst_test_question');
3647 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_test_question (test_question_id, test_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
3648 array(
'integer',
'integer',
'integer',
'integer',
'integer'),
3649 array($next_id, $this->
getTestId(), $duplicate_id, $sequence, time())
3651 if ($affectedRows == 1)
3653 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3660 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_active WHERE test_fi = %s",
3666 return $duplicate_id;
3682 $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",
3688 array_push($titles,
$row[
"title"]);
3707 $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",
3713 $titles[
$row[
'question_id']] = $row[
"title"];
3731 return $this->lng->txt(
"ass_question");
3751 $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",
3770 $existing_questions = array();
3775 $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",
3776 array(
'integer',
'integer'),
3777 array($active_id,
$pass)
3782 $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",
3789 if(
$data->original_id === null )
3794 array_push($existing_questions,
$data->original_id);
3796 return $existing_questions;
3810 if ($question_id < 1)
return -1;
3811 $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",
3818 return $data->type_tag;
3836 $next_id = $ilDB->nextId(
'tst_times');
3837 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_times (times_id, active_fi, started, finished, pass, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
3838 array(
'integer',
'integer',
'timestamp',
'timestamp',
'integer',
'integer'),
3839 array($next_id, $active_id, strftime(
"%Y-%m-%d %H:%M:%S"), strftime(
"%Y-%m-%d %H:%M:%S"),
$pass, time())
3854 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_times SET finished = %s, tstamp = %s WHERE times_id = %s",
3855 array(
'timestamp',
'integer',
'integer'),
3856 array(strftime(
"%Y-%m-%d %H:%M:%S"), time(), $times_id)
3873 $result = $ilDB->queryF(
"SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
3874 array(
'integer',
'integer'),
3875 array($active_id, 0)
3880 $result = $ilDB->queryF(
"SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
3881 array(
'integer',
'integer'),
3882 array($active_id,
$pass)
3885 $result_array = array();
3888 array_push($result_array,
$row[
"question_fi"]);
3890 return $result_array;
3904 return ((($currentpass > 0) && ($num == 0)) || $this->
isTestFinished($active_id)) ? true :
false;
3918 $result_array = array();
3923 if (count($this->questions) == 0)
return $result_array;
3928 $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'),
3929 array(
'integer',
'integer'),
3930 array($active_id,
$pass)
3935 if (count($this->questions) == 0)
return $result_array;
3936 $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'));
3940 $result_array[
$row[
"question_id"]] =
$row;
3942 return $result_array;
3958 if (!$user_id) $user_id = $ilUser->getId();
3961 $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
3962 array(
'integer',
'integer',
'text'),
3966 else if (strlen($anonymous_id))
3968 $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
3969 array(
'integer',
'integer',
'text'),
3970 array($user_id, $this->test_id, $anonymous_id)
3975 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
3979 $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
3980 array(
'integer',
'integer'),
3981 array($user_id, $this->test_id)
3987 return $row[
"active_id"];
4009 $user_id = $ilUser->id;
4015 $result = $ilDB->queryF(
"SELECT tst_active.active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
4016 array(
'integer',
'integer'),
4017 array($user_id, $test_id)
4022 return $row[
"active_id"];
4038 $keys = array_keys($array);
4041 foreach ($keys as $key)
4057 global $tree, $ilDB,
$lng, $ilPluginAdmin;
4061 if( is_null(
$pass) )
4066 require_once
'Modules/Test/classes/class.ilTestSessionFactory.php';
4068 $testSession = $testSessionFactory->getSession($active_id);
4070 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
4072 $testSequence = $testSequenceFactory->getSequenceByPass($testSession,
$pass);
4076 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
4078 $dynamicQuestionSetConfig->loadFromDb();
4080 $testSequence->loadFromDb($dynamicQuestionSetConfig);
4083 $sequence = $testSequence->getUserSequenceQuestions();
4087 $testSequence->loadFromDb();
4088 $testSequence->loadQuestions();
4090 if( $ordered_sequence )
4092 $sequence = $testSequence->getOrderedSequenceQuestions();
4096 $sequence = $testSequence->getUserSequenceQuestions();
4100 $arrResults = array();
4103 SELECT tst_test_result.question_fi, 4104 tst_test_result.points reached, 4105 tst_test_result.hint_count requested_hints, 4106 tst_test_result.hint_points hint_points, 4107 tst_test_result.answered answered 4109 FROM tst_test_result 4111 LEFT JOIN tst_solutions 4112 ON tst_solutions.active_fi = tst_test_result.active_fi 4113 AND tst_solutions.question_fi = tst_test_result.question_fi 4115 WHERE tst_test_result.active_fi = %s 4116 AND tst_test_result.pass = %s 4119 $solutionresult = $ilDB->queryF(
4120 $query, array(
'integer',
'integer'), array($active_id,
$pass)
4123 while(
$row = $ilDB->fetchAssoc($solutionresult) )
4125 $arrResults[
$row[
'question_fi'] ] =
$row;
4128 $numWorkedThrough = count($arrResults);
4130 require_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
4132 $IN_question_ids = $ilDB->in(
'qpl_questions.question_id', $sequence,
false,
'integer');
4135 SELECT qpl_questions.*, 4136 qpl_qst_type.type_tag, 4137 qpl_sol_sug.question_fi has_sug_sol 4142 LEFT JOIN qpl_sol_sug 4143 ON qpl_sol_sug.question_fi = qpl_questions.question_id 4145 WHERE qpl_qst_type.question_type_id = qpl_questions.question_type_fi 4146 AND $IN_question_ids 4151 $unordered = array();
4155 $obligationsAnswered =
true;
4160 $row[
'points'] ? $arrResults[
$row[
'question_id'] ][
'reached'] /
$row[
'points'] : 0
4163 if( $percentvalue < 0 ) $percentvalue = 0.0;
4168 "max" => round(
$row[
'points'], 2),
4169 "reached" => round($arrResults[
$row[
'question_id']][
'reached'],2),
4170 'requested_hints' => $arrResults[$row[
'question_id']][
'requested_hints'],
4171 'hint_points' => $arrResults[$row[
'question_id']][
'hint_points'],
4172 "percent" => sprintf(
"%2.2f ", ($percentvalue) * 100) .
"%",
4174 "type" => $row[
"type_tag"],
4175 "qid" => $row[
'question_id'],
4176 "original_id" => $row[
"original_id"],
4177 "workedthrough" => isset($arrResults[$row[
'question_id']]) ? 1 : 0,
4178 'answered' => $arrResults[$row[
'question_id']][
'answered']
4181 if( !$arrResults[ $row[
'question_id'] ][
'answered'] )
4183 $obligationsAnswered =
false;
4186 $unordered[ $row[
'question_id'] ] =
$data;
4193 $pass_requested_hints = 0;
4194 $pass_hint_points = 0;
4199 foreach( $sequence as $qid )
4203 $pass_max += round($unordered[$qid][
'max'], 2);
4204 $pass_reached += round($unordered[$qid][
'reached'], 2);
4205 $pass_requested_hints += $unordered[$qid][
'requested_hints'];
4206 $pass_hint_points += $unordered[$qid][
'hint_points'];
4210 $unordered[$qid][
'nr'] = $key;
4211 array_push($found, $unordered[$qid]);
4221 if(
$results[
'reached_points'] < 0 )
4226 if( $pass_reached < 0 ) $pass_reached = 0;
4229 $found[
'pass'][
'total_max_points'] = $pass_max;
4230 $found[
'pass'][
'total_reached_points'] = $pass_reached;
4231 $found[
'pass'][
'total_requested_hints'] = $pass_requested_hints;
4232 $found[
'pass'][
'total_hint_points'] = $pass_hint_points;
4233 $found[
'pass'][
'percent'] = ($pass_max > 0) ? $pass_reached / $pass_max : 0;
4234 $found[
'pass'][
'obligationsAnswered'] = $obligationsAnswered;
4235 $found[
'pass'][
'num_workedthrough'] = $numWorkedThrough;
4237 $found[
"test"][
"total_max_points"] =
$results[
'max_points'];
4238 $found[
"test"][
"total_reached_points"] =
$results[
'reached_points'];
4239 $found[
"test"][
"total_requested_hints"] =
$results[
'hint_count'];
4240 $found[
"test"][
"total_hint_points"] =
$results[
'hint_points'];
4241 $found[
"test"][
"result_pass"] =
$results[
'pass'];
4242 $found[
'test'][
'obligations_answered'] =
$results[
'obligations_answered'];
4244 if( (!$total_reached_points) or (!$total_max_points) )
4250 $percentage = ($total_reached_points / $total_max_points) * 100.0;
4252 if( $percentage < 0 ) $percentage = 0.0;
4255 $found[
"test"][
"passed"] =
$results[
'passed'];
4270 $result = $ilDB->queryF(
"SELECT COUNT(active_id) total FROM tst_active WHERE test_fi = %s",
4275 return $row[
"total"];
4288 $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",
4289 array(
'integer',
'integer'),
4295 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4296 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4297 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4298 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4299 $time += ($epoch_2 - $epoch_1);
4326 $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",
4334 if (!array_key_exists(
$row[
"active_fi"], $times))
4336 $times[
$row[
"active_fi"]] = 0;
4338 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4339 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4340 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4341 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4342 $times[
$row[
"active_fi"]] += ($epoch_2 - $epoch_1);
4357 $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",
4358 array(
'integer',
'integer'),
4364 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4365 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4366 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4367 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4368 $time += ($epoch_2 - $epoch_1);
4383 $result = $ilDB->queryF(
"SELECT * FROM tst_times WHERE active_fi = %s AND pass = %s ORDER BY started",
4384 array(
'integer',
'integer'),
4385 array($active_id,
$pass)
4390 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4391 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4392 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4393 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4394 $time += ($epoch_2 - $epoch_1);
4423 $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",
4424 array(
'integer',
'integer'),
4425 array($test_id, $active_id)
4431 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4432 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4433 if ($firstvisit == 0 || $epoch_1 < $firstvisit) $firstvisit = $epoch_1;
4434 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4435 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4436 if ($epoch_2 > $lastvisit) $lastvisit = $epoch_2;
4438 return array(
"firstvisit" => $firstvisit,
"lastvisit" => $lastvisit);
4453 $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",
4462 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row->started, $matches);
4463 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4464 if (!$first_visit) {
4465 $first_visit = $epoch_1;
4467 if ($epoch_1 < $first_visit) {
4468 $first_visit = $epoch_1;
4470 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row->finished, $matches);
4471 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4473 $last_visit = $epoch_2;
4475 if ($epoch_2 > $last_visit) {
4476 $last_visit = $epoch_2;
4478 $times[
$row->active_fi] += ($epoch_2 - $epoch_1);
4481 foreach ($times as $key => $value) {
4482 $max_time += $value;
4484 if ((!$test_result[
"test"][
"total_reached_points"]) or (!$test_result[
"test"][
"total_max_points"]))
4490 $percentage = ($test_result[
"test"][
"total_reached_points"] / $test_result[
"test"][
"total_max_points"]) * 100.0;
4491 if ($percentage < 0) $percentage = 0.0;
4493 $mark_obj = $this->mark_schema->getMatchingMark($percentage);
4494 $first_date = getdate($first_visit);
4495 $last_date = getdate($last_visit);
4496 $qworkedthrough = 0;
4497 foreach ($test_result as $key => $value)
4499 if (preg_match(
"/\d+/", $key))
4501 $qworkedthrough += $value[
"workedthrough"];
4504 if (!$qworkedthrough)
4510 $atimeofwork = $max_time / $qworkedthrough;
4513 $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
4520 $result_mark = $mark_obj->getShortName();
4522 if( $mark_obj->getPassed() && $obligationsAnswered )
4531 $percent_worked_through = 0;
4532 if (count($this->questions))
4534 $percent_worked_through = $qworkedthrough / count($this->questions);
4536 $result_array = array(
4537 "qworkedthrough" => $qworkedthrough,
4538 "qmax" => count($this->questions),
4539 "pworkedthrough" => $percent_worked_through,
4540 "timeofwork" => $max_time,
4541 "atimeofwork" => $atimeofwork,
4542 "firstvisit" => $first_date,
4543 "lastvisit" => $last_date,
4544 "resultspoints" => $test_result[
"test"][
"total_reached_points"],
4545 "maxpoints" => $test_result[
"test"][
"total_max_points"],
4546 "resultsmarks" => $result_mark,
4547 "passed" => $passed,
4548 "distancemedian" =>
"0" 4550 foreach ($test_result as $key => $value)
4552 if (preg_match(
"/\d+/", $key))
4554 $result_array[$key] = $value;
4557 return $result_array;
4569 $totalpoints_array = array();
4571 foreach ($all_users as $active_id => $user_name)
4574 $reached = $test_result[
"test"][
"total_reached_points"];
4575 $total = $test_result[
"test"][
"total_max_points"];
4577 $mark = $this->mark_schema->getMatchingMark($percentage*100.0);
4579 $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
4583 if( $mark->getPassed() && $obligationsAnswered )
4585 array_push($totalpoints_array, $test_result[
"test"][
"total_reached_points"]);
4589 return $totalpoints_array;
4600 $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",
4604 $persons_array = array();
4607 $name = $this->lng->txt(
"unknown");
4608 $fullname = $this->lng->txt(
"unknown");
4612 if (strlen(
$row[
"firstname"].
$row[
"lastname"].
$row[
"title"]) == 0)
4614 $name = $this->lng->txt(
"deleted_user");
4615 $fullname = $this->lng->txt(
"deleted_user");
4616 $login = $this->lng->txt(
"unknown");
4620 $login = $row[
"login"];
4621 if ($row[
"user_fi"] == ANONYMOUS_USER_ID)
4623 $name = $this->lng->txt(
"unknown");
4624 $fullname = $this->lng->txt(
"unknown");
4628 $name = trim($row[
"lastname"] .
", " . $row[
"firstname"] .
" " . $row[
"title"]);
4629 $fullname = trim($row[
"title"] .
" " . $row[
"firstname"] .
" " . $row[
"lastname"]);
4633 $persons_array[
$row[
"active_id"]] = array(
4635 "fullname" => $fullname,
4639 return $persons_array;
4651 $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),
4655 $persons_array = array();
4660 $persons_array[
$row[
"active_id"]] = $this->lng->txt(
"unknown");
4664 if (strlen(
$row[
"firstname"].
$row[
"lastname"].
$row[
"title"]) == 0)
4666 $persons_array[$row[
"active_id"]] = $this->lng->txt(
"deleted_user");
4670 if ($row[
"user_fi"] == ANONYMOUS_USER_ID)
4672 $persons_array[$row[
"active_id"]] = $row[
"lastname"];
4676 $persons_array[$row[
"active_id"]] = trim($row[
"lastname"] .
", " . $row[
"firstname"] .
" " . $row[
"title"]);
4681 return $persons_array;
4693 $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),
4697 $persons_array = array();
4702 $persons_array[
$row[
"active_id"]] = array(
"name" => $this->lng->txt(
"unknown"));
4706 if (strlen(
$row[
"firstname"].
$row[
"lastname"].
$row[
"title"]) == 0)
4708 $persons_array[$row[
"active_id"]] = array(
"name" => $this->lng->txt(
"deleted_user"));
4712 if ($row[
"user_fi"] == ANONYMOUS_USER_ID)
4714 $persons_array[$row[
"active_id"]] = array(
"name" => $row[
"lastname"]);
4718 $persons_array[$row[
"active_id"]] = array(
"name" => trim($row[
"lastname"] .
", " . $row[
"firstname"] .
" " . $row[
"title"]),
"login" => $row[
"login"]);
4723 return $persons_array;
4736 $result = $ilDB->queryF(
"SELECT COUNT(active_id) total FROM tst_active WHERE test_fi = %s AND submitted = %s",
4737 array(
'integer',
'integer'),
4741 return $row[
"total"];
4756 $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
4757 "tst_test_rnd_qst.pass, qpl_questions.points " .
4758 "FROM tst_test_rnd_qst, qpl_questions " .
4759 "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
4760 "AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence",
4767 $result = $ilDB->queryF(
"SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
4768 "qpl_questions.points " .
4769 "FROM tst_test_question, tst_active, qpl_questions " .
4770 "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
4771 "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
4781 array_push($qtest,
$row);
4799 $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
4800 "qpl_questions.points " .
4801 "FROM tst_test_rnd_qst, qpl_questions " .
4802 "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
4803 "AND tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.pass = %s " .
4804 "ORDER BY tst_test_rnd_qst.sequence",
4805 array(
'integer',
'integer'),
4806 array($active_id,
$pass)
4811 $result = $ilDB->queryF(
"SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
4812 "qpl_questions.points " .
4813 "FROM tst_test_question, tst_active, qpl_questions " .
4814 "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
4815 "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
4825 array_push($qpass,
$row);
4835 include_once
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
4836 include_once
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
4837 include_once
"./Modules/Test/classes/class.ilTestEvaluationData.php";
4842 SELECT tst_test_result.*, 4843 qpl_questions.original_id, 4844 qpl_questions.title questiontitle, 4845 qpl_questions.points maxpoints 4847 FROM tst_test_result, qpl_questions, tst_active 4849 WHERE tst_active.active_id = tst_test_result.active_fi 4850 AND qpl_questions.question_id = tst_test_result.question_fi 4851 AND tst_active.test_fi = %s 4853 ORDER BY tst_active.active_id ASC, tst_test_result.pass ASC, tst_test_result.tstamp DESC 4866 $participantObject =
$data->getParticipant(
$row[
"active_fi"]);
4873 $passObject = $participantObject->getPass(
$row[
"pass"]);
4880 $passObject->addAnsweredQuestion(
4885 foreach( array_keys(
$data->getParticipants()) as $active_id )
4889 for( $testpass = 0; $testpass <=
$data->getParticipant($active_id)->getLastPass(); $testpass++ )
4892 $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, qpl_questions.original_id, " .
4893 "tst_test_rnd_qst.pass, qpl_questions.points, qpl_questions.title " .
4894 "FROM tst_test_rnd_qst, qpl_questions " .
4895 "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
4896 "AND tst_test_rnd_qst.pass = %s " .
4897 "AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence",
4898 array(
'integer',
'integer'),
4899 array($testpass, $active_id)
4905 $tpass = array_key_exists(
"pass",
$row) ?
$row[
"pass"] : 0;
4906 $data->getParticipant($active_id)->addQuestion(
$row[
"original_id"],
$row[
"question_fi"],
$row[
"points"],
$row[
"sequence"], $tpass);
4907 $data->addQuestionTitle(
$row[
"question_fi"],
$row[
"title"]);
4914 $result = $ilDB->queryF(
"SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
4915 "qpl_questions.points, qpl_questions.title, qpl_questions.original_id " .
4916 "FROM tst_test_question, tst_active, qpl_questions " .
4917 "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
4918 "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi ORDER BY tst_test_question.sequence",
4924 $questionsbysequence = array();
4928 $questionsbysequence[
$row[
"sequence"]] =
$row;
4931 $seqresult = $ilDB->queryF(
"SELECT * FROM tst_sequence WHERE active_fi = %s",
4936 while ($seqrow = $ilDB->fetchAssoc($seqresult))
4938 $questionsequence = unserialize($seqrow[
"sequence"]);
4939 foreach ($questionsequence as $sidx => $seq)
4941 $data->getParticipant($active_id)->addQuestion($questionsbysequence[$seq][
"original_id"], $questionsbysequence[$seq][
"question_fi"], $questionsbysequence[$seq][
"points"], $sidx + 1, $seqrow[
"pass"]);
4942 $data->addQuestionTitle($questionsbysequence[$seq][
"question_fi"], $questionsbysequence[$seq][
"title"]);
4949 if ($this->ects_output)
4954 foreach( array_keys(
$data->getParticipants()) as $active_id )
4956 $tstUserData =
$data->getParticipant($active_id);
4958 $percentage = $tstUserData->getReachedPointsInPercent();
4960 $obligationsAnswered = $tstUserData->areObligationsAnswered();
4962 $mark = $this->mark_schema->getMatchingMark($percentage);
4964 if (is_object($mark))
4966 $tstUserData->setMark($mark->getShortName());
4967 $tstUserData->setMarkOfficial($mark->getOfficialName());
4969 $tstUserData->setPassed(
4970 $mark->getPassed() && $tstUserData->areObligationsAnswered()
4974 if ($this->ects_output)
4977 $passed_array, $tstUserData->getReached(), $tstUserData->getMaxPoints()
4980 $tstUserData->setECTSMark($ects_mark);
4985 $tstUserData->setFirstVisit($visitingTime[
"firstvisit"]);
4986 $tstUserData->setLastVisit($visitingTime[
"lastvisit"]);
5002 $res = $ilDB->queryF(
" 5003 SELECT COUNT(qpl_questions.question_id) qcount, 5004 SUM(qpl_questions.points) qsum 5006 INNER JOIN tst_tests 5007 ON tst_tests.test_id = tst_active.test_fi 5008 INNER JOIN tst_dyn_quest_set_cfg 5009 ON tst_dyn_quest_set_cfg.test_fi = tst_tests.test_id 5010 INNER JOIN qpl_questions 5011 ON qpl_questions.obj_fi = tst_dyn_quest_set_cfg.source_qpl_fi 5012 AND qpl_questions.original_id IS NULL 5013 AND qpl_questions.complete = %s 5014 WHERE tst_active.active_id = %s 5016 array(
'integer',
'integer'),
5017 array(1, $active_id)
5024 $res = $ilDB->queryF(
" 5025 SELECT tst_test_rnd_qst.pass, 5026 COUNT(tst_test_rnd_qst.question_fi) qcount, 5027 SUM(qpl_questions.points) qsum 5029 FROM tst_test_rnd_qst, 5032 WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id 5033 AND tst_test_rnd_qst.active_fi = %s 5036 GROUP BY tst_test_rnd_qst.active_fi, 5037 tst_test_rnd_qst.pass 5039 array(
'integer',
'integer'),
5040 array($active_id,
$pass)
5047 $res = $ilDB->queryF(
" 5048 SELECT COUNT(tst_test_question.question_fi) qcount, 5049 SUM(qpl_questions.points) qsum 5051 FROM tst_test_question, 5055 WHERE tst_test_question.question_fi = qpl_questions.question_id 5056 AND tst_test_question.test_fi = tst_active.test_fi 5057 AND tst_active.active_id = %s 5059 GROUP BY tst_test_question.test_fi 5069 throw new ilTestException(
"not supported question set type: $questionSetType");
5074 if( is_array(
$row) )
5076 return array(
"count" =>
$row[
"qcount"],
"points" =>
$row[
"qsum"]);
5079 return array(
"count" => 0,
"points" => 0);
5084 include_once
"./Modules/Test/classes/class.ilTestEvaluationData.php";
5085 include_once
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
5086 include_once
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
5088 if ($withStatistics)
5090 $data->calculateStatistics();
5092 $data->setFilter($filterby, $filtertext);
5117 $result = $ilDB->queryF(
"SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
5118 "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
5119 "qpl_questions.points maxpoints " .
5120 "FROM tst_test_result, qpl_questions, tst_active " .
5121 "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
5122 "WHERE tst_active.active_id = tst_test_result.active_fi " .
5123 "AND qpl_questions.question_id = tst_test_result.question_fi " .
5124 "AND tst_active.test_fi = %s " .
5125 "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
5129 $overview = array();
5132 if (!array_key_exists(
$row[
"active_fi"], $overview))
5134 $overview[
$row[
"active_fi"]] = array();
5135 $overview[$row[
"active_fi"]][
"firstname"] = $row[
"firstname"];
5136 $overview[$row[
"active_fi"]][
"lastname"] = $row[
"lastname"];
5137 $overview[$row[
"active_fi"]][
"title"] = $row[
"title"];
5138 $overview[$row[
"active_fi"]][
"login"] = $row[
"login"];
5139 $overview[$row[
"active_fi"]][
"usr_id"] = $row[
"usr_id"];
5140 $overview[$row[
"active_fi"]][
"started"] = $row[
"started"];
5141 $overview[$row[
"active_fi"]][
"finished"] = $row[
"finished"];
5143 if (!array_key_exists(
$row[
"pass"], $overview[
$row[
"active_fi"]]))
5145 $overview[$row[
"active_fi"]][$row[
"pass"]] = array();
5146 $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] = 0;
5147 $overview[$row[
"active_fi"]][$row[
"pass"]][
"maxpoints"] = $row[
"maxpoints"];
5149 array_push($overview[$row[
"active_fi"]][$row[
"pass"]], $row);
5150 $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] += $row[
"points"];
5166 $result = $ilDB->queryF(
"SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
5167 "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
5168 "qpl_questions.points maxpoints " .
5169 "FROM tst_test_result, qpl_questions, tst_active " .
5170 "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
5171 "WHERE tst_active.active_id = tst_test_result.active_fi " .
5172 "AND qpl_questions.question_id = tst_test_result.question_fi " .
5173 "AND tst_active.test_fi = %s AND tst_active.active_id = %s" .
5174 "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
5175 array(
'integer',
'integer'),
5178 $overview = array();
5181 if (!array_key_exists(
$row[
"active_fi"], $overview))
5183 $overview[
$row[
"active_fi"]] = array();
5184 $overview[$row[
"active_fi"]][
"firstname"] = $row[
"firstname"];
5185 $overview[$row[
"active_fi"]][
"lastname"] = $row[
"lastname"];
5186 $overview[$row[
"active_fi"]][
"title"] = $row[
"title"];
5187 $overview[$row[
"active_fi"]][
"login"] = $row[
"login"];
5188 $overview[$row[
"active_fi"]][
"usr_id"] = $row[
"usr_id"];
5189 $overview[$row[
"active_fi"]][
"started"] = $row[
"started"];
5190 $overview[$row[
"active_fi"]][
"finished"] = $row[
"finished"];
5192 if (!array_key_exists(
$row[
"pass"], $overview[
$row[
"active_fi"]]))
5194 $overview[$row[
"active_fi"]][$row[
"pass"]] = array();
5195 $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] = 0;
5196 $overview[$row[
"active_fi"]][$row[
"pass"]][
"maxpoints"] = $row[
"maxpoints"];
5198 array_push($overview[$row[
"active_fi"]][$row[
"pass"]], $row);
5199 $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] += $row[
"points"];
5218 if (strlen($firstname.$lastname.$title) == 0)
5220 $name = $this->lng->txt(
"deleted_user");
5224 if ($user_id == ANONYMOUS_USER_ID)
5230 $name = trim($lastname .
", " . $firstname .
" " .
$title);
5234 $name = $this->lng->txt(
"anonymous");
5256 if (strlen($firstname.$lastname.$title) == 0)
5258 $name = $lng->txt(
"deleted_user");
5262 if ($user_id == ANONYMOUS_USER_ID)
5268 $name = trim($lastname .
", " . $firstname .
" " .
$title);
5272 $name = $lng->txt(
"anonymous");
5288 $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",
5295 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row->started, $matches);
5296 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
5297 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row->finished, $matches);
5298 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
5299 $times[
$row->active_fi] += ($epoch_2 - $epoch_1);
5303 foreach ($times as $key => $value)
5305 $max_time += $value;
5310 $average_time = round($max_time / $counter);
5316 return $average_time;
5325 function &
getAvailableQuestionpools($use_object_id =
false, $equal_points =
false, $could_be_offline =
false, $show_path = FALSE, $with_questioncount = FALSE, $permission =
"read")
5327 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
5339 $time_in_seconds = 0;
5340 foreach ($this->questions as $question_id)
5343 $est_time = $question->getEstimatedWorkingTime();
5344 $time_in_seconds += $est_time[
"h"] * 3600 + $est_time[
"m"] * 60 + $est_time[
"s"];
5346 $hours = (int)($time_in_seconds / 3600) ;
5347 $time_in_seconds = $time_in_seconds - ($hours * 3600);
5348 $minutes = (int)($time_in_seconds / 60);
5349 $time_in_seconds = $time_in_seconds - ($minutes * 60);
5350 $result = array(
"hh" => $hours,
"mm" => $minutes,
"ss" => $time_in_seconds);
5362 return CLIENT_WEB_DIR .
"/assessment/" . $this->
getId() .
"/images/";
5373 include_once
"./Services/Utilities/classes/class.ilUtil.php";
5388 if ((!$question_type) and ($question_id > 0))
5393 if (!strlen($question_type))
return null;
5395 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
5399 $question =
new $question_type_gui();
5403 if ($question_id > 0)
5405 $question->object->loadFromDb($question_id);
5410 $question->object->feedbackOBJ =
new $feedbackObjectClassname($question->object, $ilCtrl, $ilDB, $lng);
5412 $assSettings =
new ilSetting(
'assessment');
5413 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
5415 $processLockerFactory->setQuestionId($question->object->getId());
5416 $processLockerFactory->setUserId($ilUser->getId());
5417 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
5419 $question->object->setProcessLocker($processLockerFactory->getLocker());
5436 if (strcmp($question_id,
"") != 0)
5438 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
5453 $this->questions = array_values($this->questions);
5454 $array_pos = array_search($target_index, $this->questions);
5455 if ($insert_mode == 0)
5457 $part1 = array_slice($this->questions, 0, $array_pos);
5458 $part2 = array_slice($this->questions, $array_pos);
5460 else if ($insert_mode == 1)
5462 $part1 = array_slice($this->questions, 0, $array_pos + 1);
5463 $part2 = array_slice($this->questions, $array_pos + 1);
5465 foreach ($move_questions as $question_id)
5467 if (!(array_search($question_id, $part1) === FALSE))
5469 unset($part1[array_search($question_id, $part1)]);
5471 if (!(array_search($question_id, $part2) === FALSE))
5473 unset($part2[array_search($question_id, $part2)]);
5476 $part1 = array_values($part1);
5477 $part2 = array_values($part2);
5478 $new_array = array_values(array_merge($part1, $move_questions, $part2));
5479 $this->questions = array();
5481 foreach ($new_array as $question_id)
5483 $this->questions[$counter] = $question_id;
5501 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getStartingTime(), $matches))
5503 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
5505 if ($now < $epoch_time)
5526 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getEndingTime(), $matches))
5528 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
5530 if ($now > $epoch_time)
5550 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
5553 if (count($available_pools))
5555 $available =
" AND " . $ilDB->in(
'qpl_questions.obj_fi', $available_pools,
false,
'integer');
5563 $available .=
" AND qpl_questions.complete = " . $ilDB->quote(
"1",
'text');
5567 if (is_array($arrFilter))
5569 if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title']))
5571 $where .=
" AND " . $ilDB->like(
'qpl_questions.title',
'text',
"%%" . $arrFilter[
'title'] .
"%%");
5573 if (array_key_exists(
'description', $arrFilter) && strlen($arrFilter[
'description']))
5575 $where .=
" AND " . $ilDB->like(
'qpl_questions.description',
'text',
"%%" . $arrFilter[
'description'] .
"%%");
5577 if (array_key_exists(
'author', $arrFilter) && strlen($arrFilter[
'author']))
5579 $where .=
" AND " . $ilDB->like(
'qpl_questions.author',
'text',
"%%" . $arrFilter[
'author'] .
"%%");
5581 if (array_key_exists(
'type', $arrFilter) && strlen($arrFilter[
'type']))
5583 $where .=
" AND qpl_qst_type.type_tag = " . $ilDB->quote($arrFilter[
'type'],
'text');
5585 if (array_key_exists(
'qpl', $arrFilter) && strlen($arrFilter[
'qpl']))
5587 $where .=
" AND " . $ilDB->like(
'object_data.title',
'text',
"%%" . $arrFilter[
'qpl'] .
"%%");
5592 $original_clause =
" qpl_questions.original_id IS NULL";
5593 if (count($original_ids))
5595 $original_clause =
" qpl_questions.original_id IS NULL AND " . $ilDB->in(
'qpl_questions.question_id', $original_ids,
true,
'integer');
5598 $query_result = $ilDB->query(
5599 "SELECT qpl_questions.*, qpl_questions.tstamp, qpl_qst_type.type_tag, qpl_qst_type.plugin, object_data.title qpl " .
5600 "FROM qpl_questions, qpl_qst_type, object_data WHERE $original_clause $available AND " .
5601 "object_data.obj_id = qpl_questions.obj_fi AND qpl_questions.tstamp > 0 AND " .
5602 "qpl_questions.question_type_fi = qpl_qst_type.question_type_id$where");
5605 if ($query_result->numRows())
5607 while (
$row = $ilDB->fetchAssoc($query_result))
5609 $row[
'ttype'] = $types[
$row[
'type_tag']];
5614 array_push($rows, $row);
5619 array_push($rows, $row);
5631 global $ilPluginAdmin;
5633 $lng->loadLanguageModule(
"assessment");
5634 $result = $ilDB->query(
"SELECT * FROM qpl_qst_type");
5638 if (
$row[
"plugin"] == 0)
5640 $types[
$row[
'type_tag']] = $lng->txt($row[
"type_tag"]);
5644 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"TestQuestionPool",
"qst");
5645 foreach ($pl_names as $pl_name)
5648 if (strcmp($pl->getQuestionType(),
$row[
"type_tag"]) == 0)
5650 $types[
$row[
'type_tag']] = $pl->getQuestionTypeTranslation();
5670 foreach ($assessment->objectives as $objectives)
5672 foreach ($objectives->materials as $material)
5687 foreach ($assessment->assessmentcontrol as $assessmentcontrol)
5689 switch ($assessmentcontrol->getSolutionswitch())
5700 foreach ($assessment->qtimetadata as $metadata)
5702 switch ($metadata[
"label"])
5706 $type = $metadata[
"entry"];
5727 case "sequence_settings":
5737 $this->
setKiosk($metadata[
"entry"]);
5739 case "showfinalstatement":
5752 case "highscore_enabled":
5756 case "highscore_anon":
5760 case "highscore_achieved_ts":
5764 case "highscore_score":
5768 case "highscore_percentage":
5772 case "highscore_hints":
5776 case "highscore_wtime":
5780 case "highscore_own_table":
5784 case "highscore_top_table":
5788 case "highscore_top_num":
5792 case "hide_previous_results":
5793 if ($metadata[
"entry"] == 0)
5802 case "use_previous_answers":
5805 case "answer_feedback":
5808 case "hide_title_points":
5811 case "title_output":
5814 case "question_set_type":
5818 if( $metadata[
"entry"] )
5827 case "results_presentation":
5830 case "reset_processing_time":
5833 case "instant_verification":
5836 case "answer_feedback_points":
5848 case "fixed_participants":
5851 case "score_reporting":
5854 case "shuffle_questions":
5857 case "count_system":
5863 case "mailnotification":
5869 case "exportsettings":
5872 case "score_cutting":
5878 case "allowedUsers":
5881 case "allowedUsersTimeGap":
5884 case "pass_scoring":
5887 case "show_summary":
5890 case "reporting_date":
5891 $iso8601period = $metadata[
"entry"];
5892 if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
5894 $this->
setReportingDate(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
5897 case 'enable_processing_time':
5900 case "processing_time":
5903 case "starting_time":
5904 $iso8601period = $metadata[
"entry"];
5905 if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
5907 $this->
setStartingTime(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
5911 $iso8601period = $metadata[
"entry"];
5912 if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
5914 $this->
setEndingTime(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
5917 case "enable_examview":
5920 case 'show_examview_html':
5923 case 'show_examview_pdf':
5926 case 'redirection_mode':
5929 case 'redirection_url':
5932 case 'examid_in_kiosk':
5933 case 'examid_in_test_pass':
5936 case 'show_exam_id':
5937 case 'examid_in_test_res':
5940 case 'enable_archiving':
5943 case 'sign_submission':
5946 case 'char_selector_availability':
5949 case 'char_selector_definition':
5952 case 'activation_limited':
5955 case 'activation_start_time':
5958 case 'activation_end_time':
5961 case 'activation_visibility':
5967 case 'autosave_ival':
5970 case 'offer_question_hints':
5973 case 'instant_feedback_specific':
5976 case 'obligations_enabled':
5980 if (preg_match(
"/mark_step_\d+/", $metadata[
"label"]))
5982 $xmlmark = $metadata[
"entry"];
5983 preg_match(
"/<short>(.*?)<\/short>/", $xmlmark, $matches);
5984 $mark_short = $matches[1];
5985 preg_match(
"/<official>(.*?)<\/official>/", $xmlmark, $matches);
5986 $mark_official = $matches[1];
5987 preg_match(
"/<percentage>(.*?)<\/percentage>/", $xmlmark, $matches);
5988 $mark_percentage = $matches[1];
5989 preg_match(
"/<passed>(.*?)<\/passed>/", $xmlmark, $matches);
5990 $mark_passed = $matches[1];
5991 $this->mark_schema->addMarkStep($mark_short, $mark_official, $mark_percentage, $mark_passed);
5995 if (is_array(
$_SESSION[
"import_mob_xhtml"]))
5997 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
5998 include_once
"./Services/RTE/classes/class.ilRTE.php";
5999 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
6000 foreach (
$_SESSION[
"import_mob_xhtml"] as $mob)
6003 if (file_exists($importfile))
6013 $ilLog->write(
"Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
6027 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
6031 $a_xml_writer->xmlSetDtdDef(
"<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">");
6032 $a_xml_writer->xmlStartTag(
"questestinterop");
6035 "ident" =>
"il_".IL_INST_ID.
"_tst_".$this->getTestId(),
6038 $a_xml_writer->xmlStartTag(
"assessment", $attrs);
6040 $a_xml_writer->xmlElement(
"qticomment", NULL, $this->
getDescription());
6043 if ($this->enable_processing_time)
6045 preg_match(
"/(\d+):(\d+):(\d+)/", $this->processing_time, $matches);
6046 $a_xml_writer->xmlElement(
"duration", NULL, sprintf(
"P0Y0M0DT%dH%dM%dS", $matches[1], $matches[2], $matches[3]));
6050 $a_xml_writer->xmlStartTag(
"qtimetadata");
6051 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6052 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"ILIAS_VERSION");
6053 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
ilias->getSetting(
"ilias_version"));
6054 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6057 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6058 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"anonymity");
6059 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getAnonymity()));
6060 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6063 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6064 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"question_set_type");
6066 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6069 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6070 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"sequence_settings");
6072 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6075 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6076 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"author");
6077 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getAuthor());
6078 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6081 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6082 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"reset_processing_time");
6084 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6087 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6088 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"count_system");
6089 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getCountSystem());
6090 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6093 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6094 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"mc_scoring");
6095 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getMCScoring());
6096 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6099 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6100 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"score_cutting");
6101 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getScoreCutting());
6102 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6105 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6106 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"password");
6107 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getPassword());
6108 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6111 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6112 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"allowedUsers");
6113 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getAllowedUsers());
6114 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6117 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6118 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"allowedUsersTimeGap");
6120 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6123 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6124 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"pass_scoring");
6125 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getPassScoring());
6126 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6131 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6132 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"reporting_date");
6133 preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->reporting_date, $matches);
6134 $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]));
6135 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6138 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6139 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"nr_of_tries");
6140 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getNrOfTries()));
6141 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6144 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6145 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"kiosk");
6146 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getKiosk()));
6147 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6151 $a_xml_writer->xmlStartTag(
'qtimetadatafield');
6152 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"redirection_mode");
6154 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6157 $a_xml_writer->xmlStartTag(
'qtimetadatafield');
6158 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"redirection_url");
6160 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6163 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6164 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"use_previous_answers");
6166 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6169 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6170 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"title_output");
6171 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getTitleOutput()));
6172 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6175 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6176 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"results_presentation");
6178 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6181 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6182 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"examid_in_test_pass");
6184 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6187 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6188 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"examid_in_test_res");
6190 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6193 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6194 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_summary");
6196 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6199 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6200 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"score_reporting");
6201 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getScoreReporting()));
6202 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6205 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6206 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"instant_verification");
6208 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6211 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6212 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"answer_feedback");
6213 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getAnswerFeedback()));
6214 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6217 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6218 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"answer_feedback_points");
6220 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6223 $highscore_metadata = array(
6235 foreach($highscore_metadata as $label =>
$data)
6237 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6238 $a_xml_writer->xmlElement(
"fieldlabel", NULL, $label);
6239 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d",
$data[
'value']));
6240 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6244 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6245 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_cancel");
6246 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getShowCancel()));
6247 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6250 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6251 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_marker");
6252 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getShowMarker()));
6253 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6256 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6257 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"fixed_participants");
6259 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6262 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6263 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"showfinalstatement");
6264 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", (($this->
getShowFinalStatement()) ?
"1" :
"0")));
6265 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6268 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6269 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"showinfo");
6270 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", (($this->
getShowInfo()) ?
"1" :
"0")));
6271 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6274 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6275 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"mailnotification");
6277 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6280 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6281 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"mailnottype");
6283 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6286 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6287 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"exportsettings");
6289 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6292 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6293 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"forcejs");
6294 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", (($this->
getForceJS()) ?
"1" :
"0")));
6295 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6298 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6299 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"customstyle");
6300 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getCustomStyle());
6301 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6304 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6305 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"shuffle_questions");
6306 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getShuffleQuestions()));
6307 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6310 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6311 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"processing_time");
6313 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6316 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6317 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"enable_examview");
6319 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6322 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6323 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_examview_html");
6325 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6328 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6329 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_examview_pdf");
6331 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6334 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6335 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"enable_archiving");
6337 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6340 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6341 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"sign_submission");
6343 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6346 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6347 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"char_selector_availability");
6349 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6352 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6353 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"char_selector_definition");
6355 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6361 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6362 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"starting_time");
6363 preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->starting_time, $matches);
6364 $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]));
6365 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6370 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6371 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"ending_time");
6372 preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->ending_time, $matches);
6373 $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]));
6374 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6379 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6380 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"activation_limited");
6382 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6385 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6386 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"activation_start_time");
6388 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6391 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6392 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"activation_end_time");
6394 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6397 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6398 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"activation_visibility");
6400 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6403 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6404 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"autosave");
6405 $a_xml_writer->xmlElement(
"fieldentry", NULL, (
int)$this->
getAutosave());
6406 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6409 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6410 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"autosave_ival");
6411 $a_xml_writer->xmlElement(
"fieldentry", NULL, (
int)$this->
getAutosaveIval());
6412 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6415 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6416 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"offer_question_hints");
6418 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6421 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6422 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"instant_feedback_specific");
6424 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6427 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6428 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"obligations_enabled");
6430 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6433 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6434 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"enable_processing_time");
6436 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6438 foreach ($this->mark_schema->mark_steps as $index => $mark)
6441 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6442 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"mark_step_$index");
6443 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
6444 "<short>%s</short><official>%s</official><percentage>%.2f</percentage><passed>%d</passed>",
6445 $mark->getShortName(), $mark->getOfficialName(), $mark->getMinimumLevel(), $mark->getPassed()
6447 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6449 $a_xml_writer->xmlEndTag(
"qtimetadata");
6452 $a_xml_writer->xmlStartTag(
"objectives");
6454 $a_xml_writer->xmlEndTag(
"objectives");
6460 "solutionswitch" =>
"Yes" 6467 $a_xml_writer->xmlElement(
"assessmentcontrol", $attrs, NULL);
6472 $a_xml_writer->xmlStartTag(
"presentation_material");
6473 $a_xml_writer->xmlStartTag(
"flow_mat");
6475 $a_xml_writer->xmlEndTag(
"flow_mat");
6476 $a_xml_writer->xmlEndTag(
"presentation_material");
6482 $a_xml_writer->xmlElement(
"section", $attrs, NULL);
6483 $a_xml_writer->xmlEndTag(
"assessment");
6484 $a_xml_writer->xmlEndTag(
"questestinterop");
6486 $xml = $a_xml_writer->xmlDumpMem(FALSE);
6488 foreach ($this->questions as $question_id)
6491 $qti_question = $question->toXML(
false);
6492 $qti_question = preg_replace(
"/<questestinterop>/",
"", $qti_question);
6493 $qti_question = preg_replace(
"/<\/questestinterop>/",
"", $qti_question);
6494 if (strpos($xml,
"</section>") !==
false)
6496 $xml = str_replace(
"</section>",
"$qti_question</section>", $xml);
6500 $xml = str_replace(
"<section ident=\"1\"/>",
"<section ident=\"1\">\n$qti_question</section>", $xml);
6516 $this->mob_ids = array();
6517 $this->file_ids = array();
6520 $attrs[
"Type"] =
"Test";
6521 $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
6527 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Page Objects");
6528 $ilBench->start(
"ContentObjectExport",
"exportPageObjects");
6530 $ilBench->stop(
"ContentObjectExport",
"exportPageObjects");
6531 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Page Objects");
6534 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
6535 $ilBench->start(
"ContentObjectExport",
"exportMediaObjects");
6537 $ilBench->stop(
"ContentObjectExport",
"exportMediaObjects");
6538 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
6541 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
6542 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
6544 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
6545 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
6547 $a_xml_writer->xmlEndTag(
"ContentObject");
6558 include_once
"./Services/MetaData/classes/class.ilMD2XML.php";
6560 $md2xml->setExportMode(
true);
6561 $md2xml->startExport();
6562 $a_xml_writer->appendXML($md2xml->getXML());
6572 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
6574 include_once
"./Services/Utilities/classes/class.ilUtil.php";
6592 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
6594 foreach ($this->questions as $question_id)
6596 $ilBench->start(
"ContentObjectExport",
"exportPageObject");
6597 $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$question_id);
6600 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
6604 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML");
6605 include_once
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
6607 $page_object->buildDom();
6608 $page_object->insertInstIntoIDs($a_inst);
6609 $mob_ids = $page_object->collectMediaObjects(
false);
6610 require_once
'Services/COPage/classes/class.ilPCFileList.php';
6612 $xml = $page_object->getXMLFromDom(
false,
false,
false,
"",
true);
6613 $xml = str_replace(
"&",
"&", $xml);
6614 $a_xml_writer->appendXML($xml);
6615 $page_object->freeDom();
6616 unset ($page_object);
6618 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML");
6621 $ilBench->start(
"ContentObjectExport",
"exportPageObject_CollectMedia");
6623 foreach($mob_ids as $mob_id)
6625 $this->mob_ids[$mob_id] = $mob_id;
6627 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_CollectMedia");
6630 $ilBench->start(
"ContentObjectExport",
"exportPageObject_CollectFileItems");
6632 foreach($file_ids as $file_id)
6634 $this->file_ids[$file_id] = $file_id;
6636 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_CollectFileItems");
6638 $a_xml_writer->xmlEndTag(
"PageObject");
6641 $ilBench->stop(
"ContentObjectExport",
"exportPageObject");
6655 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
6657 foreach ($this->mob_ids as $mob_id)
6659 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
6663 $media_obj->exportXML($a_xml_writer, $a_inst);
6664 $media_obj->exportFiles($a_target_dir);
6676 include_once
"./Modules/File/classes/class.ilObjFile.php";
6678 foreach ($this->file_ids as $file_id)
6680 $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
6681 $file_obj =
new ilObjFile($file_id,
false);
6682 $file_obj->export($a_target_dir);
6693 if (!is_array($this->import_mapping))
6699 return $this->import_mapping;
6714 return ilObjTest::_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);
6725 function _getECTSGrade($points_passed, $reached_points, $max_points, $a, $b, $c,
$d, $e, $fx)
6727 include_once
"./Modules/Test/classes/class.ilStatistics.php";
6730 $passed_statistics->setData($points_passed);
6731 $ects_percentiles = array
6733 "A" => $passed_statistics->quantile($a),
6734 "B" => $passed_statistics->quantile($b),
6735 "C" => $passed_statistics->quantile($c),
6736 "D" => $passed_statistics->quantile(
$d),
6737 "E" => $passed_statistics->quantile($e)
6739 if (count($points_passed) && ($reached_points >= $ects_percentiles[
"A"]))
6743 else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"B"]))
6747 else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"C"]))
6751 else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"D"]))
6755 else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"E"]))
6759 else if (strcmp($fx,
"") != 0)
6761 if ($max_points > 0)
6763 $percentage = ($reached_points / $max_points) * 100.0;
6764 if ($percentage < 0) $percentage = 0.0;
6770 if ($percentage >= $fx)
6787 return $this->mark_schema->checkMarks();
6819 $md_life =& $md->getLifecycle();
6822 if (strlen($a_author) == 0)
6825 $a_author = $ilUser->getFullname();
6828 $md_life =& $md->addLifecycle();
6830 $con =& $md_life->addContribute();
6831 $con->setRole(
"Author");
6833 $ent =& $con->addEntity();
6834 $ent->setEntity($a_author);
6846 parent::createMetaData();
6860 include_once
"./Services/MetaData/classes/class.ilMD.php";
6862 $md_life =& $md->getLifecycle();
6865 $ids =& $md_life->getContributeIds();
6866 foreach ($ids as
$id)
6868 $md_cont =& $md_life->getContribute($id);
6869 if (strcmp($md_cont->getRole(),
"Author") == 0)
6871 $entids =& $md_cont->getEntityIds();
6872 foreach ($entids as $entid)
6874 $md_ent =& $md_cont->getEntity($entid);
6875 array_push($author, $md_ent->getEntity());
6880 return join($author,
",");
6893 include_once
"./Services/MetaData/classes/class.ilMD.php";
6894 $md =&
new ilMD($obj_id, 0,
"tst");
6895 $md_life =& $md->getLifecycle();
6898 $ids =& $md_life->getContributeIds();
6899 foreach ($ids as
$id)
6901 $md_cont =& $md_life->getContribute($id);
6902 if (strcmp($md_cont->getRole(),
"Author") == 0)
6904 $entids =& $md_cont->getEntityIds();
6905 foreach ($entids as $entid)
6907 $md_ent =& $md_cont->getEntity($entid);
6908 array_push($author, $md_ent->getEntity());
6913 return join($author,
",");
6927 $result_array = array();
6937 $result_array[$obj_id] = $titles[
$ref_id];
6945 return $result_array;
6956 public function cloneObject($a_target_id,$a_copy_id = 0)
6958 global
$ilLog, $tree, $ilDB, $ilPluginAdmin;
6964 $newObj = parent::cloneObject($a_target_id,$a_copy_id);
6985 $newObj->setKiosk($this->
getKiosk());
7025 $newObj->saveToDb();
7028 include_once
"./Services/Certificate/classes/class.ilCertificate.php";
7029 include_once
"./Modules/Test/classes/class.ilTestCertificateAdapter.php";
7032 $cert->cloneCertificate($newcert);
7034 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
7036 $testQuestionSetConfigFactory->getQuestionSetConfig()->cloneQuestionSetRelatedData($newObj);
7038 $newObj->saveToDb();
7039 $newObj->updateMetaData();
7055 global $tree, $ilDB, $ilPluginAdmin;
7058 $tree, $ilDB, $ilPluginAdmin, $this
7061 $questionSetConfig->loadFromDb();
7063 if( $questionSetConfig->isQuestionAmountConfigurationModePerPool() )
7065 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
7066 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetBuilderWithAmountPerPool.php';
7067 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
7071 $srcPoolDefList->loadDefinitions();
7072 $num = ilTestRandomQuestionSetBuilderWithAmountPerPool::getRequiredQuestionAmountForDefinitionList($srcPoolDefList);
7076 $num = $questionSetConfig->getQuestionAmountPerTest();
7081 $num = count($this->questions);
7099 if (strcmp($question_id,
"") != 0)
7101 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
7104 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
7119 $result = $ilDB->queryF(
"SELECT obj_fi FROM tst_tests WHERE test_id = %s",
7126 $object_id =
$row[
"obj_fi"];
7142 $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",
7149 $object_id =
$row[
"obj_fi"];
7165 $result = $ilDB->queryF(
"SELECT test_id FROM tst_tests WHERE obj_fi = %s",
7172 $test_id =
$row[
"test_id"];
7190 if (($active_id) && ($question_id))
7194 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
7197 $result = $ilDB->queryF(
"SELECT value1 FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
7198 array(
'integer',
'integer',
'integer'),
7199 array($active_id, $question_id,
$pass)
7224 $result = $ilDB->queryF(
"SELECT question_text FROM qpl_questions WHERE question_id = %s",
7247 $result_array = array();
7251 if (is_numeric($user_id))
7253 $result = $ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
7254 "tst_active.submitted test_finished, matriculation FROM usr_data, tst_invited_user " .
7255 "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
7256 "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
7258 array(
'text',
'text',
'text',
'integer',
'integer'),
7259 array(
"", $this->lng->txt(
"unknown"),
"", $this->
getTestId(), $user_id)
7264 $result = $ilDB->queryF(
"SELECT tst_active.active_id, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
7265 "tst_active.submitted test_finished, matriculation FROM usr_data, tst_invited_user " .
7266 "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
7267 "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
7269 array(
'text',
'text',
'text',
'integer'),
7270 array(
"", $this->lng->txt(
"unknown"),
"", $this->
getTestId())
7276 if (is_numeric($user_id))
7278 $result = $ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
7279 "tst_active.submitted test_finished, matriculation FROM usr_data, tst_invited_user " .
7280 "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
7281 "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
7283 array(
'integer',
'integer'),
7289 $result = $ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
7290 "tst_active.submitted test_finished, matriculation FROM usr_data, tst_invited_user " .
7291 "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
7292 "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
7299 $result_array = array();
7302 $result_array[
$row[
'usr_id']]=
$row;
7304 return $result_array;
7319 $result = $ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, tst_active.user_fi usr_id, %s login, %s lastname, %s firstname, tst_active.submitted test_finished, usr_data.matriculation, usr_data.active ".
7320 "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),
7321 array(
'text',
'text',
'text',
'integer'),
7322 array(
"", $this->lng->txt(
"unknown"),
"", $this->
getTestId())
7327 $result = $ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, tst_active.user_fi usr_id, usr_data.login, usr_data.lastname, usr_data.firstname, tst_active.submitted test_finished, usr_data.matriculation, usr_data.active ".
7328 "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),
7338 foreach (
$data as $index => $participant)
7340 if (strlen(trim($participant[
"firstname"].$participant[
"lastname"])) == 0)
7342 $data[$index][
"lastname"] = $this->lng->txt(
"deleted_user");
7352 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
7354 if (count($scoring) == 0)
return array();
7357 $filtered_participants = array();
7358 foreach ($participants as $active_id => $participant)
7360 $qstType_IN_manScoreableQstTypes = $ilDB->in(
'qpl_questions.question_type_fi', $scoring,
false,
'integer');
7363 SELECT tst_test_result.manual 7365 FROM tst_test_result 7367 INNER JOIN qpl_questions 7368 ON tst_test_result.question_fi = qpl_questions.question_id 7370 WHERE tst_test_result.active_fi = %s 7371 AND $qstType_IN_manScoreableQstTypes 7375 $queryString, array(
"integer"), array($active_id)
7385 if ($participant->active) $filtered_participants[$active_id] = $participant;
7388 if (!$participant->active) $filtered_participants[$active_id] = $participant;
7391 $filtered_participants[$active_id] = $participant;
7406 $assessmentSetting =
new ilSetting(
"assessment");
7407 $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
7408 if ($manscoring_done) $filtered_participants[$active_id] = $participant;
7420 $assessmentSetting =
new ilSetting(
"assessment");
7421 $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
7422 if (!$manscoring_done) $filtered_participants[$active_id] = $participant;
7430 if (
$row[
"manual"]) $found++;
7432 if (($found > 0) && ($found < $count)) $filtered_participants[$active_id] = $participant;
7435 $filtered_participants[$active_id] = $participant;
7440 return $filtered_participants;
7454 if (!is_array($ids) || count($ids) ==0)
return array();
7458 $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",
7459 array(
'text',
'text',
'text'),
7460 array(
"", $this->lng->txt(
"unknown"),
"")
7465 $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");
7468 $result_array = array();
7471 $result_array[
$row[
"usr_id"]]=
$row;
7473 return $result_array;
7478 if (!is_array($ids) || count($ids) ==0)
return array();
7490 if (!is_array($ids) || count($ids) ==0)
return array();
7492 foreach ($ids as $obj_id)
7508 include_once
"./Modules/Group/classes/class.ilObjGroup.php";
7510 $members = $group->getGroupMemberIds();
7511 include_once
'./Services/User/classes/class.ilObjUser.php';
7512 foreach ($members as $user_id)
7527 $members = $rbacreview->assignedUsers($role_id,
"usr_id");
7528 include_once
'./Services/User/classes/class.ilObjUser.php';
7529 foreach ($members as $user_id)
7547 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
7548 array(
'integer',
'integer'),
7563 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
7564 array(
'integer',
'integer'),
7567 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_invited_user (test_fi, user_fi, clientip, tstamp) VALUES (%s, %s, %s, %s)",
7568 array(
'integer',
'integer',
'text',
'integer'),
7569 array($this->
getTestId(), $user_id, (strlen($client_ip)) ? $client_ip : NULL, time())
7578 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_invited_user SET clientip = %s, tstamp = %s WHERE test_fi=%s and user_fi=%s",
7579 array(
'text',
'integer',
'integer',
'integer'),
7580 array((strlen($client_ip)) ? $client_ip : NULL, time(), $this->
getTestId(), $user_id)
7592 if (is_numeric($question_fi))
7594 $result = $ilDB->queryF(
"SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s AND question_fi=%s",
7595 array(
'integer',
'integer'),
7596 array($active_id, $question_fi)
7601 $result = $ilDB->queryF(
"SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s",
7606 $result_array = array();
7609 $result_array[
$row[
"question_fi"]]=
$row;
7611 return $result_array;
7623 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_qst_solved WHERE active_fi = %s AND question_fi = %s",
7624 array(
'integer',
'integer'),
7625 array($active_id, $question_id)
7627 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_qst_solved (solved, question_fi, active_fi) VALUES (%s, %s, %s)",
7628 array(
'integer',
'integer',
'integer'),
7629 array($value, $question_id, $active_id)
7640 $result = $ilDB->queryF(
"SELECT submitted FROM tst_active WHERE active_id=%s AND submitted=%s",
7641 array(
'integer',
'integer'),
7642 array($active_id, 1)
7644 return $result->numRows() == 1;
7655 if (!is_numeric($user_id))
7656 $user_id = $ilUser->getId();
7658 $result = $ilDB->queryF(
"SELECT submitted FROM tst_active WHERE test_fi=%s AND user_fi=%s AND submitted=%s",
7659 array(
'integer',
'integer',
'integer'),
7662 return $result->numRows() == 1;
7697 "user_id" => $this->lng->txt(
"user_id"),
7698 "matriculation" => $this->lng->txt(
"matriculation"),
7699 "lastname" => $this->lng->txt(
"lastname"),
7700 "firstname" => $this->lng->txt(
"firstname"),
7701 "login" =>$this->lng->txt(
"login"),
7702 "reached_points" => $this->lng->txt(
"tst_reached_points"),
7703 "max_points" => $this->lng->txt(
"tst_maximum_points"),
7704 "percent_value" => $this->lng->txt(
"tst_percent_solved"),
7705 "mark" => $this->lng->txt(
"tst_mark"),
7706 "ects" => $this->lng->txt(
"ects_grade")
7709 if (count($participants))
7711 if ($this->ects_output)
7715 foreach ($participants as $active_id => $user_rec)
7718 $reached_points = 0;
7720 foreach ($this->questions as $value)
7723 if (is_object($question))
7725 $max_points += $question->getMaximumPoints();
7726 $reached_points += $question->getReachedPoints($active_id);
7729 if ($max_points > 0)
7731 $percentvalue = $reached_points / $max_points;
7732 if ($percentvalue < 0) $percentvalue = 0.0;
7738 $mark_obj = $this->mark_schema->getMatchingMark($percentvalue * 100);
7742 $mark = $mark_obj->getOfficialName();
7743 $ects_mark = $this->
getECTSGrade($passed_array, $reached_points, $max_points);
7747 $user_rec[
'firstname'] =
"";
7748 $user_rec[
'lastname'] = $this->lng->txt(
"unknown");
7751 "user_id"=>$user_rec[
'usr_id'],
7752 "matriculation" => $user_rec[
'matriculation'],
7753 "lastname" => $user_rec[
'lastname'],
7754 "firstname" => $user_rec[
'firstname'],
7755 "login"=>$user_rec[
'login'],
7756 "reached_points" => $reached_points,
7757 "max_points" => $max_points,
7758 "percent_value" => $percentvalue,
7760 "ects" => $ects_mark
7780 $resultarray = array();
7781 foreach (
$row as $rowindex => $entry)
7788 if (strpos($entry,
"\"") !== FALSE)
7790 $entry = str_replace(
"\"",
"\"\"", $entry);
7798 $entry = str_replace(chr(13).chr(10), chr(10), $entry);
7802 $entry =
"\"" . $entry .
"\"";
7805 $resultarray[$rowindex] = $entry;
7807 return $resultarray;
7821 $result = $ilDB->queryF(
"SELECT tries FROM tst_active WHERE active_id = %s",
7828 return $row[
"tries"];
7848 $result = $ilDB->queryF(
"SELECT MAX(pass) maxpass FROM tst_test_result WHERE active_fi = %s",
7855 $max =
$row[
"maxpass"];
7878 $result = $ilDB->queryF(
"SELECT * FROM tst_pass_result WHERE active_fi = %s",
7888 if(
$row[
"maxpoints"] > 0)
7890 $factor =
$row[
"points"] /
$row[
"maxpoints"];
7897 if($factor > $bestfactor)
7900 $bestfactor = $factor;
7903 if (is_array($bestrow))
7905 return $bestrow[
"pass"];
7928 $counted_pass = NULL;
7937 return $counted_pass;
7953 global $tree, $ilDB,
$lng, $ilPluginAdmin;
7955 require_once
'Modules/Test/classes/class.ilTestSessionFactory.php';
7957 $testSession = $testSessionFactory->getSession($active_id);
7959 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
7961 $testSequence = $testSequenceFactory->getSequence($testSession);
7963 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
7965 $dynamicQuestionSetConfig->loadFromDb();
7967 $testSequence->loadFromDb($dynamicQuestionSetConfig);
7970 return $testSequence->getTrackedQuestionCount();
7977 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
7979 foreach ($this->questions as $value)
7983 $workedthrough += 1;
7986 return $workedthrough;
8002 $result = $ilDB->queryF(
"SELECT tst_test_result.tstamp FROM tst_test_result WHERE active_fi = %s AND pass = %s ORDER BY tst_test_result.tstamp DESC",
8003 array(
'integer',
'integer'),
8004 array($active_id,
$pass)
8009 return $row[
"tstamp"];
8028 "executable" =>
true,
8029 "errormessage" =>
"" 8033 $result[
"executable"] =
false;
8039 $result[
"executable"] =
false;
8051 if ($starting_time !== FALSE)
8062 $testSession->increasePass();
8063 $testSession->setLastSequence(0);
8064 $testSession->saveToDb();
8068 $result[
"executable"] =
false;
8069 $result[
"errormessage"] = $this->lng->txt(
"detail_max_processing_time_reached");
8079 require_once
'Modules/Test/classes/class.ilTestPassesSelector.php';
8081 $testPassesSelector->setActiveId($active_id);
8082 $testPassesSelector->setLastFinishedPass($testSession->getLastFinishedPass());
8084 $closedPasses = $testPassesSelector->getClosedPasses();
8088 $result[
"executable"] =
false;
8089 $result[
"errormessage"] = $this->lng->txt(
"maximum_nr_of_tries_reached");
8109 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getReportingDate(), $matches))
8111 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
8113 if ($now < $epoch_time)
8129 $notimeleft = FALSE;
8130 if ($starting_time !== FALSE)
8154 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getReportingDate(), $matches))
8156 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
8158 if ($now < $epoch_time)
8183 if ($active_id < 1)
return FALSE;
8188 $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",
8189 array(
'integer',
'integer'),
8190 array($active_id,
$pass)
8195 if (preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches))
8197 return mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
8224 if ($now > ($starting_time + $processing_time))
8245 questtypes.type_tag, 8247 tstquest.obligatory, 8248 origquest.obj_fi orig_obj_fi 8250 FROM qpl_questions questions 8252 INNER JOIN qpl_qst_type questtypes 8253 ON questtypes.question_type_id = questions.question_type_fi 8255 INNER JOIN tst_test_question tstquest 8256 ON tstquest.question_fi = questions.question_id 8258 LEFT JOIN qpl_questions origquest 8259 ON origquest.question_id = questions.original_id 8261 WHERE tstquest.test_fi = %s 8263 ORDER BY tstquest.sequence 8266 $query_result = $ilDB->queryF(
8270 $questions = array();
8272 while (
$row = $ilDB->fetchAssoc($query_result))
8276 $question[
'obligationPossible'] = self::isQuestionObligationPossible(
$row[
'question_id']);
8278 $questions[] = $question;
8287 public function getPotentialRandomTestQuestions()
8296 questtypes.type_tag, 8297 origquest.obj_fi orig_obj_fi 8299 FROM qpl_questions questions 8301 INNER JOIN qpl_qst_type questtypes 8302 ON questtypes.question_type_id = questions.question_type_fi 8304 INNER JOIN tst_rnd_cpy tstquest 8305 ON tstquest.qst_fi = questions.question_id 8307 LEFT JOIN qpl_questions origquest 8308 ON origquest.question_id = questions.original_id 8310 WHERE tstquest.tst_fi = %s 8313 $query_result = $ilDB->queryF(
8317 $questions = array();
8319 while (
$row = $ilDB->fetchAssoc($query_result))
8323 $question[
'obligationPossible'] = self::isQuestionObligationPossible(
$row[
'question_id']);
8325 $questions[] = $question;
8339 return ($this->shuffle_questions) ? 1 : 0;
8350 $this->shuffle_questions = ($a_shuffle) ? 1 : 0;
8367 return ($this->show_summary) ? $this->show_summary : 0;
8384 $this->show_summary = $a_value;
8395 if (($this->show_summary & 1) > 0)
8415 $this->show_summary = 1;
8419 $this->show_summary = 0;
8431 if (($this->show_summary & 2) > 0)
8451 $this->show_summary = $this->show_summary | 2;
8457 $this->show_summary = $this->show_summary ^ 2;
8470 if (($this->show_summary & 4) > 0)
8490 $this->show_summary = $this->show_summary | 4;
8496 $this->show_summary = $this->show_summary ^ 4;
8509 if (($this->show_summary & 8) > 0)
8529 $this->show_summary = $this->show_summary | 8;
8535 $this->show_summary = $this->show_summary ^ 8;
8548 return ($this->results_presentation) ? $this->results_presentation : 0;
8559 if (($this->results_presentation & 1) > 0)
8577 if (($this->results_presentation & 2) > 0)
8595 if (($this->results_presentation & 4) > 0)
8613 if (($this->results_presentation & 8) > 0)
8631 if (($this->results_presentation & 16) > 0)
8649 if (($this->results_presentation & 32) > 0)
8665 if (($this->results_presentation & 64) > 0)
8681 if(($this->results_presentation & 128) > 0)
8699 $this->results_presentation = $a_results_presentation;
8714 $this->results_presentation = $this->results_presentation | 1;
8720 $this->results_presentation = $this->results_presentation ^ 1;
8735 $this->results_presentation = $this->results_presentation | 2;
8741 $this->results_presentation = $this->results_presentation ^ 2;
8767 $this->results_presentation = $this->results_presentation | 4;
8773 $this->results_presentation = $this->results_presentation ^ 4;
8788 $this->results_presentation = $this->results_presentation | 8;
8794 $this->results_presentation = $this->results_presentation ^ 8;
8809 $this->results_presentation = $this->results_presentation | 16;
8815 $this->results_presentation = $this->results_presentation ^ 16;
8830 $this->results_presentation = $this->results_presentation | 32;
8836 $this->results_presentation = $this->results_presentation ^ 32;
8851 $this->results_presentation = $this->results_presentation | 64;
8857 $this->results_presentation = $this->results_presentation ^ 64;
8871 $this->results_presentation = $this->results_presentation | 128;
8877 $this->results_presentation = $this->results_presentation ^ 128;
8885 $result = $ilDB->queryF(
"SELECT user_fi FROM tst_active WHERE active_id = %s",
8892 return $row[
"user_fi"];
8902 return ($this->allowedUsers) ? $this->allowedUsers : 0;
8907 $this->allowedUsers = $a_allowed_users;
8912 return ($this->allowedUsersTimeGap) ? $this->allowedUsersTimeGap : 0;
8917 $this->allowedUsersTimeGap = $a_allowed_users_time_gap;
8926 if (($nr_of_users > 0) && ($time_gap > 0))
8929 $time_border = $now - $time_gap;
8930 $str_time_border = strftime(
"%Y%m%d%H%M%S", $time_border);
8931 $result = $ilDB->queryF(
"SELECT DISTINCT tst_times.active_fi FROM tst_times, tst_active WHERE tst_times.tstamp > %s AND tst_times.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
8932 array(
'integer',
'integer'),
8935 if (
$result->numRows() >= $nr_of_users)
8937 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
8956 $result = $ilDB->queryF(
"SELECT finished FROM tst_times WHERE active_fi = %s ORDER BY finished DESC",
8963 return $row[
"finished"];
8977 if (preg_match(
"/<[^>]*?>/", $a_text))
8997 for ($i = 0; $i < $a_material->getMaterialCount(); $i++)
8999 $material = $a_material->getMaterial($i);
9000 if (strcmp($material[
"type"],
"mattext") == 0)
9002 $result .= $material[
"material"]->getContent();
9004 if (strcmp($material[
"type"],
"matimage") == 0)
9006 $matimage = $material[
"material"];
9007 if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches))
9010 if (!is_array(
$_SESSION[
"import_mob_xhtml"]))
$_SESSION[
"import_mob_xhtml"] = array();
9011 array_push(
$_SESSION[
"import_mob_xhtml"], array(
"mob" => $matimage->getLabel(),
"uri" => $matimage->getUri()));
9016 $ilLog->write(print_r(
$_SESSION[
"import_mob_xhtml"],
true));
9030 include_once
"./Services/RTE/classes/class.ilRTE.php";
9031 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
9033 $a_xml_writer->xmlStartTag(
"material");
9035 "texttype" =>
"text/plain" 9037 if ($this->
isHTML($a_material))
9039 $attrs[
"texttype"] =
"text/xhtml";
9044 foreach (
$mobs as $mob)
9046 $moblabel =
"il_" . IL_INST_ID .
"_mob_" . $mob;
9047 if (strpos($a_material,
"mm_$mob") !== FALSE)
9053 "label" => $moblabel,
9054 "uri" =>
"objects/" .
"il_" . IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle()
9057 $a_xml_writer->xmlElement(
"matimage", $imgattrs, NULL);
9060 $a_xml_writer->xmlEndTag(
"material");
9071 include_once
"./Services/Utilities/classes/class.ilUtil.php";
9085 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_tests SET certificate_visibility = %s, tstamp = %s WHERE test_id = %s",
9086 array(
'text',
'integer',
'integer'),
9087 array($a_value, time(), $this->
getTestId())
9099 return (strlen($this->certificate_visibility)) ? $this->certificate_visibility : 0;
9110 $this->certificate_visibility = $a_value;
9121 return ($this->anonymity) ? 1 : 0;
9135 $this->anonymity = 1;
9138 $this->anonymity = 0;
9151 return ($this->show_cancel) ? 1 : 0;
9165 $this->show_cancel = 1;
9168 $this->show_cancel = 0;
9181 return ($this->show_marker) ? 1 : 0;
9195 $this->show_marker = 1;
9198 $this->show_marker = 0;
9211 return ($this->fixed_participants) ? 1 : 0;
9225 $this->fixed_participants = 1;
9228 $this->fixed_participants = 0;
9244 $result = $ilDB->queryF(
"SELECT anonymity FROM tst_tests WHERE obj_fi = %s",
9250 return $row[
'anonymity'];
9266 SELECT tst_tests.question_set_type 9268 INNER JOIN tst_tests 9269 ON tst_active.test_fi = tst_tests.test_id 9270 WHERE tst_active.active_id = %s 9273 $res = $ilDB->queryF(
$query, array(
'integer'), array($active_id) );
9275 while(
$row = $ilDB->fetchAssoc(
$res))
9277 return $row[
'question_set_type'];
9293 throw new Exception(__METHOD__.
' is deprecated ... use ilObjTest::lookupQuestionSetTypeByActiveId() instead!');
9297 $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",
9303 return $row[
'random_test'];
9320 return $this->lng->txt(
"unknown") . $suffix;
9324 include_once
'./Services/User/classes/class.ilObjUser.php';
9326 if (strlen($uname[
"firstname"].$uname[
"lastname"]) == 0) $uname[
"firstname"] = $this->lng->txt(
"deleted_user");
9329 return trim($uname[
"lastname"] .
", " . $uname[
"firstname"]) . $suffix;
9333 return trim($uname[
"firstname"] .
" " . $uname[
"lastname"]) . $suffix;
9349 return $this->lng->txt(
"tst_start_test");
9351 $active_pass = $this->
_getPass($active_id);
9355 if ($active_pass == 0)
9357 return $this->lng->txt(
"tst_start_test");
9361 return $this->lng->txt(
"tst_start_new_test_pass");
9366 return $this->lng->txt(
"tst_resume_test");
9375 public function getAvailableDefaults()
9384 "SELECT * FROM tst_test_defaults WHERE user_fi = %s ORDER BY name ASC",
9386 array($ilUser->getId())
9388 $defaults = array();
9391 $defaults[
$row[
"test_defaults_id"]] =
$row;
9405 return self::_getTestDefaults($test_defaults_id);
9412 $result = $ilDB->queryF(
"SELECT * FROM tst_test_defaults WHERE test_defaults_id = %s",
9414 array($test_defaults_id)
9436 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_test_defaults WHERE test_defaults_id = %s",
9438 array($test_default_id)
9452 $testsettings = array(
9531 $next_id = $ilDB->nextId(
'tst_test_defaults');
9533 'tst_test_defaults',
9535 'test_defaults_id' => array(
'integer', $next_id),
9536 'name' => array(
'text', $a_name),
9537 'user_fi' => array(
'integer', $ilUser->getId()),
9538 'defaults' => array(
'clob', serialize($testsettings)),
9539 'marks' => array(
'clob', serialize($this->mark_schema)),
9540 'tstamp' => array(
'integer', time())
9554 $testsettings = unserialize($test_defaults[
"defaults"]);
9555 include_once
"./Modules/Test/classes/class.assMarkSchema.php";
9556 $this->mark_schema = unserialize($test_defaults[
"marks"]);
9588 $this->
setKiosk($testsettings[
"Kiosk"]);
9591 $this->
setECTSFX($testsettings[
"ECTSFX"]);
9593 if( isset($testsettings[
"isRandomTest"]) )
9595 if( $testsettings[
"isRandomTest"] )
9604 elseif( isset($testsettings[
"questionSetType"]) )
9627 if( isset($testsettings[
'examid_in_kiosk']) )
9635 if( isset($testsettings[
'show_exam_id']) )
9682 if (extension_loaded(
"tidy"))
9686 "output-xml" =>
true,
9687 "numeric-entities" =>
true 9690 $tidy->parseString($print_output, $config,
'utf8');
9691 $tidy->cleanRepair();
9692 $print_output = tidy_get_output($tidy);
9693 $print_output = preg_replace(
"/^.*?(<html)/",
"\\1", $print_output);
9697 $print_output = str_replace(
" ",
" ", $print_output);
9698 $print_output = str_replace(
"⊗",
"X", $print_output);
9700 $xsl = file_get_contents(
"./Modules/Test/xml/question2fo.xsl");
9704 'font-family="Helvetica, unifont"',
9705 'font-family="'.
$GLOBALS[
'ilSetting']->
get(
'rpc_pdf_font',
'Helvetica, unifont').
'"',
9709 $args = array(
'/_xml' => $print_output,
'/_xsl' => $xsl );
9712 $output =
xslt_process($xh,
"arg:/_xml",
"arg:/_xsl", NULL, $args, $params);
9726 $content = preg_replace(
"/href=\".*?\"/",
"", $content);
9727 $printbody =
new ilTemplate(
"tpl.il_as_tst_print_body.html", TRUE, TRUE,
"Modules/Test");
9729 $printbody->setVariable(
"ADM_CONTENT", $content);
9730 $printbody->setCurrentBlock(
"css_file");
9732 $printbody->parseCurrentBlock();
9733 $printbody->setCurrentBlock(
"css_file");
9735 $printbody->parseCurrentBlock();
9736 $printoutput = $printbody->get();
9737 $html = str_replace(
"href=\"./",
"href=\"" . ILIAS_HTTP_PATH .
"/", $printoutput);
9738 $html = preg_replace(
"/<div id=\"dontprint\">.*?<\\/div>/ims",
"", $html);
9739 if (extension_loaded(
"tidy"))
9743 "output-xml" =>
true,
9744 "numeric-entities" =>
true 9747 $tidy->parseString($html, $config,
'utf8');
9748 $tidy->cleanRepair();
9749 $html = tidy_get_output($tidy);
9750 $html = preg_replace(
"/^.*?(<html)/",
"\\1", $html);
9754 $html = str_replace(
" ",
" ", $html);
9755 $html = str_replace(
"⊗",
"X", $html);
9757 $html = preg_replace(
"/src=\".\\//ims",
"src=\"" . ILIAS_HTTP_PATH .
"/", $html);
9771 include_once
"./Services/Utilities/classes/class.ilUtil.php";
9773 $fp = fopen($fo_file,
"w"); fwrite($fp, $fo); fclose($fp);
9775 include_once
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
9785 $ilLog->write(__METHOD__.
': '.$e->getMessage());
9790 $ilLog->write(__METHOD__.
': '.$e->getMessage());
9817 $result = $ilDB->queryF(
"SELECT feedback FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
9818 array(
'integer',
'integer',
'integer'),
9819 array($active_id, $question_id,
$pass)
9824 include_once(
"./Services/RTE/classes/class.ilRTE.php");
9840 function saveManualFeedback($active_id, $question_id,
$pass, $feedback)
9844 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
9845 array(
'integer',
'integer',
'integer'),
9846 array($active_id, $question_id,
$pass)
9849 if (strlen($feedback))
9851 $next_id = $ilDB->nextId(
'tst_manual_fb');
9853 $result = $ilDB->insert(
'tst_manual_fb', array(
9854 'manual_feedback_id' => array(
'integer', $next_id ),
9855 'active_fi' => array(
'integer', $active_id ),
9856 'question_fi' => array(
'integer', $question_id ),
9857 'pass' => array(
'integer',
$pass),
9859 'tstamp' => array(
'integer', time() ),
9862 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
9866 include_once
"./Modules/Test/classes/class.ilObjTestAccess.php";
9868 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
9875 $ilias->raiseError(
$result->getMessage());
9893 if (strcmp(
$_GET[
"tst_javascript"],
"0") == 0)
return FALSE;
9895 $assessmentSetting =
new ilSetting(
"assessment");
9896 return ($ilUser->getPref(
"tst_javascript") === FALSE) ? $assessmentSetting->get(
"use_javascript") : $ilUser->getPref(
"tst_javascript");
9901 include_once
"./Modules/Test/classes/class.ilTestSequence.php";
9912 $this->test_id = $a_id;
9926 if (count($participants))
9928 foreach ($participants as $active_id => $user_rec)
9931 $reached_points = 0;
9933 foreach ($this->questions as $value)
9936 if (is_object($question))
9938 $max_points += $question->getMaximumPoints();
9939 $reached_points += $question->getReachedPoints($active_id);
9940 if ($max_points > 0)
9942 $percentvalue = $reached_points / $max_points;
9943 if ($percentvalue < 0) $percentvalue = 0.0;
9951 $user_rec[
'firstname'] =
"";
9952 $user_rec[
'lastname'] = $this->lng->txt(
"unknown");
9955 "user_id"=>$user_rec[
'usr_id'],
9956 "matriculation" => $user_rec[
'matriculation'],
9957 "lastname" => $user_rec[
'lastname'],
9958 "firstname" => $user_rec[
'firstname'],
9959 "login"=>$user_rec[
'login'],
9960 "question_id" => $question->getId(),
9961 "question_title" => $question->getTitle(),
9962 "reached_points" => $reached_points,
9963 "max_points" => $max_points
9980 $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",
9984 $rec = $ilDB->fetchAssoc(
$result);
9985 return $rec[
"obj_id"];
9996 global $ilPluginAdmin;
9997 if ($ilPluginAdmin->isActive(
IL_COMP_MODULE,
"TestQuestionPool",
"qst", $a_pname))
10011 $result = $ilDB->queryF(
"SELECT passed FROM tst_result_cache WHERE active_fi = %s",
10018 return $row[
'passed'];
10023 $result_array =& $this->
getTestResult($active_id, $counted_pass);
10024 return $result_array[
"test"][
"passed"];
10037 include_once
"./Services/Certificate/classes/class.ilCertificate.php";
10038 include_once
"./Modules/Test/classes/class.ilTestCertificateAdapter.php";
10040 if ($cert->isComplete())
10082 public function getParticipantsForTestAndQuestion($test_id, $question_id)
10088 SELECT tst_test_result.active_fi, tst_test_result.question_fi, tst_test_result.pass 10089 FROM tst_test_result, tst_active, qpl_questions 10090 WHERE tst_active.active_id = tst_test_result.active_fi 10091 AND tst_active.test_fi = %s 10092 AND tst_test_result.question_fi = qpl_questions.question_id 10093 AND tst_test_result.question_fi = %s";
10096 array(
'integer',
'integer'),
10097 array($test_id, $question_id)
10099 $foundusers = array();
10103 if (!array_key_exists(
$row[
"active_fi"], $foundusers))
10105 $foundusers[
$row[
"active_fi"]] = array();
10107 array_push($foundusers[
$row[
"active_fi"]], array(
"pass" => $row[
"pass"],
"qid" => $row[
"question_fi"]));
10109 return $foundusers;
10120 $foundParticipants =&
$data->getParticipants();
10121 $results = array(
"overview" => array(),
"questions" => array());
10122 if (count($foundParticipants))
10124 $results[
"overview"][$this->lng->txt(
"tst_eval_total_persons")] = count($foundParticipants);
10126 $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished")] = $total_finished;
10128 $diff_seconds = $average_time;
10129 $diff_hours = floor($diff_seconds/3600);
10130 $diff_seconds -= $diff_hours * 3600;
10131 $diff_minutes = floor($diff_seconds/60);
10132 $diff_seconds -= $diff_minutes * 60;
10133 $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
10135 $total_passed_reached = 0;
10136 $total_passed_max = 0;
10137 $total_passed_time = 0;
10138 foreach ($foundParticipants as $userdata)
10140 if ($userdata->getPassed())
10143 $total_passed_reached += $userdata->getReached();
10144 $total_passed_max += $userdata->getMaxpoints();
10145 $total_passed_time += $userdata->getTimeOfWork();
10148 $average_passed_reached = $total_passed ? $total_passed_reached / $total_passed : 0;
10149 $average_passed_max = $total_passed ? $total_passed_max / $total_passed : 0;
10150 $average_passed_time = $total_passed ? $total_passed_time / $total_passed : 0;
10151 $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed")] = $total_passed;
10152 $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);
10153 $average_time = $average_passed_time;
10154 $diff_seconds = $average_time;
10155 $diff_hours = floor($diff_seconds/3600);
10156 $diff_seconds -= $diff_hours * 3600;
10157 $diff_minutes = floor($diff_seconds/60);
10158 $diff_seconds -= $diff_minutes * 60;
10159 $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
10162 foreach (
$data->getQuestionTitles() as $question_id => $question_title)
10167 foreach ($foundParticipants as $userdata)
10169 for ($i = 0; $i <= $userdata->getLastPass(); $i++)
10171 if (is_object($userdata->getPass($i)))
10173 $question =& $userdata->getPass($i)->getAnsweredQuestionByQuestionId($question_id);
10174 if (is_array($question))
10177 $reached += $question[
"reached"];
10178 $max += $question[
"points"];
10183 $percent = $max ? $reached/$max * 100.0 : 0;
10185 $results[
"questions"][$question_id] = array(
10187 sprintf(
"%.2f", $answered ? $reached / $answered : 0) .
" " . strtolower($this->lng->txt(
"of")) .
" " . sprintf(
"%.2f", $answered ? $max / $answered : 0),
10188 sprintf(
"%.2f", $percent) .
"%",
10190 sprintf(
"%.2f", $answered ? $reached / $answered : 0),
10191 sprintf(
"%.2f", $answered ? $max / $answered : 0),
10203 include_once(
"./Modules/Test/classes/class.ilTestExport.php");
10205 return $test_exp->buildExportFile();
10223 $this->mailnotification = $a_notification;
10228 include_once
"./Modules/Test/classes/class.ilTestMailNotification.php";
10233 $mail->sendSimpleNotification($owner_id, $this->
getTitle(), $usr_data);
10243 include_once
"./Modules/Test/classes/class.ilObjTestGUI.php";
10244 include_once
"./Modules/Test/classes/tables/class.ilEvaluationAllTableGUI.php";
10246 return $table_gui->getSelectedColumns();
10251 include_once
"./Modules/Test/classes/class.ilTestMailNotification.php";
10257 include_once
"./Modules/Test/classes/class.ilTestExport.php";
10259 $file = $exportObj->exportToExcel($deliver = FALSE,
'active_id', $active_id, $passedonly = FALSE);
10260 include_once
"./Services/Mail/classes/class.ilFileDataMail.php";
10262 $fd->copyAttachmentFile(
$file,
"result_" . $active_id .
".xls");
10263 $file_names[] =
"result_" . $active_id .
".xls";
10265 $mail->sendAdvancedNotification($owner_id, $this->
getTitle(), $usr_data, $file_names);
10267 if(count($file_names))
10269 $fd->unlinkFiles($file_names);
10280 $query =
"SELECT usr_id FROM usr_data";
10284 $activequery = sprintf(
"SELECT user_fi FROM tst_active WHERE test_fi = %s AND user_fi = %s",
10285 $ilDB->quote($this->getTestId()),
10286 $ilDB->quote(
$data[
'usr_id'])
10288 $activeresult = $ilDB->query($activequery);
10289 if ($activeresult->numRows() == 0)
10291 $user_id =
$data[
'usr_id'];
10292 if ($user_id != 13)
10294 include_once
"./Modules/Test/classes/class.ilTestSession.php";
10295 $testSession = FALSE;
10297 $testSession->setRefId($this->
getRefId());
10298 $testSession->setTestId($this->
getTestId());
10299 $testSession->setUserId($user_id);
10300 $testSession->saveToDb();
10302 $nr_of_passes = rand(1, $passes);
10303 $active_id = $testSession->getActiveId();
10306 include_once
"./Modules/Test/classes/class.ilTestSequence.php";
10308 if (!$testSequence->hasSequence())
10311 $testSequence->saveToDb();
10313 for ($seq = 1; $seq <= count($this->questions); $seq++)
10315 $question_id = $testSequence->getQuestionForSequence($seq);
10317 $objQuestion->createRandomSolution($testSession->getActiveId(),
$pass);
10319 if (
$pass < $nr_of_passes - 1)
10321 $testSession->increasePass();
10322 $testSession->setLastSequence(0);
10323 $testSession->saveToDb();
10327 $testSession->setSubmitted(1);
10328 $testSession->setSubmittedTimestamp(date(
'Y-m-d H:i:s'));
10329 $testSession->saveToDb();
10333 if ($number == 0)
return;
10345 FROM tst_result_cache 10346 WHERE active_fi = %s 10350 $query, array(
'integer'), array($active_id)
10355 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
10361 FROM tst_result_cache 10362 WHERE active_fi = %s 10366 $query, array(
'integer'), array($active_id)
10378 if ($this->mailnottype == 1)
10392 $this->mailnottype = 1;
10396 $this->mailnottype = 0;
10402 if ($this->exportsettings)
10416 $this->exportsettings = $a_settings;
10420 $this->exportsettings = 0;
10426 if (($this->exportsettings & 1) > 0)
10440 $this->exportsettings = $this->exportsettings | 1;
10446 $this->exportsettings = $this->exportsettings ^ 1;
10452 return $this->enabled_view_mode;
10456 $this->enabled_view_mode = $mode;
10468 $new_array = array();
10471 $query =
'SELECT question_fi FROM tst_test_question WHERE test_fi = %s';
10472 $types = array(
'integer');
10475 $new_question_id += 1;
10479 $res = $ilDB->queryF(
$query, $types, $values);
10480 while(
$row = $ilDB->fetchAssoc(
$res)) {
10482 $qid =
$row[
'question_fi'];
10484 if ($qid == $new_question_id) {
10487 else if ($qid == $previous_question_id) {
10488 $new_array[$position++] = $qid;
10489 $new_array[$position++] = $new_question_id;
10493 $new_array[$position++] = $qid;
10497 $update_query =
'UPDATE tst_test_question SET sequence = %s WHERE test_fi = %s AND question_fi = %s';
10498 $update_types = array(
'integer',
'integer',
'integer');
10500 foreach($new_array as $position => $qid) {
10501 $ilDB->manipulateF(
10530 'pass_details' =>
'setShowPassDetails',
10531 'solution_details' =>
'setShowSolutionDetails',
10532 'solution_printview' =>
'setShowSolutionPrintview',
10533 'solution_feedback' =>
'setShowSolutionFeedback',
10534 'solution_answers_only' =>
'setShowSolutionAnswersOnly',
10535 'solution_signature' =>
'setShowSolutionSignature',
10536 'solution_suggested' =>
'setShowSolutionSuggested',
10538 foreach($setter as $key => $setter) {
10553 $this->poolUsage = (boolean)$usage;
10564 foreach($orders as
$id => $position)
10569 isset($obligations[
$id]) && $obligations[
$id] ? 1 : 0
10573 UPDATE tst_test_question 10576 WHERE question_fi = %s 10579 $ilDB->manipulateF(
10580 $query, array(
'integer',
'integer',
'integer'), array($i, $obligatory, $id)
10590 if ($question_before) {
10591 $query =
'SELECT sequence, test_fi FROM tst_test_question WHERE question_fi = %s';
10592 $types = array(
'integer');
10593 $values = array($question_before);
10594 $rset = $ilDB->queryF(
$query, $types, $values);
10597 if (!$question_before || ($rset && !(
$row = $ilDB->fetchAssoc($rset)))) {
10604 $update =
'UPDATE tst_test_question SET sequence = sequence + 1 WHERE sequence > %s AND test_fi = %s';
10605 $types = array(
'integer',
'integer');
10606 $values = array(
$row[
'sequence'],
$row[
'test_fi']);
10607 $ilDB->manipulateF($update, $types, $values);
10609 $update =
'UPDATE tst_test_question SET sequence = %s WHERE question_fi = %s';
10610 $types = array(
'integer',
'integer');
10611 $values = array(
$row[
'sequence'] + 1, $question_to_move);
10612 $ilDB->manipulateF($update, $types, $values);
10622 $IN_questions = $ilDB->in(
'q1.question_id', array_keys($questions),
false,
'integer');
10625 SELECT count(q1.question_id) cnt 10627 FROM qpl_questions q1 10629 INNER JOIN qpl_questions q2 10630 ON q2.question_id = q1.original_id 10632 WHERE $IN_questions 10633 AND q1.obj_fi = q2.obj_fi 10636 $rset = $ilDB->query(
$query);
10638 $row = $ilDB->fetchAssoc($rset);
10640 return $row[
'cnt'] > 0;
10653 $result = $ilDB->queryF(
"SELECT test_fi,MAX(pass) AS pass FROM tst_active".
10654 " JOIN tst_pass_result ON (tst_pass_result.active_fi = tst_active.active_id)".
10655 " WHERE user_fi=%s".
10656 " GROUP BY test_fi",
10657 array(
'integer',
'integer'),
10658 array($a_user_id, 1)
10663 $obj_id = self::_getObjectIDFromTestID(
$row[
"test_fi"]);
10664 $all[$obj_id] = (bool)
$row[
"pass"];
10680 $this->online = (bool)$a_online;
10685 $this->print_best_solution_with_result = (bool) $status;
10715 $this->activation_visibility = (bool) $a_value;
10725 return (
bool)$this->activation_limited;
10730 $this->activation_limited = (bool)$a_value;
10742 $this->_highscore_enabled = (bool)$a_enabled;
10752 return (
bool) $this->_highscore_enabled;
10764 $this->_highscore_anon = (bool)$a_anon;
10778 return (
bool) $this->_highscore_anon;
10808 $this->_highscore_achieved_ts = (bool)$a_achieved_ts;
10818 return (
bool) $this->_highscore_achieved_ts;
10828 $this->_highscore_score = (bool)$a_score;
10838 return (
bool) $this->_highscore_score;
10848 $this->_highscore_percentage = (bool)$a_percentage;
10858 return (
bool) $this->_highscore_percentage;
10868 $this->_highscore_hints = (bool)$a_hints;
10878 return (
bool) $this->_highscore_hints;
10888 $this->_highscore_wtime = (bool)$a_wtime;
10898 return (
bool) $this->_highscore_wtime;
10908 $this->_highscore_own_table = (bool)$a_own_table;
10918 return (
bool) $this->_highscore_own_table;
10928 $this->_highscore_top_table = (bool)$a_top_table;
10938 return (
bool) $this->_highscore_top_table;
10949 $this->_highscore_top_num = (int)$a_top_num;
10962 $retval = $a_retval;
10963 if ( (
int) $this->_highscore_top_num != 0)
10965 $retval = $this->_highscore_top_num;
10974 switch ($specific_answer_feedback)
10977 $this->specific_answer_feedback = 1;
10980 $this->specific_answer_feedback = 0;
10987 switch ($this->specific_answer_feedback)
11024 require_once(
'Modules/TestQuestionPool/classes/class.assQuestion.php');
11032 $obligationPossible = call_user_func(array($classConcreteQuestion,
'isObligationPossible'), $questionId);
11034 return $obligationPossible;
11047 $rset = $ilDB->queryF(
'SELECT obligatory FROM tst_test_question WHERE question_fi = %s', array(
'integer'), array($question_id));
11049 if(
$row = $ilDB->fetchAssoc($rset) )
11051 return (
bool)
$row[
'obligatory'];
11073 $rset = $ilDB->queryF(
11074 'SELECT obligations_answered FROM tst_pass_result WHERE active_fi = %s AND pass = %s',
11075 array(
'integer',
'integer'),
11076 array($active_id,
$pass)
11079 if(
$row = $ilDB->fetchAssoc($rset) )
11081 return (
bool)
$row[
'obligations_answered'];
11084 return !self::hasObligations($test_id);
11099 $rset = $ilDB->queryF(
11100 'SELECT count(*) cnt FROM tst_test_question WHERE test_fi = %s AND obligatory = 1',
11101 array(
'integer'), array($test_id)
11104 $row = $ilDB->fetchAssoc($rset);
11106 return (
bool)
$row[
'cnt'] > 0;
11149 #region Examview / PDF Examview 11212 return (strlen($this->activation_starting_time)) ? $this->activation_starting_time : NULL;
11217 return (strlen($this->activation_ending_time)) ? $this->activation_ending_time : NULL;
11225 $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");
11228 $times[
$row[
'active_fi']] = $row[
'started'];
11238 $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",
11244 $times[
$row[
'active_fi']] = $row[
'additionaltime'];
11253 $result = $ilDB->queryF(
"SELECT additionaltime FROM tst_addtime WHERE active_fi = %s",
11260 return $row[
'additionaltime'];
11269 $participants = array();
11270 if ($active_id == 0)
11272 $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s",
11278 array_push($participants,
$row[
'active_id']);
11283 array_push($participants, $active_id);
11285 foreach ($participants as $active_id)
11287 $result = $ilDB->queryF(
"SELECT active_fi FROM tst_addtime WHERE active_fi = %s",
11293 $ilDB->manipulateF(
"DELETE FROM tst_addtime WHERE active_fi = %s",
11299 $ilDB->manipulateF(
"UPDATE tst_active SET tries = %s, submitted = %s, submittimestamp = %s WHERE active_id = %s",
11300 array(
'integer',
'integer',
'timestamp',
'integer'),
11301 array(0, 0, NULL, $active_id)
11304 $ilDB->manipulateF(
"INSERT INTO tst_addtime (active_fi, additionaltime, tstamp) VALUES (%s, %s, %s)",
11305 array(
'integer',
'integer',
'integer'),
11306 array($active_id, $minutes, time())
11309 require_once
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
11336 public function getMaxPassOfTest()
11344 SELECT MAX(tst_pass_result.pass) + 1 max_res 11345 FROM tst_pass_result 11346 INNER JOIN tst_active ON tst_active.active_id = tst_pass_result.active_fi 11347 WHERE test_fi = '.$ilDB->quote($this->
getTestId(),
'integer').
' 11351 return (
int)
$data[
'max_res'];
11364 $exam_id_query =
'SELECT exam_id FROM tst_pass_result WHERE active_fi = %s AND pass = %s';
11365 $exam_id_result = $ilDB->queryF( $exam_id_query, array(
'integer',
'integer' ), array( $active_id,
$pass ) );
11366 if ($ilDB->numRows( $exam_id_result ) == 1)
11368 $exam_id_row = $ilDB->fetchAssoc( $exam_id_result );
11370 if ($exam_id_row[
'exam_id'] != null)
11372 return $exam_id_row[
'exam_id'];
11390 $inst_id = $ilSetting->get(
'inst_id', null );
11392 $obj_id = self::_getObjectIDFromActiveID($active_id);
11394 $examId =
'I' . $inst_id .
'_T' . $obj_id .
'_A' . $active_id .
'_P' .
$pass;
11446 $this->char_selector_availability = (int) $availability;
11462 $this->char_selector_definition = $definition;
11505 $query =
"SELECT question_set_type FROM tst_tests WHERE obj_fi = %s";
11507 $res = $ilDB->queryF(
$query, array(
'integer'), array($objId));
11511 while(
$row = $ilDB->fetchAssoc(
$res) )
11548 return self::lookupQuestionSetType($a_obj_id) == self::QUESTION_SET_TYPE_RANDOM;
11556 return $lng->
txt(
'tst_question_set_type_fixed');
11559 return $lng->
txt(
'tst_question_set_type_random');
11562 return $lng->
txt(
'tst_question_set_type_dynamic');
11580 require_once
'class.ilTestScoring.php';
11582 $scoring->setPreserveManualScores($preserve_manscoring);
11583 $scoring->recalculateSolutions();
11588 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
11590 $questionChangeListeners = array(
11594 return $questionChangeListeners;
11604 INNER JOIN tst_tests 11605 ON test_id = test_fi 11609 $res = $ilDB->queryF(
$query, array(
'integer'), array($userId));
11613 while(
$row = $ilDB->fetchAssoc(
$res) )
11615 $objIds[] = (int)
$row[
'obj_fi'];
setStartingTime($starting_time=NULL)
Sets the starting time in database timestamp format for the test.
initDefaultRoles()
init default roles settings
setAllowedUsers($a_allowed_users)
static _getUserIdFromActiveId($active_id)
setAnswerFeedback($answer_feedback=0)
Sets the generic feedback for the test Use setGenericAnswerFeedback instead.
setECTSFX($a_ects_fx)
Sets the ECTS FX grade.
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.
getListOfQuestionsDescription()
Returns TRUE if the list of questions should be presented with the question descriptions.
getScoreReporting()
Gets the score reporting of the ilObjTest object.
getCharSelectorDefinition()
getTimeExtensionsOfParticipants()
_getCountSystem($active_id)
Gets the count system for the calculation of points.
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.
inviteRole($role_id)
Invites all users of a role to a test.
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 getPoolQuestionChangeListener(ilDB $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()
Indicates if ECTS grades output is presented in this test.
_getTitleOutput($active_id)
Returns the value of the title_output status.
setOnline($a_online=true)
getFixedParticipants()
Returns the fixed participants status.
setShowExamIdInTestPassEnabled($show_exam_id_in_test_pass_enabled)
deliverPDFfromFO($fo, $title=null)
Delivers a PDF file from a XSL-FO string.
getReportingDate()
Gets the reporting date of the ilObjTest object.
_lookupAnonymity($a_obj_id)
Returns the anonymity status of a test with a given object id.
static _includeClass($question_type, $gui=0)
Include the php class file for a given question type.
getCustomStyle()
Get the custom style.
getResultsPresentation()
Returns the combined results presentation value.
static allObligationsAnswered($test_id, $active_id, $pass)
checks wether all questions marked as obligatory were answered within the test pass with given testId...
_lookupAuthor($obj_id)
Gets the authors name of the ilObjTest object.
logAction($logtext="", $question_id="")
Logs an action into the Test&Assessment log.
_lookupOwner($a_id)
lookup object owner
isPassDeletionAllowed()
getter for the test setting passDeletionAllowed
_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)
prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE)
Prepares a string for a text area output in tests.
setShowPassDetails($a_details=1)
Sets if the pass details should be shown when a test is not finished.
getUnfilteredEvaluationData()
& createQuestionGUI($question_type, $question_id=-1)
Creates a question GUI instance of a given question type.
isShowExamIdInTestPassEnabled()
setQuestionOrderAndObligations($orders, $obligations)
setRedirectionMode($redirection_mode=0)
processPrintoutput2FO($print_output)
Convert a print output to XSL-FO.
setQuestionSetType($questionSetType)
setter for question set type
setECTSOutput($a_ects_output)
Enables/Disables ECTS grades output for this test.
_getPassScoring($active_id)
Gets the pass scoring type.
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.
_getTestIDFromObjectID($object_id)
Returns the ILIAS test id for a given object 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.
_getImportDirectory()
Get the import directory location of the test.
$online
the object's online status
setReportingDate($reporting_date)
Sets the reporting date of the ilObjTest object.
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.
removeAllTestEditings($question_id="")
Removes all references to the question in executed tests in case the question has been changed...
& 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...
saveECTSStatus($ects_output=0, $fx_support="", $ects_a=90, $ects_b=65, $ects_c=35, $ects_d=10, $ects_e=0)
Saves the ECTS status (output of ECTS grades in a test) to the database.
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.
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.
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.
nextId($a_table_name)
Get next ID for an index.
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.
_getPass($active_id)
Retrieves the actual pass of a given user for a given test.
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.
setCharSelectorDefinition($definition='')
Class ilObject Basic functions for all objects.
getShowKioskModeParticipant()
Returns the status of the kiosk mode participant.
setHighscoreScore($a_score)
Sets if the actual score should be displayed.
insertQuestion(ilTestQuestionSetConfig $testQuestionSetConfig, $question_id, $linkOnly=false)
Insert a question in the list of questions.
fetchObject($a_set)
Fetch row as object from result set.
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 ...
getShowInfo()
Gets whether the complete information page is shown or the required data only.
_getResultPass($active_id)
Retrieves the pass number that should be counted for a given user.
& 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.
& _instanciateQuestion($question_id)
Creates an instance of a question with a given question id.
getJavaScriptOutput()
Returns if Javascript should be chosen for drag & drop actions for the active user.
const TIMINGS_DEACTIVATED
getECTSGrade($passed_array, $reached_points, $max_points)
Returns the ECTS grade for a number of reached points.
_getMCScoring($active_id)
Gets the scoring type for multiple choice questions.
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)
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.
_getWorkingTimeOfParticipantForPass($active_id, $pass)
Returns the complete working time in seconds for a test participant.
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.
getQuestionCount()
Returns the number of questions in the test.
_getQuestionTitle($question_id)
Returns the question title of a question with a given id.
setActivationLimited($a_value)
TableGUI class for evaluation of all users.
_lookupTestObjIdForQuestionId($a_q_id)
Get test Object ID for question ID.
setSpecificAnswerFeedback($specific_answer_feedback)
getShuffleQuestions()
Returns the status of the shuffle_questions variable.
$offeringQuestionHintsEnabled
setTestId($a_id)
Sets the test ID.
_getQuestionCountAndPointsForPassOfParticipant($active_id, $pass)
isShowExamIdInTestResultsEnabled()
_getSolvedQuestions($active_id, $question_fi=null)
get solved questions
_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...
_enabledAssessmentLogging()
check wether assessment logging is enabled or not
_getBestPass($active_id)
Retrieves the best pass of a given user for a given test.
canShowTestResults($testSession, $user_id)
startingTimeReached()
Returns true if the starting time of a test is reached A starting time is not available for self asse...
_cleanupMediaObjectUsage($a_text, $a_usage_type, $a_usage_id)
synchronises appearances of media objects in $a_text with media object usage table ...
questionMoveDown($question_id)
Moves a question down in order.
getOwner()
get object owner
static prepareTextareaOutput($txt_output, $prepare_for_latex_output=FALSE)
Prepares a string for a text area output where latex code may be in it If the text is HTML-free...
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.
$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
setShowKioskModeParticipant($a_participant=FALSE)
Set to true, if the participant's name should be shown in kiosk mode.
ilObject($a_id=0, $a_reference=true)
Constructor public.
& 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.
_getQuestionType($question_id)
Returns the question type of a question with a given id.
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()
Gets the sequence settings of the ilObjTest object SEQUENCE SETTING = POSTPONING ENABLED !! ...
& 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.
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.
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.
notify($a_event, $a_ref_id, $a_parent_non_rbac_id, $a_node_id, $a_params=0)
notifys an object about an event occured Based on the event happend, each object may decide how it re...
exportFileItems($a_target_dir, &$expLog)
export files of file itmes
setCustomStyle($a_customStyle=NULL)
Set the custom style.
setSignSubmission($sign_submission)
$char_selector_definition
fetchAssoc($a_set)
Fetch row as associative array from result set.
getSpecificAnswerFeedback()
getImportMapping()
get array of (two) new created questions for import id
getAnsweredQuestionCount($active_id, $pass=NULL)
Retrieves the number of answered questions for a given user in a given test.
addDefaults($a_name)
Adds the defaults of this test to the test defaults.
getCountSystem()
Gets the count system for the calculation of points.
getIntroduction()
Gets the introduction text of the ilObjTest object.
_getObjectIDFromActiveID($active_id)
Returns the ILIAS test object id for a given active id.
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.
setShowCancel($a_value=1)
Sets the cancel test button status.
getQuestiontext($question_id)
Returns the question text for a given question.
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.
setAutosaveIval($autosave_ival)
setExportSettingsSingleChoiceShort($a_settings)
getVisitTimeOfParticipant($active_id)
Returns the first and last visit of a participant.
getListOfQuestions()
Returns if the list of questions should be presented to the user or not.
QTIMaterialToString($a_material)
Reads an QTI material tag an creates a text string.
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.
_getSolutionMaxPass($question_id, $active_id)
Returns the maximum pass a users question solution.
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)
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.
setActivationVisibility($a_value)
hasQuestionsWithoutQuestionpool()
evalTotalPersons()
Returns the number of persons who started the test.
hasSingleChoiceQuestions()
Returns TRUE if the test contains single choice results.
const ILIAS_ABSOLUTE_PATH
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.
_createImportDirectory()
creates data directory for import files (data_dir/tst_data/tst_<id>/import, depending on data directo...
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 _lookupDescription($a_id)
lookup object description
_addLog($user_id, $object_id, $logtext, $question_id="", $original_id="", $test_only=FALSE, $test_ref_id=NULL)
Add an assessment log entry.
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.
xslt_process(&$proc, $xml_var, $xslt_var, $dummy, $args, $params, $a_no_warnings=false)
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)
setLimit($a_limit, $a_offset=0)
Set limit and offset for a query.
static deleteRequestsByQuestionIds($questionIds)
Deletes all hint requests relating to a question included in given question ids.
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.
& _getAvailableTests($use_object_id=FALSE)
Returns the available tests for the active user.
getShowSolutionSuggested()
_setImportDirectory($a_import_dir=null)
set import directory
exportXMLMetaData(&$a_xml_writer)
export content objects meta data to xml (see ilias_co.dtd)
setInstantFeedbackSolution($instant_feedback=0)
Sets the instant feedback for the solution.
canShowSolutionPrintview($user_id=NULL)
Calculates if a user may see the solution printview of his/her test results.
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.
lookupExamId($active_id, $pass)
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
getAnswerFeedbackPoints()
Returns 1 if answer specific feedback as reached points is activated.
setECTSGrades($a_ects_grades)
Sets the ECTS grades.
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.
userLookupFullName($user_id, $overwrite_anonymity=FALSE, $sorted_order=FALSE, $suffix="")
Returns the full name of a test user according to the anonymity status.
getAggregatedResultsData()
Returns the aggregated test results.
getQuestionTitle($title)
Returns the title of a test question and checks if the title output is allowed.
& 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.
static getPoolQuestionChangeListeners(ilDB $db, $poolObjId)
_getMaxPass($active_id)
Retrieves the maximum pass of a given user for a given test in which the user answered at least one q...
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)
_getParticipantData($active_id)
Retrieves a participant name from active id.
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.
removeTestResultsForUser($user_id)
getType()
get object type public
_getUsePreviousAnswers($active_id, $user_active_user_setting=false)
Returns if the previous results should be hidden for a learner.
getInstantFeedbackSolution()
Returns 1 if the correct solution will be shown after answering a question.
& getQuestionTypeTranslations()
_getLogLanguage()
retrieve the log language for assessment logging
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.
_getScoreCutting($active_id)
Determines if the score of a question should be cut at 0 points or the score of the whole test...
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.
setShowSolutionFeedback($a_feedback=TRUE)
Sets if the the feedback should be presented to the user in the solution or not.
$char_selector_availability
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.
static factory($a_package)
Create an XML_RPC2 client instance.
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.
setEnableProcessingTime($enable=0)
Sets the processing time enabled or disabled.
_getObjectIDFromTestID($test_id)
Returns the ILIAS test object id for a given test id.
& 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)
static _replaceMediaObjectImageSrc($a_text, $a_direction=0)
replaces image source from mob image urls with the mob id or replaces mob id with the correct image s...
setResultsPresentationOptionsByArray($options)
setEnabledViewMode($mode)
getQuestionSetType()
getter for question set type
& getECTSGrades()
Returns the ECTS grades.
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.
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data
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.
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.
static ilTempnam()
Create a temporary file in an ILIAS writable directory.
getCharSelectorAvailability()
getCustomStyles()
Return the available custom styles.
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.
_getECTSGrade($points_passed, $reached_points, $max_points, $a, $b, $c, $d, $e, $fx)
Returns the ECTS grade for a number of reached points.
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.
exportPagesXML(&$a_xml_writer, $a_inst, $a_target_dir, &$expLog)
export pages of test to xml (see ilias_co.dtd)
recalculateScores($preserve_manscoring=false)
recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
& evalTotalParticipantsArray($name_sort_order="asc")
Returns all participants who started the test.
$print_best_solution_with_result
setPrintBestSolutionWithResult($status)
getKioskMode()
Returns the kiosk mode.
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()
getECTSFX()
Returns the ECTS FX grade.
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 insertInstIntoID($a_value)
inserts installation id into ILIAS id
static buildExamId($active_id, $pass)
& getTestResult($active_id, $pass=NULL, $ordered_sequence=FALSE)
Calculates the results of a test for a given user and returns an array with all test results...
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.
& _getAvailableQuestionpools($use_object_id=FALSE, $equal_points=FALSE, $could_be_offline=FALSE, $showPath=FALSE, $with_questioncount=FALSE, $permission="read", $usr_id="")
Returns the available question pools for the active user.
static getGuiClassNameByQuestionType($questionType)
getProcessingTimeInSeconds($active_id="")
Returns the processing time for the test in seconds.
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.
A class defining mark schemas for assessment test objects.
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.
create($a_upload=false)
create test object
& getWorkedQuestions($active_id, $pass=NULL)
Gets the id's of all questions a user already worked through.
& 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.
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)
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.
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
_updateTestResultCache($active_id, ilAssQuestionProcessLocker $processLocker=null)
Move this to a proper place.
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 ...
_getActiveIdOfUser($user_id="", $test_id="")
Gets the active id of the tst_active table for the active user.
static getInstance($a_obj_id)
getDetailedTestResults($participants)
returns all test results for all participants
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
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.
isComplete(ilTestQuestionSetConfig $testQuestionSetConfig)
Returns true, if a test is complete for use and can be set online.
setActivationEndingTime($ending_time=NULL)
static getFeedbackClassNameByQuestionType($questionType)
setShowFinalStatement($show=0)
Sets whether the final statement should be shown or not.
read($a_force_db=false)
read object data from db into object
static deleteRequestsByActiveIds($activeIds)
Deletes all hint requests relating to a testactive included in given active ids.
Test certificate adapter.
setSequenceSettings($sequence_settings=0)
Sets the sequence settings of the ilObjTest object.
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 ...
_getManualScoring()
Retrieve the manual scoring settings.
static _getTestDefaults($test_defaults_id)
getHighscoreTopNum($a_retval=10)
Gets the number of entries which are to be shown in the top-rankings table.
_lookupClientIP($a_user_id)
Lookup client ip.
isError($data, $code=null)
Tell whether a value is a PEAR error.
$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...
getPassScoring()
Gets the pass scoring type.