ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilTestSkillLevelThresholdXmlParser Class Reference
+ Inheritance diagram for ilTestSkillLevelThresholdXmlParser:
+ Collaboration diagram for ilTestSkillLevelThresholdXmlParser:

Public Member Functions

 __construct (?string $path_to_file='')
 
 isParsingActive ()
 
 setParsingActive (bool $parsingActive)
 
 getSkillLevelThresholdImportList ()
 
 initSkillLevelThresholdImportList ()
 
 getCurSkillBaseId ()
 
 setCurSkillBaseId (?int $curSkillBaseId)
 
 getCurSkillTrefId ()
 
 setCurSkillTrefId (?int $curSkillTrefId)
 
 getCurSkillLevelThreshold ()
 
 setCurSkillLevelThreshold (?ilTestSkillLevelThresholdImport $curSkillLevelThreshold)
 
 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

bool $parsingActive = false
 
string $characterDataBuffer = null
 
int $curSkillBaseId = null
 
int $curSkillTrefId = null
 
ilTestSkillLevelThresholdImportList $skillLevelThresholdImportList = null
 
ilTestSkillLevelThresholdImport $curSkillLevelThreshold = null
 
- Protected Attributes inherited from ilSaxParser
ilLanguage $lng = null
 

Private Attributes

ilDBInterface $db
 

Additional Inherited Members

- Data Fields inherited from ilSaxParser
string $xml_file
 
bool $throw_exception = false
 

Detailed Description

Definition at line 27 of file class.ilTestSkillLevelThresholdXmlParser.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestSkillLevelThresholdXmlParser::__construct ( ?string  $path_to_file = '')

Definition at line 39 of file class.ilTestSkillLevelThresholdXmlParser.php.

References $DIC, and ILIAS\MetaData\Repository\Validation\Data\__construct().

41  {
42  global $DIC;
43  $this->db = $DIC['ilDB'];
44  parent::__construct($path_to_file);
45  }
global $DIC
Definition: feed.php:28
__construct(VocabulariesInterface $vocabularies)
+ Here is the call graph for this function:

Member Function Documentation

◆ appendToCharacterDataBuffer()

ilTestSkillLevelThresholdXmlParser::appendToCharacterDataBuffer ( string  $characterData)
protected

Definition at line 70 of file class.ilTestSkillLevelThresholdXmlParser.php.

Referenced by handlerCharacterData().

70  : void
71  {
72  $this->characterDataBuffer .= $characterData;
73  }
+ Here is the caller graph for this function:

◆ getCharacterDataBuffer()

ilTestSkillLevelThresholdXmlParser::getCharacterDataBuffer ( )
protected

Definition at line 57 of file class.ilTestSkillLevelThresholdXmlParser.php.

References $characterDataBuffer.

Referenced by handlerEndTag().

+ Here is the caller graph for this function:

◆ getCurSkillBaseId()

ilTestSkillLevelThresholdXmlParser::getCurSkillBaseId ( )

Definition at line 85 of file class.ilTestSkillLevelThresholdXmlParser.php.

References $curSkillBaseId.

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

◆ getCurSkillLevelThreshold()

ilTestSkillLevelThresholdXmlParser::getCurSkillLevelThreshold ( )

Definition at line 105 of file class.ilTestSkillLevelThresholdXmlParser.php.

References $curSkillLevelThreshold.

Referenced by handlerEndTag().

+ Here is the caller graph for this function:

◆ getCurSkillTrefId()

ilTestSkillLevelThresholdXmlParser::getCurSkillTrefId ( )

Definition at line 95 of file class.ilTestSkillLevelThresholdXmlParser.php.

References $curSkillTrefId.

Referenced by handlerBeginTag(), and handlerEndTag().

+ Here is the caller graph for this function:

◆ getSkillLevelThresholdImportList()

ilTestSkillLevelThresholdXmlParser::getSkillLevelThresholdImportList ( )

◆ handlerBeginTag()

ilTestSkillLevelThresholdXmlParser::handlerBeginTag (   $xmlParser,
  $tagName,
  $tagAttributes 
)

Definition at line 122 of file class.ilTestSkillLevelThresholdXmlParser.php.

References getCurSkillBaseId(), getCurSkillTrefId(), initSkillLevelThresholdImportList(), isParsingActive(), resetCharacterDataBuffer(), setCurSkillBaseId(), setCurSkillLevelThreshold(), setCurSkillTrefId(), and setParsingActive().

