ILIAS  release_7 Revision v7.30-3-g800a261c036
ilTestSkillEvaluation Class Reference
+ Collaboration diagram for ilTestSkillEvaluation:

Public Member Functions

 __construct (ilDBInterface $db, $testId, $refId)
 
 getUserId ()
 
 setUserId ($userId)
 
 getActiveId ()
 
 setActiveId ($activeId)
 
 getPass ()
 
 setPass ($pass)
 
 getNumRequiredBookingsForSkillTriggering ()
 
 setNumRequiredBookingsForSkillTriggering ($numRequiredBookingsForSkillTriggering)
 
 init (ilAssQuestionList $questionList)
 
 evaluate ($testResults)
 
 getReachedSkillLevels ()
 
 handleSkillTriggering ()
 
 getSkillsMatchingNumAnswersBarrier ()
 
 getSkillsInvolvedByAssignment ()
 
 isAssignedSkill ($skillBaseId, $skillTrefId)
 
 getAssignedSkillMatchingSkillProfiles ()
 
 noProfileMatchingAssignedSkillExists ($availableSkillProfiles)
 

Private Member Functions

 reset ()
 
 initTestQuestionData (ilAssQuestionList $questionList)
 
 initTestResultData ($testResults)
 
 drawUpSkillPointAccounts ()
 
 isAnsweredQuestion ($questionId)
 
 determineReachedSkillPointsWithSolutionCompare (ilAssQuestionSolutionComparisonExpressionList $expressionList)
 
 calculateReachedSkillPointsFromTestPoints ($skillPoints, $maxTestPoints, $reachedTestPoints)
 
 bookToSkillPointAccount ($skillBaseId, $skillTrefId, $maxSkillPoints, $reachedSkillPoints)
 
 evaluateSkillPointAccounts ()
 
 doesNumBookingsExceedRequiredBookingsBarrier (ilTestSkillPointAccount $skillPointAccount)
 
 invokeSkillLevelTrigger ($skillLevelId, $skillTrefId)
 

Private Attributes

 $db
 
 $refId
 
 $skillQuestionAssignmentList
 
 $skillLevelThresholdList
 
 $questions
 
 $maxPointsByQuestion
 
 $reachedPointsByQuestion
 
 $skillPointAccounts
 
 $reachedSkillLevels
 
 $userId
 
 $activeId
 
 $pass
 
 $numRequiredBookingsForSkillTriggering
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilTestSkillEvaluation::__construct ( ilDBInterface  $db,
  $testId,
  $refId 
)

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

85 {
86 $this->db = $db;
87 $this->refId = $refId;
88
89 $this->skillQuestionAssignmentList = new ilAssQuestionSkillAssignmentList($this->db);
90
91 $this->skillLevelThresholdList = new ilTestSkillLevelThresholdList($this->db);
92 $this->skillLevelThresholdList->setTestId($testId);
93
94 $this->questions = array();
95 $this->maxPointsByQuestion = array();
96 }

References $db, and $refId.

Member Function Documentation

◆ bookToSkillPointAccount()

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

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

281 {
282 $skillKey = $skillBaseId . ':' . $skillTrefId;
283
284 if (!isset($this->skillPointAccounts[$skillKey])) {
285 $this->skillPointAccounts[$skillKey] = new ilTestSkillPointAccount();
286 }
287
288 $this->skillPointAccounts[$skillKey]->addBooking($maxSkillPoints, $reachedSkillPoints);
289 }

Referenced by drawUpSkillPointAccounts().

+ Here is the caller graph for this function:

◆ calculateReachedSkillPointsFromTestPoints()

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

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

266 {
267 if ($reachedTestPoints < 0) {
268 $reachedTestPoints = 0;
269 }
270
271 $factor = 0;
272
273 if ($maxTestPoints > 0) {
274 $factor = $reachedTestPoints / $maxTestPoints;
275 }
276
277 return ($skillPoints * $factor);
278 }

Referenced by drawUpSkillPointAccounts().

+ Here is the caller graph for this function:

◆ determineReachedSkillPointsWithSolutionCompare()

ilTestSkillEvaluation::determineReachedSkillPointsWithSolutionCompare ( ilAssQuestionSolutionComparisonExpressionList  $expressionList)
private

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

241 {
242 $questionProvider = new ilAssLacQuestionProvider();
243 $questionProvider->setQuestionId($expressionList->getQuestionId());
244
245 foreach ($expressionList->get() as $expression) {
246 /* @var ilAssQuestionSolutionComparisonExpression $expression */
247
248 $conditionParser = new ilAssLacConditionParser();
249 $conditionComposite = $conditionParser->parse($expression->getExpression());
250
251 $compositeEvaluator = new ilAssLacCompositeEvaluator(
252 $questionProvider,
253 $this->getActiveId(),
254 $this->getPass()
255 );
256
257 if ($compositeEvaluator->evaluate($conditionComposite)) {
258 return $expression->getPoints();
259 }
260 }
261
262 return 0;
263 }
Class ilParserQuestionProvider.

References ilAssQuestionSolutionComparisonExpressionList\get(), getActiveId(), getPass(), and ilAssQuestionSolutionComparisonExpressionList\getQuestionId().

Referenced by drawUpSkillPointAccounts().

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

◆ doesNumBookingsExceedRequiredBookingsBarrier()

ilTestSkillEvaluation::doesNumBookingsExceedRequiredBookingsBarrier ( ilTestSkillPointAccount  $skillPointAccount)
private

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

References ilTestSkillPointAccount\getNumBookings(), and getNumRequiredBookingsForSkillTriggering().

Referenced by evaluateSkillPointAccounts(), and getSkillsMatchingNumAnswersBarrier().

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

◆ drawUpSkillPointAccounts()

ilTestSkillEvaluation::drawUpSkillPointAccounts ( )
private

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

201 {
202 foreach ($this->questions as $questionId) {
203 if (!$this->isAnsweredQuestion($questionId)) {
204 continue;
205 }
206
207 $assignments = $this->skillQuestionAssignmentList->getAssignmentsByQuestionId($questionId);
208
209 foreach ($assignments as $assignment) {
210 if ($assignment->hasEvalModeBySolution()) {
211 $reachedSkillPoints = $this->determineReachedSkillPointsWithSolutionCompare(
212 $assignment->getSolutionComparisonExpressionList()
213 );
214 } else {
215 $maxTestPoints = $this->maxPointsByQuestion[$questionId];
216 $reachedTestPoints = $this->reachedPointsByQuestion[$questionId];
217
218 $reachedSkillPoints = $this->calculateReachedSkillPointsFromTestPoints(
219 $assignment->getSkillPoints(),
220 $maxTestPoints,
221 $reachedTestPoints
222 );
223 }
224
226 $assignment->getSkillBaseId(),
227 $assignment->getSkillTrefId(),
228 $assignment->getMaxSkillPoints(),
229 $reachedSkillPoints
230 );
231 }
232 }
233 }
calculateReachedSkillPointsFromTestPoints($skillPoints, $maxTestPoints, $reachedTestPoints)
determineReachedSkillPointsWithSolutionCompare(ilAssQuestionSolutionComparisonExpressionList $expressionList)
bookToSkillPointAccount($skillBaseId, $skillTrefId, $maxSkillPoints, $reachedSkillPoints)

References bookToSkillPointAccount(), calculateReachedSkillPointsFromTestPoints(), determineReachedSkillPointsWithSolutionCompare(), and isAnsweredQuestion().

Referenced by evaluate().

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

◆ evaluate()

ilTestSkillEvaluation::evaluate (   $testResults)
Parameters
array$testResultsAn array containing the test results for a given user

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

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

+ Here is the call graph for this function:

◆ evaluateSkillPointAccounts()

ilTestSkillEvaluation::evaluateSkillPointAccounts ( )
private

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

292 {
293 foreach ($this->skillPointAccounts as $skillKey => $skillPointAccount) {
294 /* @var ilTestSkillPointAccount $skillPointAccount */
295
296 if (!$this->doesNumBookingsExceedRequiredBookingsBarrier($skillPointAccount)) {
297 continue;
298 }
299
300 list($skillBaseId, $skillTrefId) = explode(':', $skillKey);
301
302 $skill = new ilBasicSkill($skillBaseId);
303 $levels = $skill->getLevelData();
304
305 $reachedLevelId = null;
306
307 foreach ($levels as $level) {
308 $threshold = $this->skillLevelThresholdList->getThreshold($skillBaseId, $skillTrefId, $level['id']);
309
310 if (!($threshold instanceof ilTestSkillLevelThreshold) || !$threshold->getThreshold()) {
311 continue;
312 }
313
314 $reachedLevelId = $level['id'];
315
316 if ($skillPointAccount->getTotalReachedSkillPercent() <= $threshold->getThreshold()) {
317 break;
318 }
319 }
320
321 if ($reachedLevelId) {
322 $this->reachedSkillLevels[] = array(
323 'sklBaseId' => $skillBaseId, 'sklTrefId' => $skillTrefId, 'sklLevelId' => $reachedLevelId
324 );
325 }
326 }
327 }
doesNumBookingsExceedRequiredBookingsBarrier(ilTestSkillPointAccount $skillPointAccount)

References doesNumBookingsExceedRequiredBookingsBarrier().

Referenced by evaluate().

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

◆ getActiveId()

ilTestSkillEvaluation::getActiveId ( )

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

References $activeId.

Referenced by determineReachedSkillPointsWithSolutionCompare().

+ Here is the caller graph for this function:

◆ getAssignedSkillMatchingSkillProfiles()

ilTestSkillEvaluation::getAssignedSkillMatchingSkillProfiles ( )

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

409 {
410 $matchingSkillProfiles = array();
411
412 $usersProfiles = ilSkillProfile::getProfilesOfUser($this->getUserId());
413
414 foreach ($usersProfiles as $profileData) {
415 $profile = new ilSkillProfile($profileData['id']);
416 $assignedSkillLevels = $profile->getSkillLevels();
417
418 foreach ($assignedSkillLevels as $assignedSkillLevel) {
419 $skillBaseId = $assignedSkillLevel['base_skill_id'];
420 $skillTrefId = $assignedSkillLevel['tref_id'];
421
422 if ($this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId)) {
423 $matchingSkillProfiles[$profileData['id']] = $profile->getTitle();
424 }
425 }
426 }
427
428 return $matchingSkillProfiles;
429 }
static getProfilesOfUser($a_user_id)
Get profiles of a user.

References ilSkillProfile\getProfilesOfUser(), and getUserId().

+ Here is the call graph for this function:

◆ getNumRequiredBookingsForSkillTriggering()

ilTestSkillEvaluation::getNumRequiredBookingsForSkillTriggering ( )

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

References $numRequiredBookingsForSkillTriggering.

Referenced by doesNumBookingsExceedRequiredBookingsBarrier().

+ Here is the caller graph for this function:

◆ getPass()

ilTestSkillEvaluation::getPass ( )

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

References $pass.

Referenced by determineReachedSkillPointsWithSolutionCompare(), and invokeSkillLevelTrigger().

+ Here is the caller graph for this function:

◆ getReachedSkillLevels()

ilTestSkillEvaluation::getReachedSkillLevels ( )

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

References $reachedSkillLevels.

Referenced by handleSkillTriggering().

+ Here is the caller graph for this function:

◆ getSkillsInvolvedByAssignment()

ilTestSkillEvaluation::getSkillsInvolvedByAssignment ( )

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

388 {
389 $uniqueSkills = array();
390
391 foreach ($this->skillQuestionAssignmentList->getUniqueAssignedSkills() as $skill) {
392 $skillKey = $skill['skill_base_id'] . ':' . $skill['skill_tref_id'];
393
394 $uniqueSkills[$skillKey] = array(
395 'base_skill_id' => (int) $skill['skill_base_id'],
396 'tref_id' => (int) $skill['skill_tref_id']
397 );
398 }
399
400 return $uniqueSkills;
401 }

◆ getSkillsMatchingNumAnswersBarrier()

ilTestSkillEvaluation::getSkillsMatchingNumAnswersBarrier ( )

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

370 {
371 $skillsMatchingNumAnswersBarrier = array();
372
373 foreach ($this->skillPointAccounts as $skillKey => $skillPointAccount) {
374 if ($this->doesNumBookingsExceedRequiredBookingsBarrier($skillPointAccount)) {
375 list($skillBaseId, $skillTrefId) = explode(':', $skillKey);
376
377 $skillsMatchingNumAnswersBarrier[$skillKey] = array(
378 'base_skill_id' => (int) $skillBaseId,
379 'tref_id' => (int) $skillTrefId
380 );
381 }
382 }
383
384 return $skillsMatchingNumAnswersBarrier;
385 }

References doesNumBookingsExceedRequiredBookingsBarrier().

+ Here is the call graph for this function:

◆ getUserId()

ilTestSkillEvaluation::getUserId ( )

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

References $userId.

Referenced by getAssignedSkillMatchingSkillProfiles(), handleSkillTriggering(), and invokeSkillLevelTrigger().

+ Here is the caller graph for this function:

◆ handleSkillTriggering()

ilTestSkillEvaluation::handleSkillTriggering ( )

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

335 {
336 foreach ($this->getReachedSkillLevels() as $reachedSkillLevel) {
337 $this->invokeSkillLevelTrigger($reachedSkillLevel['sklLevelId'], $reachedSkillLevel['sklTrefId']);
338
339 if ($reachedSkillLevel['sklTrefId'] > 0) {
340 ilPersonalSkill::addPersonalSkill($this->getUserId(), $reachedSkillLevel['sklTrefId']);
341 } else {
342 ilPersonalSkill::addPersonalSkill($this->getUserId(), $reachedSkillLevel['sklBaseId']);
343 }
344 }
345 }
static addPersonalSkill($a_user_id, $a_skill_node_id)
Add personal skill.
invokeSkillLevelTrigger($skillLevelId, $skillTrefId)

References ilPersonalSkill\addPersonalSkill(), getReachedSkillLevels(), getUserId(), and invokeSkillLevelTrigger().

+ Here is the call graph for this function:

◆ init()

ilTestSkillEvaluation::init ( ilAssQuestionList  $questionList)

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

139 {
140 $this->skillQuestionAssignmentList->setParentObjId($questionList->getParentObjId());
141 $this->skillQuestionAssignmentList->loadFromDb();
142
143 $this->skillLevelThresholdList->loadFromDb();
144
145 $this->initTestQuestionData($questionList);
146 }
initTestQuestionData(ilAssQuestionList $questionList)

References ilAssQuestionList\getParentObjId(), and initTestQuestionData().

+ Here is the call graph for this function:

◆ initTestQuestionData()

ilTestSkillEvaluation::initTestQuestionData ( ilAssQuestionList  $questionList)
private

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

174 {
175 foreach ($questionList->getQuestionDataArray() as $questionData) {
176 $this->questions[] = $questionData['question_id'];
177
178 $this->maxPointsByQuestion[ $questionData['question_id'] ] = $questionData['points'];
179 }
180 }

References ilAssQuestionList\getQuestionDataArray().

Referenced by init().

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

◆ initTestResultData()

ilTestSkillEvaluation::initTestResultData (   $testResults)
private
Parameters
array$testResults

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

186 {
187 foreach ($testResults as $key => $result) {
188 if ($key === 'pass' || $key === 'test') { // note: key int 0 IS == 'pass' or 'buxtehude'
189 continue;
190 }
191
192 if (!$result['workedthrough']) {
193 continue;
194 }
195
196 $this->reachedPointsByQuestion[ $result['qid'] ] = $result['reached'];
197 }
198 }
$result

References $result.

Referenced by evaluate().

+ Here is the caller graph for this function:

◆ invokeSkillLevelTrigger()

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

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

348 {
350 $skillLevelId,
351 $this->getUserId(),
352 $this->refId,
353 $skillTrefId,
355 true,
356 0,
357 $this->getPass()
358 );
359
360 /* @var ILIAS\DI\Container $DIC */ global $DIC;
361
362 $DIC->logger()->root()->info(
363 "refId={$this->refId} / usrId={$this->getUserId()} / levelId={$skillLevelId} / trefId={$skillTrefId}"
364 );
365
366 //mail('bheyser@databay.de', "trigger skill level $skillLevelId for user {$this->getUserId()}", '');
367 }
static writeUserSkillLevelStatus(int $a_level_id, int $a_user_id, int $a_trigger_ref_id, int $a_tref_id=0, int $a_status=ilBasicSkill::ACHIEVED, bool $a_force=false, bool $a_self_eval=false, string $a_unique_identifier="", float $a_next_level_fulfilment=0.0)
global $DIC
Definition: goto.php:24

References $DIC, ilBasicSkill\ACHIEVED, getPass(), getUserId(), and ilBasicSkill\writeUserSkillLevelStatus().

Referenced by handleSkillTriggering().

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

◆ isAnsweredQuestion()

ilTestSkillEvaluation::isAnsweredQuestion (   $questionId)
private

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

236 {
237 return isset($this->reachedPointsByQuestion[$questionId]);
238 }

Referenced by drawUpSkillPointAccounts().

+ Here is the caller graph for this function:

◆ isAssignedSkill()

ilTestSkillEvaluation::isAssignedSkill (   $skillBaseId,
  $skillTrefId 
)

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

404 {
405 $this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId);
406 }

◆ noProfileMatchingAssignedSkillExists()

ilTestSkillEvaluation::noProfileMatchingAssignedSkillExists (   $availableSkillProfiles)

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

432 {
433 $noProfileMatchingSkills = $this->skillQuestionAssignmentList->getUniqueAssignedSkills();
434
435 foreach ($availableSkillProfiles as $skillProfileId => $skillProfileTitle) {
436 $profile = new ilSkillProfile($skillProfileId);
437 $assignedSkillLevels = $profile->getSkillLevels();
438
439 foreach ($assignedSkillLevels as $assignedSkillLevel) {
440 $skillBaseId = $assignedSkillLevel['base_skill_id'];
441 $skillTrefId = $assignedSkillLevel['tref_id'];
442
443 if ($this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId)) {
444 unset($noProfileMatchingSkills["{$skillBaseId}:{$skillTrefId}"]);
445 }
446 }
447 }
448
449 return count($noProfileMatchingSkills);
450 }

◆ reset()

ilTestSkillEvaluation::reset ( )
private

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

167 {
168 $this->reachedPointsByQuestion = array();
169 $this->skillPointAccounts = array();
170 $this->reachedSkillLevels = array();
171 }

Referenced by evaluate().

+ Here is the caller graph for this function:

◆ setActiveId()

ilTestSkillEvaluation::setActiveId (   $activeId)

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

114 {
115 $this->activeId = $activeId;
116 }

References $activeId.

◆ setNumRequiredBookingsForSkillTriggering()

ilTestSkillEvaluation::setNumRequiredBookingsForSkillTriggering (   $numRequiredBookingsForSkillTriggering)

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

134 {
135 $this->numRequiredBookingsForSkillTriggering = $numRequiredBookingsForSkillTriggering;
136 }

References $numRequiredBookingsForSkillTriggering.

◆ setPass()

ilTestSkillEvaluation::setPass (   $pass)

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

124 {
125 $this->pass = $pass;
126 }

References $pass.

◆ setUserId()

ilTestSkillEvaluation::setUserId (   $userId)

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

104 {
105 $this->userId = $userId;
106 }

References $userId.

Field Documentation

◆ $activeId

ilTestSkillEvaluation::$activeId
private

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

Referenced by getActiveId(), and setActiveId().

◆ $db

ilTestSkillEvaluation::$db
private

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

Referenced by __construct().

◆ $maxPointsByQuestion

ilTestSkillEvaluation::$maxPointsByQuestion
private

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

◆ $numRequiredBookingsForSkillTriggering

ilTestSkillEvaluation::$numRequiredBookingsForSkillTriggering
private

◆ $pass

ilTestSkillEvaluation::$pass
private

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

Referenced by getPass(), and setPass().

◆ $questions

ilTestSkillEvaluation::$questions
private

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

◆ $reachedPointsByQuestion

ilTestSkillEvaluation::$reachedPointsByQuestion
private

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

◆ $reachedSkillLevels

ilTestSkillEvaluation::$reachedSkillLevels
private

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

Referenced by getReachedSkillLevels().

◆ $refId

ilTestSkillEvaluation::$refId
private

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

Referenced by __construct().

◆ $skillLevelThresholdList

ilTestSkillEvaluation::$skillLevelThresholdList
private

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

◆ $skillPointAccounts

ilTestSkillEvaluation::$skillPointAccounts
private

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

◆ $skillQuestionAssignmentList

ilTestSkillEvaluation::$skillQuestionAssignmentList
private

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

◆ $userId

ilTestSkillEvaluation::$userId
private

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

Referenced by getUserId(), and setUserId().


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