ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilTestGradingMessageBuilder Class Reference
+ Collaboration diagram for ilTestGradingMessageBuilder:

Public Member Functions

 __construct (ilLanguage $lng, ilObjTest $testOBJ)
 
 setActiveId ($activeId)
 
 getActiveId ()
 
 buildMessage ()
 
 sendMessage ()
 
 buildList ()
 
 initListTemplate ()
 
 getList ()
 

Private Member Functions

 addMessagePart ($msgPart)
 
 getFullMessage ()
 
 isPassed ()
 
 loadResultData ()
 
 buildGradingStatusMsg ()
 
 buildGradingMarkMsg ()
 
 getMarkOfficial ()
 
 getMarkShort ()
 
 getPercentage ()
 
 getReachedPoints ()
 
 getMaxPoints ()
 
 buildObligationsMsg ()
 
 areObligationsAnswered ()
 
 buildEctsGradeMsg ()
 
 getEctsGrade ()
 
 populateListEntry ($label, $value)
 
 parseListTemplate ()
 

Private Attributes

 $lng
 
 $testOBJ
 
 $tpl
 
 $resultData
 
 $activeId
 

Detailed Description

Definition at line 11 of file class.ilTestGradingMessageBuilder.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestGradingMessageBuilder::__construct ( ilLanguage  $lng,
ilObjTest  $testOBJ 
)
Parameters
ilLanguage$lng
ilObjTest$testOBJ

Definition at line 42 of file class.ilTestGradingMessageBuilder.php.

References $lng, and $testOBJ.

Member Function Documentation

◆ addMessagePart()

ilTestGradingMessageBuilder::addMessagePart (   $msgPart)
private

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

84 {
85 $this->messageText[] = $msgPart;
86 }

Referenced by buildMessage().

+ Here is the caller graph for this function:

◆ areObligationsAnswered()

ilTestGradingMessageBuilder::areObligationsAnswered ( )
private

Definition at line 195 of file class.ilTestGradingMessageBuilder.php.

196 {
197 return (bool)$this->resultData['obligations_answered'];
198 }

Referenced by buildList(), and buildObligationsMsg().

+ Here is the caller graph for this function:

◆ buildEctsGradeMsg()

ilTestGradingMessageBuilder::buildEctsGradeMsg ( )
private

Definition at line 200 of file class.ilTestGradingMessageBuilder.php.

201 {
202 return str_replace('[markects]', $this->getEctsGrade(), $this->lng->txt('mark_tst_ects'));
203 }

References getEctsGrade().

Referenced by buildMessage().

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

◆ buildGradingMarkMsg()

ilTestGradingMessageBuilder::buildGradingMarkMsg ( )
private

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

141 {
142 $markMsg = $this->lng->txt('grading_mark_msg');
143
144 $markMsg = str_replace("[mark]", $this->getMarkOfficial(), $markMsg);
145 $markMsg = str_replace("[markshort]", $this->getMarkShort(), $markMsg);
146 $markMsg = str_replace("[percentage]", $this->getPercentage(), $markMsg);
147 $markMsg = str_replace("[reached]", $this->getReachedPoints(), $markMsg);
148 $markMsg = str_replace("[max]", $this->getMaxPoints(), $markMsg);
149
150 return $markMsg;
151 }

References getMarkOfficial(), getMarkShort(), getMaxPoints(), getPercentage(), and getReachedPoints().

Referenced by buildMessage().

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

◆ buildGradingStatusMsg()

ilTestGradingMessageBuilder::buildGradingStatusMsg ( )
private

Definition at line 130 of file class.ilTestGradingMessageBuilder.php.

131 {
132 if( $this->isPassed() )
133 {
134 return $this->lng->txt('grading_status_passed_msg');
135 }
136
137 return $this->lng->txt('grading_status_failed_msg');
138 }

References isPassed().

Referenced by buildMessage().

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

◆ buildList()

ilTestGradingMessageBuilder::buildList ( )

Definition at line 210 of file class.ilTestGradingMessageBuilder.php.

211 {
212 $this->loadResultData();
213
214 $this->initListTemplate();
215
216 if( $this->testOBJ->isShowGradingStatusEnabled() )
217 {
218 $passedStatusLangVar = $this->isPassed() ? 'passed_official' : 'failed_official';
219
220 $this->populateListEntry(
221 $this->lng->txt('passed_status'), $this->lng->txt($passedStatusLangVar)
222 );
223 }
224
225 if( $this->testOBJ->areObligationsEnabled() )
226 {
227 if( $this->areObligationsAnswered() )
228 {
229 $obligAnsweredStatusLangVar = 'grading_obligations_answered_listentry';
230 }
231 else
232 {
233 $obligAnsweredStatusLangVar = 'grading_obligations_missing_listentry';
234 }
235
236 $this->populateListEntry(
237 $this->lng->txt('grading_obligations_listlabel'), $this->lng->txt($obligAnsweredStatusLangVar)
238 );
239 }
240
241 if( $this->testOBJ->isShowGradingMarkEnabled() )
242 {
243 $this->populateListEntry($this->lng->txt('tst_mark'), $this->getMarkOfficial());
244 }
245
246 if( $this->testOBJ->getECTSOutput() )
247 {
248 $this->populateListEntry($this->lng->txt('ects_grade'), $this->getEctsGrade());
249 }
250
251 $this->parseListTemplate();
252 }

References areObligationsAnswered(), initListTemplate(), isPassed(), loadResultData(), parseListTemplate(), and populateListEntry().

+ Here is the call graph for this function:

◆ buildMessage()

ilTestGradingMessageBuilder::buildMessage ( )

Definition at line 58 of file class.ilTestGradingMessageBuilder.php.

59 {
60 $this->loadResultData();
61
62 if( $this->testOBJ->isShowGradingStatusEnabled() )
63 {
65 }
66
67 if( $this->testOBJ->areObligationsEnabled() )
68 {
69 $this->addMessagePart($this->buildObligationsMsg());
70 }
71
72 if( $this->testOBJ->isShowGradingMarkEnabled() )
73 {
74 $this->addMessagePart($this->buildGradingMarkMsg());
75 }
76
77 if( $this->testOBJ->getECTSOutput() )
78 {
79 $this->addMessagePart($this->buildEctsGradeMsg());
80 }
81 }

References addMessagePart(), buildEctsGradeMsg(), buildGradingMarkMsg(), buildGradingStatusMsg(), buildObligationsMsg(), and loadResultData().

+ Here is the call graph for this function:

◆ buildObligationsMsg()

ilTestGradingMessageBuilder::buildObligationsMsg ( )
private

Definition at line 185 of file class.ilTestGradingMessageBuilder.php.

186 {
187 if( $this->areObligationsAnswered() )
188 {
189 return $this->lng->txt('grading_obligations_answered_msg');
190 }
191
192 return $this->lng->txt('grading_obligations_missing_msg');
193 }

References areObligationsAnswered().

Referenced by buildMessage().

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

◆ getActiveId()

ilTestGradingMessageBuilder::getActiveId ( )

Definition at line 53 of file class.ilTestGradingMessageBuilder.php.

References $activeId.

Referenced by loadResultData().

+ Here is the caller graph for this function:

◆ getEctsGrade()

ilTestGradingMessageBuilder::getEctsGrade ( )
private

Definition at line 205 of file class.ilTestGradingMessageBuilder.php.

206 {
207 return $this->resultData['ects_grade'];
208 }

Referenced by buildEctsGradeMsg().

+ Here is the caller graph for this function:

◆ getFullMessage()

ilTestGradingMessageBuilder::getFullMessage ( )
private

Definition at line 88 of file class.ilTestGradingMessageBuilder.php.

89 {
90 return implode(' ', $this->messageText);
91 }

Referenced by sendMessage().

+ Here is the caller graph for this function:

◆ getList()

ilTestGradingMessageBuilder::getList ( )

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

274 {
275 return $this->tpl->get();
276 }

◆ getMarkOfficial()

ilTestGradingMessageBuilder::getMarkOfficial ( )
private

Definition at line 153 of file class.ilTestGradingMessageBuilder.php.

154 {
155 return $this->resultData['mark_official'];
156 }

Referenced by buildGradingMarkMsg().

+ Here is the caller graph for this function:

◆ getMarkShort()

ilTestGradingMessageBuilder::getMarkShort ( )
private

Definition at line 158 of file class.ilTestGradingMessageBuilder.php.

159 {
160 return $this->resultData['mark_short'];
161 }

Referenced by buildGradingMarkMsg().

+ Here is the caller graph for this function:

◆ getMaxPoints()

ilTestGradingMessageBuilder::getMaxPoints ( )
private

Definition at line 180 of file class.ilTestGradingMessageBuilder.php.

181 {
182 return $this->resultData['max_points'];
183 }

Referenced by buildGradingMarkMsg(), and getPercentage().

+ Here is the caller graph for this function:

◆ getPercentage()

ilTestGradingMessageBuilder::getPercentage ( )
private

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

164 {
165 $percentage = 0;
166
167 if( $this->getMaxPoints() > 0 )
168 {
169 $percentage = $this->getReachedPoints() / $this->getMaxPoints();
170 }
171
172 return sprintf("%.2f", $percentage);
173 }

References getMaxPoints(), and getReachedPoints().

Referenced by buildGradingMarkMsg().

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

◆ getReachedPoints()

ilTestGradingMessageBuilder::getReachedPoints ( )
private

Definition at line 175 of file class.ilTestGradingMessageBuilder.php.

176 {
177 return $this->resultData['reached_points'];
178 }

Referenced by buildGradingMarkMsg(), and getPercentage().

+ Here is the caller graph for this function:

◆ initListTemplate()

ilTestGradingMessageBuilder::initListTemplate ( )

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

255 {
256 $this->tpl = new ilTemplate('tpl.tst_grading_msg_list.html', true, true, 'Modules/Test');
257 }
special template class to simplify handling of ITX/PEAR

Referenced by buildList().

+ Here is the caller graph for this function:

◆ isPassed()

ilTestGradingMessageBuilder::isPassed ( )
private

Definition at line 93 of file class.ilTestGradingMessageBuilder.php.

94 {
95 return (bool)$this->resultData['passed'];
96 }

Referenced by buildGradingStatusMsg(), buildList(), and sendMessage().

+ Here is the caller graph for this function:

◆ loadResultData()

ilTestGradingMessageBuilder::loadResultData ( )
private

Definition at line 114 of file class.ilTestGradingMessageBuilder.php.

115 {
116 $this->resultData = $this->testOBJ->getResultsForActiveId($this->getActiveId());
117
118 if( $this->testOBJ->getECTSOutput() )
119 {
120 $ectsMark = $this->testOBJ->getECTSGrade(
121 $this->testOBJ->getTotalPointsPassedArray(),
122 $this->resultData['reached_points'],
123 $this->resultData['max_points']
124 );
125
126 $this->resultData['ects_grade'] = strtoupper($ectsMark);
127 }
128 }

References getActiveId().

Referenced by buildList(), and buildMessage().

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

◆ parseListTemplate()

ilTestGradingMessageBuilder::parseListTemplate ( )
private

Definition at line 267 of file class.ilTestGradingMessageBuilder.php.

268 {
269 $this->tpl->setCurrentBlock('grading_msg_list');
270 $this->tpl->parseCurrentBlock();
271 }

Referenced by buildList().

+ Here is the caller graph for this function:

◆ populateListEntry()

ilTestGradingMessageBuilder::populateListEntry (   $label,
  $value 
)
private

Definition at line 259 of file class.ilTestGradingMessageBuilder.php.

260 {
261 $this->tpl->setCurrentBlock('grading_msg_entry');
262 $this->tpl->setVariable('LABEL', $label);
263 $this->tpl->setVariable('VALUE', $value);
264 $this->tpl->parseCurrentBlock();
265 }

Referenced by buildList().

+ Here is the caller graph for this function:

◆ sendMessage()

ilTestGradingMessageBuilder::sendMessage ( )

Definition at line 98 of file class.ilTestGradingMessageBuilder.php.

99 {
100 if( !$this->testOBJ->isShowGradingStatusEnabled() )
101 {
103 }
104 elseif( $this->isPassed() )
105 {
107 }
108 else
109 {
111 }
112 }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 getFullMessage(), isPassed(), ilUtil\sendFailure(), ilUtil\sendInfo(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ setActiveId()

ilTestGradingMessageBuilder::setActiveId (   $activeId)

Definition at line 48 of file class.ilTestGradingMessageBuilder.php.

49 {
50 $this->activeId = $activeId;
51 }

References $activeId.

Field Documentation

◆ $activeId

ilTestGradingMessageBuilder::$activeId
private

Definition at line 36 of file class.ilTestGradingMessageBuilder.php.

Referenced by getActiveId(), and setActiveId().

◆ $lng

ilTestGradingMessageBuilder::$lng
private

Definition at line 16 of file class.ilTestGradingMessageBuilder.php.

Referenced by __construct().

◆ $resultData

ilTestGradingMessageBuilder::$resultData
private

Definition at line 31 of file class.ilTestGradingMessageBuilder.php.

◆ $testOBJ

ilTestGradingMessageBuilder::$testOBJ
private

Definition at line 21 of file class.ilTestGradingMessageBuilder.php.

Referenced by __construct().

◆ $tpl

ilTestGradingMessageBuilder::$tpl
private

Definition at line 26 of file class.ilTestGradingMessageBuilder.php.


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