ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDataSetImportParser Class Reference

Manifest parser for ILIAS standard export files. More...

+ Inheritance diagram for ilDataSetImportParser:
+ Collaboration diagram for ilDataSetImportParser:

Public Member Functions

 __construct (string $a_top_entity, string $a_schema_version, string $a_xml, ilDataSet $a_ds, ilImportMapping $a_mapping)
 
 getCurrentInstallationId ()
 
 setHandlers ($a_xml_parser)
 
 handleBeginTag ( $a_xml_parser, string $a_name, array $a_attribs)
 
 handleEndTag ( $a_xml_parser, string $a_name)
 
 handleCharacterData ( $a_xml_parser, string $a_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 Attributes

string $dspref
 
string $schema_version
 
string $top_entity
 
ilDataSet $ds
 
ilImport $import = null
 
array $entities = array()
 
string $current_entity = ""
 
string $current_version = ""
 
array $current_ftypes = array()
 
bool $entities_sent = false
 
bool $in_record = false
 
string $current_field = ""
 
array $current_field_values = array()
 
string $current_installation_id = ""
 
string $chr_data = ""
 
ilImportMapping $mapping
 
- Protected Attributes inherited from ilSaxParser
ilLanguage $lng = null
 

Additional Inherited Members

- Data Fields inherited from ilSaxParser
string $xml_file
 
bool $throw_exception = false
 
- Protected Member Functions inherited from ilSaxParser
 openXMLFile ()
 
 handleError (string $message)
 
 setThrowException (bool $throw_exception)
 

Detailed Description

Manifest parser for ILIAS standard export files.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 21 of file class.ilDataSetImportParser.php.

Constructor & Destructor Documentation

◆ __construct()

ilDataSetImportParser::__construct ( string  $a_top_entity,
string  $a_schema_version,
string  $a_xml,
ilDataSet  $a_ds,
ilImportMapping  $a_mapping 
)

Definition at line 40 of file class.ilDataSetImportParser.php.

References ILIAS\GlobalScreen\Provider\__construct(), ilSaxParser\setXMLContent(), and ilSaxParser\startParsing().

46  {
47  $this->ds = $a_ds;
48  $this->mapping = $a_mapping;
49  $this->top_entity = $a_top_entity;
50  $this->schema_version = $a_schema_version;
51  $this->dspref = ($this->ds->getDSPrefix() !== "")
52  ? $this->ds->getDSPrefix() . ":"
53  : "";
54 
56  $this->setXMLContent($a_xml);
57  $this->startParsing();
58  }
startParsing()
stores xml data in array
__construct(Container $dic, ilPlugin $plugin)
setXMLContent(string $a_xml_content)
+ Here is the call graph for this function:

Member Function Documentation

◆ getCurrentInstallationId()

ilDataSetImportParser::getCurrentInstallationId ( )

Definition at line 60 of file class.ilDataSetImportParser.php.

References $current_installation_id.

60  : string
61  {
63  }

◆ handleBeginTag()

ilDataSetImportParser::handleBeginTag (   $a_xml_parser,
string  $a_name,
array  $a_attribs 
)

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

78  : void {
79  switch ($a_name) {
80  case $this->dspref . "DataSet":
81 // $this->import->initDataset($this->ds_component, $a_attribs["top_entity"]);
82  $this->current_installation_id = $a_attribs["InstallationId"];
83  $this->ds->setCurrentInstallationId($a_attribs["InstallationId"]);
84  break;
85 
86  case $this->dspref . "Types":
87  $this->current_entity = $a_attribs["Entity"];
88  $this->current_version = $a_attribs["Version"];
89  break;
90 
91  case $this->dspref . "FieldType":
92  $this->current_ftypes[$a_attribs["Name"]] =
93  $a_attribs["Type"];
94  break;
95 
96  case $this->dspref . "Rec":
97  $this->current_entity = $a_attribs["Entity"];
98  $this->in_record = true;
99  $this->current_field_values = array();
100  break;
101 
102  default:
103  if ($this->in_record) {
104  $field = explode(":", $a_name); // remove namespace
105  $field = $field[count($field) - 1];
106  $this->current_field = $field;
107  }
108  }
109  }

◆ handleCharacterData()

ilDataSetImportParser::handleCharacterData (   $a_xml_parser,
string  $a_data 
)

Definition at line 153 of file class.ilDataSetImportParser.php.

156  : void {
157  $this->chr_data .= $a_data;
158  }

◆ handleEndTag()

ilDataSetImportParser::handleEndTag (   $a_xml_parser,
string  $a_name 
)

Definition at line 111 of file class.ilDataSetImportParser.php.

References $chr_data, $current_entity, and $current_field.

114  : void {
115  switch ($a_name) {
116  case $this->dspref . "Types":
117  $this->entities[$this->current_entity] =
118  array(
119  "version" => $this->current_version,
120  "types" => $this->current_ftypes
121  );
122  $this->current_ftypes = array();
123  $this->current_entity = "";
124  $this->current_version = "";
125  break;
126 
127  case $this->dspref . "Rec":
128  $this->ds->importRecord(
129  $this->current_entity,
130  $this->entities[$this->current_entity]["types"] ?? [],
131  $this->current_field_values,
132  $this->mapping,
133  $this->schema_version
134  );
135  $this->in_record = false;
136  $this->current_entity = "";
137  $this->current_field_values = array();
138  break;
139 
140  default:
141  if ($this->in_record && $this->current_field !== "") {
142  $this->current_field_values[$this->current_field] =
144  }
145  $this->current_field = "";
146  break;
147  }
148 
149  $this->chr_data = "";
150  }

◆ setHandlers()

ilDataSetImportParser::setHandlers (   $a_xml_parser)

Definition at line 66 of file class.ilDataSetImportParser.php.

66  : void
67  {
68  xml_set_object($a_xml_parser, $this);
69  xml_set_element_handler($a_xml_parser, 'handleBeginTag', 'handleEndTag');
70  xml_set_character_data_handler($a_xml_parser, 'handleCharacterData');
71  }

Field Documentation

◆ $chr_data

string ilDataSetImportParser::$chr_data = ""
protected

Definition at line 37 of file class.ilDataSetImportParser.php.

Referenced by handleEndTag().

◆ $current_entity

string ilDataSetImportParser::$current_entity = ""
protected

Definition at line 29 of file class.ilDataSetImportParser.php.

Referenced by handleEndTag().

◆ $current_field

string ilDataSetImportParser::$current_field = ""
protected

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

Referenced by handleEndTag().

◆ $current_field_values

array ilDataSetImportParser::$current_field_values = array()
protected

Definition at line 35 of file class.ilDataSetImportParser.php.

◆ $current_ftypes

array ilDataSetImportParser::$current_ftypes = array()
protected

Definition at line 31 of file class.ilDataSetImportParser.php.

◆ $current_installation_id

string ilDataSetImportParser::$current_installation_id = ""
protected

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

Referenced by getCurrentInstallationId().

◆ $current_version

string ilDataSetImportParser::$current_version = ""
protected

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

◆ $ds

ilDataSet ilDataSetImportParser::$ds
protected

Definition at line 26 of file class.ilDataSetImportParser.php.

◆ $dspref

string ilDataSetImportParser::$dspref
protected

Definition at line 23 of file class.ilDataSetImportParser.php.

◆ $entities

array ilDataSetImportParser::$entities = array()
protected

Definition at line 28 of file class.ilDataSetImportParser.php.

◆ $entities_sent

bool ilDataSetImportParser::$entities_sent = false
protected

Definition at line 32 of file class.ilDataSetImportParser.php.

◆ $import

ilImport ilDataSetImportParser::$import = null
protected

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

◆ $in_record

bool ilDataSetImportParser::$in_record = false
protected

Definition at line 33 of file class.ilDataSetImportParser.php.

◆ $mapping

ilImportMapping ilDataSetImportParser::$mapping
protected

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

◆ $schema_version

string ilDataSetImportParser::$schema_version
protected

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

◆ $top_entity

string ilDataSetImportParser::$top_entity
protected

Definition at line 25 of file class.ilDataSetImportParser.php.


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