ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAdvancedMDParser Class Reference

Adv MD XML Parser. More...

+ Inheritance diagram for ilAdvancedMDParser:
+ Collaboration diagram for ilAdvancedMDParser:

Public Member Functions

 __construct ($a_obj_id, $a_mapping)
 
 setHandlers ($a_xml_parser)
 
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 Start element handler. More...
 
 handlerEndTag ($a_xml_parser, $a_name)
 End element handler. More...
 
 handlerCharacterData ($a_xml_parser, $a_data)
 Character data handler. More...
 
 getFieldIds ()
 
- Public Member Functions inherited from ilMDSaxParser
 ilMDSaxParser ($a_xml_file='')
 Constructor. More...
 
 enableMDParsing ($a_status)
 
 getMDParsingStatus ()
 
 setMDObject (&$md)
 
getMDObject ()
 
 inMetaData ()
 
 setHandlers ($a_xml_parser)
 set event handlers 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...
 
 __getCharacterData ()
 
 __pushParent (&$md_obj)
 
__popParent ()
 
__getParent ()
 
 ilMDSaxParser ($a_xml_file='')
 Constructor. More...
 
 setMDObject (&$md)
 
 inMetaData ()
 
 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...
 
 __getCharacterData ()
 
 __pushParent (&$md_obj)
 
__popParent ()
 
__getParent ()
 
- 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...
 

Protected Member Functions

 initValue ($a_import_id, $a_sub_type="", $a_sub_id=0)
 
- Protected Member Functions inherited from ilSaxParser
 handleError ($message, $code)
 use given error handler to handle error message or internal ilias error message handle More...
 

Protected Attributes

 $obj_id
 
 $rec_id
 
 $mapping
 
 $current_value
 
 $cdata
 
 $field_ids
 

Additional Inherited Members

- Data Fields inherited from ilMDSaxParser
 $md_in_md = false
 
 $md_chr_data = ''
 
 $md_cur_el = null
 
 $md_parsing_enabled = null
 
 $md = null
 
 $md_gen
 
- 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()
 

Detailed Description

Adv MD XML Parser.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
Id
class.ilCourseXMLParser.php 53320 2014-09-12 11:33:49Z fwolf

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

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDParser::__construct (   $a_obj_id,
  $a_mapping 
)

Definition at line 26 of file class.ilAdvancedMDParser.php.

27  {
28  parent::__construct();
29 
30  $parts = explode(":", $a_obj_id);
31  $this->obj_id = $parts[0];
32  $this->mapping = $a_mapping;
33  }

Member Function Documentation

◆ getFieldIds()

ilAdvancedMDParser::getFieldIds ( )

Definition at line 123 of file class.ilAdvancedMDParser.php.

References $field_ids.

124  {
125  return $this->field_ids;
126  }

◆ handlerBeginTag()

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

Start element handler.

public

Parameters
resource$a_xml_parserxml parser
string$a_nameelement name
array$a_attribselement attributes array

Implements ilSaxSubsetParser.

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

References initValue().

50  {
51  switch($a_name)
52  {
53  case 'AdvancedMetaData':
54  break;
55 
56  case 'Value':
57  $this->initValue($a_attribs['id'], $a_attribs['sub_type'], $a_attribs['sub_id']);
58  break;
59  }
60  }
initValue($a_import_id, $a_sub_type="", $a_sub_id=0)
+ Here is the call graph for this function:

◆ handlerCharacterData()

ilAdvancedMDParser::handlerCharacterData (   $a_xml_parser,
  $a_name 
)

Character data handler.

public

Parameters
resource$a_xml_parserxml parser
string$a_datacharacter data

Implements ilSaxSubsetParser.

Definition at line 81 of file class.ilAdvancedMDParser.php.

82  {
83  if($a_data != "\n")
84  {
85  // Replace multiple tabs with one space
86  $a_data = preg_replace("/\t+/"," ",$a_data);
87 
88  $this->cdata .= $a_data;
89  }
90  }

◆ handlerEndTag()

ilAdvancedMDParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

End element handler.

public

Parameters
resource$a_xml_parserxml parser
string$a_nameelement name

Implements ilSaxSubsetParser.

Definition at line 62 of file class.ilAdvancedMDParser.php.

63  {
64  switch($a_name)
65  {
66  case 'AdvancedMetaData':
67  break;
68 
69  case 'Value':
70  $value = trim($this->cdata);
71  if(is_object($this->current_value) && $value != "")
72  {
73  $this->current_value->setValue($value);
74  $this->current_value->save();
75  }
76  break;
77  }
78  $this->cdata = '';
79  }

◆ initValue()

ilAdvancedMDParser::initValue (   $a_import_id,
  $a_sub_type = "",
  $a_sub_id = 0 
)
protected

Definition at line 92 of file class.ilAdvancedMDParser.php.

References ilAdvancedMDFieldDefinition\_lookupFieldId().

Referenced by handlerBeginTag().

93  {
94  $this->current_value = null;
95 
96  if($field_id = ilAdvancedMDFieldDefinition::_lookupFieldId($a_import_id))
97  {
98  $new_parent_id = $this->mapping->getMapping("Services/AdvancedMetaData", "parent", $this->obj_id);
99  if(!$new_parent_id)
100  {
101  return;
102  }
103 
104  if($a_sub_type)
105  {
106  $new_sub_id = $this->mapping->getMapping("Services/AdvancedMetaData", "advmd_sub_item", "advmd:".$a_sub_type.":".$a_sub_id);
107  if(!$new_sub_id)
108  {
109  return;
110  }
111  $md_value = new ilAdvancedMDValue($field_id, $new_parent_id, $a_sub_type, $new_sub_id);
112  }
113  else
114  {
115  $md_value = new ilAdvancedMDValue($field_id, $new_parent_id);
116  }
117  $this->current_value = $md_value;
118 
119  $this->field_ids[$new_parent_id][$a_sub_type][] = $field_id;
120  }
121  }
static _lookupFieldId($a_import_id)
Lookup field id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setHandlers()

ilAdvancedMDParser::setHandlers (   $a_xml_parser)

Definition at line 35 of file class.ilAdvancedMDParser.php.

36  {
37  $this->sax_controller = new ilSaxController();
38  $this->sax_controller->setHandlers($a_xml_parser);
39  $this->sax_controller->setDefaultElementHandler($this);
40 
41  /* the value parser does not support sub-types and object-specific record selection
42  include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDValueParser.php');
43  $this->sax_controller->setElementHandler(
44  $this->adv_md_handler = new ilAdvancedMDValueParser($this->obj_id),
45  'AdvancedMetaData');
46  */
47  }
Controller class for sax element handlers.

Field Documentation

◆ $cdata

ilAdvancedMDParser::$cdata
protected

Definition at line 23 of file class.ilAdvancedMDParser.php.

◆ $current_value

ilAdvancedMDParser::$current_value
protected

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

◆ $field_ids

ilAdvancedMDParser::$field_ids
protected

Definition at line 24 of file class.ilAdvancedMDParser.php.

Referenced by getFieldIds().

◆ $mapping

ilAdvancedMDParser::$mapping
protected

Definition at line 21 of file class.ilAdvancedMDParser.php.

◆ $obj_id

ilAdvancedMDParser::$obj_id
protected

Definition at line 19 of file class.ilAdvancedMDParser.php.

◆ $rec_id

ilAdvancedMDParser::$rec_id
protected

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


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