Public Member Functions

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)

Detailed Description

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


Member Function Documentation

ilMDContribute::__getFields (  ) 

Definition at line 165 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 165 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 231 of file class.ilMDContribute.php.

References $query, $res, and $row.

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

        {
                global $ilDB;

                $query = "SELECT meta_contribute_id FROM il_meta_contribute ".
                        "WHERE rbac_id = '".$a_rbac_id."' ".
                        "AND obj_id = '".$a_obj_id."' ".
                        "AND parent_id = '".$a_parent_id."' ".
                        "AND parent_type = '".$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:

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

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

References $query, $res, and $row.

        {
                global $ilDB;

                $query = "SELECT meta_contribute_id FROM il_meta_contribute ".
                        "WHERE rbac_id = '".$a_rbac_id."' ".
                        "AND obj_id = '".$a_obj_id."' ".
                        "AND parent_id = '".$a_parent_id."' ".
                        "AND parent_type = '".$a_parent_type."'";

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

& 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 145 of file class.ilMDContribute.php.

References $id, $query, getEntity(), getEntityIds(), and ilMDBase::getMetaId().

        {
                if($this->getMetaId())
                {
                        $query = "DELETE FROM il_meta_contribute ".
                                "WHERE meta_contribute_id = '".$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 145 of file class.ilMDContribute.php.

References $id, $query, getEntity(), getEntityIds(), and ilMDBase::getMetaId().

        {
                if($this->getMetaId())
                {
                        $query = "DELETE FROM il_meta_contribute ".
                                "WHERE meta_contribute_id = '".$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 176 of file class.ilMDContribute.php.

References $query, $res, $row, ilMDBase::getMetaId(), setDate(), ilMDBase::setObjId(), ilMDBase::setObjType(), ilMDBase::setParentId(), ilMDBase::setParentType(), ilMDBase::setRBACId(), and setRole().

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

                if($this->getMetaId())
                {
                        $query = "SELECT * FROM il_meta_contribute ".
                                "WHERE meta_contribute_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->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 176 of file class.ilMDContribute.php.

References $query, $res, $row, ilMDBase::getMetaId(), setDate(), ilMDBase::setObjId(), ilMDBase::setObjType(), ilMDBase::setParentId(), ilMDBase::setParentType(), ilMDBase::setRBACId(), setRole(), and ilUtil::stripSlashes().

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

                if($this->getMetaId())
                {
                        $query = "SELECT * FROM il_meta_contribute ".
                                "WHERE meta_contribute_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->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.

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::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 205 of file class.ilMDContribute.php.

References $id, 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 205 of file class.ilMDContribute.php.

References $id, 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 ilMDBase::getMetaId().

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

        {
                if($this->getMetaId())
                {
                        if($this->db->autoExecute('il_meta_contribute',
                                                                          $this->__getFields(),
                                                                          DB_AUTOQUERY_UPDATE,
                                                                          "meta_contribute_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: