ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
ilAdvancedMDValueParser Class Reference
+ Inheritance diagram for ilAdvancedMDValueParser:
+ Collaboration diagram for ilAdvancedMDValueParser:

Public Member Functions

 __construct (int $a_new_obj_id=0)
 
 setObjId (int $a_obj_id)
 Set object id (id of new created object) More...
 
 save ()
 Save values @access public. More...
 
 handlerBeginTag ($a_xml_parser, string $a_name, array $a_attribs)
 Start element handler @access public. More...
 
 handlerEndTag ($a_xml_parser, string $a_name)
 End element handler @access public. More...
 
 handlerCharacterData ($a_xml_parser, string $a_data)
 Character data handler @access public. More...
 
 handlerBeginTag ($a_xml_parser, string $a_name, array $a_attribs)
 Start element handler. More...
 
 handlerEndTag ($a_xml_parser, string $a_name)
 End element handler. More...
 
 handlerCharacterData ($a_xml_parser, string $a_name)
 Character data handler. More...
 

Protected Attributes

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

Private Member Functions

 initValue (string $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 31 of file class.ilAdvancedMDValueParser.php.

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDValueParser::__construct ( int  $a_new_obj_id = 0)

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

40 {
41 $this->obj_id = $a_new_obj_id;
42 }

Member Function Documentation

◆ handlerBeginTag()

ilAdvancedMDValueParser::handlerBeginTag (   $a_xml_parser,
string  $a_name,
array  $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 71 of file class.ilAdvancedMDValueParser.php.

71 : void
72 {
73 switch ($a_name) {
74 case 'AdvancedMetaData':
75 $this->values_records = ilAdvancedMDValues::getInstancesForObjectId($this->obj_id);
76 foreach ($this->values_records as $values_record) {
77 // init ADTGroup before definitions to bind definitions to group
78 $values_record->getADTGroup();
79
80 foreach ($values_record->getDefinitions() as $def) {
81 $this->values[$def->getImportId()] = $def;
82 }
83 }
84 break;
85
86 case 'Value':
87 $this->initValue($a_attribs['id']);
88 break;
89 }
90 }
initValue(string $a_import_id)
init new value object
static getInstancesForObjectId(int $a_obj_id, ?string $a_obj_type=null, string $a_sub_type="-", int $a_sub_id=0)

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

+ Here is the call graph for this function:

◆ handlerCharacterData()

ilAdvancedMDValueParser::handlerCharacterData (   $a_xml_parser,
string  $a_data 
)

Character data handler @access public.

Parameters
resource$a_xml_parserxml parser
string$a_datacharacter data

Implements ilSaxSubsetParser.

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

120 : void
121 {
122 if ($a_data != "\n") {
123 // Replace multiple tabs with one space
124 $a_data = preg_replace("/\t+/", " ", $a_data);
125
126 $this->cdata .= $a_data;
127 }
128 }

◆ handlerEndTag()

ilAdvancedMDValueParser::handlerEndTag (   $a_xml_parser,
string  $a_name 
)

End element handler @access public.

Parameters
resource$a_xml_parserxml parser
string$a_nameelement name

Implements ilSaxSubsetParser.

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

98 : void
99 {
100 switch ($a_name) {
101 case 'AdvancedMetaData':
102 break;
103
104 case 'Value':
105 $value = trim($this->cdata);
106 if (is_object($this->current_value) && $value) {
107 $this->current_value->importValueFromXML($value);
108 }
109 break;
110 }
111 $this->cdata = '';
112 }

◆ initValue()

ilAdvancedMDValueParser::initValue ( string  $a_import_id)
private

init new value object

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

133 : void
134 {
135 if (isset($this->values[$a_import_id])) {
136 $this->current_value = $this->values[$a_import_id];
137 } else {
138 $this->current_value = null;
139 }
140 }

Referenced by handlerBeginTag().

+ Here is the caller graph for this function:

◆ save()

ilAdvancedMDValueParser::save ( )

Save values @access public.

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

56 : bool
57 {
58 foreach ($this->values_records as $values_record) {
59 $values_record->write();
60 }
61 return true;
62 }

◆ setObjId()

ilAdvancedMDValueParser::setObjId ( int  $a_obj_id)

Set object id (id of new created object)

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

47 : void
48 {
49 $this->obj_id = $a_obj_id;
50 }

Field Documentation

◆ $cdata

string ilAdvancedMDValueParser::$cdata = ''
protected

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

◆ $current_value

ilAdvancedMDFieldDefinition ilAdvancedMDValueParser::$current_value = null
protected

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

◆ $obj_id

int ilAdvancedMDValueParser::$obj_id
protected

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

◆ $values

array ilAdvancedMDValueParser::$values = array()
protected

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

◆ $values_records

array ilAdvancedMDValueParser::$values_records = array()
protected

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


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