ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilAssQuestionSkillAssignmentXmlParser Class Reference
+ Inheritance diagram for ilAssQuestionSkillAssignmentXmlParser:
+ Collaboration diagram for ilAssQuestionSkillAssignmentXmlParser:

Public Member Functions

 __construct ($xmlFile)
 
 isParsingActive ()
 
 setParsingActive ($parsingActive)
 
 getCurQuestionId ()
 
 setCurQuestionId ($curQuestionId)
 
 getCurAssignment ()
 
 setCurAssignment ($curAssignment)
 
 getAssignmentList ()
 
 getCurExpression ()
 
 setCurExpression ($curExpression)
 
 setHandlers ($xmlParser)
 
 handlerBeginTag ($xmlParser, $tagName, $tagAttributes)
 
 handlerEndTag ($xmlParser, $tagName)
 
 handlerCharacterData ($xmlParser, $charData)
 
- Public Member Functions inherited from ilSaxParser
 __construct ($a_xml_file='', $throwException=false)
 Constructor setup ILIAS global object public. More...
 
 setXMLContent ($a_xml_content)
 
 getXMLContent ()
 
 getInputType ()
 
 startParsing ()
 stores xml data in array More...
 
 createParser ()
 create parser More...
 
 setOptions ($a_xml_parser)
 set parser options More...
 
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class private More...
 
 openXMLFile ()
 open xml file More...
 
 parse ($a_xml_parser, $a_fp=null)
 parse xml file More...
 
 freeParser ($a_xml_parser)
 free xml parser handle More...
 
 setThrowException ($throwException)
 set error handling More...
 
- Public Member Functions inherited from PEAR
 __construct ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes. More...
 
 isError ($data, $code=null)
 Tell whether a value is a PEAR error. More...
 
 expectError ($code=' *')
 This method is used to tell which errors you expect to get. More...
 
 popExpect ()
 This method pops one element off the expected error codes stack. More...
 
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available. More...
 
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack. More...
 
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. More...
 
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options. More...
 
 staticPushErrorHandling ($mode, $options=null)
 
 staticPopErrorHandling ()
 
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack. More...
 
 popErrorHandling ()
 Pop the last error handler used. More...
 
 loadExtension ($ext)
 OS independant PHP extension load. More...
 

Protected Member Functions

 getCharacterDataBuffer ()
 
 resetCharacterDataBuffer ()
 
 appendToCharacterDataBuffer ($characterData)
 
- Protected Member Functions inherited from ilSaxParser
 handleError ($message, $code)
 use given error handler to handle error message or internal ilias error message handle More...
 

Protected Attributes

 $parsingActive
 
 $characterDataBuffer
 
 $curQuestionId
 
 $curAssignment
 
 $curExpression
 
 $assignmentList
 

Additional Inherited Members

- Static Public Member Functions inherited from PEAR
static & getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. More...
 
static setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 
- Data Fields inherited from ilSaxParser
 $input_type = null
 
 $xml_content = ''
 
 $ilias
 
 $lng
 
 $xml_file
 
 $throwException = false
 
- Data Fields inherited from PEAR
 $_debug = false
 
 $_default_error_mode = null
 
 $_default_error_options = null
 
 $_default_error_handler = ''
 
 $_error_class = 'PEAR_Error'
 
 $_expected_errors = array()
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionSkillAssignmentXmlParser::__construct (   $xmlFile)
Parameters
$xmlFile

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

50  {
51  $this->parsingActive = false;
52  $this->characterDataBuffer = null;
53  $this->curQuestionId = null;
54  $this->curAssignment = null;
55  $this->curExpression = null;
56  $this->assignmentList = new ilAssQuestionSkillAssignmentImportList();
57  return parent::__construct($xmlFile);
58  }

Member Function Documentation

◆ appendToCharacterDataBuffer()

ilAssQuestionSkillAssignmentXmlParser::appendToCharacterDataBuffer (   $characterData)
protected
Parameters
string$characterData

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

Referenced by handlerCharacterData().

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

◆ getAssignmentList()

ilAssQuestionSkillAssignmentXmlParser::getAssignmentList ( )
Returns
ilAssQuestionSkillAssignmentImportList

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

References $assignmentList.

Referenced by handlerEndTag().

+ Here is the caller graph for this function:

◆ getCharacterDataBuffer()

ilAssQuestionSkillAssignmentXmlParser::getCharacterDataBuffer ( )
protected
Returns
string

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

References $characterDataBuffer.

Referenced by handlerEndTag().

+ Here is the caller graph for this function:

◆ getCurAssignment()

ilAssQuestionSkillAssignmentXmlParser::getCurAssignment ( )
Returns
ilAssQuestionSkillAssignmentImport

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

References $curAssignment.

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

◆ getCurExpression()

ilAssQuestionSkillAssignmentXmlParser::getCurExpression ( )
Returns
ilAssQuestionSolutionComparisonExpressionImport

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

References $curExpression.

Referenced by handlerEndTag().

+ Here is the caller graph for this function:

◆ getCurQuestionId()

ilAssQuestionSkillAssignmentXmlParser::getCurQuestionId ( )
Returns
int

Definition at line 103 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 163 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().

164  {
165  if ($tagName != 'QuestionSkillAssignments' && !$this->isParsingActive()) {
166  return;
167  }
168 
169  switch ($tagName) {
170  case 'QuestionSkillAssignments':
171  $this->setParsingActive(true);
172  break;
173 
174  case 'TriggerQuestion':
175  $this->setCurQuestionId((int) $tagAttributes['Id']);
176  break;
177 
178  case 'TriggeredSkill':
179  $assignment = new ilAssQuestionSkillAssignmentImport();
180  $assignment->setImportQuestionId($this->getCurQuestionId());
181  $assignment->setImportSkillBaseId((int) $tagAttributes['BaseId']);
182  $assignment->setImportSkillTrefId((int) $tagAttributes['TrefId']);
183  $assignment->initImportSolutionComparisonExpressionList();
184  $this->setCurAssignment($assignment);
185  break;
186 
187  case 'OriginalSkillTitle':
188  $this->resetCharacterDataBuffer();
189  break;
190 
191  case 'OriginalSkillPath':
192  $this->resetCharacterDataBuffer();
193  break;
194 
195  case 'EvalByQuestionResult':
197  $this->getCurAssignment()->setSkillPoints((int) $tagAttributes['Points']);
198  break;
199 
200  case 'EvalByQuestionSolution':
202  break;
203 
204  case 'SolutionComparisonExpression':
206  $expression->setPoints((int) $tagAttributes['Points']);
207  $expression->setOrderIndex((int) $tagAttributes['Index']);
208  $this->setCurExpression($expression);
209  $this->resetCharacterDataBuffer();
210  break;
211  }
212  }
+ Here is the call graph for this function:

◆ handlerCharacterData()

ilAssQuestionSkillAssignmentXmlParser::handlerCharacterData (   $xmlParser,
  $charData 
)

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

References appendToCharacterDataBuffer(), and isParsingActive().

260  {
261  if (!$this->isParsingActive()) {
262  return;
263  }
264 
265  if ($charData != "\n") {
266  // Replace multiple tabs with one space
267  $charData = preg_replace("/\t+/", " ", $charData);
268 
269  $this->appendToCharacterDataBuffer($charData);
270  }
271  }
+ Here is the call graph for this function:

◆ handlerEndTag()

ilAssQuestionSkillAssignmentXmlParser::handlerEndTag (   $xmlParser,
  $tagName 
)

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

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

215  {
216  if (!$this->isParsingActive()) {
217  return;
218  }
219 
220  switch ($tagName) {
221  case 'QuestionSkillAssignments':
222  $this->setParsingActive(false);
223  break;
224 
225  case 'TriggerQuestion':
226  $this->setCurQuestionId(null);
227  break;
228 
229  case 'TriggeredSkill':
230  $this->getAssignmentList()->addAssignment($this->getCurAssignment());
231  $this->setCurAssignment(null);
232  break;
233 
234  case 'OriginalSkillTitle':
235  $this->getCurAssignment()->setImportSkillTitle($this->getCharacterDataBuffer());
236  $this->resetCharacterDataBuffer();
237  break;
238 
239  case 'OriginalSkillPath':
240  $this->getCurAssignment()->setImportSkillPath($this->getCharacterDataBuffer());
241  $this->resetCharacterDataBuffer();
242  break;
243 
244  case 'EvalByQuestionResult':
245  break;
246 
247  case 'EvalByQuestionSolution':
248  break;
249 
250  case 'SolutionComparisonExpression':
251  $this->getCurExpression()->setExpression($this->getCharacterDataBuffer());
252  $this->getCurAssignment()->getImportSolutionComparisonExpressionList()->addExpression($this->getCurExpression());
253  $this->setCurExpression(null);
254  $this->resetCharacterDataBuffer();
255  break;
256  }
257  }
+ Here is the call graph for this function:

◆ isParsingActive()

ilAssQuestionSkillAssignmentXmlParser::isParsingActive ( )
Returns
boolean

Definition at line 63 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 87 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

Referenced by handlerBeginTag(), and handlerEndTag().

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

◆ setCurAssignment()

ilAssQuestionSkillAssignmentXmlParser::setCurAssignment (   $curAssignment)
Parameters
ilAssQuestionSkillAssignmentImport$curAssignment

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

References $curAssignment.

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

◆ setCurExpression()

ilAssQuestionSkillAssignmentXmlParser::setCurExpression (   $curExpression)
Parameters
ilAssQuestionSolutionComparisonExpressionImport$curExpression

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

References $curExpression.

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

◆ setCurQuestionId()

ilAssQuestionSkillAssignmentXmlParser::setCurQuestionId (   $curQuestionId)
Parameters
int$curQuestionId

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

References $curQuestionId.

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

◆ setHandlers()

ilAssQuestionSkillAssignmentXmlParser::setHandlers (   $xmlParser)

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

157  {
158  xml_set_object($xmlParser, $this);
159  xml_set_element_handler($xmlParser, 'handlerBeginTag', 'handlerEndTag');
160  xml_set_character_data_handler($xmlParser, 'handlerCharacterData');
161  }

◆ setParsingActive()

ilAssQuestionSkillAssignmentXmlParser::setParsingActive (   $parsingActive)
Parameters
boolean$parsingActive

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

References $parsingActive.

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

Field Documentation

◆ $assignmentList

ilAssQuestionSkillAssignmentXmlParser::$assignmentList
protected

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

Referenced by getAssignmentList().

◆ $characterDataBuffer

ilAssQuestionSkillAssignmentXmlParser::$characterDataBuffer
protected

◆ $curAssignment

ilAssQuestionSkillAssignmentXmlParser::$curAssignment
protected

◆ $curExpression

ilAssQuestionSkillAssignmentXmlParser::$curExpression
protected

◆ $curQuestionId

ilAssQuestionSkillAssignmentXmlParser::$curQuestionId
protected

◆ $parsingActive

ilAssQuestionSkillAssignmentXmlParser::$parsingActive
protected

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