34 include_once
'./Services/Xml/classes/class.ilSaxParser.php';
35 include_once(
'./webservice/soap/classes/class.ilObjectXMLException.php');
61 return $this->object_data ? $this->object_data : array();
71 function parse($a_xml_parser,$a_fp = null)
85 xml_set_object($a_xml_parser,$this);
86 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
87 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
105 $this->curr_obj = -1;
134 $this->time_target = array();
135 $this->ref_id = $a_attribs[
"ref_id"];
136 $this->parent_id = $a_attribs[
'parent_id'];
140 $this->time_target[
'timing_type'] = $a_attribs[
'type'];
144 $this->time_target[
'timing_visibility'] = $a_attribs[
'visibility'];
145 if(isset($a_attribs[
'starting_time']))
147 $this->time_target[
'starting_time'] = $a_attribs[
'starting_time'];
149 if(isset($a_attribs[
'ending_time']))
151 $this->time_target[
'ending_time'] = $a_attribs[
'ending_time'];
154 if($a_attribs[
'ending_time'] < $a_attribs[
'starting_time'])
159 $this->time_target[
'changeable'] = $a_attribs[
'changeable'];
162 if(isset($a_attribs[
'starting_time']))
164 $this->time_target[
'suggestion_start'] = $a_attribs[
'starting_time'];
166 if(isset($a_attribs[
'ending_time']))
168 $this->time_target[
'suggestion_end'] = $a_attribs[
'ending_time'];
170 if(isset($a_attribs[
'earliest_start']))
172 $this->time_target[
'earliest_start'] = $a_attribs[
'earliest_start'];
174 if(isset($a_attribs[
'latest_end']))
176 $this->time_target[
'latest_end'] = $a_attribs[
'latest_end'];
179 if($a_attribs[
'latest_end'] < $a_attribs[
'earliest_start'])
181 if($a_attribs[
'ending_time'] < $a_attribs[
'starting_time'])
229 $this->
__addReference($this->ref_id,$this->parent_id,$this->time_target);
249 $a_data = preg_replace(
"/\t+/",
" ",$a_data);
251 $this->cdata .= $a_data;
260 $this->object_data[$this->curr_obj][$a_name] = $a_value;
268 $reference[
'ref_id'] = $a_ref_id;
269 $reference[
'parent_id'] = $a_parent_id;
270 $reference[
'time_target'] = $a_time_target;
272 if(isset($reference[
'time_target'][
'changeable']) and $reference[
'time_target'][
'changeable'])
274 if(!isset($reference[
'time_target'][
'earliest_start']) or !isset($reference[
'time_target'][
'latest_end']))
276 throw new ilObjectXMLException(
'Missing attributes: "earliest_start" and "latest_end" required for attribute "changeable"');
278 if(!isset($reference[
'time_target'][
'suggestion_start']) or !isset($reference[
'time_target'][
'suggestion_end']))
280 throw new ilObjectXMLException(
'Missing attributes: "starting_time" and "ending_time" required for attribute "changeable"');
282 if(($reference[
'time_target'][
'earliest_start'] < $reference[
'time_target'][
'suggestion_start']) or
283 ($reference[
'time_target'][
'earliest_start'] > $reference[
'time_target'][
'suggestion_end']))
285 throw new ilObjectXMLException(
'Invalid attributes: "earliest_start" must be within "starting_time" and "ending_time"');
287 if(($reference[
'time_target'][
'latest_end'] < $reference[
'time_target'][
'suggestion_start']) or
288 ($reference[
'time_target'][
'latest_end'] > $reference[
'time_target'][
'suggestion_end']))
290 throw new ilObjectXMLException(
'Invalid attributes: "latest_end" must be within "starting_time" and "ending_time"');
294 $this->object_data[$this->curr_obj][
'references'][] = $reference;