ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 $DIC;
88  $ilDB = $DIC['ilDB'];
89 
90  $this->getXmlWriter()->xmlStartTag('QuestionSkillAssignments');
91 
92  foreach ($this->getQuestionIds() as $questionId) {
93  $this->getXmlWriter()->xmlStartTag('TriggerQuestion', array('Id' => $questionId));
94 
95  foreach ($this->getAssignmentList()->getAssignmentsByQuestionId($questionId) as $questionSkillAssignment) {
96  /* @var ilAssQuestionSkillAssignment $questionSkillAssignment */
97 
98  $this->getXmlWriter()->xmlStartTag('TriggeredSkill', array(
99  'BaseId' => $questionSkillAssignment->getSkillBaseId(),
100  'TrefId' => $questionSkillAssignment->getSkillTrefId()
101  ));
102 
103  $this->getXmlWriter()->xmlElement(
104  'OriginalSkillTitle',
105  null,
106  $questionSkillAssignment->getSkillTitle()
107  );
108 
109  $this->getXmlWriter()->xmlElement(
110  'OriginalSkillPath',
111  null,
112  $questionSkillAssignment->getSkillPath()
113  );
114 
115  switch ($questionSkillAssignment->getEvalMode()) {
117 
118  $this->getXmlWriter()->xmlElement('EvalByQuestionResult', array(
119  'Points' => $questionSkillAssignment->getSkillPoints()
120  ));
121  break;
122 
124 
125  $this->getXmlWriter()->xmlStartTag('EvalByQuestionSolution');
126 
127  $questionSkillAssignment->initSolutionComparisonExpressionList();
128  $expressionList = $questionSkillAssignment->getSolutionComparisonExpressionList();
129 
130  foreach ($expressionList->get() as $expression) {
131  /* @var ilAssQuestionSolutionComparisonExpression $expression */
132 
133  $this->getXmlWriter()->xmlStartTag('SolutionComparisonExpression', array(
134  'Points' => $expression->getPoints(),
135  'Index' => $expression->getOrderIndex()
136  ));
137 
138  $this->getXmlWriter()->xmlData($expression->getExpression(), false, true);
139 
140  $this->getXmlWriter()->xmlEndTag('SolutionComparisonExpression');
141  }
142 
143  $this->getXmlWriter()->xmlEndTag('EvalByQuestionSolution');
144  break;
145  }
146 
147  $this->getXmlWriter()->xmlEndTag('TriggeredSkill');
148  }
149 
150  $this->getXmlWriter()->xmlEndTag('TriggerQuestion');
151  }
152 
153  $this->getXmlWriter()->xmlEndTag('QuestionSkillAssignments');
154  }
155 }
__construct()
ilAssQuestionSkillAssignmentExporter constructor.
global $DIC
Definition: saml.php:7
XML writer class.
global $ilDB