Public Member Functions

ilMDLifecycle Class Reference

Inheritance diagram for ilMDLifecycle:
Collaboration diagram for ilMDLifecycle:

Public Member Functions

 ilMDLifecycle ($a_rbac_id=0, $a_obj_id=0, $a_obj_type= '')
 getPossibleSubelements ()
getContributeIds ()
getContribute ($a_contribute_id)
addContribute ()
 setStatus ($a_status)
 getStatus ()
 setVersion ($a_version)
 getVersion ()
 setVersionLanguage ($lng_obj)
getVersionLanguage ()
 getVersionLanguageCode ()
 save ()
 update ()
 delete ()
 __getFields ()
 read ()
 toXML (&$writer)
 _getId ($a_rbac_id, $a_obj_id)
 ilMDLifecycle ($a_rbac_id=0, $a_obj_id=0, $a_obj_type= '')
getContributeIds ()
getContribute ($a_contribute_id)
addContribute ()
 setStatus ($a_status)
 getStatus ()
 setVersion ($a_version)
 getVersion ()
 setVersionLanguage ($lng_obj)
getVersionLanguage ()
 getVersionLanguageCode ()
 save ()
 update ()
 delete ()
 __getFields ()
 read ()
 toXML (&$writer)
 _getId ($a_rbac_id, $a_obj_id)

Detailed Description

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


Member Function Documentation

ilMDLifecycle::__getFields (  ) 

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

References ilMDBase::getObjId(), ilMDBase::getObjType(), ilMDBase::getRBACId(), getStatus(), getVersion(), getVersionLanguageCode(), and ilUtil::prepareDBString().

        {
                return array('rbac_id'  => $this->getRBACId(),
                                         'obj_id'       => $this->getObjId(),
                                         'obj_type'     => ilUtil::prepareDBString($this->getObjType()),
                                         'lifecycle_status'     => $this->getStatus(),
                                         'meta_version'         => $this->getVersion(),
                                         'version_language' => $this->getVersionLanguageCode());
        }

Here is the call graph for this function:

ilMDLifecycle::__getFields (  ) 

Definition at line 173 of file class.ilMDLifecycle.php.

References ilMDBase::getObjId(), ilMDBase::getObjType(), ilMDBase::getRBACId(), getStatus(), getVersion(), getVersionLanguageCode(), and ilUtil::prepareDBString().

        {
                return array('rbac_id'  => $this->getRBACId(),
                                         'obj_id'       => $this->getObjId(),
                                         'obj_type'     => ilUtil::prepareDBString($this->getObjType()),
                                         'lifecycle_status'     => ilUtil::prepareDBString($this->getStatus()),
                                         'meta_version'         => ilUtil::prepareDBString($this->getVersion()),
                                         'version_language' => ilUtil::prepareDBString($this->getVersionLanguageCode()));
        }

Here is the call graph for this function:

ilMDLifecycle::_getId ( a_rbac_id,
a_obj_id 
)

Definition at line 247 of file class.ilMDLifecycle.php.

References $query, $res, and $row.

Referenced by ilMD::getLifecycle().

        {
                global $ilDB;

                $query = "SELECT meta_lifecycle_id FROM il_meta_lifecycle ".
                        "WHERE rbac_id = '".$a_rbac_id."' ".
                        "AND obj_id = '".$a_obj_id."'";


                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        return $row->meta_lifecycle_id;
                }
                return false;
        }

Here is the caller graph for this function:

ilMDLifecycle::_getId ( a_rbac_id,
a_obj_id 
)

Definition at line 229 of file class.ilMDLifecycle.php.

References $query, $res, and $row.

        {
                global $ilDB;

                $query = "SELECT meta_lifecycle_id FROM il_meta_lifecycle ".
                        "WHERE rbac_id = '".$a_rbac_id."' ".
                        "AND obj_id = '".$a_obj_id."'";


                $res = $ilDB->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        return $row->meta_lifecycle_id;
                }
                return false;
        }

& ilMDLifecycle::addContribute (  ) 

Definition at line 70 of file class.ilMDLifecycle.php.

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

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

                $con =& new ilMDContribute($this->getRBACId(),$this->getObjId(),$this->getObjType());
                $con->setParentId($this->getMetaId());
                $con->setParentType('meta_lifecycle');

                return $con;
        }

Here is the call graph for this function:

& ilMDLifecycle::addContribute (  ) 

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

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

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

                $con =& new ilMDContribute($this->getRBACId(),$this->getObjId(),$this->getObjType());
                $con->setParentId($this->getMetaId());
                $con->setParentType('meta_lifecycle');

                return $con;
        }

Here is the call graph for this function:

ilMDLifecycle::delete (  ) 

Reimplemented from ilMDBase.

Definition at line 150 of file class.ilMDLifecycle.php.

References $id, $query, getContribute(), getContributeIds(), and ilMDBase::getMetaId().

        {
                // Delete 'contribute'
                foreach($this->getContributeIds() as $id)
                {
                        $con = $this->getContribute($id);
                        $con->delete();
                }


                if($this->getMetaId())
                {
                        $query = "DELETE FROM il_meta_lifecycle ".
                                "WHERE meta_lifecycle_id = '".$this->getMetaId()."'";
                        
                        $this->db->query($query);
                        
                        return true;
                }
                return false;
        }

Here is the call graph for this function:

ilMDLifecycle::delete (  ) 

Reimplemented from ilMDBase.

Definition at line 157 of file class.ilMDLifecycle.php.

References $id, $query, getContribute(), getContributeIds(), and ilMDBase::getMetaId().

        {
                // Delete 'contribute'
                foreach($this->getContributeIds() as $id)
                {
                        $con = $this->getContribute($id);
                        $con->delete();
                }


                if($this->getMetaId())
                {
                        $query = "DELETE FROM il_meta_lifecycle ".
                                "WHERE meta_lifecycle_id = '".$this->getMetaId()."'";
                        
                        $this->db->query($query);
                        
                        return true;
                }
                return false;
        }

Here is the call graph for this function:

& ilMDLifecycle::getContribute ( a_contribute_id  ) 

Definition at line 57 of file class.ilMDLifecycle.php.

Referenced by delete(), and toXML().

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

                return $con;
        }

Here is the caller graph for this function:

& ilMDLifecycle::getContribute ( a_contribute_id  ) 

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

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

                return $con;
        }

& ilMDLifecycle::getContributeIds (  ) 

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

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

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

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

Here is the call graph for this function:

& ilMDLifecycle::getContributeIds (  ) 

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

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

Referenced by delete(), and toXML().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

ilMDLifecycle::getPossibleSubelements (  ) 

Definition at line 43 of file class.ilMDLifecycle.php.

        {
                $subs['Contribute'] = 'meta_contribute';

                return $subs;
        }               

ilMDLifecycle::getStatus (  ) 

Definition at line 90 of file class.ilMDLifecycle.php.

        {
                return $this->status;
        }

ilMDLifecycle::getStatus (  ) 

Definition at line 97 of file class.ilMDLifecycle.php.

Referenced by __getFields(), and toXML().

        {
                return $this->status;
        }

Here is the caller graph for this function:

ilMDLifecycle::getVersion (  ) 

Definition at line 105 of file class.ilMDLifecycle.php.

Referenced by __getFields(), and toXML().

        {
                return $this->version;
        }

Here is the caller graph for this function:

ilMDLifecycle::getVersion (  ) 

Definition at line 98 of file class.ilMDLifecycle.php.

        {
                return $this->version;
        }

& ilMDLifecycle::getVersionLanguage (  ) 

Definition at line 116 of file class.ilMDLifecycle.php.

        {
                return $this->version_language;
        }

& ilMDLifecycle::getVersionLanguage (  ) 

Definition at line 109 of file class.ilMDLifecycle.php.

        {
                return $this->version_language;
        }

ilMDLifecycle::getVersionLanguageCode (  ) 

Definition at line 120 of file class.ilMDLifecycle.php.

Referenced by __getFields(), and toXML().

        {
                if(is_object($this->version_language))
                {
                        return $this->version_language->getLanguageCode();
                }
                return false;
        }

Here is the caller graph for this function:

ilMDLifecycle::getVersionLanguageCode (  ) 

Definition at line 113 of file class.ilMDLifecycle.php.

        {
                if(is_object($this->version_language))
                {
                        return $this->version_language->getLanguageCode();
                }
                return false;
        }

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

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

References ilMDBase::ilMDBase().

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

Here is the call graph for this function:

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

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

References ilMDBase::ilMDBase().

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

Here is the call graph for this function:

ilMDLifecycle::read (  ) 

Definition at line 183 of file class.ilMDLifecycle.php.

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

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

                if($this->getMetaId())
                {
                        $query = "SELECT * FROM il_meta_lifecycle ".
                                "WHERE meta_lifecycle_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->setStatus(ilUtil::stripSlashes($row->lifecycle_status));
                                $this->setVersion(ilUtil::stripSlashes($row->meta_version));
                                $this->setVersionLanguage(new ilMDLanguageItem($row->version_language));
                        }
                }
                return true;
        }

Here is the call graph for this function:

ilMDLifecycle::read (  ) 

Definition at line 190 of file class.ilMDLifecycle.php.

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

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

                if($this->getMetaId())
                {
                        $query = "SELECT * FROM il_meta_lifecycle ".
                                "WHERE meta_lifecycle_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->setStatus($row->lifecycle_status);
                                $this->setVersion($row->meta_version);
                                $this->setVersionLanguage(new ilMDLanguageItem($row->version_language));
                        }
                }
                return true;
        }

Here is the call graph for this function:

ilMDLifecycle::save (  ) 

Reimplemented from ilMDBase.

Definition at line 129 of file class.ilMDLifecycle.php.

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

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

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

Here is the call graph for this function:

ilMDLifecycle::save (  ) 

Reimplemented from ilMDBase.

Definition at line 122 of file class.ilMDLifecycle.php.

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

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

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

Here is the call graph for this function:

ilMDLifecycle::setStatus ( a_status  ) 

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

        {
                switch($a_status)
                {
                        case 'Draft':
                        case 'Final':
                        case 'Revised':
                        case 'Unavailable':
                                $this->status = $a_status;

                        default:
                                return false;
                }
        }

ilMDLifecycle::setStatus ( a_status  ) 

Definition at line 83 of file class.ilMDLifecycle.php.

Referenced by read().

        {
                switch($a_status)
                {
                        case 'Draft':
                        case 'Final':
                        case 'Revised':
                        case 'Unavailable':
                                $this->status = $a_status;

                        default:
                                return false;
                }
        }

Here is the caller graph for this function:

ilMDLifecycle::setVersion ( a_version  ) 

Definition at line 101 of file class.ilMDLifecycle.php.

Referenced by read().

        {
                $this->version = $a_version;
        }

Here is the caller graph for this function:

ilMDLifecycle::setVersion ( a_version  ) 

Definition at line 94 of file class.ilMDLifecycle.php.

        {
                $this->version = $a_version;
        }

ilMDLifecycle::setVersionLanguage ( lng_obj  ) 

Definition at line 109 of file class.ilMDLifecycle.php.

Referenced by read().

        {
                if(is_object($lng_obj))
                {
                        $this->version_language =& $lng_obj;
                }
        }

Here is the caller graph for this function:

ilMDLifecycle::setVersionLanguage ( lng_obj  ) 

Definition at line 102 of file class.ilMDLifecycle.php.

        {
                if(is_object($lng_obj))
                {
                        $this->version_language =& $lng_obj;
                }
        }

ilMDLifecycle::toXML ( &$  writer  ) 

Reimplemented from ilMDBase.

Definition at line 218 of file class.ilMDLifecycle.php.

References $id, getContribute(), getContributeIds(), ilMDBase::getObjId(), ilMDBase::getRBACId(), getStatus(), getVersion(), and getVersionLanguageCode().

        {
                $writer->xmlStartTag('Lifecycle',array('Status' => $this->getStatus() 
                                                                                           ? $this->getStatus() 
                                                                                           : 'Draft'));
                $writer->xmlElement('Version',array('Language' => $this->getVersionLanguageCode() 
                                                                                        ? $this->getVersionLanguageCode()
                                                                                        : 'en'),
                                                        $this->getVersion());

                // contribute
                $contributes = $this->getContributeIds();
                foreach($contributes as $id)
                {
                        $con =& $this->getContribute($id);
                        $con->toXML($writer);
                }
                if(!count($contributes))
                {
                        include_once 'Services/MetaData/classes/class.ilMDContribute.php';
                        $con = new ilMDContribute($this->getRBACId(),$this->getObjId());
                        $con->toXML($writer);
                }
                $writer->xmlEndTag('Lifecycle');
        }

Here is the call graph for this function:

ilMDLifecycle::toXML ( &$  writer  ) 

Reimplemented from ilMDBase.

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

References $id, getContribute(), getContributeIds(), getStatus(), getVersion(), and getVersionLanguageCode().

        {
                $writer->xmlStartTag('Lifecycle',array('Status' => $this->getStatus()));
                $writer->xmlElement('Version',array('Language' => $this->getVersionLanguageCode()),$this->getVersion());

                // contribute
                foreach($this->getContributeIds() as $id)
                {
                        $con =& $this->getContribute($id);
                        $con->toXML($writer);
                }

                $writer->xmlEndTag('Lifecycle');
        }

Here is the call graph for this function:

ilMDLifecycle::update (  ) 

Reimplemented from ilMDBase.

Definition at line 142 of file class.ilMDLifecycle.php.

References ilMDBase::getMetaId().

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

Here is the call graph for this function:

ilMDLifecycle::update (  ) 

Reimplemented from ilMDBase.

Definition at line 135 of file class.ilMDLifecycle.php.

References ilMDBase::getMetaId().

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