ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
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("./classes/class.ilSaxParser.php");
5 
14 {
15  protected $expfiles = array();
16  protected $expsets = array();
17 
24  function __construct($a_file)
25  {
26  parent::ilSaxParser($a_file, true);
27  $this->startParsing();
28  }
29 
35  final function setInstallId($a_val)
36  {
37  $this->install_id = $a_val;
38  }
39 
45  final function getInstallId()
46  {
47  return $this->install_id;
48  }
49 
55  final function setInstallUrl($a_val)
56  {
57  $this->install_url = $a_val;
58  }
59 
65  final function getInstallUrl()
66  {
67  return $this->install_url;
68  }
69 
75  function setMainEntity($a_val)
76  {
77  $this->main_entity = $a_val;
78  }
79 
85  function getMainEntity()
86  {
87  return $this->main_entity;
88  }
89 
95  function setTitle($a_val)
96  {
97  $this->title = $a_val;
98  }
99 
105  function getTitle()
106  {
107  return $this->title;
108  }
109 
115  function setTargetRelease($a_val)
116  {
117  $this->target_release = $a_val;
118  }
119 
125  function getTargetRelease()
126  {
127  return $this->target_release;
128  }
129 
135  function getExportFiles()
136  {
137  return $this->expfiles;
138  }
139 
140  public function getExportSets()
141  {
142  return $this->expsets;
143  }
144 
151  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  function startParsing()
163  {
165  }
166 
170  function handleBeginTag($a_xml_parser, $a_name, $a_attribs)
171  {
172  switch ($a_name)
173  {
174  case "Manifest":
175  $this->setInstallId($a_attribs["InstallationId"]);
176  $this->setInstallUrl($a_attribs["InstallationUrl"]);
177  $this->setTitle($a_attribs["Title"]);
178  $this->setTargetRelease($a_attribs["TargetRelease"]);
179  $this->setMainEntity($a_attribs["MainEntity"]);
180  break;
181 
182  case "ExportFile":
183  $this->expfiles[] = array("component" => $a_attribs["Component"],
184  "path" => $a_attribs["Path"]);
185  break;
186 
187  case "ExportSet":
188  $this->expsets[] = array(
189  'path' => $a_attribs['Path'],
190  'type' => $a_attribs['Type']
191  );
192  break;
193  }
194  }
195 
199  function handleEndTag($a_xml_parser, $a_name)
200  {
201 
202  $this->chr_data = "";
203  }
204 
208  function handleCharacterData($a_xml_parser,$a_data)
209  {
210  //$a_data = str_replace("<","&lt;",$a_data);
211  //$a_data = str_replace(">","&gt;",$a_data);
212  // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
213  //$a_data = preg_replace("/\n/","",$a_data);
214  //$a_data = preg_replace("/\t+/","",$a_data);
215 
216  $this->chr_data .= $a_data;
217  }
218 
219 }
220 ?>