ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

Referenced by buildObligationsMsg().

217  {
218  return (bool)$this->resultData['obligations_answered'];
219  }
+ Here is the caller graph for this function:

◆ build()

ilTestGradingMessageBuilder::build ( )

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

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

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

◆ buildEctsGradeMsg()

ilTestGradingMessageBuilder::buildEctsGradeMsg ( )
private

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

References getEctsGrade().

Referenced by populateEctsGrade().

229  {
230  return str_replace('[markects]', $this->getEctsGrade(), $this->lng->txt('mark_tst_ects'));
231  }
+ 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.

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

Referenced by populateGradingMark().

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  }
+ 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.

References isPassed().

Referenced by populateGradingStatus().

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  }
+ 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.

References areObligationsAnswered().

Referenced by populateObligationsStatus().

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  }
+ 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.

Referenced by buildEctsGradeMsg().

234  {
235  return $this->resultData['ects_grade'];
236  }
+ Here is the caller graph for this function:

◆ getGradingStatusCssClass()

ilTestGradingMessageBuilder::getGradingStatusCssClass ( )
private

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

References isPassed().

Referenced by populateGradingStatus().

123  {
124  if( $this->isPassed() )
125  {
126  return 'passed';
127  }
128 
129  return 'failed';
130  }
+ 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.

Referenced by buildGradingMarkMsg().

168  {
169  return $this->resultData['mark_official'];
170  }
+ Here is the caller graph for this function:

◆ getMarkShort()

ilTestGradingMessageBuilder::getMarkShort ( )
private

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

Referenced by buildGradingMarkMsg().

173  {
174  return $this->resultData['mark_short'];
175  }
+ Here is the caller graph for this function:

◆ getMaxPoints()

ilTestGradingMessageBuilder::getMaxPoints ( )
private

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

Referenced by buildGradingMarkMsg(), and getPercentage().

195  {
196  return $this->resultData['max_points'];
197  }
+ 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.

References getMaxPoints(), and getReachedPoints().

Referenced by buildGradingMarkMsg().

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  }
+ 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.

Referenced by buildGradingMarkMsg(), and getPercentage().

190  {
191  return $this->resultData['reached_points'];
192  }
+ Here is the caller graph for this function:

◆ initTemplate()

ilTestGradingMessageBuilder::initTemplate ( )
private

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

Referenced by build().

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

◆ isPassed()

ilTestGradingMessageBuilder::isPassed ( )
private

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

Referenced by buildGradingStatusMsg(), and getGradingStatusCssClass().

143  {
144  return (bool)$this->resultData['passed'];
145  }
+ Here is the caller graph for this function:

◆ loadResultData()

ilTestGradingMessageBuilder::loadResultData ( )
private

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

References getActiveId().

Referenced by build().

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  }
+ 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.

References buildEctsGradeMsg().

Referenced by build().

222  {
223  $this->tpl->setCurrentBlock('grading_mark_ects_msg');
224  $this->tpl->setVariable('GRADING_MARK_ECTS_MSG', $this->buildEctsGradeMsg());
225  $this->tpl->parseCurrentBlock();
226  }
+ 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.

References buildGradingMarkMsg().

Referenced by build().

148  {
149  $this->tpl->setCurrentBlock('grading_mark_msg');
150  $this->tpl->setVariable('GRADING_MARK_MSG', $this->buildGradingMarkMsg());
151  $this->tpl->parseCurrentBlock();
152  }
+ 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.

References buildGradingStatusMsg(), and getGradingStatusCssClass().

Referenced by build().

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  }
+ 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.

References buildObligationsMsg().

Referenced by build().

200  {
201  $this->tpl->setCurrentBlock('obligations_msg');
202  $this->tpl->setVariable('OBLIGATIONS_MSG', $this->buildObligationsMsg());
203  $this->tpl->parseCurrentBlock();
204  }
+ 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.

References $activeId.

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

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: