ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTestSkillLevelThresholdExporter.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
11 {
15  protected $xmlWriter;
16 
20  protected $assignmentList;
21 
25  protected $thresholdList;
26 
30  public function __construct()
31  {
32  $this->xmlWriter = null;
33  }
34 
38  public function getXmlWriter()
39  {
40  return $this->xmlWriter;
41  }
42 
47  {
48  $this->xmlWriter = $xmlWriter;
49  }
50 
54  public function getAssignmentList()
55  {
56  return $this->assignmentList;
57  }
58 
63  {
64  $this->assignmentList = $assignmentList;
65  }
66 
70  public function getThresholdList()
71  {
72  return $this->thresholdList;
73  }
74 
79  {
80  $this->thresholdList = $thresholdList;
81  }
82 
83  public function export()
84  {
85  $this->getXmlWriter()->xmlStartTag('SkillsLevelThresholds');
86 
87  foreach ($this->getAssignmentList()->getUniqueAssignedSkills() as $assignedSkillData) {
88  $this->getXmlWriter()->xmlStartTag('QuestionsAssignedSkill', array(
89  'BaseId' => $assignedSkillData['skill_base_id'],
90  'TrefId' => $assignedSkillData['skill_tref_id']
91  ));
92 
93  $this->getXmlWriter()->xmlElement('OriginalSkillTitle', null, $assignedSkillData['skill_title']);
94  $this->getXmlWriter()->xmlElement('OriginalSkillPath', null, $assignedSkillData['skill_path']);
95 
96  /* @var ilBasicSkill $assignedSkill */
97  $assignedSkill = $assignedSkillData['skill'];
98  $skillLevels = $assignedSkill->getLevelData();
99 
100  for ($i = 0, $max = count($skillLevels); $i < $max; $i++) {
101  $levelData = $skillLevels[$i];
102 
103  $skillLevelThreshold = $this->getThresholdList()->getThreshold(
104  $assignedSkillData['skill_base_id'],
105  $assignedSkillData['skill_tref_id'],
106  $levelData['id'],
107  true
108  );
109 
110  $this->getXmlWriter()->xmlStartTag('SkillLevel', array(
111  'Id' => $levelData['id'], 'Nr' => $levelData['nr']
112  ));
113 
114  $this->getXmlWriter()->xmlElement('ThresholdPercentage', null, $skillLevelThreshold->getThreshold());
115 
116  $this->getXmlWriter()->xmlElement('OriginalLevelTitle', null, $levelData['title']);
117  $this->getXmlWriter()->xmlElement('OriginalLevelDescription', null, $levelData['description']);
118 
119  $this->getXmlWriter()->xmlEndTag('SkillLevel');
120  }
121 
122  $this->getXmlWriter()->xmlEndTag('QuestionsAssignedSkill');
123  }
124 
125  $this->getXmlWriter()->xmlEndTag('SkillsLevelThresholds');
126  }
127 }
__construct()
ilAssQuestionSkillAssignmentExporter constructor.
XML writer class.
$i
Definition: disco.tpl.php:19