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 public function parse($a_xml_parser, $a_fp = null)
73 parent::parse($a_xml_parser, $a_fp);
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');
104 $this->curr_obj = -1;
133 $this->time_target =
array();
134 $this->ref_id = $a_attribs[
"ref_id"];
135 $this->parent_id = $a_attribs[
'parent_id'];
139 $this->time_target[
'timing_type'] = $a_attribs[
'type'];
143 $this->time_target[
'timing_visibility'] = $a_attribs[
'visibility'];
144 if (isset($a_attribs[
'starting_time'])) {
145 $this->time_target[
'starting_time'] = $a_attribs[
'starting_time'];
147 if (isset($a_attribs[
'ending_time'])) {
148 $this->time_target[
'ending_time'] = $a_attribs[
'ending_time'];
151 if ($a_attribs[
'ending_time'] < $a_attribs[
'starting_time']) {
157 $this->time_target[
'changeable'] = $a_attribs[
'changeable'];
160 if (isset($a_attribs[
'starting_time'])) {
161 $this->time_target[
'suggestion_start'] = $a_attribs[
'starting_time'];
163 if (isset($a_attribs[
'ending_time'])) {
164 $this->time_target[
'suggestion_end'] = $a_attribs[
'ending_time'];
166 if (isset($a_attribs[
'earliest_start'])) {
167 $this->time_target[
'earliest_start'] = $a_attribs[
'earliest_start'];
169 if (isset($a_attribs[
'latest_end'])) {
170 $this->time_target[
'latest_end'] = $a_attribs[
'latest_end'];
173 if ($a_attribs[
'latest_end'] < $a_attribs[
'earliest_start']) {
176 if ($a_attribs[
'ending_time'] < $a_attribs[
'starting_time']) {
224 $this->
__addReference($this->ref_id, $this->parent_id, $this->time_target);
241 if ($a_data !=
"\n") {
243 $a_data = preg_replace(
"/\t+/",
" ", $a_data);
245 $this->cdata .= $a_data;
252 $this->object_data[$this->curr_obj][$a_name] = $a_value;
260 $reference[
'ref_id'] = $a_ref_id;
261 $reference[
'parent_id'] = $a_parent_id;
262 $reference[
'time_target'] = $a_time_target;
264 if (isset($reference[
'time_target'][
'changeable']) and $reference[
'time_target'][
'changeable']) {
265 if (!isset($reference[
'time_target'][
'earliest_start']) or !isset($reference[
'time_target'][
'latest_end'])) {
266 throw new ilObjectXMLException(
'Missing attributes: "earliest_start" and "latest_end" required for attribute "changeable"');
268 if (!isset($reference[
'time_target'][
'suggestion_start']) or !isset($reference[
'time_target'][
'suggestion_end'])) {
269 throw new ilObjectXMLException(
'Missing attributes: "starting_time" and "ending_time" required for attribute "changeable"');
271 if (($reference[
'time_target'][
'earliest_start'] < $reference[
'time_target'][
'suggestion_start']) or
272 ($reference[
'time_target'][
'earliest_start'] > $reference[
'time_target'][
'suggestion_end'])) {
273 throw new ilObjectXMLException(
'Invalid attributes: "earliest_start" must be within "starting_time" and "ending_time"');
275 if (($reference[
'time_target'][
'latest_end'] < $reference[
'time_target'][
'suggestion_start']) or
276 ($reference[
'time_target'][
'latest_end'] > $reference[
'time_target'][
'suggestion_end'])) {
277 throw new ilObjectXMLException(
'Invalid attributes: "latest_end" must be within "starting_time" and "ending_time"');
281 $this->object_data[$this->curr_obj][
'references'][] = $reference;
handlerEndTag($a_xml_parser, $a_name)
handler for end of element
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
Exception class for ObjectXMLWriter and ObjectXMLParser.
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
__construct($a_xml_data='', $throwException=false)
Constructor.
Create styles array
The data for the language used.
__addReference($a_ref_id, $a_parent_id, $a_time_target)
setHandlers($a_xml_parser)
set event handlers
parse($a_xml_parser, $a_fp=null)
parse xml file
setXMLContent($a_xml_content)
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
__addProperty($a_name, $a_value)