ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 259 of file class.ilTestQuestionHeaderBlockBuilder.php.

260 {
261 if ($this->isQuestionObligatory()) {
262 return $this->lng->txt("tst_you_have_to_answer_this_question");
263 }
264
265 return '';
266 }

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 241 of file class.ilTestQuestionHeaderBlockBuilder.php.

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

References getQuestionPoints().

Referenced by getHTML(), and 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 return '';
231 }
232
233 if ($this->getQuestionCount()) {
234 return sprintf($this->lng->txt("tst_position"), $this->getQuestionPosition(), $this->getQuestionCount());
235 }
236
237 return sprintf($this->lng->txt("tst_position_without_total"), $this->getQuestionPosition());
238 }

References getQuestionCount(), and getQuestionPosition().

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 250 of file class.ilTestQuestionHeaderBlockBuilder.php.

251 {
252 if ($this->isQuestionPostponed()) {
253 return $this->lng->txt("postponed");
254 }
255
256 return '';
257 }

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 268 of file class.ilTestQuestionHeaderBlockBuilder.php.

269 {
270 if (strlen($this->getQuestionRelatedObjectives())) {
271 $label = $this->lng->txt('tst_res_lo_objectives_header');
272 return $label . ': ' . $this->getQuestionRelatedObjectives();
273 }
274
275 return '';
276 }

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 358 of file class.ilTestQuestionHeaderBlockBuilder.php.

359 {
360 $headerBlock = $this->buildQuestionPositionString();
361
362 switch ($this->getHeaderMode()) {
363 case 1:
364
365 $headerBlock .= " - " . $this->getQuestionTitle();
366 $headerBlock .= $this->buildQuestionPostponedString();
367 $headerBlock .= $this->buildQuestionObligatoryString();
368 break;
369
370 case 2:
371
372 $headerBlock .= $this->buildQuestionPostponedString();
373 $headerBlock .= $this->buildQuestionObligatoryString();
374 break;
375
376 case 0:
377 default:
378
379 $headerBlock .= " - " . $this->getQuestionTitle();
380 $headerBlock .= $this->buildQuestionPostponedString();
381// fau: testNav - put the points in parentheses here, not in building the string
382 $headerBlock .= ' (' . $this->buildQuestionPointsString() . ')';
383// fau.
384 $headerBlock .= $this->buildQuestionObligatoryString();
385 }
386
387 $headerBlock .= $this->buildQuestionRelatedObjectivesString();
388
389 return $headerBlock;
390 }

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

+ 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 287 of file class.ilTestQuestionHeaderBlockBuilder.php.

288 {
289 switch ($this->getHeaderMode()) {
290 case 2: // neither titles nor points => show position as title
291 return $this->buildQuestionPositionString();
292 break;
293
294 case 0: // titles and points => show title here
295 case 1: // only titles => show title here
296 default:
297 return $this->getQuestionTitle();
298 }
299 }

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 307 of file class.ilTestQuestionHeaderBlockBuilder.php.

308 {
309 $tpl = new ilTemplate('tpl.tst_question_info.html', true, true, 'Modules/Test');
310
311 // position and/or points
312 switch ($this->getHeaderMode()) {
313 case 1: // only titles => show position here
315 break;
316
317 case 2: // neither titles nor points => position is separate title, show nothing here
318 $text = '';
319 break;
320
321 case 0: // titles and points => show position and points here
322 default:
323 $text = $this->buildQuestionPositionString() . ' (' . $this->buildQuestionPointsString() . ')';
324 }
325 if ($this->isQuestionPostponed()) {
326 $text .= ($text ? ', ' : '') . $this->buildQuestionPostponedString();
327 }
328
329 $tpl->setVariable('TXT_POSITION_POINTS', $text);
330
331 // obligatory
332 if ($this->isQuestionObligatory() && !$this->isQuestionAnswered()) {
333 $tpl->setVariable('TXT_OBLIGATORY', $this->buildQuestionObligatoryString());
334 }
335
336 // objectives
337 if (strlen($this->getQuestionRelatedObjectives())) {
338 $tpl->setVariable('TXT_OBJECTIVES', $this->buildQuestionRelatedObjectivesString());
339 }
340
341 // answer status
342 if ($this->isQuestionAnswered()) {
343 $tpl->setVariable('HIDDEN_NOT_ANSWERED', 'hidden');
344 } else {
345 $tpl->setVariable('HIDDEN_ANSWERED', 'hidden');
346 }
347
348 $tpl->setVariable('SRC_ANSWERED', ilUtil::getImagePath('answered.svg'));
349 $tpl->setVariable('SRC_NOT_ANSWERED', ilUtil::getImagePath('answered_not.svg'));
350 $tpl->setVariable('TXT_ANSWERED', $this->lng->txt('tst_answer_status_answered'));
351 $tpl->setVariable('TXT_NOT_ANSWERED', $this->lng->txt('tst_answer_status_not_answered'));
352 $tpl->setVariable('TXT_EDITING', $this->lng->txt('tst_answer_status_editing'));
353
354 return $tpl->get();
355 }
$tpl
Definition: ilias.php:10
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
Definition: errorreport.php:18

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 getHTML(), and 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: