ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilMDTaxonPath Class Reference
+ Inheritance diagram for ilMDTaxonPath:
+ Collaboration diagram for ilMDTaxonPath:

Public Member Functions

 getTaxonIds ()
 
 getTaxon (int $a_taxon_id)
 
 addTaxon ()
 
 setSource (string $a_source)
 
 getSource ()
 
 setSourceLanguage (ilMDLanguageItem $lng_obj)
 
 getSourceLanguage ()
 
 getSourceLanguageCode ()
 
 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 $source = ''
 
ilMDLanguageItem $source_language = null
 

Additional Inherited Members

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

Detailed Description

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

Member Function Documentation

◆ __getFields()

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

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

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

Referenced by save(), and update().

128  : array
129  {
130  return array(
131  'rbac_id' => array('integer', $this->getRBACId()),
132  'obj_id' => array('integer', $this->getObjId()),
133  'obj_type' => array('text', $this->getObjType()),
134  'parent_type' => array('text', $this->getParentType()),
135  'parent_id' => array('integer', $this->getParentId()),
136  'source' => array('text', $this->getSource()),
137  'source_language' => array('text', $this->getSourceLanguageCode())
138  );
139  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getIds()

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

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

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

Referenced by ilMDClassification\getTaxonPathIds().

190  : array
191  {
192  global $DIC;
193 
194  $ilDB = $DIC->database();
195 
196  $query = "SELECT meta_taxon_path_id FROM il_meta_taxon_path " .
197  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
198  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
199  "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
200  "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
201 
202  $res = $ilDB->query($query);
203  $ids = [];
204  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
205  $ids[] = (int) $row->meta_taxon_path_id;
206  }
207  return $ids;
208  }
$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:

◆ addTaxon()

ilMDTaxonPath::addTaxon ( )

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

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

52  : ilMDTaxon
53  {
54  $tax = new ilMDTaxon($this->getRBACId(), $this->getObjId(), $this->getObjType());
55  $tax->setParentId($this->getMetaId());
56  $tax->setParentType('meta_taxon_path');
57 
58  return $tax;
59  }
+ Here is the call graph for this function:

◆ delete()

ilMDTaxonPath::delete ( )

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

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

108  : bool
109  {
110  if ($this->getMetaId()) {
111  $query = "DELETE FROM il_meta_taxon_path " .
112  "WHERE meta_taxon_path_id = " . $this->db->quote($this->getMetaId(), 'integer');
113  $res = $this->db->manipulate($query);
114 
115  foreach ($this->getTaxonIds() as $id) {
116  $tax = $this->getTaxon($id);
117  $tax->delete();
118  }
119 
120  return true;
121  }
122  return false;
123  }
$res
Definition: ltiservices.php:69
$query
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
getTaxon(int $a_taxon_id)
+ Here is the call graph for this function:

◆ getSource()

ilMDTaxonPath::getSource ( )

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

References $source.

Referenced by __getFields(), and toXML().

67  : string
68  {
69  return $this->source;
70  }
+ Here is the caller graph for this function:

◆ getSourceLanguage()

ilMDTaxonPath::getSourceLanguage ( )

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

78  {
79  return is_object($this->source_language) ? $this->source_language : null;
80  }

◆ getSourceLanguageCode()

ilMDTaxonPath::getSourceLanguageCode ( )

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

Referenced by __getFields(), and toXML().

82  : string
83  {
84  return is_object($this->source_language) ? $this->source_language->getLanguageCode() : '';
85  }
+ Here is the caller graph for this function:

◆ getTaxon()

ilMDTaxonPath::getTaxon ( int  $a_taxon_id)

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

Referenced by delete(), and toXML().

41  : ?ilMDTaxon
42  {
43  if (!$a_taxon_id) {
44  return null;
45  }
46  $tax = new ilMDTaxon();
47  $tax->setMetaId($a_taxon_id);
48 
49  return $tax;
50  }
+ Here is the caller graph for this function:

◆ getTaxonIds()

ilMDTaxonPath::getTaxonIds ( )
Returns
int[]

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

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

Referenced by delete(), and toXML().

36  : array
37  {
38  return ilMDTaxon::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_taxon_path');
39  }
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilMDTaxonPath::read ( )

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

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

141  : bool
142  {
143  if ($this->getMetaId()) {
144  $query = "SELECT * FROM il_meta_taxon_path " .
145  "WHERE meta_taxon_path_id = " . $this->db->quote($this->getMetaId(), 'integer');
146 
147  $res = $this->db->query($query);
148  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
149  $this->setRBACId((int) $row->rbac_id);
150  $this->setObjId((int) $row->obj_id);
151  $this->setObjType($row->obj_type);
152  $this->setParentId((int) $row->parent_id);
153  $this->setParentType($row->parent_type);
154  $this->setSource($row->source ?? '');
155  $this->source_language = new ilMDLanguageItem($row->source_language ?? '');
156  }
157  }
158  return true;
159  }
$res
Definition: ltiservices.php:69
setRBACId(int $a_id)
setObjId(int $a_id)
$query
setParentId(int $a_id)
setParentType(string $a_parent_type)
setSource(string $a_source)
setObjType(string $a_type)
+ Here is the call graph for this function:

◆ save()

ilMDTaxonPath::save ( )

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

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

87  : int
88  {
89  $fields = $this->__getFields();
90  $fields['meta_taxon_path_id'] = array('integer', $next_id = $this->db->nextId('il_meta_taxon_path'));
91 
92  if ($this->db->insert('il_meta_taxon_path', $fields)) {
93  $this->setMetaId($next_id);
94  return $this->getMetaId();
95  }
96  return 0;
97  }
setMetaId(int $a_meta_id, bool $a_read_data=true)
+ Here is the call graph for this function:

◆ setSource()

ilMDTaxonPath::setSource ( string  $a_source)

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

Referenced by read().

62  : void
63  {
64  $this->source = $a_source;
65  }
+ Here is the caller graph for this function:

◆ setSourceLanguage()

ilMDTaxonPath::setSourceLanguage ( ilMDLanguageItem  $lng_obj)

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

72  : void
73  {
74  $this->source_language = $lng_obj;
75  }

◆ toXML()

ilMDTaxonPath::toXML ( ilXmlWriter  $writer)

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

References $id, ilMDBase\getObjId(), ilMDBase\getRBACId(), getSource(), getSourceLanguageCode(), getTaxon(), getTaxonIds(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

161  : void
162  {
163  $writer->xmlStartTag('TaxonPath');
164 
165  $writer->xmlElement(
166  'Source',
167  array(
168  'Language' => $this->getSourceLanguageCode() ?: 'en'
169  ),
170  $this->getSource()
171  );
172 
173  // Taxon
174  $taxs = $this->getTaxonIds();
175  foreach ($taxs as $id) {
176  $tax = $this->getTaxon($id);
177  $tax->toXML($writer);
178  }
179  if (!count($taxs)) {
180  $tax = new ilMDTaxon($this->getRBACId(), $this->getObjId());
181  $tax->toXML($writer);
182  }
183 
184  $writer->xmlEndTag('TaxonPath');
185  }
xmlEndTag(string $tag)
Writes an endtag.
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
getTaxon(int $a_taxon_id)
+ Here is the call graph for this function:

◆ update()

ilMDTaxonPath::update ( )

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

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

99  : bool
100  {
101  return $this->getMetaId() && $this->db->update(
102  'il_meta_taxon_path',
103  $this->__getFields(),
104  array("meta_taxon_path_id" => array('integer', $this->getMetaId()))
105  );
106  }
+ Here is the call graph for this function:

Field Documentation

◆ $source

string ilMDTaxonPath::$source = ''
private

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

Referenced by getSource().

◆ $source_language

ilMDLanguageItem ilMDTaxonPath::$source_language = null
private

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


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