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, $lng, and array.

65  {
66  $this->lng = $lng;
67  $this->ctrl = $ctrl;
68  $this->validationFailed = false;
69  $this->validationReports = array();
70  }
Create styles array
The data for the language used.

Member Function Documentation

◆ addValidationReport()

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

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

Referenced by handle().

188  {
189  $this->validationReports[] = $validationReport;
190  }
+ Here is the caller graph for this function:

◆ buildGeneralConfigSubTabLink()

ilTestRandomQuestionSetConfigStateMessageHandler::buildGeneralConfigSubTabLink ( )
private

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

References ilTestRandomQuestionSetConfigGUI\CMD_SHOW_GENERAL_CONFIG_FORM, and getTargetGUI().

Referenced by handle().

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  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildLostPoolsReport()

ilTestRandomQuestionSetConfigStateMessageHandler::buildLostPoolsReport ( )
protected
Returns
string

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

References buildLostQuestionPoolsString(), buildQuestionPoolsTabLink(), and getContext().

Referenced by handle().

390  {
391  $report = sprintf(
392  $this->lng->txt('tst_msg_rand_quest_set_lost_pools'),
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'),
400  );
401  }
402 
403  return $report;
404  }
+ 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.

References array, and getLostPools().

Referenced by buildLostPoolsReport().

266  {
267  $titles = array();
268 
269  foreach ($this->getLostPools() as $lostPool) {
270  $titles[] = $lostPool->getTitle();
271  }
272 
273  return implode(', ', $titles);
274  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildQuestionPoolsTabLink()

ilTestRandomQuestionSetConfigStateMessageHandler::buildQuestionPoolsTabLink ( )
protected
Returns
string

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

References ilTestRandomQuestionSetConfigGUI\CMD_SHOW_SRC_POOL_DEF_LIST, and getTargetGUI().

Referenced by buildLostPoolsReport().

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  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildQuestionSelectionSubTabLink()

ilTestRandomQuestionSetConfigStateMessageHandler::buildQuestionSelectionSubTabLink ( )
private

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

References ilTestRandomQuestionSetConfigGUI\CMD_SHOW_SRC_POOL_DEF_LIST, and getTargetGUI().

Referenced by handle().

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  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildQuestionStageRebuildLink()

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

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

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

Referenced by handle().

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  }
+ 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()

ilTestRandomQuestionSetConfigStateMessageHandler::getAfterRebuildQuestionStageCommand ( )
private

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

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

Referenced by buildQuestionStageRebuildLink().

277  {
278  switch ($this->getContext()) {
279  case self::CONTEXT_POOL_SELECTION:
280 
282 
283  case self::CONTEXT_GENERAL_CONFIG:
284  default:
285 
287  }
288  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContext()

◆ getLostPools()

ilTestRandomQuestionSetConfigStateMessageHandler::getLostPools ( )

◆ getQuestionSetConfig()

ilTestRandomQuestionSetConfigStateMessageHandler::getQuestionSetConfig ( )

◆ getTargetGUI()

ilTestRandomQuestionSetConfigStateMessageHandler::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.

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

193  {
195  $this->addValidationReport($this->lng->txt('tst_msg_rand_quest_set_no_pools_available'));
196  } elseif ($this->getLostPools()) {
197  $this->addValidationReport($this->buildLostPoolsReport());
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'),
206  )
207  );
208  } elseif ($this->isQuestionAmountConfigPerPoolHintRequired()) {
209  $this->addValidationReport(
210  sprintf(
211  $this->lng->txt('tst_msg_rand_quest_set_change_quest_amount_here'),
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 
253  $this->addValidationReport(sprintf(
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  }
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
const IL_CAL_UNIX
Date and time handling
+ 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.

References getContext().

Referenced by handle().

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  }
+ 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.

References getContext().

Referenced by handle().

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  }
+ 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.

References getContext().

Referenced by handle().

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  }
+ 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.

References $context.

◆ setLostPools()

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

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

References $lostPools.

◆ setParticipantDataExists()

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

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

References $participantDataExists.

◆ setQuestionSetConfig()

ilTestRandomQuestionSetConfigStateMessageHandler::setQuestionSetConfig (   $questionSetConfig)

◆ setTargetGUI()

ilTestRandomQuestionSetConfigStateMessageHandler::setTargetGUI (   $targetGUI)

◆ setValidationFailed()

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

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

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: