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()) {
 
   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(),
 
  302                $this->getAssignments()->getTypeByTest(
$session->getRefId())
 
  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(),
 
  336                $this->getAssignments()->getTypeByTest(
$session->getRefId()),
 
  337                $old_result[
'status'],
 
  338                $old_result[
'result_perc'],
 
  340                $old_result[
'tries'],
 
  341                $old_result[
'is_final']
 
  354            $this->logger->debug(
'Initial test');
 
  358        if (
$session->getRefId() != $this->getSettings()->getQualifiedTest()) {
 
  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(),
 
  409                    $this->getAssignments()->getTypeByTest(
$session->getRefId())
 
  413                $ur->saveObjectiveResult(
 
  414                    $run->getObjectiveId(),
 
  415                    $this->getAssignments()->getTypeByTest(
$session->getRefId()),
 
  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[
'DIC'][
'ilLog']->write(__METHOD__ . 
': ' . print_r($run->getResult(), 
true));
 
  432                $GLOBALS[
'DIC'][
'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[
'DIC'][
'ilLog']->write(__METHOD__ . 
': separate run');
 
  499            $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ . 
': fixed run');
 
  503            $GLOBALS[
'DIC'][
'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(),
 
  565                    ($this->getSettings()->getQualifiedTest() == 
$session->getRefId()) ?
 
  574                    $tst_run->addQuestion($qst);
 
  578            $tst_run->setMaxPoints($points);
 
  584        foreach ($this->run as $run) {
 
  585            if ($run->questionExists($a_qid)) {
 
  599        $ilPluginAdmin = 
$DIC[
'ilPluginAdmin'];
 
  601        require_once 
'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
 
  603        $questionList->setParentObjId($testObjId);
 
  606        $questionList->setQuestionIdsFilter($questionIds);
 
  608        $questionList->load();
 
  610        return $questionList->getQuestionDataArray();
 
  620        $adapter->setTestRefId($a_test_session->
getRefId());
 
  621        $adapter->initTestRun($a_test_session);
 
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
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.
getReachedPoints($active_id, $pass=null)
Returns the points, a learner has reached answering the question This is the fast way to get the poin...
getId()
Gets the id of the assQuestion object.
const QUESTION_INSTANCE_TYPE_DUPLICATES
static isStartObject($a_container_id, $a_item_ref_id)
Check if object is start object.
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 lookupSequencesByType($a_container_id, $a_objective_id, $a_test_id, $a_test_type)
Lookup sequence ids @global type $ilDB.
static lookupObjectiveIdsBySequence($a_container_id, $a_seq_id)
Lookup objective ids by sequence_id @global type $ilDB.
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)
update random questions
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()
foreach($_POST as $key=> $value) $res