ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilManifestParser.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
27 protected string $chr_data = '';
28 protected string $target_release = '';
29 protected string $title = '';
30 protected string $main_entity = '';
31 protected string $install_id = '';
32 protected string $install_url = '';
33 protected array $expfiles = array();
34 protected array $expsets = array();
35
36 public function __construct(string $a_file)
37 {
38 parent::__construct($a_file, true);
39 $this->startParsing();
40 }
41
42 final public function setInstallId(string $a_val): void
43 {
44 $this->install_id = $a_val;
45 }
46
47 final public function getInstallId(): string
48 {
49 return $this->install_id;
50 }
51
52 final public function setInstallUrl(string $a_val): void
53 {
54 $this->install_url = $a_val;
55 }
56
57 final public function getInstallUrl(): string
58 {
59 return $this->install_url;
60 }
61
62 public function setMainEntity(string $a_val): void
63 {
64 $this->main_entity = $a_val;
65 }
66
67 public function getMainEntity(): string
68 {
69 return $this->main_entity;
70 }
71
72 public function setTitle(string $a_val): void
73 {
74 $this->title = $a_val;
75 }
76
77 public function getTitle(): string
78 {
79 return $this->title;
80 }
81
82 /*
83 public function setTargetRelease(string $a_val): void
84 {
85 $this->target_release = $a_val;
86 }*/
87
88
89 /*
90 public function getTargetRelease(): string
91 {
92 return $this->target_release;
93 }*/
94
95 public function getExportFiles(): array
96 {
97 return $this->expfiles;
98 }
99
100 public function getExportSets(): array
101 {
102 return $this->expsets;
103 }
104
111 public function setHandlers($a_xml_parser): void
112 {
113 xml_set_element_handler($a_xml_parser, $this->handleBeginTag(...), $this->handleEndTag(...));
114 xml_set_character_data_handler($a_xml_parser, $this->handleCharacterData(...));
115 }
116
120 public function handleBeginTag($a_xml_parser, string $a_name, array $a_attribs): void
121 {
122 switch ($a_name) {
123 case "Manifest":
124 $this->setInstallId($a_attribs["InstallationId"]);
125 $this->setInstallUrl($a_attribs["InstallationUrl"]);
126 $this->setTitle($a_attribs["Title"]);
127 //$this->setTargetRelease($a_attribs["TargetRelease"]);
128 $this->setMainEntity($a_attribs["MainEntity"]);
129 break;
130
131 case "ExportFile":
132 $this->expfiles[] = array("component" => $a_attribs["Component"],
133 "path" => $a_attribs["Path"]
134 );
135 break;
136
137 case "ExportSet":
138 $this->expsets[] = array(
139 'path' => $a_attribs['Path'],
140 'type' => $a_attribs['Type']
141 );
142 break;
143 }
144 }
145
149 public function handleEndTag($a_xml_parser, string $a_name): void
150 {
151 $this->chr_data = "";
152 }
153
157 public function handleCharacterData($a_xml_parser, string $a_data): void
158 {
159 //$a_data = str_replace("<","&lt;",$a_data);
160 //$a_data = str_replace(">","&gt;",$a_data);
161 // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
162 //$a_data = preg_replace("/\n/","",$a_data);
163 //$a_data = preg_replace("/\t+/","",$a_data);
164
165 $this->chr_data .= $a_data;
166 }
167}
Manifest parser for ILIAS standard export files.
setHandlers($a_xml_parser)
Set event handlers.
setMainEntity(string $a_val)
setInstallId(string $a_val)
__construct(string $a_file)
handleBeginTag($a_xml_parser, string $a_name, array $a_attribs)
Begin Tag.
handleEndTag($a_xml_parser, string $a_name)
End Tag.
setInstallUrl(string $a_val)
handleCharacterData($a_xml_parser, string $a_data)
End Tag.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
startParsing()
stores xml data in array
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc