ILIAS  Release_4_0_x_branch Revision 61816
 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(), 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::__getFields ( )

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

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

Referenced by save().

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

+ Here is the call graph for this function:

+ Here is the caller 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 $ilDB, $query, $res, $row, 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 238 of file class.ilMDContribute.php.

References $ilDB, $query, $res, $row, 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 ,'integer')." ".
"AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
"AND parent_id = ".$ilDB->quote($a_parent_id ,'integer')." ".
"AND parent_type = ".$ilDB->quote($a_parent_type ,'text');
$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 267 of file class.ilMDContribute.php.

References $ilDB, $query, $res, $row, 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 ent ".
"JOIN il_meta_contribute con ON ent.parent_id = con.meta_contribute_id ".
"WHERE ent.rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
"AND ent.obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
$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 $ilDB, $query, 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 149 of file class.ilMDContribute.php.

References $ilDB, $query, $res, getEntity(), getEntityIds(), and ilMDBase\getMetaId().

{
global $ilDB;
if($this->getMetaId())
{
$query = "DELETE FROM il_meta_contribute ".
"WHERE meta_contribute_id = ".$ilDB->quote($this->getMetaId() ,'integer');
$res = $ilDB->manipulate($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.

{
return $this->date;
}
ilMDContribute::getDate ( )

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

Referenced by __getFields(), and toXML().

{
return $this->date;
}

+ Here is the caller graph for this function:

& 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 104 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 $ilDB, $query, $res, $row, 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);
}
}
return true;
}

+ Here is the call graph for this function:

ilMDContribute::read ( )

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

References $ilDB, $query, $res, $row, 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() ,'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->setParentId($row->parent_id);
$this->setParentType($row->parent_type);
$this->setRole($row->role);
$this->setDate($row->c_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 118 of file class.ilMDContribute.php.

References $ilDB, __getFields(), ilMDBase\getMetaId(), and ilMDBase\setMetaId().

{
global $ilDB;
$fields = $this->__getFields();
$fields['meta_contribute_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_contribute'));
if($this->db->insert('il_meta_contribute',$fields))
{
$this->setMetaId($next_id);
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 108 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.

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':
case 'PointOfContact':
$this->role = $a_role;
return true;
default:
return false;
}
}

+ 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::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::toXML ( $writer)

Reimplemented from ilMDBase.

Definition at line 212 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::update ( )

Reimplemented from ilMDBase.

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

References $ilDB, and 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 133 of file class.ilMDContribute.php.

References $ilDB, and ilMDBase\getMetaId().

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