ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
167  return;
168  }
169 
170  switch($tagName)
171  {
172  case 'QuestionSkillAssignments':
173  $this->setParsingActive(true);
174  break;
175 
176  case 'TriggerQuestion':
177  $this->setCurQuestionId((int)$tagAttributes['Id']);
178  break;
179 
180  case 'TriggeredSkill':
181  $assignment = new ilAssQuestionSkillAssignmentImport();
182  $assignment->setImportQuestionId($this->getCurQuestionId());
183  $assignment->setImportSkillBaseId((int)$tagAttributes['BaseId']);
184  $assignment->setImportSkillTrefId((int)$tagAttributes['TrefId']);
185  $assignment->initImportSolutionComparisonExpressionList();
186  $this->setCurAssignment($assignment);
187  break;
188 
189  case 'OriginalSkillTitle':
190  $this->resetCharacterDataBuffer();
191  break;
192 
193  case 'OriginalSkillPath':
194  $this->resetCharacterDataBuffer();
195  break;
196 
197  case 'EvalByQuestionResult':
199  $this->getCurAssignment()->setSkillPoints((int)$tagAttributes['Points']);
200  break;
201 
202  case 'EvalByQuestionSolution':
204  break;
205 
206  case 'SolutionComparisonExpression':
208  $expression->setPoints((int)$tagAttributes['Points']);
209  $expression->setOrderIndex((int)$tagAttributes['Index']);
210  $this->setCurExpression($expression);
211  $this->resetCharacterDataBuffer();
212  break;
213  }
214  }
+ Here is the call graph for this function:

◆ handlerCharacterData()

ilAssQuestionSkillAssignmentXmlParser::handlerCharacterData (   $xmlParser,
  $charData 
)

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

References appendToCharacterDataBuffer(), and isParsingActive().

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

◆ handlerEndTag()

ilAssQuestionSkillAssignmentXmlParser::handlerEndTag (   $xmlParser,
  $tagName 
)

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

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

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