19 declare(strict_types=1);
58 $this->validationFailed =
false;
59 $this->validationReports = [];
133 return implode(
'<br />', $this->validationReports);
138 return count($this->validationReports);
143 $this->validationReports[] = $validationReport;
153 $this->sync_info_message =
$message;
168 if (!$this->questionSetConfig->isQuestionAmountConfigComplete()) {
174 $this->
lng->txt(
'tst_msg_rand_quest_set_change_quest_amount_here'),
184 $this->
lng->txt(
'tst_msg_rand_quest_set_change_quest_amount_here'),
192 if (!$this->questionSetConfig->hasSourcePoolDefinitions()) {
197 if ($this->questionSetConfig->getLastQuestionSyncTimestamp() === 0 ||
198 $this->questionSetConfig->getLastQuestionSyncTimestamp() ===
null) {
203 if (!$this->questionSetConfig->isQuestionSetBuildable()) {
206 $this->
addValidationReport(implode(
'<br />', $this->questionSetConfig->getBuildableMessages()));
210 if ($this->questionSetConfig->getLastQuestionSyncTimestamp()) {
221 $titles[] = $lostPool->getTitle();
224 return implode(
', ', $titles);
230 case self::CONTEXT_POOL_SELECTION:
234 case self::CONTEXT_GENERAL_CONFIG:
243 $this->
ctrl->setParameter(
249 $href = $this->
ctrl->getLinkTarget(
253 $label = $this->
lng->txt(
'tst_btn_rebuild_random_question_stage');
255 return $this->ui_factory->button()->standard($label, $href)->withLoadingAnimationOnClick(
true);
260 $href = $this->
ctrl->getLinkTarget(
265 $label = $this->
lng->txt(
'tst_rnd_quest_cfg_tab_general');
267 return "<a href=\"{$href}\">{$label}</a>";
272 $href = $this->
ctrl->getLinkTarget(
277 $label = $this->
lng->txt(
'tst_rnd_quest_cfg_tab_pool');
279 return "<a href=\"{$href}\">{$label}</a>";
288 if ($this->
getContext() !== self::CONTEXT_POOL_SELECTION) {
292 if ($this->questionSetConfig->doesSelectableQuestionPoolsExist()) {
305 if ($this->
getContext() != self::CONTEXT_GENERAL_CONFIG) {
309 if (!$this->questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
318 if ($this->
getContext() != self::CONTEXT_POOL_SELECTION) {
322 if (!$this->questionSetConfig->isQuestionAmountConfigurationModePerTest()) {
332 $this->
lng->txt(
'tst_msg_rand_quest_set_lost_pools'),
336 if ($this->
getContext() == self::CONTEXT_GENERAL_CONFIG) {
337 $action = $this->
ctrl->getLinkTarget(
342 $link = $this->ui_factory->link()->standard(
343 $this->
lng->txt(
'tst_msg_rand_quest_set_lost_pools_link'),
347 $msg_box = $this->ui_factory->messageBox()->info($report)->withLinks([$link]);
349 $msg_box = $this->ui_factory->messageBox()->info($report);
352 return $this->ui_renderer->render($msg_box);
358 $this->questionSetConfig->getLastQuestionSyncTimestamp(),
362 $this->
lng->txt(
'tst_msg_rand_quest_set_stage_pool_last_sync'),
366 $message .=
'<br>' . $this->
lng->txt(
'tst_msg_cannot_modify_random_question_set_conf_due_to_part');
368 $msg_box = $this->ui_factory->messageBox()->info($message);
371 $label = $this->
lng->txt(
'tst_btn_reset_pool_sync');
374 $this->ui_factory->button()->standard($label, $href)
377 $msg_box = $this->ui_factory->messageBox()
379 ->withButtons($buttons);
382 return $this->ui_renderer->render($msg_box);
387 $message = $this->
lng->txt(
'tst_msg_rand_quest_set_not_sync');
389 $msg_box = $this->ui_factory->messageBox()->info(
$message)->withButtons([$button]);
391 return $this->ui_renderer->render($msg_box);
setValidationFailed(bool $validationFailed)
setQuestionSetConfig(ilTestRandomQuestionSetConfig $questionSetConfig)
setParticipantDataExists(bool $participantDataExists)
string $sync_info_message
buildQuestionSelectionSubTabLink()
addValidationReport(string $validationReport)
isQuestionAmountConfigPerTestHintRequired()
const CONTEXT_POOL_SELECTION
doesParticipantDataExists()
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const CMD_SHOW_SRC_POOL_DEF_LIST
ilTestRandomQuestionSetConfig $questionSetConfig
getAfterRebuildQuestionStageCommand()
setContext(string $context)
buildQuestionStageRebuildButton()
const CONTEXT_GENERAL_CONFIG
bool $participantDataExists
isNoAvailableQuestionPoolsHintRequired()
buildLostQuestionPoolsString()
setSyncInfoMessage(string $message)
setTargetGUI(ilTestRandomQuestionSetConfigGUI $targetGUI)
ilTestRandomQuestionSetConfigGUI $targetGUI
const HTTP_PARAM_AFTER_REBUILD_QUESTION_STAGE_CMD
__construct(private ilLanguage $lng, private UIFactory $ui_factory, private UIRenderer $ui_renderer, private ilCtrlInterface $ctrl)
const CMD_SHOW_GENERAL_CONFIG_FORM
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
buildGeneralConfigSubTabLink()
buildLostPoolsReportMessage()
getValidationReportHtml()
setLostPools(array $lostPools)
const CMD_BUILD_QUESTION_STAGE
isQuestionAmountConfigPerPoolHintRequired()