ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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.

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 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ 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.

94 : void
95 {
96 $this->characterDataBuffer .= $characterData;
97 }

Referenced by handlerCharacterData().

+ Here is the caller graph for this function:

◆ getAssignmentList()

ilAssQuestionSkillAssignmentXmlParser::getAssignmentList ( )

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

References $assignmentList.

Referenced by handlerEndTag().

+ Here is the caller graph for this function:

◆ 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()

◆ 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.

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':
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);
184 break;
185 }
186 }
setCurAssignment(?ilAssQuestionSkillAssignmentImport $curAssignment)
setCurExpression(?ilAssQuestionSolutionComparisonExpressionImport $curExpression)

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().

+ 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.

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 }

References appendToCharacterDataBuffer(), and isParsingActive().

Referenced by setHandlers().

+ 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.

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());
211 break;
212
213 case 'OriginalSkillPath':
214 $this->getCurAssignment()->setImportSkillPath($this->getCharacterDataBuffer());
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);
227 break;
228 }
229 }

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

Referenced by setHandlers().

+ 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.

89 : void
90 {
91 $this->characterDataBuffer = '';
92 }

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

◆ setCurAssignment()

ilAssQuestionSkillAssignmentXmlParser::setCurAssignment ( ?ilAssQuestionSkillAssignmentImport  $curAssignment)

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

114 : void
115 {
116 $this->curAssignment = $curAssignment;
117 }

References $curAssignment.

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

◆ setCurExpression()

ilAssQuestionSkillAssignmentXmlParser::setCurExpression ( ?ilAssQuestionSolutionComparisonExpressionImport  $curExpression)

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

129 : void
130 {
131 $this->curExpression = $curExpression;
132 }

References $curExpression.

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

◆ setCurQuestionId()

ilAssQuestionSkillAssignmentXmlParser::setCurQuestionId ( ?int  $curQuestionId)

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

104 : void
105 {
106 $this->curQuestionId = (int) $curQuestionId;
107 }

References $curQuestionId, and ILIAS\Repository\int().

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setHandlers()

ilAssQuestionSkillAssignmentXmlParser::setHandlers (   $a_xml_parser)
Parameters
XMLParser | resource$a_xml_parser
Returns
void

Reimplemented from ilSaxParser.

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

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 }

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

+ Here is the call graph for this function:

◆ setParsingActive()

ilAssQuestionSkillAssignmentXmlParser::setParsingActive ( bool  $parsingActive)

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

76 : void
77 {
78 $this->parsingActive = $parsingActive;
79 }

References $parsingActive.

Referenced by handlerBeginTag(), and handlerEndTag().

+ 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

◆ $parsingActive

ilAssQuestionSkillAssignmentXmlParser::$parsingActive
protected

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