ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTestSkillLevelThresholdExporter.php
Go to the documentation of this file.
1 <?php
2 
26 {
30  protected $xmlWriter;
31 
35  protected $assignmentList;
36 
40  protected $thresholdList;
41 
45  public function __construct()
46  {
47  $this->xmlWriter = null;
48  }
49 
53  public function getXmlWriter(): ?ilXmlWriter
54  {
55  return $this->xmlWriter;
56  }
57 
62  {
63  $this->xmlWriter = $xmlWriter;
64  }
65 
70  {
71  return $this->assignmentList;
72  }
73 
78  {
79  $this->assignmentList = $assignmentList;
80  }
81 
86  {
87  return $this->thresholdList;
88  }
89 
94  {
95  $this->thresholdList = $thresholdList;
96  }
97 
98  public function export()
99  {
100  $this->getXmlWriter()->xmlStartTag('SkillsLevelThresholds');
101 
102  foreach ($this->getAssignmentList()->getUniqueAssignedSkills() as $assignedSkillData) {
103  $this->getXmlWriter()->xmlStartTag('QuestionsAssignedSkill', array(
104  'BaseId' => $assignedSkillData['skill_base_id'],
105  'TrefId' => $assignedSkillData['skill_tref_id']
106  ));
107 
108  $this->getXmlWriter()->xmlElement('OriginalSkillTitle', null, $assignedSkillData['skill_title']);
109  $this->getXmlWriter()->xmlElement('OriginalSkillPath', null, $assignedSkillData['skill_path']);
110 
111  /* @var ilBasicSkill $assignedSkill */
112  $assignedSkill = $assignedSkillData['skill'];
113  $skillLevels = $assignedSkill->getLevelData();
114 
115  for ($i = 0, $max = count($skillLevels); $i < $max; $i++) {
116  $levelData = $skillLevels[$i];
117 
118  $skillLevelThreshold = $this->getThresholdList()->getThreshold(
119  $assignedSkillData['skill_base_id'],
120  $assignedSkillData['skill_tref_id'],
121  $levelData['id'],
122  true
123  );
124 
125  $this->getXmlWriter()->xmlStartTag('SkillLevel', array(
126  'Id' => $levelData['id'], 'Nr' => $levelData['nr']
127  ));
128 
129  $this->getXmlWriter()->xmlElement('ThresholdPercentage', null, $skillLevelThreshold->getThreshold());
130 
131  $this->getXmlWriter()->xmlElement('OriginalLevelTitle', null, $levelData['title']);
132  $this->getXmlWriter()->xmlElement('OriginalLevelDescription', null, $levelData['description']);
133 
134  $this->getXmlWriter()->xmlEndTag('SkillLevel');
135  }
136 
137  $this->getXmlWriter()->xmlEndTag('QuestionsAssignedSkill');
138  }
139 
140  $this->getXmlWriter()->xmlEndTag('SkillsLevelThresholds');
141  }
142 }
__construct()
ilAssQuestionSkillAssignmentExporter constructor.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$i
Definition: metadata.php:41