ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 312 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

313 {
314 $href = $this->ctrl->getLinkTarget(
315 $this->getTargetGUI(),
317 );
318
319 $label = $this->lng->txt('tst_rnd_quest_cfg_tab_general');
320
321 return "<a href=\"{$href}\">{$label}</a>";
322 }

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

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

References $action, 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 324 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

325 {
326 $href = $this->ctrl->getLinkTarget(
327 $this->getTargetGUI(),
329 );
330
331 $label = $this->lng->txt('tst_rnd_quest_cfg_tab_pool');
332
333 return "<a href=\"{$href}\">{$label}</a>";
334 }

References ilTestRandomQuestionSetConfigGUI\CMD_SHOW_SRC_POOL_DEF_LIST, and getTargetGUI().

+ Here is the call graph for this function:

◆ buildQuestionStageRebuildButton()

ilTestRandomQuestionSetConfigStateMessageHandler::buildQuestionStageRebuildButton ( )
private
Returns
\ILIAS\UI\Component\Button\Standard

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

296 {
297 $this->ctrl->setParameter(
298 $this->getTargetGUI(),
301 );
302
303 $href = $this->ctrl->getLinkTarget(
304 $this->getTargetGUI(),
306 );
307 $label = $this->lng->txt('tst_btn_rebuild_random_question_stage');
308
309 return $this->DIC->ui()->factory()->button()->standard($label, $href);
310 }

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
catch(Exception $e) $message

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

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

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

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

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

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

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

420 {
421 $this->DIC->ui()->mainTemplate()->setCurrentBlock('mess');
422 $this->DIC->ui()->mainTemplate()->setVariable('MESSAGE', $message);
423 $this->DIC->ui()->mainTemplate()->parseCurrentBlock();
424 }

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: