ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilTestQuestionHeaderBlockBuilder Class Reference
+ Inheritance diagram for ilTestQuestionHeaderBlockBuilder:
+ Collaboration diagram for ilTestQuestionHeaderBlockBuilder:

Public Member Functions

 __construct (ilLanguage $lng)
 
 getHeaderMode ()
 
 setHeaderMode ($headerMode)
 
 getQuestionTitle ()
 
 setQuestionTitle ($questionTitle)
 
 getQuestionPoints ()
 
 setQuestionPoints ($questionPoints)
 
 setQuestionAnswered ($questionAnswered)
 
 getQuestionPosition ()
 
 setQuestionPosition ($questionPosition)
 
 getQuestionCount ()
 
 setQuestionCount ($questionCount)
 
 isQuestionPostponed ()
 
 isQuestionAnswered ()
 
 setQuestionPostponed ($questionPostponed)
 
 isQuestionObligatory ()
 
 setQuestionObligatory ($questionObligatory)
 
 getQuestionRelatedObjectives ()
 
 setQuestionRelatedObjectives ($questionRelatedObjectives)
 
 getPresentationTitle ()
 Get the presentation title of the question This is shown above the title line in a test run. More...
 
 getQuestionInfoHTML ()
 Get the additional question info and answering status This is shown below the title line in a test run. More...
 
 getHTML ()
 Get the HTML representation of the header block. More...
 
 getHTML ()
 Get the HTML representation of the header block. More...
 

Protected Member Functions

 buildQuestionPositionString ()
 
 buildQuestionPointsString ()
 
 buildQuestionPostponedString ()
 
 buildQuestionObligatoryString ()
 
 buildQuestionRelatedObjectivesString ()
 

Protected Attributes

 $lng
 
 $headerMode
 
 $questionTitle
 
 $questionPoints
 
 $questionPosition
 
 $questionCount
 
 $questionPostponed
 
 $questionObligatory
 
 $questionRelatedObjectives
 
 $questionAnswered
 

Detailed Description

Definition at line 12 of file class.ilTestQuestionHeaderBlockBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestQuestionHeaderBlockBuilder::__construct ( ilLanguage  $lng)

Definition at line 66 of file class.ilTestQuestionHeaderBlockBuilder.php.

67 {
68 $this->lng = $lng;
69
70 $this->headerMode = null;
71 $this->questionTitle = '';
72 $this->questionPoints = 0.0;
73 $this->questionPosition = 0;
74 $this->questionCount = 0;
75 $this->questionPostponed = false;
76 $this->questionObligatory = false;
77 $this->questionRelatedObjectives = '';
78 }

References $lng.

Member Function Documentation

◆ buildQuestionObligatoryString()

ilTestQuestionHeaderBlockBuilder::buildQuestionObligatoryString ( )
protected

Definition at line 263 of file class.ilTestQuestionHeaderBlockBuilder.php.

264 {
265 if( $this->isQuestionObligatory() )
266 {
267 return $this->lng->txt("tst_you_have_to_answer_this_question");
268 }
269
270 return '';
271 }

References isQuestionObligatory().

Referenced by getHTML(), and getQuestionInfoHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildQuestionPointsString()

ilTestQuestionHeaderBlockBuilder::buildQuestionPointsString ( )
protected

Definition at line 243 of file class.ilTestQuestionHeaderBlockBuilder.php.

244 {
245 if( $this->getQuestionPoints() == 1 )
246 {
247 return "{$this->getQuestionPoints()} {$this->lng->txt('point')}";
248 }
249
250 return "{$this->getQuestionPoints()} {$this->lng->txt('points')}";
251 }

References getQuestionPoints().

Referenced by getQuestionInfoHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildQuestionPositionString()

ilTestQuestionHeaderBlockBuilder::buildQuestionPositionString ( )
protected

Definition at line 227 of file class.ilTestQuestionHeaderBlockBuilder.php.

228 {
229 if( !$this->getQuestionPosition() )
230 {
231 return '';
232 }
233
234 if( $this->getQuestionCount() )
235 {
236 return sprintf($this->lng->txt("tst_position"), $this->getQuestionPosition(), $this->getQuestionCount());
237 }
238
239 return sprintf($this->lng->txt("tst_position_without_total"), $this->getQuestionPosition());
240 }
sprintf('%.4f', $callTime)

References getQuestionCount(), getQuestionPosition(), and sprintf.

Referenced by getHTML(), getPresentationTitle(), and getQuestionInfoHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildQuestionPostponedString()

ilTestQuestionHeaderBlockBuilder::buildQuestionPostponedString ( )
protected

Definition at line 253 of file class.ilTestQuestionHeaderBlockBuilder.php.

254 {
255 if( $this->isQuestionPostponed() )
256 {
257 return $this->lng->txt("postponed");
258 }
259
260 return '';
261 }

References isQuestionPostponed().

Referenced by getHTML(), and getQuestionInfoHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildQuestionRelatedObjectivesString()

ilTestQuestionHeaderBlockBuilder::buildQuestionRelatedObjectivesString ( )
protected

Definition at line 273 of file class.ilTestQuestionHeaderBlockBuilder.php.

274 {
275 if( strlen($this->getQuestionRelatedObjectives()) )
276 {
277 $label = $this->lng->txt('tst_res_lo_objectives_header');
278 return $label.': '.$this->getQuestionRelatedObjectives();
279 }
280
281 return '';
282 }

References getQuestionRelatedObjectives().

Referenced by getHTML(), and getQuestionInfoHTML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHeaderMode()

ilTestQuestionHeaderBlockBuilder::getHeaderMode ( )
Returns
int

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

References $headerMode.

Referenced by getHTML(), getPresentationTitle(), and getQuestionInfoHTML().

+ Here is the caller graph for this function:

◆ getHTML()

ilTestQuestionHeaderBlockBuilder::getHTML ( )

Get the HTML representation of the header block.

Returns
string

Implements ilQuestionHeaderBlockBuilder.

Definition at line 372 of file class.ilTestQuestionHeaderBlockBuilder.php.

373 {
374 $headerBlock = $this->buildQuestionPositionString();
375
376 switch( $this->getHeaderMode() )
377 {
378 case 1:
379
380 $headerBlock .= " - ".$this->getQuestionTitle();
381 $headerBlock .= $this->buildQuestionPostponedString();
382 $headerBlock .= $this->buildQuestionObligatoryString();
383 break;
384
385 case 2:
386
387 $headerBlock .= $this->buildQuestionPostponedString();
388 $headerBlock .= $this->buildQuestionObligatoryString();
389 break;
390
391 case 0:
392 default:
393
394 $headerBlock .= " - ".$this->getQuestionTitle();
395 $headerBlock .= $this->buildQuestionPostponedString();
396// fau: testNav - put the points in parentheses here, not in building the string
397 $headerBlock .= ' ('.$this->buildQuestionPointsString().')';
398// fau.
399 $headerBlock .= $this->buildQuestionObligatoryString();
400 }
401
402 $headerBlock .= $this->buildQuestionRelatedObjectivesString();
403
404 return $headerBlock;
405 }

References buildQuestionObligatoryString(), buildQuestionPositionString(), buildQuestionPostponedString(), buildQuestionRelatedObjectivesString(), and getHeaderMode().

+ Here is the call graph for this function:

◆ getPresentationTitle()

ilTestQuestionHeaderBlockBuilder::getPresentationTitle ( )

Get the presentation title of the question This is shown above the title line in a test run.

Returns
string

Definition at line 293 of file class.ilTestQuestionHeaderBlockBuilder.php.

294 {
295 switch( $this->getHeaderMode() )
296 {
297 case 2: // neither titles nor points => show position as title
298 return $this->buildQuestionPositionString();
299 break;
300
301 case 0: // titles and points => show title here
302 case 1: // only titles => show title here
303 default:
304 return $this->getQuestionTitle();
305 }
306 }

References buildQuestionPositionString(), getHeaderMode(), and getQuestionTitle().

+ Here is the call graph for this function:

◆ getQuestionCount()

ilTestQuestionHeaderBlockBuilder::getQuestionCount ( )
Returns
int

Definition at line 156 of file class.ilTestQuestionHeaderBlockBuilder.php.

References $questionCount.

Referenced by buildQuestionPositionString().

+ Here is the caller graph for this function:

◆ getQuestionInfoHTML()

ilTestQuestionHeaderBlockBuilder::getQuestionInfoHTML ( )

Get the additional question info and answering status This is shown below the title line in a test run.

Returns
string html code of the info block

Definition at line 314 of file class.ilTestQuestionHeaderBlockBuilder.php.

315 {
316 $tpl = new ilTemplate('tpl.tst_question_info.html', true, true, 'Modules/Test');
317
318 // position and/or points
319 switch( $this->getHeaderMode() )
320 {
321 case 1: // only titles => show position here
323 break;
324
325 case 2: // neither titles nor points => position is separate title, show nothing here
326 $text = '';
327 break;
328
329 case 0: // titles and points => show position and points here
330 default:
331 $text = $this->buildQuestionPositionString() . ' (' . $this->buildQuestionPointsString() . ')';
332 }
333 if ($this->isQuestionPostponed())
334 {
335 $text .= ($text ? ', ' : '') . $this->buildQuestionPostponedString();
336 }
337
338 $tpl->setVariable('TXT_POSITION_POINTS',$text);
339
340 // obligatory
341 if ($this->isQuestionObligatory() && !$this->isQuestionAnswered())
342 {
343 $tpl->setVariable('TXT_OBLIGATORY', $this->buildQuestionObligatoryString());
344 }
345
346 // objectives
347 if (strlen($this->getQuestionRelatedObjectives()) )
348 {
349 $tpl->setVariable('TXT_OBJECTIVES', $this->buildQuestionRelatedObjectivesString());
350 }
351
352 // answer status
353 if ($this->isQuestionAnswered())
354 {
355 $tpl->setVariable('HIDDEN_NOT_ANSWERED', 'hidden');
356 }
357 else
358 {
359 $tpl->setVariable('HIDDEN_ANSWERED', 'hidden');
360 }
361
362 $tpl->setVariable('SRC_ANSWERED', ilUtil::getImagePath('answered.svg'));
363 $tpl->setVariable('SRC_NOT_ANSWERED', ilUtil::getImagePath('answered_not.svg'));
364 $tpl->setVariable('TXT_ANSWERED', $this->lng->txt('tst_answer_status_answered'));
365 $tpl->setVariable('TXT_NOT_ANSWERED', $this->lng->txt('tst_answer_status_not_answered'));
366 $tpl->setVariable('TXT_EDITING', $this->lng->txt('tst_answer_status_editing'));
367
368 return $tpl->get();
369 }
global $tpl
Definition: ilias.php:8
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
$text

References $text, $tpl, buildQuestionObligatoryString(), buildQuestionPointsString(), buildQuestionPositionString(), buildQuestionPostponedString(), buildQuestionRelatedObjectivesString(), getHeaderMode(), ilUtil\getImagePath(), getQuestionRelatedObjectives(), isQuestionAnswered(), isQuestionObligatory(), and isQuestionPostponed().

+ Here is the call graph for this function:

◆ getQuestionPoints()

ilTestQuestionHeaderBlockBuilder::getQuestionPoints ( )
Returns
float

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

References $questionPoints.

Referenced by buildQuestionPointsString().

+ Here is the caller graph for this function:

◆ getQuestionPosition()

ilTestQuestionHeaderBlockBuilder::getQuestionPosition ( )
Returns
int

Definition at line 140 of file class.ilTestQuestionHeaderBlockBuilder.php.

References $questionPosition.

Referenced by buildQuestionPositionString().

+ Here is the caller graph for this function:

◆ getQuestionRelatedObjectives()

ilTestQuestionHeaderBlockBuilder::getQuestionRelatedObjectives ( )
Returns
string

Definition at line 214 of file class.ilTestQuestionHeaderBlockBuilder.php.

References $questionRelatedObjectives.

Referenced by buildQuestionRelatedObjectivesString(), and getQuestionInfoHTML().

+ Here is the caller graph for this function:

◆ getQuestionTitle()

ilTestQuestionHeaderBlockBuilder::getQuestionTitle ( )
Returns
string

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

References $questionTitle.

Referenced by getPresentationTitle().

+ Here is the caller graph for this function:

◆ isQuestionAnswered()

ilTestQuestionHeaderBlockBuilder::isQuestionAnswered ( )
Returns
boolean | null

Definition at line 181 of file class.ilTestQuestionHeaderBlockBuilder.php.

References $questionAnswered.

Referenced by getQuestionInfoHTML().

+ Here is the caller graph for this function:

◆ isQuestionObligatory()

ilTestQuestionHeaderBlockBuilder::isQuestionObligatory ( )
Returns
boolean

Definition at line 198 of file class.ilTestQuestionHeaderBlockBuilder.php.

References $questionObligatory.

Referenced by buildQuestionObligatoryString(), and getQuestionInfoHTML().

+ Here is the caller graph for this function:

◆ isQuestionPostponed()

ilTestQuestionHeaderBlockBuilder::isQuestionPostponed ( )
Returns
boolean

Definition at line 172 of file class.ilTestQuestionHeaderBlockBuilder.php.

References $questionPostponed.

Referenced by buildQuestionPostponedString(), and getQuestionInfoHTML().

+ Here is the caller graph for this function:

◆ setHeaderMode()

ilTestQuestionHeaderBlockBuilder::setHeaderMode (   $headerMode)
Parameters
int$headerMode

Definition at line 91 of file class.ilTestQuestionHeaderBlockBuilder.php.

92 {
93 $this->headerMode = $headerMode;
94 }

References $headerMode.

◆ setQuestionAnswered()

ilTestQuestionHeaderBlockBuilder::setQuestionAnswered (   $questionAnswered)
Parameters
bool$questionAnswered

Definition at line 132 of file class.ilTestQuestionHeaderBlockBuilder.php.

133 {
134 $this->questionAnswered = $questionAnswered;
135 }

References $questionAnswered.

◆ setQuestionCount()

ilTestQuestionHeaderBlockBuilder::setQuestionCount (   $questionCount)
Parameters
int$questionCount

Definition at line 164 of file class.ilTestQuestionHeaderBlockBuilder.php.

165 {
166 $this->questionCount = $questionCount;
167 }

References $questionCount.

◆ setQuestionObligatory()

ilTestQuestionHeaderBlockBuilder::setQuestionObligatory (   $questionObligatory)
Parameters
boolean$questionObligatory

Definition at line 206 of file class.ilTestQuestionHeaderBlockBuilder.php.

207 {
208 $this->questionObligatory = $questionObligatory;
209 }

References $questionObligatory.

◆ setQuestionPoints()

ilTestQuestionHeaderBlockBuilder::setQuestionPoints (   $questionPoints)
Parameters
float$questionPoints

Definition at line 123 of file class.ilTestQuestionHeaderBlockBuilder.php.

124 {
125 $this->questionPoints = $questionPoints;
126 }

References $questionPoints.

◆ setQuestionPosition()

ilTestQuestionHeaderBlockBuilder::setQuestionPosition (   $questionPosition)
Parameters
int$questionPosition

Definition at line 148 of file class.ilTestQuestionHeaderBlockBuilder.php.

149 {
150 $this->questionPosition = $questionPosition;
151 }

References $questionPosition.

◆ setQuestionPostponed()

ilTestQuestionHeaderBlockBuilder::setQuestionPostponed (   $questionPostponed)
Parameters
boolean$questionPostponed

Definition at line 190 of file class.ilTestQuestionHeaderBlockBuilder.php.

191 {
192 $this->questionPostponed = $questionPostponed;
193 }

References $questionPostponed.

◆ setQuestionRelatedObjectives()

ilTestQuestionHeaderBlockBuilder::setQuestionRelatedObjectives (   $questionRelatedObjectives)
Parameters
string$questionRelatedObjectives

Definition at line 222 of file class.ilTestQuestionHeaderBlockBuilder.php.

223 {
224 $this->questionRelatedObjectives = $questionRelatedObjectives;
225 }

References $questionRelatedObjectives.

◆ setQuestionTitle()

ilTestQuestionHeaderBlockBuilder::setQuestionTitle (   $questionTitle)
Parameters
string$questionTitle

Definition at line 107 of file class.ilTestQuestionHeaderBlockBuilder.php.

108 {
109 $this->questionTitle = $questionTitle;
110 }

References $questionTitle.

Field Documentation

◆ $headerMode

ilTestQuestionHeaderBlockBuilder::$headerMode
protected

Definition at line 22 of file class.ilTestQuestionHeaderBlockBuilder.php.

Referenced by getHeaderMode(), and setHeaderMode().

◆ $lng

ilTestQuestionHeaderBlockBuilder::$lng
protected

Definition at line 17 of file class.ilTestQuestionHeaderBlockBuilder.php.

Referenced by __construct().

◆ $questionAnswered

ilTestQuestionHeaderBlockBuilder::$questionAnswered
protected

◆ $questionCount

ilTestQuestionHeaderBlockBuilder::$questionCount
protected

◆ $questionObligatory

ilTestQuestionHeaderBlockBuilder::$questionObligatory
protected

◆ $questionPoints

ilTestQuestionHeaderBlockBuilder::$questionPoints
protected

◆ $questionPosition

ilTestQuestionHeaderBlockBuilder::$questionPosition
protected

◆ $questionPostponed

ilTestQuestionHeaderBlockBuilder::$questionPostponed
protected

◆ $questionRelatedObjectives

ilTestQuestionHeaderBlockBuilder::$questionRelatedObjectives
protected

◆ $questionTitle

ilTestQuestionHeaderBlockBuilder::$questionTitle
protected

The documentation for this class was generated from the following file: