4 include_once
'./Modules/Course/classes/Objectives/class.ilLOSettings.php';
5 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
35 $this->logger =
$GLOBALS[
'DIC']->logger()->crs();
37 $this->user_id = $a_user_id;
38 $this->container_id = $a_course_id;
66 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestAssignments.php';
69 include_once
'./Modules/Course/classes/class.ilCourseObjective.php';
72 $relevant_objective_ids =
array();
73 if (!$this->
getSettings()->hasSeparateInitialTests()) {
74 if ($a_tst_ref_id == $this->
getSettings()->getInitialTest()) {
75 $relevant_objective_ids = $objective_ids;
77 } elseif (!$this->
getSettings()->hasSeparateQualifiedTests()) {
78 if ($a_tst_ref_id == $this->
getSettings()->getQualifiedTest()) {
79 $relevant_objective_ids = $objective_ids;
83 foreach ((
array) $objective_ids as $objective_id) {
85 if ($assigned_itest == $a_tst_ref_id) {
86 $relevant_objective_ids[] = $objective_id;
89 if ($assigned_qtest == $a_tst_ref_id) {
90 $relevant_objective_ids[] = $objective_id;
94 $relevant_objective_ids = array_unique($relevant_objective_ids);
96 if (count($relevant_objective_ids) <= 1) {
97 return $relevant_objective_ids;
101 $test_type =
$assignments->getTypeByTest($a_tst_ref_id);
103 $passed_objectives =
array();
104 include_once
'./Modules/Course/classes/Objectives/class.ilLOUserResults.php';
107 $passed =
$results->getCompletedObjectiveIds();
108 $this->logger->debug(
'Passed objectives are ' . print_r($passed,
true) .
' for test type: ' . $test_type);
112 if (count($passed) >= count($relevant_objective_ids)) {
113 return $relevant_objective_ids;
117 foreach ($relevant_objective_ids as $objective_id) {
118 if (!in_array($objective_id, $passed)) {
119 $unpassed[] = $objective_id;
138 $this->logger->debug(
'Notify test start: ' . print_r($relevant_objectives,
true));
141 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestRun.php';
148 foreach ((
array) $relevant_objectives as $oid) {
149 $this->logger->debug(
'Adding new run for objective with id: ' . $oid);
170 $this->logger->debug(
'Prepare test pass called');
195 $testType = $this->assignments->getTypeByTest($this->
getTestRefId());
219 $definitionId = $a_test_sequence->getResponsibleSourcePoolDefinitionId($questionId);
225 if (count($objectiveIds)) {
233 include_once
'./Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
239 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
246 if ($assignment->getTestRefId() ==
$testRefId) {
247 return $assignment->getObjectiveId();
289 $is_qualified_run =
false;
291 $is_qualified_run =
true;
294 foreach ($this->run as $run) {
295 include_once
'./Modules/Course/classes/Objectives/class.ilLOUserResults.php';
296 include_once
'./Modules/Course/classes/Objectives/class.ilLOUtils.php';
301 $run->getObjectiveId(),
305 include_once
'./Modules/Course/classes/Objectives/class.ilLOUtils.php';
309 $run->getObjectiveId(),
314 $max_attempts = ilLOUtils::lookupMaxAttempts(
316 $run->getObjectiveId(),
320 $this->logger->debug(
'Max attempts = ' . $max_attempts);
325 $this->logger->debug(
'Checking for qualified test...');
326 if (!$is_qualified_run) {
327 $this->logger->debug(
' and increasing attempts.');
328 ++$old_result[
'tries'];
330 $old_result[
'is_final'] = ($old_result[
'tries'] >= $max_attempts);
334 $ur->saveObjectiveResult(
335 $run->getObjectiveId(),
337 $old_result[
'status'],
338 $old_result[
'result_perc'],
340 $old_result[
'tries'],
341 $old_result[
'is_final']
354 $this->logger->debug(
'Initial test');
359 $this->logger->debug(
'No qualified test run');
362 include_once
'./Services/Container/classes/class.ilContainerStartObjects.php';
364 $this->logger->debug(
'No start object');
370 $container_ref_id = end($container_ref_ids);
376 if ($start->isFullfilled($this->getUserId(), $session->
getRefId())) {
377 $this->logger->debug(
'Is fullfilled');
380 $this->logger->debug(
'Is not fullfilled');
391 foreach ($this->run as $run) {
392 if ($run->questionExists($qst->
getId())) {
394 $run->setQuestionResult(
400 $res = $run->getResult();
402 include_once
'./Modules/Course/classes/Objectives/class.ilLOUserResults.php';
403 include_once
'./Modules/Course/classes/Objectives/class.ilLOUtils.php';
408 $run->getObjectiveId(),
413 $ur->saveObjectiveResult(
414 $run->getObjectiveId(),
419 $run->getObjectiveId(),
422 $old_result[
'limit_perc']
426 (
int) $res[
'percentage'],
427 $old_result[
'limit_perc'],
428 $old_result[
'tries'],
429 $old_result[
'is_final']
431 $GLOBALS[
'ilLog']->write(__METHOD__ .
': ' . print_r($run->getResult(),
true));
432 $GLOBALS[
'ilLog']->write(__METHOD__ .
'!!!!!!!!!!!!!!!!!!!!: ' . print_r($comp,
true));
434 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
473 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestRun.php';
486 foreach ($this->run as $tst_run) {
495 $GLOBALS[
'ilLog']->write(__METHOD__ .
': separate run');
499 $GLOBALS[
'ilLog']->write(__METHOD__ .
': fixed run');
503 $GLOBALS[
'ilLog']->write(__METHOD__ .
': random run');
515 foreach ($this->run as $tst_run) {
516 $tst_run->clearQuestions();
519 $tst_run->addQuestion($qst_id);
520 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
523 $tst_run->setMaxPoints($points);
530 foreach ($this->run as $tst_run) {
531 $tst_run->clearQuestions();
532 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
535 $tst_run->getObjectiveId()
538 foreach ($qst as
$id) {
539 $tst_run->addQuestion($id);
542 $tst_run->setMaxPoints($points);
553 include_once
'./Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
554 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
556 foreach ($this->run as $tst_run) {
558 $tst_run->clearQuestions();
562 $tst_run->getObjectiveId(),
574 $tst_run->addQuestion($qst);
578 $tst_run->setMaxPoints($points);
584 foreach ($this->run as $run) {
585 if ($run->questionExists($a_qid)) {
597 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
599 $questionList->setParentObjId($testObjId);
602 $questionList->setQuestionIdsFilter($questionIds);
604 $questionList->load();
606 return $questionList->getQuestionDataArray();
617 $adapter->initTestRun($a_test_session);
static isCompleted($a_cont_oid, $a_test_rid, $a_objective_id, $max_points, $reached, $limit_perc)
Check if objective is completed.
static getInstanceByObjId($a_obj_id)
get singleton instance
updateRandomQuestions(ilTestSession $session, ilTestSequenceRandomQuestionSet $seq)
update random questions
getId()
Gets the id of the assQuestion object.
getResponsibleSourcePoolDefinitionId($questionId)
getRelatedObjectivesForSeparatedTest($testRefId)
static getInstance($a_container_id)
Get instance by container id.
notifyTestStart(ilTestSession $a_test_session, $a_test_obj_id)
Called from learning objective test on actual test start.
static _lookupMaximumPointsOfQuestion($a_question_id)
lookup maximimum point
storeTestRun()
Store test run in DB.
Abstract basic class which is to be extended by the concrete assessment question type classes...
static lookupResult($a_course_obj_id, $a_user_id, $a_objective_id, $a_tst_type)
Lookup user result.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
if(!array_key_exists('StateId', $_REQUEST)) $id
static _getObjectiveIds($course_id, $a_activated_only=false)
getSettings()
Get loc settings.
const QUESTION_INSTANCE_TYPE_DUPLICATES
getObjectiveOrientedContainerId()
static getRun($a_container_id, $a_user_id, $a_test_id)
setQuestionsOptional(ilTestSequence $seq)
set questions optional
const HIDE_PASSED_OBJECTIVE_QST
hideQuestion($question_id)
static _getAllReferences($a_id)
get all reference ids of object
updateSeparateTestQuestions(ilTestSession $session, ilTestSequence $seq)
Update questions for separate tests.
hideQuestions(ilTestSequence $seq)
Hide questions.
saveToDb()
Saves the sequence data for a given pass to the database.
static getInstance(ilTestSession $a_test_session)
updateQuestions(ilTestSession $session, ilTestSequence $seq)
foreach($_POST as $key=> $value) $res
initTestRun(ilTestSession $session)
buildQuestionRelatedObjectiveListByQuestions(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
buildQuestionRelatedObjectiveList(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
updateFixedQuestions(ilTestSession $session, ilTestSequence $seq)
static _lookupObjId($a_id)
const MARK_PASSED_OBJECTIVE_QST
__construct($a_user_id, $a_course_id)
static lookupSequencesByType($a_container_id, $a_objective_id, $a_test_id, $a_test_type)
Lookup sequence ids type $ilDB.
static lookupObjectiveRequiredPercentage($a_container_id, $a_objective_id, $a_test_ref_id, $a_max_points)
Create styles array
The data for the language used.
updateQuestionResult(ilTestSession $session, assQuestion $qst)
update question result of run
isQualifiedStartRun(ilTestSession $session)
Check if current run is a start object run.
static lookupObjectiveIdsBySequence($a_container_id, $a_seq_id)
Lookup objective ids by sequence_id type $ilDB.
lookupObjectiveIdByFixedQuestionId($a_question_id)
setQuestionOptional($questionId)
buildQuestionRelatedObjectiveListByTest(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
lookupObjectiveIdByRandomQuestionSelectionDefinitionId($a_id)
static deleteRun($a_container_id, $a_user_id, $a_test_id)
getReachedPoints($active_id, $pass=null)
Returns the points, a learner has reached answering the question This is the fast way to get the poin...
const TYPE_TEST_QUALIFIED
static lookupObjectivesOfQuestion($a_qid)
Lookup objective for test question type $ilDB.
Stores current objective, questions and max points.
prepareTestPass(ilTestSession $a_test_session, ilTestSequence $a_test_sequence)
Called from learning objective test.
static lookupQuestionsByObjective($a_test_id, $a_objective)
static getQuestionData($testObjId, $questionIds)
lookupRelevantObjectiveIdsForTest($a_container_id, $a_tst_ref_id, $a_user_id)
Lookup all relevant objective ids for a specific test.
initUserResult(ilTestSession $session)
init user result
static isStartObject($a_container_id, $a_item_ref_id)
Check if object is start object type $ilDB.