ILIAS  release_8 Revision v8.23
ilMDTaxon Class Reference
+ Inheritance diagram for ilMDTaxon:
+ Collaboration diagram for ilMDTaxon:

Public Member Functions

 setTaxon (string $a_taxon)
 
 getTaxon ()
 
 setTaxonLanguage (ilMDLanguageItem $lng_obj)
 
 getTaxonLanguage ()
 
 getTaxonLanguageCode ()
 
 setTaxonId (string $a_taxon_id)
 
 getTaxonId ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (ilXmlWriter $writer)
 
- Public Member Functions inherited from ilMDBase
 __construct (int $a_rbac_id=0, int $a_obj_id=0, string $a_type='')
 constructor More...
 
 read ()
 
 setRBACId (int $a_id)
 
 getRBACId ()
 
 setObjId (int $a_id)
 
 getObjId ()
 
 setObjType (string $a_type)
 
 getObjType ()
 
 setMetaId (int $a_meta_id, bool $a_read_data=true)
 
 getMetaId ()
 
 setParentType (string $a_parent_type)
 
 getParentType ()
 
 setParentId (int $a_id)
 
 getParentId ()
 
 setExportMode (bool $a_export_mode=true)
 
 getExportMode ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (ilXmlWriter $writer)
 

Static Public Member Functions

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

Private Attributes

string $taxon = ''
 
ilMDLanguageItem $taxon_language = null
 
string $taxon_id = ''
 

Additional Inherited Members

- Protected Attributes inherited from ilMDBase
ilLogger $log
 
ilDBInterface $db
 

Detailed Description

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

Member Function Documentation

◆ __getFields()

ilMDTaxon::__getFields ( )
Returns
array<string, array<string, mixed>>

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

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

Referenced by save(), and update().

105  : array
106  {
107  return array(
108  'rbac_id' => array('integer', $this->getRBACId()),
109  'obj_id' => array('integer', $this->getObjId()),
110  'obj_type' => array('text', $this->getObjType()),
111  'parent_type' => array('text', $this->getParentType()),
112  'parent_id' => array('integer', $this->getParentId()),
113  'taxon' => array('text', $this->getTaxon()),
114  'taxon_language' => array('text', $this->getTaxonLanguageCode()),
115  'taxon_id' => array('text', $this->getTaxonId())
116  );
117  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getIds()

static ilMDTaxon::_getIds ( int  $a_rbac_id,
int  $a_obj_id,
int  $a_parent_id,
string  $a_parent_type 
)
static
Returns
int[]

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

References $DIC, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by ilMDTaxonPath\getTaxonIds().

158  : array
159  {
160  global $DIC;
161 
162  $ilDB = $DIC->database();
163 
164  $query = "SELECT meta_taxon_id FROM il_meta_taxon " .
165  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
166  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
167  "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
168  "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
169 
170  $res = $ilDB->query($query);
171  $ids = [];
172  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
173  $ids[] = (int) $row->meta_taxon_id;
174  }
175  return $ids;
176  }
$res
Definition: ltiservices.php:69
global $DIC
Definition: feed.php:28
$query
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilMDTaxon::delete ( )

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

References $query, and ilMDBase\getMetaId().

89  : bool
90  {
91  if ($this->getMetaId()) {
92  $query = "DELETE FROM il_meta_taxon " .
93  "WHERE meta_taxon_id = " . $this->db->quote($this->getMetaId(), 'integer');
94 
95  $this->db->query($query);
96 
97  return true;
98  }
99  return false;
100  }
$query
+ Here is the call graph for this function:

◆ getTaxon()

ilMDTaxon::getTaxon ( )

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

References $taxon.

Referenced by __getFields(), and toXML().

38  : string
39  {
40  return $this->taxon;
41  }
+ Here is the caller graph for this function:

◆ getTaxonId()

ilMDTaxon::getTaxonId ( )

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

References $taxon_id.

Referenced by __getFields(), and toXML().

63  : string
64  {
65  return $this->taxon_id;
66  }
string $taxon_id
+ Here is the caller graph for this function:

◆ getTaxonLanguage()

ilMDTaxon::getTaxonLanguage ( )

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

49  {
50  return is_object($this->taxon_language) ? $this->taxon_language : null;
51  }

◆ getTaxonLanguageCode()

ilMDTaxon::getTaxonLanguageCode ( )

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

Referenced by __getFields(), and toXML().

53  : string
54  {
55  return is_object($this->taxon_language) ? $this->taxon_language->getLanguageCode() : '';
56  }
+ Here is the caller graph for this function:

◆ read()

ilMDTaxon::read ( )

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

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

119  : bool
120  {
121  if ($this->getMetaId()) {
122  $query = "SELECT * FROM il_meta_taxon " .
123  "WHERE meta_taxon_id = " . $this->db->quote($this->getMetaId(), 'integer');
124 
125  $res = $this->db->query($query);
126  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
127  $this->setRBACId((int) $row->rbac_id);
128  $this->setObjId((int) $row->obj_id);
129  $this->setObjType($row->obj_type);
130  $this->setParentId((int) $row->parent_id);
131  $this->setParentType($row->parent_type);
132  $this->setTaxon($row->taxon ?? '');
133  $this->taxon_language = new ilMDLanguageItem($row->taxon_language ?? '');
134  $this->setTaxonId($row->taxon_id ?? '');
135  }
136  }
137  return true;
138  }
$res
Definition: ltiservices.php:69
setTaxonId(string $a_taxon_id)
setRBACId(int $a_id)
setTaxon(string $a_taxon)
setObjId(int $a_id)
$query
setParentId(int $a_id)
setParentType(string $a_parent_type)
setObjType(string $a_type)
+ Here is the call graph for this function:

◆ save()

ilMDTaxon::save ( )

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

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

68  : int
69  {
70  $fields = $this->__getFields();
71  $fields['meta_taxon_id'] = array('integer', $next_id = $this->db->nextId('il_meta_taxon'));
72 
73  if ($this->db->insert('il_meta_taxon', $fields)) {
74  $this->setMetaId($next_id);
75  return $this->getMetaId();
76  }
77  return 0;
78  }
setMetaId(int $a_meta_id, bool $a_read_data=true)
+ Here is the call graph for this function:

◆ setTaxon()

ilMDTaxon::setTaxon ( string  $a_taxon)

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

Referenced by read().

33  : void
34  {
35  $this->taxon = $a_taxon;
36  }
+ Here is the caller graph for this function:

◆ setTaxonId()

ilMDTaxon::setTaxonId ( string  $a_taxon_id)

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

Referenced by read().

58  : void
59  {
60  $this->taxon_id = $a_taxon_id;
61  }
+ Here is the caller graph for this function:

◆ setTaxonLanguage()

ilMDTaxon::setTaxonLanguage ( ilMDLanguageItem  $lng_obj)

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

43  : void
44  {
45  $this->taxon_language = $lng_obj;
46  }

◆ toXML()

ilMDTaxon::toXML ( ilXmlWriter  $writer)

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

References getTaxon(), getTaxonId(), getTaxonLanguageCode(), and ilXmlWriter\xmlElement().

140  : void
141  {
142  $random = new \ilRandom();
143  $writer->xmlElement(
144  'Taxon',
145  array(
146  'Language' => $this->getTaxonLanguageCode() ?: 'en',
147  'Id' => $this->getTaxonId() ?: ("ID" . $random->int())
148  ),
149  $this->getTaxon()
150  );
151  }
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
+ Here is the call graph for this function:

◆ update()

ilMDTaxon::update ( )

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

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

80  : bool
81  {
82  return $this->getMetaId() && $this->db->update(
83  'il_meta_taxon',
84  $this->__getFields(),
85  array("meta_taxon_id" => array('integer', $this->getMetaId()))
86  );
87  }
+ Here is the call graph for this function:

Field Documentation

◆ $taxon

string ilMDTaxon::$taxon = ''
private

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

Referenced by getTaxon().

◆ $taxon_id

string ilMDTaxon::$taxon_id = ''
private

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

Referenced by getTaxonId().

◆ $taxon_language

ilMDLanguageItem ilMDTaxon::$taxon_language = null
private

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


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