ILIAS  release_7 Revision v7.30-3-g800a261c036
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
4include_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 /*
116 public function setTargetRelease($a_val)
117 {
118 $this->target_release = $a_val;
119 }*/
120
126 /*public function getTargetRelease()
127 {
128 return $this->target_release;
129 }*/
130
136 public function getExportFiles()
137 {
138 return $this->expfiles;
139 }
140
141 public function getExportSets()
142 {
143 return $this->expsets;
144 }
145
152 public function setHandlers($a_xml_parser)
153 {
154 xml_set_object($a_xml_parser, $this);
155 xml_set_element_handler($a_xml_parser, 'handleBeginTag', 'handleEndTag');
156 xml_set_character_data_handler($a_xml_parser, 'handleCharacterData');
157 }
158
159
163 public function startParsing()
164 {
165 parent::startParsing();
166 }
167
171 public function handleBeginTag($a_xml_parser, $a_name, $a_attribs)
172 {
173 switch ($a_name) {
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 public function handleEndTag($a_xml_parser, $a_name)
200 {
201 $this->chr_data = "";
202 }
203
207 public function handleCharacterData($a_xml_parser, $a_data)
208 {
209 //$a_data = str_replace("<","&lt;",$a_data);
210 //$a_data = str_replace(">","&gt;",$a_data);
211 // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
212 //$a_data = preg_replace("/\n/","",$a_data);
213 //$a_data = preg_replace("/\t+/","",$a_data);
214
215 $this->chr_data .= $a_data;
216 }
217}
An exception for terminatinating execution or to throw for unit testing.
Manifest parser for ILIAS standard export files.
getExportFiles()
Set target release.
setMainEntity($a_val)
Set main entity.
setInstallId($a_val)
Set Installation ID.
handleEndTag($a_xml_parser, $a_name)
End Tag.
setHandlers($a_xml_parser)
Set event handlers.
handleCharacterData($a_xml_parser, $a_data)
End Tag.
getInstallId()
Get Installation ID.
setTitle($a_val)
Set title.
handleBeginTag($a_xml_parser, $a_name, $a_attribs)
Begin Tag.
getMainEntity()
Get main entity.
getInstallUrl()
Get Installation Url.
setInstallUrl($a_val)
Set Installation Url.
__construct($a_file)
Constructor.
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc