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

Public Member Functions

 __construct (ilDB $db, ilObjTest $testOBJ)
 
 init ()
 
 evaluate ($activeId, $pass, $userId)
 
 trigger ($activeId, $pass, $userId)
 
 getReachedSkillLevels ()
 
 getReachedSkillLevelsForPersonalSkillGUI ()
 
 getUniqueAssignedSkillsForPersonalSkillGUI ()
 
 isAssignedSkill ($skillBaseId, $skillTrefId)
 
 getAssignedSkillMatchingSkillProfiles ($usrId)
 
 noProfileMatchingAssignedSkillExists ($usrId, $availableSkillProfiles)
 

Private Member Functions

 reset ()
 
 initTestQuestionData ()
 
 initTestResultData ($activeId, $pass)
 
 drawUpSkillPointAccounts ()
 
 calculateReachedSkillPoints ($skillPoints, $maxTestPoints, $reachedTestPoints)
 
 bookToSkillPointAccount ($skillBaseId, $skillTrefId, $reachedSkillPoints)
 
 evaluateSkillPointAccounts ($userId)
 
 triggerSkillService ()
 
 invokeSkillLevelTrigger ($userId, $skillBaseId, $skillTrefId, $skillLevelId)
 

Private Attributes

 $db
 
 $testOBJ
 
 $skillQuestionAssignmentList
 
 $skillLevelThresholdList
 
 $questions
 
 $maxPointsByQuestion
 
 $reachedPointsByQuestion
 
 $skillPointAccounts
 
 $reachedSkillLevels
 

Detailed Description

Definition at line 14 of file class.ilTestSkillEvaluation.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestSkillEvaluation::__construct ( ilDB  $db,
ilObjTest  $testOBJ 
)

Definition at line 61 of file class.ilTestSkillEvaluation.php.

62 {
63 $this->db = $db;
64 $this->testOBJ = $testOBJ;
65
66 $this->skillQuestionAssignmentList = new ilTestSkillQuestionAssignmentList($this->db);
67 $this->skillQuestionAssignmentList->setTestId($this->testOBJ->getTestId());
68
69 $this->skillLevelThresholdList = new ilTestSkillLevelThresholdList($this->db);
70 $this->skillLevelThresholdList->setTestId($this->testOBJ->getTestId());
71
72 $this->questions = array();
73 $this->maxPointsByQuestion = array();
74 }

References $db, and $testOBJ.

Member Function Documentation

◆ bookToSkillPointAccount()

ilTestSkillEvaluation::bookToSkillPointAccount (   $skillBaseId,
  $skillTrefId,
  $reachedSkillPoints 
)
private

Definition at line 178 of file class.ilTestSkillEvaluation.php.

179 {
180 $skillKey = $skillBaseId.':'.$skillTrefId;
181
182 if( !isset($this->skillPointAccounts[$skillKey]) )
183 {
184 $this->skillPointAccounts[$skillKey] = 0;
185 }
186
187 $this->skillPointAccounts[$skillKey] += $reachedSkillPoints;
188 }

Referenced by drawUpSkillPointAccounts().

+ Here is the caller graph for this function:

◆ calculateReachedSkillPoints()

ilTestSkillEvaluation::calculateReachedSkillPoints (   $skillPoints,
  $maxTestPoints,
  $reachedTestPoints 
)
private

Definition at line 161 of file class.ilTestSkillEvaluation.php.

162 {
163 if( $reachedTestPoints < 0 )
164 {
165 $reachedTestPoints = 0;
166 }
167
168 $factor = 0;
169
170 if( $maxTestPoints > 0 )
171 {
172 $factor = $reachedTestPoints / $maxTestPoints;
173 }
174
175 return ($skillPoints * $factor);
176 }

Referenced by drawUpSkillPointAccounts().

+ Here is the caller graph for this function:

◆ drawUpSkillPointAccounts()

ilTestSkillEvaluation::drawUpSkillPointAccounts ( )
private

Definition at line 139 of file class.ilTestSkillEvaluation.php.

140 {
141 foreach($this->questions as $questionId)
142 {
143 $maxTestPoints = $this->maxPointsByQuestion[$questionId];
144 $reachedTestPoints = $this->reachedPointsByQuestion[$questionId];
145
146 $assignments = $this->skillQuestionAssignmentList->getAssignmentsByQuestionId($questionId);
147
148 foreach($assignments as $assignment)
149 {
150 $reachedSkillPoints = $this->calculateReachedSkillPoints(
151 $assignment->getSkillPoints(), $maxTestPoints, $reachedTestPoints
152 );
153
155 $assignment->getSkillBaseId(), $assignment->getSkillTrefId(), $reachedSkillPoints
156 );
157 }
158 }
159 }
calculateReachedSkillPoints($skillPoints, $maxTestPoints, $reachedTestPoints)
bookToSkillPointAccount($skillBaseId, $skillTrefId, $reachedSkillPoints)

References bookToSkillPointAccount(), and calculateReachedSkillPoints().

Referenced by evaluate().

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

◆ evaluate()

ilTestSkillEvaluation::evaluate (   $activeId,
  $pass,
  $userId 
)

Definition at line 86 of file class.ilTestSkillEvaluation.php.

References $pass, drawUpSkillPointAccounts(), evaluateSkillPointAccounts(), initTestResultData(), and reset().

Referenced by trigger().

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

◆ evaluateSkillPointAccounts()

ilTestSkillEvaluation::evaluateSkillPointAccounts (   $userId)
private

Definition at line 190 of file class.ilTestSkillEvaluation.php.

191 {
192 foreach($this->skillPointAccounts as $skillKey => $skillPoints)
193 {
194 list($skillBaseId, $skillTrefId) = explode(':', $skillKey);
195
196 $skill = new ilBasicSkill($skillBaseId);
197 $levels = $skill->getLevelData();
198
199 $reachedLevelId = null;
200
201 foreach($levels as $level)
202 {
203 $threshold = $this->skillLevelThresholdList->getThreshold($skillBaseId, $skillTrefId, $level['id']);
204
205 if( !($threshold instanceof ilTestSkillLevelThreshold) || !$threshold->getThreshold() )
206 {
207 continue;
208 }
209
210 $reachedLevelId = $level['id'];
211
212 if( $skillPoints <= $threshold->getThreshold() )
213 {
214 break;
215 }
216 }
217
218 if( $reachedLevelId )
219 {
220 $this->reachedSkillLevels[] = array(
221 'usrId' => $userId, 'sklBaseId' => $skillBaseId,
222 'sklTrefId' => $skillTrefId, 'sklLevelId' => $reachedLevelId
223 );
224 }
225 }
226 }

Referenced by evaluate().

+ Here is the caller graph for this function:

◆ getAssignedSkillMatchingSkillProfiles()

ilTestSkillEvaluation::getAssignedSkillMatchingSkillProfiles (   $usrId)

Definition at line 282 of file class.ilTestSkillEvaluation.php.

283 {
284 $matchingSkillProfiles = array();
285
286 include_once("./Services/Skill/classes/class.ilSkillProfile.php");
287 $usersProfiles = ilSkillProfile::getProfilesOfUser($usrId);
288
289 foreach ($usersProfiles as $profileData)
290 {
291 $profile = new ilSkillProfile($profileData['id']);
292 $assignedSkillLevels = $profile->getSkillLevels();
293
294 foreach($assignedSkillLevels as $assignedSkillLevel)
295 {
296 $skillBaseId = $assignedSkillLevel['base_skill_id'];
297 $skillTrefId = $assignedSkillLevel['tref_id'];
298
299 if( $this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId) )
300 {
301 $matchingSkillProfiles[$profileData['id']] = $profile->getTitle();
302 }
303 }
304 }
305
306 return $matchingSkillProfiles;
307 }
static getProfilesOfUser($a_user_id)
Get profiles of a user.

References ilSkillProfile\getProfilesOfUser().

+ Here is the call graph for this function:

◆ getReachedSkillLevels()

ilTestSkillEvaluation::getReachedSkillLevels ( )

Definition at line 103 of file class.ilTestSkillEvaluation.php.

References $reachedSkillLevels.

Referenced by getReachedSkillLevelsForPersonalSkillGUI(), and triggerSkillService().

+ Here is the caller graph for this function:

◆ getReachedSkillLevelsForPersonalSkillGUI()

ilTestSkillEvaluation::getReachedSkillLevelsForPersonalSkillGUI ( )

Definition at line 248 of file class.ilTestSkillEvaluation.php.

249 {
250 $reachedLevels = array();
251
252 foreach($this->getReachedSkillLevels() as $reachedLevel)
253 {
254 $reachedLevels[$reachedLevel['sklBaseId']] = array(
255 $reachedLevel['sklTrefId'] => $reachedLevel['sklLevelId']
256 );
257 }
258
259 return $reachedLevels;
260 }

References getReachedSkillLevels().

+ Here is the call graph for this function:

◆ getUniqueAssignedSkillsForPersonalSkillGUI()

ilTestSkillEvaluation::getUniqueAssignedSkillsForPersonalSkillGUI ( )

Definition at line 262 of file class.ilTestSkillEvaluation.php.

263 {
264 $uniqueSkills = array();
265
266 foreach($this->skillQuestionAssignmentList->getUniqueAssignedSkills() as $skill)
267 {
268 $uniqueSkills[] = array(
269 'base_skill_id' => (int)$skill['skill_base_id'],
270 'tref_id' => (int)$skill['skill_tref_id']
271 );
272 }
273
274 return $uniqueSkills;
275 }

◆ init()

ilTestSkillEvaluation::init ( )

Definition at line 76 of file class.ilTestSkillEvaluation.php.

77 {
78 $this->skillQuestionAssignmentList->loadFromDb();
79 $this->skillLevelThresholdList->loadFromDb();
80
81 $this->initTestQuestionData();
82
83 return $this;
84 }

References initTestQuestionData().

+ Here is the call graph for this function:

◆ initTestQuestionData()

ilTestSkillEvaluation::initTestQuestionData ( )
private

Definition at line 115 of file class.ilTestSkillEvaluation.php.

116 {
117 foreach($this->testOBJ->getTestQuestions() as $question)
118 {
119 $this->questions[] = $question['question_id'];
120
121 $this->maxPointsByQuestion[ $question['question_id'] ] = $question['points'];
122 }
123 }

Referenced by init().

+ Here is the caller graph for this function:

◆ initTestResultData()

ilTestSkillEvaluation::initTestResultData (   $activeId,
  $pass 
)
private

Definition at line 125 of file class.ilTestSkillEvaluation.php.

126 {
127 $testResults = $this->testOBJ->getTestResult($activeId, $pass, true);
128 foreach($testResults as $key => $result)
129 {
130 if($key === 'pass' || $key === 'test') // note: key int 0 IS == 'pass' or 'buxtehude'
131 {
132 continue;
133 }
134
135 $this->reachedPointsByQuestion[ $result['qid'] ] = $result['reached'];
136 }
137 }
$result

References $pass, and $result.

Referenced by evaluate().

+ Here is the caller graph for this function:

◆ invokeSkillLevelTrigger()

ilTestSkillEvaluation::invokeSkillLevelTrigger (   $userId,
  $skillBaseId,
  $skillTrefId,
  $skillLevelId 
)
private

Definition at line 239 of file class.ilTestSkillEvaluation.php.

240 {
242 $skillLevelId, $userId, $this->testOBJ->getRefId(), $skillTrefId, ilBasicSkill::ACHIEVED, true
243 );
244
245 //mail('bheyser@databay.de', "trigger skill $skillBaseId:$skillTrefId level $skillLevelId for user $userId", '');
246 }
static writeUserSkillLevelStatus($a_level_id, $a_user_id, $a_trigger_ref_id, $a_tref_id=0, $a_status=ilBasicSkill::ACHIEVED, $a_force=false, $a_self_eval=0)
Write skill level status.

References ilBasicSkill\ACHIEVED, and ilBasicSkill\writeUserSkillLevelStatus().

Referenced by triggerSkillService().

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

◆ isAssignedSkill()

ilTestSkillEvaluation::isAssignedSkill (   $skillBaseId,
  $skillTrefId 
)

Definition at line 277 of file class.ilTestSkillEvaluation.php.

278 {
279 $this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId);
280 }

◆ noProfileMatchingAssignedSkillExists()

ilTestSkillEvaluation::noProfileMatchingAssignedSkillExists (   $usrId,
  $availableSkillProfiles 
)

Definition at line 309 of file class.ilTestSkillEvaluation.php.

310 {
311 $noProfileMatchingSkills = $this->skillQuestionAssignmentList->getUniqueAssignedSkills();
312
313 foreach($availableSkillProfiles as $skillProfileId => $skillProfileTitle)
314 {
315 $profile = new ilSkillProfile($skillProfileId);
316 $assignedSkillLevels = $profile->getSkillLevels();
317
318 foreach($assignedSkillLevels as $assignedSkillLevel)
319 {
320 $skillBaseId = $assignedSkillLevel['base_skill_id'];
321 $skillTrefId = $assignedSkillLevel['tref_id'];
322
323 if( $this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId) )
324 {
325 unset($noProfileMatchingSkills["{$skillBaseId}:{$skillTrefId}"]);
326 }
327 }
328 }
329
330 return count($noProfileMatchingSkills);
331 }

◆ reset()

ilTestSkillEvaluation::reset ( )
private

Definition at line 108 of file class.ilTestSkillEvaluation.php.

109 {
110 $this->reachedPointsByQuestion = array();
111 $this->skillPointAccounts = array();
112 $this->reachedSkillLevels = array();
113 }

Referenced by evaluate().

+ Here is the caller graph for this function:

◆ trigger()

ilTestSkillEvaluation::trigger (   $activeId,
  $pass,
  $userId 
)

Definition at line 96 of file class.ilTestSkillEvaluation.php.

97 {
98 $this->evaluate($activeId, $pass, $userId);
99
100 $this->triggerSkillService();
101 }
evaluate($activeId, $pass, $userId)

References $pass, evaluate(), and triggerSkillService().

+ Here is the call graph for this function:

◆ triggerSkillService()

ilTestSkillEvaluation::triggerSkillService ( )
private

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

229 {
230 foreach($this->getReachedSkillLevels() as $reachedSkillLevel)
231 {
233 $reachedSkillLevel['usrId'], $reachedSkillLevel['sklBaseId'],
234 $reachedSkillLevel['sklTrefId'], $reachedSkillLevel['sklLevelId']
235 );
236 }
237 }
invokeSkillLevelTrigger($userId, $skillBaseId, $skillTrefId, $skillLevelId)

References getReachedSkillLevels(), and invokeSkillLevelTrigger().

Referenced by trigger().

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

Field Documentation

◆ $db

ilTestSkillEvaluation::$db
private

Definition at line 19 of file class.ilTestSkillEvaluation.php.

Referenced by __construct().

◆ $maxPointsByQuestion

ilTestSkillEvaluation::$maxPointsByQuestion
private

Definition at line 44 of file class.ilTestSkillEvaluation.php.

◆ $questions

ilTestSkillEvaluation::$questions
private

Definition at line 39 of file class.ilTestSkillEvaluation.php.

◆ $reachedPointsByQuestion

ilTestSkillEvaluation::$reachedPointsByQuestion
private

Definition at line 49 of file class.ilTestSkillEvaluation.php.

◆ $reachedSkillLevels

ilTestSkillEvaluation::$reachedSkillLevels
private

Definition at line 59 of file class.ilTestSkillEvaluation.php.

Referenced by getReachedSkillLevels().

◆ $skillLevelThresholdList

ilTestSkillEvaluation::$skillLevelThresholdList
private

Definition at line 34 of file class.ilTestSkillEvaluation.php.

◆ $skillPointAccounts

ilTestSkillEvaluation::$skillPointAccounts
private

Definition at line 54 of file class.ilTestSkillEvaluation.php.

◆ $skillQuestionAssignmentList

ilTestSkillEvaluation::$skillQuestionAssignmentList
private

Definition at line 29 of file class.ilTestSkillEvaluation.php.

◆ $testOBJ

ilTestSkillEvaluation::$testOBJ
private

Definition at line 24 of file class.ilTestSkillEvaluation.php.

Referenced by __construct().


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