24 require_once(
"./Services/Xml/classes/class.ilSaxParser.php");
51 $this->parent_cnt = 0;
52 $this->
parent[$this->parent_cnt] = $a_parent;
56 parent::__construct($a_xml_file);
67 xml_set_object($a_xml_parser,$this);
68 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
69 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
77 parent::startParsing();
98 while (list($k,$v) = each($attr))
99 $tag.=
" ".$k.
"=\"$v\"";
114 global $rbacadmin, $rbacreview, $rbacsystem;
119 $cur_parent = $this->
parent[$this->parent_cnt - 1];
120 require_once(
"Modules/Category/classes/class.ilObjCategory.php");
122 $this->category->
setImportId($a_attribs[
"Id"].
" (#".$cur_parent.
")");
123 $this->default_language = $a_attribs[
"DefaultLanguage"];
124 $this->category->setTitle($a_attribs[
"Id"]);
125 $this->category->create();
126 $this->category->createReference();
127 $this->category->putInTree($cur_parent);
128 $this->
parent[$this->parent_cnt++] = $this->category->getRefId();
132 $this->cur_spec_lang = $a_attribs[
"Language"];
145 global
$ilias, $rbacadmin;
150 unset($this->category);
151 unset($this->
parent[$this->parent_cnt - 1]);
157 if ($this->cur_spec_lang == $this->default_language)
159 $this->category->setTitle($this->cur_title);
160 $this->category->setDescription($this->cur_description);
161 $this->category->update();
164 $this->category->addTranslation($this->cur_title,
165 $this->cur_description, $this->cur_spec_lang, $is_def);
169 $this->cur_title = $this->cdata;
173 $this->cur_description = $this->cdata;
189 $a_data = str_replace(
"<",
"<",$a_data);
190 $a_data = str_replace(
">",
">",$a_data);
193 $a_data = preg_replace(
"/\n/",
"",$a_data);
194 $a_data = preg_replace(
"/\t+/",
"",$a_data);
197 $this->cdata .= $a_data;
buildTag($type, $name, $attr="")
generate a tag with given name and attributes
setHandlers($a_xml_parser)
set event handler should be overwritten by inherited class private
handlerEndTag($a_xml_parser, $a_name)
handler for end of element
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
startParsing()
start the parser
setImportId($a_import_id)
set import id
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
__construct($a_xml_file, $a_parent, $withrol)
Constructor.