Public Member Functions

ilMDClassification Class Reference

Inheritance diagram for ilMDClassification:
Collaboration diagram for ilMDClassification:

Public Member Functions

 ilMDClassification ($a_rbac_id=0, $a_obj_id=0, $a_obj_type= '')
getTaxonPathIds ()
getTaxonPath ($a_taxon_path_id)
addTaxonPath ()
getKeywordIds ()
getKeyword ($a_keyword_id)
addKeyword ()
 setPurpose ($a_purpose)
 getPurpose ()
 setDescription ($a_description)
 getDescription ()
 setDescriptionLanguage (&$lng_obj)
getDescriptionLanguage ()
 getDescriptionLanguageCode ()
 save ()
 update ()
 delete ()
 __getFields ()
 read ()
 toXML (&$writer)
 _getIds ($a_rbac_id, $a_obj_id)
 ilMDClassification ($a_rbac_id=0, $a_obj_id=0, $a_obj_type= '')
getTaxonPathIds ()
getTaxonPath ($a_taxon_path_id)
addTaxonPath ()
getKeywordIds ()
getKeyword ($a_keyword_id)
addKeyword ()
 setPurpose ($a_purpose)
 getPurpose ()
 setDescription ($a_description)
 getDescription ()
 setDescriptionLanguage (&$lng_obj)
getDescriptionLanguage ()
 getDescriptionLanguageCode ()
 save ()
 update ()
 delete ()
 __getFields ()
 read ()
 toXML (&$writer)
 _getIds ($a_rbac_id, $a_obj_id)

Detailed Description

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


Member Function Documentation

ilMDClassification::__getFields (  ) 

Definition at line 207 of file class.ilMDClassification.php.

References getDescription(), getDescriptionLanguageCode(), ilMDBase::getObjId(), ilMDBase::getObjType(), getPurpose(), and ilMDBase::getRBACId().

        {
                return array('rbac_id'  => $this->getRBACId(),
                                         'obj_id'       => $this->getObjId(),
                                         'obj_type'     => $this->getObjType(),
                                         'purpose'      => $this->getPurpose(),
                                         'description' => $this->getDescription(),
                                         'description_language' => $this->getDescriptionLanguageCode());
        }

Here is the call graph for this function:

ilMDClassification::__getFields (  ) 

Definition at line 207 of file class.ilMDClassification.php.

References getDescription(), getDescriptionLanguageCode(), ilMDBase::getObjId(), ilMDBase::getObjType(), getPurpose(), ilMDBase::getRBACId(), and ilUtil::prepareDBString().

        {
                return array('rbac_id'  => $this->getRBACId(),
                                         'obj_id'       => $this->getObjId(),
                                         'obj_type'     => ilUtil::prepareDBString($this->getObjType()),
                                         'purpose'      => ilUtil::prepareDBString($this->getPurpose()),
                                         'description' => ilUtil::prepareDBString($this->getDescription()),
                                         'description_language' => ilUtil::prepareDBString($this->getDescriptionLanguageCode()));
        }

Here is the call graph for this function:

ilMDClassification::_getIds ( a_rbac_id,
a_obj_id 
)

Definition at line 290 of file class.ilMDClassification.php.

References $query, $res, and $row.

Referenced by ilMD::getClassificationIds(), getKeywordIds(), and getTaxonPathIds().

        {
                global $ilDB;

                $query = "SELECT meta_classification_id FROM il_meta_classification ".
                        "WHERE rbac_id = '".$a_rbac_id."' ".
                        "AND obj_id = '".$a_obj_id."'";


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

Here is the caller graph for this function:

ilMDClassification::_getIds ( a_rbac_id,
a_obj_id 
)

Definition at line 270 of file class.ilMDClassification.php.

References $query, $res, and $row.

        {
                global $ilDB;

                $query = "SELECT meta_classification_id FROM il_meta_classification ".
                        "WHERE rbac_id = '".$a_rbac_id."' ".
                        "AND obj_id = '".$a_obj_id."'";


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

& ilMDClassification::addKeyword (  ) 

Definition at line 92 of file class.ilMDClassification.php.

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

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

                $key =& new ilMDKeyword($this->getRBACId(),$this->getObjId(),$this->getObjType());
                $key->setParentId($this->getMetaId());
                $key->setParentType('meta_classification');

                return $key;
        }

Here is the call graph for this function:

& ilMDClassification::addKeyword (  ) 

Definition at line 92 of file class.ilMDClassification.php.

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

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

                $key =& new ilMDKeyword($this->getRBACId(),$this->getObjId(),$this->getObjType());
                $key->setParentId($this->getMetaId());
                $key->setParentType('meta_classification');

                return $key;
        }

Here is the call graph for this function:

& ilMDClassification::addTaxonPath (  ) 

Definition at line 62 of file class.ilMDClassification.php.

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

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

                $tax =& new ilMDTaxonPath($this->getRBACId(),$this->getObjId(),$this->getObjType());
                $tax->setParentId($this->getMetaId());
                $tax->setParentType('meta_classification');

                return $tax;
        }

Here is the call graph for this function:

& ilMDClassification::addTaxonPath (  ) 

Definition at line 62 of file class.ilMDClassification.php.

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

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

                $tax =& new ilMDTaxonPath($this->getRBACId(),$this->getObjId(),$this->getObjType());
                $tax->setParentId($this->getMetaId());
                $tax->setParentType('meta_classification');

                return $tax;
        }

Here is the call graph for this function:

ilMDClassification::delete (  ) 

Reimplemented from ilMDBase.

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

References $id, $key, $query, getKeyword(), getKeywordIds(), ilMDBase::getMetaId(), getTaxonPath(), and getTaxonPathIds().

        {
                if($this->getMetaId())
                {
                        $query = "DELETE FROM il_meta_classification ".
                                "WHERE meta_classification_id = '".$this->getMetaId()."'";
                        
                        $this->db->query($query);

                        foreach($this->getTaxonPathIds() as $id)
                        {
                                $tax = $this->getTaxonPath($id);
                                $tax->delete();
                        }
                        foreach($this->getKeywordIds() as $id)
                        {
                                $key = $this->getKeyword($id);
                                $key->delete();
                        }
                        
                        return true;
                }
                return false;
        }

Here is the call graph for this function:

ilMDClassification::delete (  ) 

Reimplemented from ilMDBase.

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

References $id, $key, $query, getKeyword(), getKeywordIds(), ilMDBase::getMetaId(), getTaxonPath(), and getTaxonPathIds().

        {
                if($this->getMetaId())
                {
                        $query = "DELETE FROM il_meta_classification ".
                                "WHERE meta_classification_id = '".$this->getMetaId()."'";
                        
                        $this->db->query($query);

                        foreach($this->getTaxonPathIds() as $id)
                        {
                                $tax =& $this->getTaxonPath($id);
                                $tax->delete();
                        }
                        foreach($this->getKeywordIds() as $id)
                        {
                                $key =& $this->getKeyword($id);
                                $key->delete();
                        }
                        
                        return true;
                }
                return false;
        }

Here is the call graph for this function:

ilMDClassification::getDescription (  ) 

Definition at line 132 of file class.ilMDClassification.php.

        {
                return $this->description;
        }

ilMDClassification::getDescription (  ) 

Definition at line 132 of file class.ilMDClassification.php.

Referenced by __getFields(), and toXML().

        {
                return $this->description;
        }

Here is the caller graph for this function:

& ilMDClassification::getDescriptionLanguage (  ) 

Definition at line 143 of file class.ilMDClassification.php.

        {
                return is_object($this->description_language) ? $this->description_language : false;
        }

& ilMDClassification::getDescriptionLanguage (  ) 

Definition at line 143 of file class.ilMDClassification.php.

        {
                return is_object($this->description_language) ? $this->description_language : false;
        }

ilMDClassification::getDescriptionLanguageCode (  ) 

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

        {
                return is_object($this->description_language) ? $this->description_language->getLanguageCode() : false;
        } 

ilMDClassification::getDescriptionLanguageCode (  ) 

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

Referenced by __getFields(), and toXML().

        {
                return is_object($this->description_language) ? $this->description_language->getLanguageCode() : false;
        } 

Here is the caller graph for this function:

& ilMDClassification::getKeyword ( a_keyword_id  ) 

Definition at line 79 of file class.ilMDClassification.php.

References $key.

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

                return $key;
        }

& ilMDClassification::getKeyword ( a_keyword_id  ) 

Definition at line 79 of file class.ilMDClassification.php.

References $key.

Referenced by delete(), and toXML().

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

                return $key;
        }

Here is the caller graph for this function:

& ilMDClassification::getKeywordIds (  ) 

Definition at line 73 of file class.ilMDClassification.php.

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

Referenced by delete(), and toXML().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

& ilMDClassification::getKeywordIds (  ) 

Definition at line 73 of file class.ilMDClassification.php.

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

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

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

Here is the call graph for this function:

ilMDClassification::getPurpose (  ) 

Definition at line 124 of file class.ilMDClassification.php.

Referenced by __getFields(), and toXML().

        {
                return $this->purpose;
        }

Here is the caller graph for this function:

ilMDClassification::getPurpose (  ) 

Definition at line 124 of file class.ilMDClassification.php.

        {
                return $this->purpose;
        }

& ilMDClassification::getTaxonPath ( a_taxon_path_id  ) 

Definition at line 49 of file class.ilMDClassification.php.

Referenced by delete(), and toXML().

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

                if(!$a_taxon_path_id)
                {
                        return false;
                }
                $tax =& new ilMDTaxonPath();
                $tax->setMetaId($a_taxon_path_id);

                return $tax;
        }

Here is the caller graph for this function:

& ilMDClassification::getTaxonPath ( a_taxon_path_id  ) 

Definition at line 49 of file class.ilMDClassification.php.

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

                if(!$a_taxon_path_id)
                {
                        return false;
                }
                $tax =& new ilMDTaxonPath();
                $tax->setMetaId($a_taxon_path_id);

                return $tax;
        }

& ilMDClassification::getTaxonPathIds (  ) 

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

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

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

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

Here is the call graph for this function:

& ilMDClassification::getTaxonPathIds (  ) 

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

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

Referenced by delete(), and toXML().

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

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

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 35 of file class.ilMDClassification.php.

References ilMDBase::ilMDBase().

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

Here is the call graph for this function:

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

Definition at line 35 of file class.ilMDClassification.php.

References ilMDBase::ilMDBase().

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

Here is the call graph for this function:

ilMDClassification::read (  ) 

Definition at line 217 of file class.ilMDClassification.php.

References $query, $res, $row, ilMDBase::getMetaId(), setDescription(), ilMDBase::setObjId(), ilMDBase::setObjType(), setPurpose(), and ilMDBase::setRBACId().

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

                if($this->getMetaId())
                {
                        $query = "SELECT * FROM il_meta_classification ".
                                "WHERE meta_classification_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->setPurpose($row->purpose);
                                $this->setDescription($row->description);
                                $this->description_language = new ilMDLanguageItem($row->description_language);
                        }
                }
                return true;
        }

Here is the call graph for this function:

ilMDClassification::read (  ) 

Definition at line 217 of file class.ilMDClassification.php.

References $query, $res, $row, ilMDBase::getMetaId(), setDescription(), ilMDBase::setObjId(), ilMDBase::setObjType(), setPurpose(), ilMDBase::setRBACId(), and ilUtil::stripSlashes().

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

                if($this->getMetaId())
                {
                        $query = "SELECT * FROM il_meta_classification ".
                                "WHERE meta_classification_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->setPurpose(ilUtil::stripSlashes($row->purpose));
                                $this->setDescription(ilUtil::stripSlashes($row->description));
                                $this->description_language = new ilMDLanguageItem($row->description_language);
                        }
                }
                return true;
        }

Here is the call graph for this function:

ilMDClassification::save (  ) 

Reimplemented from ilMDBase.

Definition at line 153 of file class.ilMDClassification.php.

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

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

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

Here is the call graph for this function:

ilMDClassification::save (  ) 

Reimplemented from ilMDBase.

Definition at line 153 of file class.ilMDClassification.php.

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

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

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

Here is the call graph for this function:

ilMDClassification::setDescription ( a_description  ) 

Definition at line 128 of file class.ilMDClassification.php.

        {
                $this->description = $a_description;
        }

ilMDClassification::setDescription ( a_description  ) 

Definition at line 128 of file class.ilMDClassification.php.

Referenced by read().

        {
                $this->description = $a_description;
        }

Here is the caller graph for this function:

ilMDClassification::setDescriptionLanguage ( &$  lng_obj  ) 

Definition at line 136 of file class.ilMDClassification.php.

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

ilMDClassification::setDescriptionLanguage ( &$  lng_obj  ) 

Definition at line 136 of file class.ilMDClassification.php.

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

ilMDClassification::setPurpose ( a_purpose  ) 

Definition at line 104 of file class.ilMDClassification.php.

Referenced by read().

        {
                switch($a_purpose)
                {
                        case 'Discipline':
                        case 'Idea':
                        case 'Prerequisite':
                        case 'EducationalObjective':
                        case 'AccessibilityRestrictions':
                        case 'EducationalLevel':
                        case 'SkillLevel':
                        case 'SecurityLevel':
                        case 'Competency':
                                $this->purpose = $a_purpose;
                                return true;

                        default: 
                                return false;
                }
        }

Here is the caller graph for this function:

ilMDClassification::setPurpose ( a_purpose  ) 

Definition at line 104 of file class.ilMDClassification.php.

        {
                switch($a_purpose)
                {
                        case 'Discipline':
                        case 'Idea':
                        case 'Prerequisite':
                        case 'EducationalObjective':
                        case 'AccessibilityRestrictions':
                        case 'EducationalLevel':
                        case 'SkillLevel':
                        case 'SecurityLevel':
                        case 'Competency':
                                $this->purpose = $a_purpose;
                                return true;

                        default: 
                                return false;
                }
        }

ilMDClassification::toXML ( &$  writer  ) 

Reimplemented from ilMDBase.

Definition at line 245 of file class.ilMDClassification.php.

References $id, $key, getDescription(), getDescriptionLanguageCode(), getKeyword(), getKeywordIds(), getPurpose(), getTaxonPath(), and getTaxonPathIds().

        {
                $writer->xmlStartTag('Classification',array('Purpose' => $this->getPurpose()));

                // Taxon Path
                foreach($this->getTaxonPathIds() as $id)
                {
                        $tax =& $this->getTaxonPath($id);
                        $tax->toXML($writer);
                }
                // Description
                $writer->xmlElement('Description',array('Language' => $this->getDescriptionLanguageCode()),$this->getDescription());
                
                // Keyword
                foreach($this->getKeywordIds() as $id)
                {
                        $key =& $this->getKeyword($id);
                        $key->toXML($writer);
                }
                $writer->xmlEndTag('Classification');
        }

Here is the call graph for this function:

ilMDClassification::toXML ( &$  writer  ) 

Reimplemented from ilMDBase.

Definition at line 245 of file class.ilMDClassification.php.

References $id, $key, getDescription(), getDescriptionLanguageCode(), getKeyword(), getKeywordIds(), ilMDBase::getObjId(), getPurpose(), ilMDBase::getRBACId(), getTaxonPath(), and getTaxonPathIds().

        {
                $writer->xmlStartTag('Classification',array('Purpose' => $this->getPurpose()
                                                                                                        ? $this->getPurpose()
                                                                                                        : 'Idea'));

                // Taxon Path
                $taxs = $this->getTaxonPathIds();
                foreach($taxs as $id)
                {
                        $tax =& $this->getTaxonPath($id);
                        $tax->toXML($writer);
                }
                if(!count($taxs))
                {
                        include_once 'Services/MetaData/classes/class.ilMDTaxonPath.php';
                        $tax = new ilMDTaxonPath($this->getRBACId(),$this->getObjId());
                        $tax->toXML($writer);
                }

                // Description
                $writer->xmlElement('Description',array('Language' => $this->getDescriptionLanguageCode()
                                                                                                ? $this->getDescriptionLanguageCode()
                                                                                                : 'en'),
                                                        $this->getDescription());
                
                // Keyword
                $keys = $this->getKeywordIds();
                foreach($keys as $id)
                {
                        $key =& $this->getKeyword($id);
                        $key->toXML($writer);
                }
                if(!count($keys))
                {
                        include_once 'Services/MetaData/classes/class.ilMDKeyword.php';
                        $key = new ilMDKeyword($this->getRBACId(),$this->getObjId());
                        $key->toXML($writer);
                }
                $writer->xmlEndTag('Classification');
        }

Here is the call graph for this function:

ilMDClassification::update (  ) 

Reimplemented from ilMDBase.

Definition at line 166 of file class.ilMDClassification.php.

References ilMDBase::getMetaId().

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

Here is the call graph for this function:

ilMDClassification::update (  ) 

Reimplemented from ilMDBase.

Definition at line 166 of file class.ilMDClassification.php.

References ilMDBase::getMetaId().

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