Public Member Functions | Protected Attributes | Private Member Functions

ilAdvancedMDValueParser Class Reference

Inheritance diagram for ilAdvancedMDValueParser:
Collaboration diagram for ilAdvancedMDValueParser:

Public Member Functions

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

Protected Attributes

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

Private Member Functions

 initValue ($a_import_id)
 init new value object

Detailed Description

Author:
Stefan Meyer <smeyer@databay.de>
Version:
$Id$

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


Constructor & Destructor Documentation

ilAdvancedMDValueParser::__construct ( a_new_obj_id = 0  ) 

Constructor.

public

Parameters:
 

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

        {
                $this->obj_id = $a_new_obj_id;
        }


Member Function Documentation

ilAdvancedMDValueParser::handlerBeginTag ( a_xml_parser,
a_name,
a_attribs 
)

Start element handler.

public

Parameters:
resource $a_xml_parser xml parser
string $a_name element name
array $a_attribs element attributes array

Implements ilSaxSubsetParser.

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

References initValue().

        {
                switch($a_name)
                {
                        case 'AdvancedMetaData':
                                $this->values = array();
                                break;
                                
                        case 'Value':
                                $this->initValue($a_attribs['id']);
                                break;
                }
                
        }

Here is the call graph for this function:

ilAdvancedMDValueParser::handlerCharacterData ( a_xml_parser,
a_data 
)

Character data handler.

public

Parameters:
resource $a_xml_parser xml parser
string $a_data character data

Implements ilSaxSubsetParser.

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

        {
                if($a_data != "\n")
                {
                        // Replace multiple tabs with one space
                        $a_data = preg_replace("/\t+/"," ",$a_data);

                        $this->cdata .= $a_data;
                }
        }

ilAdvancedMDValueParser::handlerEndTag ( a_xml_parser,
a_name 
)

End element handler.

public

Parameters:
resource $a_xml_parser xml parser
string $a_name element name

Implements ilSaxSubsetParser.

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

        {
                switch($a_name)
                {
                        case 'AdvancedMetaData':
                                break;
                                
                        case 'Value':
                                if(is_object($this->current_value))
                                {
                                        $this->current_value->setValue(trim($this->cdata));
                                }
                                break;
                }
                $this->cdata = '';
        }

ilAdvancedMDValueParser::initValue ( a_import_id  )  [private]

init new value object

private

Parameters:
string import id

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

References ilAdvancedMDFieldDefinition::_lookupFieldId().

Referenced by handlerBeginTag().

        {
                if($field_id = ilAdvancedMDFieldDefinition::_lookupFieldId($a_import_id))
                {
                        $this->current_value = new ilAdvancedMDValue($field_id,$this->obj_id);
                        $this->values[] = $this->current_value;
                }
                else
                {
                        $this->current_value = null;
                }
                
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilAdvancedMDValueParser::save (  ) 

Save values public.

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

        {
                foreach($this->values as $value)
                {
                        $value->setObjId($this->obj_id);
                        $value->save();
                }
                return true;
        }

ilAdvancedMDValueParser::setObjId ( a_obj_id  ) 

Set object id (id of new created object).

public

Parameters:
int obj_id

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

        {
                $this->obj_id = $a_obj_id;
        }


Field Documentation

ilAdvancedMDValueParser::$cdata = '' [protected]

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

ilAdvancedMDValueParser::$current_value = null [protected]

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

ilAdvancedMDValueParser::$obj_id [protected]

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

ilAdvancedMDValueParser::$values = array() [protected]

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


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