122  : void
123  {
124  if ($tagName != 'SkillsLevelThresholds' && !$this->isParsingActive()) {
125  return;
126  }
127 
128  switch ($tagName) {
129  case 'SkillsLevelThresholds':
130  $this->setParsingActive(true);
132  break;
133 
134  case 'QuestionsAssignedSkill':
135  $this->setCurSkillBaseId((int) $tagAttributes['BaseId']);
136  $this->setCurSkillTrefId((int) $tagAttributes['TrefId']);
137  break;
138 
139  case 'OriginalLevelDescription':
140  case 'OriginalLevelTitle':
141  case 'ThresholdPercentage':
142  case 'OriginalSkillPath':
143  case 'OriginalSkillTitle':
144  $this->resetCharacterDataBuffer();
145  break;
146 
147  case 'SkillLevel':
148  $skillLevelThreshold = new ilTestSkillLevelThresholdImport($this->db);
149  $skillLevelThreshold->setImportSkillBaseId($this->getCurSkillBaseId());
150  $skillLevelThreshold->setImportSkillTrefId($this->getCurSkillTrefId());
151  $skillLevelThreshold->setImportLevelId((int) $tagAttributes['Id']);
152  $skillLevelThreshold->setOrderIndex((int) $tagAttributes['Nr']);
153  $this->setCurSkillLevelThreshold($skillLevelThreshold);
154  break;
155  }
156  }
setCurSkillLevelThreshold(?ilTestSkillLevelThresholdImport $curSkillLevelThreshold)
+ Here is the call graph for this function:

◆ handlerCharacterData()

ilTestSkillLevelThresholdXmlParser::handlerCharacterData (   $xmlParser,
  $charData 
)

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

References appendToCharacterDataBuffer(), and isParsingActive().

216  : void
217  {
218  if (!$this->isParsingActive()) {
219  return;
220  }
221 
222  if ($charData != "\n") {
223  // Replace multiple tabs with one space
224  $charData = preg_replace("/\t+/", " ", $charData);
225 
226  $this->appendToCharacterDataBuffer($charData);
227  }
228  }
+ Here is the call graph for this function:

◆ handlerEndTag()

ilTestSkillLevelThresholdXmlParser::handlerEndTag (   $xmlParser,
  $tagName 
)

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

References getCharacterDataBuffer(), getCurSkillBaseId(), getCurSkillLevelThreshold(), getCurSkillTrefId(), getSkillLevelThresholdImportList(), isParsingActive(), resetCharacterDataBuffer(), setCurSkillBaseId(), setCurSkillLevelThreshold(), setCurSkillTrefId(), and setParsingActive().

158  : void
159  {
160  if (!$this->isParsingActive()) {
161  return;
162  }
163 
164  switch ($tagName) {
165  case 'SkillsLevelThresholds':
166  $this->setParsingActive(false);
167  break;
168 
169  case 'QuestionsAssignedSkill':
170  $this->setCurSkillBaseId(null);
171  $this->setCurSkillTrefId(null);
172  break;
173 
174  case 'OriginalSkillTitle':
175  $this->getSkillLevelThresholdImportList()->addOriginalSkillTitle(
176  $this->getCurSkillBaseId(),
177  $this->getCurSkillTrefId(),
178  $this->getCharacterDataBuffer()
179  );
180  $this->resetCharacterDataBuffer();
181  break;
182 
183  case 'OriginalSkillPath':
184  $this->getSkillLevelThresholdImportList()->addOriginalSkillPath(
185  $this->getCurSkillBaseId(),
186  $this->getCurSkillTrefId(),
187  $this->getCharacterDataBuffer()
188  );
189  $this->resetCharacterDataBuffer();
190  break;
191 
192  case 'SkillLevel':
193  $this->getSkillLevelThresholdImportList()->addSkillLevelThreshold(
195  );
196  $this->setCurSkillLevelThreshold(null);
197  break;
198 
199  case 'ThresholdPercentage':
200  $this->getCurSkillLevelThreshold()->setThreshold((int) $this->getCharacterDataBuffer());
201  $this->resetCharacterDataBuffer();
202  break;
203 
204  case 'OriginalLevelTitle':
205  $this->getCurSkillLevelThreshold()->setOriginalLevelTitle($this->getCharacterDataBuffer());
206  $this->resetCharacterDataBuffer();
207  break;
208 
209  case 'OriginalLevelDescription':
210  $this->getCurSkillLevelThreshold()->setOriginalLevelDescription($this->getCharacterDataBuffer());
211  $this->resetCharacterDataBuffer();
212  break;
213  }
214  }
setCurSkillLevelThreshold(?ilTestSkillLevelThresholdImport $curSkillLevelThreshold)
+ Here is the call graph for this function:

◆ initSkillLevelThresholdImportList()

ilTestSkillLevelThresholdXmlParser::initSkillLevelThresholdImportList ( )

Definition at line 80 of file class.ilTestSkillLevelThresholdXmlParser.php.

Referenced by handlerBeginTag().

80  : void
81  {
82  $this->skillLevelThresholdImportList = new ilTestSkillLevelThresholdImportList($this->db);
83  }
+ Here is the caller graph for this function:

◆ isParsingActive()

ilTestSkillLevelThresholdXmlParser::isParsingActive ( )

Definition at line 47 of file class.ilTestSkillLevelThresholdXmlParser.php.

References $parsingActive.

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

+ Here is the caller graph for this function:

◆ resetCharacterDataBuffer()

ilTestSkillLevelThresholdXmlParser::resetCharacterDataBuffer ( )
protected
Parameters
string$characterDataBuffer

Definition at line 65 of file class.ilTestSkillLevelThresholdXmlParser.php.

Referenced by handlerBeginTag(), and handlerEndTag().

65  : void
66  {
67  $this->characterDataBuffer = '';
68  }
+ Here is the caller graph for this function:

◆ setCurSkillBaseId()

ilTestSkillLevelThresholdXmlParser::setCurSkillBaseId ( ?int  $curSkillBaseId)

Definition at line 90 of file class.ilTestSkillLevelThresholdXmlParser.php.

References $curSkillBaseId.

Referenced by handlerBeginTag(), and handlerEndTag().

90  : void
91  {
92  $this->curSkillBaseId = $curSkillBaseId;
93  }
+ Here is the caller graph for this function:

◆ setCurSkillLevelThreshold()

ilTestSkillLevelThresholdXmlParser::setCurSkillLevelThreshold ( ?ilTestSkillLevelThresholdImport  $curSkillLevelThreshold)

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

References $curSkillLevelThreshold.

Referenced by handlerBeginTag(), and handlerEndTag().

110  : void
111  {
112  $this->curSkillLevelThreshold = $curSkillLevelThreshold;
113  }
+ Here is the caller graph for this function:

◆ setCurSkillTrefId()

ilTestSkillLevelThresholdXmlParser::setCurSkillTrefId ( ?int  $curSkillTrefId)

Definition at line 100 of file class.ilTestSkillLevelThresholdXmlParser.php.

References $curSkillTrefId.

Referenced by handlerBeginTag(), and handlerEndTag().

100  : void
101  {
102  $this->curSkillTrefId = $curSkillTrefId;
103  }
+ Here is the caller graph for this function:

◆ setHandlers()

ilTestSkillLevelThresholdXmlParser::setHandlers (   $a_xml_parser)

Definition at line 115 of file class.ilTestSkillLevelThresholdXmlParser.php.

115  : void
116  {
117  xml_set_object($a_xml_parser, $this);
118  xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
119  xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
120  }

◆ setParsingActive()

ilTestSkillLevelThresholdXmlParser::setParsingActive ( bool  $parsingActive)

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

References $parsingActive.

Referenced by handlerBeginTag(), and handlerEndTag().

52  : void
53  {
54  $this->parsingActive = $parsingActive;
55  }
+ Here is the caller graph for this function:

Field Documentation

◆ $characterDataBuffer

string ilTestSkillLevelThresholdXmlParser::$characterDataBuffer = null
protected

Definition at line 30 of file class.ilTestSkillLevelThresholdXmlParser.php.

Referenced by getCharacterDataBuffer().

◆ $curSkillBaseId

int ilTestSkillLevelThresholdXmlParser::$curSkillBaseId = null
protected

◆ $curSkillLevelThreshold

ilTestSkillLevelThresholdImport ilTestSkillLevelThresholdXmlParser::$curSkillLevelThreshold = null
protected

◆ $curSkillTrefId

int ilTestSkillLevelThresholdXmlParser::$curSkillTrefId = null
protected

◆ $db

ilDBInterface ilTestSkillLevelThresholdXmlParser::$db
private

Definition at line 34 of file class.ilTestSkillLevelThresholdXmlParser.php.

◆ $parsingActive

bool ilTestSkillLevelThresholdXmlParser::$parsingActive = false
protected

◆ $skillLevelThresholdImportList

ilTestSkillLevelThresholdImportList ilTestSkillLevelThresholdXmlParser::$skillLevelThresholdImportList = null
protected

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