ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestRandomQuestionCollectionSubsetApplicationList Class Reference
+ Inheritance diagram for ilTestRandomQuestionCollectionSubsetApplicationList:
+ Collaboration diagram for ilTestRandomQuestionCollectionSubsetApplicationList:

Public Member Functions

 __construct ()
 ilTestRandomQuestionCollectionSubsetApplicantList constructor. More...
 
 getCollectionSubsetApplication ($applicantId)
 
 getCollectionSubsetApplications ()
 
 addCollectionSubsetApplication (ilTestRandomQuestionCollectionSubsetApplication $collectionSubsetApplication)
 
 setCollectionSubsetApplications ($collectionSubsetApplications)
 
 resetCollectionSubsetApplicants ()
 resetter for collectionSubsetApplicants More...
 
 getReservedQuestionCollection ()
 
 setReservedQuestionCollection ($reservedQuestionCollection)
 
 addReservedQuestion (ilTestRandomQuestionSetQuestion $reservedQuestion)
 
 current ()
 
 next ()
 
 key ()
 
 valid ()
 
 rewind ()
 
 handleQuestionRequest (ilTestRandomQuestionSetQuestion $question)
 
 getNonReservedQuestionAmount ()
 

Protected Attributes

 $collectionSubsetApplications = array()
 
 $reservedQuestionCollection
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTestRandomQuestionCollectionSubsetApplicationList::__construct ( )

Member Function Documentation

◆ addCollectionSubsetApplication()

ilTestRandomQuestionCollectionSubsetApplicationList::addCollectionSubsetApplication ( ilTestRandomQuestionCollectionSubsetApplication  $collectionSubsetApplication)

Definition at line 66 of file class.ilTestRandomQuestionCollectionSubsetApplicationList.php.

References ilTestRandomQuestionCollectionSubsetApplication\getApplicantId().

67  {
68  $this->collectionSubsetApplications[$collectionSubsetApplication->getApplicantId()] = $collectionSubsetApplication;
69  }
+ Here is the call graph for this function:

◆ addReservedQuestion()

ilTestRandomQuestionCollectionSubsetApplicationList::addReservedQuestion ( ilTestRandomQuestionSetQuestion  $reservedQuestion)
Parameters
ilTestRandomQuestionSetQuestion$question

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

References getReservedQuestionCollection().

Referenced by handleQuestionRequest().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ current()

ilTestRandomQuestionCollectionSubsetApplicationList::current ( )
Returns
ilTestRandomQuestionCollectionSubsetApplication|false

Definition at line 114 of file class.ilTestRandomQuestionCollectionSubsetApplicationList.php.

115  {
116  return current($this->collectionSubsetApplications);
117  }

◆ getCollectionSubsetApplication()

ilTestRandomQuestionCollectionSubsetApplicationList::getCollectionSubsetApplication (   $applicantId)
Parameters
integer$applicantId
Returns
ilTestRandomQuestionCollectionSubsetApplication

Definition at line 49 of file class.ilTestRandomQuestionCollectionSubsetApplicationList.php.

50  {
51  if (!isset($this->collectionSubsetApplications[$applicantId])) {
52  return null;
53  }
54 
55  return $this->collectionSubsetApplications[$applicantId];
56  }

◆ getCollectionSubsetApplications()

ilTestRandomQuestionCollectionSubsetApplicationList::getCollectionSubsetApplications ( )

◆ getNonReservedQuestionAmount()

ilTestRandomQuestionCollectionSubsetApplicationList::getNonReservedQuestionAmount ( )
Returns
int

Definition at line 170 of file class.ilTestRandomQuestionCollectionSubsetApplicationList.php.

References getReservedQuestionCollection().

170  : int
171  {
172  $availableQuestionCollection = new ilTestRandomQuestionSetQuestionCollection();
173 
174  foreach ($this as $collectionSubsetApplication) {
175  $applicationsNonReservedQstCollection = $collectionSubsetApplication->getRelativeComplementCollection(
177  );
178 
179  $availableQuestionCollection->mergeQuestionCollection($applicationsNonReservedQstCollection);
180  }
181 
182  $nonReservedQuestionCollection = $availableQuestionCollection->getUniqueQuestionCollection();
183 
184  return $nonReservedQuestionCollection->getQuestionAmount();
185  }
+ Here is the call graph for this function:

◆ getReservedQuestionCollection()

◆ handleQuestionRequest()

ilTestRandomQuestionCollectionSubsetApplicationList::handleQuestionRequest ( ilTestRandomQuestionSetQuestion  $question)
Parameters
ilTestRandomQuestionSetQuestion$question

Definition at line 147 of file class.ilTestRandomQuestionCollectionSubsetApplicationList.php.

References addReservedQuestion(), and ilTestRandomQuestionSetQuestion\getQuestionId().

148  {
149  $questionReservationRequired = false;
150 
151  foreach ($this as $collectionSubsetApplication) {
152  if (!$collectionSubsetApplication->hasQuestion($question->getQuestionId())) {
153  continue;
154  }
155 
156  if ($collectionSubsetApplication->hasRequiredAmountLeft()) {
157  $questionReservationRequired = true;
158  $collectionSubsetApplication->decrementRequiredAmount();
159  }
160  }
161 
162  if ($questionReservationRequired) {
163  $this->addReservedQuestion($question);
164  }
165  }
+ Here is the call graph for this function:

◆ key()

ilTestRandomQuestionCollectionSubsetApplicationList::key ( )

Definition at line 127 of file class.ilTestRandomQuestionCollectionSubsetApplicationList.php.

Referenced by valid().

127  : string
128  {
129  return key($this->collectionSubsetApplications);
130  }
+ Here is the caller graph for this function:

◆ next()

ilTestRandomQuestionCollectionSubsetApplicationList::next ( )
Returns
ilTestRandomQuestionCollectionSubsetApplication|false

Definition at line 122 of file class.ilTestRandomQuestionCollectionSubsetApplicationList.php.

123  {
124  return next($this->collectionSubsetApplications);
125  }

◆ resetCollectionSubsetApplicants()

ilTestRandomQuestionCollectionSubsetApplicationList::resetCollectionSubsetApplicants ( )

resetter for collectionSubsetApplicants

Definition at line 82 of file class.ilTestRandomQuestionCollectionSubsetApplicationList.php.

References setCollectionSubsetApplications().

+ Here is the call graph for this function:

◆ rewind()

ilTestRandomQuestionCollectionSubsetApplicationList::rewind ( )
Returns
ilTestRandomQuestionCollectionSubsetApplication|false

Definition at line 139 of file class.ilTestRandomQuestionCollectionSubsetApplicationList.php.

140  {
141  return reset($this->collectionSubsetApplications);
142  }

◆ setCollectionSubsetApplications()

ilTestRandomQuestionCollectionSubsetApplicationList::setCollectionSubsetApplications (   $collectionSubsetApplications)
Parameters
ilTestRandomQuestionCollectionSubsetApplication[]$collectionSubsetApplications

Definition at line 74 of file class.ilTestRandomQuestionCollectionSubsetApplicationList.php.

References $collectionSubsetApplications.

Referenced by resetCollectionSubsetApplicants().

+ Here is the caller graph for this function:

◆ setReservedQuestionCollection()

ilTestRandomQuestionCollectionSubsetApplicationList::setReservedQuestionCollection (   $reservedQuestionCollection)
Parameters
ilTestRandomQuestionSetQuestionCollection$reservedQuestionCollection

Definition at line 98 of file class.ilTestRandomQuestionCollectionSubsetApplicationList.php.

References $reservedQuestionCollection.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ valid()

ilTestRandomQuestionCollectionSubsetApplicationList::valid ( )

Definition at line 132 of file class.ilTestRandomQuestionCollectionSubsetApplicationList.php.

References key().

132  : bool
133  {
134  return key($this->collectionSubsetApplications) !== null;
135  }
+ Here is the call graph for this function:

Field Documentation

◆ $collectionSubsetApplications

ilTestRandomQuestionCollectionSubsetApplicationList::$collectionSubsetApplications = array()
protected

◆ $reservedQuestionCollection

ilTestRandomQuestionCollectionSubsetApplicationList::$reservedQuestionCollection
protected

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