ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilMDTaxon Class Reference
+ Inheritance diagram for ilMDTaxon:
+ Collaboration diagram for ilMDTaxon:

Public Member Functions

 ilMDTaxon ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 setTaxon ($a_taxon)
 
 getTaxon ()
 
 setTaxonLanguage (&$lng_obj)
 
getTaxonLanguage ()
 
 getTaxonLanguageCode ()
 
 setTaxonId ($a_taxon_id)
 
 getTaxonId ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 _getIds ($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
 
 ilMDTaxon ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 setTaxon ($a_taxon)
 
 getTaxon ()
 
 setTaxonLanguage (&$lng_obj)
 
getTaxonLanguage ()
 
 getTaxonLanguageCode ()
 
 setTaxonId ($a_taxon_id)
 
 getTaxonId ()
 
 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 ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (&$writer)
 
 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 ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (&$writer)
 

Additional Inherited Members

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

Detailed Description

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

Member Function Documentation

◆ __getFields() [1/2]

ilMDTaxon::__getFields ( )

Definition at line 121 of file class.ilMDTaxon.php.

References ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), ilMDBase\getRBACId(), getTaxon(), getTaxonId(), getTaxonLanguageCode(), and ilUtil\prepareDBString().

122  {
123  return array('rbac_id' => $this->getRBACId(),
124  'obj_id' => $this->getObjId(),
125  'obj_type' => ilUtil::prepareDBString($this->getObjType()),
126  'parent_type' => $this->getParentType(),
127  'parent_id' => $this->getParentId(),
128  'taxon' => ilUtil::prepareDBString($this->getTaxon()),
129  'taxon_language' => ilUtil::prepareDBString($this->getTaxonLanguageCode()),
130  'taxon_id' => ilUtil::prepareDBString($this->getTaxonId()));
131  }
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
+ Here is the call graph for this function:

◆ __getFields() [2/2]

ilMDTaxon::__getFields ( )

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

References ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), ilMDBase\getRBACId(), getTaxon(), getTaxonId(), and getTaxonLanguageCode().

Referenced by save().

125  {
126  return array('rbac_id' => array('integer',$this->getRBACId()),
127  'obj_id' => array('integer',$this->getObjId()),
128  'obj_type' => array('text',$this->getObjType()),
129  'parent_type' => array('text',$this->getParentType()),
130  'parent_id' => array('integer',$this->getParentId()),
131  'taxon' => array('text',$this->getTaxon()),
132  'taxon_language' => array('text',$this->getTaxonLanguageCode()),
133  'taxon_id' => array('text',$this->getTaxonId()));
134  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getIds() [1/2]

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

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

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

174  {
175  global $ilDB;
176 
177  $query = "SELECT meta_taxon_id FROM il_meta_taxon ".
178  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
179  "AND obj_id = ".$ilDB->quote($a_obj_id)." ".
180  "AND parent_id = ".$ilDB->quote($a_parent_id)." ".
181  "AND parent_type = ".$ilDB->quote($a_parent_type);
182 
183 
184  $res = $ilDB->query($query);
185  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
186  {
187  $ids[] = $row->meta_taxon_id;
188  }
189  return $ids ? $ids : array();
190  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB

◆ _getIds() [2/2]

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

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

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilMDTaxonPath\getTaxonIds().

181  {
182  global $ilDB;
183 
184  $query = "SELECT meta_taxon_id FROM il_meta_taxon ".
185  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
186  "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
187  "AND parent_id = ".$ilDB->quote($a_parent_id ,'integer')." ".
188  "AND parent_type = ".$ilDB->quote($a_parent_type ,'text');
189 
190 
191  $res = $ilDB->query($query);
192  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
193  {
194  $ids[] = $row->meta_taxon_id;
195  }
196  return $ids ? $ids : array();
197  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB
+ Here is the caller graph for this function:

◆ delete() [1/2]

ilMDTaxon::delete ( )

Definition at line 106 of file class.ilMDTaxon.php.

References $query, and ilMDBase\getMetaId().

107  {
108  if($this->getMetaId())
109  {
110  $query = "DELETE FROM il_meta_taxon ".
111  "WHERE meta_taxon_id = ".$ilDB->quote($this->getMetaId());
112 
113  $this->db->query($query);
114 
115  return true;
116  }
117  return false;
118  }
+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDTaxon::delete ( )

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

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

108  {
109  global $ilDB;
110 
111  if($this->getMetaId())
112  {
113  $query = "DELETE FROM il_meta_taxon ".
114  "WHERE meta_taxon_id = ".$ilDB->quote($this->getMetaId() ,'integer');
115 
116  $this->db->query($query);
117 
118  return true;
119  }
120  return false;
121  }
global $ilDB
+ Here is the call graph for this function:

◆ getTaxon() [1/2]

ilMDTaxon::getTaxon ( )

Definition at line 47 of file class.ilMDTaxon.php.

Referenced by __getFields(), and toXML().

48  {
49  return $this->taxon;
50  }
+ Here is the caller graph for this function:

◆ getTaxon() [2/2]

ilMDTaxon::getTaxon ( )

Definition at line 47 of file class.ilMDTaxon.php.

48  {
49  return $this->taxon;
50  }

◆ getTaxonId() [1/2]

ilMDTaxon::getTaxonId ( )

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

Referenced by __getFields(), and toXML().

71  {
72  return $this->taxon_id;
73  }
+ Here is the caller graph for this function:

◆ getTaxonId() [2/2]

ilMDTaxon::getTaxonId ( )

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

71  {
72  return $this->taxon_id;
73  }

◆ getTaxonLanguage() [1/2]

& ilMDTaxon::getTaxonLanguage ( )

Definition at line 58 of file class.ilMDTaxon.php.

59  {
60  return is_object($this->taxon_language) ? $this->taxon_language : false;
61  }

◆ getTaxonLanguage() [2/2]

& ilMDTaxon::getTaxonLanguage ( )

Definition at line 58 of file class.ilMDTaxon.php.

59  {
60  return is_object($this->taxon_language) ? $this->taxon_language : false;
61  }

◆ getTaxonLanguageCode() [1/2]

ilMDTaxon::getTaxonLanguageCode ( )

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

63  {
64  return is_object($this->taxon_language) ? $this->taxon_language->getLanguageCode() : false;
65  }

◆ getTaxonLanguageCode() [2/2]

ilMDTaxon::getTaxonLanguageCode ( )

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

Referenced by __getFields(), and toXML().

63  {
64  return is_object($this->taxon_language) ? $this->taxon_language->getLanguageCode() : false;
65  }
+ Here is the caller graph for this function:

◆ ilMDTaxon() [1/2]

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

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

36  {
37  parent::ilMDBase($a_rbac_id,
38  $a_obj_id,
39  $a_obj_type);
40  }

◆ ilMDTaxon() [2/2]

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

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

36  {
37  parent::ilMDBase($a_rbac_id,
38  $a_obj_id,
39  $a_obj_type);
40  }

◆ read() [1/2]

ilMDTaxon::read ( )

Definition at line 133 of file class.ilMDTaxon.php.

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, ilMDBase\getMetaId(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setParentId(), ilMDBase\setParentType(), ilMDBase\setRBACId(), setTaxon(), setTaxonId(), and ilUtil\stripSlashes().

134  {
135  global $ilDB;
136 
137  include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
138 
139  if($this->getMetaId())
140  {
141  $query = "SELECT * FROM il_meta_taxon ".
142  "WHERE meta_taxon_id = ".$ilDB->quote($this->getMetaId());
143 
144  $res = $this->db->query($query);
145  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
146  {
147  $this->setRBACId($row->rbac_id);
148  $this->setObjId($row->obj_id);
149  $this->setObjType($row->obj_type);
150  $this->setParentId($row->parent_id);
151  $this->setParentType($row->parent_type);
152  $this->setTaxon(ilUtil::stripSlashes($row->taxon));
153  $this->taxon_language = new ilMDLanguageItem($row->taxon_language);
154  $this->setTaxonId(ilUtil::stripSlashes($row->taxon_id));
155  }
156  }
157  return true;
158  }
setObjType($a_type)
setTaxon($a_taxon)
setTaxonId($a_taxon_id)
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
setObjId($a_id)
setRBACId($a_id)
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setParentId($a_id)
global $ilDB
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ read() [2/2]

ilMDTaxon::read ( )

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

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, ilMDBase\getMetaId(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setParentId(), ilMDBase\setParentType(), ilMDBase\setRBACId(), setTaxon(), and setTaxonId().

137  {
138  global $ilDB;
139 
140  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
141 
142  if($this->getMetaId())
143  {
144  $query = "SELECT * FROM il_meta_taxon ".
145  "WHERE meta_taxon_id = ".$ilDB->quote($this->getMetaId() ,'integer');
146 
147  $res = $this->db->query($query);
148  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
149  {
150  $this->setRBACId($row->rbac_id);
151  $this->setObjId($row->obj_id);
152  $this->setObjType($row->obj_type);
153  $this->setParentId($row->parent_id);
154  $this->setParentType($row->parent_type);
155  $this->setTaxon($row->taxon);
156  $this->taxon_language = new ilMDLanguageItem($row->taxon_language);
157  $this->setTaxonId($row->taxon_id);
158  }
159  }
160  return true;
161  }
setObjType($a_type)
setTaxon($a_taxon)
setTaxonId($a_taxon_id)
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
setObjId($a_id)
setRBACId($a_id)
setParentId($a_id)
global $ilDB
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ save() [1/2]

ilMDTaxon::save ( )

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

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

77  {
78  global $ilDB;
79 
80  $fields = $this->__getFields();
81  $fields['meta_taxon_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_taxon'));
82 
83  if($this->db->insert('il_meta_taxon',$fields))
84  {
85  $this->setMetaId($next_id);
86  return $this->getMetaId();
87  }
88  return false;
89  }
setMetaId($a_meta_id, $a_read_data=true)
global $ilDB
+ Here is the call graph for this function:

◆ save() [2/2]

ilMDTaxon::save ( )

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

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

77  {
78  if($this->db->autoExecute('il_meta_taxon',
79  $this->__getFields(),
80  DB_AUTOQUERY_INSERT))
81  {
82  $this->setMetaId($this->db->getLastInsertId());
83 
84  return $this->getMetaId();
85  }
86  return false;
87  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ setTaxon() [1/2]

ilMDTaxon::setTaxon (   $a_taxon)

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

44  {
45  $this->taxon = $a_taxon;
46  }

◆ setTaxon() [2/2]

ilMDTaxon::setTaxon (   $a_taxon)

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

Referenced by read().

44  {
45  $this->taxon = $a_taxon;
46  }
+ Here is the caller graph for this function:

◆ setTaxonId() [1/2]

ilMDTaxon::setTaxonId (   $a_taxon_id)

Definition at line 66 of file class.ilMDTaxon.php.

67  {
68  $this->taxon_id = $a_taxon_id;
69  }

◆ setTaxonId() [2/2]

ilMDTaxon::setTaxonId (   $a_taxon_id)

Definition at line 66 of file class.ilMDTaxon.php.

Referenced by read().

67  {
68  $this->taxon_id = $a_taxon_id;
69  }
+ Here is the caller graph for this function:

◆ setTaxonLanguage() [1/2]

ilMDTaxon::setTaxonLanguage ( $lng_obj)

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

52  {
53  if(is_object($lng_obj))
54  {
55  $this->taxon_language = $lng_obj;
56  }
57  }

◆ setTaxonLanguage() [2/2]

ilMDTaxon::setTaxonLanguage ( $lng_obj)

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

52  {
53  if(is_object($lng_obj))
54  {
55  $this->taxon_language = $lng_obj;
56  }
57  }

◆ toXML() [1/2]

ilMDTaxon::toXML ( $writer)

Definition at line 165 of file class.ilMDTaxon.php.

References getTaxon(), getTaxonId(), and getTaxonLanguageCode().

166  {
167  $writer->xmlElement('Taxon',array('Language' => $this->getTaxonLanguageCode(),
168  'Id' => $this->getTaxonId()),$this->getTaxon());
169  }
+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDTaxon::toXML ( $writer)

Definition at line 168 of file class.ilMDTaxon.php.

References getTaxon(), getTaxonId(), and getTaxonLanguageCode().

169  {
170  $writer->xmlElement('Taxon',array('Language' => $this->getTaxonLanguageCode()
171  ? $this->getTaxonLanguageCode()
172  : 'en',
173  'Id' => $this->getTaxonId() ?
174  $this->getTaxonId() : ("ID".rand())),
175  $this->getTaxon());
176  }
+ Here is the call graph for this function:

◆ update() [1/2]

ilMDTaxon::update ( )

Definition at line 89 of file class.ilMDTaxon.php.

References $ilDB, and ilMDBase\getMetaId().

90  {
91  global $ilDB;
92 
93  if($this->getMetaId())
94  {
95  if($this->db->autoExecute('il_meta_taxon',
96  $this->__getFields(),
97  DB_AUTOQUERY_UPDATE,
98  "meta_taxon_id = ".$ilDB->quote($this->getMetaId())))
99  {
100  return true;
101  }
102  }
103  return false;
104  }
global $ilDB
+ Here is the call graph for this function:

◆ update() [2/2]

ilMDTaxon::update ( )

Definition at line 91 of file class.ilMDTaxon.php.

References $ilDB, and ilMDBase\getMetaId().

92  {
93  global $ilDB;
94 
95  if($this->getMetaId())
96  {
97  if($this->db->update('il_meta_taxon',
98  $this->__getFields(),
99  array("meta_taxon_id" => array('integer',$this->getMetaId()))))
100  {
101  return true;
102  }
103  }
104  return false;
105  }
global $ilDB
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: