ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilAdvancedMDValueParser Class Reference
+ Inheritance diagram for ilAdvancedMDValueParser:
+ Collaboration diagram for ilAdvancedMDValueParser:

Public Member Functions

 __construct ($a_new_obj_id=0)
 Constructor. More...
 
 setObjId ($a_obj_id)
 Set object id (id of new created object) More...
 
 save ()
 Save values @access public. More...
 
 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)
 
 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_name)
 

Protected Attributes

 $cdata = ''
 
 $obj_id
 
 $values_records = array()
 
 $values = array()
 
 $current_value = null
 

Private Member Functions

 initValue ($a_import_id)
 init new value object More...
 

Detailed Description

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 37 of file class.ilAdvancedMDValueParser.php.

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDValueParser::__construct (   $a_new_obj_id = 0)

Constructor.

@access public

Parameters

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

53 {
54 $this->obj_id = $a_new_obj_id;
55 }

Member Function Documentation

◆ handlerBeginTag()

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

Start element handler.

@access public

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

Implements ilSaxSubsetParser.

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

93 {
94 switch($a_name)
95 {
96 case 'AdvancedMetaData':
97 $this->values_records = ilAdvancedMDValues::getInstancesForObjectId($this->obj_id);
98 foreach($this->values_records as $values_record)
99 {
100 // init ADTGroup before definitions to bind definitions to group
101 $values_record->getADTGroup();
102
103 foreach($values_record->getDefinitions() as $def)
104 {
105 $this->values[$def->getImportId()] = $def;
106 }
107 }
108 break;
109
110 case 'Value':
111 $this->initValue($a_attribs['id']);
112 break;
113 }
114
115 }
initValue($a_import_id)
init new value object
static getInstancesForObjectId($a_obj_id, $a_obj_type=null, $a_sub_type="-", $a_sub_id=0)
Get instances for given object id.

References ilAdvancedMDValues\getInstancesForObjectId(), and initValue().

+ Here is the call graph for this function:

◆ handlerCharacterData()

ilAdvancedMDValueParser::handlerCharacterData (   $a_xml_parser,
  $a_data 
)
Character data handler

@access public
Parameters
resource$a_xml_parserxml parser
string$a_datacharacter data

Implements ilSaxSubsetParser.

Definition at line 150 of file class.ilAdvancedMDValueParser.php.

151 {
152 if($a_data != "\n")
153 {
154 // Replace multiple tabs with one space
155 $a_data = preg_replace("/\t+/"," ",$a_data);
156
157 $this->cdata .= $a_data;
158 }
159 }

◆ handlerEndTag()

ilAdvancedMDValueParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

End element handler.

@access public

Parameters
resource$a_xml_parserxml parser
string$a_nameelement name

Implements ilSaxSubsetParser.

Definition at line 125 of file class.ilAdvancedMDValueParser.php.

126 {
127 switch($a_name)
128 {
129 case 'AdvancedMetaData':
130 break;
131
132 case 'Value':
133 $value = trim($this->cdata);
134 if(is_object($this->current_value) && $value)
135 {
136 $this->current_value->importValueFromXML($value);
137 }
138 break;
139 }
140 $this->cdata = '';
141 }

◆ initValue()

ilAdvancedMDValueParser::initValue (   $a_import_id)
private

init new value object

@access private

Parameters
stringimport id

Definition at line 168 of file class.ilAdvancedMDValueParser.php.

169 {
170 if(isset($this->values[$a_import_id]))
171 {
172 $this->current_value = $this->values[$a_import_id];
173 }
174 else
175 {
176 $this->current_value = null;
177 }
178
179 }

Referenced by handlerBeginTag().

+ Here is the caller graph for this function:

◆ save()

ilAdvancedMDValueParser::save ( )

Save values @access public.

Definition at line 74 of file class.ilAdvancedMDValueParser.php.

75 {
76 foreach($this->values_records as $values_record)
77 {
78 $values_record->write();
79 }
80 return true;
81 }

◆ setObjId()

ilAdvancedMDValueParser::setObjId (   $a_obj_id)

Set object id (id of new created object)

@access public

Parameters
intobj_id

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

65 {
66 $this->obj_id = $a_obj_id;
67 }

Field Documentation

◆ $cdata

ilAdvancedMDValueParser::$cdata = ''
protected

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

◆ $current_value

ilAdvancedMDValueParser::$current_value = null
protected

Definition at line 43 of file class.ilAdvancedMDValueParser.php.

◆ $obj_id

ilAdvancedMDValueParser::$obj_id
protected

Definition at line 40 of file class.ilAdvancedMDValueParser.php.

◆ $values

ilAdvancedMDValueParser::$values = array()
protected

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

◆ $values_records

ilAdvancedMDValueParser::$values_records = array()
protected

Definition at line 41 of file class.ilAdvancedMDValueParser.php.


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