Public Member Functions

ilMDRelation Class Reference

Inheritance diagram for ilMDRelation:
Collaboration diagram for ilMDRelation:

Public Member Functions

 ilMDRelation ($a_rbac_id=0, $a_obj_id=0, $a_obj_type= '')
getIdentifier_Ids ()
getIdentifier_ ($a_identifier__id)
addIdentifier_ ()
getDescriptionIds ()
getDescription ($a_description_id)
addDescription ()
 setKind ($a_kind)
 getKind ()
 save ()
 update ()
 delete ()
 __getFields ()
 read ()
 toXML (&$writer)
 _getIds ($a_rbac_id, $a_obj_id)
 ilMDRelation ($a_rbac_id=0, $a_obj_id=0, $a_obj_type= '')
getIdentifier_Ids ()
getIdentifier_ ($a_identifier__id)
addIdentifier_ ()
getDescriptionIds ()
getDescription ($a_description_id)
addDescription ()
 setKind ($a_kind)
 getKind ()
 save ()
 update ()
 delete ()
 __getFields ()
 read ()
 toXML (&$writer)
 _getIds ($a_rbac_id, $a_obj_id)

Detailed Description

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


Member Function Documentation

ilMDRelation::__getFields (  ) 

Definition at line 187 of file class.ilMDRelation.php.

References getKind(), ilMDBase::getObjId(), ilMDBase::getObjType(), and ilMDBase::getRBACId().

        {
                return array('rbac_id'  => $this->getRBACId(),
                                         'obj_id'       => $this->getObjId(),
                                         'obj_type'     => $this->getObjType(),
                                         'kind'         => $this->getKind());
        }

Here is the call graph for this function:

ilMDRelation::__getFields (  ) 

Definition at line 187 of file class.ilMDRelation.php.

References getKind(), ilMDBase::getObjId(), ilMDBase::getObjType(), ilMDBase::getRBACId(), and ilUtil::prepareDBString().

        {
                return array('rbac_id'  => $this->getRBACId(),
                                         'obj_id'       => $this->getObjId(),
                                         'obj_type'     => ilUtil::prepareDBString($this->getObjType()),
                                         'kind'         => ilUtil::prepareDBString($this->getKind()));
        }

Here is the call graph for this function:

ilMDRelation::_getIds ( a_rbac_id,
a_obj_id 
)

Definition at line 261 of file class.ilMDRelation.php.

References $query, $res, and $row.

Referenced by getDescriptionIds(), getIdentifier_Ids(), and ilMD::getRelationIds().

        {
                global $ilDB;

                $query = "SELECT meta_relation_id FROM il_meta_relation ".
                        "WHERE rbac_id = '".$a_rbac_id."' ".
                        "AND obj_id = '".$a_obj_id."' ";

                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $ids[] = $row->meta_relation_id;
                }
                return $ids ? $ids : array();
        }

Here is the caller graph for this function:

ilMDRelation::_getIds ( a_rbac_id,
a_obj_id 
)

Definition at line 243 of file class.ilMDRelation.php.

References $query, $res, and $row.

        {
                global $ilDB;

                $query = "SELECT meta_relation_id FROM il_meta_relation ".
                        "WHERE rbac_id = '".$a_rbac_id."' ".
                        "AND obj_id = '".$a_obj_id."'";

                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $ids[] = $row->meta_relation_id;
                }
                return $ids ? $ids : array();
        }

& ilMDRelation::addDescription (  ) 

Definition at line 93 of file class.ilMDRelation.php.

References ilMDBase::getMetaId(), ilMDBase::getObjId(), ilMDBase::getObjType(), and ilMDBase::getRBACId().

        {
                include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDDescription.php';
                
                $des =& new ilMDDescription($this->getRBACId(),$this->getObjId(),$this->getObjType());
                $des->setParentId($this->getMetaId());
                $des->setParentType('meta_relation');

                return $des;
        }

Here is the call graph for this function:

& ilMDRelation::addDescription (  ) 

Definition at line 93 of file class.ilMDRelation.php.

References ilMDBase::getMetaId(), ilMDBase::getObjId(), ilMDBase::getObjType(), and ilMDBase::getRBACId().

        {
                include_once 'Services/MetaData/classes/class.ilMDDescription.php';
                
                $des =& new ilMDDescription($this->getRBACId(),$this->getObjId(),$this->getObjType());
                $des->setParentId($this->getMetaId());
                $des->setParentType('meta_relation');

                return $des;
        }

Here is the call graph for this function:

& ilMDRelation::addIdentifier_ (  ) 

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

References ilMDBase::getMetaId(), ilMDBase::getObjId(), ilMDBase::getObjType(), and ilMDBase::getRBACId().

        {
                include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDIdentifier_.php';

                $ide =& new ilMDIdentifier_($this->getRBACId(),$this->getObjId(),$this->getObjType());
                $ide->setParentId($this->getMetaId());
                $ide->setParentType('meta_relation');

                return $ide;
        }

Here is the call graph for this function:

& ilMDRelation::addIdentifier_ (  ) 

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

References ilMDBase::getMetaId(), ilMDBase::getObjId(), ilMDBase::getObjType(), and ilMDBase::getRBACId().

        {
                include_once 'Services/MetaData/classes/class.ilMDIdentifier_.php';

                $ide =& new ilMDIdentifier_($this->getRBACId(),$this->getObjId(),$this->getObjType());
                $ide->setParentId($this->getMetaId());
                $ide->setParentType('meta_relation');

                return $ide;
        }

Here is the call graph for this function:

ilMDRelation::delete (  ) 

Reimplemented from ilMDBase.

Definition at line 161 of file class.ilMDRelation.php.

References $id, $query, getDescription(), getDescriptionIds(), getIdentifier_(), getIdentifier_Ids(), and ilMDBase::getMetaId().

        {
                if($this->getMetaId())
                {
                        $query = "DELETE FROM il_meta_relation ".
                                "WHERE meta_relation_id = '".$this->getMetaId()."'";
                        
                        $this->db->query($query);

                        foreach($this->getIdentifier_Ids() as $id)
                        {
                                $ide = $this->getIdentifier_($id);
                                $ide->delete();
                        }
                        foreach($this->getDescriptionIds() as $id)
                        {
                                $des = $this->getDescription($id);
                                $des->delete();
                        }
                        
                        return true;
                }
                return false;
        }

Here is the call graph for this function:

ilMDRelation::delete (  ) 

Reimplemented from ilMDBase.

Definition at line 161 of file class.ilMDRelation.php.

References $id, $query, getDescription(), getDescriptionIds(), getIdentifier_(), getIdentifier_Ids(), and ilMDBase::getMetaId().

        {
                if($this->getMetaId())
                {
                        $query = "DELETE FROM il_meta_relation ".
                                "WHERE meta_relation_id = '".$this->getMetaId()."'";
                        
                        $this->db->query($query);

                        foreach($this->getIdentifier_Ids() as $id)
                        {
                                $ide = $this->getIdentifier_($id);
                                $ide->delete();
                        }
                        foreach($this->getDescriptionIds() as $id)
                        {
                                $des = $this->getDescription();
                                $des->delete();
                        }
                        
                        return true;
                }
                return false;
        }

Here is the call graph for this function:

& ilMDRelation::getDescription ( a_description_id  ) 

Definition at line 80 of file class.ilMDRelation.php.

        {
                include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDDescription.php';
                
                if(!$a_description_id)
                {
                        return false;
                }
                $des =& new ilMDDescription();
                $des->setMetaId($a_description_id);

                return $des;
        }

& ilMDRelation::getDescription ( a_description_id  ) 

Definition at line 80 of file class.ilMDRelation.php.

Referenced by delete(), and toXML().

        {
                include_once 'Services/MetaData/classes/class.ilMDDescription.php';
                
                if(!$a_description_id)
                {
                        return false;
                }
                $des =& new ilMDDescription();
                $des->setMetaId($a_description_id);

                return $des;
        }

Here is the caller graph for this function:

& ilMDRelation::getDescriptionIds (  ) 

Definition at line 74 of file class.ilMDRelation.php.

References _getIds(), ilMDBase::getMetaId(), ilMDBase::getObjId(), and ilMDBase::getRBACId().

Referenced by delete(), and toXML().

        {
                include_once 'Services/MetaData/classes/class.ilMDDescription.php';

                return ilMdDescription::_getIds($this->getRBACId(),$this->getObjId(),$this->getMetaId(),'meta_relation');
        }

Here is the call graph for this function:

Here is the caller graph for this function:

& ilMDRelation::getDescriptionIds (  ) 

Definition at line 74 of file class.ilMDRelation.php.

References _getIds(), ilMDBase::getMetaId(), ilMDBase::getObjId(), and ilMDBase::getRBACId().

        {
                include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDDescription.php';

                return ilMdDescription::_getIds($this->getRBACId(),$this->getObjId(),$this->getMetaId(),'meta_relation');
        }

Here is the call graph for this function:

& ilMDRelation::getIdentifier_ ( a_identifier__id  ) 

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

        {
                include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDIdentifier_.php';

                if(!$a_identifier__id)
                {
                        return false;
                }
                $ide =& new ilMDIdentifier_();
                $ide->setMetaId($a_identifier__id);

                return $ide;
        }

& ilMDRelation::getIdentifier_ ( a_identifier__id  ) 

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

Referenced by delete(), and toXML().

        {
                include_once 'Services/MetaData/classes/class.ilMDIdentifier_.php';

                if(!$a_identifier__id)
                {
                        return false;
                }
                $ide =& new ilMDIdentifier_();
                $ide->setMetaId($a_identifier__id);

                return $ide;
        }

Here is the caller graph for this function:

& ilMDRelation::getIdentifier_Ids (  ) 

Definition at line 44 of file class.ilMDRelation.php.

References _getIds(), ilMDBase::getMetaId(), ilMDBase::getObjId(), and ilMDBase::getRBACId().

        {
                include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDIdentifier_.php';

                return ilMDIdentifier_::_getIds($this->getRBACId(),$this->getObjId(),$this->getMetaId(),'meta_relation');
        }

Here is the call graph for this function:

& ilMDRelation::getIdentifier_Ids (  ) 

Definition at line 44 of file class.ilMDRelation.php.

References _getIds(), ilMDBase::getMetaId(), ilMDBase::getObjId(), and ilMDBase::getRBACId().

Referenced by delete(), and toXML().

        {
                include_once 'Services/MetaData/classes/class.ilMDIdentifier_.php';

                return ilMDIdentifier_::_getIds($this->getRBACId(),$this->getObjId(),$this->getMetaId(),'meta_relation');
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilMDRelation::getKind (  ) 

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

Referenced by __getFields(), and toXML().

        {
                return $this->kind;
        }

Here is the caller graph for this function:

ilMDRelation::getKind (  ) 

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

        {
                return $this->kind;
        }

ilMDRelation::ilMDRelation ( a_rbac_id = 0,
a_obj_id = 0,
a_obj_type = '' 
)

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

References ilMDBase::ilMDBase().

        {
                parent::ilMDBase($a_rbac_id,
                                                 $a_obj_id,
                                                 $a_obj_type);
        }

Here is the call graph for this function:

ilMDRelation::ilMDRelation ( a_rbac_id = 0,
a_obj_id = 0,
a_obj_type = '' 
)

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

References ilMDBase::ilMDBase().

        {
                parent::ilMDBase($a_rbac_id,
                                                 $a_obj_id,
                                                 $a_obj_type);
        }

Here is the call graph for this function:

ilMDRelation::read (  ) 

Definition at line 195 of file class.ilMDRelation.php.

References $query, $res, $row, ilMDBase::getMetaId(), setKind(), ilMDBase::setObjId(), ilMDBase::setObjType(), and ilMDBase::setRBACId().

        {
                if($this->getMetaId())
                {
                        $query = "SELECT * FROM il_meta_relation ".
                                "WHERE meta_relation_id = '".$this->getMetaId()."'";

                        $res = $this->db->query($query);
                        while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                        {
                                $this->setRBACId($row->rbac_id);
                                $this->setObjId($row->obj_id);
                                $this->setObjType($row->obj_type);
                                $this->setKind($row->kind);
                        }
                }
                return true;
        }

Here is the call graph for this function:

ilMDRelation::read (  ) 

Definition at line 195 of file class.ilMDRelation.php.

References $query, $res, $row, ilMDBase::getMetaId(), setKind(), ilMDBase::setObjId(), ilMDBase::setObjType(), ilMDBase::setRBACId(), and ilUtil::stripSlashes().

        {
                if($this->getMetaId())
                {
                        $query = "SELECT * FROM il_meta_relation ".
                                "WHERE meta_relation_id = '".$this->getMetaId()."'";

                        $res = $this->db->query($query);
                        while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                        {
                                $this->setRBACId($row->rbac_id);
                                $this->setObjId($row->obj_id);
                                $this->setObjType($row->obj_type);
                                $this->setKind(ilUtil::stripSlashes($row->kind));
                        }
                }
                return true;
        }

Here is the call graph for this function:

ilMDRelation::save (  ) 

Reimplemented from ilMDBase.

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

References ilMDBase::getMetaId(), and ilMDBase::setMetaId().

        {
                if($this->db->autoExecute('il_meta_relation',
                                                                  $this->__getFields(),
                                                                  DB_AUTOQUERY_INSERT))
                {
                        $this->setMetaId($this->db->getLastInsertId());

                        return $this->getMetaId();
                }
                return false;
        }

Here is the call graph for this function:

ilMDRelation::save (  ) 

Reimplemented from ilMDBase.

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

References ilMDBase::getMetaId(), and ilMDBase::setMetaId().

        {
                if($this->db->autoExecute('il_meta_relation',
                                                                  $this->__getFields(),
                                                                  DB_AUTOQUERY_INSERT))
                {
                        $this->setMetaId($this->db->getLastInsertId());

                        return $this->getMetaId();
                }
                return false;
        }

Here is the call graph for this function:

ilMDRelation::setKind ( a_kind  ) 

Definition at line 104 of file class.ilMDRelation.php.

        {
                switch($a_kind)
                {
                        case 'IsPartOf':
                        case 'HasPart':
                        case 'IsVersionOf':
                        case 'HasVersion':
                        case 'IsFormatOf':
                        case 'HasFormat':
                        case 'References':
                        case 'IsReferencedBy':
                        case 'IsBasedOn':
                        case 'IsBasisFor':
                        case 'Requires':
                        case 'IsRequiredBy':
                                $this->kind = $a_kind;
                                return true;

                        default:
                                return false;
                }
        }

ilMDRelation::setKind ( a_kind  ) 

Definition at line 104 of file class.ilMDRelation.php.

Referenced by read().

        {
                switch($a_kind)
                {
                        case 'IsPartOf':
                        case 'HasPart':
                        case 'IsVersionOf':
                        case 'HasVersion':
                        case 'IsFormatOf':
                        case 'HasFormat':
                        case 'References':
                        case 'IsReferencedBy':
                        case 'IsBasedOn':
                        case 'IsBasisFor':
                        case 'Requires':
                        case 'IsRequiredBy':
                                $this->kind = $a_kind;
                                return true;

                        default:
                                return false;
                }
        }

Here is the caller graph for this function:

ilMDRelation::toXML ( &$  writer  ) 

Reimplemented from ilMDBase.

Definition at line 219 of file class.ilMDRelation.php.

References $id, getDescription(), getDescriptionIds(), getIdentifier_(), getIdentifier_Ids(), and getKind().

        {
                $writer->xmlStartTag('Relation',array('Kind' => $this->getKind()));
                $writer->xmlStartTag('Resource');

                // Identifier_
                foreach($this->getIdentifier_Ids() as $id)
                {
                        $ide =& $this->getIdentifier_($id);
                        $ide->toXML($writer);
                }
                // Description
                foreach($this->getDescriptionIds() as $id)
                {
                        $des =& $this->getDescription($id);
                        $des->toXML($writer);
                }
                $writer->xmlEndTag('Resource');
                $writer->xmlEndTag('Relation');
        }

Here is the call graph for this function:

ilMDRelation::toXML ( &$  writer  ) 

Reimplemented from ilMDBase.

Definition at line 219 of file class.ilMDRelation.php.

References $id, getDescription(), getDescriptionIds(), getIdentifier_(), getIdentifier_Ids(), getKind(), ilMDBase::getObjId(), and ilMDBase::getRBACId().

        {
                $writer->xmlStartTag('Relation',array('Kind' => $this->getKind()
                                                                                          ? $this->getKind()
                                                                                          : 'IsPartOf'));
                $writer->xmlStartTag('Resource');

                // Identifier_
                $ides = $this->getIdentifier_Ids();
                foreach($ides as $id)
                {
                        $ide =& $this->getIdentifier_($id);
                        $ide->toXML($writer);
                }
                if(!count($ides))
                {
                        include_once 'Services/MetaData/classes/class.ilMDIdentifier_.php';
                        $ide = new ilMDIdentifier_($this->getRBACId(),$this->getObjId());
                        $ide->toXML($writer);
                }

                // Description
                $dess = $this->getDescriptionIds();
                foreach($dess as $id)
                {
                        $des =& $this->getDescription($id);
                        $des->toXML($writer);
                }
                if(!count($dess))
                {
                        include_once 'Services/MetaData/classes/class.ilMDDescription.php';
                        $des = new ilMDDescription($this->getRBACId(),$this->getObjId());
                        $des->toXML($writer);
                }

                $writer->xmlEndTag('Resource');
                $writer->xmlEndTag('Relation');
        }

Here is the call graph for this function:

ilMDRelation::update (  ) 

Reimplemented from ilMDBase.

Definition at line 146 of file class.ilMDRelation.php.

References ilMDBase::getMetaId().

        {
                if($this->getMetaId())
                {
                        if($this->db->autoExecute('il_meta_relation',
                                                                          $this->__getFields(),
                                                                          DB_AUTOQUERY_UPDATE,
                                                                          "meta_relation_id = '".$this->getMetaId()."'"))
                        {
                                return true;
                        }
                }
                return false;
        }

Here is the call graph for this function:

ilMDRelation::update (  ) 

Reimplemented from ilMDBase.

Definition at line 146 of file class.ilMDRelation.php.

References ilMDBase::getMetaId().

        {
                if($this->getMetaId())
                {
                        if($this->db->autoExecute('il_meta_relation',
                                                                          $this->__getFields(),
                                                                          DB_AUTOQUERY_UPDATE,
                                                                          "meta_relation_id = '".$this->getMetaId()."'"))
                        {
                                return true;
                        }
                }
                return false;
        }

Here is the call graph for this function:


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