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.

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 }

References ilTestRandomQuestionSetConfigGUI\CMD_SHOW_GENERAL_CONFIG_FORM, and getTargetGUI().

+ Here is the call graph for this function:

◆ buildLostQuestionPoolsString()

ilTestRandomQuestionSetConfigStateMessageHandler::buildLostQuestionPoolsString ( )
private

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

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

References getLostPools().

+ Here is the call graph for this function:

◆ buildQuestionSelectionSubTabLink()

ilTestRandomQuestionSetConfigStateMessageHandler::buildQuestionSelectionSubTabLink ( )
private

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

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 }

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

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 }

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

References $participantDataExists.

Referenced by handle().

+ Here is the caller graph for this function:

◆ getAfterRebuildQuestionStageCommand()

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

142 {
143 if( $this->getLostPools() )
144 {
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'),
160 $this->buildGeneralConfigSubTabLink()
161 );
162 }
164 {
165 $infoMessage[] = sprintf(
166 $this->lng->txt('tst_msg_rand_quest_set_change_quest_amount_here'),
167 $this->buildQuestionSelectionSubTabLink()
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 }
sprintf('%.4f', $callTime)
const IL_CAL_UNIX
static formatDate(ilDateTime $date)
Format a date @access public.
@classDescription Date and time handling
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References buildQuestionStageRebuildLink(), doesParticipantDataExists(), ilDatePresentation\formatDate(), getLostPools(), IL_CAL_UNIX, isNoAvailableQuestionPoolsHintRequired(), isQuestionAmountConfigPerPoolHintRequired(), isQuestionAmountConfigPerTestHintRequired(), ilUtil\sendFailure(), ilUtil\sendInfo(), and sprintf.

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

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 }

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

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 }

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

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 }

References getContext().

Referenced by handle().

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

120 {
121 $this->context = $context;
122 }

References $context.

◆ setLostPools()

ilTestRandomQuestionSetConfigStateMessageHandler::setLostPools (   $lostPools)
Parameters
array$lostPools

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

72 {
73 $this->lostPools = $lostPools;
74 }

References $lostPools.

◆ setParticipantDataExists()

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

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

88 {
89 $this->participantDataExists = $participantDataExists;
90 }

References $participantDataExists.

◆ setQuestionSetConfig()

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

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

136 {
137 $this->questionSetConfig = $questionSetConfig;
138 }

References $questionSetConfig.

◆ setTargetGUI()

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

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

104 {
105 $this->targetGUI = $targetGUI;
106 }

References $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: