24 require_once(
"./Services/Xml/classes/class.ilSaxParser.php");
68 $this->rbacadmin = $DIC->rbac()->admin();
69 $this->rbacreview = $DIC->rbac()->review();
70 $this->rbacsystem = $DIC->rbac()->system();
71 $this->parent_cnt = 0;
72 $this->
parent[$this->parent_cnt] = $a_parent;
76 parent::__construct($a_xml_file);
87 xml_set_object($a_xml_parser, $this);
88 xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
89 xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
97 parent::startParsing();
111 if (
$type ==
"end") {
117 if (is_array($attr)) {
118 foreach ($attr as $k => $v) {
119 $tag .=
" " . $k .
"=\"$v\"";
139 $cur_parent = $this->
parent[$this->parent_cnt - 1];
140 require_once(
"Modules/Category/classes/class.ilObjCategory.php");
142 $this->category->
setImportId($a_attribs[
"Id"] .
" (#" . $cur_parent .
")");
143 $this->default_language = $a_attribs[
"DefaultLanguage"];
144 $this->category->setTitle($a_attribs[
"Id"]);
145 $this->category->create();
146 $this->category->createReference();
147 $this->category->putInTree($cur_parent);
148 $this->
parent[$this->parent_cnt++] = $this->category->getRefId();
152 $this->cur_spec_lang = $a_attribs[
"Language"];
166 unset($this->category);
167 unset($this->
parent[$this->parent_cnt - 1]);
173 if ($this->cur_spec_lang == $this->default_language) {
174 $this->category->setTitle($this->cur_title);
175 $this->category->setDescription($this->cur_description);
176 $this->category->update();
179 $this->category->addTranslation(
181 $this->cur_description,
182 $this->cur_spec_lang,
188 $this->cur_title = $this->cdata;
192 $this->cur_description = $this->cdata;
208 $a_data = str_replace(
"<",
"<", $a_data);
209 $a_data = str_replace(
">",
">", $a_data);
212 $a_data = preg_replace(
"/\n/",
"", $a_data);
213 $a_data = preg_replace(
"/\t+/",
"", $a_data);
214 if (!empty($a_data)) {
215 $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.
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag