ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilTestRandomQuestionsSrcPoolDefinitionQuantitiesCalculation.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
28 {
33 
38 
43 
48 
53 
60  {
61  $this->sourcePoolDefinition = $sourcePoolDefinition;
62  }
63 
68  {
70  }
71 
76  {
78  }
79 
84  {
85  $this->intersectionQuantitySharingDefinitionList = $intersectionQuantitySharingDefinitionList;
86  }
87 
91  public function getOverallQuestionAmount(): int
92  {
94  }
95 
100  {
101  $this->overallQuestionAmount = $overallQuestionAmount;
102  }
103 
107  public function getExclusiveQuestionAmount(): int
108  {
110  }
111 
116  {
117  $this->exclusiveQuestionAmount = $exclusiveQuestionAmount;
118  }
119 
124  {
126  }
127 
132  {
133  $this->availableSharedQuestionAmount = $availableSharedQuestionAmount;
134  }
135 
139  protected function getReservedSharedQuestionAmount(): int
140  {
141  return $this->getOverallQuestionAmount() - (
143  );
144  }
145 
150  {
151  $requiredQuestionAmount = $this->getSourcePoolDefinition()->getQuestionAmount();
153 
154  return $requiredQuestionAmount - $exclusiveQuestionAmount;
155  }
156 
161  {
162  $requiredQuestionAmount = $this->getSourcePoolDefinition()->getQuestionAmount();
164 
165  return $overallQuestionAmount >= $requiredQuestionAmount;
166  }
167 
172  {
173  $requiredQuestionAmount = $this->getSourcePoolDefinition()->getQuestionAmount();
175 
176  return $exclusiveQuestionAmount >= $requiredQuestionAmount;
177  }
178 
183  {
184  $remainingRequiredQuestionAmount = $this->getRemainingRequiredQuestionAmount();
186 
187  return $availableSharedQuestionAmount >= $remainingRequiredQuestionAmount;
188  }
189 
193  protected function sourcePoolDefinitionIntersectionsExist(): bool
194  {
195  if ($this->getIntersectionQuantitySharingDefinitionList()->getDefinitionCount() > 0) {
196  return true;
197  }
198 
199  return false;
200  }
201 
205  public function isRequiredAmountGuaranteedAvailable(): bool
206  {
208  return true;
209  }
210 
212  return true;
213  }
214 
215  return false;
216  }
217 
218  public function getDistributionReport(ilLanguage $lng): string
219  {
220  $report = $this->getRuleSatisfactionResultMessage($lng);
221 
223  $report .= ' ' . $this->getConcurrentRuleConflictMessage($lng);
224  }
225 
226  return $report;
227  }
228 
230  {
232  return sprintf(
233  $lng->txt('tst_msg_rand_quest_set_rule_not_satisfied_reserved'),
234  $this->getSourcePoolDefinition()->getSequencePosition(),
235  $this->getSourcePoolDefinition()->getQuestionAmount(),
236  $this->getOverallQuestionAmount()
237  );
238  }
239 
240  return sprintf(
241  $lng->txt('tst_msg_rand_quest_set_rule_not_satisfied_missing'),
242  $this->getSourcePoolDefinition()->getSequencePosition(),
243  $this->getSourcePoolDefinition()->getQuestionAmount(),
244  $this->getOverallQuestionAmount()
245  );
246  }
247 
249  {
250  $definitionsString = '<br />' . $this->buildIntersectionQuestionSharingDefinitionsString($lng);
251 
253  return sprintf(
254  $lng->txt('tst_msg_rand_quest_set_rule_not_satisfied_reserved_shared'),
256  $definitionsString
257  );
258  }
259 
260  return sprintf(
261  $lng->txt('tst_msg_rand_quest_set_rule_not_satisfied_missing_shared'),
263  $definitionsString
264  );
265  }
266 
272  {
273  $definitionsString = [];
274 
275  foreach ($this->getIntersectionQuantitySharingDefinitionList() as $definition) {
276  $definitionsString[] = sprintf(
277  $lng->txt('tst_msg_rand_quest_set_rule_label'),
278  $definition->getSequencePosition()
279  );
280  }
281 
282  $definitionsString = '<ul><li>' . implode('</li><li>', $definitionsString) . '</li></ul>';
283  return $definitionsString;
284  }
285 }
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...
__construct(ilTestRandomQuestionSetSourcePoolDefinition $sourcePoolDefinition)
ilTestRandomQuestionsSrcPoolDefinitionQuantitiesCheck constructor.
global $lng
Definition: privfeed.php:31