ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilTestRandomQuestionCollectionSubsetApplication.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetQuestionCollection.php';
5 
13 {
17  protected $applicantId;
18 
22  protected $requiredAmount;
23 
27  public function getApplicantId()
28  {
29  return $this->applicantId;
30  }
31 
35  public function setApplicantId($applicantId)
36  {
37  $this->applicantId = $applicantId;
38  }
39 
43  public function getRequiredAmount()
44  {
45  return $this->requiredAmount;
46  }
47 
52  {
53  $this->requiredAmount = $requiredAmount;
54  }
55 
56  /*
57  * returns the fact if required amount is still positive
58  */
59  public function hasRequiredAmountLeft()
60  {
61  return $this->getRequiredAmount() > 0;
62  }
63 
67  public function decrementRequiredAmount()
68  {
69  $this->setRequiredAmount($this->getRequiredAmount() - 1);
70  }
71 
75  public function hasQuestion($questionId)
76  {
77  return $this->getQuestion($questionId) !== null;
78  }
79 
83  public function getQuestion($questionId)
84  {
85  foreach ($this as $question) {
86  if ($question->getQuestionId() != $questionId) {
87  continue;
88  }
89 
90  return $question;
91  }
92 
93  return null;
94  }
95 }