ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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

Constructor & Destructor Documentation

◆ __construct()

ilAssQuestionSkillAssignmentXmlParser::__construct ( ?string  $xml_file)

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

67 : void
68 {
69 $this->character_data_buffer .= $characterData;
70 }

Referenced by handlerCharacterData().

+ Here is the caller graph for this function:

◆ getAssignmentList()

ilAssQuestionSkillAssignmentXmlParser::getAssignmentList ( )

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

References $character_data_buffer.

Referenced by handlerEndTag().

+ Here is the caller graph for this function:

◆ getCurAssignment()

ilAssQuestionSkillAssignmentXmlParser::getCurAssignment ( )

◆ getCurExpression()

ilAssQuestionSkillAssignmentXmlParser::getCurExpression ( )

◆ getCurQuestionid()

ilAssQuestionSkillAssignmentXmlParser::getCurQuestionid ( )

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

113 : void
114 {
115 if ($tag_name !== 'SkillAssignments' && !$this->isParsingActive()) {
116 return;
117 }
118
119 switch ($tag_name) {
120 case 'SkillAssignments':
121 $this->setParsingActive(true);
122 break;
123
124 case 'TriggerQuestion':
125 $this->setCurQuestionid((int) $tag_attributes['Id']);
126 break;
127
128 case 'TriggeredSkill':
129 $assignment = new ilAssQuestionSkillAssignmentImport();
130 $assignment->setImportQuestionId($this->getCurQuestionid());
131 $assignment->setImportSkillBaseId((int) $tag_attributes['BaseId']);
132 $assignment->setImportSkillTrefId((int) $tag_attributes['TrefId']);
133 $assignment->initImportSolutionComparisonExpressionList();
134 $this->setCurAssignment($assignment);
135 break;
136
137 case 'OriginalSkillPath':
138 case 'OriginalSkillTitle':
140 break;
141
142 case 'EvalByQuestionResult':
144 $this->getCurAssignment()->setSkillPoints((int) $tag_attributes['Points']);
145 break;
146
147 case 'EvalByQuestionSolution':
149 break;
150
151 case 'SolutionComparisonExpression':
153 $expression->setPoints((int) $tag_attributes['Points']);
154 $expression->setOrderIndex((int) $tag_attributes['Index']);
155 $this->setCurExpression($expression);
157 break;
158 }
159 }
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 204 of file class.ilAssQuestionSkillAssignmentXmlParser.php.

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

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

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

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

62 : void
63 {
64 $this->character_data_buffer = '';
65 }

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

◆ setCurAssignment()

ilAssQuestionSkillAssignmentXmlParser::setCurAssignment ( ?ilAssQuestionSkillAssignmentImport  $cur_assignment)

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

87 : void
88 {
89 $this->cur_assignment = $cur_assignment;
90 }

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

102 : void
103 {
104 $this->cur_expression = $cur_expression;
105 }

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

77 : void
78 {
79 $this->cur_question_id = (int) $cur_question_id;
80 }

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

107 : void
108 {
109 xml_set_element_handler($a_xml_parser, $this->handlerBeginTag(...), $this->handlerEndTag(...));
110 xml_set_character_data_handler($a_xml_parser, $this->handlerCharacterData(...));
111 }

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

+ Here is the call graph for this function:

◆ setParsingActive()

ilAssQuestionSkillAssignmentXmlParser::setParsingActive ( bool  $parsing_active)

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

52 : void
53 {
54 $this->parsing_active = $parsing_active;
55 }

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