ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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)
 Character data handler. 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_name)
 Character data handler. More...
 

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

92 {
93 switch ($a_name) {
94 case 'AdvancedMetaData':
95 $this->values_records = ilAdvancedMDValues::getInstancesForObjectId($this->obj_id);
96 foreach ($this->values_records as $values_record) {
97 // init ADTGroup before definitions to bind definitions to group
98 $values_record->getADTGroup();
99
100 foreach ($values_record->getDefinitions() as $def) {
101 $this->values[$def->getImportId()] = $def;
102 }
103 }
104 break;
105
106 case 'Value':
107 $this->initValue($a_attribs['id']);
108 break;
109 }
110 }
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 143 of file class.ilAdvancedMDValueParser.php.

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

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

121 {
122 switch ($a_name) {
123 case 'AdvancedMetaData':
124 break;
125
126 case 'Value':
127 $value = trim($this->cdata);
128 if (is_object($this->current_value) && $value) {
129 $this->current_value->importValueFromXML($value);
130 }
131 break;
132 }
133 $this->cdata = '';
134 }

◆ initValue()

ilAdvancedMDValueParser::initValue (   $a_import_id)
private

init new value object

@access private

Parameters
stringimport id

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

161 {
162 if (isset($this->values[$a_import_id])) {
163 $this->current_value = $this->values[$a_import_id];
164 } else {
165 $this->current_value = null;
166 }
167 }

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 $values_record->write();
78 }
79 return true;
80 }

◆ 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: