ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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

 buildLostPoolsReport ()
 
 buildQuestionPoolsTabLink ()
 

Protected Attributes

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

Private Member Functions

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

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

References $ctrl, and $lng.

Member Function Documentation

◆ addValidationReport()

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

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

188 {
189 $this->validationReports[] = $validationReport;
190 }

Referenced by handle().

+ Here is the caller graph for this function:

◆ buildGeneralConfigSubTabLink()

ilTestRandomQuestionSetConfigStateMessageHandler::buildGeneralConfigSubTabLink ( )
private

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

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

References ilTestRandomQuestionSetConfigGUI\CMD_SHOW_GENERAL_CONFIG_FORM, and getTargetGUI().

+ Here is the call graph for this function:

◆ buildLostPoolsReport()

ilTestRandomQuestionSetConfigStateMessageHandler::buildLostPoolsReport ( )
protected
Returns
string

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

390 {
391 $report = sprintf(
392 $this->lng->txt('tst_msg_rand_quest_set_lost_pools'),
393 $this->buildLostQuestionPoolsString()
394 );
395
396 if ($this->getContext() == self::CONTEXT_GENERAL_CONFIG) {
397 $report .= '<br /><br />' . sprintf(
398 $this->lng->txt('tst_msg_rand_quest_set_lost_pools_link'),
399 $this->buildQuestionPoolsTabLink()
400 );
401 }
402
403 return $report;
404 }
sprintf('%.4f', $callTime)

References getContext(), and sprintf.

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

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

References getLostPools().

+ Here is the call graph for this function:

◆ buildQuestionPoolsTabLink()

ilTestRandomQuestionSetConfigStateMessageHandler::buildQuestionPoolsTabLink ( )
protected
Returns
string

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

410 {
411 $href = $this->ctrl->getLinkTarget(
412 $this->getTargetGUI(),
414 );
415
416 $label = $this->getTargetGUI()->getPoolConfigTabLabel();
417
418 return "<a href=\"{$href}\">{$label}</a>";
419 }

References ilTestRandomQuestionSetConfigGUI\CMD_SHOW_SRC_POOL_DEF_LIST, and getTargetGUI().

+ Here is the call graph for this function:

◆ buildQuestionSelectionSubTabLink()

ilTestRandomQuestionSetConfigStateMessageHandler::buildQuestionSelectionSubTabLink ( )
private

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

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

References ilTestRandomQuestionSetConfigGUI\CMD_SHOW_SRC_POOL_DEF_LIST, and getTargetGUI().

+ Here is the call graph for this function:

◆ buildQuestionStageRebuildLink()

ilTestRandomQuestionSetConfigStateMessageHandler::buildQuestionStageRebuildLink ( )
private
Parameters
$afterRebuildQuestionStageCmd
Returns
string

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

295 {
296 $this->ctrl->setParameter(
297 $this->getTargetGUI(),
300 );
301
302 $href = $this->ctrl->getLinkTarget(
303 $this->getTargetGUI(),
305 );
306 $label = $this->lng->txt('tst_btn_rebuild_random_question_stage');
307
308 return "<a href=\"{$href}\">{$label}</a>";
309 }

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

172 {
173 return implode('<br />', $this->validationReports);
174 }

◆ handle()

ilTestRandomQuestionSetConfigStateMessageHandler::handle ( )

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

193 {
195 $this->addValidationReport($this->lng->txt('tst_msg_rand_quest_set_no_pools_available'));
196 } elseif ($this->getLostPools()) {
198 } elseif (!$this->questionSetConfig->isQuestionAmountConfigComplete()) {
199 $this->addValidationReport($this->lng->txt('tst_msg_rand_quest_set_incomplete_quest_amount_cfg'));
200
202 $this->addValidationReport(
203 sprintf(
204 $this->lng->txt('tst_msg_rand_quest_set_change_quest_amount_here'),
205 $this->buildGeneralConfigSubTabLink()
206 )
207 );
209 $this->addValidationReport(
210 sprintf(
211 $this->lng->txt('tst_msg_rand_quest_set_change_quest_amount_here'),
212 $this->buildQuestionSelectionSubTabLink()
213 )
214 );
215 }
216 } elseif (!$this->questionSetConfig->hasSourcePoolDefinitions()) {
217 $this->addValidationReport($this->lng->txt('tst_msg_rand_quest_set_no_src_pool_defs'));
218 }
219 // fau: delayCopyRandomQuestions - show info message if date of last synchronisation is empty
220 elseif ($this->questionSetConfig->getLastQuestionSyncTimestamp() == 0) {
221 $this->addValidationReport($this->lng->txt('tst_msg_rand_quest_set_not_sync'));
222 $this->addValidationReport("<br />{$this->buildQuestionStageRebuildLink()}");
223 $this->addValidationReport("<br><small>" . $this->lng->txt('tst_msg_rand_quest_set_sync_duration') . "</small>");
224 }
225 // fau.
226
227 elseif (!$this->questionSetConfig->isQuestionSetBuildable()) {
228 $this->setValidationFailed(true);
229 $this->addValidationReport($this->lng->txt('tst_msg_rand_quest_set_pass_not_buildable'));
230
231 //fau: fixRandomTestBuildable - show the messages if set is not buildable
232 $this->addValidationReport(implode('<br />', $this->questionSetConfig->getBuildableMessages()));
233 //fau.
234 } else {
235 //fau: fixRandomTestBuildable - show the messages if set is buildable but messages exist
236 #if (count($this->questionSetConfig->getBuildableMessages()))
237 #{
238 //$this->setValidationFailed(true);
239
240 // REALLY REQUIRED !?? vielleicht doch?
241 //ilUtil::sendFailure(implode('<br />', $this->questionSetConfig->getBuildableMessages()));
242 #}
243 //fau.
244
245 $this->addValidationReport($this->lng->txt('tst_msg_rand_quest_set_pass_buildable'));
246
247 if ($this->questionSetConfig->getLastQuestionSyncTimestamp()) {
248 $syncDate = new ilDateTime(
249 $this->questionSetConfig->getLastQuestionSyncTimestamp(),
251 );
252
254 $this->lng->txt('tst_msg_rand_quest_set_stage_pool_last_sync'),
256 ));
257 }
258
259 if (!$this->doesParticipantDataExists() && !$this->getLostPools()) {
261 }
262 }
263 }
const IL_CAL_UNIX
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
@classDescription Date and time handling

References addValidationReport(), buildLostPoolsReport(), buildQuestionStageRebuildLink(), doesParticipantDataExists(), ilDatePresentation\formatDate(), getLostPools(), IL_CAL_UNIX, isNoAvailableQuestionPoolsHintRequired(), isQuestionAmountConfigPerPoolHintRequired(), isQuestionAmountConfigPerTestHintRequired(), setValidationFailed(), and sprintf.

+ Here is the call graph for this function:

◆ hasValidationReports()

ilTestRandomQuestionSetConfigStateMessageHandler::hasValidationReports ( )
Returns
array

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

180 {
181 return count($this->validationReports);
182 }

◆ isNoAvailableQuestionPoolsHintRequired()

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

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

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

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

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

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

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

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 (   $context)
Parameters
string$context

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

132 {
133 $this->context = $context;
134 }

References $context.

◆ setLostPools()

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

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

84 {
85 $this->lostPools = $lostPools;
86 }

References $lostPools.

◆ setParticipantDataExists()

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

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

100 {
101 $this->participantDataExists = $participantDataExists;
102 }

References $participantDataExists.

◆ setQuestionSetConfig()

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

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

148 {
149 $this->questionSetConfig = $questionSetConfig;
150 }

References $questionSetConfig.

◆ setTargetGUI()

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

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

116 {
117 $this->targetGUI = $targetGUI;
118 }

References $targetGUI.

◆ setValidationFailed()

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

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

164 {
165 $this->validationFailed = $validationFailed;
166 }

References $validationFailed.

Referenced by handle().

+ Here is the caller graph for this function:

Field Documentation

◆ $context

ilTestRandomQuestionSetConfigStateMessageHandler::$context
protected

◆ $ctrl

ilTestRandomQuestionSetConfigStateMessageHandler::$ctrl
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: