ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilTestSkillEvaluation Class Reference
+ Collaboration diagram for ilTestSkillEvaluation:

Public Member Functions

 __construct (ilDB $db, $testId, $refId)
 
 getUserId ()
 
 setUserId ($userId)
 
 getActiveId ()
 
 setActiveId ($activeId)
 
 getPass ()
 
 setPass ($pass)
 
 getNumRequiredBookingsForSkillTriggering ()
 
 setNumRequiredBookingsForSkillTriggering ($numRequiredBookingsForSkillTriggering)
 
 init (ilAssQuestionList $questionList)
 
 evaluate ($testResults)
 
 getReachedSkillLevels ()
 
 handleSkillTriggering ()
 
 getReachedSkillLevelsForPersonalSkillGUI ()
 
 getUniqueAssignedSkillsForPersonalSkillGUI ()
 
 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 ( ilDB  $db,
  $testId,
  $refId 
)

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

References $db, and $refId.

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  }

Member Function Documentation

◆ bookToSkillPointAccount()

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

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

Referenced by drawUpSkillPointAccounts().

290  {
291  $skillKey = $skillBaseId.':'.$skillTrefId;
292 
293  if( !isset($this->skillPointAccounts[$skillKey]) )
294  {
295  $this->skillPointAccounts[$skillKey] = new ilTestSkillPointAccount();
296  }
297 
298  $this->skillPointAccounts[$skillKey]->addBooking($maxSkillPoints, $reachedSkillPoints);
299  }
+ Here is the caller graph for this function:

◆ calculateReachedSkillPointsFromTestPoints()

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

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

Referenced by drawUpSkillPointAccounts().

273  {
274  if( $reachedTestPoints < 0 )
275  {
276  $reachedTestPoints = 0;
277  }
278 
279  $factor = 0;
280 
281  if( $maxTestPoints > 0 )
282  {
283  $factor = $reachedTestPoints / $maxTestPoints;
284  }
285 
286  return ($skillPoints * $factor);
287  }
+ Here is the caller graph for this function:

◆ determineReachedSkillPointsWithSolutionCompare()

ilTestSkillEvaluation::determineReachedSkillPointsWithSolutionCompare ( ilAssQuestionSolutionComparisonExpressionList  $expressionList)
private

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

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

Referenced by drawUpSkillPointAccounts().

248  {
249  $questionProvider = new ilAssLacQuestionProvider();
250  $questionProvider->setQuestionId($expressionList->getQuestionId());
251 
252  foreach($expressionList->get() as $expression)
253  {
254  /* @var ilAssQuestionSolutionComparisonExpression $expression */
255 
256  $conditionParser = new ilAssLacConditionParser();
257  $conditionComposite = $conditionParser->parse($expression->getExpression());
258 
259  $compositeEvaluator = new ilAssLacCompositeEvaluator(
260  $questionProvider, $this->getActiveId(), $this->getPass()
261  );
262 
263  if( $compositeEvaluator->evaluate($conditionComposite) )
264  {
265  return $expression->getPoints();
266  }
267  }
268 
269  return 0;
270  }
Class ilParserQuestionProvider.
+ 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 345 of file class.ilTestSkillEvaluation.php.

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

Referenced by evaluateSkillPointAccounts().

346  {
347  return $skillPointAccount->getNumBookings() >= $this->getNumRequiredBookingsForSkillTriggering();
348  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ drawUpSkillPointAccounts()

ilTestSkillEvaluation::drawUpSkillPointAccounts ( )
private

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

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

Referenced by evaluate().

206  {
207  foreach($this->questions as $questionId)
208  {
209  if( !$this->isAnsweredQuestion($questionId) )
210  {
211  continue;
212  }
213 
214  $assignments = $this->skillQuestionAssignmentList->getAssignmentsByQuestionId($questionId);
215 
216  foreach($assignments as $assignment)
217  {
218  if( $assignment->hasEvalModeBySolution() )
219  {
220  $reachedSkillPoints = $this->determineReachedSkillPointsWithSolutionCompare(
221  $assignment->getSolutionComparisonExpressionList()
222  );
223  }
224  else
225  {
226  $maxTestPoints = $this->maxPointsByQuestion[$questionId];
227  $reachedTestPoints = $this->reachedPointsByQuestion[$questionId];
228 
229  $reachedSkillPoints = $this->calculateReachedSkillPointsFromTestPoints(
230  $assignment->getSkillPoints(), $maxTestPoints, $reachedTestPoints
231  );
232  }
233 
235  $assignment->getSkillBaseId(), $assignment->getSkillTrefId(),
236  $assignment->getMaxSkillPoints(), $reachedSkillPoints
237  );
238  }
239  }
240  }
calculateReachedSkillPointsFromTestPoints($skillPoints, $maxTestPoints, $reachedTestPoints)
bookToSkillPointAccount($skillBaseId, $skillTrefId, $maxSkillPoints, $reachedSkillPoints)
determineReachedSkillPointsWithSolutionCompare(ilAssQuestionSolutionComparisonExpressionList $expressionList)
+ 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().

153  {
154  $this->reset();
155 
156  $this->initTestResultData($testResults);
157 
158  $this->drawUpSkillPointAccounts();
160  }
+ Here is the call graph for this function:

◆ evaluateSkillPointAccounts()

ilTestSkillEvaluation::evaluateSkillPointAccounts ( )
private

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

References doesNumBookingsExceedRequiredBookingsBarrier().

Referenced by evaluate().

302  {
303  foreach($this->skillPointAccounts as $skillKey => $skillPointAccount)
304  {
305  /* @var ilTestSkillPointAccount $skillPointAccount */
306 
307  if( !$this->doesNumBookingsExceedRequiredBookingsBarrier($skillPointAccount) )
308  {
309  continue;
310  }
311 
312  list($skillBaseId, $skillTrefId) = explode(':', $skillKey);
313 
314  $skill = new ilBasicSkill($skillBaseId);
315  $levels = $skill->getLevelData();
316 
317  $reachedLevelId = null;
318 
319  foreach($levels as $level)
320  {
321  $threshold = $this->skillLevelThresholdList->getThreshold($skillBaseId, $skillTrefId, $level['id']);
322 
323  if( !($threshold instanceof ilTestSkillLevelThreshold) || !$threshold->getThreshold() )
324  {
325  continue;
326  }
327 
328  $reachedLevelId = $level['id'];
329 
330  if( $skillPointAccount->getTotalReachedSkillPercent() <= $threshold->getThreshold() )
331  {
332  break;
333  }
334  }
335 
336  if( $reachedLevelId )
337  {
338  $this->reachedSkillLevels[] = array(
339  'sklBaseId' => $skillBaseId, 'sklTrefId' => $skillTrefId, 'sklLevelId' => $reachedLevelId
340  );
341  }
342  }
343  }
doesNumBookingsExceedRequiredBookingsBarrier(ilTestSkillPointAccount $skillPointAccount)
Basic Skill.
+ 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 402 of file class.ilTestSkillEvaluation.php.

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

403  {
404  $matchingSkillProfiles = array();
405 
406  include_once("./Services/Skill/classes/class.ilSkillProfile.php");
407  $usersProfiles = ilSkillProfile::getProfilesOfUser($this->getUserId());
408 
409  foreach ($usersProfiles as $profileData)
410  {
411  $profile = new ilSkillProfile($profileData['id']);
412  $assignedSkillLevels = $profile->getSkillLevels();
413 
414  foreach($assignedSkillLevels as $assignedSkillLevel)
415  {
416  $skillBaseId = $assignedSkillLevel['base_skill_id'];
417  $skillTrefId = $assignedSkillLevel['tref_id'];
418 
419  if( $this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId) )
420  {
421  $matchingSkillProfiles[$profileData['id']] = $profile->getTitle();
422  }
423  }
424  }
425 
426  return $matchingSkillProfiles;
427  }
static getProfilesOfUser($a_user_id)
Get profiles of a user.
+ 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().

120  {
121  return $this->pass;
122  }
+ Here is the caller graph for this function:

◆ getReachedSkillLevels()

ilTestSkillEvaluation::getReachedSkillLevels ( )

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

References $reachedSkillLevels.

Referenced by getReachedSkillLevelsForPersonalSkillGUI(), and handleSkillTriggering().

+ Here is the caller graph for this function:

◆ getReachedSkillLevelsForPersonalSkillGUI()

ilTestSkillEvaluation::getReachedSkillLevelsForPersonalSkillGUI ( )

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

References getReachedSkillLevels().

369  {
370  $reachedLevels = array();
371 
372  foreach($this->getReachedSkillLevels() as $reachedLevel)
373  {
374  $reachedLevels[$reachedLevel['sklBaseId']] = array(
375  $reachedLevel['sklTrefId'] => $reachedLevel['sklLevelId']
376  );
377  }
378 
379  return $reachedLevels;
380  }
+ Here is the call graph for this function:

◆ getUniqueAssignedSkillsForPersonalSkillGUI()

ilTestSkillEvaluation::getUniqueAssignedSkillsForPersonalSkillGUI ( )

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

383  {
384  $uniqueSkills = array();
385 
386  foreach($this->skillQuestionAssignmentList->getUniqueAssignedSkills() as $skill)
387  {
388  $uniqueSkills[] = array(
389  'base_skill_id' => (int)$skill['skill_base_id'],
390  'tref_id' => (int)$skill['skill_tref_id']
391  );
392  }
393 
394  return $uniqueSkills;
395  }

◆ getUserId()

ilTestSkillEvaluation::getUserId ( )

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

References $userId.

Referenced by getAssignedSkillMatchingSkillProfiles(), and invokeSkillLevelTrigger().

100  {
101  return $this->userId;
102  }
+ Here is the caller graph for this function:

◆ handleSkillTriggering()

ilTestSkillEvaluation::handleSkillTriggering ( )

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

References getReachedSkillLevels(), and invokeSkillLevelTrigger().

351  {
352  foreach($this->getReachedSkillLevels() as $reachedSkillLevel)
353  {
354  $this->invokeSkillLevelTrigger($reachedSkillLevel['sklLevelId'], $reachedSkillLevel['sklTrefId']);
355  }
356  }
invokeSkillLevelTrigger($skillLevelId, $skillTrefId)
+ Here is the call graph for this function:

◆ init()

ilTestSkillEvaluation::init ( ilAssQuestionList  $questionList)

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

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

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

◆ initTestQuestionData()

ilTestSkillEvaluation::initTestQuestionData ( ilAssQuestionList  $questionList)
private

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

References ilAssQuestionList\getQuestionDataArray().

Referenced by init().

175  {
176  foreach($questionList->getQuestionDataArray() as $questionData)
177  {
178  $this->questions[] = $questionData['question_id'];
179 
180  $this->maxPointsByQuestion[ $questionData['question_id'] ] = $questionData['points'];
181  }
182  }
+ 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 187 of file class.ilTestSkillEvaluation.php.

References $result.

Referenced by evaluate().

188  {
189  foreach($testResults as $key => $result)
190  {
191  if($key === 'pass' || $key === 'test') // note: key int 0 IS == 'pass' or 'buxtehude'
192  {
193  continue;
194  }
195 
196  if( !$result['workedthrough'] )
197  {
198  continue;
199  }
200 
201  $this->reachedPointsByQuestion[ $result['qid'] ] = $result['reached'];
202  }
203  }
$result
+ Here is the caller graph for this function:

◆ invokeSkillLevelTrigger()

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

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

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

Referenced by handleSkillTriggering().

359  {
361  $skillLevelId, $this->getUserId(), $this->refId,
362  $skillTrefId, ilBasicSkill::ACHIEVED, true, 0, $this->getPass()
363  );
364 
365  //mail('bheyser@databay.de', "trigger skill level $skillLevelId for user {$this->getUserId()}", '');
366  }
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, $a_unique_identifier="")
Write skill level status.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAnsweredQuestion()

ilTestSkillEvaluation::isAnsweredQuestion (   $questionId)
private

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

Referenced by drawUpSkillPointAccounts().

243  {
244  return isset($this->reachedPointsByQuestion[$questionId]);
245  }
+ Here is the caller graph for this function:

◆ isAssignedSkill()

ilTestSkillEvaluation::isAssignedSkill (   $skillBaseId,
  $skillTrefId 
)

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

398  {
399  $this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId);
400  }

◆ noProfileMatchingAssignedSkillExists()

ilTestSkillEvaluation::noProfileMatchingAssignedSkillExists (   $availableSkillProfiles)

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

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

◆ reset()

ilTestSkillEvaluation::reset ( )
private

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

Referenced by evaluate().

168  {
169  $this->reachedPointsByQuestion = array();
170  $this->skillPointAccounts = array();
171  $this->reachedSkillLevels = array();
172  }
+ Here is the caller graph for this function:

◆ setActiveId()

ilTestSkillEvaluation::setActiveId (   $activeId)

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

References $activeId.

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

◆ setNumRequiredBookingsForSkillTriggering()

ilTestSkillEvaluation::setNumRequiredBookingsForSkillTriggering (   $numRequiredBookingsForSkillTriggering)

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

References $numRequiredBookingsForSkillTriggering.

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

◆ setPass()

ilTestSkillEvaluation::setPass (   $pass)

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

References $pass.

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

◆ setUserId()

ilTestSkillEvaluation::setUserId (   $userId)

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

References $userId.

Referenced by ilTestPlayerAbstractGUI\handleSkillTriggering().

105  {
106  $this->userId = $userId;
107  }
+ Here is the caller graph for this function:

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: