ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMDTaxon Class Reference
+ Inheritance diagram for ilMDTaxon:
+ Collaboration diagram for ilMDTaxon:

Public Member Functions

 setTaxon ($a_taxon)
 
 getTaxon ()
 
 setTaxonLanguage (&$lng_obj)
 
getTaxonLanguage ()
 
 getTaxonLanguageCode ()
 
 setTaxonId ($a_taxon_id)
 
 getTaxonId ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 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
 __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.ilMDTaxon.php.

Member Function Documentation

◆ __getFields() [1/2]

ilMDTaxon::__getFields ( )

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

115 {
116 return array('rbac_id' => array('integer',$this->getRBACId()),
117 'obj_id' => array('integer',$this->getObjId()),
118 'obj_type' => array('text',$this->getObjType()),
119 'parent_type' => array('text',$this->getParentType()),
120 'parent_id' => array('integer',$this->getParentId()),
121 'taxon' => array('text',$this->getTaxon()),
122 'taxon_language' => array('text',$this->getTaxonLanguageCode()),
123 'taxon_id' => array('text',$this->getTaxonId()));
124 }

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

Referenced by save().

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

◆ __getFields() [2/2]

ilMDTaxon::__getFields ( )

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

114 {
115 return array('rbac_id' => $this->getRBACId(),
116 'obj_id' => $this->getObjId(),
117 'obj_type' => ilUtil::prepareDBString($this->getObjType()),
118 'parent_type' => $this->getParentType(),
119 'parent_id' => $this->getParentId(),
120 'taxon' => ilUtil::prepareDBString($this->getTaxon()),
121 'taxon_language' => ilUtil::prepareDBString($this->getTaxonLanguageCode()),
122 'taxon_id' => ilUtil::prepareDBString($this->getTaxonId()));
123 }
static prepareDBString($a_str)
prepare a string for db writing (insert/update)

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

+ Here is the call graph for this function:

◆ _getIds() [1/2]

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

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

173 {
174 global $ilDB;
175
176 $query = "SELECT meta_taxon_id FROM il_meta_taxon " .
177 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
178 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
179 "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
180 "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
181
182
183 $res = $ilDB->query($query);
184 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
185 $ids[] = $row->meta_taxon_id;
186 }
187 return $ids ? $ids : array();
188 }
$query
foreach($_POST as $key=> $value) $res
global $ilDB

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

Referenced by ilMDTaxonPath\getTaxonIds().

+ Here is the caller graph for this function:

◆ _getIds() [2/2]

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

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

164 {
165 global $ilDB;
166
167 $query = "SELECT meta_taxon_id FROM il_meta_taxon " .
168 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id) . " " .
169 "AND obj_id = " . $ilDB->quote($a_obj_id) . " " .
170 "AND parent_id = " . $ilDB->quote($a_parent_id) . " " .
171 "AND parent_type = " . $ilDB->quote($a_parent_type);
172
173
174 $res = $ilDB->query($query);
175 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
176 $ids[] = $row->meta_taxon_id;
177 }
178 return $ids ? $ids : array();
179 }

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

◆ delete() [1/2]

ilMDTaxon::delete ( )

Reimplemented from ilMDBase.

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

99 {
100 global $ilDB;
101
102 if ($this->getMetaId()) {
103 $query = "DELETE FROM il_meta_taxon " .
104 "WHERE meta_taxon_id = " . $ilDB->quote($this->getMetaId(), 'integer');
105
106 $this->db->query($query);
107
108 return true;
109 }
110 return false;
111 }

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

+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDTaxon::delete ( )

Reimplemented from ilMDBase.

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

100 {
101 if ($this->getMetaId()) {
102 $query = "DELETE FROM il_meta_taxon " .
103 "WHERE meta_taxon_id = " . $ilDB->quote($this->getMetaId());
104
105 $this->db->query($query);
106
107 return true;
108 }
109 return false;
110 }

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

+ Here is the call graph for this function:

◆ getTaxon() [1/2]

ilMDTaxon::getTaxon ( )

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

41 {
42 return $this->taxon;
43 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getTaxon() [2/2]

ilMDTaxon::getTaxon ( )

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

41 {
42 return $this->taxon;
43 }

◆ getTaxonId() [1/2]

ilMDTaxon::getTaxonId ( )

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

63 {
64 return $this->taxon_id;
65 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getTaxonId() [2/2]

ilMDTaxon::getTaxonId ( )

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

63 {
64 return $this->taxon_id;
65 }

◆ getTaxonLanguage() [1/2]

& ilMDTaxon::getTaxonLanguage ( )

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

51 {
52 return is_object($this->taxon_language) ? $this->taxon_language : false;
53 }

◆ getTaxonLanguage() [2/2]

& ilMDTaxon::getTaxonLanguage ( )

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

51 {
52 return is_object($this->taxon_language) ? $this->taxon_language : false;
53 }

◆ getTaxonLanguageCode() [1/2]

ilMDTaxon::getTaxonLanguageCode ( )

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

55 {
56 return is_object($this->taxon_language) ? $this->taxon_language->getLanguageCode() : false;
57 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getTaxonLanguageCode() [2/2]

ilMDTaxon::getTaxonLanguageCode ( )

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

55 {
56 return is_object($this->taxon_language) ? $this->taxon_language->getLanguageCode() : false;
57 }

◆ read() [1/2]

ilMDTaxon::read ( )

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

127 {
128 global $ilDB;
129
130 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
131
132 if ($this->getMetaId()) {
133 $query = "SELECT * FROM il_meta_taxon " .
134 "WHERE meta_taxon_id = " . $ilDB->quote($this->getMetaId(), 'integer');
135
136 $res = $this->db->query($query);
137 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
138 $this->setRBACId($row->rbac_id);
139 $this->setObjId($row->obj_id);
140 $this->setObjType($row->obj_type);
141 $this->setParentId($row->parent_id);
142 $this->setParentType($row->parent_type);
143 $this->setTaxon($row->taxon);
144 $this->taxon_language = new ilMDLanguageItem($row->taxon_language);
145 $this->setTaxonId($row->taxon_id);
146 }
147 }
148 return true;
149 }
setObjId($a_id)
setParentId($a_id)
setObjType($a_type)
setRBACId($a_id)
setParentType($a_parent_type)
setTaxonId($a_taxon_id)
setTaxon($a_taxon)

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

+ Here is the call graph for this function:

◆ read() [2/2]

ilMDTaxon::read ( )

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

126 {
127 global $ilDB;
128
129 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
130
131 if ($this->getMetaId()) {
132 $query = "SELECT * FROM il_meta_taxon " .
133 "WHERE meta_taxon_id = " . $ilDB->quote($this->getMetaId());
134
135 $res = $this->db->query($query);
136 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
137 $this->setRBACId($row->rbac_id);
138 $this->setObjId($row->obj_id);
139 $this->setObjType($row->obj_type);
140 $this->setParentId($row->parent_id);
141 $this->setParentType($row->parent_type);
142 $this->setTaxon(ilUtil::stripSlashes($row->taxon));
143 $this->taxon_language = new ilMDLanguageItem($row->taxon_language);
144 $this->setTaxonId(ilUtil::stripSlashes($row->taxon_id));
145 }
146 }
147 return true;
148 }
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(), setTaxon(), setTaxonId(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ save() [1/2]

ilMDTaxon::save ( )

Reimplemented from ilMDBase.

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

69 {
70 global $ilDB;
71
72 $fields = $this->__getFields();
73 $fields['meta_taxon_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_taxon'));
74
75 if ($this->db->insert('il_meta_taxon', $fields)) {
76 $this->setMetaId($next_id);
77 return $this->getMetaId();
78 }
79 return false;
80 }
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]

ilMDTaxon::save ( )

Reimplemented from ilMDBase.

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

69 {
70 if ($this->db->autoExecute(
71 'il_meta_taxon',
72 $this->__getFields(),
74 )) {
75 $this->setMetaId($this->db->getLastInsertId());
76
77 return $this->getMetaId();
78 }
79 return false;
80 }

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

+ Here is the call graph for this function:

◆ setTaxon() [1/2]

ilMDTaxon::setTaxon (   $a_taxon)

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

37 {
38 $this->taxon = $a_taxon;
39 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTaxon() [2/2]

ilMDTaxon::setTaxon (   $a_taxon)

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

37 {
38 $this->taxon = $a_taxon;
39 }

◆ setTaxonId() [1/2]

ilMDTaxon::setTaxonId (   $a_taxon_id)

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

59 {
60 $this->taxon_id = $a_taxon_id;
61 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTaxonId() [2/2]

ilMDTaxon::setTaxonId (   $a_taxon_id)

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

59 {
60 $this->taxon_id = $a_taxon_id;
61 }

◆ setTaxonLanguage() [1/2]

ilMDTaxon::setTaxonLanguage ( $lng_obj)

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

45 {
46 if (is_object($lng_obj)) {
47 $this->taxon_language = $lng_obj;
48 }
49 }

◆ setTaxonLanguage() [2/2]

ilMDTaxon::setTaxonLanguage ( $lng_obj)

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

45 {
46 if (is_object($lng_obj)) {
47 $this->taxon_language = $lng_obj;
48 }
49 }

◆ toXML() [1/2]

ilMDTaxon::toXML ( $writer)

Reimplemented from ilMDBase.

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

157 {
158 $random = new \ilRandom();
159 $writer->xmlElement(
160 'Taxon',
161 array('Language' => $this->getTaxonLanguageCode()
162 ? $this->getTaxonLanguageCode()
163 : 'en',
164 'Id' => $this->getTaxonId() ?
165 $this->getTaxonId() : ("ID" . $random->int())),
166 $this->getTaxon()
167 );
168 }

References getTaxonId(), and getTaxonLanguageCode().

+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDTaxon::toXML ( $writer)

Reimplemented from ilMDBase.

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

156 {
157 $writer->xmlElement('Taxon', array('Language' => $this->getTaxonLanguageCode(),
158 'Id' => $this->getTaxonId()), $this->getTaxon());
159 }

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

+ Here is the call graph for this function:

◆ update() [1/2]

ilMDTaxon::update ( )

Reimplemented from ilMDBase.

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

83 {
84 global $ilDB;
85
86 if ($this->getMetaId()) {
87 if ($this->db->update(
88 'il_meta_taxon',
89 $this->__getFields(),
90 array("meta_taxon_id" => array('integer',$this->getMetaId()))
91 )) {
92 return true;
93 }
94 }
95 return false;
96 }

References $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDTaxon::update ( )

Reimplemented from ilMDBase.

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

83 {
84 global $ilDB;
85
86 if ($this->getMetaId()) {
87 if ($this->db->autoExecute(
88 'il_meta_taxon',
89 $this->__getFields(),
91 "meta_taxon_id = " . $ilDB->quote($this->getMetaId())
92 )) {
93 return true;
94 }
95 }
96 return false;
97 }

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: