ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilManifestParser.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once("./Services/Xml/classes/class.ilSaxParser.php");
5 
14 {
15  protected $expfiles = array();
16  protected $expsets = array();
17 
24  public function __construct($a_file)
25  {
26  parent::__construct($a_file, true);
27  $this->startParsing();
28  }
29 
35  final public function setInstallId($a_val)
36  {
37  $this->install_id = $a_val;
38  }
39 
45  final public function getInstallId()
46  {
47  return $this->install_id;
48  }
49 
55  final public function setInstallUrl($a_val)
56  {
57  $this->install_url = $a_val;
58  }
59 
65  final public function getInstallUrl()
66  {
67  return $this->install_url;
68  }
69 
75  public function setMainEntity($a_val)
76  {
77  $this->main_entity = $a_val;
78  }
79 
85  public function getMainEntity()
86  {
87  return $this->main_entity;
88  }
89 
95  public function setTitle($a_val)
96  {
97  $this->title = $a_val;
98  }
99 
105  public function getTitle()
106  {
107  return $this->title;
108  }
109 
115  public function setTargetRelease($a_val)
116  {
117  $this->target_release = $a_val;
118  }
119 
125  public function getTargetRelease()
126  {
127  return $this->target_release;
128  }
129 
135  public function getExportFiles()
136  {
137  return $this->expfiles;
138  }
139 
140  public function getExportSets()
141  {
142  return $this->expsets;
143  }
144 
151  public function setHandlers($a_xml_parser)
152  {
153  xml_set_object($a_xml_parser, $this);
154  xml_set_element_handler($a_xml_parser, 'handleBeginTag', 'handleEndTag');
155  xml_set_character_data_handler($a_xml_parser, 'handleCharacterData');
156  }
157 
158 
162  public function startParsing()
163  {
164  parent::startParsing();
165  }
166 
170  public function handleBeginTag($a_xml_parser, $a_name, $a_attribs)
171  {
172  switch ($a_name) {
173  case "Manifest":
174  $this->setInstallId($a_attribs["InstallationId"]);
175  $this->setInstallUrl($a_attribs["InstallationUrl"]);
176  $this->setTitle($a_attribs["Title"]);
177  $this->setTargetRelease($a_attribs["TargetRelease"]);
178  $this->setMainEntity($a_attribs["MainEntity"]);
179  break;
180 
181  case "ExportFile":
182  $this->expfiles[] = array("component" => $a_attribs["Component"],
183  "path" => $a_attribs["Path"]);
184  break;
185 
186  case "ExportSet":
187  $this->expsets[] = array(
188  'path' => $a_attribs['Path'],
189  'type' => $a_attribs['Type']
190  );
191  break;
192  }
193  }
194 
198  public function handleEndTag($a_xml_parser, $a_name)
199  {
200  $this->chr_data = "";
201  }
202 
206  public function handleCharacterData($a_xml_parser, $a_data)
207  {
208  //$a_data = str_replace("<","&lt;",$a_data);
209  //$a_data = str_replace(">","&gt;",$a_data);
210  // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
211  //$a_data = preg_replace("/\n/","",$a_data);
212  //$a_data = preg_replace("/\t+/","",$a_data);
213 
214  $this->chr_data .= $a_data;
215  }
216 }
getInstallId()
Get Installation ID.
handleEndTag($a_xml_parser, $a_name)
End Tag.
setHandlers($a_xml_parser)
Set event handlers.
setInstallUrl($a_val)
Set Installation Url.
startParsing()
Start parser.
setTitle($a_val)
Set title.
getExportFiles()
Get xml files.
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
getMainEntity()
Get main entity.
getTargetRelease()
Get target release.
handleCharacterData($a_xml_parser, $a_data)
End Tag.
setTargetRelease($a_val)
Set target release.
setMainEntity($a_val)
Set main entity.
getInstallUrl()
Get Installation Url.
__construct($a_file)
Constructor.
handleBeginTag($a_xml_parser, $a_name, $a_attribs)
Begin Tag.
Create styles array
The data for the language used.
Manifest parser for ILIAS standard export files.
setInstallId($a_val)
Set Installation ID.