ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilAssQuestionSkillAssignmentExporter.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 $questionIds;
21 
25  protected $assignmentList;
26 
30  public function __construct()
31  {
32  $this->xmlWriter = null;
33  $this->questionIds = array();
34  $this->assignmentList = null;
35  }
36 
40  public function getXmlWriter()
41  {
42  return $this->xmlWriter;
43  }
44 
49  {
50  $this->xmlWriter = $xmlWriter;
51  }
52 
56  public function getQuestionIds()
57  {
58  return $this->questionIds;
59  }
60 
64  public function setQuestionIds($questionIds)
65  {
66  $this->questionIds = $questionIds;
67  }
68 
72  public function getAssignmentList()
73  {
74  return $this->assignmentList;
75  }
76 
81  {
82  $this->assignmentList = $assignmentList;
83  }
84 
85  public function export()
86  {
87  global $ilDB;
88 
89  $this->getXmlWriter()->xmlStartTag('QuestionSkillAssignments');
90 
91  foreach ($this->getQuestionIds() as $questionId) {
92  $this->getXmlWriter()->xmlStartTag('TriggerQuestion', array('Id' => $questionId));
93 
94  foreach ($this->getAssignmentList()->getAssignmentsByQuestionId($questionId) as $questionSkillAssignment) {
95  /* @var ilAssQuestionSkillAssignment $questionSkillAssignment */
96 
97  $this->getXmlWriter()->xmlStartTag('TriggeredSkill', array(
98  'BaseId' => $questionSkillAssignment->getSkillBaseId(),
99  'TrefId' => $questionSkillAssignment->getSkillTrefId()
100  ));
101 
102  $this->getXmlWriter()->xmlElement(
103  'OriginalSkillTitle',
104  null,
105  $questionSkillAssignment->getSkillTitle()
106  );
107 
108  $this->getXmlWriter()->xmlElement(
109  'OriginalSkillPath',
110  null,
111  $questionSkillAssignment->getSkillPath()
112  );
113 
114  switch ($questionSkillAssignment->getEvalMode()) {
116 
117  $this->getXmlWriter()->xmlElement('EvalByQuestionResult', array(
118  'Points' => $questionSkillAssignment->getSkillPoints()
119  ));
120  break;
121 
123 
124  $this->getXmlWriter()->xmlStartTag('EvalByQuestionSolution');
125 
126  $questionSkillAssignment->initSolutionComparisonExpressionList();
127  $expressionList = $questionSkillAssignment->getSolutionComparisonExpressionList();
128 
129  foreach ($expressionList->get() as $expression) {
130  /* @var ilAssQuestionSolutionComparisonExpression $expression */
131 
132  $this->getXmlWriter()->xmlStartTag('SolutionComparisonExpression', array(
133  'Points' => $expression->getPoints(),
134  'Index' => $expression->getOrderIndex()
135  ));
136 
137  $this->getXmlWriter()->xmlData($expression->getExpression(), false, true);
138 
139  $this->getXmlWriter()->xmlEndTag('SolutionComparisonExpression');
140  }
141 
142  $this->getXmlWriter()->xmlEndTag('EvalByQuestionSolution');
143  break;
144  }
145 
146  $this->getXmlWriter()->xmlEndTag('TriggeredSkill');
147  }
148 
149  $this->getXmlWriter()->xmlEndTag('TriggerQuestion');
150  }
151 
152  $this->getXmlWriter()->xmlEndTag('QuestionSkillAssignments');
153  }
154 }
__construct()
ilAssQuestionSkillAssignmentExporter constructor.
XML writer class.
Create styles array
The data for the language used.
global $ilDB