ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilTestVirtualSequence Class Reference
+ Inheritance diagram for ilTestVirtualSequence:
+ Collaboration diagram for ilTestVirtualSequence:

Public Member Functions

 __construct (ilDBInterface $db, ilObjTest $testOBJ, ilTestSequenceFactory $testSequenceFactory)
 
 getActiveId ()
 
 setActiveId ($activeId)
 
 getQuestionIds ()
 
 getQuestionsPassMap ()
 
 getUniquePasses ()
 
 init ()
 

Protected Member Functions

 getTestSequence ($activeId, $pass)
 
 wasAnsweredInThisPass (ilTestSequence $testSequence, $questionId)
 
 fetchQuestionsFromPasses ($activeId, $passes)
 

Protected Attributes

 $db
 
 $testOBJ
 
 $testSequenceFactory
 
 $activeId
 
 $questionsPassMap
 

Private Member Functions

 getExistingPassesDescendent ($activeId)
 

Detailed Description

Definition at line 12 of file class.ilTestVirtualSequence.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestVirtualSequence::__construct ( ilDBInterface  $db,
ilObjTest  $testOBJ,
ilTestSequenceFactory  $testSequenceFactory 
)

Definition at line 39 of file class.ilTestVirtualSequence.php.

References $db, $testOBJ, $testSequenceFactory, and array.

40  {
41  $this->db = $db;
42  $this->testOBJ = $testOBJ;
43  $this->testSequenceFactory = $testSequenceFactory;
44 
45  $this->activeId = null;
46 
47  $this->questionsPassMap = array();
48  }
Create styles array
The data for the language used.

Member Function Documentation

◆ fetchQuestionsFromPasses()

ilTestVirtualSequence::fetchQuestionsFromPasses (   $activeId,
  $passes 
)
protected

Definition at line 126 of file class.ilTestVirtualSequence.php.

References $activeId, $pass, array, getTestSequence(), and wasAnsweredInThisPass().

Referenced by init().

127  {
128  $this->questionsPassMap = array();
129 
130  foreach($passes as $pass)
131  {
132  $testSequence = $this->getTestSequence($activeId, $pass);
133 
134  foreach($testSequence->getOrderedSequenceQuestions() as $questionId)
135  {
136  if(isset($this->questionsPassMap[$questionId]))
137  {
138  continue;
139  }
140 
141  if($this->wasAnsweredInThisPass($testSequence, $questionId))
142  {
143  $this->questionsPassMap[$questionId] = $pass;
144  }
145  }
146  }
147  }
Create styles array
The data for the language used.
wasAnsweredInThisPass(ilTestSequence $testSequence, $questionId)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getActiveId()

ilTestVirtualSequence::getActiveId ( )

Definition at line 50 of file class.ilTestVirtualSequence.php.

References $activeId.

Referenced by ilTestService\getVirtualSequenceUserResults(), and init().

+ Here is the caller graph for this function:

◆ getExistingPassesDescendent()

ilTestVirtualSequence::getExistingPassesDescendent (   $activeId)
private

Definition at line 81 of file class.ilTestVirtualSequence.php.

References $activeId.

Referenced by init().

82  {
83  require_once 'Modules/Test/classes/class.ilTestPassesSelector.php';
84  $passesSelector = new ilTestPassesSelector($this->db, $this->testOBJ);
85  $passesSelector->setActiveId($activeId);
86 
87  $passes = $passesSelector->getExistingPasses();
88 
89  rsort($passes, SORT_NUMERIC);
90 
91  return $passes;
92  }
+ Here is the caller graph for this function:

◆ getQuestionIds()

ilTestVirtualSequence::getQuestionIds ( )

Implements ilTestQuestionSequence.

Definition at line 60 of file class.ilTestVirtualSequence.php.

61  {
62  return array_keys($this->questionsPassMap);
63  }

◆ getQuestionsPassMap()

ilTestVirtualSequence::getQuestionsPassMap ( )

Definition at line 65 of file class.ilTestVirtualSequence.php.

References $questionsPassMap.

Referenced by ilTestService\getVirtualSequenceUserResults().

+ Here is the caller graph for this function:

◆ getTestSequence()

ilTestVirtualSequence::getTestSequence (   $activeId,
  $pass 
)
protected

Definition at line 94 of file class.ilTestVirtualSequence.php.

References $activeId, and $pass.

Referenced by ilTestVirtualSequenceRandomQuestionSet\fetchQuestionsFromPasses(), and fetchQuestionsFromPasses().

95  {
96  $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($activeId, $pass);
97 
98  $testSequence->loadFromDb();
99  $testSequence->loadQuestions();
100 
101  $testSequence->setConsiderHiddenQuestionsEnabled(true);
102  $testSequence->setConsiderOptionalQuestionsEnabled(true);
103  return $testSequence;
104  }
+ Here is the caller graph for this function:

◆ getUniquePasses()

ilTestVirtualSequence::getUniquePasses ( )

Definition at line 70 of file class.ilTestVirtualSequence.php.

Referenced by ilTestService\getVirtualSequenceUserResults().

71  {
72  return array_unique(array_values($this->questionsPassMap));
73  }
+ Here is the caller graph for this function:

◆ init()

ilTestVirtualSequence::init ( )

Definition at line 75 of file class.ilTestVirtualSequence.php.

References fetchQuestionsFromPasses(), getActiveId(), and getExistingPassesDescendent().

76  {
77  $passes = $this->getExistingPassesDescendent($this->getActiveId());
78  $this->fetchQuestionsFromPasses($this->getActiveId(), $passes);
79  }
fetchQuestionsFromPasses($activeId, $passes)
+ Here is the call graph for this function:

◆ setActiveId()

ilTestVirtualSequence::setActiveId (   $activeId)

Definition at line 55 of file class.ilTestVirtualSequence.php.

References $activeId.

56  {
57  $this->activeId = $activeId;
58  }

◆ wasAnsweredInThisPass()

ilTestVirtualSequence::wasAnsweredInThisPass ( ilTestSequence  $testSequence,
  $questionId 
)
protected

Definition at line 106 of file class.ilTestVirtualSequence.php.

References ilTestSequence\isAnsweringOptionalQuestionsConfirmed(), ilTestSequence\isHiddenQuestion(), and ilTestSequence\isQuestionOptional().

Referenced by ilTestVirtualSequenceRandomQuestionSet\fetchQuestionsFromPasses(), and fetchQuestionsFromPasses().

107  {
108  if( $testSequence->isHiddenQuestion($questionId) )
109  {
110  return false;
111  }
112 
113  if( !$testSequence->isQuestionOptional($questionId) )
114  {
115  return true;
116  }
117 
118  if( $testSequence->isAnsweringOptionalQuestionsConfirmed() )
119  {
120  return true;
121  }
122 
123  return false;
124  }
isQuestionOptional($questionId)
isHiddenQuestion($question_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $activeId

◆ $db

ilTestVirtualSequence::$db
protected

Definition at line 17 of file class.ilTestVirtualSequence.php.

Referenced by __construct().

◆ $questionsPassMap

ilTestVirtualSequence::$questionsPassMap
protected

Definition at line 37 of file class.ilTestVirtualSequence.php.

Referenced by getQuestionsPassMap().

◆ $testOBJ

ilTestVirtualSequence::$testOBJ
protected

Definition at line 22 of file class.ilTestVirtualSequence.php.

Referenced by __construct().

◆ $testSequenceFactory

ilTestVirtualSequence::$testSequenceFactory
protected

Definition at line 27 of file class.ilTestVirtualSequence.php.

Referenced by __construct().


The documentation for this class was generated from the following file: