ILIAS  release_8 Revision v8.24
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 return 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 141 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

141 : void
142 {
143 if ($tagName != 'QuestionSkillAssignments' && !$this->isParsingActive()) {
144 return;
145 }
146
147 switch ($tagName) {
148 case 'QuestionSkillAssignments':
149 $this->setParsingActive(true);
150 break;
151
152 case 'TriggerQuestion':
153 $this->setCurQuestionId((int) $tagAttributes['Id']);
154 break;
155
156 case 'TriggeredSkill':
157 $assignment = new ilAssQuestionSkillAssignmentImport();
158 $assignment->setImportQuestionId($this->getCurQuestionId());
159 $assignment->setImportSkillBaseId((int) $tagAttributes['BaseId']);
160 $assignment->setImportSkillTrefId((int) $tagAttributes['TrefId']);
161 $assignment->initImportSolutionComparisonExpressionList();
162 $this->setCurAssignment($assignment);
163 break;
164
165 case 'OriginalSkillPath':
166 case 'OriginalSkillTitle':
168 break;
169
170 case 'EvalByQuestionResult':
172 $this->getCurAssignment()->setSkillPoints((int) $tagAttributes['Points']);
173 break;
174
175 case 'EvalByQuestionSolution':
177 break;
178
179 case 'SolutionComparisonExpression':
181 $expression->setPoints((int) $tagAttributes['Points']);
182 $expression->setOrderIndex((int) $tagAttributes['Index']);
183 $this->setCurExpression($expression);
185 break;
186 }
187 }
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().

+ Here is the call graph for this function:

◆ handlerCharacterData()

ilAssQuestionSkillAssignmentXmlParser::handlerCharacterData (   $xmlParser,
  $charData 
)

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

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

References appendToCharacterDataBuffer(), and isParsingActive().

+ Here is the call graph for this function:

◆ handlerEndTag()

ilAssQuestionSkillAssignmentXmlParser::handlerEndTag (   $xmlParser,
  $tagName 
)

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

189 : void
190 {
191 if (!$this->isParsingActive()) {
192 return;
193 }
194
195 switch ($tagName) {
196 case 'QuestionSkillAssignments':
197 $this->setParsingActive(false);
198 break;
199
200 case 'TriggerQuestion':
201 $this->setCurQuestionId(null);
202 break;
203
204 case 'TriggeredSkill':
205 $this->getAssignmentList()->addAssignment($this->getCurAssignment());
206 $this->setCurAssignment(null);
207 break;
208
209 case 'OriginalSkillTitle':
210 $this->getCurAssignment()->setImportSkillTitle($this->getCharacterDataBuffer());
212 break;
213
214 case 'OriginalSkillPath':
215 $this->getCurAssignment()->setImportSkillPath($this->getCharacterDataBuffer());
217 break;
218
219 case 'EvalByQuestionSolution':
220 case 'EvalByQuestionResult':
221 break;
222
223 case 'SolutionComparisonExpression':
224 $this->getCurExpression()->setExpression($this->getCharacterDataBuffer());
225 $this->getCurAssignment()->getImportSolutionComparisonExpressionList()->addExpression($this->getCurExpression());
226 $this->setCurExpression(null);
228 break;
229 }
230 }

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

+ Here is the call 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_object($a_xml_parser, $this);
137 xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
138 xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
139 }

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