ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMDTaxonPath Class Reference
+ Inheritance diagram for ilMDTaxonPath:
+ Collaboration diagram for ilMDTaxonPath:

Public Member Functions

getTaxonIds ()
 
getTaxon ($a_taxon_id)
 
addTaxon ()
 
 setSource ($a_source)
 
 getSource ()
 
 setSourceLanguage (&$lng_obj)
 
getSourceLanguage ()
 
 getSourceLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
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
 __construct ($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)
 
 __construct ($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)
 

Static Public Member Functions

static _getIds ($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
 

Additional Inherited Members

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

Detailed Description

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

Member Function Documentation

◆ __getFields() [1/2]

ilMDTaxonPath::__getFields ( )

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

146 {
147 return array('rbac_id' => array('integer',$this->getRBACId()),
148 'obj_id' => array('integer',$this->getObjId()),
149 'obj_type' => array('text',$this->getObjType()),
150 'parent_type' => array('text',$this->getParentType()),
151 'parent_id' => array('integer',$this->getParentId()),
152 'source' => array('text',$this->getSource()),
153 'source_language' => array('text',$this->getSourceLanguageCode()));
154 }

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

Referenced by save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getFields() [2/2]

ilMDTaxonPath::__getFields ( )

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

146 {
147 return array('rbac_id' => $this->getRBACId(),
148 'obj_id' => $this->getObjId(),
149 'obj_type' => ilUtil::prepareDBString($this->getObjType()),
150 'parent_type' => $this->getParentType(),
151 'parent_id' => $this->getParentId(),
152 'source' => ilUtil::prepareDBString($this->getSource()),
153 'source_language' => ilUtil::prepareDBString($this->getSourceLanguageCode()));
154 }
static prepareDBString($a_str)
prepare a string for db writing (insert/update)

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

+ Here is the call graph for this function:

◆ _getIds() [1/2]

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

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

217 {
218 global $ilDB;
219
220 $query = "SELECT meta_taxon_path_id FROM il_meta_taxon_path ".
221 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
222 "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
223 "AND parent_id = ".$ilDB->quote($a_parent_id ,'integer')." ".
224 "AND parent_type = ".$ilDB->quote($a_parent_type ,'text');
225
226 $res = $ilDB->query($query);
227 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
228 {
229 $ids[] = $row->meta_taxon_path_id;
230 }
231 return $ids ? $ids : array();
232 }
global $ilDB

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilMDClassification\getTaxonPathIds().

+ Here is the caller graph for this function:

◆ _getIds() [2/2]

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

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

207 {
208 global $ilDB;
209
210 $query = "SELECT meta_taxon_path_id FROM il_meta_taxon_path ".
211 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
212 "AND obj_id = ".$ilDB->quote($a_obj_id)." ".
213 "AND parent_id = ".$ilDB->quote($a_parent_id)." ".
214 "AND parent_type = ".$ilDB->quote($a_parent_type);
215
216 $res = $ilDB->query($query);
217 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
218 {
219 $ids[] = $row->meta_taxon_path_id;
220 }
221 return $ids ? $ids : array();
222 }

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

◆ addTaxon() [1/2]

& ilMDTaxonPath::addTaxon ( )

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

56 {
57 include_once 'Services/MetaData/classes/class.ilMDTaxon.php';
58
59 $tax = new ilMDTaxon($this->getRBACId(),$this->getObjId(),$this->getObjType());
60 $tax->setParentId($this->getMetaId());
61 $tax->setParentType('meta_taxon_path');
62
63 return $tax;
64 }

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

+ Here is the call graph for this function:

◆ addTaxon() [2/2]

& ilMDTaxonPath::addTaxon ( )

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

56 {
57 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDTaxon.php';
58
59 $tax = new ilMDTaxon($this->getRBACId(),$this->getObjId(),$this->getObjType());
60 $tax->setParentId($this->getMetaId());
61 $tax->setParentType('meta_taxon_path');
62
63 return $tax;
64 }

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

+ Here is the call graph for this function:

◆ delete() [1/2]

ilMDTaxonPath::delete ( )

Reimplemented from ilMDBase.

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

124 {
125 global $ilDB;
126
127 if($this->getMetaId())
128 {
129 $query = "DELETE FROM il_meta_taxon_path ".
130 "WHERE meta_taxon_path_id = ".$ilDB->quote($this->getMetaId(), 'integer');
131 $res = $ilDB->manipulate($query);
132
133 foreach($this->getTaxonIds() as $id)
134 {
135 $tax = $this->getTaxon($id);
136 $tax->delete();
137 }
138
139 return true;
140 }
141 return false;
142 }
& getTaxon($a_taxon_id)

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

+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDTaxonPath::delete ( )

Reimplemented from ilMDBase.

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

123 {
124 global $ilDB;
125
126 if($this->getMetaId())
127 {
128 $query = "DELETE FROM il_meta_taxon_path ".
129 "WHERE meta_taxon_path_id = ".$ilDB->quote($this->getMetaId());
130
131 $this->db->query($query);
132
133 foreach($this->getTaxonIds() as $id)
134 {
135 $tax = $this->getTaxon($id);
136 $tax->delete();
137 }
138
139 return true;
140 }
141 return false;
142 }

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

+ Here is the call graph for this function:

◆ getSource() [1/2]

ilMDTaxonPath::getSource ( )

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

72 {
73 return $this->source;
74 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getSource() [2/2]

ilMDTaxonPath::getSource ( )

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

72 {
73 return $this->source;
74 }

◆ getSourceLanguage() [1/2]

& ilMDTaxonPath::getSourceLanguage ( )

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

83 {
84 return is_object($this->source_language) ? $this->source_language : false;
85 }

◆ getSourceLanguage() [2/2]

& ilMDTaxonPath::getSourceLanguage ( )

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

83 {
84 return is_object($this->source_language) ? $this->source_language : false;
85 }

◆ getSourceLanguageCode() [1/2]

ilMDTaxonPath::getSourceLanguageCode ( )

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

87 {
88 return is_object($this->source_language) ? $this->source_language->getLanguageCode() : false;
89 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getSourceLanguageCode() [2/2]

ilMDTaxonPath::getSourceLanguageCode ( )

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

87 {
88 return is_object($this->source_language) ? $this->source_language->getLanguageCode() : false;
89 }

◆ getTaxon() [1/2]

& ilMDTaxonPath::getTaxon (   $a_taxon_id)

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

43 {
44 include_once 'Services/MetaData/classes/class.ilMDTaxon.php';
45
46 if(!$a_taxon_id)
47 {
48 return false;
49 }
50 $tax = new ilMDTaxon();
51 $tax->setMetaId($a_taxon_id);
52
53 return $tax;
54 }

Referenced by delete(), and toXML().

+ Here is the caller graph for this function:

◆ getTaxon() [2/2]

& ilMDTaxonPath::getTaxon (   $a_taxon_id)

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

43 {
44 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDTaxon.php';
45
46 if(!$a_taxon_id)
47 {
48 return false;
49 }
50 $tax = new ilMDTaxon();
51 $tax->setMetaId($a_taxon_id);
52
53 return $tax;
54 }

◆ getTaxonIds() [1/2]

& ilMDTaxonPath::getTaxonIds ( )

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

37 {
38 include_once 'Services/MetaData/classes/class.ilMDTaxon.php';
39
40 return ilMDTaxon::_getIds($this->getRBACId(),$this->getObjId(),$this->getMetaId(),'meta_taxon_path');
41 }
static _getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)

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

Referenced by delete(), and toXML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTaxonIds() [2/2]

& ilMDTaxonPath::getTaxonIds ( )

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

37 {
38 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDTaxon.php';
39
40 return ilMDTaxon::_getIds($this->getRBACId(),$this->getObjId(),$this->getMetaId(),'meta_taxon_path');
41 }

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

+ Here is the call graph for this function:

◆ read() [1/2]

ilMDTaxonPath::read ( )

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

157 {
158 global $ilDB;
159
160 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
161
162 if($this->getMetaId())
163 {
164 $query = "SELECT * FROM il_meta_taxon_path ".
165 "WHERE meta_taxon_path_id = ".$ilDB->quote($this->getMetaId() ,'integer');
166
167 $res = $ilDB->query($query);
168 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
169 {
170 $this->setRBACId($row->rbac_id);
171 $this->setObjId($row->obj_id);
172 $this->setObjType($row->obj_type);
173 $this->setParentId($row->parent_id);
174 $this->setParentType($row->parent_type);
175 $this->setSource($row->source);
176 $this->source_language = new ilMDLanguageItem($row->source_language);
177 }
178 }
179 return true;
180 }
setObjId($a_id)
setParentId($a_id)
setObjType($a_type)
setRBACId($a_id)
setParentType($a_parent_type)

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

+ Here is the call graph for this function:

◆ read() [2/2]

ilMDTaxonPath::read ( )

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

157 {
158 global $ilDB;
159
160 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
161
162 if($this->getMetaId())
163 {
164 $query = "SELECT * FROM il_meta_taxon_path ".
165 "WHERE meta_taxon_path_id = ".$ilDB->quote($this->getMetaId());
166
167 $res = $this->db->query($query);
168 while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
169 {
170 $this->setRBACId($row->rbac_id);
171 $this->setObjId($row->obj_id);
172 $this->setObjType($row->obj_type);
173 $this->setParentId($row->parent_id);
174 $this->setParentType($row->parent_type);
175 $this->setSource(ilUtil::stripSlashes($row->source));
176 $this->source_language = new ilMDLanguageItem($row->source_language);
177 }
178 }
179 return true;
180 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

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

+ Here is the call graph for this function:

◆ save() [1/2]

ilMDTaxonPath::save ( )

Reimplemented from ilMDBase.

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

93 {
94 global $ilDB;
95
96 $fields = $this->__getFields();
97 $fields['meta_taxon_path_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_taxon_path'));
98
99 if($this->db->insert('il_meta_taxon_path',$fields))
100 {
101 $this->setMetaId($next_id);
102 return $this->getMetaId();
103 }
104 return false;
105 }
setMetaId($a_meta_id, $a_read_data=true)

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

+ Here is the call graph for this function:

◆ save() [2/2]

ilMDTaxonPath::save ( )

Reimplemented from ilMDBase.

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

93 {
94 if($this->db->autoExecute('il_meta_taxon_path',
95 $this->__getFields(),
97 {
98 $this->setMetaId($this->db->getLastInsertId());
99
100 return $this->getMetaId();
101 }
102 return false;
103 }

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

+ Here is the call graph for this function:

◆ setSource() [1/2]

ilMDTaxonPath::setSource (   $a_source)

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

68 {
69 $this->source = $a_source;
70 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setSource() [2/2]

ilMDTaxonPath::setSource (   $a_source)

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

68 {
69 $this->source = $a_source;
70 }

◆ setSourceLanguage() [1/2]

ilMDTaxonPath::setSourceLanguage ( $lng_obj)

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

76 {
77 if(is_object($lng_obj))
78 {
79 $this->source_language = $lng_obj;
80 }
81 }

◆ setSourceLanguage() [2/2]

ilMDTaxonPath::setSourceLanguage ( $lng_obj)

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

76 {
77 if(is_object($lng_obj))
78 {
79 $this->source_language = $lng_obj;
80 }
81 }

◆ toXML() [1/2]

ilMDTaxonPath::toXML ( $writer)

Reimplemented from ilMDBase.

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

188 {
189 $writer->xmlStartTag('TaxonPath');
190
191 $writer->xmlElement('Source',array('Language' => $this->getSourceLanguageCode()
192 ? $this->getSourceLanguageCode()
193 : 'en'),
194 $this->getSource());
195
196 // Taxon
197 $taxs = $this->getTaxonIds();
198 foreach($taxs as $id)
199 {
200 $tax =& $this->getTaxon($id);
201 $tax->toXML($writer);
202 }
203 if(!count($taxs))
204 {
205 include_once 'Services/MetaData/classes/class.ilMDTaxon.php';
206 $tax = new ilMDTaxon($this->getRBACId(),$this->getObjId());
207 $tax->toXML($writer);
208 }
209
210 $writer->xmlEndTag('TaxonPath');
211 }

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

+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDTaxonPath::toXML ( $writer)

Reimplemented from ilMDBase.

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

188 {
189 $writer->xmlStartTag('TaxonPath');
190
191 $writer->xmlElement('Source',array('Language' => $this->getSourceLanguageCode()),$this->getSource());
192
193 // Taxon
194 foreach($this->getTaxonIds() as $id)
195 {
196 $tax =& $this->getTaxon($id);
197 $tax->toXML($writer);
198 }
199
200 $writer->xmlEndTag('TaxonPath');
201 }

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

+ Here is the call graph for this function:

◆ update() [1/2]

ilMDTaxonPath::update ( )

Reimplemented from ilMDBase.

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

108 {
109 global $ilDB;
110
111 if($this->getMetaId())
112 {
113 if($this->db->update('il_meta_taxon_path',
114 $this->__getFields(),
115 array("meta_taxon_path_id" => array('integer',$this->getMetaId()))))
116 {
117 return true;
118 }
119 }
120 return false;
121 }

References $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDTaxonPath::update ( )

Reimplemented from ilMDBase.

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

106 {
107 global $ilDB;
108
109 if($this->getMetaId())
110 {
111 if($this->db->autoExecute('il_meta_taxon_path',
112 $this->__getFields(),
114 "meta_taxon_path_id = ".$ilDB->quote($this->getMetaId())))
115 {
116 return true;
117 }
118 }
119 return false;
120 }

References $ilDB, ilMDBase\getMetaId(), and ilDBConstants\MDB2_AUTOQUERY_UPDATE.

+ Here is the call graph for this function:

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