ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 79 of file class.ilTestGradingMessageBuilder.php.

80 {
81 $this->messageText[] = $msgPart;
82 }

Referenced by buildMessage().

+ Here is the caller graph for this function:

◆ areObligationsAnswered()

ilTestGradingMessageBuilder::areObligationsAnswered ( )
private

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

183 {
184 return (bool) $this->resultData['obligations_answered'];
185 }

Referenced by buildList(), and buildObligationsMsg().

+ Here is the caller graph for this function:

◆ buildEctsGradeMsg()

ilTestGradingMessageBuilder::buildEctsGradeMsg ( )
private

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

188 {
189 return str_replace('[markects]', $this->getEctsGrade(), $this->lng->txt('mark_tst_ects'));
190 }

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 129 of file class.ilTestGradingMessageBuilder.php.

130 {
131 $markMsg = $this->lng->txt('grading_mark_msg');
132
133 $markMsg = str_replace("[mark]", $this->getMarkOfficial(), $markMsg);
134 $markMsg = str_replace("[markshort]", $this->getMarkShort(), $markMsg);
135 $markMsg = str_replace("[percentage]", $this->getPercentage(), $markMsg);
136 $markMsg = str_replace("[reached]", $this->getReachedPoints(), $markMsg);
137 $markMsg = str_replace("[max]", $this->getMaxPoints(), $markMsg);
138
139 return $markMsg;
140 }

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 120 of file class.ilTestGradingMessageBuilder.php.

121 {
122 if ($this->isPassed()) {
123 return $this->lng->txt('grading_status_passed_msg');
124 }
125
126 return $this->lng->txt('grading_status_failed_msg');
127 }

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 197 of file class.ilTestGradingMessageBuilder.php.

198 {
199 $this->loadResultData();
200
201 $this->initListTemplate();
202
203 if ($this->testOBJ->isShowGradingStatusEnabled()) {
204 $passedStatusLangVar = $this->isPassed() ? 'passed_official' : 'failed_official';
205
206 $this->populateListEntry(
207 $this->lng->txt('passed_status'),
208 $this->lng->txt($passedStatusLangVar)
209 );
210 }
211
212 if ($this->testOBJ->areObligationsEnabled()) {
213 if ($this->areObligationsAnswered()) {
214 $obligAnsweredStatusLangVar = 'grading_obligations_answered_listentry';
215 } else {
216 $obligAnsweredStatusLangVar = 'grading_obligations_missing_listentry';
217 }
218
219 $this->populateListEntry(
220 $this->lng->txt('grading_obligations_listlabel'),
221 $this->lng->txt($obligAnsweredStatusLangVar)
222 );
223 }
224
225 if ($this->testOBJ->isShowGradingMarkEnabled()) {
226 $this->populateListEntry($this->lng->txt('tst_mark'), $this->getMarkOfficial());
227 }
228
229 if ($this->testOBJ->getECTSOutput()) {
230 $this->populateListEntry($this->lng->txt('ects_grade'), $this->getEctsGrade());
231 }
232
233 $this->parseListTemplate();
234 }

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()) {
64 }
65
66 if ($this->testOBJ->areObligationsEnabled()) {
67 $this->addMessagePart($this->buildObligationsMsg());
68 }
69
70 if ($this->testOBJ->isShowGradingMarkEnabled()) {
71 $this->addMessagePart($this->buildGradingMarkMsg());
72 }
73
74 if ($this->testOBJ->getECTSOutput()) {
75 $this->addMessagePart($this->buildEctsGradeMsg());
76 }
77 }

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

+ Here is the call graph for this function:

◆ buildObligationsMsg()

ilTestGradingMessageBuilder::buildObligationsMsg ( )
private

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

174 {
175 if ($this->areObligationsAnswered()) {
176 return $this->lng->txt('grading_obligations_answered_msg');
177 }
178
179 return $this->lng->txt('grading_obligations_missing_msg');
180 }

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 192 of file class.ilTestGradingMessageBuilder.php.

193 {
194 return $this->resultData['ects_grade'];
195 }

Referenced by buildEctsGradeMsg().

+ Here is the caller graph for this function:

◆ getFullMessage()

ilTestGradingMessageBuilder::getFullMessage ( )
private

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

85 {
86 return implode(' ', $this->messageText);
87 }

Referenced by sendMessage().

+ Here is the caller graph for this function:

◆ getList()

ilTestGradingMessageBuilder::getList ( )

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

256 {
257 return $this->tpl->get();
258 }

◆ getMarkOfficial()

ilTestGradingMessageBuilder::getMarkOfficial ( )
private

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

143 {
144 return $this->resultData['mark_official'];
145 }

Referenced by buildGradingMarkMsg().

+ Here is the caller graph for this function:

◆ getMarkShort()

ilTestGradingMessageBuilder::getMarkShort ( )
private

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

148 {
149 return $this->resultData['mark_short'];
150 }

Referenced by buildGradingMarkMsg().

+ Here is the caller graph for this function:

◆ getMaxPoints()

ilTestGradingMessageBuilder::getMaxPoints ( )
private

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

169 {
170 return $this->resultData['max_points'];
171 }

Referenced by buildGradingMarkMsg(), and getPercentage().

+ Here is the caller graph for this function:

◆ getPercentage()

ilTestGradingMessageBuilder::getPercentage ( )
private

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

153 {
154 $percentage = 0;
155
156 if ($this->getMaxPoints() > 0) {
157 $percentage = $this->getReachedPoints() / $this->getMaxPoints();
158 }
159
160 return sprintf("%.2f", $percentage);
161 }

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 163 of file class.ilTestGradingMessageBuilder.php.

164 {
165 return $this->resultData['reached_points'];
166 }

Referenced by buildGradingMarkMsg(), and getPercentage().

+ Here is the caller graph for this function:

◆ initListTemplate()

ilTestGradingMessageBuilder::initListTemplate ( )

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

237 {
238 $this->tpl = new ilTemplate('tpl.tst_grading_msg_list.html', true, true, 'Modules/Test');
239 }
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 89 of file class.ilTestGradingMessageBuilder.php.

90 {
91 return (bool) $this->resultData['passed'];
92 }

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

+ Here is the caller graph for this function:

◆ loadResultData()

ilTestGradingMessageBuilder::loadResultData ( )
private

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

106 {
107 $this->resultData = $this->testOBJ->getResultsForActiveId($this->getActiveId());
108
109 if ($this->testOBJ->getECTSOutput()) {
110 $ectsMark = $this->testOBJ->getECTSGrade(
111 $this->testOBJ->getTotalPointsPassedArray(),
112 $this->resultData['reached_points'],
113 $this->resultData['max_points']
114 );
115
116 $this->resultData['ects_grade'] = strtoupper($ectsMark);
117 }
118 }

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 249 of file class.ilTestGradingMessageBuilder.php.

250 {
251 $this->tpl->setCurrentBlock('grading_msg_list');
252 $this->tpl->parseCurrentBlock();
253 }

Referenced by buildList().

+ Here is the caller graph for this function:

◆ populateListEntry()

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

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

242 {
243 $this->tpl->setCurrentBlock('grading_msg_entry');
244 $this->tpl->setVariable('LABEL', $label);
245 $this->tpl->setVariable('VALUE', $value);
246 $this->tpl->parseCurrentBlock();
247 }

Referenced by buildList().

+ Here is the caller graph for this function:

◆ sendMessage()

ilTestGradingMessageBuilder::sendMessage ( )

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

95 {
96 if (!$this->testOBJ->isShowGradingStatusEnabled()) {
98 } elseif ($this->isPassed()) {
99 ilUtil::sendSuccess($this->getFullMessage());
100 } else {
102 }
103 }
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(), and ilUtil\sendInfo().

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