ILIAS  trunk Revision v11.0_alpha-1689-g66c127b4ae8
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilAssQuestionSkillAssignmentExporter.php
Go to the documentation of this file.
1 <?php
2 
26 {
30  protected $xmlWriter;
31 
35  protected $questionIds;
36 
40  protected $assignmentList;
41 
45  public function __construct()
46  {
47  $this->xmlWriter = null;
48  $this->questionIds = [];
49  $this->assignmentList = null;
50  }
51 
55  public function getXmlWriter(): ?ilXmlWriter
56  {
57  return $this->xmlWriter;
58  }
59 
63  public function setXmlWriter(ilXmlWriter $xmlWriter): void
64  {
65  $this->xmlWriter = $xmlWriter;
66  }
67 
71  public function getQuestionIds(): array
72  {
73  return $this->questionIds;
74  }
75 
79  public function setQuestionIds($questionIds): void
80  {
81  $this->questionIds = $questionIds;
82  }
83 
88  {
89  return $this->assignmentList;
90  }
91 
95  public function setAssignmentList($assignmentList): void
96  {
97  $this->assignmentList = $assignmentList;
98  }
99 
100  public function export(): void
101  {
102  global $DIC;
103  $ilDB = $DIC['ilDB'];
104 
105  $this->getXmlWriter()->xmlStartTag('QuestionSkillAssignments');
106 
107  foreach ($this->getQuestionIds() as $questionId) {
108  $this->getXmlWriter()->xmlStartTag('TriggerQuestion', ['Id' => $questionId]);
109 
110  foreach ($this->getAssignmentList()->getAssignmentsByQuestionId($questionId) as $questionSkillAssignment) {
111  /* @var ilAssQuestionSkillAssignment $questionSkillAssignment */
112 
113  $this->getXmlWriter()->xmlStartTag('TriggeredSkill', [
114  'BaseId' => $questionSkillAssignment->getSkillBaseId(),
115  'TrefId' => $questionSkillAssignment->getSkillTrefId()
116  ]);
117 
118  $this->getXmlWriter()->xmlElement(
119  'OriginalSkillTitle',
120  null,
121  $questionSkillAssignment->getSkillTitle()
122  );
123 
124  $this->getXmlWriter()->xmlElement(
125  'OriginalSkillPath',
126  null,
127  $questionSkillAssignment->getSkillPath()
128  );
129 
130  switch ($questionSkillAssignment->getEvalMode()) {
132 
133  $this->getXmlWriter()->xmlElement('EvalByQuestionResult', [
134  'Points' => $questionSkillAssignment->getSkillPoints()
135  ]);
136  break;
137 
139 
140  $this->getXmlWriter()->xmlStartTag('EvalByQuestionSolution');
141 
142  $questionSkillAssignment->initSolutionComparisonExpressionList();
143  $expressionList = $questionSkillAssignment->getSolutionComparisonExpressionList();
144 
145  foreach ($expressionList->get() as $expression) {
146  /* @var ilAssQuestionSolutionComparisonExpression $expression */
147 
148  $this->getXmlWriter()->xmlStartTag('SolutionComparisonExpression', [
149  'Points' => $expression->getPoints(),
150  'Index' => $expression->getOrderIndex()
151  ]);
152 
153  $this->getXmlWriter()->xmlData($expression->getExpression(), false, true);
154 
155  $this->getXmlWriter()->xmlEndTag('SolutionComparisonExpression');
156  }
157 
158  $this->getXmlWriter()->xmlEndTag('EvalByQuestionSolution');
159  break;
160  }
161 
162  $this->getXmlWriter()->xmlEndTag('TriggeredSkill');
163  }
164 
165  $this->getXmlWriter()->xmlEndTag('TriggerQuestion');
166  }
167 
168  $this->getXmlWriter()->xmlEndTag('QuestionSkillAssignments');
169  }
170 }
__construct()
ilAssQuestionSkillAssignmentExporter constructor.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22