ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTestRandomQuestionsSrcPoolDefinitionQuantitiesCalculation.php
Go to the documentation of this file.
1 <?php
2 
26 {
31 
36 
41 
46 
51 
58  {
59  $this->sourcePoolDefinition = $sourcePoolDefinition;
60  }
61 
66  {
68  }
69 
74  {
76  }
77 
82  {
83  $this->intersectionQuantitySharingDefinitionList = $intersectionQuantitySharingDefinitionList;
84  }
85 
89  public function getOverallQuestionAmount(): int
90  {
92  }
93 
98  {
99  $this->overallQuestionAmount = $overallQuestionAmount;
100  }
101 
105  public function getExclusiveQuestionAmount(): int
106  {
108  }
109 
114  {
115  $this->exclusiveQuestionAmount = $exclusiveQuestionAmount;
116  }
117 
122  {
124  }
125 
130  {
131  $this->availableSharedQuestionAmount = $availableSharedQuestionAmount;
132  }
133 
137  protected function getReservedSharedQuestionAmount(): int
138  {
139  return $this->getOverallQuestionAmount() - (
141  );
142  }
143 
148  {
149  $requiredQuestionAmount = $this->getSourcePoolDefinition()->getQuestionAmount();
151 
152  return $requiredQuestionAmount - $exclusiveQuestionAmount;
153  }
154 
159  {
160  $requiredQuestionAmount = $this->getSourcePoolDefinition()->getQuestionAmount();
162 
163  return $overallQuestionAmount >= $requiredQuestionAmount;
164  }
165 
170  {
171  $requiredQuestionAmount = $this->getSourcePoolDefinition()->getQuestionAmount();
173 
174  return $exclusiveQuestionAmount >= $requiredQuestionAmount;
175  }
176 
181  {
182  $remainingRequiredQuestionAmount = $this->getRemainingRequiredQuestionAmount();
184 
185  return $availableSharedQuestionAmount >= $remainingRequiredQuestionAmount;
186  }
187 
191  protected function sourcePoolDefinitionIntersectionsExist(): bool
192  {
193  if ($this->getIntersectionQuantitySharingDefinitionList()->getDefinitionCount() > 0) {
194  return true;
195  }
196 
197  return false;
198  }
199 
203  public function isRequiredAmountGuaranteedAvailable(): bool
204  {
206  return true;
207  }
208 
210  return true;
211  }
212 
213  return false;
214  }
215 
216  public function getDistributionReport(ilLanguage $lng): string
217  {
218  $report = $this->getRuleSatisfactionResultMessage($lng);
219 
221  $report .= ' ' . $this->getConcurrentRuleConflictMessage($lng);
222  }
223 
224  return $report;
225  }
226 
228  {
230  return sprintf(
231  $lng->txt('tst_msg_rand_quest_set_rule_not_satisfied_reserved'),
232  $this->getSourcePoolDefinition()->getSequencePosition(),
233  $this->getSourcePoolDefinition()->getQuestionAmount(),
234  $this->getOverallQuestionAmount()
235  );
236  }
237 
238  return sprintf(
239  $lng->txt('tst_msg_rand_quest_set_rule_not_satisfied_missing'),
240  $this->getSourcePoolDefinition()->getSequencePosition(),
241  $this->getSourcePoolDefinition()->getQuestionAmount(),
242  $this->getOverallQuestionAmount()
243  );
244  }
245 
247  {
248  $definitionsString = '<br />' . $this->buildIntersectionQuestionSharingDefinitionsString($lng);
249 
251  return sprintf(
252  $lng->txt('tst_msg_rand_quest_set_rule_not_satisfied_reserved_shared'),
254  $definitionsString
255  );
256  }
257 
258  return sprintf(
259  $lng->txt('tst_msg_rand_quest_set_rule_not_satisfied_missing_shared'),
261  $definitionsString
262  );
263  }
264 
270  {
271  $definitionsString = array();
272 
273  foreach ($this->getIntersectionQuantitySharingDefinitionList() as $definition) {
274  $definitionsString[] = sprintf(
275  $lng->txt('tst_msg_rand_quest_set_rule_label'),
276  $definition->getSequencePosition()
277  );
278  }
279 
280  $definitionsString = '<ul><li>' . implode('</li><li>', $definitionsString) . '</li></ul>';
281  return $definitionsString;
282  }
283 }
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
$lng
__construct(ilTestRandomQuestionSetSourcePoolDefinition $sourcePoolDefinition)
ilTestRandomQuestionsSrcPoolDefinitionQuantitiesCheck constructor.