ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 146 of file class.ilMDTaxonPath.php.

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

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 142 of file class.ilMDTaxonPath.php.

143 {
144 return array('rbac_id' => $this->getRBACId(),
145 'obj_id' => $this->getObjId(),
146 'obj_type' => ilUtil::prepareDBString($this->getObjType()),
147 'parent_type' => $this->getParentType(),
148 'parent_id' => $this->getParentId(),
149 'source' => ilUtil::prepareDBString($this->getSource()),
150 'source_language' => ilUtil::prepareDBString($this->getSourceLanguageCode()));
151 }
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 218 of file class.ilMDTaxonPath.php.

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

References $DIC, $ilDB, $query, $res, 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 200 of file class.ilMDTaxonPath.php.

201 {
202 global $ilDB;
203
204 $query = "SELECT meta_taxon_path_id FROM il_meta_taxon_path " .
205 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id) . " " .
206 "AND obj_id = " . $ilDB->quote($a_obj_id) . " " .
207 "AND parent_id = " . $ilDB->quote($a_parent_id) . " " .
208 "AND parent_type = " . $ilDB->quote($a_parent_type);
209
210 $res = $ilDB->query($query);
211 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
212 $ids[] = $row->meta_taxon_path_id;
213 }
214 return $ids ? $ids : array();
215 }

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

◆ addTaxon() [1/2]

& ilMDTaxonPath::addTaxon ( )

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

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

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 54 of file class.ilMDTaxonPath.php.

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

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 124 of file class.ilMDTaxonPath.php.

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

References $DIC, $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 121 of file class.ilMDTaxonPath.php.

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

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

+ Here is the call graph for this function:

◆ getSource() [1/2]

ilMDTaxonPath::getSource ( )

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

71 {
72 return $this->source;
73 }
$source
Definition: metadata.php:76

References $source.

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getSource() [2/2]

ilMDTaxonPath::getSource ( )

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

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

References $source.

◆ getSourceLanguage() [1/2]

& ilMDTaxonPath::getSourceLanguage ( )

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

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

◆ getSourceLanguage() [2/2]

& ilMDTaxonPath::getSourceLanguage ( )

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

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

◆ getSourceLanguageCode() [1/2]

ilMDTaxonPath::getSourceLanguageCode ( )

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

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

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getSourceLanguageCode() [2/2]

ilMDTaxonPath::getSourceLanguageCode ( )

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

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

◆ 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 return false;
48 }
49 $tax = new ilMDTaxon();
50 $tax->setMetaId($a_taxon_id);
51
52 return $tax;
53 }

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 return false;
48 }
49 $tax = new ilMDTaxon();
50 $tax->setMetaId($a_taxon_id);
51
52 return $tax;
53 }

◆ 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 157 of file class.ilMDTaxonPath.php.

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

References $DIC, $ilDB, $query, $res, 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 153 of file class.ilMDTaxonPath.php.

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

References $ilDB, $query, $res, 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 90 of file class.ilMDTaxonPath.php.

91 {
92 global $DIC;
93
94 $ilDB = $DIC['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 $this->setMetaId($next_id);
101 return $this->getMetaId();
102 }
103 return false;
104 }
setMetaId($a_meta_id, $a_read_data=true)

References $DIC, $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 90 of file class.ilMDTaxonPath.php.

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

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

+ Here is the call graph for this function:

◆ setSource() [1/2]

ilMDTaxonPath::setSource (   $a_source)

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

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

Referenced by read().

+ Here is the caller graph for this function:

◆ setSource() [2/2]

ilMDTaxonPath::setSource (   $a_source)

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

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

◆ setSourceLanguage() [1/2]

ilMDTaxonPath::setSourceLanguage ( $lng_obj)

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

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

◆ setSourceLanguage() [2/2]

ilMDTaxonPath::setSourceLanguage ( $lng_obj)

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

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

◆ toXML() [1/2]

ilMDTaxonPath::toXML ( $writer)

Reimplemented from ilMDBase.

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

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

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 182 of file class.ilMDTaxonPath.php.

183 {
184 $writer->xmlStartTag('TaxonPath');
185
186 $writer->xmlElement('Source', array('Language' => $this->getSourceLanguageCode()), $this->getSource());
187
188 // Taxon
189 foreach ($this->getTaxonIds() as $id) {
190 $tax = &$this->getTaxon($id);
191 $tax->toXML($writer);
192 }
193
194 $writer->xmlEndTag('TaxonPath');
195 }

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 106 of file class.ilMDTaxonPath.php.

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

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

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDTaxonPath::update ( )

Reimplemented from ilMDBase.

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

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

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

+ Here is the call graph for this function:

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