ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilTestGradingMessageBuilder Class Reference
+ Collaboration diagram for ilTestGradingMessageBuilder:

Public Member Functions

 __construct (ilLanguage $lng, ilObjTest $testOBJ)
 
 setActiveId ($activeId)
 
 getActiveId ()
 
 build ()
 
 getMessage ()
 

Private Member Functions

 initTemplate ()
 
 loadResultData ()
 
 populateGradingStatus ()
 
 getGradingStatusCssClass ()
 
 buildGradingStatusMsg ()
 
 isPassed ()
 
 populateGradingMark ()
 
 buildGradingMarkMsg ()
 
 getMarkOfficial ()
 
 getMarkShort ()
 
 getPercentage ()
 
 getReachedPoints ()
 
 getMaxPoints ()
 
 populateObligationsStatus ()
 
 buildObligationsMsg ()
 
 areObligationsAnswered ()
 
 populateEctsGrade ()
 
 buildEctsGradeMsg ()
 
 getEctsGrade ()
 

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

◆ areObligationsAnswered()

ilTestGradingMessageBuilder::areObligationsAnswered ( )
private

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

217 {
218 return (bool)$this->resultData['obligations_answered'];
219 }

Referenced by buildObligationsMsg().

+ Here is the caller graph for this function:

◆ build()

ilTestGradingMessageBuilder::build ( )

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

59 {
60 $this->initTemplate();
61
62 $this->loadResultData();
63
64 if( $this->testOBJ->isShowGradingStatusEnabled() )
65 {
66 $this->populateGradingStatus();
67 }
68
69 if( $this->testOBJ->areObligationsEnabled() )
70 {
72 }
73
74 if( $this->testOBJ->isShowGradingMarkEnabled() )
75 {
76 $this->populateGradingMark();
77 }
78
79 if( $this->testOBJ->getECTSOutput() )
80 {
81 $this->populateEctsGrade();
82 }
83 }

References initTemplate(), loadResultData(), populateEctsGrade(), populateGradingMark(), populateGradingStatus(), and populateObligationsStatus().

+ Here is the call graph for this function:

◆ buildEctsGradeMsg()

ilTestGradingMessageBuilder::buildEctsGradeMsg ( )
private

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

229 {
230 return str_replace('[markects]', $this->getEctsGrade(), $this->lng->txt('mark_tst_ects'));
231 }

References getEctsGrade().

Referenced by populateEctsGrade().

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

◆ buildGradingMarkMsg()

ilTestGradingMessageBuilder::buildGradingMarkMsg ( )
private

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

155 {
156 $markMsg = $this->lng->txt('grading_mark_msg');
157
158 $markMsg = str_replace("[mark]", $this->getMarkOfficial(), $markMsg);
159 $markMsg = str_replace("[markshort]", $this->getMarkShort(), $markMsg);
160 $markMsg = str_replace("[percentage]", $this->getPercentage(), $markMsg);
161 $markMsg = str_replace("[reached]", $this->getReachedPoints(), $markMsg);
162 $markMsg = str_replace("[max]", $this->getMaxPoints(), $markMsg);
163
164 return $markMsg;
165 }

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

Referenced by populateGradingMark().

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

◆ buildGradingStatusMsg()

ilTestGradingMessageBuilder::buildGradingStatusMsg ( )
private

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

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

References isPassed().

Referenced by populateGradingStatus().

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

◆ buildObligationsMsg()

ilTestGradingMessageBuilder::buildObligationsMsg ( )
private

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

207 {
208 if( $this->areObligationsAnswered() )
209 {
210 return $this->lng->txt('grading_obligations_answered_msg');
211 }
212
213 return $this->lng->txt('grading_obligations_missing_msg');
214 }

References areObligationsAnswered().

Referenced by populateObligationsStatus().

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

234 {
235 return $this->resultData['ects_grade'];
236 }

Referenced by buildEctsGradeMsg().

+ Here is the caller graph for this function:

◆ getGradingStatusCssClass()

ilTestGradingMessageBuilder::getGradingStatusCssClass ( )
private

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

123 {
124 if( $this->isPassed() )
125 {
126 return 'passed';
127 }
128
129 return 'failed';
130 }

References isPassed().

Referenced by populateGradingStatus().

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

◆ getMarkOfficial()

ilTestGradingMessageBuilder::getMarkOfficial ( )
private

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

168 {
169 return $this->resultData['mark_official'];
170 }

Referenced by buildGradingMarkMsg().

+ Here is the caller graph for this function:

◆ getMarkShort()

ilTestGradingMessageBuilder::getMarkShort ( )
private

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

173 {
174 return $this->resultData['mark_short'];
175 }

Referenced by buildGradingMarkMsg().

+ Here is the caller graph for this function:

◆ getMaxPoints()

ilTestGradingMessageBuilder::getMaxPoints ( )
private

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

195 {
196 return $this->resultData['max_points'];
197 }

Referenced by buildGradingMarkMsg(), and getPercentage().

+ Here is the caller graph for this function:

◆ getMessage()

ilTestGradingMessageBuilder::getMessage ( )

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

86 {
87 return $this->tpl->get();
88 }

◆ getPercentage()

ilTestGradingMessageBuilder::getPercentage ( )
private

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

178 {
179 $percentage = 0;
180
181 if( $this->getMaxPoints() > 0 )
182 {
183 $percentage = $this->getReachedPoints() / $this->getMaxPoints();
184 }
185
186 return sprintf("%.2f", $percentage);
187 }

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

190 {
191 return $this->resultData['reached_points'];
192 }

Referenced by buildGradingMarkMsg(), and getPercentage().

+ Here is the caller graph for this function:

◆ initTemplate()

ilTestGradingMessageBuilder::initTemplate ( )
private

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

91 {
92 $this->tpl = new ilTemplate('tpl.tst_grading_message.html', true, true, 'Modules/Test');
93 }
special template class to simplify handling of ITX/PEAR

Referenced by build().

+ Here is the caller graph for this function:

◆ isPassed()

ilTestGradingMessageBuilder::isPassed ( )
private

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

143 {
144 return (bool)$this->resultData['passed'];
145 }

Referenced by buildGradingStatusMsg(), and getGradingStatusCssClass().

+ Here is the caller graph for this function:

◆ loadResultData()

ilTestGradingMessageBuilder::loadResultData ( )
private

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

96 {
97 $this->resultData = $this->testOBJ->getResultsForActiveId($this->getActiveId());
98
99 if( $this->testOBJ->getECTSOutput() )
100 {
101 $ectsMark = $this->testOBJ->getECTSGrade(
102 $this->testOBJ->getTotalPointsPassedArray(),
103 $this->resultData['reached_points'],
104 $this->resultData['max_points']
105 );
106
107 $this->resultData['ects_grade'] = strtoupper($ectsMark);
108 }
109 }

References getActiveId().

Referenced by build().

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

◆ populateEctsGrade()

ilTestGradingMessageBuilder::populateEctsGrade ( )
private

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

222 {
223 $this->tpl->setCurrentBlock('grading_mark_ects_msg');
224 $this->tpl->setVariable('GRADING_MARK_ECTS_MSG', $this->buildEctsGradeMsg());
225 $this->tpl->parseCurrentBlock();
226 }

References buildEctsGradeMsg().

Referenced by build().

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

◆ populateGradingMark()

ilTestGradingMessageBuilder::populateGradingMark ( )
private

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

148 {
149 $this->tpl->setCurrentBlock('grading_mark_msg');
150 $this->tpl->setVariable('GRADING_MARK_MSG', $this->buildGradingMarkMsg());
151 $this->tpl->parseCurrentBlock();
152 }

References buildGradingMarkMsg().

Referenced by build().

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

◆ populateGradingStatus()

ilTestGradingMessageBuilder::populateGradingStatus ( )
private

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

112 {
113 $this->tpl->setCurrentBlock('status_css_class');
114 $this->tpl->setVariable('STATUS_CSS_CLASS', $this->getGradingStatusCssClass());
115 $this->tpl->parseCurrentBlock();
116
117 $this->tpl->setCurrentBlock('grading_status_msg');
118 $this->tpl->setVariable('GRADING_STATUS_MSG', $this->buildGradingStatusMsg());
119 $this->tpl->parseCurrentBlock();
120 }

References buildGradingStatusMsg(), and getGradingStatusCssClass().

Referenced by build().

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

◆ populateObligationsStatus()

ilTestGradingMessageBuilder::populateObligationsStatus ( )
private

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

200 {
201 $this->tpl->setCurrentBlock('obligations_msg');
202 $this->tpl->setVariable('OBLIGATIONS_MSG', $this->buildObligationsMsg());
203 $this->tpl->parseCurrentBlock();
204 }

References buildObligationsMsg().

Referenced by build().

+ Here is the call graph for this function:
+ Here is the caller 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: