ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTestSkillQuestionAssignmentList Class Reference
+ Collaboration diagram for ilTestSkillQuestionAssignmentList:

Public Member Functions

 __construct (ilDB $db)
 setTestId ($testId)
 getTestId ()
 reset ()
 loadFromDb ()
 loadAdditionalSkillData ()
 getAssignmentsByQuestionId ($questionId)
 getUniqueAssignedSkills ()
 isAssignedSkill ($skillBaseId, $skillTrefId)
 getNumAssignsBySkill ($skillBaseId, $skillTrefId)
 getMaxPointsBySkill ($skillBaseId, $skillTrefId)

Private Member Functions

 addAssignment (ilTestSkillQuestionAssignment $assignment)
 incrementNumAssignsBySkill (ilTestSkillQuestionAssignment $assignment)
 incrementMaxPointsBySkill (ilTestSkillQuestionAssignment $assignment)
 buildSkillQuestionAssignmentByArray ($data)
 buildSkillKey ($skillBaseId, $skillTrefId)

Private Attributes

 $db
 $testId
 $assignments
 $numAssignsBySkill
 $maxPointsBySkill

Detailed Description

Definition at line 12 of file class.ilTestSkillQuestionAssignmentList.php.

Constructor & Destructor Documentation

ilTestSkillQuestionAssignmentList::__construct ( ilDB  $db)

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

References $db.

{
$this->db = $db;
}

Member Function Documentation

ilTestSkillQuestionAssignmentList::addAssignment ( ilTestSkillQuestionAssignment  $assignment)
private

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

References ilTestSkillQuestionAssignment\getQuestionId().

Referenced by loadFromDb().

{
if( !isset($this->assignments[$assignment->getQuestionId()]) )
{
$this->assignments[$assignment->getQuestionId()] = array();
}
$this->assignments[$assignment->getQuestionId()][] = $assignment;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestSkillQuestionAssignmentList::buildSkillKey (   $skillBaseId,
  $skillTrefId 
)
private

Definition at line 140 of file class.ilTestSkillQuestionAssignmentList.php.

Referenced by getMaxPointsBySkill(), getNumAssignsBySkill(), getUniqueAssignedSkills(), incrementMaxPointsBySkill(), and incrementNumAssignsBySkill().

{
return $skillBaseId.':'.$skillTrefId;
}

+ Here is the caller graph for this function:

ilTestSkillQuestionAssignmentList::buildSkillQuestionAssignmentByArray (   $data)
private
Parameters
array$data
Returns
ilTestSkillQuestionAssignment

Definition at line 127 of file class.ilTestSkillQuestionAssignmentList.php.

Referenced by loadFromDb().

{
$assignment = new ilTestSkillQuestionAssignment($this->db);
$assignment->setTestId($data['test_fi']);
$assignment->setQuestionId($data['question_fi']);
$assignment->setSkillBaseId($data['skill_base_fi']);
$assignment->setSkillTrefId($data['skill_tref_fi']);
$assignment->setSkillPoints($data['skill_points']);
return $assignment;
}

+ Here is the caller graph for this function:

ilTestSkillQuestionAssignmentList::getAssignmentsByQuestionId (   $questionId)

Definition at line 156 of file class.ilTestSkillQuestionAssignmentList.php.

{
if( !isset($this->assignments[$questionId]) )
{
return array();
}
return $this->assignments[$questionId];
}
ilTestSkillQuestionAssignmentList::getMaxPointsBySkill (   $skillBaseId,
  $skillTrefId 
)

Definition at line 221 of file class.ilTestSkillQuestionAssignmentList.php.

References buildSkillKey().

Referenced by getUniqueAssignedSkills().

{
return $this->maxPointsBySkill[$this->buildSkillKey($skillBaseId, $skillTrefId)];
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestSkillQuestionAssignmentList::getNumAssignsBySkill (   $skillBaseId,
  $skillTrefId 
)

Definition at line 216 of file class.ilTestSkillQuestionAssignmentList.php.

References buildSkillKey().

Referenced by getUniqueAssignedSkills().

{
return $this->numAssignsBySkill[$this->buildSkillKey($skillBaseId, $skillTrefId)];
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestSkillQuestionAssignmentList::getTestId ( )
Returns
int

Definition at line 55 of file class.ilTestSkillQuestionAssignmentList.php.

References $testId.

Referenced by loadFromDb().

{
return $this->testId;
}

+ Here is the caller graph for this function:

ilTestSkillQuestionAssignmentList::getUniqueAssignedSkills ( )

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

References buildSkillKey(), getMaxPointsBySkill(), and getNumAssignsBySkill().

Referenced by isAssignedSkill().

{
require_once 'Services/Skill/classes/class.ilBasicSkill.php';
$skills = array();
foreach($this->assignments as $assignmentsByQuestion)
{
foreach($assignmentsByQuestion as $assignment)
{
$key = $this->buildSkillKey($assignment->getSkillBaseId(), $assignment->getSkillTrefId());
if( !isset($skills[$key]) )
{
$skills[$key] = array(
'skill' => new ilBasicSkill($assignment->getSkillBaseId()),
'skill_base_id' => $assignment->getSkillBaseId(),
'skill_tref_id' => $assignment->getSkillTrefId(),
'num_assigns' => $this->getNumAssignsBySkill(
$assignment->getSkillBaseId(), $assignment->getSkillTrefId()
),
'max_points' => $this->getMaxPointsBySkill(
$assignment->getSkillBaseId(), $assignment->getSkillTrefId()
)
);
}
}
}
return $skills;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestSkillQuestionAssignmentList::incrementMaxPointsBySkill ( ilTestSkillQuestionAssignment  $assignment)
private

Definition at line 89 of file class.ilTestSkillQuestionAssignmentList.php.

References buildSkillKey(), ilTestSkillQuestionAssignment\getSkillBaseId(), ilTestSkillQuestionAssignment\getSkillPoints(), and ilTestSkillQuestionAssignment\getSkillTrefId().

Referenced by loadFromDb().

{
$key = $this->buildSkillKey($assignment->getSkillBaseId(), $assignment->getSkillTrefId());
if( !isset($this->maxPointsBySkill[$key]) )
{
$this->maxPointsBySkill[$key] = 0;
}
$this->maxPointsBySkill[$key] += $assignment->getSkillPoints();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestSkillQuestionAssignmentList::incrementNumAssignsBySkill ( ilTestSkillQuestionAssignment  $assignment)
private

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

References buildSkillKey(), ilTestSkillQuestionAssignment\getSkillBaseId(), and ilTestSkillQuestionAssignment\getSkillTrefId().

Referenced by loadFromDb().

{
$key = $this->buildSkillKey($assignment->getSkillBaseId(), $assignment->getSkillTrefId());
if( !isset($this->numAssignsBySkill[$key]) )
{
$this->numAssignsBySkill[$key] = 0;
}
$this->numAssignsBySkill[$key]++;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestSkillQuestionAssignmentList::isAssignedSkill (   $skillBaseId,
  $skillTrefId 
)

Definition at line 198 of file class.ilTestSkillQuestionAssignmentList.php.

References getUniqueAssignedSkills().

{
foreach($this->getUniqueAssignedSkills() as $assignedSkill)
{
if( $assignedSkill['skill_base_id'] != $skillBaseId )
{
continue;
}
if( $assignedSkill['skill_tref_id'] == $skillTrefId )
{
return true;
}
}
return false;
}

+ Here is the call graph for this function:

ilTestSkillQuestionAssignmentList::loadAdditionalSkillData ( )

Definition at line 145 of file class.ilTestSkillQuestionAssignmentList.php.

{
foreach($this->assignments as $assignmentsByQuestion)
{
foreach($assignmentsByQuestion as $assignment)
{
$assignment->loadAdditionalSkillData();
}
}
}
ilTestSkillQuestionAssignmentList::loadFromDb ( )

Definition at line 101 of file class.ilTestSkillQuestionAssignmentList.php.

References $query, $res, $row, addAssignment(), buildSkillQuestionAssignmentByArray(), getTestId(), incrementMaxPointsBySkill(), incrementNumAssignsBySkill(), and reset().

{
$this->reset();
$query = "
SELECT test_fi, question_fi, skill_base_fi, skill_tref_fi, skill_points
FROM tst_skl_qst_assigns
WHERE test_fi = %s
";
$res = $this->db->queryF( $query, array('integer'), array($this->getTestId()) );
while( $row = $this->db->fetchAssoc($res) )
{
$this->addAssignment($assignment);
$this->incrementNumAssignsBySkill($assignment);
$this->incrementMaxPointsBySkill($assignment);
}
}

+ Here is the call graph for this function:

ilTestSkillQuestionAssignmentList::reset ( )

Definition at line 60 of file class.ilTestSkillQuestionAssignmentList.php.

Referenced by loadFromDb().

{
$this->assignments = array();
$this->numAssignsBySkill = array();
$this->maxPointsBySkill = array();
}

+ Here is the caller graph for this function:

ilTestSkillQuestionAssignmentList::setTestId (   $testId)
Parameters
int$testId

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

References $testId.

{
$this->testId = $testId;
}

Field Documentation

ilTestSkillQuestionAssignmentList::$assignments
private

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

ilTestSkillQuestionAssignmentList::$db
private

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

Referenced by __construct().

ilTestSkillQuestionAssignmentList::$maxPointsBySkill
private

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

ilTestSkillQuestionAssignmentList::$numAssignsBySkill
private

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

ilTestSkillQuestionAssignmentList::$testId
private

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

Referenced by getTestId(), and setTestId().


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