ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilTestRandomQuestionSetConfigStateMessageHandler Class Reference
+ Collaboration diagram for ilTestRandomQuestionSetConfigStateMessageHandler:

Public Member Functions

 __construct (ilLanguage $lng, ilCtrl $ctrl)
 
 getLostPools ()
 
 setLostPools ($lostPools)
 
 doesParticipantDataExists ()
 
 setParticipantDataExists ($participantDataExists)
 
 getTargetGUI ()
 
 setTargetGUI ($targetGUI)
 
 getContext ()
 
 setContext ($context)
 
 getQuestionSetConfig ()
 
 setQuestionSetConfig ($questionSetConfig)
 
 isValidationFailed ()
 
 setValidationFailed ($validationFailed)
 
 getValidationReportHtml ()
 
 hasValidationReports ()
 
 addValidationReport ($validationReport)
 
 handle ()
 

Data Fields

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

Protected Member Functions

 buildLostPoolsReportMessage ()
 
 populateMessage ($message)
 

Protected Attributes

 $DIC
 
 $lng
 
 $ctrl
 
 $targetGUI
 
 $context
 
 $participantDataExists
 
 $lostPools
 
 $questionSetConfig
 
 $validationFailed
 
 $validationReports
 

Private Member Functions

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTestRandomQuestionSetConfigStateMessageHandler::__construct ( ilLanguage  $lng,
ilCtrl  $ctrl 
)
Parameters
ilLanguage$lng

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

69 {
70 global $DIC; /* @var ILIAS\DI\Container $DIC */
71 $this->DIC = $DIC;
72
73 $this->lng = $lng;
74 $this->ctrl = $ctrl;
75 $this->validationFailed = false;
76 $this->validationReports = array();
77 }

References $ctrl, $DIC, and $lng.

Member Function Documentation

◆ addValidationReport()

ilTestRandomQuestionSetConfigStateMessageHandler::addValidationReport (   $validationReport)
Parameters
string$validationReport

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

195 {
196 $this->validationReports[] = $validationReport;
197 }

Referenced by handle().

+ Here is the caller graph for this function:

◆ buildGeneralConfigSubTabLink()

ilTestRandomQuestionSetConfigStateMessageHandler::buildGeneralConfigSubTabLink ( )
private

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

310 {
311 $href = $this->ctrl->getLinkTarget(
312 $this->getTargetGUI(),
314 );
315
316 $label = $this->lng->txt('tst_rnd_quest_cfg_tab_general');
317
318 return "<a href=\"{$href}\">{$label}</a>";
319 }

References ilTestRandomQuestionSetConfigGUI\CMD_SHOW_GENERAL_CONFIG_FORM, and getTargetGUI().

+ Here is the call graph for this function:

◆ buildLostPoolsReportMessage()

ilTestRandomQuestionSetConfigStateMessageHandler::buildLostPoolsReportMessage ( )
protected
Returns
string

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

388 {
389 $report = sprintf(
390 $this->lng->txt('tst_msg_rand_quest_set_lost_pools'),
391 $this->buildLostQuestionPoolsString()
392 );
393
394 if ($this->getContext() == self::CONTEXT_GENERAL_CONFIG) {
395 $action = $this->ctrl->getLinkTarget(
396 $this->getTargetGUI(),
398 );
399
400 $link = $this->DIC->ui()->factory()->link()->standard(
401 $this->lng->txt('tst_msg_rand_quest_set_lost_pools_link'),
402 $action
403 );
404
405 $msgBox = $this->DIC->ui()->factory()->messageBox()->info($report)->withLinks(array($link));
406 } else {
407 $msgBox = $this->DIC->ui()->factory()->messageBox()->info($report);
408 }
409
410 return $this->DIC->ui()->renderer()->render($msgBox);
411 }

References ilTestRandomQuestionSetConfigGUI\CMD_SHOW_SRC_POOL_DEF_LIST, getContext(), and getTargetGUI().

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 267 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

268 {
269 $titles = array();
270
271 foreach ($this->getLostPools() as $lostPool) {
272 $titles[] = $lostPool->getTitle();
273 }
274
275 return implode(', ', $titles);
276 }

References getLostPools().

+ Here is the call graph for this function:

◆ buildQuestionSelectionSubTabLink()

ilTestRandomQuestionSetConfigStateMessageHandler::buildQuestionSelectionSubTabLink ( )
private

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

322 {
323 $href = $this->ctrl->getLinkTarget(
324 $this->getTargetGUI(),
326 );
327
328 $label = $this->lng->txt('tst_rnd_quest_cfg_tab_pool');
329
330 return "<a href=\"{$href}\">{$label}</a>";
331 }

References ilTestRandomQuestionSetConfigGUI\CMD_SHOW_SRC_POOL_DEF_LIST, and getTargetGUI().

+ Here is the call graph for this function:

◆ buildQuestionStageRebuildButton()

ilTestRandomQuestionSetConfigStateMessageHandler::buildQuestionStageRebuildButton ( )
private

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

293 {
294 $this->ctrl->setParameter(
295 $this->getTargetGUI(),
298 );
299
300 $href = $this->ctrl->getLinkTarget(
301 $this->getTargetGUI(),
303 );
304 $label = $this->lng->txt('tst_btn_rebuild_random_question_stage');
305
306 return $this->DIC->ui()->factory()->button()->standard($label, $href)->withLoadingAnimationOnClick(true);
307 }
withLoadingAnimationOnClick(bool $loading_animation_on_click)
If clicked the button will display a spinner wheel to show that a request is being processed in the b...
This describes a standard button.
Definition: Standard.php:13

References ilTestRandomQuestionSetConfigGUI\CMD_BUILD_QUESTION_STAGE, getAfterRebuildQuestionStageCommand(), getTargetGUI(), and ilTestRandomQuestionSetConfigGUI\HTTP_PARAM_AFTER_REBUILD_QUESTION_STAGE_CMD.

Referenced by handle().

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

◆ doesParticipantDataExists()

ilTestRandomQuestionSetConfigStateMessageHandler::doesParticipantDataExists ( )
Returns
boolean

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

References $participantDataExists.

Referenced by handle().

+ Here is the caller graph for this function:

◆ getAfterRebuildQuestionStageCommand()

◆ getContext()

◆ getLostPools()

ilTestRandomQuestionSetConfigStateMessageHandler::getLostPools ( )

◆ getQuestionSetConfig()

ilTestRandomQuestionSetConfigStateMessageHandler::getQuestionSetConfig ( )

◆ getTargetGUI()

◆ getValidationReportHtml()

ilTestRandomQuestionSetConfigStateMessageHandler::getValidationReportHtml ( )
Returns
array

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

179 {
180 return implode('<br />', $this->validationReports);
181 }

◆ handle()

ilTestRandomQuestionSetConfigStateMessageHandler::handle ( )

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

200 {
202 $this->addValidationReport($this->lng->txt('tst_msg_rand_quest_set_no_pools_available'));
203 } elseif ($this->getLostPools()) {
205 } elseif (!$this->questionSetConfig->isQuestionAmountConfigComplete()) {
206 $this->addValidationReport($this->lng->txt('tst_msg_rand_quest_set_incomplete_quest_amount_cfg'));
207
209 $this->addValidationReport(
210 sprintf(
211 $this->lng->txt('tst_msg_rand_quest_set_change_quest_amount_here'),
212 $this->buildGeneralConfigSubTabLink()
213 )
214 );
216 $this->addValidationReport(
217 sprintf(
218 $this->lng->txt('tst_msg_rand_quest_set_change_quest_amount_here'),
219 $this->buildQuestionSelectionSubTabLink()
220 )
221 );
222 }
223 } elseif (!$this->questionSetConfig->hasSourcePoolDefinitions()) {
224 $this->addValidationReport($this->lng->txt('tst_msg_rand_quest_set_no_src_pool_defs'));
225 }
226 // fau: delayCopyRandomQuestions - show info message if date of last synchronisation is empty
227 elseif ($this->questionSetConfig->getLastQuestionSyncTimestamp() == 0) {
228 $message = $this->DIC->language()->txt('tst_msg_rand_quest_set_not_sync');
229 $button = $this->buildQuestionStageRebuildButton();
230 $msgBox = $this->DIC->ui()->factory()->messageBox()->info($message)->withButtons(array($button));
231 $this->populateMessage($this->DIC->ui()->renderer()->render($msgBox));
232 }
233 // fau.
234
235 elseif (!$this->questionSetConfig->isQuestionSetBuildable()) {
236 $this->setValidationFailed(true);
237 $this->addValidationReport($this->lng->txt('tst_msg_rand_quest_set_pass_not_buildable'));
238
239 //fau: fixRandomTestBuildable - show the messages if set is not buildable
240 $this->addValidationReport(implode('<br />', $this->questionSetConfig->getBuildableMessages()));
241 //fau.
242 } elseif ($this->questionSetConfig->getLastQuestionSyncTimestamp()) {
243 $message = $this->lng->txt('tst_msg_rand_quest_set_pass_buildable');
244
245 $syncDate = new ilDateTime(
246 $this->questionSetConfig->getLastQuestionSyncTimestamp(),
248 );
249
250 $message .= sprintf(
251 $this->lng->txt('tst_msg_rand_quest_set_stage_pool_last_sync'),
253 );
254
255 if (!$this->doesParticipantDataExists() && !$this->getLostPools()) {
256 $msgBox = $this->DIC->ui()->factory()->messageBox()->info($message)->withButtons(
257 array($this->buildQuestionStageRebuildButton())
258 );
259 } else {
260 $msgBox = $this->DIC->ui()->factory()->messageBox()->info($message);
261 }
262
263 $this->populateMessage($this->DIC->ui()->renderer()->render($msgBox));
264 }
265 }
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
$message
Definition: xapiexit.php:14

References $message, addValidationReport(), buildLostPoolsReportMessage(), buildQuestionStageRebuildButton(), doesParticipantDataExists(), ilDatePresentation\formatDate(), getLostPools(), IL_CAL_UNIX, isNoAvailableQuestionPoolsHintRequired(), isQuestionAmountConfigPerPoolHintRequired(), isQuestionAmountConfigPerTestHintRequired(), populateMessage(), and setValidationFailed().

+ Here is the call graph for this function:

◆ hasValidationReports()

ilTestRandomQuestionSetConfigStateMessageHandler::hasValidationReports ( )
Returns
array

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

187 {
188 return count($this->validationReports);
189 }

◆ isNoAvailableQuestionPoolsHintRequired()

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

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

338 {
339 if ($this->getContext() != self::CONTEXT_POOL_SELECTION) {
340 return false;
341 }
342
343 if ($this->questionSetConfig->doesSelectableQuestionPoolsExist()) {
344 return false;
345 }
346
347 return true;
348 }

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 354 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

355 {
356 if ($this->getContext() != self::CONTEXT_GENERAL_CONFIG) {
357 return false;
358 }
359
360 if (!$this->questionSetConfig->isQuestionAmountConfigurationModePerPool()) {
361 return false;
362 }
363
364 return true;
365 }

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
Parameters
$currentRequestCmd
Returns
bool

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

372 {
373 if ($this->getContext() != self::CONTEXT_POOL_SELECTION) {
374 return false;
375 }
376
377 if (!$this->questionSetConfig->isQuestionAmountConfigurationModePerTest()) {
378 return false;
379 }
380
381 return true;
382 }

References getContext().

Referenced by handle().

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

◆ isValidationFailed()

ilTestRandomQuestionSetConfigStateMessageHandler::isValidationFailed ( )

◆ populateMessage()

ilTestRandomQuestionSetConfigStateMessageHandler::populateMessage (   $message)
protected
Parameters
$message

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

417 {
418 $this->DIC->ui()->mainTemplate()->setCurrentBlock('mess');
419 $this->DIC->ui()->mainTemplate()->setVariable('MESSAGE', $message);
420 $this->DIC->ui()->mainTemplate()->parseCurrentBlock();
421 }

References $message.

Referenced by handle().

+ Here is the caller graph for this function:

◆ setContext()

ilTestRandomQuestionSetConfigStateMessageHandler::setContext (   $context)
Parameters
string$context

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

139 {
140 $this->context = $context;
141 }

References $context.

◆ setLostPools()

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

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

91 {
92 $this->lostPools = $lostPools;
93 }

References $lostPools.

◆ setParticipantDataExists()

ilTestRandomQuestionSetConfigStateMessageHandler::setParticipantDataExists (   $participantDataExists)
Parameters
boolean$participantDataExists

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

107 {
108 $this->participantDataExists = $participantDataExists;
109 }

References $participantDataExists.

◆ setQuestionSetConfig()

ilTestRandomQuestionSetConfigStateMessageHandler::setQuestionSetConfig (   $questionSetConfig)
Parameters
ilTestRandomQuestionSetConfig$questionSetConfig

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

155 {
156 $this->questionSetConfig = $questionSetConfig;
157 }

References $questionSetConfig.

◆ setTargetGUI()

ilTestRandomQuestionSetConfigStateMessageHandler::setTargetGUI (   $targetGUI)
Parameters
ilTestRandomQuestionSetConfigGUI$targetGUI

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

123 {
124 $this->targetGUI = $targetGUI;
125 }

References $targetGUI.

◆ setValidationFailed()

ilTestRandomQuestionSetConfigStateMessageHandler::setValidationFailed (   $validationFailed)
Parameters
bool$validationFailed

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

171 {
172 $this->validationFailed = $validationFailed;
173 }

References $validationFailed.

Referenced by handle().

+ Here is the caller graph for this function:

Field Documentation

◆ $context

ilTestRandomQuestionSetConfigStateMessageHandler::$context
protected

◆ $ctrl

ilTestRandomQuestionSetConfigStateMessageHandler::$ctrl
protected

◆ $DIC

ilTestRandomQuestionSetConfigStateMessageHandler::$DIC
protected

◆ $lng

ilTestRandomQuestionSetConfigStateMessageHandler::$lng
protected

◆ $lostPools

ilTestRandomQuestionSetConfigStateMessageHandler::$lostPools
protected

◆ $participantDataExists

ilTestRandomQuestionSetConfigStateMessageHandler::$participantDataExists
protected

◆ $questionSetConfig

ilTestRandomQuestionSetConfigStateMessageHandler::$questionSetConfig
protected

◆ $targetGUI

ilTestRandomQuestionSetConfigStateMessageHandler::$targetGUI
protected

◆ $validationFailed

ilTestRandomQuestionSetConfigStateMessageHandler::$validationFailed
protected

◆ $validationReports

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: