ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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)
- Public Member Functions inherited from ilMDBase
 ilMDBase ($a_rbac_id=0, $a_obj_id=0, $a_type=0)
 setRBACId ($a_id)
 getRBACId ()
 setObjId ($a_id)
 getObjId ()
 setObjType ($a_type)
 getObjType ()
 setMetaId ($a_meta_id, $a_read_data=true)
 getMetaId ()
 setParentType ($a_parent_type)
 getParentType ()
 setParentId ($a_id)
 getParentId ()
 setExportMode ($a_export_mode=true)
 getExportMode ()
 validate ()
 ilMDBase ($a_rbac_id=0, $a_obj_id=0, $a_type=0)
 setRBACId ($a_id)
 getRBACId ()
 setObjId ($a_id)
 getObjId ()
 setObjType ($a_type)
 getObjType ()
 setMetaId ($a_meta_id, $a_read_data=true)
 getMetaId ()
 setParentType ($a_parent_type)
 getParentType ()
 setParentId ($a_id)
 getParentId ()
 validate ()

Additional Inherited Members

- Data Fields inherited from ilMDBase
 $rbac_id
 $obj_id
 $obj_type
 $export_mode = false

Detailed Description

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

Member Function Documentation

ilMDRelation::__getFields ( )

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

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

Referenced by save().

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

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMDRelation::__getFields ( )

Definition at line 191 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 249 of file class.ilMDRelation.php.

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

{
global $ilDB;
$query = "SELECT meta_relation_id FROM il_meta_relation ".
"WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
"AND obj_id = ".$ilDB->quote($a_obj_id);
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$ids[] = $row->meta_relation_id;
}
return $ids ? $ids : array();
}
ilMDRelation::_getIds (   $a_rbac_id,
  $a_obj_id 
)

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

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

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

{
global $ilDB;
$query = "SELECT meta_relation_id FROM il_meta_relation ".
"WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
"AND obj_id = ".$ilDB->quote($a_obj_id ,'integer');
$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::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 163 of file class.ilMDRelation.php.

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

{
global $ilDB;
if($this->getMetaId())
{
$query = "DELETE FROM il_meta_relation ".
"WHERE meta_relation_id = ".$ilDB->quote($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::delete ( )

Reimplemented from ilMDBase.

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

References $query, $res, getDescription(), getDescriptionIds(), getIdentifier_(), getIdentifier_Ids(), and ilMDBase\getMetaId().

{
global $ilDB;
if($this->getMetaId())
{
$query = "DELETE FROM il_meta_relation ".
"WHERE meta_relation_id = ".$ilDB->quote($this->getMetaId() ,'integer');
$res = $ilDB->manipulate($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::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 199 of file class.ilMDRelation.php.

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

{
global $ilDB;
if($this->getMetaId())
{
$query = "SELECT * FROM il_meta_relation ".
"WHERE meta_relation_id = ".$ilDB->quote($this->getMetaId() ,'integer');
$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 199 of file class.ilMDRelation.php.

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

{
global $ilDB;
if($this->getMetaId())
{
$query = "SELECT * FROM il_meta_relation ".
"WHERE meta_relation_id = ".$ilDB->quote($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);
}
}
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 __getFields(), ilMDBase\getMetaId(), and ilMDBase\setMetaId().

{
global $ilDB;
$fields = $this->__getFields();
$fields['meta_relation_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_relation'));
if($this->db->insert('il_meta_relation',$fields))
{
$this->setMetaId($next_id);
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 225 of file class.ilMDRelation.php.

References 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 225 of file class.ilMDRelation.php.

References 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().

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

+ Here is the call graph for this function:

ilMDRelation::update ( )

Reimplemented from ilMDBase.

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

References ilMDBase\getMetaId().

{
global $ilDB;
if($this->getMetaId())
{
if($this->db->update('il_meta_relation',
$this->__getFields(),
array("meta_relation_id" => array('integer',$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: