ILIAS  release_8 Revision v8.24
ilTestRandomQuestionSetConfigStateMessageHandler Class Reference
+ Collaboration diagram for ilTestRandomQuestionSetConfigStateMessageHandler:

Public Member Functions

 __construct (ilLanguage $lng, UIServices $ui, ilCtrl $ctrl)
 
 getLostPools ()
 
 setLostPools (array $lostPools)
 
 doesParticipantDataExists ()
 
 setParticipantDataExists (bool $participantDataExists)
 
 getTargetGUI ()
 
 setTargetGUI (ilTestRandomQuestionSetConfigGUI $targetGUI)
 
 getContext ()
 
 setContext (string $context)
 
 getQuestionSetConfig ()
 
 setQuestionSetConfig (ilTestRandomQuestionSetConfig $questionSetConfig)
 
 isValidationFailed ()
 
 getValidationReportHtml ()
 
 hasValidationReports ()
 
 getSyncInfoMessage ()
 
 handle ()
 

Data Fields

const CONTEXT_GENERAL_CONFIG = 'generalConfigContext'
 
const CONTEXT_POOL_SELECTION = 'poolSelectionContext'
 

Protected Member Functions

 setValidationFailed (bool $validationFailed)
 
 addValidationReport (string $validationReport)
 
 setSyncInfoMessage (string $message)
 
 buildLostPoolsReportMessage ()
 
 buildLastSyncMessage ()
 
 buildNotSyncedMessage ()
 

Protected Attributes

UIServices $ui
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilTestRandomQuestionSetConfigGUI $targetGUI
 
string $context
 
bool $participantDataExists
 
array $lostPools
 
ilTestRandomQuestionSetConfig $questionSetConfig
 
bool $validationFailed = false
 
array $validationReports = []
 
string $sync_info_message = ''
 

Private Member Functions

 buildLostQuestionPoolsString ()
 
 getAfterRebuildQuestionStageCommand ()
 
 buildQuestionStageRebuildButton ()
 
 buildGeneralConfigSubTabLink ()
 
 buildQuestionSelectionSubTabLink ()
 
 isNoAvailableQuestionPoolsHintRequired ()
 
 isQuestionAmountConfigPerPoolHintRequired ()
 
 isQuestionAmountConfigPerTestHintRequired ()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ addValidationReport()

ilTestRandomQuestionSetConfigStateMessageHandler::addValidationReport ( string  $validationReport)
protected

Definition at line 143 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

144 {
145 $this->validationReports[] = $validationReport;
146 }

Referenced by handle().

+ Here is the caller graph for this function:

◆ buildGeneralConfigSubTabLink()

ilTestRandomQuestionSetConfigStateMessageHandler::buildGeneralConfigSubTabLink ( )
private

Definition at line 238 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

238 : string
239 {
240 $href = $this->ctrl->getLinkTarget(
241 $this->getTargetGUI(),
243 );
244
245 $label = $this->lng->txt('tst_rnd_quest_cfg_tab_general');
246
247 return "<a href=\"{$href}\">{$label}</a>";
248 }

References ilTestRandomQuestionSetConfigGUI\CMD_SHOW_GENERAL_CONFIG_FORM, ILIAS\Repository\ctrl(), getTargetGUI(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ buildLastSyncMessage()

ilTestRandomQuestionSetConfigStateMessageHandler::buildLastSyncMessage ( )
protected

Definition at line 335 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

335 : string
336 {
337 $sync_date = new ilDateTime(
338 $this->questionSetConfig->getLastQuestionSyncTimestamp(),
340 );
341 $message = sprintf(
342 $this->lng->txt('tst_msg_rand_quest_set_stage_pool_last_sync'),
344 );
345 if ($this->doesParticipantDataExists()) {
346 $message .= '<br>' . $this->lng->txt('tst_msg_cannot_modify_random_question_set_conf_due_to_part');
347
348 $msg_box = $this->ui->factory()->messageBox()->info($message);
349 } else {
350 $href = $this->ctrl->getLinkTargetByClass(ilTestRandomQuestionSetConfigGUI::class, ilTestRandomQuestionSetConfigGUI::CMD_RESET_POOLSYNC);
351 $label = $this->lng->txt('tst_btn_reset_pool_sync');
352
353 $buttons = [
354 $this->ui->factory()->button()->standard($label, $href)
355 ];
356
357 $msg_box = $this->ui->factory()->messageBox()
358 ->info($message)
359 ->withButtons($buttons);
360 }
361
362 return $this->ui->renderer()->render($msg_box);
363 }
const IL_CAL_UNIX
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
@classDescription Date and time handling
$message
Definition: xapiexit.php:32

References $message, ilTestRandomQuestionSetConfigGUI\CMD_RESET_POOLSYNC, ILIAS\Repository\ctrl(), doesParticipantDataExists(), ilDatePresentation\formatDate(), IL_CAL_UNIX, ILIAS\Repository\lng(), and ILIAS\Repository\ui().

Referenced by handle().

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

◆ buildLostPoolsReportMessage()

ilTestRandomQuestionSetConfigStateMessageHandler::buildLostPoolsReportMessage ( )
protected

Definition at line 309 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

309 : string
310 {
311 $report = sprintf(
312 $this->lng->txt('tst_msg_rand_quest_set_lost_pools'),
313 $this->buildLostQuestionPoolsString()
314 );
315
316 if ($this->getContext() == self::CONTEXT_GENERAL_CONFIG) {
317 $action = $this->ctrl->getLinkTarget(
318 $this->getTargetGUI(),
320 );
321
322 $link = $this->ui->factory()->link()->standard(
323 $this->lng->txt('tst_msg_rand_quest_set_lost_pools_link'),
324 $action
325 );
326
327 $msg_box = $this->ui->factory()->messageBox()->info($report)->withLinks(array($link));
328 } else {
329 $msg_box = $this->ui->factory()->messageBox()->info($report);
330 }
331
332 return $this->ui->renderer()->render($msg_box);
333 }

References ilTestRandomQuestionSetConfigGUI\CMD_SHOW_SRC_POOL_DEF_LIST, ILIAS\Repository\ctrl(), getContext(), getTargetGUI(), ILIAS\Repository\lng(), and ILIAS\Repository\ui().

Referenced by handle().

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

◆ buildLostQuestionPoolsString()

ilTestRandomQuestionSetConfigStateMessageHandler::buildLostQuestionPoolsString ( )
private

Definition at line 196 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

196 : string
197 {
198 $titles = array();
199
200 foreach ($this->getLostPools() as $lostPool) {
201 $titles[] = $lostPool->getTitle();
202 }
203
204 return implode(', ', $titles);
205 }

References getLostPools().

+ Here is the call graph for this function:

◆ buildNotSyncedMessage()

ilTestRandomQuestionSetConfigStateMessageHandler::buildNotSyncedMessage ( )
protected

Definition at line 365 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

365 : string
366 {
367 $message = $this->lng->txt('tst_msg_rand_quest_set_not_sync');
368 $button = $this->buildQuestionStageRebuildButton();
369 $msg_box = $this->ui->factory()->messageBox()->info($message)->withButtons(array($button));
370
371 return $this->ui->renderer()->render($msg_box);
372 }

References $message, buildQuestionStageRebuildButton(), ILIAS\Repository\lng(), and ILIAS\Repository\ui().

Referenced by handle().

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

◆ buildQuestionSelectionSubTabLink()

ilTestRandomQuestionSetConfigStateMessageHandler::buildQuestionSelectionSubTabLink ( )
private

Definition at line 250 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

250 : string
251 {
252 $href = $this->ctrl->getLinkTarget(
253 $this->getTargetGUI(),
255 );
256
257 $label = $this->lng->txt('tst_rnd_quest_cfg_tab_pool');
258
259 return "<a href=\"{$href}\">{$label}</a>";
260 }

References ilTestRandomQuestionSetConfigGUI\CMD_SHOW_SRC_POOL_DEF_LIST, ILIAS\Repository\ctrl(), getTargetGUI(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ buildQuestionStageRebuildButton()

ilTestRandomQuestionSetConfigStateMessageHandler::buildQuestionStageRebuildButton ( )
private

Definition at line 221 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

221 : StandardButton
222 {
223 $this->ctrl->setParameter(
224 $this->getTargetGUI(),
227 );
228
229 $href = $this->ctrl->getLinkTarget(
230 $this->getTargetGUI(),
232 );
233 $label = $this->lng->txt('tst_btn_rebuild_random_question_stage');
234
235 return $this->ui->factory()->button()->standard($label, $href)->withLoadingAnimationOnClick(true);
236 }

References ilTestRandomQuestionSetConfigGUI\CMD_BUILD_QUESTION_STAGE, ILIAS\Repository\ctrl(), getAfterRebuildQuestionStageCommand(), getTargetGUI(), ilTestRandomQuestionSetConfigGUI\HTTP_PARAM_AFTER_REBUILD_QUESTION_STAGE_CMD, ILIAS\Repository\lng(), and ILIAS\Repository\ui().

Referenced by buildNotSyncedMessage().

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

◆ doesParticipantDataExists()

ilTestRandomQuestionSetConfigStateMessageHandler::doesParticipantDataExists ( )
Returns
boolean

Definition at line 83 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

References $participantDataExists.

Referenced by buildLastSyncMessage().

+ Here is the caller graph for this function:

◆ getAfterRebuildQuestionStageCommand()

◆ getContext()

◆ getLostPools()

ilTestRandomQuestionSetConfigStateMessageHandler::getLostPools ( )

◆ getQuestionSetConfig()

ilTestRandomQuestionSetConfigStateMessageHandler::getQuestionSetConfig ( )

◆ getSyncInfoMessage()

ilTestRandomQuestionSetConfigStateMessageHandler::getSyncInfoMessage ( )

◆ getTargetGUI()

◆ getValidationReportHtml()

ilTestRandomQuestionSetConfigStateMessageHandler::getValidationReportHtml ( )

Definition at line 133 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

133 : string
134 {
135 return implode('<br />', $this->validationReports);
136 }

◆ handle()

ilTestRandomQuestionSetConfigStateMessageHandler::handle ( )

Definition at line 158 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

158 : void
159 {
161 $this->addValidationReport($this->lng->txt('tst_msg_rand_quest_set_no_pools_available'));
162 } elseif ($this->getLostPools()) {
164 } elseif (!$this->questionSetConfig->isQuestionAmountConfigComplete()) {
165 $this->addValidationReport($this->lng->txt('tst_msg_rand_quest_set_incomplete_quest_amount_cfg'));
166
168 $this->addValidationReport(
169 sprintf(
170 $this->lng->txt('tst_msg_rand_quest_set_change_quest_amount_here'),
171 $this->buildGeneralConfigSubTabLink()
172 )
173 );
175 $this->addValidationReport(
176 sprintf(
177 $this->lng->txt('tst_msg_rand_quest_set_change_quest_amount_here'),
178 $this->buildQuestionSelectionSubTabLink()
179 )
180 );
181 }
182 } elseif (!$this->questionSetConfig->hasSourcePoolDefinitions()) {
183 $this->addValidationReport($this->lng->txt('tst_msg_rand_quest_set_no_src_pool_defs'));
184 } elseif ($this->questionSetConfig->getLastQuestionSyncTimestamp() === 0 ||
185 $this->questionSetConfig->getLastQuestionSyncTimestamp() === null) {
187 } elseif (!$this->questionSetConfig->isQuestionSetBuildable()) {
188 $this->setValidationFailed(true);
189 $this->addValidationReport($this->lng->txt('tst_msg_rand_quest_set_pass_not_buildable'));
190 $this->addValidationReport(implode('<br />', $this->questionSetConfig->getBuildableMessages()));
191 } elseif ($this->questionSetConfig->getLastQuestionSyncTimestamp()) {
193 }
194 }

References addValidationReport(), buildLastSyncMessage(), buildLostPoolsReportMessage(), buildNotSyncedMessage(), getLostPools(), isNoAvailableQuestionPoolsHintRequired(), isQuestionAmountConfigPerPoolHintRequired(), isQuestionAmountConfigPerTestHintRequired(), ILIAS\Repository\lng(), setSyncInfoMessage(), and setValidationFailed().

+ Here is the call graph for this function:

◆ hasValidationReports()

ilTestRandomQuestionSetConfigStateMessageHandler::hasValidationReports ( )

Definition at line 138 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

138 : int
139 {
140 return count($this->validationReports);
141 }

◆ isNoAvailableQuestionPoolsHintRequired()

ilTestRandomQuestionSetConfigStateMessageHandler::isNoAvailableQuestionPoolsHintRequired ( )
private
Parameters
$currentRequestCmd
Returns
bool

Definition at line 266 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

266 : bool
267 {
268 if ($this->getContext() != self::CONTEXT_POOL_SELECTION) {
269 return false;
270 }
271
272 if ($this->questionSetConfig->doesSelectableQuestionPoolsExist()) {
273 return false;
274 }
275
276 return true;
277 }

References getContext().

Referenced by handle().

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

◆ isQuestionAmountConfigPerPoolHintRequired()

ilTestRandomQuestionSetConfigStateMessageHandler::isQuestionAmountConfigPerPoolHintRequired ( )
private
Parameters
$currentRequestCmd
Returns
bool

Definition at line 283 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

283 : bool
284 {
285 if ($this->getContext() != self::CONTEXT_GENERAL_CONFIG) {
286 return false;
287 }
288
289 if (!$this->questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
290 return false;
291 }
292
293 return true;
294 }

References getContext().

Referenced by handle().

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

◆ isQuestionAmountConfigPerTestHintRequired()

ilTestRandomQuestionSetConfigStateMessageHandler::isQuestionAmountConfigPerTestHintRequired ( )
private

Definition at line 296 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

296 : bool
297 {
298 if ($this->getContext() != self::CONTEXT_POOL_SELECTION) {
299 return false;
300 }
301
302 if (!$this->questionSetConfig->isQuestionAmountConfigurationModePerTest()) {
303 return false;
304 }
305
306 return true;
307 }

References getContext().

Referenced by handle().

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

◆ isValidationFailed()

ilTestRandomQuestionSetConfigStateMessageHandler::isValidationFailed ( )

◆ setContext()

ilTestRandomQuestionSetConfigStateMessageHandler::setContext ( string  $context)

Definition at line 108 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

109 {
110 $this->context = $context;
111 }

References $context.

◆ setLostPools()

ilTestRandomQuestionSetConfigStateMessageHandler::setLostPools ( array  $lostPools)
Parameters
ilTestRandomQuestionSetNonAvailablePool[]$lostPools

Definition at line 75 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

75 : void
76 {
77 $this->lostPools = $lostPools;
78 }

References $lostPools.

◆ setParticipantDataExists()

ilTestRandomQuestionSetConfigStateMessageHandler::setParticipantDataExists ( bool  $participantDataExists)

Definition at line 88 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

88 : void
89 {
90 $this->participantDataExists = $participantDataExists;
91 }

References $participantDataExists.

◆ setQuestionSetConfig()

ilTestRandomQuestionSetConfigStateMessageHandler::setQuestionSetConfig ( ilTestRandomQuestionSetConfig  $questionSetConfig)

Definition at line 118 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

119 {
120 $this->questionSetConfig = $questionSetConfig;
121 }

References $questionSetConfig.

◆ setSyncInfoMessage()

ilTestRandomQuestionSetConfigStateMessageHandler::setSyncInfoMessage ( string  $message)
protected

Definition at line 153 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

153 : void
154 {
155 $this->sync_info_message = $message;
156 }

References $message.

Referenced by handle().

+ Here is the caller graph for this function:

◆ setTargetGUI()

ilTestRandomQuestionSetConfigStateMessageHandler::setTargetGUI ( ilTestRandomQuestionSetConfigGUI  $targetGUI)

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

99 {
100 $this->targetGUI = $targetGUI;
101 }

References $targetGUI.

◆ setValidationFailed()

ilTestRandomQuestionSetConfigStateMessageHandler::setValidationFailed ( bool  $validationFailed)
protected

Definition at line 128 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

129 {
130 $this->validationFailed = $validationFailed;
131 }

References $validationFailed.

Referenced by handle().

+ Here is the caller graph for this function:

Field Documentation

◆ $context

string ilTestRandomQuestionSetConfigStateMessageHandler::$context
protected

◆ $ctrl

ilCtrl ilTestRandomQuestionSetConfigStateMessageHandler::$ctrl
protected

◆ $lng

ilLanguage ilTestRandomQuestionSetConfigStateMessageHandler::$lng
protected

◆ $lostPools

array ilTestRandomQuestionSetConfigStateMessageHandler::$lostPools
protected

◆ $participantDataExists

bool ilTestRandomQuestionSetConfigStateMessageHandler::$participantDataExists
protected

◆ $questionSetConfig

ilTestRandomQuestionSetConfig ilTestRandomQuestionSetConfigStateMessageHandler::$questionSetConfig
protected

◆ $sync_info_message

string ilTestRandomQuestionSetConfigStateMessageHandler::$sync_info_message = ''
protected

◆ $targetGUI

ilTestRandomQuestionSetConfigGUI ilTestRandomQuestionSetConfigStateMessageHandler::$targetGUI
protected

◆ $ui

UIServices ilTestRandomQuestionSetConfigStateMessageHandler::$ui
protected

◆ $validationFailed

bool ilTestRandomQuestionSetConfigStateMessageHandler::$validationFailed = false
protected

◆ $validationReports

array ilTestRandomQuestionSetConfigStateMessageHandler::$validationReports = []
protected

◆ CONTEXT_GENERAL_CONFIG

const ilTestRandomQuestionSetConfigStateMessageHandler::CONTEXT_GENERAL_CONFIG = 'generalConfigContext'

◆ CONTEXT_POOL_SELECTION

const ilTestRandomQuestionSetConfigStateMessageHandler::CONTEXT_POOL_SELECTION = 'poolSelectionContext'

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