ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilStyleImportParser Class Reference

Style Import Parser. More...

+ Inheritance diagram for ilStyleImportParser:
+ Collaboration diagram for ilStyleImportParser:

Public Member Functions

 __construct ($a_xml_file, &$a_style_obj)
 Constructor. More...
 
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class private More...
 
 startParsing ()
 start the parser More...
 
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element More...
 
 handlerEndTag ($a_xml_parser, $a_name)
 handler for end of element More...
 
 handlerCharacterData ($a_xml_parser, $a_data)
 handler for character data More...
 
- Public Member Functions inherited from ilSaxParser
 __construct ($a_xml_file='', $throwException=false)
 Constructor setup ILIAS global object public. More...
 
 setXMLContent ($a_xml_content)
 
 getXMLContent ()
 
 getInputType ()
 
 startParsing ()
 stores xml data in array More...
 
 createParser ()
 create parser More...
 
 setOptions ($a_xml_parser)
 set parser options More...
 
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class private More...
 
 openXMLFile ()
 open xml file More...
 
 parse ($a_xml_parser, $a_fp=null)
 parse xml file More...
 
 freeParser ($a_xml_parser)
 free xml parser handle More...
 
 setThrowException ($throwException)
 set error handling More...
 
- Public Member Functions inherited from PEAR
 __construct ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes. More...
 
 isError ($data, $code=null)
 Tell whether a value is a PEAR error. More...
 
 expectError ($code=' *')
 This method is used to tell which errors you expect to get. More...
 
 popExpect ()
 This method pops one element off the expected error codes stack. More...
 
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available. More...
 
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack. More...
 
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. More...
 
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options. More...
 
 staticPushErrorHandling ($mode, $options=null)
 
 staticPopErrorHandling ()
 
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack. More...
 
 popErrorHandling ()
 Pop the last error handler used. More...
 
 loadExtension ($ext)
 OS independant PHP extension load. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from PEAR
static & getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. More...
 
static setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 
- Data Fields inherited from ilSaxParser
 $input_type = null
 
 $xml_content = ''
 
 $ilias
 
 $lng
 
 $xml_file
 
 $throwException = false
 
- Data Fields inherited from PEAR
 $_debug = false
 
 $_default_error_mode = null
 
 $_default_error_options = null
 
 $_default_error_handler = ''
 
 $_error_class = 'PEAR_Error'
 
 $_expected_errors = array()
 
- Protected Member Functions inherited from ilSaxParser
 handleError ($message, $code)
 use given error handler to handle error message or internal ilias error message handle More...
 

Detailed Description

Style Import Parser.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 16 of file class.ilStyleImportParser.php.

Constructor & Destructor Documentation

◆ __construct()

ilStyleImportParser::__construct (   $a_xml_file,
$a_style_obj 
)

Constructor.

Parameters
string$a_xml_filexml file
int$a_modeIL_EXTRACT_ROLES | IL_USER_IMPORT

public

Definition at line 27 of file class.ilStyleImportParser.php.

References ilSaxParser\$lng.

28  {
29  global $lng, $tree;
30 
31  $this->style_obj = $a_style_obj;
32 
33  parent::__construct($a_xml_file);
34  }

Member Function Documentation

◆ handlerBeginTag()

ilStyleImportParser::handlerBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element

Definition at line 64 of file class.ilStyleImportParser.php.

References array.

65  {
66 
67  switch($a_name)
68  {
69  case "Style":
70  $this->current_tag = $a_attribs["Tag"];
71  $this->current_class = $a_attribs["Class"];
72  $this->current_type = $a_attribs["Type"];
73  if ($this->current_class == "PageTitle" && $this->current_type == "page_title" && $this->current_tag == "div")
74  {
75  $this->current_tag = "h1";
76  }
77  if ($this->current_class == "Headline1" && $this->current_tag == "div")
78  {
79  $this->current_tag = "h1";
80  $this->current_type = "heading1";
81  }
82  if ($this->current_class == "Headline2" && $this->current_tag == "div")
83  {
84  $this->current_tag = "h2";
85  $this->current_type = "heading2";
86  }
87  if ($this->current_class == "Headline3" && $this->current_tag == "div")
88  {
89  $this->current_tag = "h3";
90  $this->current_type = "heading3";
91  }
92  $this->current_tags = array();
93  $this->chars[] = array("type" => $this->current_type,
94  "class" => $this->current_class);
95  break;
96 
97  case "StyleParameter":
98  $this->current_tags[] = array(
99  "tag" => $this->current_tag,
100  "class" => $this->current_class,
101  "parameter" => $a_attribs["Name"],
102  "type" => $this->current_type,
103  "value" => $a_attribs["Value"],
104  "custom" => $a_attribs["Custom"]);
105  break;
106 
107  case "StyleColor":
108  $this->style_obj->addColor($a_attribs["Name"], $a_attribs["Code"]);
109  break;
110 
111  case "StyleTemplate":
112  $this->cur_template = array("type" => $a_attribs["Type"],
113  "name" => $a_attribs["Name"]);
114  $this->cur_template_classes = array();
115  break;
116 
117  case "StyleTemplateClass":
118  $this->cur_template_classes[$a_attribs["ClassType"]] =
119  $a_attribs["Class"];
120  break;
121 
122  }
123  $this->cdata = "";
124  }
Create styles array
The data for the language used.

◆ handlerCharacterData()

ilStyleImportParser::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

handler for character data

Definition at line 157 of file class.ilStyleImportParser.php.

158  {
159  // i don't know why this is necessary, but
160  // the parser seems to convert "&gt;" to ">" and "&lt;" to "<"
161  // in character data, but we don't want that, because it's the
162  // way we mask user html in our content, so we convert back...
163  $a_data = str_replace("<","&lt;",$a_data);
164  $a_data = str_replace(">","&gt;",$a_data);
165 
166  // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
167  $a_data = preg_replace("/\n/","",$a_data);
168  $a_data = preg_replace("/\t+/","",$a_data);
169  if(!empty($a_data))
170  {
171  $this->cdata .= $a_data;
172  }
173  }

◆ handlerEndTag()

ilStyleImportParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element

Definition at line 130 of file class.ilStyleImportParser.php.

131  {
132  switch($a_name)
133  {
134  case "Title":
135  $this->style_obj->setTitle($this->cdata);
136  break;
137 
138  case "Description":
139  $this->style_obj->setDescription($this->cdata);
140  break;
141 
142  case "Style":
143  $this->styles[] = $this->current_tags;
144  break;
145 
146  case "StyleTemplate":
147  $this->style_obj->addTemplate($this->cur_template["type"],
148  $this->cur_template["name"], $this->cur_template_classes);
149  break;
150 
151  }
152  }

◆ setHandlers()

ilStyleImportParser::setHandlers (   $a_xml_parser)

set event handler should be overwritten by inherited class private

Definition at line 42 of file class.ilStyleImportParser.php.

43  {
44  xml_set_object($a_xml_parser,$this);
45  xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
46  xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
47  }

◆ startParsing()

ilStyleImportParser::startParsing ( )

start the parser

Definition at line 52 of file class.ilStyleImportParser.php.

References array.

53  {
54  $this->styles = array();
55  parent::startParsing();
56  $this->style_obj->setStyle($this->styles);
57  $this->style_obj->setCharacteristics($this->chars);
58  }
Create styles array
The data for the language used.

The documentation for this class was generated from the following file: