ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAssQuestionSkillAssignmentXmlParser Class Reference
+ Inheritance diagram for ilAssQuestionSkillAssignmentXmlParser:
+ Collaboration diagram for ilAssQuestionSkillAssignmentXmlParser:

Public Member Functions

 __construct (?string $xmlFile)
 
 isParsingActive ()
 
 setParsingActive (bool $parsingActive)
 
 getCurQuestionId ()
 
 setCurQuestionId (?int $curQuestionId)
 
 getCurAssignment ()
 
 setCurAssignment (?ilAssQuestionSkillAssignmentImport $curAssignment)
 
 getAssignmentList ()
 
 getCurExpression ()
 
 setCurExpression (?ilAssQuestionSolutionComparisonExpressionImport $curExpression)
 
 setHandlers ($a_xml_parser)
 
 handlerBeginTag ($xmlParser, $tagName, $tagAttributes)
 
 handlerEndTag ($xmlParser, $tagName)
 
 handlerCharacterData ($xmlParser, $charData)
 
- Public Member Functions inherited from ilSaxParser
 __construct (?string $path_to_file='', ?bool $throw_exception=false)
 
 setXMLContent (string $a_xml_content)
 
 getXMLContent ()
 
 getInputType ()
 
 startParsing ()
 stores xml data in array More...
 
 createParser ()
 
 setHandlers ($a_xml_parser)
 
 parse ($a_xml_parser, $a_fp=null)
 

Protected Member Functions

 getCharacterDataBuffer ()
 
 resetCharacterDataBuffer ()
 
 appendToCharacterDataBuffer (string $characterData)
 
- Protected Member Functions inherited from ilSaxParser
 openXMLFile ()
 
 handleError (string $message)
 
 setThrowException (bool $throw_exception)
 

Protected Attributes

 $parsingActive
 
 $characterDataBuffer
 
 $curQuestionId
 
 $curAssignment
 
 $curExpression
 
 $assignmentList
 
- Protected Attributes inherited from ilSaxParser
ilLanguage $lng = null
 

Additional Inherited Members

- Data Fields inherited from ilSaxParser
string $xml_file
 
bool $throw_exception = false
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionSkillAssignmentXmlParser::__construct ( ?string  $xmlFile)
Parameters
$xmlFile

Definition at line 60 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

References ILIAS\GlobalScreen\Provider\__construct(), and null.

61  {
62  $this->parsingActive = false;
63  $this->characterDataBuffer = null;
64  $this->curQuestionId = null;
65  $this->curAssignment = null;
66  $this->curExpression = null;
67  $this->assignmentList = new ilAssQuestionSkillAssignmentImportList();
68  parent::__construct($xmlFile);
69  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(Container $dic, ilPlugin $plugin)
+ Here is the call graph for this function:

Member Function Documentation

◆ appendToCharacterDataBuffer()

ilAssQuestionSkillAssignmentXmlParser::appendToCharacterDataBuffer ( string  $characterData)
protected

Definition at line 94 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

Referenced by handlerCharacterData().

94  : void
95  {
96  $this->characterDataBuffer .= $characterData;
97  }
+ Here is the caller graph for this function:

◆ getAssignmentList()

ilAssQuestionSkillAssignmentXmlParser::getAssignmentList ( )

◆ getCharacterDataBuffer()

ilAssQuestionSkillAssignmentXmlParser::getCharacterDataBuffer ( )
protected

Definition at line 81 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

References $characterDataBuffer.

Referenced by handlerEndTag().

+ Here is the caller graph for this function:

◆ getCurAssignment()

ilAssQuestionSkillAssignmentXmlParser::getCurAssignment ( )

◆ getCurExpression()

ilAssQuestionSkillAssignmentXmlParser::getCurExpression ( )

◆ getCurQuestionId()

ilAssQuestionSkillAssignmentXmlParser::getCurQuestionId ( )

Definition at line 99 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

References $curQuestionId.

Referenced by handlerBeginTag().

+ Here is the caller graph for this function:

◆ handlerBeginTag()

ilAssQuestionSkillAssignmentXmlParser::handlerBeginTag (   $xmlParser,
  $tagName,
  $tagAttributes 
)

Definition at line 140 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

References ilAssQuestionSkillAssignment\EVAL_MODE_BY_QUESTION_RESULT, ilAssQuestionSkillAssignment\EVAL_MODE_BY_QUESTION_SOLUTION, getCurAssignment(), getCurQuestionId(), isParsingActive(), resetCharacterDataBuffer(), setCurAssignment(), setCurExpression(), setCurQuestionId(), and setParsingActive().

Referenced by setHandlers().

140  : void
141  {
142  if ($tagName != 'QuestionSkillAssignments' && !$this->isParsingActive()) {
143  return;
144  }
145 
146  switch ($tagName) {
147  case 'QuestionSkillAssignments':
148  $this->setParsingActive(true);
149  break;
150 
151  case 'TriggerQuestion':
152  $this->setCurQuestionId((int) $tagAttributes['Id']);
153  break;
154 
155  case 'TriggeredSkill':
156  $assignment = new ilAssQuestionSkillAssignmentImport();
157  $assignment->setImportQuestionId($this->getCurQuestionId());
158  $assignment->setImportSkillBaseId((int) $tagAttributes['BaseId']);
159  $assignment->setImportSkillTrefId((int) $tagAttributes['TrefId']);
160  $assignment->initImportSolutionComparisonExpressionList();
161  $this->setCurAssignment($assignment);
162  break;
163 
164  case 'OriginalSkillPath':
165  case 'OriginalSkillTitle':
166  $this->resetCharacterDataBuffer();
167  break;
168 
169  case 'EvalByQuestionResult':
171  $this->getCurAssignment()->setSkillPoints((int) $tagAttributes['Points']);
172  break;
173 
174  case 'EvalByQuestionSolution':
176  break;
177 
178  case 'SolutionComparisonExpression':
180  $expression->setPoints((int) $tagAttributes['Points']);
181  $expression->setOrderIndex((int) $tagAttributes['Index']);
182  $this->setCurExpression($expression);
183  $this->resetCharacterDataBuffer();
184  break;
185  }
186  }
setCurAssignment(?ilAssQuestionSkillAssignmentImport $curAssignment)
setCurExpression(?ilAssQuestionSolutionComparisonExpressionImport $curExpression)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handlerCharacterData()

ilAssQuestionSkillAssignmentXmlParser::handlerCharacterData (   $xmlParser,
  $charData 
)

Definition at line 231 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

References appendToCharacterDataBuffer(), and isParsingActive().

Referenced by setHandlers().

231  : void
232  {
233  if (!$this->isParsingActive()) {
234  return;
235  }
236 
237  if ($charData != "\n") {
238  // Replace multiple tabs with one space
239  $charData = preg_replace("/\t+/", " ", $charData);
240 
241  $this->appendToCharacterDataBuffer($charData);
242  }
243  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handlerEndTag()

ilAssQuestionSkillAssignmentXmlParser::handlerEndTag (   $xmlParser,
  $tagName 
)

Definition at line 188 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

References getAssignmentList(), getCharacterDataBuffer(), getCurAssignment(), getCurExpression(), isParsingActive(), null, resetCharacterDataBuffer(), setCurAssignment(), setCurExpression(), setCurQuestionId(), and setParsingActive().

Referenced by setHandlers().

188  : void
189  {
190  if (!$this->isParsingActive()) {
191  return;
192  }
193 
194  switch ($tagName) {
195  case 'QuestionSkillAssignments':
196  $this->setParsingActive(false);
197  break;
198 
199  case 'TriggerQuestion':
200  $this->setCurQuestionId(null);
201  break;
202 
203  case 'TriggeredSkill':
204  $this->getAssignmentList()->addAssignment($this->getCurAssignment());
205  $this->setCurAssignment(null);
206  break;
207 
208  case 'OriginalSkillTitle':
209  $this->getCurAssignment()->setImportSkillTitle($this->getCharacterDataBuffer());
210  $this->resetCharacterDataBuffer();
211  break;
212 
213  case 'OriginalSkillPath':
214  $this->getCurAssignment()->setImportSkillPath($this->getCharacterDataBuffer());
215  $this->resetCharacterDataBuffer();
216  break;
217 
218  case 'EvalByQuestionSolution':
219  case 'EvalByQuestionResult':
220  break;
221 
222  case 'SolutionComparisonExpression':
223  $this->getCurExpression()->setExpression($this->getCharacterDataBuffer());
224  $this->getCurAssignment()->getImportSolutionComparisonExpressionList()->addExpression($this->getCurExpression());
225  $this->setCurExpression(null);
226  $this->resetCharacterDataBuffer();
227  break;
228  }
229  }
setCurAssignment(?ilAssQuestionSkillAssignmentImport $curAssignment)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
setCurExpression(?ilAssQuestionSolutionComparisonExpressionImport $curExpression)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isParsingActive()

ilAssQuestionSkillAssignmentXmlParser::isParsingActive ( )

Definition at line 71 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

References $parsingActive.

Referenced by handlerBeginTag(), handlerCharacterData(), and handlerEndTag().

+ Here is the caller graph for this function:

◆ resetCharacterDataBuffer()

ilAssQuestionSkillAssignmentXmlParser::resetCharacterDataBuffer ( )
protected
Parameters
string$characterDataBuffer

Definition at line 89 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

Referenced by handlerBeginTag(), and handlerEndTag().

89  : void
90  {
91  $this->characterDataBuffer = '';
92  }
+ Here is the caller graph for this function:

◆ setCurAssignment()

ilAssQuestionSkillAssignmentXmlParser::setCurAssignment ( ?ilAssQuestionSkillAssignmentImport  $curAssignment)

Definition at line 114 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

References $curAssignment.

Referenced by handlerBeginTag(), and handlerEndTag().

114  : void
115  {
116  $this->curAssignment = $curAssignment;
117  }
+ Here is the caller graph for this function:

◆ setCurExpression()

ilAssQuestionSkillAssignmentXmlParser::setCurExpression ( ?ilAssQuestionSolutionComparisonExpressionImport  $curExpression)

Definition at line 129 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

References $curExpression.

Referenced by handlerBeginTag(), and handlerEndTag().

129  : void
130  {
131  $this->curExpression = $curExpression;
132  }
+ Here is the caller graph for this function:

◆ setCurQuestionId()

ilAssQuestionSkillAssignmentXmlParser::setCurQuestionId ( ?int  $curQuestionId)

Definition at line 104 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

References ILIAS\Repository\int().

Referenced by handlerBeginTag(), and handlerEndTag().

104  : void
105  {
106  $this->curQuestionId = (int) $curQuestionId;
107  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setHandlers()

ilAssQuestionSkillAssignmentXmlParser::setHandlers (   $a_xml_parser)

Definition at line 134 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

References handlerBeginTag(), handlerCharacterData(), and handlerEndTag().

134  : void
135  {
136  xml_set_element_handler($a_xml_parser, $this->handlerBeginTag(...), $this->handlerEndTag(...));
137  xml_set_character_data_handler($a_xml_parser, $this->handlerCharacterData(...));
138  }
+ Here is the call graph for this function:

◆ setParsingActive()

ilAssQuestionSkillAssignmentXmlParser::setParsingActive ( bool  $parsingActive)

Definition at line 76 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

References $parsingActive.

Referenced by handlerBeginTag(), and handlerEndTag().

76  : void
77  {
78  $this->parsingActive = $parsingActive;
79  }
+ Here is the caller graph for this function:

Field Documentation

◆ $assignmentList

ilAssQuestionSkillAssignmentXmlParser::$assignmentList
protected

Definition at line 55 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

Referenced by getAssignmentList().

◆ $characterDataBuffer

ilAssQuestionSkillAssignmentXmlParser::$characterDataBuffer
protected

◆ $curAssignment

ilAssQuestionSkillAssignmentXmlParser::$curAssignment
protected

◆ $curExpression

ilAssQuestionSkillAssignmentXmlParser::$curExpression
protected

◆ $curQuestionId

ilAssQuestionSkillAssignmentXmlParser::$curQuestionId
protected

Definition at line 40 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

Referenced by getCurQuestionId().

◆ $parsingActive

ilAssQuestionSkillAssignmentXmlParser::$parsingActive
protected

The documentation for this class was generated from the following file: