ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
93  $this->getXmlWriter()->xmlStartTag('TriggerQuestion', array('Id' => $questionId));
94 
95  foreach($this->getAssignmentList()->getAssignmentsByQuestionId($questionId) as $questionSkillAssignment)
96  {
97  /* @var ilAssQuestionSkillAssignment $questionSkillAssignment */
98 
99  $this->getXmlWriter()->xmlStartTag('TriggeredSkill', array(
100  'BaseId' => $questionSkillAssignment->getSkillBaseId(),
101  'TrefId' => $questionSkillAssignment->getSkillTrefId()
102  ));
103 
104  $this->getXmlWriter()->xmlElement(
105  'OriginalSkillTitle', null, $questionSkillAssignment->getSkillTitle()
106  );
107 
108  $this->getXmlWriter()->xmlElement(
109  'OriginalSkillPath', null, $questionSkillAssignment->getSkillPath()
110  );
111 
112  switch( $questionSkillAssignment->getEvalMode() )
113  {
115 
116  $this->getXmlWriter()->xmlElement('EvalByQuestionResult', array(
117  'Points' => $questionSkillAssignment->getSkillPoints()
118  ));
119  break;
120 
122 
123  $this->getXmlWriter()->xmlStartTag('EvalByQuestionSolution');
124 
125  $questionSkillAssignment->initSolutionComparisonExpressionList();
126  $expressionList = $questionSkillAssignment->getSolutionComparisonExpressionList();
127 
128  foreach($expressionList->get() as $expression)
129  {
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