4include_once
'./Modules/Course/classes/Objectives/class.ilLOSettings.php';
5include_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())
75 if($a_tst_ref_id == $this->
getSettings()->getInitialTest())
77 $relevant_objective_ids = $objective_ids;
80 elseif(!$this->
getSettings()->hasSeparateQualifiedTests())
82 if($a_tst_ref_id == $this->
getSettings()->getQualifiedTest())
84 $relevant_objective_ids = $objective_ids;
88 foreach((array) $objective_ids as $objective_id)
91 if($assigned_itest == $a_tst_ref_id)
93 $relevant_objective_ids[] = $objective_id;
96 if($assigned_qtest == $a_tst_ref_id)
98 $relevant_objective_ids[] = $objective_id;
102 $relevant_objective_ids = array_unique($relevant_objective_ids);
104 if(count($relevant_objective_ids) <= 1)
106 return $relevant_objective_ids;
110 $test_type =
$assignments->getTypeByTest($a_tst_ref_id);
112 $passed_objectives = array();
113 include_once
'./Modules/Course/classes/Objectives/class.ilLOUserResults.php';
116 $passed =
$results->getCompletedObjectiveIds();
117 $this->logger->debug(
'Passed objectives are ' . print_r($passed,
true).
' for test type: ' . $test_type);
121 if(count($passed) >= count($relevant_objective_ids))
123 return $relevant_objective_ids;
127 foreach($relevant_objective_ids as $objective_id)
129 if(!in_array($objective_id, $passed))
131 $unpassed[] = $objective_id;
150 $this->logger->debug(
'Notify test start: '. print_r($relevant_objectives,
true));
153 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestRun.php';
160 foreach((array) $relevant_objectives as $oid)
162 $this->logger->debug(
'Adding new run for objective with id: ' . $oid);
183 $this->logger->debug(
'Prepare test pass called');
211 $testType = $this->assignments->getTypeByTest($this->
getTestRefId());
243 $definitionId = $a_test_sequence->getResponsibleSourcePoolDefinitionId($questionId);
251 if( count($objectiveIds) )
260 include_once
'./Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
266 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
276 return $assignment->getObjectiveId();
318 $is_qualified_run =
false;
321 $is_qualified_run =
true;
324 foreach($this->run as $run)
326 include_once
'./Modules/Course/classes/Objectives/class.ilLOUserResults.php';
327 include_once
'./Modules/Course/classes/Objectives/class.ilLOUtils.php';
332 $run->getObjectiveId(),
333 $this->getAssignments()->getTypeByTest($session->
getRefId())
336 include_once
'./Modules/Course/classes/Objectives/class.ilLOUtils.php';
340 $run->getObjectiveId(),
345 $max_attempts = ilLOUtils::lookupMaxAttempts(
347 $run->getObjectiveId(),
351 $this->logger->debug(
'Max attempts = ' . $max_attempts);
357 $this->logger->debug(
'Checking for qualified test...');
358 if(!$is_qualified_run)
360 $this->logger->debug(
' and increasing attempts.');
361 ++$old_result[
'tries'];
363 $old_result[
'is_final'] = ($old_result[
'tries'] >= $max_attempts);
367 $ur->saveObjectiveResult(
368 $run->getObjectiveId(),
369 $this->getAssignments()->getTypeByTest($session->
getRefId()),
370 $old_result[
'status'],
371 $old_result[
'result_perc'],
373 $old_result[
'tries'],
374 $old_result[
'is_final']
388 $this->logger->debug(
'Initial test');
392 if($session->
getRefId() != $this->getSettings()->getQualifiedTest())
394 $this->logger->debug(
'No qualified test run');
397 include_once
'./Services/Container/classes/class.ilContainerStartObjects.php';
400 $this->logger->debug(
'No start object');
406 $container_ref_id = end($container_ref_ids);
414 $this->logger->debug(
'Is fullfilled');
417 $this->logger->debug(
'Is not fullfilled');
428 foreach($this->run as $run)
430 if($run->questionExists($qst->
getId()))
433 $run->setQuestionResult(
439 $res = $run->getResult();
441 include_once
'./Modules/Course/classes/Objectives/class.ilLOUserResults.php';
442 include_once
'./Modules/Course/classes/Objectives/class.ilLOUtils.php';
447 $run->getObjectiveId(),
448 $this->getAssignments()->getTypeByTest($session->
getRefId())
452 $ur->saveObjectiveResult(
453 $run->getObjectiveId(),
454 $this->getAssignments()->getTypeByTest($session->
getRefId()),
458 $run->getObjectiveId(),
459 $res[
'max'],
$res[
'reached'],$old_result[
'limit_perc']) ?
462 (
int)
$res[
'percentage'],
463 $old_result[
'limit_perc'],
464 $old_result[
'tries'],
465 $old_result[
'is_final']
467 $GLOBALS[
'ilLog']->write(__METHOD__.
': '.print_r($run->getResult(),
true));
468 $GLOBALS[
'ilLog']->write(__METHOD__.
'!!!!!!!!!!!!!!!!!!!!: '.print_r($comp,TRUE));
470 include_once(
"./Services/Tracking/classes/class.ilLPStatusWrapper.php");
513 include_once
'./Modules/Course/classes/Objectives/class.ilLOTestRun.php';
526 foreach ($this->run as $tst_run)
537 $GLOBALS[
'ilLog']->write(__METHOD__.
': separate run');
542 $GLOBALS[
'ilLog']->write(__METHOD__.
': fixed run');
547 $GLOBALS[
'ilLog']->write(__METHOD__.
': random run');
560 foreach($this->run as $tst_run)
562 $tst_run->clearQuestions();
566 $tst_run->addQuestion($qst_id);
567 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
570 $tst_run->setMaxPoints($points);
577 foreach ($this->run as $tst_run)
579 $tst_run->clearQuestions();
580 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
583 $tst_run->getObjectiveId()
588 $tst_run->addQuestion($id);
591 $tst_run->setMaxPoints($points);
597 include_once
'./Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
598 include_once
'./Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
600 foreach($this->run as $tst_run)
603 $tst_run->clearQuestions();
606 $tst_run->getObjectiveId(),
607 ($this->getSettings()->getQualifiedTest() == $session->
getRefId() ?
611 $stored_sequence_id = $rnd->getQplSequence();
617 $tst_run->addQuestion($qst);
621 $tst_run->setMaxPoints($points);
627 foreach($this->run as $run)
629 if($run->questionExists($a_qid))
642 require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
644 $questionList->setParentObjId($testObjId);
647 $questionList->setQuestionIdsFilter($questionIds);
649 $questionList->load();
651 return $questionList->getQuestionDataArray();
662 $adapter->initTestRun($a_test_session);
An exception for terminatinating execution or to throw for unit testing.
Abstract basic class which is to be extended by the concrete assessment question type classes.
getId()
Gets the id of the assQuestion object.
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 QUESTION_INSTANCE_TYPE_DUPLICATES
static isStartObject($a_container_id, $a_item_ref_id)
Check if object is start object @global type $ilDB.
static lookupObjectivesOfQuestion($a_qid)
Lookup objective for test question @global type $ilDB.
static lookupQuestionsByObjective($a_test_id, $a_objective)
static _lookupMaximumPointsOfQuestion($a_question_id)
lookup maximimum point
static _getObjectiveIds($course_id, $a_activated_only=false)
static lookupObjectiveIdsBySequence($a_container_id, $a_seq_id)
Lookup objective id by sequence.
const TYPE_TEST_QUALIFIED
const HIDE_PASSED_OBJECTIVE_QST
const MARK_PASSED_OBJECTIVE_QST
static getInstanceByObjId($a_obj_id)
get singleton instance
static getInstance($a_container_id)
Get instance by container id.
setQuestionsOptional(ilTestSequence $seq)
set questions optional
isQualifiedStartRun(ilTestSession $session)
Check if current run is a start object run.
buildQuestionRelatedObjectiveListByQuestions(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
buildQuestionRelatedObjectiveListByTest(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
getRelatedObjectivesForSeparatedTest($testRefId)
prepareTestPass(ilTestSession $a_test_session, ilTestSequence $a_test_sequence)
Called from learning objective test.
lookupObjectiveIdByFixedQuestionId($a_question_id)
buildQuestionRelatedObjectiveList(ilTestQuestionSequence $a_test_sequence, ilTestQuestionRelatedObjectivesList $a_objectives_list)
notifyTestStart(ilTestSession $a_test_session, $a_test_obj_id)
Called from learning objective test on actual test start.
hideQuestions(ilTestSequence $seq)
Hide questions.
initTestRun(ilTestSession $session)
updateQuestions(ilTestSession $session, ilTestSequence $seq)
updateQuestionResult(ilTestSession $session, assQuestion $qst)
update question result of run
storeTestRun()
Store test run in DB.
updateSeparateTestQuestions(ilTestSession $session, ilTestSequence $seq)
Update questions for separate tests.
updateRandomQuestions(ilTestSession $session, ilTestSequenceRandomQuestionSet $seq)
lookupRelevantObjectiveIdsForTest($a_container_id, $a_tst_ref_id, $a_user_id)
Lookup all relevant objective ids for a specific test.
lookupObjectiveIdByRandomQuestionSelectionDefinitionId($a_id)
initUserResult(ilTestSession $session)
init user result
static getInstance(ilTestSession $a_test_session)
__construct($a_user_id, $a_course_id)
static getQuestionData($testObjId, $questionIds)
updateFixedQuestions(ilTestSession $session, ilTestSequence $seq)
getSettings()
Get loc settings.
Stores current objective, questions and max points.
static deleteRun($a_container_id, $a_user_id, $a_test_id)
static getRun($a_container_id, $a_user_id, $a_test_id)
static lookupResult($a_course_obj_id, $a_user_id, $a_objective_id, $a_tst_type)
Lookup user result.
static lookupObjectiveRequiredPercentage($a_container_id, $a_objective_id, $a_test_ref_id, $a_max_points)
static isCompleted($a_cont_oid, $a_test_rid, $a_objective_id, $max_points, $reached, $limit_perc)
Check if objective is completed.
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _lookupObjId($a_id)
static _getAllReferences($a_id)
get all reference ids of object
getResponsibleSourcePoolDefinitionId($questionId)
hideQuestion($question_id)
saveToDb()
Saves the sequence data for a given pass to the database.
setQuestionOptional($questionId)
getObjectiveOrientedContainerId()
$GLOBALS['loaded']
Global hash that tracks already loaded includes.