ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 public. More...
 
 handlerBeginTag ($a_xml_parser, string $a_name, array $a_attribs)
 Start element handler public. More...
 
 handlerEndTag ($a_xml_parser, string $a_name)
 End element handler public. More...
 
 handlerCharacterData ($a_xml_parser, string $a_data)
 Character data handler public. 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 25 of file class.ilAdvancedMDValueParser.php.

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDValueParser::__construct ( int  $a_new_obj_id = 0)

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

34  {
35  $this->obj_id = $a_new_obj_id;
36  }

Member Function Documentation

◆ handlerBeginTag()

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

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

65  : void
66  {
67  switch ($a_name) {
68  case 'AdvancedMetaData':
69  $this->values_records = ilAdvancedMDValues::getInstancesForObjectId($this->obj_id);
70  foreach ($this->values_records as $values_record) {
71  // init ADTGroup before definitions to bind definitions to group
72  $values_record->getADTGroup();
73 
74  foreach ($values_record->getDefinitions() as $def) {
75  $this->values[$def->getImportId()] = $def;
76  }
77  }
78  break;
79 
80  case 'Value':
81  $this->initValue($a_attribs['id']);
82  break;
83  }
84  }
static getInstancesForObjectId(int $a_obj_id, ?string $a_obj_type=null, string $a_sub_type="-", int $a_sub_id=0)
initValue(string $a_import_id)
init new value object
+ Here is the call graph for this function:

◆ handlerCharacterData()

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

Character data handler public.

Parameters
resource$a_xml_parserxml parser
string$a_datacharacter data

Implements ilSaxSubsetParser.

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

114  : void
115  {
116  if ($a_data != "\n") {
117  // Replace multiple tabs with one space
118  $a_data = preg_replace("/\t+/", " ", $a_data);
119 
120  $this->cdata .= $a_data;
121  }
122  }

◆ handlerEndTag()

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

End element handler public.

Parameters
resource$a_xml_parserxml parser
string$a_nameelement name

Implements ilSaxSubsetParser.

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

92  : void
93  {
94  switch ($a_name) {
95  case 'AdvancedMetaData':
96  break;
97 
98  case 'Value':
99  $value = trim($this->cdata);
100  if (is_object($this->current_value) && $value) {
101  $this->current_value->importValueFromXML($value);
102  }
103  break;
104  }
105  $this->cdata = '';
106  }

◆ initValue()

ilAdvancedMDValueParser::initValue ( string  $a_import_id)
private

init new value object

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

References null.

Referenced by handlerBeginTag().

127  : void
128  {
129  if (isset($this->values[$a_import_id])) {
130  $this->current_value = $this->values[$a_import_id];
131  } else {
132  $this->current_value = null;
133  }
134  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ save()

ilAdvancedMDValueParser::save ( )

Save values public.

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

50  : bool
51  {
52  foreach ($this->values_records as $values_record) {
53  $values_record->write();
54  }
55  return true;
56  }

◆ setObjId()

ilAdvancedMDValueParser::setObjId ( int  $a_obj_id)

Set object id (id of new created object)

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

41  : void
42  {
43  $this->obj_id = $a_obj_id;
44  }

Field Documentation

◆ $cdata

string ilAdvancedMDValueParser::$cdata = ''
protected

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

◆ $current_value

ilAdvancedMDFieldDefinition ilAdvancedMDValueParser::$current_value = null
protected

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

◆ $obj_id

int ilAdvancedMDValueParser::$obj_id
protected

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

◆ $values

array ilAdvancedMDValueParser::$values = array()
protected

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

◆ $values_records

array ilAdvancedMDValueParser::$values_records = array()
protected

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


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