ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
ilObjDefReader Class Reference

Component definition reader (reads common tags in module.xml and service.xml files) Name is misleading and should be ilComponentDefReader instead. More...

+ Inheritance diagram for ilObjDefReader:
+ Collaboration diagram for ilObjDefReader:

Public Member Functions

 ilObjDefReader ($a_path, $a_name, $a_type)
 
 setHandlers ($a_xml_parser)
 
 clearTables ()
 clear the tables More...
 
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 Start tag handler. More...
 
 handlerEndTag ($a_xml_parser, $a_name)
 End tag handler. More...
 
 handlerCharacterData ($a_xml_parser, $a_data)
 end tag handler More...
 
- Public Member Functions inherited from ilSaxParser
 ilSaxParser ($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
 PEAR ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
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...
 
 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...
 
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. 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...
 

Static Public Member Functions

static deleteObjectDefinition ($a_id)
 Delete an object definition (this is currently needed for test cases) More...
 

Protected Attributes

 $readers
 
 $current_reader = null
 

Additional Inherited Members

- 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

Component definition reader (reads common tags in module.xml and service.xml files) Name is misleading and should be ilComponentDefReader instead.

Reads reads module information of modules.xml files into db

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

Definition at line 15 of file class.ilObjDefReader.php.

Member Function Documentation

◆ clearTables()

ilObjDefReader::clearTables ( )

clear the tables

Definition at line 49 of file class.ilObjDefReader.php.

References $ilDB, and $reader.

50  {
51  global $ilDB;
52 
53  $ilDB->manipulate("DELETE FROM il_object_def");
54 
55  $ilDB->manipulate("DELETE FROM il_object_subobj");
56 
57  $ilDB->manipulate("DELETE FROM il_object_group");
58 
59  $ilDB->manipulate("DELETE FROM il_pluginslot");
60 
61  $ilDB->manipulate("DELETE FROM il_component");
62 
63  $ilDB->manipulate("DELETE FROM il_event_handling");
64 
65  $ilDB->manipulate("DELETE FROM il_object_sub_type");
66 
67  foreach ($this->readers as $k => $reader)
68  {
69  $this->readers[$k]["reader"]->clearTables();
70  }
71  }
global $ilDB

◆ deleteObjectDefinition()

static ilObjDefReader::deleteObjectDefinition (   $a_id)
static

Delete an object definition (this is currently needed for test cases)

Definition at line 76 of file class.ilObjDefReader.php.

References $ilDB.

77  {
78  global $ilDB;
79 
80  $ilDB->manipulateF("DELETE FROM il_object_def WHERE id = %s",
81  array("text"), array($a_id));
82 
83  $ilDB->manipulateF("DELETE FROM il_object_subobj WHERE parent = %s OR subobj = %s",
84  array("text", "text"), array($a_id, $a_id));
85  }
global $ilDB

◆ handlerBeginTag()

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

Start tag handler.

Parameters
ressouceinternal xml_parser_handler
stringelement tag name
arrayelement attributes

Definition at line 94 of file class.ilObjDefReader.php.

References $current_reader, $ilDB, and ilCronManager\updateFromXML().

95  {
96  global $ilDB;
97 
98  $this->current_tag = $a_name;
99 
100  // check if a special reader needs to be activated
101  if (isset($this->readers[$a_name]))
102  {
103  $this->current_reader = $a_name;
104  }
105 
106  // call special reader
107  if ($this->current_reader != "")
108  {
109  $this->readers[$this->current_reader]["reader"]->handlerBeginTag($a_xml_parser,$a_name,$a_attribs,
110  $this->current_component);
111  }
112  else
113  {
114  // default handling
115  switch ($a_name)
116  {
117  case 'object':
118 
119  // if attributes are not given, set default (repository only)
120  if($a_attribs["repository"] === NULL)
121  {
122  $a_attribs["repository"] = true;
123  }
124  if($a_attribs["workspace"] === NULL)
125  {
126  $a_attribs["workspace"] = false;
127  }
128 
129  $this->current_object = $a_attribs["id"];
130  $ilDB->manipulateF("INSERT INTO il_object_def (id, class_name, component,location,".
131  "checkbox,inherit,translate,devmode,allow_link,allow_copy,rbac,default_pos,".
132  "default_pres_pos,sideblock,grp,system,export,repository,workspace,administration,amet) VALUES ".
133  "(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",
134  array("text", "text", "text", "text", "integer", "integer", "text", "integer","integer","integer",
135  "integer","integer","integer","integer", "text", "integer", "integer", "integer", "integer",'integer','integer'),
136  array(
137  $a_attribs["id"],
138  $a_attribs["class_name"],
139  $this->current_component,
140  $this->current_component."/".$a_attribs["dir"],
141  (int) $a_attribs["checkbox"],
142  (int) $a_attribs["inherit"],
143  $a_attribs["translate"],
144  (int) $a_attribs["devmode"],
145  (int) $a_attribs["allow_link"],
146  (int) $a_attribs["allow_copy"],
147  (int) $a_attribs["rbac"],
148  (int) $a_attribs["default_pos"],
149  (int) $a_attribs["default_pres_pos"],
150  (int) $a_attribs["sideblock"],
151  $a_attribs["group"],
152  (int) $a_attribs["system"],
153  (int) $a_attribs["export"],
154  (int) $a_attribs["repository"],
155  (int) $a_attribs["workspace"],
156  (int) $a_attribs['administration'],
157  (int) $a_attribs['amet']
158  ));
159  break;
160 
161  case "subobj":
162  $ilDB->manipulateF("INSERT INTO il_object_subobj (parent, subobj, mmax) VALUES (%s,%s,%s)",
163  array("text", "text", "integer"),
164  array($this->current_object, $a_attribs["id"], (int) $a_attribs["max"]));
165  break;
166 
167  case "parent":
168  $ilDB->manipulateF("INSERT INTO il_object_subobj (parent, subobj, mmax) VALUES (%s,%s,%s)",
169  array("text", "text", "integer"),
170  array($a_attribs["id"], $this->current_object, (int) $a_attribs["max"]));
171  break;
172 
173  case "objectgroup":
174  $ilDB->manipulateF("INSERT INTO il_object_group (id, name, default_pres_pos) VALUES (%s,%s,%s)",
175  array("text", "text", "integer"),
176  array($a_attribs["id"], $a_attribs["name"], $a_attribs["default_pres_pos"]));
177  break;
178 
179  case "pluginslot":
180  $this->current_object = $a_attribs["id"];
181  $q = "INSERT INTO il_pluginslot (component, id, name) VALUES (".
182  $ilDB->quote($this->current_component, "text").",".
183  $ilDB->quote($a_attribs["id"], "text").",".
184  $ilDB->quote($a_attribs["name"], "text").")";
185  $ilDB->manipulate($q);
186  break;
187 
188  case "event":
189  $component = $a_attribs["component"];
190  if(!$component)
191  {
192  $component = $this->current_component;
193  }
194  $q = "INSERT INTO il_event_handling (component, type, id) VALUES (".
195  $ilDB->quote($component, "text").",".
196  $ilDB->quote($a_attribs["type"], "text").",".
197  $ilDB->quote($a_attribs["id"], "text").")";
198  $ilDB->manipulate($q);
199  break;
200 
201  case "cron":
202  $component = $a_attribs["component"];
203  if(!$component)
204  {
205  $component = $this->current_component;
206  }
207  include_once "Services/Cron/classes/class.ilCronManager.php";
208  ilCronManager::updateFromXML($component, $a_attribs["id"], $a_attribs["class"], $a_attribs["path"]);
209  $this->has_cron[$component][] = $a_attribs["id"];
210  break;
211 
212  case "sub_type":
213  $ilDB->manipulate("INSERT INTO il_object_sub_type ".
214  "(obj_type, sub_type, amet) VALUES (".
215  $ilDB->quote($this->current_object, "text").",".
216  $ilDB->quote($a_attribs["id"], "text").",".
217  $ilDB->quote($a_attribs["amet"], "integer").
218  ")");
219  break;
220  }
221  }
222  }
static updateFromXML($a_component, $a_id, $a_class, $a_path=null)
Process data from module.xml/service.xml.
global $ilDB
+ Here is the call graph for this function:

◆ handlerCharacterData()

ilObjDefReader::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

end tag handler

Parameters
ressouceinternal xml_parser_handler
stringdata private

Definition at line 263 of file class.ilObjDefReader.php.

264  {
265  // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
266  $a_data = preg_replace("/\n/","",$a_data);
267  $a_data = preg_replace("/\t+/","",$a_data);
268 
269  if (!empty($a_data))
270  {
271  switch ($this->current_tag)
272  {
273  case '':
274  }
275  }
276  }

◆ handlerEndTag()

ilObjDefReader::handlerEndTag (   $a_xml_parser,
  $a_name 
)

End tag handler.

Parameters
objectinternal xml_parser_handler
stringelement tag name

Definition at line 230 of file class.ilObjDefReader.php.

References $current_reader, and ilCronManager\clearFromXML().

231  {
232  // call special reader
233  if ($this->current_reader != "")
234  {
235  $this->readers[$this->current_reader]["reader"]->handlerEndTag($a_xml_parser,$a_name);
236  }
237  else
238  {
239  // cron
240  if($a_name == "module" || $a_name == "service")
241  {
242  include_once "Services/Cron/classes/class.ilCronManager.php";
243  ilCronManager::clearFromXML($this->current_component,
244  (array)$this->has_cron[$this->current_component]);
245  }
246  }
247 
248  // check if a special reader needs to be activated
249  if (isset($this->readers[$a_name]))
250  {
251  $this->current_reader = null;
252  }
253  }
static clearFromXML($a_component, array $a_xml_job_ids)
Clear job data.
+ Here is the call graph for this function:

◆ ilObjDefReader()

ilObjDefReader::ilObjDefReader (   $a_path,
  $a_name,
  $a_type 
)

Definition at line 22 of file class.ilObjDefReader.php.

References $reader.

23  {
24  // init specialized readers
25  foreach ($this->readers as $k => $reader)
26  {
27  $class = $reader["class"];
28  $class_path = "./setup/classes/class.".$class.".php";
29  include_once($class_path);
30  $this->readers[$k]["reader"] = new $class();
31  }
32 
33  $this->name = $a_name;
34  $this->type = $a_type;
35 //echo "<br>-".$a_path."-".$this->name."-".$this->type."-";
36  parent::ilSaxParser($a_path);
37  }

◆ setHandlers()

ilObjDefReader::setHandlers (   $a_xml_parser)

Definition at line 39 of file class.ilObjDefReader.php.

40  {
41  xml_set_object($a_xml_parser,$this);
42  xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
43  xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
44  }

Field Documentation

◆ $current_reader

ilObjDefReader::$current_reader = null
protected

Definition at line 20 of file class.ilObjDefReader.php.

Referenced by handlerBeginTag(), and handlerEndTag().

◆ $readers

ilObjDefReader::$readers
protected
Initial value:
= array(
"copage" => array("class" => "ilCOPageDefReader")
)

Definition at line 17 of file class.ilObjDefReader.php.


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