4 require_once
'Services/Object/classes/class.ilObject.php';
5 require_once
'Modules/Test/classes/inc.AssessmentConstants.php';
6 require_once
'Modules/Test/interfaces/interface.ilMarkSchemaAware.php';
7 require_once
'Modules/Test/interfaces/interface.ilEctsGradesEnabled.php';
581 public function __construct($a_id = 0,$a_call_by_reference =
true)
586 $lng->loadLanguageModule(
"assessment");
588 include_once
"./Modules/Test/classes/class.assMarkSchema.php";
590 $this->mark_schema->createSimpleSchema(
591 $lng->txt(
"failed_short"),
592 $lng->txt(
"failed_official"),
595 $lng->txt(
"passed_short"),
596 $lng->txt(
"passed_official"),
602 $this->author = $ilUser->fullname;
603 $this->introductionEnabled =
false;
604 $this->introduction =
"";
605 $this->questions = array();
608 $this->instant_verification = 0;
609 $this->answer_feedback_points = 0;
610 $this->reporting_date =
"";
611 $this->nr_of_tries = 0;
613 $this->use_previous_answers = 1;
614 $this->title_output = 0;
615 $this->starting_time =
"";
616 $this->ending_time =
"";
617 $this->processing_time =
"";
618 $this->enable_processing_time =
"0";
619 $this->reset_processing_time = 0;
620 $this->ects_output = FALSE;
621 $this->ects_fx = NULL;
622 $this->shuffle_questions = FALSE;
623 $this->mailnottype = 0;
624 $this->exportsettings = 0;
625 $this->show_summary = 8;
630 $this->answer_feedback = 0;
631 $this->password =
"";
632 $this->certificate_visibility = 0;
633 $this->allowedUsers =
"";
634 $this->_showfinalstatement = FALSE;
635 $this->_finalstatement =
"";
636 $this->_showinfo = TRUE;
637 $this->_forcejs = TRUE;
638 $this->_customStyle =
"";
639 $this->allowedUsersTimeGap =
"";
640 $this->anonymity = 0;
641 $this->show_cancel = 0;
642 $this->show_marker = 0;
643 $this->fixed_participants = 0;
648 $this->testSession = FALSE;
649 $this->testSequence = FALSE;
650 $this->mailnotification = 0;
651 $this->poolUsage = 1;
653 $this->ects_grades = array(
661 $this->autosave = FALSE;
662 $this->autosave_ival = 30000;
664 $this->enable_examview =
false;
665 $this->show_examview_html =
false;
666 $this->show_examview_pdf =
false;
667 $this->enable_archiving =
false;
669 $this->express_mode =
false;
670 $this->template_id =
'';
671 $this->redirection_mode = 0;
672 $this->redirection_url = NULL;
673 $this->show_exam_id_in_test_pass_enabled =
false;
674 $this->show_exam_id_in_test_results_enabled =
false;
675 $this->sign_submission =
false;
676 $this->char_selector_availability = 0;
677 $this->char_selector_definition = null;
679 $this->showGradingStatusEnabled =
true;
680 $this->showGradingMarkEnabled =
true;
682 $this->instantFeedbackAnswerFixationEnabled =
false;
684 $this->testFinalBroken =
false;
686 $this->
ilObject($a_id, $a_call_by_reference);
712 if (!parent::update())
727 function read($a_force_db =
false)
743 if (!parent::delete())
764 global $tree,
$ilDB, $ilPluginAdmin;
770 $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s",
774 $active_array = array();
777 array_push($active_array,
$row[
"active_id"]);
780 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_active WHERE test_fi = %s",
785 if (count($active_array))
787 foreach ($active_array as $active_id)
789 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_times WHERE active_fi = %s",
794 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_sequence WHERE active_fi = %s",
801 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_mark WHERE test_fi = %s",
806 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_tests WHERE test_id = %s",
811 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
813 $testQuestionSetConfigFactory->getQuestionSetConfig()->removeQuestionSetRelatedData();
816 include_once
"./Services/Utilities/classes/class.ilUtil.php";
818 $directory = $tst_data_dir.
"/tst_".$this->
getId();
819 if (is_dir($directory))
821 include_once
"./Services/Utilities/classes/class.ilUtil.php";
824 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
830 foreach(
$mobs as $mob)
855 function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
895 if ($a_node_id==
$_GET[
"ref_id"])
897 $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
898 $parent_type = $parent_obj->getType();
899 if ($parent_type == $this->
getType())
901 $a_node_id = (int) $tree->getParentId($a_node_id);
905 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
915 include_once
"./Services/Utilities/classes/class.ilUtil.php";
918 if (!is_writable($tst_data_dir))
920 $this->ilias->raiseError(
"Test Data Directory (".$tst_data_dir
921 .
") not writeable.",$this->ilias->error_obj->MESSAGE);
925 $tst_dir = $tst_data_dir.
"/tst_".$this->
getId();
927 if (!@is_dir($tst_dir))
929 $this->ilias->raiseError(
"Creation of Test Directory failed.",$this->ilias->error_obj->MESSAGE);
932 $export_dir = $tst_dir.
"/export";
934 if (!@is_dir($export_dir))
936 $this->ilias->raiseError(
"Creation of Export Directory failed.",$this->ilias->error_obj->MESSAGE);
947 include_once
"./Services/Utilities/classes/class.ilUtil.php";
958 function getExportFiles($dir)
961 if(!@is_dir($dir) || !is_writeable($dir))
977 $files[] = $file->getBasename();
990 if (strlen($a_import_dir))
992 $_SESSION[
"tst_import_dir"] = $a_import_dir;
1008 if (strlen(
$_SESSION[
"tst_import_dir"]))
1028 include_once
"./Services/Utilities/classes/class.ilUtil.php";
1032 if (!is_writable($tst_data_dir))
1034 $this->ilias->raiseError(
"Test Data Directory (".$tst_data_dir
1035 .
") not writeable.",$this->ilias->error_obj->FATAL);
1039 $tst_dir = $tst_data_dir.
"/tst_import";
1041 if (!@is_dir($tst_dir))
1043 $ilias->raiseError(
"Creation of test import directory failed.",$ilias->error_obj->FATAL);
1058 $result = $ilDB->queryF(
"SELECT DISTINCT(qpl_qst_type.type_tag) foundtypes FROM qpl_questions, tst_test_result, qpl_qst_type, tst_active WHERE tst_test_result.question_fi = qpl_questions.question_id AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id AND tst_test_result.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
1065 if (strcmp(
$row[
'foundtypes'],
'assSingleChoice') == 0)
1083 $result = $ilDB->queryF(
"SELECT DISTINCT(qpl_qst_type.type_tag) foundtypes FROM qpl_questions, tst_test_result, qpl_qst_type, tst_active WHERE tst_test_result.question_fi = qpl_questions.question_id AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id AND tst_test_result.active_fi = tst_active.active_id AND tst_active.test_fi = %s",
1090 if (strcmp(
$row[
'foundtypes'],
'assSingleChoice') == 0)
1115 SELECT DISTINCT(qpl_qst_sc.shuffle) foundshuffles
1121 WHERE tst_test_result.question_fi = qpl_questions.question_id
1122 AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id
1123 AND tst_test_result.active_fi = tst_active.active_id
1124 AND qpl_questions.question_id = qpl_qst_sc.question_fi
1125 AND tst_active.test_fi = %s
1126 AND qpl_qst_type.type_tag = %s
1128 array(
'integer',
'text'),
1129 array($this->
getTestId(),
'assSingleChoice')
1134 return (
$row[
'foundshuffles'] == 0);
1147 if( !count($this->mark_schema->mark_steps) )
1168 global $tree,
$ilDB, $ilPluginAdmin;
1171 $test->loadFromDb();
1173 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
1176 return $test->isComplete( $testQuestionSetConfigFactory->getQuestionSetConfig() );
1192 if(!preg_match(
'/\d+/', $this->
getECTSFX()))
1200 SET ects_output = %s, ects_a = %s, ects_b = %s, ects_c = %s, ects_d = %s, ects_e = %s, ects_fx = %s
1201 WHERE test_id = %s",
1202 array(
'text',
'float',
'float',
'float',
'float',
'float',
'float',
'integer'),
1205 $grades[
'A'], $grades[
'B'], $grades[
'C'], $grades[
'D'], $grades[
'E'],
1222 if($this->
isComplete($testQuestionSetConfig))
1229 "UPDATE tst_tests SET complete = %s WHERE test_id = %s",
1230 array(
'text',
'integer'),
1231 array($complete, $this->test_id)
1256 include_once(
"./Services/RTE/classes/class.ilRTE.php");
1257 $completecontent =
"";
1260 $completecontent .= $content;
1273 global $tree,
$ilDB, $ilPluginAdmin;
1280 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
1282 $testQuestionSetConfig = $testQuestionSetConfigFactory->getQuestionSetConfig();
1284 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1285 if ($this->test_id == -1)
1288 $next_id = $ilDB->nextId(
'tst_tests');
1290 $ilDB->insert(
'tst_tests', array(
1291 'test_id' => array(
'integer', $next_id),
1292 'obj_fi' => array(
'integer', $this->
getId()),
1293 'author' => array(
'text', $this->
getAuthor()),
1297 'showinfo' => array(
'integer', $this->
getShowInfo()),
1298 'forcejs' => array(
'integer', $this->
getForceJS()),
1310 'nr_of_tries' => array(
'integer', $this->
getNrOfTries()),
1311 'kiosk' => array(
'integer', $this->
getKiosk()),
1322 'complete' => array(
'text', $this->
isComplete($testQuestionSetConfig)),
1324 'ects_a' => array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : NULL),
1325 'ects_b' => array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : NULL),
1326 'ects_c' => array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : NULL),
1327 'ects_d' => array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : NULL),
1328 'ects_e' => array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : NULL),
1329 'ects_fx' => array(
'float', $this->
getECTSFX()),
1338 'password' => array(
'text', $this->
getPassword()),
1346 'created' => array(
'integer', time()),
1347 'tstamp' => array(
'integer', time()),
1349 'template_id' => array(
'integer', $this->
getTemplate()),
1350 'pool_usage' => array(
'integer', $this->
getPoolUsage()),
1364 'online_status' => array(
'integer', (
int)$this->
isOnline()),
1366 'autosave' => array(
'integer', (
int)$this->
getAutosave()),
1389 $this->test_id = $next_id;
1402 $result = $ilDB->queryF(
"SELECT * FROM tst_tests WHERE test_id = %s",
1404 array($this->test_id)
1408 $oldrow = $ilDB->fetchAssoc(
$result);
1412 $ilDB->update(
'tst_tests',
1414 'author' => array(
'text', $this->
getAuthor()),
1418 'showinfo' => array(
'integer', $this->
getShowInfo()),
1419 'forcejs' => array(
'integer', $this->
getForceJS()),
1431 'nr_of_tries' => array(
'integer', $this->
getNrOfTries()),
1432 'kiosk' => array(
'integer', $this->
getKiosk()),
1443 'complete' => array(
'text', $this->
isComplete($testQuestionSetConfig)),
1445 'ects_a' => array(
'float', strlen($this->ects_grades[
"A"]) ? $this->ects_grades[
"A"] : NULL),
1446 'ects_b' => array(
'float', strlen($this->ects_grades[
"B"]) ? $this->ects_grades[
"B"] : NULL),
1447 'ects_c' => array(
'float', strlen($this->ects_grades[
"C"]) ? $this->ects_grades[
"C"] : NULL),
1448 'ects_d' => array(
'float', strlen($this->ects_grades[
"D"]) ? $this->ects_grades[
"D"] : NULL),
1449 'ects_e' => array(
'float', strlen($this->ects_grades[
"E"]) ? $this->ects_grades[
"E"] : NULL),
1450 'ects_fx' => array(
'float', $this->
getECTSFX()),
1459 'password' => array(
'text', $this->
getPassword()),
1467 'tstamp' => array(
'integer', time()),
1469 'template_id' => array(
'integer', $this->
getTemplate()),
1470 'pool_usage' => array(
'integer', $this->
getPoolUsage()),
1484 'online_status' => array(
'integer', (
int)$this->
isOnline()),
1486 'autosave' => array(
'integer', (
int)$this->
getAutosave()),
1509 'test_id' => array(
'integer', (
int)$this->
getTestId())
1513 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1516 $logresult = $ilDB->queryF(
"SELECT * FROM tst_tests WHERE test_id = %s",
1521 if ($logresult->numRows() == 1)
1523 $newrow = $ilDB->fetchAssoc($logresult);
1525 $changed_fields = array();
1526 foreach ($oldrow as $key => $value)
1528 if (strcmp($oldrow[$key], $newrow[$key]) != 0)
1530 array_push($changed_fields,
"$key: " . $oldrow[$key] .
" => " . $newrow[$key]);
1533 $changes = join($changed_fields,
", ");
1534 if (count($changed_fields) > 0)
1545 $aresult = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s AND tries >= %s AND submitted = %s",
1546 array(
'integer',
'integer',
'integer'),
1549 while (
$row = $ilDB->fetchAssoc($aresult))
1551 $ilDB->manipulateF(
"UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
1552 array(
'integer',
'timestamp',
'integer'),
1553 array(1, date(
'Y-m-d H:i:s'),
$row[
"active_id"])
1558 $aresult = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s AND tries < %s AND submitted = %s",
1559 array(
'integer',
'integer',
'integer'),
1562 while (
$row = $ilDB->fetchAssoc($aresult))
1564 $ilDB->manipulateF(
"UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
1565 array(
'integer',
'timestamp',
'integer'),
1566 array(0, NULL,
$row[
"active_id"])
1573 $aresult = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s AND submitted = %s",
1574 array(
'integer',
'integer'),
1577 while (
$row = $ilDB->fetchAssoc($aresult))
1579 $ilDB->manipulateF(
"UPDATE tst_active SET submitted = %s, submittimestamp = %s WHERE active_id = %s",
1580 array(
'integer',
'timestamp',
'integer'),
1581 array(0, NULL,
$row[
"active_id"])
1591 include_once
"./Services/Object/classes/class.ilObjectActivation.php";
1607 $item->update($this->ref_id);
1610 if (!$properties_only)
1615 $ilias->raiseError(
$result->getMessage());
1623 $this->mark_schema->saveToDb($this->test_id);
1638 $oldquestions = array();
1639 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
1642 $result = $ilDB->queryF(
"SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
1650 array_push($oldquestions,
$row[
"question_fi"]);
1656 $currentQuestionsObligationsQuery =
'SELECT question_fi, obligatory FROM tst_test_question WHERE test_fi = %s';
1657 $rset = $ilDB->queryF($currentQuestionsObligationsQuery, array(
'integer'), array($this->
getTestId()));
1658 while (
$row = $ilDB->fetchAssoc($rset)) {
1659 $obligatoryQuestionState[
$row[
'question_fi']] = $row[
'obligatory'];
1662 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_test_question WHERE test_fi = %s",
1667 foreach ($this->questions as $key => $value)
1670 if( !isset($obligatoryQuestionState[$value]) || is_null($obligatoryQuestionState[$value]) )
1672 $obligatoryQuestionState[$value] = 0;
1676 $next_id = $ilDB->nextId(
'tst_test_question');
1677 $ilDB->insert(
'tst_test_question', array(
1678 'test_question_id' => array(
'integer', $next_id),
1679 'test_fi' => array(
'integer', $this->
getTestId()),
1680 'question_fi' => array(
'integer', $value),
1681 'sequence' => array(
'integer', $key),
1682 'obligatory' => array(
'integer', $obligatoryQuestionState[$value]),
1683 'tstamp' => array(
'integer', time())
1686 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
1689 $result = $ilDB->queryF(
"SELECT question_fi FROM tst_test_question WHERE test_fi = %s ORDER BY sequence",
1693 $newquestions = array();
1698 array_push($newquestions,
$row[
"question_fi"]);
1701 foreach ($oldquestions as $index => $question_id)
1703 if (strcmp($newquestions[$index], $question_id) != 0)
1705 $pos = array_search($question_id, $newquestions);
1716 foreach ($newquestions as $index => $question_id)
1718 if (array_search($question_id, $oldquestions) === FALSE)
1734 $result = $ilDB->queryF(
'SELECT copy_id FROM tst_rnd_cpy WHERE tst_fi = %s',
1738 return $result->numRows() > 0;
1762 $result = $ilDB->queryF(
"SELECT qpl_questions.original_id FROM qpl_questions, tst_test_question WHERE qpl_questions.question_id = tst_test_question.question_fi AND qpl_questions.tstamp > 0 AND tst_test_question.test_fi = %s",
1766 $original_ids = array();
1767 $paramtypes = array();
1768 $paramvalues = array();
1771 array_push($original_ids,
$row[
'original_id']);
1776 if (($questionpool == 0) && (!is_array($qpls)))
1778 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
1780 if (count($available_pools))
1782 $available =
" AND " . $ilDB->in(
'obj_fi', $available_pools,
false,
'integer');
1790 $constraint_qpls =
"";
1791 $result_array = array();
1792 if ($questionpool == 0)
1794 if (is_array($qpls))
1796 if (count($qpls) > 0)
1798 $constraint_qpls =
" AND " . $ilDB->in(
'obj_fi', $qpls,
false,
'integer');
1803 $original_clause =
"";
1804 if (count($original_ids))
1806 $original_clause =
" AND " . $ilDB->in(
'question_id', $original_ids,
true,
'integer');
1809 if ($questionpool == 0)
1811 $result = $ilDB->queryF(
"SELECT question_id FROM qpl_questions WHERE original_id IS NULL $available $constraint_qpls AND owner > %s AND complete = %s $original_clause",
1812 array(
'integer',
'text'),
1818 $result = $ilDB->queryF(
"SELECT question_id FROM qpl_questions WHERE original_id IS NULL AND obj_fi = %s AND owner > %s AND complete = %s $original_clause",
1819 array(
'integer',
'integer',
'text'),
1820 array($questionpool, 0,
"1")
1823 $found_ids = array();
1826 array_push($found_ids,
$row[
'question_id']);
1828 $nr_of_questions = ($nr_of_questions > count($found_ids)) ? count($found_ids) : $nr_of_questions;
1829 if ($nr_of_questions == 0)
return array();
1830 $rand_keys = array_rand($found_ids, $nr_of_questions);
1832 if (is_array($rand_keys))
1834 foreach ($rand_keys as $key)
1836 $result[$found_ids[$key]] = $found_ids[$key];
1841 $result[$found_ids[$rand_keys]] = $found_ids[$rand_keys];
1857 $result = $ilDB->queryF(
"SELECT test_result_id FROM tst_test_result WHERE active_fi = %s AND pass = %s",
1858 array(
'integer',
'integer'),
1859 array($active_id,
$pass)
1877 $result = $ilDB->queryF(
"SELECT test_random_question_id FROM tst_test_rnd_qst WHERE active_fi = %s AND pass = %s",
1878 array(
'integer',
'integer'),
1879 array($active_id,
$pass)
1881 return (
$result->numRows() > 0) ?
true :
false;
1891 $result = $ilDB->queryF(
"SELECT * FROM tst_tests WHERE obj_fi = %s",
1893 array($this->
getId())
1897 $data = $ilDB->fetchObject(
$result);
1904 include_once(
"./Services/RTE/classes/class.ilRTE.php");
1941 "A" => $data->ects_a,
1942 "B" => $data->ects_b,
1943 "C" => $data->ects_c,
1944 "D" => $data->ects_d,
1945 "E" => $data->ects_e
1949 $this->mark_schema->flush();
1950 $this->mark_schema->loadFromDb($this->
getTestId());
1980 $this->
setOnline((
bool) $data->online_status);
1996 $this->
setResultFilterTaxIds(strlen($data->result_tax_filters) ? unserialize($data->result_tax_filters) : array());
2007 include_once
"./Services/Object/classes/class.ilObjectActivation.php";
2009 switch($activation[
"timing_type"])
2036 $this->questions = array();
2037 if (strcmp($active_id,
"") == 0)
2047 $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.* FROM tst_test_rnd_qst, qpl_questions WHERE tst_test_rnd_qst.active_fi = %s AND qpl_questions.question_id = tst_test_rnd_qst.question_fi AND tst_test_rnd_qst.pass = %s ORDER BY sequence",
2048 array(
'integer',
'integer'),
2049 array($active_id,
$pass)
2057 $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.* FROM tst_test_rnd_qst, qpl_questions WHERE tst_test_rnd_qst.active_fi = %s AND qpl_questions.question_id = tst_test_rnd_qst.question_fi AND tst_test_rnd_qst.pass = 0 ORDER BY sequence",
2065 $result = $ilDB->queryF(
"SELECT tst_test_question.* FROM tst_test_question, qpl_questions WHERE tst_test_question.test_fi = %s AND qpl_questions.question_id = tst_test_question.question_fi ORDER BY sequence",
2067 array($this->test_id)
2071 while ($data = $ilDB->fetchAssoc(
$result))
2073 $this->questions[$index++] = $data[
"question_fi"];
2101 return (strlen($this->introduction)) ? $this->introduction : NULL;
2126 $this->_finalstatement = $a_statement;
2138 $this->_showinfo = ($a_info) ? 1 : 0;
2150 $this->_forcejs = ($a_js) ? 1 : 0;
2162 $this->_customStyle = $a_customStyle;
2174 return (strlen($this->_customStyle)) ? $this->_customStyle : NULL;
2187 $css_path = str_replace(
"ta.css",
"customstyles", $css_path) .
"/";
2188 $customstyles = array();
2189 if (is_dir($css_path))
2192 include_once
"./Services/Utilities/classes/class.ilFileUtils.php";
2198 if (strpos($filename,
".css"))
2200 array_push($customstyles, $filename);
2205 return $customstyles;
2220 $custom = str_replace(
"ta.css",
"customstyles/" . $this->
getCustomStyle(), $default);
2221 if (file_exists($custom))
2224 $custom = str_replace(
"ta.css",
"customstyles/" . $this->
getCustomStyle(), $custom);
2247 $this->_showfinalstatement = ($show) ? 1 : 0;
2258 return (strlen($this->_finalstatement)) ? $this->_finalstatement : NULL;
2270 return ($this->_showinfo) ? 1 : 0;
2282 return ($this->_forcejs) ? 1 : 0;
2294 return ($this->_showfinalstatement) ? 1 : 0;
2314 return ($this->ects_output) ? 1 : 0;
2322 $this->ects_output = $a_ects_output ? 1 : 0;
2330 return (strlen($this->ects_fx)) ? $this->ects_fx : NULL;
2338 $this->ects_fx = $a_ects_fx;
2354 $this->ects_grades = $a_ects_grades;
2364 return ($this->sequence_settings) ? $this->sequence_settings : 0;
2414 switch ($instant_feedback)
2417 $this->instant_verification = 1;
2420 $this->instant_verification = 0;
2437 $this->answer_feedback = 1;
2440 $this->answer_feedback = 0;
2453 switch ($generic_answer_feedback)
2456 $this->answer_feedback = 1;
2459 $this->answer_feedback = 0;
2476 $this->answer_feedback_points = 1;
2479 $this->answer_feedback_points = 0;
2492 $this->reporting_date =
'';
2515 return ($this->score_reporting) ? $this->score_reporting : 0;
2532 return ($this->instant_verification) ? $this->instant_verification : 0;
2545 return ($this->answer_feedback) ? $this->answer_feedback : 0;
2558 return ($this->answer_feedback) ? $this->answer_feedback : 0;
2570 return ($this->answer_feedback_points) ? $this->answer_feedback_points : 0;
2582 return ($this->count_system) ? $this->count_system : 0;
2595 $result = $ilDB->queryF(
"SELECT tst_tests.count_system FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_active.test_fi = tst_tests.test_id",
2602 return $row[
"count_system"];
2616 return ($this->mc_scoring) ? $this->mc_scoring : 0;
2628 return ($this->score_cutting) ? $this->score_cutting : 0;
2640 return ($this->pass_scoring) ? $this->pass_scoring : 0;
2653 $result = $ilDB->queryF(
"SELECT tst_tests.pass_scoring FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
2660 return $row[
"pass_scoring"];
2675 $result = $ilDB->queryF(
"SELECT tst_tests.mc_scoring FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_active.test_fi = tst_tests.test_id",
2682 return $row[
"mc_scoring"];
2697 $result = $ilDB->queryF(
"SELECT tst_tests.score_cutting FROM tst_tests, tst_active WHERE tst_active.active_id = %s AND tst_tests.test_id = tst_active.test_fi",
2704 return $row[
"score_cutting"];
2718 return (strlen($this->reporting_date)) ? $this->reporting_date : NULL;
2730 return ($this->nr_of_tries) ? $this->nr_of_tries : 0;
2742 return ($this->_kiosk) ? $this->_kiosk : 0;
2755 $this->_kiosk = $kiosk;
2767 if (($this->_kiosk & 1) > 0)
2788 $this->_kiosk = $this->_kiosk | 1;
2794 $this->_kiosk = $this->_kiosk ^ 1;
2808 if (($this->_kiosk & 2) > 0)
2828 $this->_kiosk = $this->_kiosk | 2;
2834 $this->_kiosk = $this->_kiosk ^ 2;
2848 if (($this->_kiosk & 4) > 0)
2868 $this->_kiosk = $this->_kiosk | 4;
2874 $this->_kiosk = $this->_kiosk ^ 4;
2888 return ($this->use_previous_answers) ? $this->use_previous_answers : 0;
2900 return ($this->title_output) ? $this->title_output : 0;
2915 $result = $ilDB->queryF(
"SELECT tst_tests.title_output FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
2922 return $row[
"title_output"];
2943 $result = $ilDB->queryF(
"SELECT tst_tests.use_previous_answers FROM tst_tests, tst_active WHERE tst_tests.test_id = tst_active.test_fi AND tst_active.active_id = %s",
2955 if ($user_active_user_setting)
2957 $res = $ilUser->getPref(
"tst_use_previous_answers");
2976 return (strlen($this->processing_time)) ? $this->processing_time : NULL;
2987 if (strlen($this->processing_time))
2989 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches))
2991 if ((
int)$matches[1]+(
int)$matches[2]+(
int)$matches[3] == 0)
2998 'hh' => $matches[1],
2999 'mm' => $matches[2],
3000 'ss' => $matches[3],
3010 if (strlen($this->processing_time))
3012 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/is", $this->processing_time, $matches))
3014 return ($matches[1] * 60) + $matches[2];
3030 if (preg_match(
"/(\d{2}):(\d{2}):(\d{2})/", $this->
getProcessingTime(), $matches))
3033 return ($matches[1] * 3600) + ($matches[2] * 60) + $matches[3] + $extratime;
3050 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getEndingTime(), $matches))
3052 $ending = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
3054 return $ending - $now;
3071 return ($this->enable_processing_time) ? $this->enable_processing_time : 0;
3083 return ($this->reset_processing_time) ? $this->reset_processing_time : 0;
3111 return (strlen($this->starting_time)) ? $this->starting_time : NULL;
3151 return (strlen($this->ending_time)) ? $this->ending_time : NULL;
3189 $this->use_previous_answers = 1;
3193 $this->use_previous_answers = 0;
3226 $this->title_output = 1;
3229 $this->title_output = 2;
3232 $this->title_output = 0;
3251 $this->processing_time = sprintf(
"%02d:%02d:00", floor($minutes/60), $minutes%60);
3264 $this->enable_processing_time =
"1";
3266 $this->enable_processing_time =
"0";
3281 $this->reset_processing_time = 1;
3285 $this->reset_processing_time = 0;
3298 $this->count_system = $a_count_system;
3326 return (strlen($this->password)) ? $this->password : NULL;
3338 $this->password = $a_password;
3350 $this->score_cutting = $a_score_cutting;
3362 $this->mc_scoring = $a_mc_scoring;
3374 switch ($a_pass_scoring)
3395 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3400 $question->delete($question_id);
3420 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_solutions WHERE tst_solutions.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s) AND tst_solutions.question_fi = %s",
3421 array(
'integer',
'integer'),
3424 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_qst_solved WHERE tst_qst_solved.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s) AND tst_qst_solved.question_fi = %s",
3425 array(
'integer',
'integer'),
3428 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_test_result WHERE tst_test_result.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s) AND tst_test_result.question_fi = %s",
3429 array(
'integer',
'integer'),
3432 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_pass_result WHERE tst_pass_result.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s)",
3437 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
3442 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_solutions WHERE tst_solutions.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s)",
3446 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_qst_solved WHERE tst_qst_solved.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s)",
3450 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_test_result WHERE tst_test_result.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s)",
3454 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_pass_result WHERE tst_pass_result.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s)",
3459 $query =
"SELECT active_id FROM tst_active WHERE test_fi = %s";
3461 $activeIds = array();
3462 while(
$row = $ilDB->fetchAssoc(
$res) )
3464 $activeIds[] =
$row[
'active_id'];
3467 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
3470 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3477 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_sequence WHERE tst_sequence.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s)",
3484 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_test_rnd_qst WHERE tst_test_rnd_qst.active_fi IN (SELECT active_id FROM tst_active WHERE test_fi = %s)",
3491 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_active WHERE test_fi = %s",
3497 $affectedRows = $ilDB->manipulateF(
"DELETE FROM usr_pref WHERE keyword = %s",
3499 array(
"tst_password_".$this->
getTestId())
3504 if (@is_dir(CLIENT_WEB_DIR .
"/assessment/tst_" . $this->
getTestId()))
3520 require_once
'Services/Object/classes/class.ilObjectLP.php';
3522 $testLP->resetLPDataForUserIds($participantData->
getUserIds(),
false);
3535 require_once
'Modules/Test/classes/class.ilTestParticipantData.php';
3537 $participantData->setUserIds($userIds);
3538 $participantData->load($this->
getTestId());
3540 $IN_userIds = $ilDB->in(
'usr_id', $participantData->getUserIds(),
false,
'integer');
3541 $ilDB->manipulateF(
"DELETE FROM usr_pref WHERE $IN_userIds AND keyword = %s",
3542 array(
'text'), array(
"tst_password_".$this->
getTestId())
3545 if( count($participantData->getActiveIds()) )
3555 $IN_activeIds = $ilDB->in(
'active_fi', $activeIds,
false,
'integer');
3557 $ilDB->manipulate(
"DELETE FROM tst_solutions WHERE $IN_activeIds");
3558 $ilDB->manipulate(
"DELETE FROM tst_qst_solved WHERE $IN_activeIds");
3559 $ilDB->manipulate(
"DELETE FROM tst_test_result WHERE $IN_activeIds");
3560 $ilDB->manipulate(
"DELETE FROM tst_pass_result WHERE $IN_activeIds");
3561 $ilDB->manipulate(
"DELETE FROM tst_result_cache WHERE $IN_activeIds");
3562 $ilDB->manipulate(
"DELETE FROM tst_sequence WHERE $IN_activeIds");
3566 $ilDB->manipulate(
"DELETE FROM tst_test_rnd_qst WHERE $IN_activeIds");
3570 $ilDB->manipulate(
"DELETE FROM tst_seq_qst_tracking WHERE $IN_activeIds");
3571 $ilDB->manipulate(
"DELETE FROM tst_seq_qst_answstatus WHERE $IN_activeIds");
3572 $ilDB->manipulate(
"DELETE FROM tst_seq_qst_postponed WHERE $IN_activeIds");
3573 $ilDB->manipulate(
"DELETE FROM tst_seq_qst_checked WHERE $IN_activeIds");
3576 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3578 foreach ($activeIds as $active_id)
3582 if (@is_dir(CLIENT_WEB_DIR .
"/assessment/tst_" . $this->
getTestId() .
"/$active_id"))
3593 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
3601 $IN_activeIds = $ilDB->in(
'active_id', $activeIds,
false,
'integer');
3602 $ilDB->manipulate(
"DELETE FROM tst_active WHERE $IN_activeIds");
3612 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_solutions WHERE active_fi = %s",
3616 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_qst_solved WHERE active_fi = %s",
3620 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_test_result WHERE active_fi = %s",
3624 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_pass_result WHERE active_fi = %s",
3631 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_test_rnd_qst WHERE active_fi = %s",
3637 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3643 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_sequence WHERE active_fi = %s",
3649 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_active WHERE active_id = %s",
3657 $affectedRows = $ilDB->manipulateF(
"DELETE FROM usr_pref WHERE usr_id = %s AND keyword = %s",
3658 array(
'integer',
'text'),
3659 array($user_id,
"tst_password_".$this->
getTestId())
3665 if (@is_dir(CLIENT_WEB_DIR .
"/assessment/tst_" . $this->
getTestId() .
"/$active_id"))
3670 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionHintTracking.php';
3686 $result = $ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
3687 array(
'integer',
'integer'),
3690 $data = $ilDB->fetchObject(
$result);
3691 if ($data->sequence > 1)
3694 $result = $ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
3695 array(
'integer',
'integer'),
3696 array($this->
getTestId(), $data->sequence - 1)
3698 $data_previous = $ilDB->fetchObject(
$result);
3700 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
3701 array(
'integer',
'integer'),
3702 array($data->sequence, $data_previous->test_question_id)
3705 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
3706 array(
'integer',
'integer'),
3707 array($data->sequence - 1, $data->test_question_id)
3709 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3730 $result = $ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND question_fi=%s",
3731 array(
'integer',
'integer'),
3734 $data = $ilDB->fetchObject(
$result);
3735 $result = $ilDB->queryF(
"SELECT * FROM tst_test_question WHERE test_fi=%s AND sequence=%s",
3736 array(
'integer',
'integer'),
3737 array($this->
getTestId(), $data->sequence + 1)
3742 $data_next = $ilDB->fetchObject(
$result);
3744 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
3745 array(
'integer',
'integer'),
3746 array($data->sequence, $data_next->test_question_id)
3749 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_test_question SET sequence=%s WHERE test_question_id=%s",
3750 array(
'integer',
'integer'),
3751 array($data->sequence + 1, $data->test_question_id)
3753 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3773 $duplicate_id = $question->duplicate(
true, null, null, null, $this->
getId());
3775 return $duplicate_id;
3789 #var_dump($question_id);
3792 $duplicate_id = $question_id;
3800 $result = $ilDB->queryF(
"SELECT MAX(sequence) seq FROM tst_test_question WHERE test_fi=%s",
3808 $data = $ilDB->fetchObject(
$result);
3809 $sequence = $data->seq + 1;
3812 $next_id = $ilDB->nextId(
'tst_test_question');
3813 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_test_question (test_question_id, test_fi, question_fi, sequence, tstamp) VALUES (%s, %s, %s, %s, %s)",
3814 array(
'integer',
'integer',
'integer',
'integer',
'integer'),
3815 array($next_id, $this->
getTestId(), $duplicate_id, $sequence, time())
3817 if ($affectedRows == 1)
3819 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
3826 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_active WHERE test_fi = %s",
3832 return $duplicate_id;
3848 $result = $ilDB->queryF(
"SELECT qpl_questions.title FROM tst_test_question, qpl_questions WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id ORDER BY tst_test_question.sequence",
3854 array_push($titles,
$row[
"title"]);
3873 $result = $ilDB->queryF(
"SELECT qpl_questions.title, qpl_questions.question_id FROM tst_test_question, qpl_questions WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id ORDER BY tst_test_question.sequence",
3879 $titles[
$row[
'question_id']] = $row[
"title"];
3897 return $this->lng->txt(
"ass_question");
3917 $result = $ilDB->queryF(
"SELECT qpl_questions.*, qpl_qst_type.type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
3936 $existing_questions = array();
3941 $result = $ilDB->queryF(
"SELECT qpl_questions.original_id FROM qpl_questions, tst_test_rnd_qst WHERE tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.question_fi = qpl_questions.question_id AND tst_test_rnd_qst.pass = %s",
3942 array(
'integer',
'integer'),
3943 array($active_id,
$pass)
3948 $result = $ilDB->queryF(
"SELECT qpl_questions.original_id FROM qpl_questions, tst_test_question WHERE tst_test_question.test_fi = %s AND tst_test_question.question_fi = qpl_questions.question_id",
3953 while ($data = $ilDB->fetchObject(
$result))
3955 if( $data->original_id === null )
3960 array_push($existing_questions, $data->original_id);
3962 return $existing_questions;
3976 if ($question_id < 1)
return -1;
3977 $result = $ilDB->queryF(
"SELECT type_tag FROM qpl_questions, qpl_qst_type WHERE qpl_questions.question_id = %s AND qpl_questions.question_type_fi = qpl_qst_type.question_type_id",
3983 $data = $ilDB->fetchObject(
$result);
3984 return $data->type_tag;
4002 $next_id = $ilDB->nextId(
'tst_times');
4003 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_times (times_id, active_fi, started, finished, pass, tstamp) VALUES (%s, %s, %s, %s, %s, %s)",
4004 array(
'integer',
'integer',
'timestamp',
'timestamp',
'integer',
'integer'),
4005 array($next_id, $active_id, strftime(
"%Y-%m-%d %H:%M:%S"), strftime(
"%Y-%m-%d %H:%M:%S"),
$pass, time())
4020 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_times SET finished = %s, tstamp = %s WHERE times_id = %s",
4021 array(
'timestamp',
'integer',
'integer'),
4022 array(strftime(
"%Y-%m-%d %H:%M:%S"), time(), $times_id)
4039 $result = $ilDB->queryF(
"SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
4040 array(
'integer',
'integer'),
4041 array($active_id, 0)
4046 $result = $ilDB->queryF(
"SELECT question_fi FROM tst_solutions WHERE active_fi = %s AND pass = %s GROUP BY question_fi",
4047 array(
'integer',
'integer'),
4048 array($active_id,
$pass)
4051 $result_array = array();
4054 array_push($result_array,
$row[
"question_fi"]);
4056 return $result_array;
4070 return ((($currentpass > 0) && ($num == 0)) || $this->
isTestFinished($active_id)) ?
true :
false;
4084 $result_array = array();
4089 if (count($this->questions) == 0)
return $result_array;
4094 $result = $ilDB->queryF(
"SELECT qpl_questions.* FROM qpl_questions, tst_test_rnd_qst WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id AND tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.pass = %s AND " . $ilDB->in(
'qpl_questions.question_id', $this->questions,
false,
'integer'),
4095 array(
'integer',
'integer'),
4096 array($active_id,
$pass)
4101 if (count($this->questions) == 0)
return $result_array;
4102 $result = $ilDB->query(
"SELECT qpl_questions.* FROM qpl_questions, tst_test_question WHERE tst_test_question.question_fi = qpl_questions.question_id AND " . $ilDB->in(
'qpl_questions.question_id', $this->questions,
false,
'integer'));
4106 $result_array[
$row[
"question_id"]] =
$row;
4108 return $result_array;
4124 if (!$user_id) $user_id = $ilUser->getId();
4127 $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
4128 array(
'integer',
'integer',
'text'),
4132 else if (strlen($anonymous_id))
4134 $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s AND anonymous_id = %s",
4135 array(
'integer',
'integer',
'text'),
4136 array($user_id, $this->test_id, $anonymous_id)
4141 if (
$_SESSION[
"AccountId"] == ANONYMOUS_USER_ID)
4145 $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
4146 array(
'integer',
'integer'),
4147 array($user_id, $this->test_id)
4153 return $row[
"active_id"];
4175 $user_id = $ilUser->id;
4181 $result = $ilDB->queryF(
"SELECT tst_active.active_id FROM tst_active WHERE user_fi = %s AND test_fi = %s",
4182 array(
'integer',
'integer'),
4188 return $row[
"active_id"];
4204 $keys = array_keys($array);
4207 foreach ($keys as $key)
4223 global $tree,
$ilDB,
$lng, $ilPluginAdmin;
4227 if( is_null(
$pass) )
4232 require_once
'Modules/Test/classes/class.ilTestSessionFactory.php';
4234 $testSession = $testSessionFactory->getSession($active_id);
4236 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
4242 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
4244 $dynamicQuestionSetConfig->loadFromDb();
4256 if( $ordered_sequence )
4266 $arrResults = array();
4269 SELECT tst_test_result.question_fi,
4270 tst_test_result.points reached,
4271 tst_test_result.hint_count requested_hints,
4272 tst_test_result.hint_points hint_points,
4273 tst_test_result.answered answered
4275 FROM tst_test_result
4277 LEFT JOIN tst_solutions
4278 ON tst_solutions.active_fi = tst_test_result.active_fi
4279 AND tst_solutions.question_fi = tst_test_result.question_fi
4281 WHERE tst_test_result.active_fi = %s
4282 AND tst_test_result.pass = %s
4285 $solutionresult = $ilDB->queryF(
4286 $query, array(
'integer',
'integer'), array($active_id,
$pass)
4289 while(
$row = $ilDB->fetchAssoc($solutionresult) )
4291 $arrResults[
$row[
'question_fi'] ] =
$row;
4294 $numWorkedThrough = count($arrResults);
4296 require_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
4298 $IN_question_ids = $ilDB->in(
'qpl_questions.question_id', $sequence,
false,
'integer');
4301 SELECT qpl_questions.*,
4302 qpl_qst_type.type_tag,
4303 qpl_sol_sug.question_fi has_sug_sol
4308 LEFT JOIN qpl_sol_sug
4309 ON qpl_sol_sug.question_fi = qpl_questions.question_id
4311 WHERE qpl_qst_type.question_type_id = qpl_questions.question_type_fi
4312 AND $IN_question_ids
4317 $unordered = array();
4321 $obligationsAnswered =
true;
4326 $row[
'points'] ? $arrResults[
$row[
'question_id'] ][
'reached'] /
$row[
'points'] : 0
4329 if( $percentvalue < 0 ) $percentvalue = 0.0;
4334 "max" => round(
$row[
'points'], 2),
4335 "reached" => round($arrResults[
$row[
'question_id']][
'reached'],2),
4336 'requested_hints' => $arrResults[$row[
'question_id']][
'requested_hints'],
4337 'hint_points' => $arrResults[$row[
'question_id']][
'hint_points'],
4338 "percent" => sprintf(
"%2.2f ", ($percentvalue) * 100) .
"%",
4340 "type" => $row[
"type_tag"],
4341 "qid" => $row[
'question_id'],
4342 "original_id" => $row[
"original_id"],
4343 "workedthrough" => isset($arrResults[$row[
'question_id']]) ? 1 : 0,
4344 'answered' => $arrResults[$row[
'question_id']][
'answered']
4347 if( !$arrResults[ $row[
'question_id'] ][
'answered'] )
4349 $obligationsAnswered =
false;
4352 $unordered[ $row[
'question_id'] ] = $data;
4359 $pass_requested_hints = 0;
4360 $pass_hint_points = 0;
4365 foreach( $sequence as $qid )
4369 $pass_max += round($unordered[$qid][
'max'], 2);
4370 $pass_reached += round($unordered[$qid][
'reached'], 2);
4371 $pass_requested_hints += $unordered[$qid][
'requested_hints'];
4372 $pass_hint_points += $unordered[$qid][
'hint_points'];
4376 $unordered[$qid][
'nr'] = $key;
4377 array_push($found, $unordered[$qid]);
4387 if(
$results[
'reached_points'] < 0 )
4392 if( $pass_reached < 0 ) $pass_reached = 0;
4395 $found[
'pass'][
'total_max_points'] = $pass_max;
4396 $found[
'pass'][
'total_reached_points'] = $pass_reached;
4397 $found[
'pass'][
'total_requested_hints'] = $pass_requested_hints;
4398 $found[
'pass'][
'total_hint_points'] = $pass_hint_points;
4399 $found[
'pass'][
'percent'] = ($pass_max > 0) ? $pass_reached / $pass_max : 0;
4400 $found[
'pass'][
'obligationsAnswered'] = $obligationsAnswered;
4401 $found[
'pass'][
'num_workedthrough'] = $numWorkedThrough;
4403 $found[
"test"][
"total_max_points"] =
$results[
'max_points'];
4404 $found[
"test"][
"total_reached_points"] =
$results[
'reached_points'];
4405 $found[
"test"][
"total_requested_hints"] =
$results[
'hint_count'];
4406 $found[
"test"][
"total_hint_points"] =
$results[
'hint_points'];
4407 $found[
"test"][
"result_pass"] =
$results[
'pass'];
4408 $found[
'test'][
'obligations_answered'] =
$results[
'obligations_answered'];
4410 if( (!$total_reached_points) or (!$total_max_points) )
4416 $percentage = ($total_reached_points / $total_max_points) * 100.0;
4418 if( $percentage < 0 ) $percentage = 0.0;
4421 $found[
"test"][
"passed"] =
$results[
'passed'];
4436 $result = $ilDB->queryF(
"SELECT COUNT(active_id) total FROM tst_active WHERE test_fi = %s",
4441 return $row[
"total"];
4454 $result = $ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi AND tst_active.user_fi = %s",
4455 array(
'integer',
'integer'),
4461 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4462 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4463 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4464 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4465 $time += ($epoch_2 - $epoch_1);
4492 $result = $ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi ORDER BY tst_times.active_fi, tst_times.started",
4500 if (!array_key_exists(
$row[
"active_fi"], $times))
4502 $times[
$row[
"active_fi"]] = 0;
4504 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4505 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4506 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4507 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4508 $times[
$row[
"active_fi"]] += ($epoch_2 - $epoch_1);
4523 $result = $ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi AND tst_active.active_id = %s ORDER BY tst_times.active_fi, tst_times.started",
4524 array(
'integer',
'integer'),
4530 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4531 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4532 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4533 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4534 $time += ($epoch_2 - $epoch_1);
4549 $result = $ilDB->queryF(
"SELECT * FROM tst_times WHERE active_fi = %s AND pass = %s ORDER BY started",
4550 array(
'integer',
'integer'),
4551 array($active_id,
$pass)
4556 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4557 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4558 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4559 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4560 $time += ($epoch_2 - $epoch_1);
4589 $result = $ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.test_fi = %s AND tst_active.active_id = tst_times.active_fi AND tst_active.active_id = %s ORDER BY tst_times.started",
4590 array(
'integer',
'integer'),
4597 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches);
4598 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4599 if ($firstvisit == 0 || $epoch_1 < $firstvisit) $firstvisit = $epoch_1;
4600 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"finished"], $matches);
4601 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4602 if ($epoch_2 > $lastvisit) $lastvisit = $epoch_2;
4604 return array(
"firstvisit" => $firstvisit,
"lastvisit" => $lastvisit);
4619 $result = $ilDB->queryF(
"SELECT tst_times.* FROM tst_active, tst_times WHERE tst_active.active_id = %s AND tst_active.active_id = tst_times.active_fi",
4628 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row->started, $matches);
4629 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4630 if (!$first_visit) {
4631 $first_visit = $epoch_1;
4633 if ($epoch_1 < $first_visit) {
4634 $first_visit = $epoch_1;
4636 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row->finished, $matches);
4637 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
4639 $last_visit = $epoch_2;
4641 if ($epoch_2 > $last_visit) {
4642 $last_visit = $epoch_2;
4644 $times[
$row->active_fi] += ($epoch_2 - $epoch_1);
4647 foreach ($times as $key => $value) {
4648 $max_time += $value;
4650 if ((!$test_result[
"test"][
"total_reached_points"]) or (!$test_result[
"test"][
"total_max_points"]))
4656 $percentage = ($test_result[
"test"][
"total_reached_points"] / $test_result[
"test"][
"total_max_points"]) * 100.0;
4657 if ($percentage < 0) $percentage = 0.0;
4659 $mark_obj = $this->mark_schema->getMatchingMark($percentage);
4660 $first_date = getdate($first_visit);
4661 $last_date = getdate($last_visit);
4662 $qworkedthrough = 0;
4663 foreach ($test_result as $key => $value)
4665 if (preg_match(
"/\d+/", $key))
4667 $qworkedthrough += $value[
"workedthrough"];
4670 if (!$qworkedthrough)
4676 $atimeofwork = $max_time / $qworkedthrough;
4679 $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
4686 $result_mark = $mark_obj->getShortName();
4688 if( $mark_obj->getPassed() && $obligationsAnswered )
4697 $percent_worked_through = 0;
4698 if (count($this->questions))
4700 $percent_worked_through = $qworkedthrough / count($this->questions);
4702 $result_array = array(
4703 "qworkedthrough" => $qworkedthrough,
4704 "qmax" => count($this->questions),
4705 "pworkedthrough" => $percent_worked_through,
4706 "timeofwork" => $max_time,
4707 "atimeofwork" => $atimeofwork,
4708 "firstvisit" => $first_date,
4709 "lastvisit" => $last_date,
4710 "resultspoints" => $test_result[
"test"][
"total_reached_points"],
4711 "maxpoints" => $test_result[
"test"][
"total_max_points"],
4712 "resultsmarks" => $result_mark,
4713 "passed" => $passed,
4714 "distancemedian" =>
"0"
4716 foreach ($test_result as $key => $value)
4718 if (preg_match(
"/\d+/", $key))
4720 $result_array[$key] = $value;
4723 return $result_array;
4735 $totalpoints_array = array();
4737 foreach ($all_users as $active_id => $user_name)
4740 $reached = $test_result[
"test"][
"total_reached_points"];
4741 $total = $test_result[
"test"][
"total_max_points"];
4743 $mark = $this->mark_schema->getMatchingMark($percentage*100.0);
4745 $obligationsAnswered = $test_result[
"test"][
"obligations_answered"];
4749 if( $mark->getPassed() && $obligationsAnswered )
4751 array_push($totalpoints_array, $test_result[
"test"][
"total_reached_points"]);
4755 return $totalpoints_array;
4766 $result = $ilDB->queryF(
"SELECT tst_active.active_id, usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login FROM tst_active LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id WHERE tst_active.test_fi = %s ORDER BY usr_data.lastname ASC",
4770 $persons_array = array();
4773 $name = $this->lng->txt(
"anonymous");
4774 $fullname = $this->lng->txt(
"anonymous");
4778 if (strlen(
$row[
"firstname"].
$row[
"lastname"].
$row[
"title"]) == 0)
4780 $name = $this->lng->txt(
"deleted_user");
4781 $fullname = $this->lng->txt(
"deleted_user");
4782 $login = $this->lng->txt(
"unknown");
4786 $login = $row[
"login"];
4787 if ($row[
"user_fi"] == ANONYMOUS_USER_ID)
4789 $name = $this->lng->txt(
"anonymous");
4790 $fullname = $this->lng->txt(
"anonymous");
4794 $name = trim($row[
"lastname"] .
", " . $row[
"firstname"] .
" " . $row[
"title"]);
4795 $fullname = trim($row[
"title"] .
" " . $row[
"firstname"] .
" " . $row[
"lastname"]);
4799 $persons_array[
$row[
"active_id"]] = array(
4801 "fullname" => $fullname,
4805 return $persons_array;
4817 $result = $ilDB->queryF(
"SELECT tst_active.active_id, usr_data.firstname, usr_data.lastname, usr_data.title FROM tst_active LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id WHERE tst_active.test_fi = %s ORDER BY usr_data.lastname " . strtoupper($name_sort_order),
4821 $persons_array = array();
4826 $persons_array[
$row[
"active_id"]] = $this->lng->txt(
"anonymous");
4830 if (strlen(
$row[
"firstname"].
$row[
"lastname"].
$row[
"title"]) == 0)
4832 $persons_array[$row[
"active_id"]] = $this->lng->txt(
"deleted_user");
4836 if ($row[
"user_fi"] == ANONYMOUS_USER_ID)
4838 $persons_array[$row[
"active_id"]] = $row[
"lastname"];
4842 $persons_array[$row[
"active_id"]] = trim($row[
"lastname"] .
", " . $row[
"firstname"] .
" " . $row[
"title"]);
4847 return $persons_array;
4859 $result = $ilDB->queryF(
"SELECT tst_active.active_id, usr_data.login, usr_data.firstname, usr_data.lastname, usr_data.title FROM tst_active LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id WHERE tst_active.test_fi = %s ORDER BY usr_data.lastname " . strtoupper($name_sort_order),
4863 $persons_array = array();
4868 $persons_array[
$row[
"active_id"]] = array(
"name" => $this->lng->txt(
"anonymous"));
4872 if (strlen(
$row[
"firstname"].
$row[
"lastname"].
$row[
"title"]) == 0)
4874 $persons_array[$row[
"active_id"]] = array(
"name" => $this->lng->txt(
"deleted_user"));
4878 if ($row[
"user_fi"] == ANONYMOUS_USER_ID)
4880 $persons_array[$row[
"active_id"]] = array(
"name" => $row[
"lastname"]);
4884 $persons_array[$row[
"active_id"]] = array(
"name" => trim($row[
"lastname"] .
", " . $row[
"firstname"] .
" " . $row[
"title"]),
"login" => $row[
"login"]);
4889 return $persons_array;
4902 $result = $ilDB->queryF(
"SELECT COUNT(active_id) total FROM tst_active WHERE test_fi = %s AND submitted = %s",
4903 array(
'integer',
'integer'),
4907 return $row[
"total"];
4922 $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
4923 "tst_test_rnd_qst.pass, qpl_questions.points " .
4924 "FROM tst_test_rnd_qst, qpl_questions " .
4925 "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
4926 "AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence",
4933 $result = $ilDB->queryF(
"SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
4934 "qpl_questions.points " .
4935 "FROM tst_test_question, tst_active, qpl_questions " .
4936 "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
4937 "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
4947 array_push($qtest,
$row);
4965 $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, " .
4966 "qpl_questions.points " .
4967 "FROM tst_test_rnd_qst, qpl_questions " .
4968 "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
4969 "AND tst_test_rnd_qst.active_fi = %s AND tst_test_rnd_qst.pass = %s " .
4970 "ORDER BY tst_test_rnd_qst.sequence",
4971 array(
'integer',
'integer'),
4972 array($active_id,
$pass)
4977 $result = $ilDB->queryF(
"SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
4978 "qpl_questions.points " .
4979 "FROM tst_test_question, tst_active, qpl_questions " .
4980 "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
4981 "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi",
4991 array_push($qpass,
$row);
5001 include_once
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
5002 include_once
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
5003 include_once
"./Modules/Test/classes/class.ilTestEvaluationData.php";
5008 SELECT tst_test_result.*,
5009 qpl_questions.original_id,
5010 qpl_questions.title questiontitle,
5011 qpl_questions.points maxpoints
5013 FROM tst_test_result, qpl_questions, tst_active
5015 WHERE tst_active.active_id = tst_test_result.active_fi
5016 AND qpl_questions.question_id = tst_test_result.question_fi
5017 AND tst_active.test_fi = %s
5019 ORDER BY tst_active.active_id ASC, tst_test_result.pass ASC, tst_test_result.tstamp DESC
5032 $participantObject = $data->getParticipant(
$row[
"active_fi"]);
5039 $passObject = $participantObject->getPass(
$row[
"pass"]);
5046 $passObject->addAnsweredQuestion(
5051 foreach( array_keys($data->getParticipants()) as $active_id )
5055 for( $testpass = 0; $testpass <= $data->getParticipant($active_id)->getLastPass(); $testpass++ )
5058 $result = $ilDB->queryF(
"SELECT tst_test_rnd_qst.sequence, tst_test_rnd_qst.question_fi, qpl_questions.original_id, " .
5059 "tst_test_rnd_qst.pass, qpl_questions.points, qpl_questions.title " .
5060 "FROM tst_test_rnd_qst, qpl_questions " .
5061 "WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id " .
5062 "AND tst_test_rnd_qst.pass = %s " .
5063 "AND tst_test_rnd_qst.active_fi = %s ORDER BY tst_test_rnd_qst.sequence",
5064 array(
'integer',
'integer'),
5065 array($testpass, $active_id)
5071 $tpass = array_key_exists(
"pass",
$row) ?
$row[
"pass"] : 0;
5072 $data->getParticipant($active_id)->addQuestion(
$row[
"original_id"],
$row[
"question_fi"],
$row[
"points"],
$row[
"sequence"], $tpass);
5073 $data->addQuestionTitle(
$row[
"question_fi"],
$row[
"title"]);
5080 $result = $ilDB->queryF(
"SELECT tst_test_question.sequence, tst_test_question.question_fi, " .
5081 "qpl_questions.points, qpl_questions.title, qpl_questions.original_id " .
5082 "FROM tst_test_question, tst_active, qpl_questions " .
5083 "WHERE tst_test_question.question_fi = qpl_questions.question_id " .
5084 "AND tst_active.active_id = %s AND tst_active.test_fi = tst_test_question.test_fi ORDER BY tst_test_question.sequence",
5090 $questionsbysequence = array();
5094 $questionsbysequence[
$row[
"sequence"]] =
$row;
5097 $seqresult = $ilDB->queryF(
"SELECT * FROM tst_sequence WHERE active_fi = %s",
5102 while ($seqrow = $ilDB->fetchAssoc($seqresult))
5104 $questionsequence = unserialize($seqrow[
"sequence"]);
5105 foreach ($questionsequence as $sidx => $seq)
5107 $data->getParticipant($active_id)->addQuestion($questionsbysequence[$seq][
"original_id"], $questionsbysequence[$seq][
"question_fi"], $questionsbysequence[$seq][
"points"], $sidx + 1, $seqrow[
"pass"]);
5108 $data->addQuestionTitle($questionsbysequence[$seq][
"question_fi"], $questionsbysequence[$seq][
"title"]);
5120 foreach( array_keys($data->getParticipants()) as $active_id )
5122 $tstUserData = $data->getParticipant($active_id);
5124 $percentage = $tstUserData->getReachedPointsInPercent();
5126 $obligationsAnswered = $tstUserData->areObligationsAnswered();
5128 $mark = $this->mark_schema->getMatchingMark($percentage);
5130 if (is_object($mark))
5132 $tstUserData->setMark($mark->getShortName());
5133 $tstUserData->setMarkOfficial($mark->getOfficialName());
5135 $tstUserData->setPassed(
5136 $mark->getPassed() && $tstUserData->areObligationsAnswered()
5143 $passed_array, $tstUserData->getReached(), $tstUserData->getMaxPoints()
5146 $tstUserData->setECTSMark($ects_mark);
5151 $tstUserData->setFirstVisit($visitingTime[
"firstvisit"]);
5152 $tstUserData->setLastVisit($visitingTime[
"lastvisit"]);
5168 $res = $ilDB->queryF(
"
5169 SELECT COUNT(qpl_questions.question_id) qcount,
5170 SUM(qpl_questions.points) qsum
5172 INNER JOIN tst_tests
5173 ON tst_tests.test_id = tst_active.test_fi
5174 INNER JOIN tst_dyn_quest_set_cfg
5175 ON tst_dyn_quest_set_cfg.test_fi = tst_tests.test_id
5176 INNER JOIN qpl_questions
5177 ON qpl_questions.obj_fi = tst_dyn_quest_set_cfg.source_qpl_fi
5178 AND qpl_questions.original_id IS NULL
5179 AND qpl_questions.complete = %s
5180 WHERE tst_active.active_id = %s
5182 array(
'integer',
'integer'),
5183 array(1, $active_id)
5190 $res = $ilDB->queryF(
"
5191 SELECT tst_test_rnd_qst.pass,
5192 COUNT(tst_test_rnd_qst.question_fi) qcount,
5193 SUM(qpl_questions.points) qsum
5195 FROM tst_test_rnd_qst,
5198 WHERE tst_test_rnd_qst.question_fi = qpl_questions.question_id
5199 AND tst_test_rnd_qst.active_fi = %s
5202 GROUP BY tst_test_rnd_qst.active_fi,
5203 tst_test_rnd_qst.pass
5205 array(
'integer',
'integer'),
5206 array($active_id,
$pass)
5213 $res = $ilDB->queryF(
"
5214 SELECT COUNT(tst_test_question.question_fi) qcount,
5215 SUM(qpl_questions.points) qsum
5217 FROM tst_test_question,
5221 WHERE tst_test_question.question_fi = qpl_questions.question_id
5222 AND tst_test_question.test_fi = tst_active.test_fi
5223 AND tst_active.active_id = %s
5225 GROUP BY tst_test_question.test_fi
5235 throw new ilTestException(
"not supported question set type: $questionSetType");
5240 if( is_array(
$row) )
5242 return array(
"count" =>
$row[
"qcount"],
"points" =>
$row[
"qsum"]);
5245 return array(
"count" => 0,
"points" => 0);
5250 include_once
"./Modules/Test/classes/class.ilTestEvaluationData.php";
5251 include_once
"./Modules/Test/classes/class.ilTestEvaluationPassData.php";
5252 include_once
"./Modules/Test/classes/class.ilTestEvaluationUserData.php";
5254 if ($withStatistics)
5256 $data->calculateStatistics();
5258 $data->setFilter($filterby, $filtertext);
5283 $result = $ilDB->queryF(
"SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
5284 "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
5285 "qpl_questions.points maxpoints " .
5286 "FROM tst_test_result, qpl_questions, tst_active " .
5287 "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
5288 "WHERE tst_active.active_id = tst_test_result.active_fi " .
5289 "AND qpl_questions.question_id = tst_test_result.question_fi " .
5290 "AND tst_active.test_fi = %s " .
5291 "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
5295 $overview = array();
5298 if (!array_key_exists(
$row[
"active_fi"], $overview))
5300 $overview[
$row[
"active_fi"]] = array();
5301 $overview[$row[
"active_fi"]][
"firstname"] = $row[
"firstname"];
5302 $overview[$row[
"active_fi"]][
"lastname"] = $row[
"lastname"];
5303 $overview[$row[
"active_fi"]][
"title"] = $row[
"title"];
5304 $overview[$row[
"active_fi"]][
"login"] = $row[
"login"];
5305 $overview[$row[
"active_fi"]][
"usr_id"] = $row[
"usr_id"];
5306 $overview[$row[
"active_fi"]][
"started"] = $row[
"started"];
5307 $overview[$row[
"active_fi"]][
"finished"] = $row[
"finished"];
5309 if (!array_key_exists(
$row[
"pass"], $overview[
$row[
"active_fi"]]))
5311 $overview[$row[
"active_fi"]][$row[
"pass"]] = array();
5312 $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] = 0;
5313 $overview[$row[
"active_fi"]][$row[
"pass"]][
"maxpoints"] = $row[
"maxpoints"];
5315 array_push($overview[$row[
"active_fi"]][$row[
"pass"]], $row);
5316 $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] += $row[
"points"];
5332 $result = $ilDB->queryF(
"SELECT usr_data.usr_id, usr_data.firstname, usr_data.lastname, usr_data.title, usr_data.login, " .
5333 "tst_test_result.*, qpl_questions.original_id, qpl_questions.title questiontitle, " .
5334 "qpl_questions.points maxpoints " .
5335 "FROM tst_test_result, qpl_questions, tst_active " .
5336 "LEFT JOIN usr_data ON tst_active.user_fi = usr_data.usr_id " .
5337 "WHERE tst_active.active_id = tst_test_result.active_fi " .
5338 "AND qpl_questions.question_id = tst_test_result.question_fi " .
5339 "AND tst_active.test_fi = %s AND tst_active.active_id = %s" .
5340 "ORDER BY tst_active.active_id, tst_test_result.pass, tst_test_result.tstamp",
5341 array(
'integer',
'integer'),
5344 $overview = array();
5347 if (!array_key_exists(
$row[
"active_fi"], $overview))
5349 $overview[
$row[
"active_fi"]] = array();
5350 $overview[$row[
"active_fi"]][
"firstname"] = $row[
"firstname"];
5351 $overview[$row[
"active_fi"]][
"lastname"] = $row[
"lastname"];
5352 $overview[$row[
"active_fi"]][
"title"] = $row[
"title"];
5353 $overview[$row[
"active_fi"]][
"login"] = $row[
"login"];
5354 $overview[$row[
"active_fi"]][
"usr_id"] = $row[
"usr_id"];
5355 $overview[$row[
"active_fi"]][
"started"] = $row[
"started"];
5356 $overview[$row[
"active_fi"]][
"finished"] = $row[
"finished"];
5358 if (!array_key_exists(
$row[
"pass"], $overview[
$row[
"active_fi"]]))
5360 $overview[$row[
"active_fi"]][$row[
"pass"]] = array();
5361 $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] = 0;
5362 $overview[$row[
"active_fi"]][$row[
"pass"]][
"maxpoints"] = $row[
"maxpoints"];
5364 array_push($overview[$row[
"active_fi"]][$row[
"pass"]], $row);
5365 $overview[$row[
"active_fi"]][$row[
"pass"]][
"reached"] += $row[
"points"];
5384 if (strlen($firstname.$lastname.$title) == 0)
5386 $name = $this->lng->txt(
"deleted_user");
5390 if ($user_id == ANONYMOUS_USER_ID)
5396 $name = trim($lastname .
", " . $firstname .
" " .
$title);
5400 $name = $this->lng->txt(
"anonymous");
5422 if (strlen($firstname.$lastname.$title) == 0)
5424 $name = $lng->txt(
"deleted_user");
5428 if ($user_id == ANONYMOUS_USER_ID)
5434 $name = trim($lastname .
", " . $firstname .
" " .
$title);
5438 $name = $lng->txt(
"anonymous");
5454 $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",
5461 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row->started, $matches);
5462 $epoch_1 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
5463 preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row->finished, $matches);
5464 $epoch_2 = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
5465 $times[
$row->active_fi] += ($epoch_2 - $epoch_1);
5469 foreach ($times as $key => $value)
5471 $max_time += $value;
5476 $average_time = round($max_time / $counter);
5482 return $average_time;
5491 function &
getAvailableQuestionpools($use_object_id =
false, $equal_points =
false, $could_be_offline =
false, $show_path = FALSE, $with_questioncount = FALSE, $permission =
"read")
5493 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
5505 $time_in_seconds = 0;
5506 foreach ($this->questions as $question_id)
5509 $est_time = $question->getEstimatedWorkingTime();
5510 $time_in_seconds += $est_time[
"h"] * 3600 + $est_time[
"m"] * 60 + $est_time[
"s"];
5512 $hours = (int)($time_in_seconds / 3600) ;
5513 $time_in_seconds = $time_in_seconds - ($hours * 3600);
5514 $minutes = (int)($time_in_seconds / 60);
5515 $time_in_seconds = $time_in_seconds - ($minutes * 60);
5516 $result = array(
"hh" => $hours,
"mm" => $minutes,
"ss" => $time_in_seconds);
5528 return CLIENT_WEB_DIR .
"/assessment/" . $this->
getId() .
"/images/";
5539 include_once
"./Services/Utilities/classes/class.ilUtil.php";
5554 if ((!$question_type) and ($question_id > 0))
5559 if (!strlen($question_type))
return null;
5561 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
5565 $question =
new $question_type_gui();
5569 if ($question_id > 0)
5571 $question->object->loadFromDb($question_id);
5576 $question->object->feedbackOBJ =
new $feedbackObjectClassname($question->object, $ilCtrl, $ilDB, $lng);
5578 $assSettings =
new ilSetting(
'assessment');
5579 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionProcessLockerFactory.php';
5581 $processLockerFactory->setQuestionId($question->object->getId());
5582 $processLockerFactory->setUserId($ilUser->getId());
5583 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
5585 $question->object->setProcessLocker($processLockerFactory->getLocker());
5602 if (strcmp($question_id,
"") != 0)
5604 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
5619 $this->questions = array_values($this->questions);
5620 $array_pos = array_search($target_index, $this->questions);
5621 if ($insert_mode == 0)
5623 $part1 = array_slice($this->questions, 0, $array_pos);
5624 $part2 = array_slice($this->questions, $array_pos);
5626 else if ($insert_mode == 1)
5628 $part1 = array_slice($this->questions, 0, $array_pos + 1);
5629 $part2 = array_slice($this->questions, $array_pos + 1);
5631 foreach ($move_questions as $question_id)
5633 if (!(array_search($question_id, $part1) === FALSE))
5635 unset($part1[array_search($question_id, $part1)]);
5637 if (!(array_search($question_id, $part2) === FALSE))
5639 unset($part2[array_search($question_id, $part2)]);
5642 $part1 = array_values($part1);
5643 $part2 = array_values($part2);
5644 $new_array = array_values(array_merge($part1, $move_questions, $part2));
5645 $this->questions = array();
5647 foreach ($new_array as $question_id)
5649 $this->questions[$counter] = $question_id;
5667 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getStartingTime(), $matches))
5669 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
5671 if ($now < $epoch_time)
5692 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getEndingTime(), $matches))
5694 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
5696 if ($now > $epoch_time)
5716 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
5719 if (count($available_pools))
5721 $available =
" AND " . $ilDB->in(
'qpl_questions.obj_fi', $available_pools,
false,
'integer');
5729 $available .=
" AND qpl_questions.complete = " . $ilDB->quote(
"1",
'text');
5733 if (is_array($arrFilter))
5735 if (array_key_exists(
'title', $arrFilter) && strlen($arrFilter[
'title']))
5737 $where .=
" AND " . $ilDB->like(
'qpl_questions.title',
'text',
"%%" . $arrFilter[
'title'] .
"%%");
5739 if (array_key_exists(
'description', $arrFilter) && strlen($arrFilter[
'description']))
5741 $where .=
" AND " . $ilDB->like(
'qpl_questions.description',
'text',
"%%" . $arrFilter[
'description'] .
"%%");
5743 if (array_key_exists(
'author', $arrFilter) && strlen($arrFilter[
'author']))
5745 $where .=
" AND " . $ilDB->like(
'qpl_questions.author',
'text',
"%%" . $arrFilter[
'author'] .
"%%");
5747 if (array_key_exists(
'type', $arrFilter) && strlen($arrFilter[
'type']))
5749 $where .=
" AND qpl_qst_type.type_tag = " . $ilDB->quote($arrFilter[
'type'],
'text');
5751 if (array_key_exists(
'qpl', $arrFilter) && strlen($arrFilter[
'qpl']))
5753 $where .=
" AND " . $ilDB->like(
'object_data.title',
'text',
"%%" . $arrFilter[
'qpl'] .
"%%");
5758 $original_clause =
" qpl_questions.original_id IS NULL";
5759 if (count($original_ids))
5761 $original_clause =
" qpl_questions.original_id IS NULL AND " . $ilDB->in(
'qpl_questions.question_id', $original_ids,
true,
'integer');
5764 $query_result = $ilDB->query(
5765 "SELECT qpl_questions.*, qpl_questions.tstamp, qpl_qst_type.type_tag, qpl_qst_type.plugin, object_data.title qpl " .
5766 "FROM qpl_questions, qpl_qst_type, object_data WHERE $original_clause $available AND " .
5767 "object_data.obj_id = qpl_questions.obj_fi AND qpl_questions.tstamp > 0 AND " .
5768 "qpl_questions.question_type_fi = qpl_qst_type.question_type_id$where");
5771 if ($query_result->numRows())
5773 while (
$row = $ilDB->fetchAssoc($query_result))
5775 $row[
'ttype'] = $types[
$row[
'type_tag']];
5780 array_push($rows, $row);
5785 array_push($rows, $row);
5797 global $ilPluginAdmin;
5799 $lng->loadLanguageModule(
"assessment");
5800 $result = $ilDB->query(
"SELECT * FROM qpl_qst_type");
5804 if (
$row[
"plugin"] == 0)
5806 $types[
$row[
'type_tag']] = $lng->txt($row[
"type_tag"]);
5810 $pl_names = $ilPluginAdmin->getActivePluginsForSlot(
IL_COMP_MODULE,
"TestQuestionPool",
"qst");
5811 foreach ($pl_names as $pl_name)
5814 if (strcmp($pl->getQuestionType(),
$row[
"type_tag"]) == 0)
5816 $types[
$row[
'type_tag']] = $pl->getQuestionTypeTranslation();
5837 foreach ($assessment->objectives as $objectives)
5839 foreach ($objectives->materials as $material)
5856 foreach ($assessment->assessmentcontrol as $assessmentcontrol)
5858 switch ($assessmentcontrol->getSolutionswitch())
5874 foreach ($assessment->qtimetadata as
$metadata)
5876 switch ($metadata[
"label"])
5880 $type = $metadata[
"entry"];
5901 case "sequence_settings":
5911 $this->
setKiosk($metadata[
"entry"]);
5913 case "showfinalstatement":
5926 case "highscore_enabled":
5930 case "highscore_anon":
5934 case "highscore_achieved_ts":
5938 case "highscore_score":
5942 case "highscore_percentage":
5946 case "highscore_hints":
5950 case "highscore_wtime":
5954 case "highscore_own_table":
5958 case "highscore_top_table":
5962 case "highscore_top_num":
5966 case "hide_previous_results":
5967 if ($metadata[
"entry"] == 0)
5976 case "use_previous_answers":
5979 case "answer_feedback":
5982 case "hide_title_points":
5985 case "title_output":
5988 case "question_set_type":
5992 if( $metadata[
"entry"] )
6001 case "results_presentation":
6004 case "reset_processing_time":
6007 case "instant_verification":
6010 case "answer_feedback_points":
6022 case "fixed_participants":
6025 case "score_reporting":
6028 case "shuffle_questions":
6031 case "count_system":
6037 case "mailnotification":
6043 case "exportsettings":
6046 case "score_cutting":
6053 case "allowedUsers":
6057 case "allowedUsersTimeGap":
6060 case "pass_scoring":
6063 case "show_summary":
6066 case "reporting_date":
6067 $iso8601period = $metadata[
"entry"];
6068 if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
6070 $this->
setReportingDate(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
6073 case 'enable_processing_time':
6076 case "processing_time":
6079 case "starting_time":
6080 $iso8601period = $metadata[
"entry"];
6081 if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
6083 $this->
setStartingTime(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
6088 $iso8601period = $metadata[
"entry"];
6089 if (preg_match(
"/P(\d+)Y(\d+)M(\d+)DT(\d+)H(\d+)M(\d+)S/", $iso8601period, $matches))
6091 $this->
setEndingTime(sprintf(
"%02d%02d%02d%02d%02d%02d", $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]));
6095 case "enable_examview":
6098 case 'show_examview_html':
6101 case 'show_examview_pdf':
6104 case 'redirection_mode':
6107 case 'redirection_url':
6110 case 'examid_in_kiosk':
6111 case 'examid_in_test_pass':
6114 case 'show_exam_id':
6115 case 'examid_in_test_res':
6118 case 'enable_archiving':
6121 case 'sign_submission':
6124 case 'char_selector_availability':
6127 case 'char_selector_definition':
6130 case 'skill_service':
6133 case 'result_tax_filters':
6134 $this->
setResultFilterTaxIds(strlen($metadata[
'entry']) ? unserialize($metadata[
'entry']) : array());
6136 case 'show_grading_status':
6139 case 'show_grading_mark':
6142 case 'activation_limited':
6145 case 'activation_start_time':
6148 case 'activation_end_time':
6151 case 'activation_visibility':
6157 case 'autosave_ival':
6160 case 'offer_question_hints':
6163 case 'instant_feedback_specific':
6166 case 'instant_feedback_answer_fixation':
6169 case 'obligations_enabled':
6173 if (preg_match(
"/mark_step_\d+/", $metadata[
"label"]))
6175 $xmlmark = $metadata[
"entry"];
6176 preg_match(
"/<short>(.*?)<\/short>/", $xmlmark, $matches);
6177 $mark_short = $matches[1];
6178 preg_match(
"/<official>(.*?)<\/official>/", $xmlmark, $matches);
6179 $mark_official = $matches[1];
6180 preg_match(
"/<percentage>(.*?)<\/percentage>/", $xmlmark, $matches);
6181 $mark_percentage = $matches[1];
6182 preg_match(
"/<passed>(.*?)<\/passed>/", $xmlmark, $matches);
6183 $mark_passed = $matches[1];
6184 $this->mark_schema->addMarkStep($mark_short, $mark_official, $mark_percentage, $mark_passed);
6188 if (is_array(
$_SESSION[
"import_mob_xhtml"]))
6190 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
6191 include_once
"./Services/RTE/classes/class.ilRTE.php";
6192 include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
6193 foreach (
$_SESSION[
"import_mob_xhtml"] as $mob)
6196 if (file_exists($importfile))
6206 $ilLog->write(
"Error: Could not open XHTML mob file for test introduction during test import. File $importfile does not exist!");
6220 include_once(
"./Services/Xml/classes/class.ilXmlWriter.php");
6224 $a_xml_writer->xmlSetDtdDef(
"<!DOCTYPE questestinterop SYSTEM \"ims_qtiasiv1p2p1.dtd\">");
6225 $a_xml_writer->xmlStartTag(
"questestinterop");
6228 "ident" =>
"il_".IL_INST_ID.
"_tst_".$this->getTestId(),
6231 $a_xml_writer->xmlStartTag(
"assessment", $attrs);
6233 $a_xml_writer->xmlElement(
"qticomment", NULL, $this->
getDescription());
6236 if ($this->enable_processing_time)
6238 preg_match(
"/(\d+):(\d+):(\d+)/", $this->processing_time, $matches);
6239 $a_xml_writer->xmlElement(
"duration", NULL, sprintf(
"P0Y0M0DT%dH%dM%dS", $matches[1], $matches[2], $matches[3]));
6243 $a_xml_writer->xmlStartTag(
"qtimetadata");
6244 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6245 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"ILIAS_VERSION");
6246 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->ilias->getSetting(
"ilias_version"));
6247 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6250 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6251 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"anonymity");
6252 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getAnonymity()));
6253 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6256 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6257 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"question_set_type");
6259 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6262 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6263 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"sequence_settings");
6265 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6268 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6269 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"author");
6270 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getAuthor());
6271 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6274 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6275 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"reset_processing_time");
6277 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6280 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6281 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"count_system");
6282 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getCountSystem());
6283 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6286 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6287 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"mc_scoring");
6288 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getMCScoring());
6289 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6292 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6293 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"score_cutting");
6294 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getScoreCutting());
6295 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6298 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6299 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"password");
6300 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getPassword());
6301 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6304 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6305 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"allowedUsers");
6306 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getAllowedUsers());
6307 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6310 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6311 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"allowedUsersTimeGap");
6313 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6316 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6317 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"pass_scoring");
6318 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getPassScoring());
6319 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6324 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6325 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"reporting_date");
6326 preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->reporting_date, $matches);
6327 $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]));
6328 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6331 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6332 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"nr_of_tries");
6333 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getNrOfTries()));
6334 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6337 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6338 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"kiosk");
6339 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getKiosk()));
6340 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6344 $a_xml_writer->xmlStartTag(
'qtimetadatafield');
6345 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"redirection_mode");
6347 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6350 $a_xml_writer->xmlStartTag(
'qtimetadatafield');
6351 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"redirection_url");
6353 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6356 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6357 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"use_previous_answers");
6359 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6362 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6363 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"title_output");
6364 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getTitleOutput()));
6365 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6368 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6369 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"results_presentation");
6371 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6374 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6375 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"examid_in_test_pass");
6377 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6380 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6381 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"examid_in_test_res");
6383 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6386 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6387 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_summary");
6389 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6392 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6393 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"score_reporting");
6394 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getScoreReporting()));
6395 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6398 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6399 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"instant_verification");
6401 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6404 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6405 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"answer_feedback");
6406 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getAnswerFeedback()));
6407 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6410 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6411 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"answer_feedback_points");
6413 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6416 $highscore_metadata = array(
6428 foreach($highscore_metadata as $label => $data)
6430 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6431 $a_xml_writer->xmlElement(
"fieldlabel", NULL, $label);
6432 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $data[
'value']));
6433 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6437 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6438 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_cancel");
6439 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getShowCancel()));
6440 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6443 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6444 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_marker");
6445 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getShowMarker()));
6446 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6449 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6450 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"fixed_participants");
6452 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6455 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6456 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"showfinalstatement");
6457 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", (($this->
getShowFinalStatement()) ?
"1" :
"0")));
6458 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6461 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6462 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"showinfo");
6463 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", (($this->
getShowInfo()) ?
"1" :
"0")));
6464 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6467 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6468 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"mailnotification");
6470 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6473 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6474 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"mailnottype");
6476 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6479 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6480 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"exportsettings");
6482 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6485 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6486 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"forcejs");
6487 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", (($this->
getForceJS()) ?
"1" :
"0")));
6488 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6491 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6492 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"customstyle");
6493 $a_xml_writer->xmlElement(
"fieldentry", NULL, $this->
getCustomStyle());
6494 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6497 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6498 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"shuffle_questions");
6499 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
"%d", $this->
getShuffleQuestions()));
6500 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6503 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6504 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"processing_time");
6506 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6509 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6510 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"enable_examview");
6512 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6515 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6516 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_examview_html");
6518 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6521 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6522 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_examview_pdf");
6524 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6527 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6528 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"enable_archiving");
6530 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6533 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6534 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"sign_submission");
6536 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6539 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6540 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"char_selector_availability");
6542 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6545 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6546 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"char_selector_definition");
6548 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6551 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6552 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"skill_service");
6554 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6557 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6558 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"result_tax_filters");
6560 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6563 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6564 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_grading_status");
6566 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6569 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6570 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"show_grading_mark");
6572 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6578 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6579 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"starting_time");
6580 preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->starting_time, $matches);
6581 $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]));
6582 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6587 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6588 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"ending_time");
6589 preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->ending_time, $matches);
6590 $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]));
6591 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6596 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6597 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"activation_limited");
6599 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6602 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6603 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"activation_start_time");
6605 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6608 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6609 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"activation_end_time");
6611 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6614 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6615 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"activation_visibility");
6617 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6620 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6621 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"autosave");
6622 $a_xml_writer->xmlElement(
"fieldentry", NULL, (
int)$this->
getAutosave());
6623 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6626 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6627 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"autosave_ival");
6628 $a_xml_writer->xmlElement(
"fieldentry", NULL, (
int)$this->
getAutosaveIval());
6629 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6632 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6633 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"offer_question_hints");
6635 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6638 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6639 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"instant_feedback_specific");
6641 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6644 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6645 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"instant_feedback_answer_fixation");
6647 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6650 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6651 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"obligations_enabled");
6653 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6656 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6657 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"enable_processing_time");
6659 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6661 foreach ($this->mark_schema->mark_steps as $index => $mark)
6664 $a_xml_writer->xmlStartTag(
"qtimetadatafield");
6665 $a_xml_writer->xmlElement(
"fieldlabel", NULL,
"mark_step_$index");
6666 $a_xml_writer->xmlElement(
"fieldentry", NULL, sprintf(
6667 "<short>%s</short><official>%s</official><percentage>%.2f</percentage><passed>%d</passed>",
6668 $mark->getShortName(), $mark->getOfficialName(), $mark->getMinimumLevel(), $mark->getPassed()
6670 $a_xml_writer->xmlEndTag(
"qtimetadatafield");
6672 $a_xml_writer->xmlEndTag(
"qtimetadata");
6675 $a_xml_writer->xmlStartTag(
"objectives");
6677 $a_xml_writer->xmlEndTag(
"objectives");
6683 "solutionswitch" =>
"Yes"
6690 $a_xml_writer->xmlElement(
"assessmentcontrol", $attrs, NULL);
6695 $a_xml_writer->xmlStartTag(
"presentation_material");
6696 $a_xml_writer->xmlStartTag(
"flow_mat");
6698 $a_xml_writer->xmlEndTag(
"flow_mat");
6699 $a_xml_writer->xmlEndTag(
"presentation_material");
6705 $a_xml_writer->xmlElement(
"section", $attrs, NULL);
6706 $a_xml_writer->xmlEndTag(
"assessment");
6707 $a_xml_writer->xmlEndTag(
"questestinterop");
6709 $xml = $a_xml_writer->xmlDumpMem(FALSE);
6711 foreach ($this->questions as $question_id)
6714 $qti_question = $question->toXML(
false);
6715 $qti_question = preg_replace(
"/<questestinterop>/",
"", $qti_question);
6716 $qti_question = preg_replace(
"/<\/questestinterop>/",
"", $qti_question);
6717 if (strpos($xml,
"</section>") !==
false)
6719 $xml = str_replace(
"</section>",
"$qti_question</section>", $xml);
6723 $xml = str_replace(
"<section ident=\"1\"/>",
"<section ident=\"1\">\n$qti_question</section>", $xml);
6739 $this->mob_ids = array();
6740 $this->file_ids = array();
6743 $attrs[
"Type"] =
"Test";
6744 $a_xml_writer->xmlStartTag(
"ContentObject", $attrs);
6750 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Page Objects");
6751 $ilBench->start(
"ContentObjectExport",
"exportPageObjects");
6753 $ilBench->stop(
"ContentObjectExport",
"exportPageObjects");
6754 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Page Objects");
6757 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export Media Objects");
6758 $ilBench->start(
"ContentObjectExport",
"exportMediaObjects");
6760 $ilBench->stop(
"ContentObjectExport",
"exportMediaObjects");
6761 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export Media Objects");
6764 $expLog->write(date(
"[y-m-d H:i:s] ").
"Start Export File Items");
6765 $ilBench->start(
"ContentObjectExport",
"exportFileItems");
6767 $ilBench->stop(
"ContentObjectExport",
"exportFileItems");
6768 $expLog->write(date(
"[y-m-d H:i:s] ").
"Finished Export File Items");
6770 $a_xml_writer->xmlEndTag(
"ContentObject");
6781 include_once
"./Services/MetaData/classes/class.ilMD2XML.php";
6783 $md2xml->setExportMode(
true);
6784 $md2xml->startExport();
6785 $a_xml_writer->appendXML($md2xml->getXML());
6795 if ($a_tag ==
"Identifier" && $a_param ==
"Entry")
6797 include_once
"./Services/Utilities/classes/class.ilUtil.php";
6815 include_once
"./Modules/LearningModule/classes/class.ilLMPageObject.php";
6817 foreach ($this->questions as $question_id)
6819 $ilBench->start(
"ContentObjectExport",
"exportPageObject");
6820 $expLog->write(date(
"[y-m-d H:i:s] ").
"Page Object ".$question_id);
6823 $a_xml_writer->xmlStartTag(
"PageObject", $attrs);
6827 $ilBench->start(
"ContentObjectExport",
"exportPageObject_XML");
6828 include_once
"./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
6830 $page_object->buildDom();
6831 $page_object->insertInstIntoIDs($a_inst);
6832 $mob_ids = $page_object->collectMediaObjects(
false);
6833 require_once
'Services/COPage/classes/class.ilPCFileList.php';
6835 $xml = $page_object->getXMLFromDom(
false,
false,
false,
"",
true);
6836 $xml = str_replace(
"&",
"&", $xml);
6837 $a_xml_writer->appendXML($xml);
6838 $page_object->freeDom();
6839 unset ($page_object);
6841 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_XML");
6844 $ilBench->start(
"ContentObjectExport",
"exportPageObject_CollectMedia");
6846 foreach($mob_ids as $mob_id)
6848 $this->mob_ids[$mob_id] = $mob_id;
6850 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_CollectMedia");
6853 $ilBench->start(
"ContentObjectExport",
"exportPageObject_CollectFileItems");
6855 foreach($file_ids as $file_id)
6857 $this->file_ids[$file_id] = $file_id;
6859 $ilBench->stop(
"ContentObjectExport",
"exportPageObject_CollectFileItems");
6861 $a_xml_writer->xmlEndTag(
"PageObject");
6864 $ilBench->stop(
"ContentObjectExport",
"exportPageObject");
6878 include_once
"./Services/MediaObjects/classes/class.ilObjMediaObject.php";
6880 foreach ($this->mob_ids as $mob_id)
6882 $expLog->write(date(
"[y-m-d H:i:s] ").
"Media Object ".$mob_id);
6886 $media_obj->exportXML($a_xml_writer, $a_inst);
6887 $media_obj->exportFiles($a_target_dir);
6899 include_once
"./Modules/File/classes/class.ilObjFile.php";
6901 foreach ($this->file_ids as $file_id)
6903 $expLog->write(date(
"[y-m-d H:i:s] ").
"File Item ".$file_id);
6904 $file_obj =
new ilObjFile($file_id,
false);
6905 $file_obj->export($a_target_dir);
6916 if (!is_array($this->import_mapping))
6922 return $this->import_mapping;
6939 return self::_getECTSGrade($passed_array, $reached_points, $max_points, $this->ects_grades[
"A"], $this->ects_grades[
"B"], $this->ects_grades[
"C"], $this->ects_grades[
"D"], $this->ects_grades[
"E"], $this->ects_fx);
6945 public static function _getECTSGrade($points_passed, $reached_points, $max_points, $a, $b, $c,
$d, $e, $fx)
6947 include_once
"./Modules/Test/classes/class.ilStatistics.php";
6950 $passed_statistics->setData($points_passed);
6951 $ects_percentiles = array
6953 "A" => $passed_statistics->quantile($a),
6954 "B" => $passed_statistics->quantile($b),
6955 "C" => $passed_statistics->quantile($c),
6956 "D" => $passed_statistics->quantile(
$d),
6957 "E" => $passed_statistics->quantile($e)
6959 if (count($points_passed) && ($reached_points >= $ects_percentiles[
"A"]))
6963 else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"B"]))
6967 else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"C"]))
6971 else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"D"]))
6975 else if (count($points_passed) && ($reached_points >= $ects_percentiles[
"E"]))
6979 else if (strcmp($fx,
"") != 0)
6981 if ($max_points > 0)
6983 $percentage = ($reached_points / $max_points) * 100.0;
6984 if ($percentage < 0) $percentage = 0.0;
6990 if ($percentage >= $fx)
7010 return $this->mark_schema->checkMarks();
7038 global
$ilDB, $ilPluginAdmin, $tree;
7040 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
7060 if(preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getReportingDate(), $matches))
7062 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
7064 if($now < $epoch_time)
7102 $md_life =& $md->getLifecycle();
7105 if (strlen($a_author) == 0)
7108 $a_author = $ilUser->getFullname();
7111 $md_life =& $md->addLifecycle();
7113 $con =& $md_life->addContribute();
7114 $con->setRole(
"Author");
7116 $ent =& $con->addEntity();
7117 $ent->setEntity($a_author);
7143 include_once
"./Services/MetaData/classes/class.ilMD.php";
7145 $md_life =& $md->getLifecycle();
7148 $ids =& $md_life->getContributeIds();
7149 foreach ($ids as
$id)
7151 $md_cont =& $md_life->getContribute($id);
7152 if (strcmp($md_cont->getRole(),
"Author") == 0)
7154 $entids =& $md_cont->getEntityIds();
7155 foreach ($entids as $entid)
7157 $md_ent =& $md_cont->getEntity($entid);
7158 array_push(
$author, $md_ent->getEntity());
7176 include_once
"./Services/MetaData/classes/class.ilMD.php";
7177 $md =&
new ilMD($obj_id, 0,
"tst");
7178 $md_life =& $md->getLifecycle();
7181 $ids =& $md_life->getContributeIds();
7182 foreach ($ids as
$id)
7184 $md_cont =& $md_life->getContribute($id);
7185 if (strcmp($md_cont->getRole(),
"Author") == 0)
7187 $entids =& $md_cont->getEntityIds();
7188 foreach ($entids as $entid)
7190 $md_ent =& $md_cont->getEntity($entid);
7191 array_push(
$author, $md_ent->getEntity());
7210 $result_array = array();
7220 $result_array[$obj_id] = $titles[
$ref_id];
7228 return $result_array;
7239 public function cloneObject($a_target_id,$a_copy_id = 0)
7253 if(!$cp_options->isRootNode($this->getRefId()))
7255 $newObj->setOnline($this->
isOnline());
7280 $newObj->setKiosk($this->
getKiosk());
7325 $newObj->saveToDb();
7328 include_once
"./Services/Certificate/classes/class.ilCertificate.php";
7329 include_once
"./Modules/Test/classes/class.ilTestCertificateAdapter.php";
7332 $cert->cloneCertificate($newcert);
7334 require_once
'Modules/Test/classes/class.ilTestQuestionSetConfigFactory.php';
7336 $testQuestionSetConfigFactory->getQuestionSetConfig()->cloneQuestionSetRelatedData($newObj);
7338 $newObj->saveToDb();
7339 $newObj->updateMetaData();
7341 include_once(
'./Services/Tracking/classes/class.ilLPObjSettings.php');
7343 $obj_settings->cloneSettings($newObj->getId());
7360 global $tree,
$ilDB, $ilPluginAdmin;
7363 $tree, $ilDB, $ilPluginAdmin, $this
7366 $questionSetConfig->loadFromDb();
7368 if( $questionSetConfig->isQuestionAmountConfigurationModePerPool() )
7370 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionList.php';
7371 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetBuilderWithAmountPerPool.php';
7372 require_once
'Modules/Test/classes/class.ilTestRandomQuestionSetSourcePoolDefinitionFactory.php';
7378 $sourcePoolDefinitionList->loadDefinitions();
7380 $num = $sourcePoolDefinitionList->getQuestionAmount();
7384 $num = $questionSetConfig->getQuestionAmountPerTest();
7389 $num = count($this->questions);
7407 if (strcmp($question_id,
"") != 0)
7409 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
7412 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
7427 $result = $ilDB->queryF(
"SELECT obj_fi FROM tst_tests WHERE test_id = %s",
7434 $object_id =
$row[
"obj_fi"];
7450 $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",
7457 $object_id =
$row[
"obj_fi"];
7473 $result = $ilDB->queryF(
"SELECT test_id FROM tst_tests WHERE obj_fi = %s",
7498 if (($active_id) && ($question_id))
7502 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
7505 $result = $ilDB->queryF(
"SELECT value1 FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
7506 array(
'integer',
'integer',
'integer'),
7507 array($active_id, $question_id,
$pass)
7532 $result = $ilDB->queryF(
"SELECT question_text FROM qpl_questions WHERE question_id = %s",
7555 $result_array = array();
7559 if (is_numeric($user_id))
7561 $result = $ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
7562 "tst_active.submitted test_finished, matriculation FROM usr_data, tst_invited_user " .
7563 "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
7564 "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
7566 array(
'text',
'text',
'text',
'integer',
'integer'),
7567 array(
"", $this->lng->txt(
"anonymous"),
"", $this->
getTestId(), $user_id)
7572 $result = $ilDB->queryF(
"SELECT tst_active.active_id, usr_id, %s login, %s lastname, %s firstname, tst_invited_user.clientip, " .
7573 "tst_active.submitted test_finished, matriculation FROM usr_data, tst_invited_user " .
7574 "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
7575 "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
7577 array(
'text',
'text',
'text',
'integer'),
7578 array(
"", $this->lng->txt(
"anonymous"),
"", $this->
getTestId())
7584 if (is_numeric($user_id))
7586 $result = $ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
7587 "tst_active.submitted test_finished, matriculation FROM usr_data, tst_invited_user " .
7588 "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
7589 "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id AND usr_data.usr_id=%s " .
7591 array(
'integer',
'integer'),
7597 $result = $ilDB->queryF(
"SELECT tst_active.active_id, tst_active.tries, usr_id, login, lastname, firstname, tst_invited_user.clientip, " .
7598 "tst_active.submitted test_finished, matriculation FROM usr_data, tst_invited_user " .
7599 "LEFT JOIN tst_active ON tst_active.user_fi = tst_invited_user.user_fi AND tst_active.test_fi = tst_invited_user.test_fi " .
7600 "WHERE tst_invited_user.test_fi = %s and tst_invited_user.user_fi=usr_data.usr_id " .
7607 $result_array = array();
7610 $result_array[
$row[
'usr_id']]=
$row;
7612 return $result_array;
7627 $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 ".
7628 "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),
7629 array(
'text',
'text',
'text',
'integer'),
7630 array(
"", $this->lng->txt(
"anonymous"),
"", $this->
getTestId())
7635 $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 ".
7636 "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),
7646 foreach ($data as $index => $participant)
7648 if (strlen(trim($participant[
"firstname"].$participant[
"lastname"])) == 0)
7650 $data[$index][
"lastname"] = $this->lng->txt(
"deleted_user");
7660 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
7662 if (count($scoring) == 0)
return array();
7665 $filtered_participants = array();
7666 foreach ($participants as $active_id => $participant)
7668 $qstType_IN_manScoreableQstTypes = $ilDB->in(
'qpl_questions.question_type_fi', $scoring,
false,
'integer');
7671 SELECT tst_test_result.manual
7673 FROM tst_test_result
7675 INNER JOIN qpl_questions
7676 ON tst_test_result.question_fi = qpl_questions.question_id
7678 WHERE tst_test_result.active_fi = %s
7679 AND $qstType_IN_manScoreableQstTypes
7683 $queryString, array(
"integer"), array($active_id)
7693 if ($participant->active) $filtered_participants[$active_id] = $participant;
7696 if (!$participant->active) $filtered_participants[$active_id] = $participant;
7699 $filtered_participants[$active_id] = $participant;
7714 $assessmentSetting =
new ilSetting(
"assessment");
7715 $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
7716 if ($manscoring_done) $filtered_participants[$active_id] = $participant;
7728 $assessmentSetting =
new ilSetting(
"assessment");
7729 $manscoring_done = $assessmentSetting->get(
"manscoring_done_" . $active_id);
7730 if (!$manscoring_done) $filtered_participants[$active_id] = $participant;
7738 if (
$row[
"manual"]) $found++;
7740 if (($found > 0) && ($found < $count)) $filtered_participants[$active_id] = $participant;
7743 $filtered_participants[$active_id] = $participant;
7748 return $filtered_participants;
7762 if (!is_array($ids) || count($ids) ==0)
return array();
7766 $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",
7767 array(
'text',
'text',
'text'),
7768 array(
"", $this->lng->txt(
"anonymous"),
"")
7773 $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");
7776 $result_array = array();
7779 $result_array[
$row[
"usr_id"]]=
$row;
7781 return $result_array;
7786 if (!is_array($ids) || count($ids) ==0)
return array();
7798 if (!is_array($ids) || count($ids) ==0)
return array();
7800 foreach ($ids as $obj_id)
7816 include_once
"./Modules/Group/classes/class.ilObjGroup.php";
7818 $members = $group->getGroupMemberIds();
7819 include_once
'./Services/User/classes/class.ilObjUser.php';
7820 foreach ($members as $user_id)
7835 $members = $rbacreview->assignedUsers($role_id,
"usr_id");
7836 include_once
'./Services/User/classes/class.ilObjUser.php';
7837 foreach ($members as $user_id)
7855 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
7856 array(
'integer',
'integer'),
7871 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_invited_user WHERE test_fi = %s AND user_fi = %s",
7872 array(
'integer',
'integer'),
7875 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_invited_user (test_fi, user_fi, clientip, tstamp) VALUES (%s, %s, %s, %s)",
7876 array(
'integer',
'integer',
'text',
'integer'),
7877 array($this->
getTestId(), $user_id, (strlen($client_ip)) ? $client_ip : NULL, time())
7886 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_invited_user SET clientip = %s, tstamp = %s WHERE test_fi=%s and user_fi=%s",
7887 array(
'text',
'integer',
'integer',
'integer'),
7888 array((strlen($client_ip)) ? $client_ip : NULL, time(), $this->
getTestId(), $user_id)
7900 if (is_numeric($question_fi))
7902 $result = $ilDB->queryF(
"SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s AND question_fi=%s",
7903 array(
'integer',
'integer'),
7904 array($active_id, $question_fi)
7909 $result = $ilDB->queryF(
"SELECT question_fi, solved FROM tst_qst_solved WHERE active_fi = %s",
7914 $result_array = array();
7917 $result_array[
$row[
"question_fi"]]=
$row;
7919 return $result_array;
7931 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_qst_solved WHERE active_fi = %s AND question_fi = %s",
7932 array(
'integer',
'integer'),
7933 array($active_id, $question_id)
7935 $affectedRows = $ilDB->manipulateF(
"INSERT INTO tst_qst_solved (solved, question_fi, active_fi) VALUES (%s, %s, %s)",
7936 array(
'integer',
'integer',
'integer'),
7937 array($value, $question_id, $active_id)
7948 $result = $ilDB->queryF(
"SELECT submitted FROM tst_active WHERE active_id=%s AND submitted=%s",
7949 array(
'integer',
'integer'),
7950 array($active_id, 1)
7952 return $result->numRows() == 1;
7963 if (!is_numeric($user_id))
7964 $user_id = $ilUser->getId();
7966 $result = $ilDB->queryF(
"SELECT submitted FROM tst_active WHERE test_fi=%s AND user_fi=%s AND submitted=%s",
7967 array(
'integer',
'integer',
'integer'),
7970 return $result->numRows() == 1;
8005 "user_id" => $this->lng->txt(
"user_id"),
8006 "matriculation" => $this->lng->txt(
"matriculation"),
8007 "lastname" => $this->lng->txt(
"lastname"),
8008 "firstname" => $this->lng->txt(
"firstname"),
8009 "login" =>$this->lng->txt(
"login"),
8010 "reached_points" => $this->lng->txt(
"tst_reached_points"),
8011 "max_points" => $this->lng->txt(
"tst_maximum_points"),
8012 "percent_value" => $this->lng->txt(
"tst_percent_solved"),
8013 "mark" => $this->lng->txt(
"tst_mark"),
8014 "ects" => $this->lng->txt(
"ects_grade")
8017 if (count($participants))
8023 foreach ($participants as $active_id => $user_rec)
8026 $reached_points = 0;
8028 foreach ($this->questions as $value)
8031 if (is_object($question))
8033 $max_points += $question->getMaximumPoints();
8034 $reached_points += $question->getReachedPoints($active_id);
8037 if ($max_points > 0)
8039 $percentvalue = $reached_points / $max_points;
8040 if ($percentvalue < 0) $percentvalue = 0.0;
8046 $mark_obj = $this->mark_schema->getMatchingMark($percentvalue * 100);
8050 $mark = $mark_obj->getOfficialName();
8051 $ects_mark = $this->
getECTSGrade($passed_array, $reached_points, $max_points);
8055 $user_rec[
'firstname'] =
"";
8056 $user_rec[
'lastname'] = $this->lng->txt(
"anonymous");
8059 "user_id"=>$user_rec[
'usr_id'],
8060 "matriculation" => $user_rec[
'matriculation'],
8061 "lastname" => $user_rec[
'lastname'],
8062 "firstname" => $user_rec[
'firstname'],
8063 "login"=>$user_rec[
'login'],
8064 "reached_points" => $reached_points,
8065 "max_points" => $max_points,
8066 "percent_value" => $percentvalue,
8068 "ects" => $ects_mark
8088 $resultarray = array();
8089 foreach (
$row as $rowindex => $entry)
8096 if (strpos($entry,
"\"") !== FALSE)
8098 $entry = str_replace(
"\"",
"\"\"", $entry);
8106 $entry = str_replace(chr(13).chr(10), chr(10), $entry);
8110 $entry =
"\"" . $entry .
"\"";
8113 $resultarray[$rowindex] = $entry;
8115 return $resultarray;
8129 $result = $ilDB->queryF(
"SELECT tries FROM tst_active WHERE active_id = %s",
8136 return $row[
"tries"];
8156 $result = $ilDB->queryF(
"SELECT MAX(pass) maxpass FROM tst_test_result WHERE active_fi = %s",
8163 $max =
$row[
"maxpass"];
8186 $result = $ilDB->queryF(
"SELECT * FROM tst_pass_result WHERE active_fi = %s",
8196 if(
$row[
"maxpoints"] > 0)
8198 $factor =
$row[
"points"] /
$row[
"maxpoints"];
8205 if($factor > $bestfactor)
8208 $bestfactor = $factor;
8211 if (is_array($bestrow))
8213 return $bestrow[
"pass"];
8236 $counted_pass = NULL;
8245 return $counted_pass;
8261 global $tree,
$ilDB,
$lng, $ilPluginAdmin;
8263 require_once
'Modules/Test/classes/class.ilTestSessionFactory.php';
8265 $testSession = $testSessionFactory->getSession($active_id);
8267 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
8271 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
8273 $dynamicQuestionSetConfig->loadFromDb();
8285 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
8287 foreach ($this->questions as $value)
8291 $workedthrough += 1;
8294 return $workedthrough;
8316 SELECT tst_pass_result.tstamp pass_res_tstamp,
8317 tst_test_result.tstamp quest_res_tstamp
8319 FROM tst_pass_result
8321 LEFT JOIN tst_test_result
8322 ON tst_test_result.active_fi = tst_pass_result.active_fi
8323 AND tst_test_result.pass = tst_pass_result.pass
8325 WHERE tst_pass_result.active_fi = %s
8326 AND tst_pass_result.pass = %s
8328 ORDER BY tst_test_result.tstamp DESC
8332 array(
'integer',
'integer'),
8333 array($active_id,
$pass)
8338 if(
$row[
'qres_tstamp'] )
8340 return $row[
'quest_res_tstamp'];
8343 return $row[
'pass_res_tstamp'];
8360 "executable" =>
true,
8361 "errormessage" =>
""
8365 $result[
"executable"] =
false;
8371 $result[
"executable"] =
false;
8400 $result[
"executable"] =
false;
8401 $result[
"errormessage"] = $this->lng->txt(
"detail_max_processing_time_reached");
8411 require_once
'Modules/Test/classes/class.ilTestPassesSelector.php';
8413 $testPassesSelector->setActiveId($active_id);
8414 $testPassesSelector->setLastFinishedPass(
$testSession->getLastFinishedPass());
8416 $closedPasses = $testPassesSelector->getClosedPasses();
8420 $result[
"executable"] =
false;
8421 $result[
"errormessage"] = $this->lng->txt(
"maximum_nr_of_tries_reached");
8441 if (preg_match(
"/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $this->
getReportingDate(), $matches))
8443 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
8445 if ($now < $epoch_time)
8461 $notimeleft = FALSE;
8490 if ($active_id < 1)
return FALSE;
8495 $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",
8496 array(
'integer',
'integer'),
8497 array($active_id,
$pass)
8502 if (preg_match(
"/(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})/",
$row[
"started"], $matches))
8504 return mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
8552 questtypes.type_tag,
8554 tstquest.obligatory,
8555 origquest.obj_fi orig_obj_fi
8557 FROM qpl_questions questions
8559 INNER JOIN qpl_qst_type questtypes
8560 ON questtypes.question_type_id = questions.question_type_fi
8562 INNER JOIN tst_test_question tstquest
8563 ON tstquest.question_fi = questions.question_id
8565 LEFT JOIN qpl_questions origquest
8566 ON origquest.question_id = questions.original_id
8568 WHERE tstquest.test_fi = %s
8570 ORDER BY tstquest.sequence
8573 $query_result = $ilDB->queryF(
8579 while (
$row = $ilDB->fetchAssoc($query_result))
8594 public function getPotentialRandomTestQuestions()
8603 questtypes.type_tag,
8604 origquest.obj_fi orig_obj_fi
8606 FROM qpl_questions questions
8608 INNER JOIN qpl_qst_type questtypes
8609 ON questtypes.question_type_id = questions.question_type_fi
8611 INNER JOIN tst_rnd_cpy tstquest
8612 ON tstquest.qst_fi = questions.question_id
8614 LEFT JOIN qpl_questions origquest
8615 ON origquest.question_id = questions.original_id
8617 WHERE tstquest.tst_fi = %s
8620 $query_result = $ilDB->queryF(
8626 while (
$row = $ilDB->fetchAssoc($query_result))
8646 return ($this->shuffle_questions) ? 1 : 0;
8657 $this->shuffle_questions = ($a_shuffle) ? 1 : 0;
8674 return ($this->show_summary) ? $this->show_summary : 0;
8691 $this->show_summary = $a_value;
8702 if (($this->show_summary & 1) > 0)
8722 $this->show_summary = 1;
8726 $this->show_summary = 0;
8738 if (($this->show_summary & 2) > 0)
8758 $this->show_summary = $this->show_summary | 2;
8764 $this->show_summary = $this->show_summary ^ 2;
8777 if (($this->show_summary & 4) > 0)
8797 $this->show_summary = $this->show_summary | 4;
8803 $this->show_summary = $this->show_summary ^ 4;
8816 if (($this->show_summary & 8) > 0)
8836 $this->show_summary = $this->show_summary | 8;
8842 $this->show_summary = $this->show_summary ^ 8;
8855 return ($this->results_presentation) ? $this->results_presentation : 0;
8866 if (($this->results_presentation & 1) > 0)
8884 if (($this->results_presentation & 2) > 0)
8902 if (($this->results_presentation & 4) > 0)
8920 if (($this->results_presentation & 8) > 0)
8938 if (($this->results_presentation & 16) > 0)
8956 if (($this->results_presentation & 32) > 0)
8972 if (($this->results_presentation & 64) > 0)
8988 if(($this->results_presentation & 128) > 0)
9006 $this->results_presentation = $a_results_presentation;
9021 $this->results_presentation = $this->results_presentation | 1;
9027 $this->results_presentation = $this->results_presentation ^ 1;
9042 $this->results_presentation = $this->results_presentation | 2;
9048 $this->results_presentation = $this->results_presentation ^ 2;
9074 $this->results_presentation = $this->results_presentation | 4;
9080 $this->results_presentation = $this->results_presentation ^ 4;
9095 $this->results_presentation = $this->results_presentation | 8;
9101 $this->results_presentation = $this->results_presentation ^ 8;
9116 $this->results_presentation = $this->results_presentation | 16;
9122 $this->results_presentation = $this->results_presentation ^ 16;
9137 $this->results_presentation = $this->results_presentation | 32;
9143 $this->results_presentation = $this->results_presentation ^ 32;
9158 $this->results_presentation = $this->results_presentation | 64;
9164 $this->results_presentation = $this->results_presentation ^ 64;
9178 $this->results_presentation = $this->results_presentation | 128;
9184 $this->results_presentation = $this->results_presentation ^ 128;
9195 $result = $ilDB->queryF(
"SELECT user_fi FROM tst_active WHERE active_id = %s",
9202 return $row[
"user_fi"];
9228 return ($this->allowedUsers) ? $this->allowedUsers : 0;
9233 $this->allowedUsers = $a_allowed_users;
9238 return ($this->allowedUsersTimeGap) ? $this->allowedUsersTimeGap : 0;
9243 $this->allowedUsersTimeGap = $a_allowed_users_time_gap;
9252 if (($nr_of_users > 0) && ($time_gap > 0))
9255 $time_border = $now - $time_gap;
9256 $str_time_border = strftime(
"%Y%m%d%H%M%S", $time_border);
9258 SELECT DISTINCT tst_times.active_fi
9260 INNER JOIN tst_active
9261 ON tst_times.active_fi = tst_active.active_id
9263 tst_times.pass > tst_active.last_finished_pass OR tst_active.last_finished_pass IS NULL
9265 WHERE tst_times.tstamp > %s
9266 AND tst_active.test_fi = %s
9269 if (
$result->numRows() >= $nr_of_users)
9271 include_once
"./Modules/Test/classes/class.ilObjAssessmentFolder.php";
9290 $result = $ilDB->queryF(
"SELECT finished FROM tst_times WHERE active_fi = %s ORDER BY finished DESC",
9297 return $row[
"finished"];
9311 if (preg_match(
"/<[^>]*?>/", $a_text))
9331 for ($i = 0; $i < $a_material->getMaterialCount(); $i++)
9333 $material = $a_material->getMaterial($i);
9334 if (strcmp($material[
"type"],
"mattext") == 0)
9336 $result .= $material[
"material"]->getContent();
9338 if (strcmp($material[
"type"],
"matimage") == 0)
9340 $matimage = $material[
"material"];
9341 if (preg_match(
"/(il_([0-9]+)_mob_([0-9]+))/", $matimage->getLabel(), $matches))
9344 if (!is_array(
$_SESSION[
"import_mob_xhtml"]))
$_SESSION[
"import_mob_xhtml"] = array();
9345 array_push(
$_SESSION[
"import_mob_xhtml"], array(
"mob" => $matimage->getLabel(),
"uri" => $matimage->getUri()));
9350 $ilLog->write(print_r(
$_SESSION[
"import_mob_xhtml"],
true));
9364 include_once
"./Services/RTE/classes/class.ilRTE.php";
9365 include_once(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php");
9367 $a_xml_writer->xmlStartTag(
"material");
9369 "texttype" =>
"text/plain"
9371 if ($this->
isHTML($a_material))
9373 $attrs[
"texttype"] =
"text/xhtml";
9378 foreach (
$mobs as $mob)
9380 $moblabel =
"il_" . IL_INST_ID .
"_mob_" . $mob;
9381 if (strpos($a_material,
"mm_$mob") !== FALSE)
9387 "label" => $moblabel,
9388 "uri" =>
"objects/" .
"il_" . IL_INST_ID .
"_mob_" . $mob .
"/" . $mob_obj->getTitle()
9391 $a_xml_writer->xmlElement(
"matimage", $imgattrs, NULL);
9394 $a_xml_writer->xmlEndTag(
"material");
9405 include_once
"./Services/Utilities/classes/class.ilUtil.php";
9419 $affectedRows = $ilDB->manipulateF(
"UPDATE tst_tests SET certificate_visibility = %s, tstamp = %s WHERE test_id = %s",
9420 array(
'text',
'integer',
'integer'),
9421 array($a_value, time(), $this->
getTestId())
9433 return (strlen($this->certificate_visibility)) ? $this->certificate_visibility : 0;
9444 $this->certificate_visibility = $a_value;
9455 return ($this->anonymity) ? 1 : 0;
9469 $this->anonymity = 1;
9472 $this->anonymity = 0;
9485 return ($this->show_cancel) ? 1 : 0;
9499 $this->show_cancel = 1;
9502 $this->show_cancel = 0;
9515 return ($this->show_marker) ? 1 : 0;
9529 $this->show_marker = 1;
9532 $this->show_marker = 0;
9545 return ($this->fixed_participants) ? 1 : 0;
9559 $this->fixed_participants = 1;
9562 $this->fixed_participants = 0;
9578 $result = $ilDB->queryF(
"SELECT anonymity FROM tst_tests WHERE obj_fi = %s",
9584 return $row[
'anonymity'];
9600 SELECT tst_tests.question_set_type
9602 INNER JOIN tst_tests
9603 ON tst_active.test_fi = tst_tests.test_id
9604 WHERE tst_active.active_id = %s
9607 $res = $ilDB->queryF(
$query, array(
'integer'), array($active_id) );
9609 while(
$row = $ilDB->fetchAssoc(
$res))
9611 return $row[
'question_set_type'];
9627 throw new Exception(__METHOD__.
' is deprecated ... use ilObjTest::lookupQuestionSetTypeByActiveId() instead!');
9631 $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",
9637 return $row[
'random_test'];
9656 return $this->lng->txt(
"anonymous") . $suffix;
9660 include_once
'./Services/User/classes/class.ilObjUser.php';
9662 if (strlen($uname[
"firstname"].$uname[
"lastname"]) == 0) $uname[
"firstname"] = $this->lng->txt(
"deleted_user");
9665 return trim($uname[
"lastname"] .
", " . $uname[
"firstname"]) . $suffix;
9669 return trim($uname[
"firstname"] .
" " . $uname[
"lastname"]) . $suffix;
9685 return $this->lng->txt(
"tst_start_test");
9687 $active_pass = $this->
_getPass($active_id);
9691 if ($active_pass == 0)
9693 return $this->lng->txt(
"tst_start_test");
9697 return $this->lng->txt(
"tst_start_new_test_pass");
9702 return $this->lng->txt(
"tst_resume_test");
9711 public function getAvailableDefaults()
9720 "SELECT * FROM tst_test_defaults WHERE user_fi = %s ORDER BY name ASC",
9722 array($ilUser->getId())
9724 $defaults = array();
9727 $defaults[
$row[
"test_defaults_id"]] =
$row;
9748 $result = $ilDB->queryF(
"SELECT * FROM tst_test_defaults WHERE test_defaults_id = %s",
9750 array($test_defaults_id)
9772 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_test_defaults WHERE test_defaults_id = %s",
9774 array($test_default_id)
9788 $testsettings = array(
9879 $next_id = $ilDB->nextId(
'tst_test_defaults');
9881 'tst_test_defaults',
9883 'test_defaults_id' => array(
'integer', $next_id),
9884 'name' => array(
'text', $a_name),
9885 'user_fi' => array(
'integer', $ilUser->getId()),
9886 'defaults' => array(
'clob', serialize($testsettings)),
9887 'marks' => array(
'clob', serialize($this->mark_schema)),
9888 'tstamp' => array(
'integer', time())
9902 $testsettings = unserialize($test_defaults[
"defaults"]);
9903 include_once
"./Modules/Test/classes/class.assMarkSchema.php";
9904 $this->mark_schema = unserialize($test_defaults[
"marks"]);
9938 $this->
setKiosk($testsettings[
"Kiosk"]);
9942 $this->
setECTSFX($testsettings[
"ECTSFX"]);
9944 if( isset($testsettings[
"isRandomTest"]) )
9946 if( $testsettings[
"isRandomTest"] )
9955 elseif( isset($testsettings[
"questionSetType"]) )
9978 if( isset($testsettings[
'examid_in_kiosk']) )
9986 if( isset($testsettings[
'show_exam_id']) )
10040 if (extension_loaded(
"tidy"))
10044 "output-xml" =>
true,
10045 "numeric-entities" =>
true
10047 $tidy =
new tidy();
10048 $tidy->parseString($print_output, $config,
'utf8');
10049 $tidy->cleanRepair();
10050 $print_output = tidy_get_output($tidy);
10051 $print_output = preg_replace(
"/^.*?(<html)/",
"\\1", $print_output);
10055 $print_output = str_replace(
" ",
" ", $print_output);
10056 $print_output = str_replace(
"⊗",
"X", $print_output);
10058 $xsl = file_get_contents(
"./Modules/Test/xml/question2fo.xsl");
10061 $xsl = str_replace(
10062 'font-family="Helvetica, unifont"',
10063 'font-family="'.
$GLOBALS[
'ilSetting']->
get(
'rpc_pdf_font',
'Helvetica, unifont').
'"',
10067 $args = array(
'/_xml' => $print_output,
'/_xsl' => $xsl );
10070 $output = xslt_process($xh,
"arg:/_xml",
"arg:/_xsl", NULL, $args, $params);
10084 $content = preg_replace(
"/href=\".*?\"/",
"", $content);
10085 $printbody =
new ilTemplate(
"tpl.il_as_tst_print_body.html", TRUE, TRUE,
"Modules/Test");
10087 $printbody->setVariable(
"ADM_CONTENT", $content);
10088 $printbody->setCurrentBlock(
"css_file");
10090 $printbody->parseCurrentBlock();
10091 $printbody->setCurrentBlock(
"css_file");
10093 $printbody->parseCurrentBlock();
10094 $printoutput = $printbody->get();
10095 $html = str_replace(
"href=\"./",
"href=\"" . ILIAS_HTTP_PATH .
"/", $printoutput);
10096 $html = preg_replace(
"/<div id=\"dontprint\">.*?<\\/div>/ims",
"", $html);
10097 if (extension_loaded(
"tidy"))
10101 "output-xml" =>
true,
10102 "numeric-entities" =>
true
10104 $tidy =
new tidy();
10105 $tidy->parseString($html, $config,
'utf8');
10106 $tidy->cleanRepair();
10107 $html = tidy_get_output($tidy);
10108 $html = preg_replace(
"/^.*?(<html)/",
"\\1", $html);
10112 $html = str_replace(
" ",
" ", $html);
10113 $html = str_replace(
"⊗",
"X", $html);
10115 $html = preg_replace(
"/src=\".\\//ims",
"src=\"" . ILIAS_HTTP_PATH .
"/", $html);
10129 include_once
"./Services/Utilities/classes/class.ilUtil.php";
10131 $fp = fopen($fo_file,
"w"); fwrite($fp, $fo); fclose($fp);
10133 include_once
'./Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
10143 $ilLog->write(__METHOD__.
': '.$e->getMessage());
10148 $ilLog->write(__METHOD__.
': '.$e->getMessage());
10175 $result = $ilDB->queryF(
"SELECT feedback FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
10176 array(
'integer',
'integer',
'integer'),
10177 array($active_id, $question_id,
$pass)
10182 include_once(
"./Services/RTE/classes/class.ilRTE.php");
10198 function saveManualFeedback($active_id, $question_id,
$pass, $feedback)
10202 $affectedRows = $ilDB->manipulateF(
"DELETE FROM tst_manual_fb WHERE active_fi = %s AND question_fi = %s AND pass = %s",
10203 array(
'integer',
'integer',
'integer'),
10204 array($active_id, $question_id,
$pass)
10207 if (strlen($feedback))
10209 $next_id = $ilDB->nextId(
'tst_manual_fb');
10211 $result = $ilDB->insert(
'tst_manual_fb', array(
10212 'manual_feedback_id' => array(
'integer', $next_id ),
10213 'active_fi' => array(
'integer', $active_id ),
10214 'question_fi' => array(
'integer', $question_id ),
10215 'pass' => array(
'integer',
$pass),
10217 'tstamp' => array(
'integer', time() ),
10220 include_once (
"./Modules/Test/classes/class.ilObjAssessmentFolder.php");
10224 include_once
"./Modules/Test/classes/class.ilObjTestAccess.php";
10226 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
10233 $ilias->raiseError(
$result->getMessage());
10261 include_once
"./Modules/Test/classes/class.ilTestSequence.php";
10272 $this->test_id = $a_id;
10286 if (count($participants))
10288 foreach ($participants as $active_id => $user_rec)
10291 $reached_points = 0;
10293 foreach ($this->questions as $value)
10296 if (is_object($question))
10298 $max_points += $question->getMaximumPoints();
10299 $reached_points += $question->getReachedPoints($active_id);
10300 if ($max_points > 0)
10302 $percentvalue = $reached_points / $max_points;
10303 if ($percentvalue < 0) $percentvalue = 0.0;
10311 $user_rec[
'firstname'] =
"";
10312 $user_rec[
'lastname'] = $this->lng->txt(
"anonymous");
10315 "user_id"=>$user_rec[
'usr_id'],
10316 "matriculation" => $user_rec[
'matriculation'],
10317 "lastname" => $user_rec[
'lastname'],
10318 "firstname" => $user_rec[
'firstname'],
10319 "login"=>$user_rec[
'login'],
10320 "question_id" => $question->getId(),
10321 "question_title" => $question->getTitle(),
10322 "reached_points" => $reached_points,
10323 "max_points" => $max_points
10340 $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",
10344 $rec = $ilDB->fetchAssoc(
$result);
10345 return $rec[
"obj_id"];
10356 global $ilPluginAdmin;
10357 if ($ilPluginAdmin->isActive(
IL_COMP_MODULE,
"TestQuestionPool",
"qst", $a_pname))
10371 $result = $ilDB->queryF(
"SELECT passed FROM tst_result_cache WHERE active_fi = %s",
10378 return $row[
'passed'];
10383 $result_array =& $this->
getTestResult($active_id, $counted_pass);
10384 return $result_array[
"test"][
"passed"];
10397 include_once
"./Services/Certificate/classes/class.ilCertificate.php";
10398 include_once
"./Modules/Test/classes/class.ilTestCertificateAdapter.php";
10400 if ($cert->isComplete())
10442 public function getParticipantsForTestAndQuestion(
$test_id, $question_id)
10448 SELECT tst_test_result.active_fi, tst_test_result.question_fi, tst_test_result.pass
10449 FROM tst_test_result, tst_active, qpl_questions
10450 WHERE tst_active.active_id = tst_test_result.active_fi
10451 AND tst_active.test_fi = %s
10452 AND tst_test_result.question_fi = qpl_questions.question_id
10453 AND tst_test_result.question_fi = %s";
10456 array(
'integer',
'integer'),
10459 $foundusers = array();
10463 if (!array_key_exists(
$row[
"active_fi"], $foundusers))
10465 $foundusers[
$row[
"active_fi"]] = array();
10467 array_push($foundusers[
$row[
"active_fi"]], array(
"pass" => $row[
"pass"],
"qid" => $row[
"question_fi"]));
10469 return $foundusers;
10480 $foundParticipants =& $data->getParticipants();
10481 $results = array(
"overview" => array(),
"questions" => array());
10482 if (count($foundParticipants))
10484 $results[
"overview"][$this->lng->txt(
"tst_eval_total_persons")] = count($foundParticipants);
10486 $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished")] = $total_finished;
10488 $diff_seconds = $average_time;
10489 $diff_hours = floor($diff_seconds/3600);
10490 $diff_seconds -= $diff_hours * 3600;
10491 $diff_minutes = floor($diff_seconds/60);
10492 $diff_seconds -= $diff_minutes * 60;
10493 $results[
"overview"][$this->lng->txt(
"tst_eval_total_finished_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
10495 $total_passed_reached = 0;
10496 $total_passed_max = 0;
10497 $total_passed_time = 0;
10498 foreach ($foundParticipants as $userdata)
10500 if ($userdata->getPassed())
10503 $total_passed_reached += $userdata->getReached();
10504 $total_passed_max += $userdata->getMaxpoints();
10505 $total_passed_time += $userdata->getTimeOfWork();
10508 $average_passed_reached = $total_passed ? $total_passed_reached / $total_passed : 0;
10509 $average_passed_max = $total_passed ? $total_passed_max / $total_passed : 0;
10510 $average_passed_time = $total_passed ? $total_passed_time / $total_passed : 0;
10511 $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed")] = $total_passed;
10512 $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);
10513 $average_time = $average_passed_time;
10514 $diff_seconds = $average_time;
10515 $diff_hours = floor($diff_seconds/3600);
10516 $diff_seconds -= $diff_hours * 3600;
10517 $diff_minutes = floor($diff_seconds/60);
10518 $diff_seconds -= $diff_minutes * 60;
10519 $results[
"overview"][$this->lng->txt(
"tst_eval_total_passed_average_time")] = sprintf(
"%02d:%02d:%02d", $diff_hours, $diff_minutes, $diff_seconds);
10522 foreach ($data->getQuestionTitles() as $question_id => $question_title)
10527 foreach ($foundParticipants as $userdata)
10529 for ($i = 0; $i <= $userdata->getLastPass(); $i++)
10531 if (is_object($userdata->getPass($i)))
10533 $question =& $userdata->getPass($i)->getAnsweredQuestionByQuestionId($question_id);
10534 if (is_array($question))
10537 $reached += $question[
"reached"];
10538 $max += $question[
"points"];
10543 $percent = $max ? $reached/$max * 100.0 : 0;
10545 $results[
"questions"][$question_id] = array(
10547 sprintf(
"%.2f", $answered ? $reached / $answered : 0) .
" " . strtolower($this->lng->txt(
"of")) .
" " . sprintf(
"%.2f", $answered ? $max / $answered : 0),
10548 sprintf(
"%.2f", $percent) .
"%",
10550 sprintf(
"%.2f", $answered ? $reached / $answered : 0),
10551 sprintf(
"%.2f", $answered ? $max / $answered : 0),
10563 include_once(
"./Modules/Test/classes/class.ilTestExport.php");
10565 return $test_exp->buildExportFile();
10583 $this->mailnotification = $a_notification;
10588 include_once
"./Modules/Test/classes/class.ilTestMailNotification.php";
10593 $mail->sendSimpleNotification($owner_id, $this->
getTitle(), $usr_data);
10603 include_once
"./Modules/Test/classes/class.ilObjTestGUI.php";
10604 include_once
"./Modules/Test/classes/tables/class.ilEvaluationAllTableGUI.php";
10606 return $table_gui->getSelectedColumns();
10611 include_once
"./Modules/Test/classes/class.ilTestMailNotification.php";
10617 include_once
"./Modules/Test/classes/class.ilTestExport.php";
10619 $file = $exportObj->exportToExcel($deliver = FALSE,
'active_id', $active_id, $passedonly = FALSE);
10620 include_once
"./Services/Mail/classes/class.ilFileDataMail.php";
10622 $fd->copyAttachmentFile($file,
"result_" . $active_id .
".xls");
10623 $file_names[] =
"result_" . $active_id .
".xls";
10625 $mail->sendAdvancedNotification($owner_id, $this->
getTitle(), $usr_data, $file_names);
10627 if(count($file_names))
10629 $fd->unlinkFiles($file_names);
10640 $query =
"SELECT usr_id FROM usr_data";
10642 while ($data = $ilDB->fetchAssoc(
$result))
10644 $activequery = sprintf(
"SELECT user_fi FROM tst_active WHERE test_fi = %s AND user_fi = %s",
10645 $ilDB->quote($this->getTestId()),
10646 $ilDB->quote($data[
'usr_id'])
10648 $activeresult = $ilDB->query($activequery);
10649 if ($activeresult->numRows() == 0)
10651 $user_id = $data[
'usr_id'];
10652 if ($user_id != 13)
10654 include_once
"./Modules/Test/classes/class.ilTestSession.php";
10662 $nr_of_passes = rand(1, $passes);
10666 include_once
"./Modules/Test/classes/class.ilTestSequence.php";
10673 for ($seq = 1; $seq <= count($this->questions); $seq++)
10675 $question_id =
$testSequence->getQuestionForSequence($seq);
10679 if (
$pass < $nr_of_passes - 1)
10688 $testSession->setSubmittedTimestamp(date(
'Y-m-d H:i:s'));
10693 if ($number == 0)
return;
10705 FROM tst_result_cache
10706 WHERE active_fi = %s
10710 $query, array(
'integer'), array($active_id)
10715 include_once
"./Modules/TestQuestionPool/classes/class.assQuestion.php";
10721 FROM tst_result_cache
10722 WHERE active_fi = %s
10726 $query, array(
'integer'), array($active_id)
10738 if ($this->mailnottype == 1)
10752 $this->mailnottype = 1;
10756 $this->mailnottype = 0;
10762 if ($this->exportsettings)
10776 $this->exportsettings = $a_settings;
10780 $this->exportsettings = 0;
10786 if (($this->exportsettings & 1) > 0)
10800 $this->exportsettings = $this->exportsettings | 1;
10806 $this->exportsettings = $this->exportsettings ^ 1;
10812 return $this->enabled_view_mode;
10816 $this->enabled_view_mode = $mode;
10828 $new_array = array();
10831 $query =
'SELECT question_fi FROM tst_test_question WHERE test_fi = %s';
10832 $types = array(
'integer');
10835 $new_question_id += 1;
10839 $res = $ilDB->queryF(
$query, $types, $values);
10840 while(
$row = $ilDB->fetchAssoc(
$res)) {
10842 $qid =
$row[
'question_fi'];
10844 if ($qid == $new_question_id) {
10847 else if ($qid == $previous_question_id) {
10848 $new_array[$position++] = $qid;
10849 $new_array[$position++] = $new_question_id;
10853 $new_array[$position++] = $qid;
10857 $update_query =
'UPDATE tst_test_question SET sequence = %s WHERE test_fi = %s AND question_fi = %s';
10858 $update_types = array(
'integer',
'integer',
'integer');
10860 foreach($new_array as $position => $qid) {
10861 $ilDB->manipulateF(
10895 'pass_details' =>
'setShowPassDetails',
10896 'solution_details' =>
'setShowSolutionDetails',
10897 'solution_printview' =>
'setShowSolutionPrintview',
10898 'solution_feedback' =>
'setShowSolutionFeedback',
10899 'solution_answers_only' =>
'setShowSolutionAnswersOnly',
10900 'solution_signature' =>
'setShowSolutionSignature',
10901 'solution_suggested' =>
'setShowSolutionSuggested',
10903 foreach($setter as $key => $setter) {
10918 $this->poolUsage = (boolean)$usage;
10929 foreach($orders as
$id => $position)
10934 isset($obligations[
$id]) && $obligations[
$id] ? 1 : 0
10938 UPDATE tst_test_question
10941 WHERE question_fi = %s
10944 $ilDB->manipulateF(
10945 $query, array(
'integer',
'integer',
'integer'), array($i, $obligatory, $id)
10955 if ($question_before) {
10956 $query =
'SELECT sequence, test_fi FROM tst_test_question WHERE question_fi = %s';
10957 $types = array(
'integer');
10958 $values = array($question_before);
10959 $rset = $ilDB->queryF(
$query, $types, $values);
10962 if (!$question_before || ($rset && !(
$row = $ilDB->fetchAssoc($rset)))) {
10969 $update =
'UPDATE tst_test_question SET sequence = sequence + 1 WHERE sequence > %s AND test_fi = %s';
10970 $types = array(
'integer',
'integer');
10971 $values = array(
$row[
'sequence'],
$row[
'test_fi']);
10972 $ilDB->manipulateF($update, $types, $values);
10974 $update =
'UPDATE tst_test_question SET sequence = %s WHERE question_fi = %s';
10975 $types = array(
'integer',
'integer');
10976 $values = array(
$row[
'sequence'] + 1, $question_to_move);
10977 $ilDB->manipulateF($update, $types, $values);
10987 $IN_questions = $ilDB->in(
'q1.question_id', array_keys(
$questions),
false,
'integer');
10990 SELECT count(q1.question_id) cnt
10992 FROM qpl_questions q1
10994 INNER JOIN qpl_questions q2
10995 ON q2.question_id = q1.original_id
10997 WHERE $IN_questions
10998 AND q1.obj_fi = q2.obj_fi
11001 $rset = $ilDB->query(
$query);
11003 $row = $ilDB->fetchAssoc($rset);
11005 return $row[
'cnt'] > 0;
11018 $result = $ilDB->queryF(
"SELECT test_fi,MAX(pass) AS pass FROM tst_active".
11019 " JOIN tst_pass_result ON (tst_pass_result.active_fi = tst_active.active_id)".
11020 " WHERE user_fi=%s".
11021 " GROUP BY test_fi",
11022 array(
'integer',
'integer'),
11023 array($a_user_id, 1)
11029 $all[$obj_id] = (bool)
$row[
"pass"];
11045 $this->online = (bool)$a_online;
11050 $this->print_best_solution_with_result = (bool) $status;
11080 $this->activation_visibility = (bool) $a_value;
11090 return (
bool)$this->activation_limited;
11095 $this->activation_limited = (bool)$a_value;
11107 $this->_highscore_enabled = (bool)$a_enabled;
11117 return (
bool) $this->_highscore_enabled;
11129 $this->_highscore_anon = (bool)$a_anon;
11143 return (
bool) $this->_highscore_anon;
11173 $this->_highscore_achieved_ts = (bool)$a_achieved_ts;
11183 return (
bool) $this->_highscore_achieved_ts;
11193 $this->_highscore_score = (bool)$a_score;
11203 return (
bool) $this->_highscore_score;
11213 $this->_highscore_percentage = (bool)$a_percentage;
11223 return (
bool) $this->_highscore_percentage;
11233 $this->_highscore_hints = (bool)$a_hints;
11243 return (
bool) $this->_highscore_hints;
11253 $this->_highscore_wtime = (bool)$a_wtime;
11263 return (
bool) $this->_highscore_wtime;
11273 $this->_highscore_own_table = (bool)$a_own_table;
11283 return (
bool) $this->_highscore_own_table;
11293 $this->_highscore_top_table = (bool)$a_top_table;
11303 return (
bool) $this->_highscore_top_table;
11314 $this->_highscore_top_num = (int)$a_top_num;
11327 $retval = $a_retval;
11328 if ( (
int) $this->_highscore_top_num != 0)
11330 $retval = $this->_highscore_top_num;
11365 case self::HIGHSCORE_SHOW_ALL_TABLES:
11370 case self::HIGHSCORE_SHOW_TOP_TABLE:
11375 case self::HIGHSCORE_SHOW_OWN_TABLE:
11386 switch ($specific_answer_feedback)
11389 $this->specific_answer_feedback = 1;
11392 $this->specific_answer_feedback = 0;
11399 switch ($this->specific_answer_feedback)
11436 require_once(
'Modules/TestQuestionPool/classes/class.assQuestion.php');
11444 $obligationPossible = call_user_func(array($classConcreteQuestion,
'isObligationPossible'), $questionId);
11446 return $obligationPossible;
11459 $rset = $ilDB->queryF(
'SELECT obligatory FROM tst_test_question WHERE question_fi = %s', array(
'integer'), array($question_id));
11461 if(
$row = $ilDB->fetchAssoc($rset) )
11463 return (
bool)
$row[
'obligatory'];
11485 $rset = $ilDB->queryF(
11486 'SELECT obligations_answered FROM tst_pass_result WHERE active_fi = %s AND pass = %s',
11487 array(
'integer',
'integer'),
11488 array($active_id,
$pass)
11491 if(
$row = $ilDB->fetchAssoc($rset) )
11493 return (
bool)
$row[
'obligations_answered'];
11511 $rset = $ilDB->queryF(
11512 'SELECT count(*) cnt FROM tst_test_question WHERE test_fi = %s AND obligatory = 1',
11516 $row = $ilDB->fetchAssoc($rset);
11518 return (
bool)
$row[
'cnt'] > 0;
11561 #region Examview / PDF Examview
11624 return (strlen($this->activation_starting_time)) ? $this->activation_starting_time : NULL;
11629 return (strlen($this->activation_ending_time)) ? $this->activation_ending_time : NULL;
11637 $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");
11640 $times[
$row[
'active_fi']] = $row[
'started'];
11650 $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",
11656 $times[
$row[
'active_fi']] = $row[
'additionaltime'];
11665 $result = $ilDB->queryF(
"SELECT additionaltime FROM tst_addtime WHERE active_fi = %s",
11672 return $row[
'additionaltime'];
11681 $participants = array();
11682 if ($active_id == 0)
11684 $result = $ilDB->queryF(
"SELECT active_id FROM tst_active WHERE test_fi = %s",
11690 array_push($participants,
$row[
'active_id']);
11695 array_push($participants, $active_id);
11697 foreach ($participants as $active_id)
11699 $result = $ilDB->queryF(
"SELECT active_fi FROM tst_addtime WHERE active_fi = %s",
11705 $ilDB->manipulateF(
"DELETE FROM tst_addtime WHERE active_fi = %s",
11711 $ilDB->manipulateF(
"UPDATE tst_active SET tries = %s, submitted = %s, submittimestamp = %s WHERE active_id = %s",
11712 array(
'integer',
'integer',
'timestamp',
'integer'),
11713 array(0, 0, NULL, $active_id)
11716 $ilDB->manipulateF(
"INSERT INTO tst_addtime (active_fi, additionaltime, tstamp) VALUES (%s, %s, %s)",
11717 array(
'integer',
'integer',
'integer'),
11718 array($active_id, $minutes, time())
11721 require_once
'Modules/Test/classes/class.ilObjAssessmentFolder.php';
11748 public function getMaxPassOfTest()
11756 SELECT MAX(tst_pass_result.pass) + 1 max_res
11757 FROM tst_pass_result
11758 INNER JOIN tst_active ON tst_active.active_id = tst_pass_result.active_fi
11759 WHERE test_fi = '.$ilDB->quote($this->
getTestId(),
'integer').
'
11762 $data = $ilDB->fetchAssoc(
$res);
11763 return (
int)$data[
'max_res'];
11776 $exam_id_query =
'SELECT exam_id FROM tst_pass_result WHERE active_fi = %s AND pass = %s';
11777 $exam_id_result = $ilDB->queryF( $exam_id_query, array(
'integer',
'integer' ), array( $active_id,
$pass ) );
11778 if ($ilDB->numRows( $exam_id_result ) == 1)
11780 $exam_id_row = $ilDB->fetchAssoc( $exam_id_result );
11782 if ($exam_id_row[
'exam_id'] != null)
11784 return $exam_id_row[
'exam_id'];
11802 $inst_id = $ilSetting->get(
'inst_id', null );
11804 if($test_obj_id === null)
11810 $obj_id = $test_obj_id;
11813 $examId =
'I' . $inst_id .
'_T' . $obj_id .
'_A' . $active_id .
'_P' .
$pass;
11865 $this->char_selector_availability = (int) $availability;
11881 $this->char_selector_definition = $definition;
11924 $query =
"SELECT question_set_type FROM tst_tests WHERE obj_fi = %s";
11926 $res = $ilDB->queryF(
$query, array(
'integer'), array($objId));
11930 while(
$row = $ilDB->fetchAssoc(
$res) )
11985 return $lng->
txt(
'tst_question_set_type_fixed');
11988 return $lng->
txt(
'tst_question_set_type_random');
11991 return $lng->
txt(
'tst_question_set_type_dynamic');
12024 require_once
'class.ilTestScoring.php';
12026 $scoring->setPreserveManualScores($preserve_manscoring);
12027 $scoring->recalculateSolutions();
12032 require_once
'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
12034 $questionChangeListeners = array(
12038 return $questionChangeListeners;
12048 INNER JOIN tst_tests
12049 ON test_id = test_fi
12053 $res = $ilDB->queryF(
$query, array(
'integer'), array($userId));
12057 while(
$row = $ilDB->fetchAssoc(
$res) )
12059 $objIds[] = (int)
$row[
'obj_fi'];
12092 if( !self::isSkillManagementGloballyActivated() )
12104 if( self::$isSkillManagementGloballyActivated === null )
12106 include_once
'Services/Skill/classes/class.ilSkillManagementSettings.php';
12109 self::$isSkillManagementGloballyActivated = $skmgSet->isActivated();
12154 $activeId = $testOBJ->getActiveIdOfUser($userId);
12156 require_once
'Modules/Test/classes/class.ilTestSessionFactory.php';
12159 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
12162 $testSession = $testSessionFactory->getSession($activeId);
12167 if($a_force_new_run)
12188 $activeId = $testOBJ->getActiveIdOfUser($userId);
12190 require_once
'Modules/Test/classes/class.ilTestSessionFactory.php';
12193 $testSessionFactory->reset();
12195 require_once
'Modules/Test/classes/class.ilTestSequenceFactory.php';
12198 $testSession = $testSessionFactory->getSession($activeId);