ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMDContribute Class Reference
+ Inheritance diagram for ilMDContribute:
+ Collaboration diagram for ilMDContribute:

Public Member Functions

 ilMDContribute ($a_rbac_id=0, $a_obj_id=0, $a_obj_type= '')
getEntityIds ()
getEntity ($a_entity_id)
addEntity ()
 setRole ($a_role)
 getRole ()
 setDate ($a_date)
 getDate ()
 save ()
 update ()
 delete ()
 __getFields ()
 read ()
 toXML (&$writer)
 _getIds ($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
 ilMDContribute ($a_rbac_id=0, $a_obj_id=0, $a_obj_type= '')
getEntityIds ()
getEntity ($a_entity_id)
addEntity ()
 setRole ($a_role)
 getRole ()
 setDate ($a_date)
 getDate ()
 save ()
 update ()
 delete ()
 __getFields ()
 read ()
 toXML (&$writer)
 _getIds ($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
- 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 ()

Static Public Member Functions

static _lookupAuthors ($a_rbac_id, $a_obj_id, $a_obj_type)
 Lookup authors.

Additional Inherited Members

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

Detailed Description

Definition at line 34 of file class.ilMDContribute.php.

Member Function Documentation

ilMDContribute::__getFields ( )

Definition at line 169 of file class.ilMDContribute.php.

References getDate(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), ilMDBase\getRBACId(), and getRole().

{
return array('rbac_id' => $this->getRBACId(),
'obj_id' => $this->getObjId(),
'obj_type' => $this->getObjType(),
'parent_type' => $this->getParentType(),
'parent_id' => $this->getParentId(),
'role' => $this->getRole(),
'date' => $this->getDate());
}

+ Here is the call graph for this function:

ilMDContribute::__getFields ( )

Definition at line 169 of file class.ilMDContribute.php.

References getDate(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), ilMDBase\getRBACId(), getRole(), and ilUtil\prepareDBString().

{
return array('rbac_id' => $this->getRBACId(),
'obj_id' => $this->getObjId(),
'obj_type' => ilUtil::prepareDBString($this->getObjType()),
'parent_type' => $this->getParentType(),
'parent_id' => $this->getParentId(),
'role' => ilUtil::prepareDBString($this->getRole()),
'date' => ilUtil::prepareDBString($this->getDate()));
}

+ Here is the call graph for this function:

ilMDContribute::_getIds (   $a_rbac_id,
  $a_obj_id,
  $a_parent_id,
  $a_parent_type 
)

Definition at line 227 of file class.ilMDContribute.php.

References $res, and DB_FETCHMODE_OBJECT.

{
global $ilDB;
$query = "SELECT meta_contribute_id FROM il_meta_contribute ".
"WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
"AND obj_id = ".$ilDB->quote($a_obj_id)." ".
"AND parent_id = ".$ilDB->quote($a_parent_id)." ".
"AND parent_type = ".$ilDB->quote($a_parent_type);
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$ids[] = $row->meta_contribute_id;
}
return $ids ? $ids : array();
}
ilMDContribute::_getIds (   $a_rbac_id,
  $a_obj_id,
  $a_parent_id,
  $a_parent_type 
)

Definition at line 237 of file class.ilMDContribute.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by ilMDLifecycle\getContributeIds(), ilMDMetaMetadata\getContributeIds(), and getEntityIds().

{
global $ilDB;
$query = "SELECT meta_contribute_id FROM il_meta_contribute ".
"WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
"AND obj_id = ".$ilDB->quote($a_obj_id)." ".
"AND parent_id = ".$ilDB->quote($a_parent_id)." ".
"AND parent_type = ".$ilDB->quote($a_parent_type);
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$ids[] = $row->meta_contribute_id;
}
return $ids ? $ids : array();
}

+ Here is the caller graph for this function:

static ilMDContribute::_lookupAuthors (   $a_rbac_id,
  $a_obj_id,
  $a_obj_type 
)
static

Lookup authors.

public

Parameters
intrbac_id
intobj_id
stringobj_type
Returns
array string authors

Definition at line 266 of file class.ilMDContribute.php.

References $res, and DB_FETCHMODE_OBJECT.

Referenced by ilMDUtils\_fillHTMLMetaTags().

{
global $ilDB;
// Ask for 'author' later to use indexes
$query = "SELECT entity,ent.parent_type,role FROM il_meta_entity as ent ".
"JOIN il_meta_contribute as con ON ent.parent_id = con.meta_contribute_id ".
"WHERE ent.rbac_id = ".$ilDB->quote($a_rbac_id)." ".
"AND ent.obj_id = ".$ilDB->quote($a_obj_id)." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if($row->role == 'Author' and $row->parent_type == 'meta_contribute')
{
$authors[] = trim($row->entity);
}
}
return $authors ? $authors : array();
}

+ Here is the caller graph for this function:

& ilMDContribute::addEntity ( )

Definition at line 64 of file class.ilMDContribute.php.

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

{
include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDEntity.php';
$ent =& new ilMDEntity($this->getRBACId(),$this->getObjId(),$this->getObjType());
$ent->setParentId($this->getMetaId());
$ent->setParentType('meta_contribute');
return $ent;
}

+ Here is the call graph for this function:

& ilMDContribute::addEntity ( )

Definition at line 64 of file class.ilMDContribute.php.

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

{
include_once 'Services/MetaData/classes/class.ilMDEntity.php';
$ent = new ilMDEntity($this->getRBACId(),$this->getObjId(),$this->getObjType());
$ent->setParentId($this->getMetaId());
$ent->setParentType('meta_contribute');
return $ent;
}

+ Here is the call graph for this function:

ilMDContribute::delete ( )

Reimplemented from ilMDBase.

Definition at line 147 of file class.ilMDContribute.php.

References getEntity(), getEntityIds(), and ilMDBase\getMetaId().

{
global $ilDB;
if($this->getMetaId())
{
$query = "DELETE FROM il_meta_contribute ".
"WHERE meta_contribute_id = ".$ilDB->quote($this->getMetaId());
$this->db->query($query);
foreach($this->getEntityIds() as $id)
{
$ent = $this->getEntity($id);
$ent->delete();
}
return true;
}
return false;
}

+ Here is the call graph for this function:

ilMDContribute::delete ( )

Reimplemented from ilMDBase.

Definition at line 147 of file class.ilMDContribute.php.

References getEntity(), getEntityIds(), and ilMDBase\getMetaId().

{
global $ilDB;
if($this->getMetaId())
{
$query = "DELETE FROM il_meta_contribute ".
"WHERE meta_contribute_id = ".$ilDB->quote($this->getMetaId());
$this->db->query($query);
foreach($this->getEntityIds() as $id)
{
$ent =& $this->getEntity($id);
$ent->delete();
}
return true;
}
return false;
}

+ Here is the call graph for this function:

ilMDContribute::getDate ( )

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

Referenced by __getFields(), and toXML().

{
return $this->date;
}

+ Here is the caller graph for this function:

ilMDContribute::getDate ( )

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

{
return $this->date;
}
& ilMDContribute::getEntity (   $a_entity_id)

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

Referenced by delete(), and toXML().

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

+ Here is the caller graph for this function:

& ilMDContribute::getEntity (   $a_entity_id)

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

{
include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDEntity.php';
if(!$a_entity_id)
{
return false;
}
$ent =& new ilMDEntity();
$ent->setMetaId($a_entity_id);
return $ent;
}
& ilMDContribute::getEntityIds ( )

Definition at line 45 of file class.ilMDContribute.php.

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

{
include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDEntity.php';
return ilMDEntity::_getIds($this->getRBACId(),$this->getObjId(),$this->getMetaId(),'meta_contribute');
}

+ Here is the call graph for this function:

& ilMDContribute::getEntityIds ( )

Definition at line 45 of file class.ilMDContribute.php.

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

Referenced by delete(), and toXML().

{
include_once 'Services/MetaData/classes/class.ilMDEntity.php';
return ilMDEntity::_getIds($this->getRBACId(),$this->getObjId(),$this->getMetaId(),'meta_contribute');
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilMDContribute::getRole ( )

Definition at line 103 of file class.ilMDContribute.php.

{
return $this->role;
}
ilMDContribute::getRole ( )

Definition at line 103 of file class.ilMDContribute.php.

Referenced by __getFields(), and toXML().

{
return $this->role;
}

+ Here is the caller graph for this function:

ilMDContribute::ilMDContribute (   $a_rbac_id = 0,
  $a_obj_id = 0,
  $a_obj_type = '' 
)

Definition at line 36 of file class.ilMDContribute.php.

References ilMDBase\ilMDBase().

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

+ Here is the call graph for this function:

ilMDContribute::ilMDContribute (   $a_rbac_id = 0,
  $a_obj_id = 0,
  $a_obj_type = '' 
)

Definition at line 36 of file class.ilMDContribute.php.

References ilMDBase\ilMDBase().

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

+ Here is the call graph for this function:

ilMDContribute::read ( )

Definition at line 180 of file class.ilMDContribute.php.

References $res, DB_FETCHMODE_OBJECT, ilMDBase\getMetaId(), setDate(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setParentId(), ilMDBase\setParentType(), ilMDBase\setRBACId(), and setRole().

{
global $ilDB;
include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
if($this->getMetaId())
{
$query = "SELECT * FROM il_meta_contribute ".
"WHERE meta_contribute_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);
$this->setParentId($row->parent_id);
$this->setParentType($row->parent_type);
$this->setRole($row->role);
$this->setDate($row->date);
}
}
return true;
}

+ Here is the call graph for this function:

ilMDContribute::read ( )

Definition at line 180 of file class.ilMDContribute.php.

References $res, DB_FETCHMODE_OBJECT, ilMDBase\getMetaId(), setDate(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setParentId(), ilMDBase\setParentType(), ilMDBase\setRBACId(), setRole(), and ilUtil\stripSlashes().

{
global $ilDB;
include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
if($this->getMetaId())
{
$query = "SELECT * FROM il_meta_contribute ".
"WHERE meta_contribute_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);
$this->setParentId($row->parent_id);
$this->setParentType($row->parent_type);
$this->setRole(ilUtil::stripSlashes($row->role));
$this->setDate(ilUtil::stripSlashes($row->date));
}
}
return true;
}

+ Here is the call graph for this function:

ilMDContribute::save ( )

Reimplemented from ilMDBase.

Definition at line 117 of file class.ilMDContribute.php.

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

{
if($this->db->autoExecute('il_meta_contribute',
$this->__getFields(),
DB_AUTOQUERY_INSERT))
{
$this->setMetaId($this->db->getLastInsertId());
return $this->getMetaId();
}
return false;
}

+ Here is the call graph for this function:

ilMDContribute::save ( )

Reimplemented from ilMDBase.

Definition at line 117 of file class.ilMDContribute.php.

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

{
if($this->db->autoExecute('il_meta_contribute',
$this->__getFields(),
DB_AUTOQUERY_INSERT))
{
$this->setMetaId($this->db->getLastInsertId());
return $this->getMetaId();
}
return false;
}

+ Here is the call graph for this function:

ilMDContribute::setDate (   $a_date)

Definition at line 107 of file class.ilMDContribute.php.

{
$this->date = $a_date;
}
ilMDContribute::setDate (   $a_date)

Definition at line 107 of file class.ilMDContribute.php.

Referenced by read().

{
$this->date = $a_date;
}

+ Here is the caller graph for this function:

ilMDContribute::setRole (   $a_role)

Definition at line 76 of file class.ilMDContribute.php.

{
switch($a_role)
{
case 'Author':
case 'Publisher':
case 'Unknown':
case 'Initiator':
case 'Terminator':
case 'Editor':
case 'GraphicalDesigner':
case 'TechnicalImplementer':
case 'ContentProvider':
case 'TechnicalValidator':
case 'EducationalValidator':
case 'ScriptWriter':
case 'InstructionalDesigner':
case 'SubjectMatterExpert':
case 'Creator':
case 'Validator':
$this->role = $a_role;
return true;
default:
return false;
}
}
ilMDContribute::setRole (   $a_role)

Definition at line 76 of file class.ilMDContribute.php.

Referenced by read().

{
switch($a_role)
{
case 'Author':
case 'Publisher':
case 'Unknown':
case 'Initiator':
case 'Terminator':
case 'Editor':
case 'GraphicalDesigner':
case 'TechnicalImplementer':
case 'ContentProvider':
case 'TechnicalValidator':
case 'EducationalValidator':
case 'ScriptWriter':
case 'InstructionalDesigner':
case 'SubjectMatterExpert':
case 'Creator':
case 'Validator':
$this->role = $a_role;
return true;
default:
return false;
}
}

+ Here is the caller graph for this function:

ilMDContribute::toXML ( $writer)

Reimplemented from ilMDBase.

Definition at line 211 of file class.ilMDContribute.php.

References getDate(), getEntity(), getEntityIds(), ilMDBase\getObjId(), ilMDBase\getRBACId(), and getRole().

{
$writer->xmlStartTag('Contribute',array('Role' => $this->getRole()
? $this->getRole()
: 'Author'));
// Entities
$entities = $this->getEntityIds();
foreach($entities as $id)
{
$ent =& $this->getEntity($id);
$ent->toXML($writer);
}
if(!count($entities))
{
include_once 'Services/MetaData/classes/class.ilMDEntity.php';
$ent = new ilMDEntity($this->getRBACId(),$this->getObjId());
$ent->toXML($writer);
}
$writer->xmlElement('Date',null,$this->getDate());
$writer->xmlEndTag('Contribute');
}

+ Here is the call graph for this function:

ilMDContribute::toXML ( $writer)

Reimplemented from ilMDBase.

Definition at line 211 of file class.ilMDContribute.php.

References getDate(), getEntity(), getEntityIds(), and getRole().

{
$writer->xmlStartTag('Contribute',array('Role' => $this->getRole()));
// Entities
foreach($this->getEntityIds() as $id)
{
$ent =& $this->getEntity($id);
$ent->toXML($writer);
}
$writer->xmlElement('Date',null,$this->getDate());
$writer->xmlEndTag('Contribute');
}

+ Here is the call graph for this function:

ilMDContribute::update ( )

Reimplemented from ilMDBase.

Definition at line 130 of file class.ilMDContribute.php.

References ilMDBase\getMetaId().

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

+ Here is the call graph for this function:

ilMDContribute::update ( )

Reimplemented from ilMDBase.

Definition at line 130 of file class.ilMDContribute.php.

References ilMDBase\getMetaId().

{
global $ilDB;
if($this->getMetaId())
{
if($this->db->autoExecute('il_meta_contribute',
$this->__getFields(),
DB_AUTOQUERY_UPDATE,
"meta_contribute_id = ".$ilDB->quote($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: