ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 27 of file class.ilMDTaxon.php.

Member Function Documentation

◆ __getFields()

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

Definition at line 106 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().

106  : array
107  {
108  return array(
109  'rbac_id' => array('integer', $this->getRBACId()),
110  'obj_id' => array('integer', $this->getObjId()),
111  'obj_type' => array('text', $this->getObjType()),
112  'parent_type' => array('text', $this->getParentType()),
113  'parent_id' => array('integer', $this->getParentId()),
114  'taxon' => array('text', $this->getTaxon()),
115  'taxon_language' => array('text', $this->getTaxonLanguageCode()),
116  'taxon_id' => array('text', $this->getTaxonId())
117  );
118  }
+ 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 159 of file class.ilMDTaxon.php.

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

Referenced by ilMDTaxonPath\getTaxonIds().

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

◆ delete()

ilMDTaxon::delete ( )

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

References ilMDBase\getMetaId().

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

◆ getTaxon()

ilMDTaxon::getTaxon ( )

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

References $taxon.

Referenced by __getFields(), and toXML().

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

◆ getTaxonId()

ilMDTaxon::getTaxonId ( )

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

References $taxon_id.

Referenced by __getFields(), and toXML().

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

◆ getTaxonLanguage()

ilMDTaxon::getTaxonLanguage ( )

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

References null.

50  {
51  return is_object($this->taxon_language) ? $this->taxon_language : null;
52  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getTaxonLanguageCode()

ilMDTaxon::getTaxonLanguageCode ( )

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

Referenced by __getFields(), and toXML().

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

◆ read()

ilMDTaxon::read ( )

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

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

120  : bool
121  {
122  if ($this->getMetaId()) {
123  $query = "SELECT * FROM il_meta_taxon " .
124  "WHERE meta_taxon_id = " . $this->db->quote($this->getMetaId(), 'integer');
125 
126  $res = $this->db->query($query);
127  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
128  $this->setRBACId((int) $row->rbac_id);
129  $this->setObjId((int) $row->obj_id);
130  $this->setObjType($row->obj_type ?? '');
131  $this->setParentId((int) $row->parent_id);
132  $this->setParentType($row->parent_type);
133  $this->setTaxon($row->taxon ?? '');
134  $this->taxon_language = new ilMDLanguageItem($row->taxon_language ?? '');
135  $this->setTaxonId($row->taxon_id ?? '');
136  }
137  }
138  return true;
139  }
$res
Definition: ltiservices.php:66
setTaxonId(string $a_taxon_id)
setRBACId(int $a_id)
setTaxon(string $a_taxon)
setObjId(int $a_id)
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 69 of file class.ilMDTaxon.php.

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

69  : int
70  {
71  $fields = $this->__getFields();
72  $fields['meta_taxon_id'] = array('integer', $next_id = $this->db->nextId('il_meta_taxon'));
73 
74  if ($this->db->insert('il_meta_taxon', $fields)) {
75  $this->setMetaId($next_id);
76  return $this->getMetaId();
77  }
78  return 0;
79  }
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 34 of file class.ilMDTaxon.php.

Referenced by read().

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

◆ setTaxonId()

ilMDTaxon::setTaxonId ( string  $a_taxon_id)

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

Referenced by read().

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

◆ setTaxonLanguage()

ilMDTaxon::setTaxonLanguage ( ilMDLanguageItem  $lng_obj)

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

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

◆ toXML()

ilMDTaxon::toXML ( ilXmlWriter  $writer)

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

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

141  : void
142  {
143  $random = new \Random\Randomizer();
144  $writer->xmlElement(
145  'Taxon',
146  array(
147  'Language' => $this->getTaxonLanguageCode() ?: 'en',
148  'Id' => $this->getTaxonId() ?: ("ID" . $random->nextInt())
149  ),
150  $this->getTaxon()
151  );
152  }
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 81 of file class.ilMDTaxon.php.

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

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

Field Documentation

◆ $taxon

string ilMDTaxon::$taxon = ''
private

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

Referenced by getTaxon().

◆ $taxon_id

string ilMDTaxon::$taxon_id = ''
private

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

Referenced by getTaxonId().

◆ $taxon_language

ilMDLanguageItem ilMDTaxon::$taxon_language = null
private

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


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