ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilAssQuestionSkillAssignmentXmlParser Class Reference
+ Inheritance diagram for ilAssQuestionSkillAssignmentXmlParser:
+ Collaboration diagram for ilAssQuestionSkillAssignmentXmlParser:

Public Member Functions

 __construct (?string $xml_file)
 
 isParsingActive ()
 
 setParsingActive (bool $parsing_active)
 
 getCurQuestionid ()
 
 setCurQuestionid (?int $cur_question_id)
 
 getCurAssignment ()
 
 setCurAssignment (?ilAssQuestionSkillAssignmentImport $cur_assignment)
 
 getAssignmentList ()
 
 getCurExpression ()
 
 setCurExpression (?ilAssQuestionSolutionComparisonExpressionImport $cur_expression)
 
 setHandlers ($a_xml_parser)
 
 handlerBeginTag ($xml_parser, $tag_name, $tag_attributes)
 
 handlerEndTag ($xml_parser, $tag_name)
 
 handlerCharacterData ($xml_parser, $char_data)
 
- 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

bool $parsing_active = false
 
string $character_data_buffer = ''
 
int $cur_question_id = null
 
ilAssQuestionSkillAssignmentImport $cur_assignment = null
 
ilAssQuestionSolutionComparisonExpressionImport $cur_expression = null
 
ilAssQuestionSkillAssignmentImportList $assignment_list
 
- 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

Deprecated:
12: Use ILIAS\TestQuestionPool\ExportImport\Import\SkillAssignmentsImporter instead

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

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionSkillAssignmentXmlParser::__construct ( ?string  $xml_file)

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

References ilSaxParser\$xml_file, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ appendToCharacterDataBuffer()

ilAssQuestionSkillAssignmentXmlParser::appendToCharacterDataBuffer ( string  $characterData)
protected

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

64 : void
65 {
66 $this->character_data_buffer .= $characterData;
67 }

Referenced by handlerCharacterData().

+ Here is the caller graph for this function:

◆ getAssignmentList()

ilAssQuestionSkillAssignmentXmlParser::getAssignmentList ( )

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

References $assignment_list.

Referenced by handlerEndTag().

+ Here is the caller graph for this function:

◆ getCharacterDataBuffer()

ilAssQuestionSkillAssignmentXmlParser::getCharacterDataBuffer ( )
protected

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

References $character_data_buffer.

Referenced by handlerEndTag().

+ Here is the caller graph for this function:

◆ getCurAssignment()

ilAssQuestionSkillAssignmentXmlParser::getCurAssignment ( )

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

80 {
82 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $cur_assignment.

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

◆ getCurExpression()

ilAssQuestionSkillAssignmentXmlParser::getCurExpression ( )

◆ getCurQuestionid()

ilAssQuestionSkillAssignmentXmlParser::getCurQuestionid ( )

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

References $cur_question_id.

Referenced by handlerBeginTag().

+ Here is the caller graph for this function:

◆ handlerBeginTag()

ilAssQuestionSkillAssignmentXmlParser::handlerBeginTag (   $xml_parser,
  $tag_name,
  $tag_attributes 
)

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

110 : void
111 {
112 if ($tag_name !== 'SkillAssignments' && !$this->isParsingActive()) {
113 return;
114 }
115
116 switch ($tag_name) {
117 case 'SkillAssignments':
118 $this->setParsingActive(true);
119 break;
120
121 case 'TriggerQuestion':
122 $this->setCurQuestionid((int) $tag_attributes['Id']);
123 break;
124
125 case 'TriggeredSkill':
126 $assignment = new ilAssQuestionSkillAssignmentImport();
127 $assignment->setImportQuestionId($this->getCurQuestionid());
128 $assignment->setImportSkillBaseId((int) $tag_attributes['BaseId']);
129 $assignment->setImportSkillTrefId((int) $tag_attributes['TrefId']);
130 $assignment->initImportSolutionComparisonExpressionList();
131 $this->setCurAssignment($assignment);
132 break;
133
134 case 'OriginalSkillPath':
135 case 'OriginalSkillTitle':
137 break;
138
139 case 'EvalByQuestionResult':
141 $this->getCurAssignment()->setSkillPoints((int) $tag_attributes['Points']);
142 break;
143
144 case 'EvalByQuestionSolution':
146 break;
147
148 case 'SolutionComparisonExpression':
150 $expression->setPoints((int) $tag_attributes['Points']);
151 $expression->setOrderIndex((int) $tag_attributes['Index']);
152 $this->setCurExpression($expression);
154 break;
155 }
156 }
setCurExpression(?ilAssQuestionSolutionComparisonExpressionImport $cur_expression)
setCurAssignment(?ilAssQuestionSkillAssignmentImport $cur_assignment)

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 (   $xml_parser,
  $char_data 
)

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

201 : void
202 {
203 if (!$this->isParsingActive()) {
204 return;
205 }
206
207 if ($char_data !== "\n") {
208 // Replace multiple tabs with one space
209 $this->appendToCharacterDataBuffer(preg_replace("/\t+/", ' ', $char_data));
210 }
211 }

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 (   $xml_parser,
  $tag_name 
)

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

158 : void
159 {
160 if (!$this->isParsingActive()) {
161 return;
162 }
163
164 switch ($tag_name) {
165 case 'SkillAssignments':
166 $this->setParsingActive(false);
167 break;
168
169 case 'TriggerQuestion':
170 $this->setCurQuestionid(null);
171 break;
172
173 case 'TriggeredSkill':
174 $this->getAssignmentList()->addAssignment($this->getCurAssignment());
175 $this->setCurAssignment(null);
176 break;
177
178 case 'OriginalSkillTitle':
179 $this->getCurAssignment()->setImportSkillTitle($this->getCharacterDataBuffer());
181 break;
182
183 case 'OriginalSkillPath':
184 $this->getCurAssignment()->setImportSkillPath($this->getCharacterDataBuffer());
186 break;
187
188 case 'EvalByQuestionSolution':
189 case 'EvalByQuestionResult':
190 break;
191
192 case 'SolutionComparisonExpression':
193 $this->getCurExpression()->setExpression($this->getCharacterDataBuffer());
194 $this->getCurAssignment()->getImportSolutionComparisonExpressionList()->addExpression($this->getCurExpression());
195 $this->setCurExpression(null);
197 break;
198 }
199 }

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 44 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

References $parsing_active.

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

+ Here is the caller graph for this function:

◆ resetCharacterDataBuffer()

ilAssQuestionSkillAssignmentXmlParser::resetCharacterDataBuffer ( )
protected

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

59 : void
60 {
61 $this->character_data_buffer = '';
62 }

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

◆ setCurAssignment()

ilAssQuestionSkillAssignmentXmlParser::setCurAssignment ( ?ilAssQuestionSkillAssignmentImport  $cur_assignment)

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

84 : void
85 {
86 $this->cur_assignment = $cur_assignment;
87 }

References $cur_assignment.

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

◆ setCurExpression()

ilAssQuestionSkillAssignmentXmlParser::setCurExpression ( ?ilAssQuestionSolutionComparisonExpressionImport  $cur_expression)

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

99 : void
100 {
101 $this->cur_expression = $cur_expression;
102 }

References $cur_expression.

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

◆ setCurQuestionid()

ilAssQuestionSkillAssignmentXmlParser::setCurQuestionid ( ?int  $cur_question_id)

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

74 : void
75 {
76 $this->cur_question_id = (int) $cur_question_id;
77 }

References $cur_question_id, 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 104 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

104 : void
105 {
106 xml_set_element_handler($a_xml_parser, $this->handlerBeginTag(...), $this->handlerEndTag(...));
107 xml_set_character_data_handler($a_xml_parser, $this->handlerCharacterData(...));
108 }

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

+ Here is the call graph for this function:

◆ setParsingActive()

ilAssQuestionSkillAssignmentXmlParser::setParsingActive ( bool  $parsing_active)

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

49 : void
50 {
51 $this->parsing_active = $parsing_active;
52 }

References $parsing_active.

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

Field Documentation

◆ $assignment_list

ilAssQuestionSkillAssignmentImportList ilAssQuestionSkillAssignmentXmlParser::$assignment_list
protected

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

Referenced by getAssignmentList().

◆ $character_data_buffer

string ilAssQuestionSkillAssignmentXmlParser::$character_data_buffer = ''
protected

◆ $cur_assignment

ilAssQuestionSkillAssignmentImport ilAssQuestionSkillAssignmentXmlParser::$cur_assignment = null
protected

◆ $cur_expression

ilAssQuestionSolutionComparisonExpressionImport ilAssQuestionSkillAssignmentXmlParser::$cur_expression = null
protected

◆ $cur_question_id

int ilAssQuestionSkillAssignmentXmlParser::$cur_question_id = null
protected

◆ $parsing_active

bool ilAssQuestionSkillAssignmentXmlParser::$parsing_active = false
protected

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