ILIAS  trunk Revision v11.0_alpha-1846-g895b5f47236
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilDataSetImportParser Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Manifest parser for ILIAS standard export files

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

Definition at line 24 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 43 of file class.ilDataSetImportParser.php.

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

49  {
50  $this->ds = $a_ds;
51  $this->mapping = $a_mapping;
52  $this->top_entity = $a_top_entity;
53  $this->schema_version = $a_schema_version;
54  $this->dspref = ($this->ds->getDSPrefix() !== "")
55  ? $this->ds->getDSPrefix() . ":"
56  : "";
57 
59  $this->setXMLContent($a_xml);
60  $this->startParsing();
61  }
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 63 of file class.ilDataSetImportParser.php.

References $current_installation_id.

63  : string
64  {
66  }

◆ handleBeginTag()

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

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

Referenced by setHandlers().

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

◆ handleCharacterData()

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

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

Referenced by setHandlers().

158  : void {
159  $this->chr_data .= $a_data;
160  }
+ Here is the caller graph for this function:

◆ handleEndTag()

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

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

References $chr_data, $current_entity, and $current_field.

Referenced by setHandlers().

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

◆ setHandlers()

ilDataSetImportParser::setHandlers (   $a_xml_parser)

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

References handleBeginTag(), handleCharacterData(), and handleEndTag().

69  : void
70  {
71  xml_set_element_handler($a_xml_parser, $this->handleBeginTag(...), $this->handleEndTag(...));
72  xml_set_character_data_handler($a_xml_parser, $this->handleCharacterData(...));
73  }
handleEndTag( $a_xml_parser, string $a_name)
handleBeginTag( $a_xml_parser, string $a_name, array $a_attribs)
handleCharacterData( $a_xml_parser, string $a_data)
+ Here is the call graph for this function:

Field Documentation

◆ $chr_data

string ilDataSetImportParser::$chr_data = ""
protected

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

Referenced by handleEndTag().

◆ $current_entity

string ilDataSetImportParser::$current_entity = ""
protected

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

Referenced by handleEndTag().

◆ $current_field

string ilDataSetImportParser::$current_field = ""
protected

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

Referenced by handleEndTag().

◆ $current_field_values

array ilDataSetImportParser::$current_field_values = array()
protected

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

◆ $current_ftypes

array ilDataSetImportParser::$current_ftypes = array()
protected

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

◆ $current_installation_id

string ilDataSetImportParser::$current_installation_id = ""
protected

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

Referenced by getCurrentInstallationId().

◆ $current_version

string ilDataSetImportParser::$current_version = ""
protected

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

◆ $ds

ilDataSet ilDataSetImportParser::$ds
protected

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

◆ $dspref

string ilDataSetImportParser::$dspref
protected

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

◆ $entities

array ilDataSetImportParser::$entities = array()
protected

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

◆ $entities_sent

bool ilDataSetImportParser::$entities_sent = false
protected

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

◆ $import

ilImport ilDataSetImportParser::$import = null
protected

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

◆ $in_record

bool ilDataSetImportParser::$in_record = false
protected

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

◆ $mapping

ilImportMapping ilDataSetImportParser::$mapping
protected

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

◆ $schema_version

string ilDataSetImportParser::$schema_version
protected

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

◆ $top_entity

string ilDataSetImportParser::$top_entity
protected

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


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