47 xml_set_object($a_xml_parser, $this);
48 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
49 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
55 public function handlerBeginTag($a_xml_parser,
string $a_name, array $a_attribs): void
65 $this->
addProperty(
'type', (
string) $a_attribs[
'type']);
66 if (array_key_exists(
'obj_id', $a_attribs)) {
70 $a_attribs[
"obj_id"] ??
'',
75 if (isset($a_attribs[
'offline'])) {
76 $this->
addProperty(
'offline', $a_attribs[
'offline']);
92 $this->time_target = [];
93 $this->ref_id = $a_attribs[
"ref_id"] ?? 0;
94 $this->parent_id = $a_attribs[
'parent_id'] ?? 0;
98 $this->time_target[
'timing_type'] = $a_attribs[
'type'];
102 if (isset($a_attribs[
'visibility'])) {
103 $this->time_target[
'timing_visibility'] = $a_attribs[
'visibility'];
105 if (isset($a_attribs[
'starting_time'])) {
106 $this->time_target[
'starting_time'] = $a_attribs[
'starting_time'];
108 if (isset($a_attribs[
'ending_time'])) {
109 $this->time_target[
'ending_time'] = $a_attribs[
'ending_time'];
111 if (isset($a_attribs[
'ending_time']) && isset($a_attribs[
'starting_time'])) {
113 if ($a_attribs[
'ending_time'] < $a_attribs[
'starting_time']) {
120 $this->time_target[
'changeable'] = $a_attribs[
'changeable'] ??
false;
122 if (isset($a_attribs[
'starting_time'])) {
123 $this->time_target[
'suggestion_start'] = $a_attribs[
'starting_time'];
125 if (isset($a_attribs[
'ending_time'])) {
126 $this->time_target[
'suggestion_end'] = $a_attribs[
'ending_time'];
149 $this->
addProperty(
'description', trim($this->cdata));
157 $this->
addProperty(
'create_date', trim($this->cdata));
161 $this->
addProperty(
'last_update', trim($this->cdata));
165 $this->
addProperty(
'import_id', trim($this->cdata));
169 if ($this->ref_id !== 0 && $this->parent_id !== 0) {
170 $this->
addReference($this->ref_id, $this->parent_id, $this->time_target);
185 if ($a_data !==
"\n") {
187 $a_data = preg_replace(
"/\t+/",
" ", $a_data);
189 $this->cdata .= $a_data;
203 private function addReference(
int $a_ref_id,
int $a_parent_id, array $a_time_target): void
205 $reference[
'ref_id'] = $a_ref_id;
206 $reference[
'parent_id'] = $a_parent_id;
207 $reference[
'time_target'] = $a_time_target;
209 if (isset($reference[
'time_target'][
'changeable']) && $reference[
'time_target'][
'changeable'] &&
210 !isset($reference[
'time_target'][
'suggestion_start'], $reference[
'time_target'][
'suggestion_end'])) {
212 'Missing attributes: "starting_time" and "ending_time" required for attribute "changeable"'
addReference(int $a_ref_id, int $a_parent_id, array $a_time_target)
Exception class for ObjectXMLWriter and ObjectXMLParser.
addProperty(string $a_name, $a_value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
handlerBeginTag($a_xml_parser, string $a_name, array $a_attribs)
handlerCharacterData($a_xml_parser, string $a_data)
static __extractId(string $ilias_id, int $inst_id)
extract ref id from role title, e.g.
__construct(Container $dic, ilPlugin $plugin)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setHandlers($a_xml_parser)
handlerEndTag($a_xml_parser, string $a_name)
setXMLContent(string $a_xml_content)
__construct(string $a_xml_data='', ?bool $throw_exception=false)