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

Constructor & Destructor Documentation

◆ __construct()

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

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

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

References $db, and $refId.

Member Function Documentation

◆ bookToSkillPointAccount()

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

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

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

Referenced by drawUpSkillPointAccounts().

+ Here is the caller graph for this function:

◆ calculateReachedSkillPointsFromTestPoints()

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

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

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

Referenced by drawUpSkillPointAccounts().

+ Here is the caller graph for this function:

◆ determineReachedSkillPointsWithSolutionCompare()

ilTestSkillEvaluation::determineReachedSkillPointsWithSolutionCompare ( ilAssQuestionSolutionComparisonExpressionList  $expressionList)
private

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

242 {
243 $questionProvider = new ilAssLacQuestionProvider();
244 $questionProvider->setQuestionId($expressionList->getQuestionId());
245
246 foreach ($expressionList->get() as $expression) {
247 /* @var ilAssQuestionSolutionComparisonExpression $expression */
248
249 $conditionParser = new ilAssLacConditionParser();
250 $conditionComposite = $conditionParser->parse($expression->getExpression());
251
252 $compositeEvaluator = new ilAssLacCompositeEvaluator(
253 $questionProvider,
254 $this->getActiveId(),
255 $this->getPass()
256 );
257
258 if ($compositeEvaluator->evaluate($conditionComposite)) {
259 return $expression->getPoints();
260 }
261 }
262
263 return 0;
264 }
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 330 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 201 of file class.ilTestSkillEvaluation.php.

202 {
203 foreach ($this->questions as $questionId) {
204 if (!$this->isAnsweredQuestion($questionId)) {
205 continue;
206 }
207
208 $assignments = $this->skillQuestionAssignmentList->getAssignmentsByQuestionId($questionId);
209
210 foreach ($assignments as $assignment) {
211 if ($assignment->hasEvalModeBySolution()) {
212 $reachedSkillPoints = $this->determineReachedSkillPointsWithSolutionCompare(
213 $assignment->getSolutionComparisonExpressionList()
214 );
215 } else {
216 $maxTestPoints = $this->maxPointsByQuestion[$questionId];
217 $reachedTestPoints = $this->reachedPointsByQuestion[$questionId];
218
219 $reachedSkillPoints = $this->calculateReachedSkillPointsFromTestPoints(
220 $assignment->getSkillPoints(),
221 $maxTestPoints,
222 $reachedTestPoints
223 );
224 }
225
227 $assignment->getSkillBaseId(),
228 $assignment->getSkillTrefId(),
229 $assignment->getMaxSkillPoints(),
230 $reachedSkillPoints
231 );
232 }
233 }
234 }
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 152 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 292 of file class.ilTestSkillEvaluation.php.

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

References $activeId.

Referenced by determineReachedSkillPointsWithSolutionCompare().

+ Here is the caller graph for this function:

◆ getAssignedSkillMatchingSkillProfiles()

ilTestSkillEvaluation::getAssignedSkillMatchingSkillProfiles ( )

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

410 {
411 $matchingSkillProfiles = array();
412
413 include_once("./Services/Skill/classes/class.ilSkillProfile.php");
414 $usersProfiles = ilSkillProfile::getProfilesOfUser($this->getUserId());
415
416 foreach ($usersProfiles as $profileData) {
417 $profile = new ilSkillProfile($profileData['id']);
418 $assignedSkillLevels = $profile->getSkillLevels();
419
420 foreach ($assignedSkillLevels as $assignedSkillLevel) {
421 $skillBaseId = $assignedSkillLevel['base_skill_id'];
422 $skillTrefId = $assignedSkillLevel['tref_id'];
423
424 if ($this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId)) {
425 $matchingSkillProfiles[$profileData['id']] = $profile->getTitle();
426 }
427 }
428 }
429
430 return $matchingSkillProfiles;
431 }
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 129 of file class.ilTestSkillEvaluation.php.

References $numRequiredBookingsForSkillTriggering.

Referenced by doesNumBookingsExceedRequiredBookingsBarrier().

+ Here is the caller graph for this function:

◆ getPass()

ilTestSkillEvaluation::getPass ( )

Definition at line 119 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 162 of file class.ilTestSkillEvaluation.php.

References $reachedSkillLevels.

Referenced by handleSkillTriggering().

+ Here is the caller graph for this function:

◆ getSkillsInvolvedByAssignment()

ilTestSkillEvaluation::getSkillsInvolvedByAssignment ( )

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

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

◆ getSkillsMatchingNumAnswersBarrier()

ilTestSkillEvaluation::getSkillsMatchingNumAnswersBarrier ( )

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

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

References doesNumBookingsExceedRequiredBookingsBarrier().

+ Here is the call graph for this function:

◆ getUserId()

ilTestSkillEvaluation::getUserId ( )

Definition at line 99 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 335 of file class.ilTestSkillEvaluation.php.

336 {
337 foreach ($this->getReachedSkillLevels() as $reachedSkillLevel) {
338 $this->invokeSkillLevelTrigger($reachedSkillLevel['sklLevelId'], $reachedSkillLevel['sklTrefId']);
339
340 if ($reachedSkillLevel['sklTrefId'] > 0) {
341 ilPersonalSkill::addPersonalSkill($this->getUserId(), $reachedSkillLevel['sklTrefId']);
342 } else {
343 ilPersonalSkill::addPersonalSkill($this->getUserId(), $reachedSkillLevel['sklBaseId']);
344 }
345 }
346 }
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 139 of file class.ilTestSkillEvaluation.php.

140 {
141 $this->skillQuestionAssignmentList->setParentObjId($questionList->getParentObjId());
142 $this->skillQuestionAssignmentList->loadFromDb();
143
144 $this->skillLevelThresholdList->loadFromDb();
145
146 $this->initTestQuestionData($questionList);
147 }
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 174 of file class.ilTestSkillEvaluation.php.

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

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 186 of file class.ilTestSkillEvaluation.php.

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

References $result.

Referenced by evaluate().

+ Here is the caller graph for this function:

◆ invokeSkillLevelTrigger()

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

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

349 {
351 $skillLevelId,
352 $this->getUserId(),
353 $this->refId,
354 $skillTrefId,
356 true,
357 0,
358 $this->getPass()
359 );
360
361 /* @var ILIAS\DI\Container $DIC */ global $DIC;
362
363 $DIC->logger()->root()->info(
364 "refId={$this->refId} / usrId={$this->getUserId()} / levelId={$skillLevelId} / trefId={$skillTrefId}"
365 );
366
367 //mail('bheyser@databay.de', "trigger skill level $skillLevelId for user {$this->getUserId()}", '');
368 }
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=false, $a_unique_identifier="")
Write skill level status.
$DIC
Definition: xapitoken.php:46

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 236 of file class.ilTestSkillEvaluation.php.

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

Referenced by drawUpSkillPointAccounts().

+ Here is the caller graph for this function:

◆ isAssignedSkill()

ilTestSkillEvaluation::isAssignedSkill (   $skillBaseId,
  $skillTrefId 
)

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

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

◆ noProfileMatchingAssignedSkillExists()

ilTestSkillEvaluation::noProfileMatchingAssignedSkillExists (   $availableSkillProfiles)

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

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

◆ reset()

ilTestSkillEvaluation::reset ( )
private

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

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

Referenced by evaluate().

+ Here is the caller graph for this function:

◆ setActiveId()

ilTestSkillEvaluation::setActiveId (   $activeId)

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

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

References $activeId.

◆ setNumRequiredBookingsForSkillTriggering()

ilTestSkillEvaluation::setNumRequiredBookingsForSkillTriggering (   $numRequiredBookingsForSkillTriggering)

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

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

References $numRequiredBookingsForSkillTriggering.

◆ setPass()

ilTestSkillEvaluation::setPass (   $pass)

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

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

References $pass.

◆ setUserId()

ilTestSkillEvaluation::setUserId (   $userId)

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

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

References $userId.

Field Documentation

◆ $activeId

ilTestSkillEvaluation::$activeId
private

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

Referenced by getActiveId(), and setActiveId().

◆ $db

ilTestSkillEvaluation::$db
private

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

Referenced by __construct().

◆ $maxPointsByQuestion

ilTestSkillEvaluation::$maxPointsByQuestion
private

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

◆ $numRequiredBookingsForSkillTriggering

ilTestSkillEvaluation::$numRequiredBookingsForSkillTriggering
private

◆ $pass

ilTestSkillEvaluation::$pass
private

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

Referenced by getPass(), and setPass().

◆ $questions

ilTestSkillEvaluation::$questions
private

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

◆ $reachedPointsByQuestion

ilTestSkillEvaluation::$reachedPointsByQuestion
private

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

◆ $reachedSkillLevels

ilTestSkillEvaluation::$reachedSkillLevels
private

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

Referenced by getReachedSkillLevels().

◆ $refId

ilTestSkillEvaluation::$refId
private

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

Referenced by __construct().

◆ $skillLevelThresholdList

ilTestSkillEvaluation::$skillLevelThresholdList
private

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

◆ $skillPointAccounts

ilTestSkillEvaluation::$skillPointAccounts
private

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

◆ $skillQuestionAssignmentList

ilTestSkillEvaluation::$skillQuestionAssignmentList
private

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

◆ $userId

ilTestSkillEvaluation::$userId
private

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

Referenced by getUserId(), and setUserId().


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