24 require_once(
"./Services/Xml/classes/class.ilSaxParser.php");
50 $this->parent_cnt = 0;
51 $this->parent[$this->parent_cnt] = $a_parent;
54 parent::ilSaxParser($a_xml_file);
65 xml_set_object($a_xml_parser,$this);
66 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
67 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
75 parent::startParsing();
96 while (list($k,$v) = each($attr))
97 $tag.=
" ".$k.
"=\"$v\"";
112 global $rbacadmin, $rbacreview, $rbacsystem;
117 $cur_parent = $this->parent[$this->parent_cnt - 1];
118 require_once(
"Modules/Category/classes/class.ilObjCategory.php");
120 $this->category->
setImportId($a_attribs[
"Id"].
" (#".$cur_parent.
")");
121 $this->default_language = $a_attribs[
"DefaultLanguage"];
122 $this->category->setTitle($a_attribs[
"Id"]);
123 $this->category->create();
124 $this->category->createReference();
125 $this->category->putInTree($cur_parent);
126 $this->parent[$this->parent_cnt++] = $this->category->getRefId();
130 $this->cur_spec_lang = $a_attribs[
"Language"];
143 global
$ilias, $rbacadmin;
148 unset($this->category);
149 unset($this->parent[$this->parent_cnt - 1]);
155 if ($this->cur_spec_lang == $this->default_language)
157 $this->category->setTitle($this->cur_title);
158 $this->category->setDescription($this->cur_description);
159 $this->category->update();
162 $this->category->addTranslation($this->cur_title,
163 $this->cur_description, $this->cur_spec_lang, $is_def);
167 $this->cur_title = $this->cdata;
171 $this->cur_description = $this->cdata;
187 $a_data = str_replace(
"<",
"<",$a_data);
188 $a_data = str_replace(
">",
">",$a_data);
191 $a_data = preg_replace(
"/\n/",
"",$a_data);
192 $a_data = preg_replace(
"/\t+/",
"",$a_data);
195 $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
ilCategoryImportParser($a_xml_file, $a_parent, $withrol)
Constructor.
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
handlerCharacterData($a_xml_parser, $a_data)
handler for character data