ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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

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

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

References $db, and $testOBJ.

{
$this->db = $db;
$this->testOBJ = $testOBJ;
$this->skillQuestionAssignmentList = new ilTestSkillQuestionAssignmentList($this->db);
$this->skillQuestionAssignmentList->setTestId($this->testOBJ->getTestId());
$this->skillLevelThresholdList = new ilTestSkillLevelThresholdList($this->db);
$this->skillLevelThresholdList->setTestId($this->testOBJ->getTestId());
$this->questions = array();
$this->maxPointsByQuestion = array();
}

Member Function Documentation

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

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

Referenced by drawUpSkillPointAccounts().

{
$skillKey = $skillBaseId.':'.$skillTrefId;
if( !isset($this->skillPointAccounts[$skillKey]) )
{
$this->skillPointAccounts[$skillKey] = 0;
}
$this->skillPointAccounts[$skillKey] += $reachedSkillPoints;
}

+ Here is the caller graph for this function:

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

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

Referenced by drawUpSkillPointAccounts().

{
if( $reachedTestPoints < 0 )
{
$reachedTestPoints = 0;
}
$factor = 0;
if( $maxTestPoints > 0 )
{
$factor = $reachedTestPoints / $maxTestPoints;
}
return ($skillPoints * $factor);
}

+ Here is the caller graph for this function:

ilTestSkillEvaluation::drawUpSkillPointAccounts ( )
private

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

References bookToSkillPointAccount(), and calculateReachedSkillPoints().

Referenced by evaluate().

{
foreach($this->questions as $questionId)
{
$maxTestPoints = $this->maxPointsByQuestion[$questionId];
$reachedTestPoints = $this->reachedPointsByQuestion[$questionId];
$assignments = $this->skillQuestionAssignmentList->getAssignmentsByQuestionId($questionId);
foreach($assignments as $assignment)
{
$reachedSkillPoints = $this->calculateReachedSkillPoints(
$assignment->getSkillPoints(), $maxTestPoints, $reachedTestPoints
);
$assignment->getSkillBaseId(), $assignment->getSkillTrefId(), $reachedSkillPoints
);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

Referenced by trigger().

{
$this->reset();
$this->initTestResultData($activeId, $pass);
$this->evaluateSkillPointAccounts($userId);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestSkillEvaluation::evaluateSkillPointAccounts (   $userId)
private

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

Referenced by evaluate().

{
foreach($this->skillPointAccounts as $skillKey => $skillPoints)
{
list($skillBaseId, $skillTrefId) = explode(':', $skillKey);
$skill = new ilBasicSkill($skillBaseId);
$levels = $skill->getLevelData();
$reachedLevelId = null;
foreach($levels as $level)
{
$threshold = $this->skillLevelThresholdList->getThreshold($skillBaseId, $skillTrefId, $level['id']);
if( !($threshold instanceof ilTestSkillLevelThreshold) || !$threshold->getThreshold() )
{
continue;
}
$reachedLevelId = $level['id'];
if( $skillPoints <= $threshold->getThreshold() )
{
break;
}
}
if( $reachedLevelId )
{
$this->reachedSkillLevels[] = array(
'usrId' => $userId, 'sklBaseId' => $skillBaseId,
'sklTrefId' => $skillTrefId, 'sklLevelId' => $reachedLevelId
);
}
}
}

+ Here is the caller graph for this function:

ilTestSkillEvaluation::getAssignedSkillMatchingSkillProfiles (   $usrId)

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

References ilSkillProfile\getProfilesOfUser().

{
$matchingSkillProfiles = array();
include_once("./Services/Skill/classes/class.ilSkillProfile.php");
$usersProfiles = ilSkillProfile::getProfilesOfUser($usrId);
foreach ($usersProfiles as $profileData)
{
$profile = new ilSkillProfile($profileData['id']);
$assignedSkillLevels = $profile->getSkillLevels();
foreach($assignedSkillLevels as $assignedSkillLevel)
{
$skillBaseId = $assignedSkillLevel['base_skill_id'];
$skillTrefId = $assignedSkillLevel['tref_id'];
if( $this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId) )
{
$matchingSkillProfiles[$profileData['id']] = $profile->getTitle();
}
}
}
return $matchingSkillProfiles;
}

+ Here is the call graph for this function:

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:

ilTestSkillEvaluation::getReachedSkillLevelsForPersonalSkillGUI ( )

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

References getReachedSkillLevels().

{
$reachedLevels = array();
foreach($this->getReachedSkillLevels() as $reachedLevel)
{
$reachedLevels[$reachedLevel['sklBaseId']] = array(
$reachedLevel['sklTrefId'] => $reachedLevel['sklLevelId']
);
}
return $reachedLevels;
}

+ Here is the call graph for this function:

ilTestSkillEvaluation::getUniqueAssignedSkillsForPersonalSkillGUI ( )

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

{
$uniqueSkills = array();
foreach($this->skillQuestionAssignmentList->getUniqueAssignedSkills() as $skill)
{
$uniqueSkills[] = array(
'base_skill_id' => (int)$skill['skill_base_id'],
'tref_id' => (int)$skill['skill_tref_id']
);
}
return $uniqueSkills;
}
ilTestSkillEvaluation::init ( )

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

References initTestQuestionData().

{
$this->skillQuestionAssignmentList->loadFromDb();
$this->skillLevelThresholdList->loadFromDb();
return $this;
}

+ Here is the call graph for this function:

ilTestSkillEvaluation::initTestQuestionData ( )
private

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

Referenced by init().

{
foreach($this->testOBJ->getTestQuestions() as $question)
{
$this->questions[] = $question['question_id'];
$this->maxPointsByQuestion[ $question['question_id'] ] = $question['points'];
}
}

+ Here is the caller graph for this function:

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

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

References $pass, and $result.

Referenced by evaluate().

{
$testResults = $this->testOBJ->getTestResult($activeId, $pass, true);
foreach($testResults as $key => $result)
{
if($key === 'pass' || $key === 'test') // note: key int 0 IS == 'pass' or 'buxtehude'
{
continue;
}
$this->reachedPointsByQuestion[ $result['qid'] ] = $result['reached'];
}
}

+ Here is the caller graph for this function:

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

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

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

Referenced by triggerSkillService().

{
$skillLevelId, $userId, $this->testOBJ->getRefId(), $skillTrefId, ilBasicSkill::ACHIEVED, true
);
//mail('bheyser@databay.de', "trigger skill $skillBaseId:$skillTrefId level $skillLevelId for user $userId", '');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestSkillEvaluation::isAssignedSkill (   $skillBaseId,
  $skillTrefId 
)

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

{
$this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId);
}
ilTestSkillEvaluation::noProfileMatchingAssignedSkillExists (   $usrId,
  $availableSkillProfiles 
)

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

{
$noProfileMatchingSkills = $this->skillQuestionAssignmentList->getUniqueAssignedSkills();
foreach($availableSkillProfiles as $skillProfileId => $skillProfileTitle)
{
$profile = new ilSkillProfile($skillProfileId);
$assignedSkillLevels = $profile->getSkillLevels();
foreach($assignedSkillLevels as $assignedSkillLevel)
{
$skillBaseId = $assignedSkillLevel['base_skill_id'];
$skillTrefId = $assignedSkillLevel['tref_id'];
if( $this->skillQuestionAssignmentList->isAssignedSkill($skillBaseId, $skillTrefId) )
{
unset($noProfileMatchingSkills["{$skillBaseId}:{$skillTrefId}"]);
}
}
}
return count($noProfileMatchingSkills);
}
ilTestSkillEvaluation::reset ( )
private

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

Referenced by evaluate().

{
$this->reachedPointsByQuestion = array();
$this->skillPointAccounts = array();
$this->reachedSkillLevels = array();
}

+ Here is the caller graph for this function:

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

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

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

{
$this->evaluate($activeId, $pass, $userId);
}

+ Here is the call graph for this function:

ilTestSkillEvaluation::triggerSkillService ( )
private

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

References getReachedSkillLevels(), and invokeSkillLevelTrigger().

Referenced by trigger().

{
foreach($this->getReachedSkillLevels() as $reachedSkillLevel)
{
$reachedSkillLevel['usrId'], $reachedSkillLevel['sklBaseId'],
$reachedSkillLevel['sklTrefId'], $reachedSkillLevel['sklLevelId']
);
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilTestSkillEvaluation::$db
private

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

Referenced by __construct().

ilTestSkillEvaluation::$maxPointsByQuestion
private

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

ilTestSkillEvaluation::$questions
private

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

ilTestSkillEvaluation::$reachedPointsByQuestion
private

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

ilTestSkillEvaluation::$reachedSkillLevels
private

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

Referenced by getReachedSkillLevels().

ilTestSkillEvaluation::$skillLevelThresholdList
private

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

ilTestSkillEvaluation::$skillPointAccounts
private

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

ilTestSkillEvaluation::$skillQuestionAssignmentList
private

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

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: