ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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 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)
 Character data handler. More...
 

Protected Attributes

 $cdata = ''
 
 $obj_id
 
 $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.

public

Parameters

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

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

Member Function Documentation

◆ handlerBeginTag()

ilAdvancedMDValueParser::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 92 of file class.ilAdvancedMDValueParser.php.

References initValue().

93  {
94  switch($a_name)
95  {
96  case 'AdvancedMetaData':
97  $this->values = array();
98  break;
99 
100  case 'Value':
101  $this->initValue($a_attribs['id']);
102  break;
103  }
104 
105  }
initValue($a_import_id)
init new value object
+ Here is the call graph for this function:

◆ handlerCharacterData()

ilAdvancedMDValueParser::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

Character data handler.

public

Parameters
resource$a_xml_parserxml parser
string$a_datacharacter data

Implements ilSaxSubsetParser.

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

140  {
141  if($a_data != "\n")
142  {
143  // Replace multiple tabs with one space
144  $a_data = preg_replace("/\t+/"," ",$a_data);
145 
146  $this->cdata .= $a_data;
147  }
148  }

◆ handlerEndTag()

ilAdvancedMDValueParser::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 115 of file class.ilAdvancedMDValueParser.php.

116  {
117  switch($a_name)
118  {
119  case 'AdvancedMetaData':
120  break;
121 
122  case 'Value':
123  if(is_object($this->current_value))
124  {
125  $this->current_value->setValue(trim($this->cdata));
126  }
127  break;
128  }
129  $this->cdata = '';
130  }

◆ initValue()

ilAdvancedMDValueParser::initValue (   $a_import_id)
private

init new value object

private

Parameters
stringimport id

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

References $current_value, and ilAdvancedMDFieldDefinition\_lookupFieldId().

Referenced by handlerBeginTag().

158  {
159  if($field_id = ilAdvancedMDFieldDefinition::_lookupFieldId($a_import_id))
160  {
161  $this->current_value = new ilAdvancedMDValue($field_id,$this->obj_id);
162  $this->values[] = $this->current_value;
163  }
164  else
165  {
166  $this->current_value = null;
167  }
168 
169  }
static _lookupFieldId($a_import_id)
Lookup field id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilAdvancedMDValueParser::save ( )

Save values public.

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

74  {
75  foreach($this->values as $value)
76  {
77  $value->setObjId($this->obj_id);
78  $value->save();
79  }
80  return true;
81  }

◆ setObjId()

ilAdvancedMDValueParser::setObjId (   $a_obj_id)

Set object id (id of new created object)

public

Parameters
intobj_id

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

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

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 42 of file class.ilAdvancedMDValueParser.php.

Referenced by initValue().

◆ $obj_id

ilAdvancedMDValueParser::$obj_id
protected

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

◆ $values

ilAdvancedMDValueParser::$values = array()
protected

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


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