ILIAS  release_4-4 Revision
ilMDTaxonPath Class Reference
+ Inheritance diagram for ilMDTaxonPath:
+ Collaboration diagram for ilMDTaxonPath:

Public Member Functions

 ilMDTaxonPath ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
getTaxonIds ()
 
getTaxon ($a_taxon_id)
 
addTaxon ()
 
 setSource ($a_source)
 
 getSource ()
 
 setSourceLanguage (&$lng_obj)
 
getSourceLanguage ()
 
 getSourceLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 _getIds ($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
 
 ilMDTaxonPath ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
getTaxonIds ()
 
getTaxon ($a_taxon_id)
 
addTaxon ()
 
 setSource ($a_source)
 
 getSource ()
 
 setSourceLanguage (&$lng_obj)
 
getSourceLanguage ()
 
 getSourceLanguageCode ()
 
 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.ilMDTaxonPath.php.

Member Function Documentation

◆ __getFields() [1/2]

ilMDTaxonPath::__getFields ( )

Definition at line 152 of file class.ilMDTaxonPath.php.

References ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), ilMDBase\getRBACId(), getSource(), and getSourceLanguageCode().

Referenced by save().

153  {
154  return array('rbac_id' => array('integer',$this->getRBACId()),
155  'obj_id' => array('integer',$this->getObjId()),
156  'obj_type' => array('text',$this->getObjType()),
157  'parent_type' => array('text',$this->getParentType()),
158  'parent_id' => array('integer',$this->getParentId()),
159  'source' => array('text',$this->getSource()),
160  'source_language' => array('text',$this->getSourceLanguageCode()));
161  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getFields() [2/2]

ilMDTaxonPath::__getFields ( )

Definition at line 152 of file class.ilMDTaxonPath.php.

References ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getParentId(), ilMDBase\getParentType(), ilMDBase\getRBACId(), getSource(), getSourceLanguageCode(), and ilUtil\prepareDBString().

153  {
154  return array('rbac_id' => $this->getRBACId(),
155  'obj_id' => $this->getObjId(),
156  'obj_type' => ilUtil::prepareDBString($this->getObjType()),
157  'parent_type' => $this->getParentType(),
158  'parent_id' => $this->getParentId(),
159  'source' => ilUtil::prepareDBString($this->getSource()),
160  'source_language' => ilUtil::prepareDBString($this->getSourceLanguageCode()));
161  }
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
+ Here is the call graph for this function:

◆ _getIds() [1/2]

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

Definition at line 213 of file class.ilMDTaxonPath.php.

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

214  {
215  global $ilDB;
216 
217  $query = "SELECT meta_taxon_path_id FROM il_meta_taxon_path ".
218  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
219  "AND obj_id = ".$ilDB->quote($a_obj_id)." ".
220  "AND parent_id = ".$ilDB->quote($a_parent_id)." ".
221  "AND parent_type = ".$ilDB->quote($a_parent_type);
222 
223  $res = $ilDB->query($query);
224  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
225  {
226  $ids[] = $row->meta_taxon_path_id;
227  }
228  return $ids ? $ids : array();
229  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

◆ _getIds() [2/2]

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

Definition at line 223 of file class.ilMDTaxonPath.php.

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

Referenced by ilMDClassification\getTaxonPathIds().

224  {
225  global $ilDB;
226 
227  $query = "SELECT meta_taxon_path_id FROM il_meta_taxon_path ".
228  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
229  "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
230  "AND parent_id = ".$ilDB->quote($a_parent_id ,'integer')." ".
231  "AND parent_type = ".$ilDB->quote($a_parent_type ,'text');
232 
233  $res = $ilDB->query($query);
234  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
235  {
236  $ids[] = $row->meta_taxon_path_id;
237  }
238  return $ids ? $ids : array();
239  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ addTaxon() [1/2]

& ilMDTaxonPath::addTaxon ( )

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

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

63  {
64  include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDTaxon.php';
65 
66  $tax =& new ilMDTaxon($this->getRBACId(),$this->getObjId(),$this->getObjType());
67  $tax->setParentId($this->getMetaId());
68  $tax->setParentType('meta_taxon_path');
69 
70  return $tax;
71  }
+ Here is the call graph for this function:

◆ addTaxon() [2/2]

& ilMDTaxonPath::addTaxon ( )

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

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

63  {
64  include_once 'Services/MetaData/classes/class.ilMDTaxon.php';
65 
66  $tax =& new ilMDTaxon($this->getRBACId(),$this->getObjId(),$this->getObjType());
67  $tax->setParentId($this->getMetaId());
68  $tax->setParentType('meta_taxon_path');
69 
70  return $tax;
71  }
+ Here is the call graph for this function:

◆ delete() [1/2]

ilMDTaxonPath::delete ( )

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

References $query, ilMDBase\getMetaId(), getTaxon(), and getTaxonIds().

130  {
131  global $ilDB;
132 
133  if($this->getMetaId())
134  {
135  $query = "DELETE FROM il_meta_taxon_path ".
136  "WHERE meta_taxon_path_id = ".$ilDB->quote($this->getMetaId());
137 
138  $this->db->query($query);
139 
140  foreach($this->getTaxonIds() as $id)
141  {
142  $tax = $this->getTaxon($id);
143  $tax->delete();
144  }
145 
146  return true;
147  }
148  return false;
149  }
& getTaxon($a_taxon_id)
+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDTaxonPath::delete ( )

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

References $query, $res, ilMDBase\getMetaId(), getTaxon(), and getTaxonIds().

131  {
132  global $ilDB;
133 
134  if($this->getMetaId())
135  {
136  $query = "DELETE FROM il_meta_taxon_path ".
137  "WHERE meta_taxon_path_id = ".$ilDB->quote($this->getMetaId(), 'integer');
138  $res = $ilDB->manipulate($query);
139 
140  foreach($this->getTaxonIds() as $id)
141  {
142  $tax = $this->getTaxon($id);
143  $tax->delete();
144  }
145 
146  return true;
147  }
148  return false;
149  }
& getTaxon($a_taxon_id)
+ Here is the call graph for this function:

◆ getSource() [1/2]

ilMDTaxonPath::getSource ( )

Definition at line 78 of file class.ilMDTaxonPath.php.

79  {
80  return $this->source;
81  }

◆ getSource() [2/2]

ilMDTaxonPath::getSource ( )

Definition at line 78 of file class.ilMDTaxonPath.php.

Referenced by __getFields(), and toXML().

79  {
80  return $this->source;
81  }
+ Here is the caller graph for this function:

◆ getSourceLanguage() [1/2]

& ilMDTaxonPath::getSourceLanguage ( )

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

90  {
91  return is_object($this->source_language) ? $this->source_language : false;
92  }

◆ getSourceLanguage() [2/2]

& ilMDTaxonPath::getSourceLanguage ( )

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

90  {
91  return is_object($this->source_language) ? $this->source_language : false;
92  }

◆ getSourceLanguageCode() [1/2]

ilMDTaxonPath::getSourceLanguageCode ( )

Definition at line 93 of file class.ilMDTaxonPath.php.

Referenced by __getFields(), and toXML().

94  {
95  return is_object($this->source_language) ? $this->source_language->getLanguageCode() : false;
96  }
+ Here is the caller graph for this function:

◆ getSourceLanguageCode() [2/2]

ilMDTaxonPath::getSourceLanguageCode ( )

Definition at line 93 of file class.ilMDTaxonPath.php.

94  {
95  return is_object($this->source_language) ? $this->source_language->getLanguageCode() : false;
96  }

◆ getTaxon() [1/2]

& ilMDTaxonPath::getTaxon (   $a_taxon_id)

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

Referenced by delete(), and toXML().

50  {
51  include_once 'Services/MetaData/classes/class.ilMDTaxon.php';
52 
53  if(!$a_taxon_id)
54  {
55  return false;
56  }
57  $tax =& new ilMDTaxon();
58  $tax->setMetaId($a_taxon_id);
59 
60  return $tax;
61  }
+ Here is the caller graph for this function:

◆ getTaxon() [2/2]

& ilMDTaxonPath::getTaxon (   $a_taxon_id)

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

50  {
51  include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDTaxon.php';
52 
53  if(!$a_taxon_id)
54  {
55  return false;
56  }
57  $tax =& new ilMDTaxon();
58  $tax->setMetaId($a_taxon_id);
59 
60  return $tax;
61  }

◆ getTaxonIds() [1/2]

& ilMDTaxonPath::getTaxonIds ( )

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

References ilMDTaxon\_getIds(), ilMDBase\getMetaId(), ilMDBase\getObjId(), and ilMDBase\getRBACId().

44  {
45  include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDTaxon.php';
46 
47  return ilMDTaxon::_getIds($this->getRBACId(),$this->getObjId(),$this->getMetaId(),'meta_taxon_path');
48  }
_getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
+ Here is the call graph for this function:

◆ getTaxonIds() [2/2]

& ilMDTaxonPath::getTaxonIds ( )

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

References ilMDTaxon\_getIds(), ilMDBase\getMetaId(), ilMDBase\getObjId(), and ilMDBase\getRBACId().

Referenced by delete(), and toXML().

44  {
45  include_once 'Services/MetaData/classes/class.ilMDTaxon.php';
46 
47  return ilMDTaxon::_getIds($this->getRBACId(),$this->getObjId(),$this->getMetaId(),'meta_taxon_path');
48  }
_getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ilMDTaxonPath() [1/2]

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

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

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

◆ ilMDTaxonPath() [2/2]

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

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

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

◆ read() [1/2]

ilMDTaxonPath::read ( )

Definition at line 163 of file class.ilMDTaxonPath.php.

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

164  {
165  global $ilDB;
166 
167  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
168 
169  if($this->getMetaId())
170  {
171  $query = "SELECT * FROM il_meta_taxon_path ".
172  "WHERE meta_taxon_path_id = ".$ilDB->quote($this->getMetaId() ,'integer');
173 
174  $res = $ilDB->query($query);
175  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
176  {
177  $this->setRBACId($row->rbac_id);
178  $this->setObjId($row->obj_id);
179  $this->setObjType($row->obj_type);
180  $this->setParentId($row->parent_id);
181  $this->setParentType($row->parent_type);
182  $this->setSource($row->source);
183  $this->source_language = new ilMDLanguageItem($row->source_language);
184  }
185  }
186  return true;
187  }
setObjType($a_type)
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
setObjId($a_id)
setRBACId($a_id)
setParentId($a_id)
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ read() [2/2]

ilMDTaxonPath::read ( )

Definition at line 163 of file class.ilMDTaxonPath.php.

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

164  {
165  global $ilDB;
166 
167  include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
168 
169  if($this->getMetaId())
170  {
171  $query = "SELECT * FROM il_meta_taxon_path ".
172  "WHERE meta_taxon_path_id = ".$ilDB->quote($this->getMetaId());
173 
174  $res = $this->db->query($query);
175  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
176  {
177  $this->setRBACId($row->rbac_id);
178  $this->setObjId($row->obj_id);
179  $this->setObjType($row->obj_type);
180  $this->setParentId($row->parent_id);
181  $this->setParentType($row->parent_type);
182  $this->setSource(ilUtil::stripSlashes($row->source));
183  $this->source_language = new ilMDLanguageItem($row->source_language);
184  }
185  }
186  return true;
187  }
setObjType($a_type)
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)
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ save() [1/2]

ilMDTaxonPath::save ( )

Definition at line 99 of file class.ilMDTaxonPath.php.

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

100  {
101  global $ilDB;
102 
103  $fields = $this->__getFields();
104  $fields['meta_taxon_path_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_taxon_path'));
105 
106  if($this->db->insert('il_meta_taxon_path',$fields))
107  {
108  $this->setMetaId($next_id);
109  return $this->getMetaId();
110  }
111  return false;
112  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ save() [2/2]

ilMDTaxonPath::save ( )

Definition at line 99 of file class.ilMDTaxonPath.php.

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

100  {
101  if($this->db->autoExecute('il_meta_taxon_path',
102  $this->__getFields(),
103  DB_AUTOQUERY_INSERT))
104  {
105  $this->setMetaId($this->db->getLastInsertId());
106 
107  return $this->getMetaId();
108  }
109  return false;
110  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ setSource() [1/2]

ilMDTaxonPath::setSource (   $a_source)

Definition at line 74 of file class.ilMDTaxonPath.php.

75  {
76  $this->source = $a_source;
77  }

◆ setSource() [2/2]

ilMDTaxonPath::setSource (   $a_source)

Definition at line 74 of file class.ilMDTaxonPath.php.

Referenced by read().

75  {
76  $this->source = $a_source;
77  }
+ Here is the caller graph for this function:

◆ setSourceLanguage() [1/2]

ilMDTaxonPath::setSourceLanguage ( $lng_obj)

Definition at line 82 of file class.ilMDTaxonPath.php.

83  {
84  if(is_object($lng_obj))
85  {
86  $this->source_language = $lng_obj;
87  }
88  }

◆ setSourceLanguage() [2/2]

ilMDTaxonPath::setSourceLanguage ( $lng_obj)

Definition at line 82 of file class.ilMDTaxonPath.php.

83  {
84  if(is_object($lng_obj))
85  {
86  $this->source_language = $lng_obj;
87  }
88  }

◆ toXML() [1/2]

ilMDTaxonPath::toXML ( $writer)

Definition at line 194 of file class.ilMDTaxonPath.php.

References getSource(), getSourceLanguageCode(), getTaxon(), and getTaxonIds().

195  {
196  $writer->xmlStartTag('TaxonPath');
197 
198  $writer->xmlElement('Source',array('Language' => $this->getSourceLanguageCode()),$this->getSource());
199 
200  // Taxon
201  foreach($this->getTaxonIds() as $id)
202  {
203  $tax =& $this->getTaxon($id);
204  $tax->toXML($writer);
205  }
206 
207  $writer->xmlEndTag('TaxonPath');
208  }
& getTaxon($a_taxon_id)
+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDTaxonPath::toXML ( $writer)

Definition at line 194 of file class.ilMDTaxonPath.php.

References ilMDBase\getObjId(), ilMDBase\getRBACId(), getSource(), getSourceLanguageCode(), getTaxon(), and getTaxonIds().

195  {
196  $writer->xmlStartTag('TaxonPath');
197 
198  $writer->xmlElement('Source',array('Language' => $this->getSourceLanguageCode()
199  ? $this->getSourceLanguageCode()
200  : 'en'),
201  $this->getSource());
202 
203  // Taxon
204  $taxs = $this->getTaxonIds();
205  foreach($taxs as $id)
206  {
207  $tax =& $this->getTaxon($id);
208  $tax->toXML($writer);
209  }
210  if(!count($taxs))
211  {
212  include_once 'Services/MetaData/classes/class.ilMDTaxon.php';
213  $tax = new ilMDTaxon($this->getRBACId(),$this->getObjId());
214  $tax->toXML($writer);
215  }
216 
217  $writer->xmlEndTag('TaxonPath');
218  }
& getTaxon($a_taxon_id)
+ Here is the call graph for this function:

◆ update() [1/2]

ilMDTaxonPath::update ( )

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

References ilMDBase\getMetaId().

113  {
114  global $ilDB;
115 
116  if($this->getMetaId())
117  {
118  if($this->db->autoExecute('il_meta_taxon_path',
119  $this->__getFields(),
120  DB_AUTOQUERY_UPDATE,
121  "meta_taxon_path_id = ".$ilDB->quote($this->getMetaId())))
122  {
123  return true;
124  }
125  }
126  return false;
127  }
+ Here is the call graph for this function:

◆ update() [2/2]

ilMDTaxonPath::update ( )

Definition at line 114 of file class.ilMDTaxonPath.php.

References ilMDBase\getMetaId().

115  {
116  global $ilDB;
117 
118  if($this->getMetaId())
119  {
120  if($this->db->update('il_meta_taxon_path',
121  $this->__getFields(),
122  array("meta_taxon_path_id" => array('integer',$this->getMetaId()))))
123  {
124  return true;
125  }
126  }
127  return false;
128  }
+ Here is the call graph for this function:

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