Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes

ilAdvancedMDValue Class Reference
[Services/AdvancedMetaData]

Collaboration diagram for ilAdvancedMDValue:

Public Member Functions

 __construct ($a_field_id, $a_obj_id=0)
 Singleton constructor.
 __toString ()
 To string method.
 setObjId ($a_obj_id)
 set object id
 appendXML ($xml_writer)
 append value xml
 setValue ($a_value)
 Set value.
 getValue ()
 get value
 isDisabled ()
 Check if value is imported and therefore disabled.
 toggleDisabledStatus ($a_status)
 Toggle disabled status.
 delete ()
 Delete value.
 save ()
 Save data.

Static Public Member Functions

static _getInstance ($a_obj_id, $a_field_id)
 Get instance.

Protected Attributes

 $db

Private Member Functions

 read ()
 Read data.

Private Attributes

 $obj_id
 $field_id
 $value
 $disabled = false

Static Private Attributes

static $instances = array()

Detailed Description

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

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


Constructor & Destructor Documentation

ilAdvancedMDValue::__construct ( a_field_id,
a_obj_id = 0 
)

Singleton constructor.

private

Parameters:
int field_id
int obj_id

Definition at line 52 of file class.ilAdvancedMDValue.php.

References read().

        {
                global $ilDB;
                
                $this->db = $ilDB;
                
                $this->obj_id = $a_obj_id;
                $this->field_id = $a_field_id;
                
                $this->read();
        }

Here is the call graph for this function:


Member Function Documentation

ilAdvancedMDValue::__toString (  ) 

To string method.

public

Definition at line 87 of file class.ilAdvancedMDValue.php.

        {
                return $this->value;
        }

static ilAdvancedMDValue::_getInstance ( a_obj_id,
a_field_id 
) [static]

Get instance.

public

Parameters:
 

Definition at line 72 of file class.ilAdvancedMDValue.php.

Referenced by ilAdvancedMDValues::_appendXMLByObjId(), ilAdvancedMDRecordGUI::loadFromPost(), ilAdvancedMDRecordGUI::parseEditor(), and ilAdvancedMDRecordGUI::parseInfoPage().

        {
                if(isset(self::$instances[$a_obj_id][$a_field_id]))
                {
                        return self::$instances[$a_obj_id][$a_field_id];
                }
                return self::$instances[$a_obj_id][$a_field_id] = new ilAdvancedMDValue($a_field_id,$a_obj_id);
        }

Here is the caller graph for this function:

ilAdvancedMDValue::appendXML ( xml_writer  ) 

append value xml

public

Parameters:
object instance of ilXmlWriter

Definition at line 111 of file class.ilAdvancedMDValue.php.

References ilAdvancedMDFieldDefinition::_lookupImportId(), and getValue().

        {
                include_once('Services/AdvancedMetaData/classes/class.ilAdvancedMDFieldDefinition.php');
                
                $xml_writer->xmlElement('Value',
                        array('id' => ilAdvancedMDFieldDefinition::_lookupImportId($this->field_id)),
                        $this->getValue());
        }

Here is the call graph for this function:

ilAdvancedMDValue::delete (  ) 

Delete value.

public

Definition at line 174 of file class.ilAdvancedMDValue.php.

References $res.

        {
                $query = "DELETE FROM adv_md_values ".
                        "WHERE obj_id = ".$this->db->quote($this->obj_id)." ".
                        "AND field_id = ".$this->db->quote($this->field_id);
                $res = $this->db->query($query);
        }

ilAdvancedMDValue::getValue (  ) 

get value

public

Definition at line 138 of file class.ilAdvancedMDValue.php.

Referenced by appendXML(), and save().

        {
                return $this->value;
        }

Here is the caller graph for this function:

ilAdvancedMDValue::isDisabled (  ) 

Check if value is imported and therefore disabled.

This is the case for imported course links.

public

Parameters:
 

Definition at line 151 of file class.ilAdvancedMDValue.php.

Referenced by save().

        {
                return (bool) $this->disabled;
        }

Here is the caller graph for this function:

ilAdvancedMDValue::read (  )  [private]

Read data.

private

Definition at line 203 of file class.ilAdvancedMDValue.php.

References $res, setValue(), and toggleDisabledStatus().

Referenced by __construct().

        {
                if(!$this->obj_id or !$this->field_id)
                {
                        return;
                }
                
                $query = "SELECT * FROM adv_md_values ".
                        "WHERE obj_id = ".$this->db->quote($this->obj_id)." ".
                        "AND field_id = ".$this->db->quote($this->field_id)." ";
                $res = $this->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $this->setValue($row->value);
                        $this->toggleDisabledStatus((bool) $row->disabled);
                }
                return true;    
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilAdvancedMDValue::save (  ) 

Save data.

public

Definition at line 188 of file class.ilAdvancedMDValue.php.

References $res, getValue(), and isDisabled().

        {
                $query = "REPLACE INTO adv_md_values ".
                        "SET obj_id = ".$this->db->quote($this->obj_id).", ".
                        "field_id = ".$this->db->quote($this->field_id).", ".
                        "value = ".$this->db->quote($this->getValue()).", ".
                        "disabled = ".(int) $this->isDisabled()." ";
                $res = $this->db->query($query);
        }

Here is the call graph for this function:

ilAdvancedMDValue::setObjId ( a_obj_id  ) 

set object id

public

Parameters:
int obj_id

Definition at line 99 of file class.ilAdvancedMDValue.php.

        {
                $this->obj_id = $a_obj_id;
        }

ilAdvancedMDValue::setValue ( a_value  ) 

Set value.

public

Parameters:
string value

Definition at line 128 of file class.ilAdvancedMDValue.php.

Referenced by read().

        {
                $this->value = $a_value;
        }

Here is the caller graph for this function:

ilAdvancedMDValue::toggleDisabledStatus ( a_status  ) 

Toggle disabled status.

public

Parameters:
bool disabled status

Definition at line 163 of file class.ilAdvancedMDValue.php.

Referenced by read().

        {
                $this->disabled = (bool) $a_status;
        }

Here is the caller graph for this function:


Field Documentation

ilAdvancedMDValue::$db [protected]

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

ilAdvancedMDValue::$disabled = false [private]

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

ilAdvancedMDValue::$field_id [private]

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

ilAdvancedMDValue::$instances = array() [static, private]

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

ilAdvancedMDValue::$obj_id [private]

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

ilAdvancedMDValue::$value [private]

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


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