ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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)
 
 handle ()
 

Data Fields

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

Protected Attributes

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

Private Member Functions

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

Member Function Documentation

◆ buildGeneralConfigSubTabLink()

ilTestRandomQuestionSetConfigStateMessageHandler::buildGeneralConfigSubTabLink ( )
private

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

References ilTestRandomQuestionSetConfigGUI\CMD_SHOW_GENERAL_CONFIG_FORM, and getTargetGUI().

Referenced by handle().

255  {
256  $href = $this->ctrl->getLinkTarget(
258  );
259 
260  $label = $this->lng->txt('tst_rnd_quest_cfg_tab_general');
261 
262  return "<a href=\"{$href}\">{$label}</a>";
263  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildLostQuestionPoolsString()

ilTestRandomQuestionSetConfigStateMessageHandler::buildLostQuestionPoolsString ( )
private

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

References array, and getLostPools().

Referenced by handle().

209  {
210  $titles = array();
211 
212  foreach($this->getLostPools() as $lostPool)
213  {
214  $titles[] = $lostPool->getTitle();
215  }
216 
217  return implode(', ', $titles);
218  }
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:

◆ buildQuestionSelectionSubTabLink()

ilTestRandomQuestionSetConfigStateMessageHandler::buildQuestionSelectionSubTabLink ( )
private

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

References ilTestRandomQuestionSetConfigGUI\CMD_SHOW_SRC_POOL_DEF_LIST, and getTargetGUI().

Referenced by handle().

266  {
267  $href = $this->ctrl->getLinkTarget(
269  );
270 
271  $label = $this->lng->txt('tst_rnd_quest_cfg_tab_pool');
272 
273  return "<a href=\"{$href}\">{$label}</a>";
274  }
+ 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 239 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().

240  {
241  $this->ctrl->setParameter( $this->getTargetGUI(),
244  );
245 
246  $href = $this->ctrl->getLinkTarget(
248  );
249  $label = $this->lng->txt('tst_btn_rebuild_random_question_stage');
250 
251  return "<a href=\"{$href}\">{$label}</a>";
252  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doesParticipantDataExists()

ilTestRandomQuestionSetConfigStateMessageHandler::doesParticipantDataExists ( )
Returns
boolean

Definition at line 79 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 220 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

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

Referenced by buildQuestionStageRebuildLink().

221  {
222  switch($this->getContext())
223  {
224  case self::CONTEXT_POOL_SELECTION:
225 
227 
228  case self::CONTEXT_GENERAL_CONFIG:
229  default:
230 
232  }
233  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getContext()

ilTestRandomQuestionSetConfigStateMessageHandler::getContext ( )

◆ getLostPools()

ilTestRandomQuestionSetConfigStateMessageHandler::getLostPools ( )
Returns
array

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

References $lostPools.

Referenced by buildLostQuestionPoolsString(), and handle().

+ Here is the caller graph for this function:

◆ getQuestionSetConfig()

ilTestRandomQuestionSetConfigStateMessageHandler::getQuestionSetConfig ( )

◆ getTargetGUI()

ilTestRandomQuestionSetConfigStateMessageHandler::getTargetGUI ( )

◆ handle()

ilTestRandomQuestionSetConfigStateMessageHandler::handle ( )

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

References array, buildGeneralConfigSubTabLink(), buildLostQuestionPoolsString(), buildQuestionSelectionSubTabLink(), buildQuestionStageRebuildLink(), doesParticipantDataExists(), ilDatePresentation\formatDate(), getLostPools(), IL_CAL_UNIX, isNoAvailableQuestionPoolsHintRequired(), isQuestionAmountConfigPerPoolHintRequired(), isQuestionAmountConfigPerTestHintRequired(), ilUtil\sendFailure(), and ilUtil\sendInfo().

142  {
143  if( $this->getLostPools() )
144  {
145  ilUtil::sendFailure(sprintf(
146  $this->lng->txt('tst_msg_rand_quest_set_lost_pools'), $this->buildLostQuestionPoolsString()
147  ));
148  }
149 
150  $infoMessage = array();
151 
152  if( !$this->questionSetConfig->isQuestionAmountConfigComplete() )
153  {
154  $infoMessage[] = $this->lng->txt('tst_msg_rand_quest_set_incomplete_quest_amount_cfg');
155 
157  {
158  $infoMessage[] = sprintf(
159  $this->lng->txt('tst_msg_rand_quest_set_change_quest_amount_here'),
161  );
162  }
164  {
165  $infoMessage[] = sprintf(
166  $this->lng->txt('tst_msg_rand_quest_set_change_quest_amount_here'),
168  );
169  }
170  }
171  elseif( !$this->questionSetConfig->hasSourcePoolDefinitions() )
172  {
173  $infoMessage[] = $this->lng->txt('tst_msg_rand_quest_set_no_src_pool_defs');
174  }
175  elseif( !$this->questionSetConfig->isQuestionSetBuildable() )
176  {
177  $infoMessage[] = $this->lng->txt('tst_msg_rand_quest_set_pass_not_buildable');
178  }
179  else
180  {
181  $infoMessage[] = $this->lng->txt('tst_msg_rand_quest_set_pass_buildable');
182 
183  if( $this->questionSetConfig->getLastQuestionSyncTimestamp() )
184  {
185  $syncDate = new ilDateTime(
186  $this->questionSetConfig->getLastQuestionSyncTimestamp(), IL_CAL_UNIX
187  );
188 
189  $infoMessage[] = sprintf(
190  $this->lng->txt('tst_msg_rand_quest_set_stage_pool_last_sync'), ilDatePresentation::formatDate($syncDate)
191  );
192  }
193 
194  if( !$this->doesParticipantDataExists() && !$this->getLostPools() )
195  {
196  $infoMessage[] = $this->buildQuestionStageRebuildLink();
197  }
198  }
199 
201  {
202  $infoMessage[] = $this->lng->txt('tst_msg_rand_quest_set_no_pools_available');
203  }
204 
205  ilUtil::sendInfo(implode('<br />', $infoMessage));
206  }
const IL_CAL_UNIX
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static formatDate(ilDateTime $date)
Format a date public.
Date and time handling
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ isNoAvailableQuestionPoolsHintRequired()

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

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

References getContext().

Referenced by handle().

281  {
282  if( $this->getContext() != self::CONTEXT_POOL_SELECTION )
283  {
284  return false;
285  }
286 
287  if( $this->questionSetConfig->doesSelectableQuestionPoolsExist() )
288  {
289  return false;
290  }
291 
292  return true;
293  }
+ 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 299 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

References getContext().

Referenced by handle().

300  {
301  if( $this->getContext() != self::CONTEXT_GENERAL_CONFIG )
302  {
303  return false;
304  }
305 
306  if( !$this->questionSetConfig->isQuestionAmountConfigurationModePerPool() )
307  {
308  return false;
309  }
310 
311  return true;
312  }
+ 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 318 of file class.ilTestRandomQuestionSetConfigStateMessageHandler.php.

References getContext().

Referenced by handle().

319  {
320  if( $this->getContext() != self::CONTEXT_POOL_SELECTION )
321  {
322  return false;
323  }
324 
325  if( !$this->questionSetConfig->isQuestionAmountConfigurationModePerTest() )
326  {
327  return false;
328  }
329 
330  return true;
331  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContext()

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

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

References $context.

◆ setLostPools()

ilTestRandomQuestionSetConfigStateMessageHandler::setLostPools (   $lostPools)

◆ setParticipantDataExists()

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

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

References $participantDataExists.

◆ setQuestionSetConfig()

ilTestRandomQuestionSetConfigStateMessageHandler::setQuestionSetConfig (   $questionSetConfig)

◆ setTargetGUI()

ilTestRandomQuestionSetConfigStateMessageHandler::setTargetGUI (   $targetGUI)

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

◆ 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: