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

Member Function Documentation

◆ __getFields()

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

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

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

Referenced by save(), and update().

132  : array
133  {
134  return array(
135  'rbac_id' => array('integer', $this->getRBACId()),
136  'obj_id' => array('integer', $this->getObjId()),
137  'obj_type' => array('text', $this->getObjType()),
138  'parent_type' => array('text', $this->getParentType()),
139  'parent_id' => array('integer', $this->getParentId()),
140  'source' => array('text', $this->getSource()),
141  'source_language' => array('text', $this->getSourceLanguageCode())
142  );
143  }
+ 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 194 of file class.ilMDTaxonPath.php.

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

Referenced by ilMDClassification\getTaxonPathIds().

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

◆ addTaxon()

ilMDTaxonPath::addTaxon ( )

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

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

56  : ilMDTaxon
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  }
+ Here is the call graph for this function:

◆ delete()

ilMDTaxonPath::delete ( )

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

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

112  : bool
113  {
114  if ($this->getMetaId()) {
115  $query = "DELETE FROM il_meta_taxon_path " .
116  "WHERE meta_taxon_path_id = " . $this->db->quote($this->getMetaId(), 'integer');
117  $res = $this->db->manipulate($query);
118 
119  foreach ($this->getTaxonIds() as $id) {
120  $tax = $this->getTaxon($id);
121  $tax->delete();
122  }
123 
124  return true;
125  }
126  return false;
127  }
$res
Definition: ltiservices.php:66
$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 71 of file class.ilMDTaxonPath.php.

References $source.

Referenced by __getFields(), and toXML().

71  : string
72  {
73  return $this->source;
74  }
+ Here is the caller graph for this function:

◆ getSourceLanguage()

ilMDTaxonPath::getSourceLanguage ( )

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

References null.

82  {
83  return is_object($this->source_language) ? $this->source_language : null;
84  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ getSourceLanguageCode()

ilMDTaxonPath::getSourceLanguageCode ( )

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

Referenced by __getFields(), and toXML().

86  : string
87  {
88  return is_object($this->source_language) ? $this->source_language->getLanguageCode() : '';
89  }
+ Here is the caller graph for this function:

◆ getTaxon()

ilMDTaxonPath::getTaxon ( int  $a_taxon_id)

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

References null.

Referenced by delete(), and toXML().

45  : ?ilMDTaxon
46  {
47  if (!$a_taxon_id) {
48  return null;
49  }
50  $tax = new ilMDTaxon();
51  $tax->setMetaId($a_taxon_id);
52 
53  return $tax;
54  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getTaxonIds()

ilMDTaxonPath::getTaxonIds ( )
Returns
int[]

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

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

Referenced by delete(), and toXML().

37  : array
38  {
39  if (!$this->getMetaId()) {
40  return [];
41  }
42  return ilMDTaxon::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_taxon_path');
43  }
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 145 of file class.ilMDTaxonPath.php.

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

145  : bool
146  {
147  if ($this->getMetaId()) {
148  $query = "SELECT * FROM il_meta_taxon_path " .
149  "WHERE meta_taxon_path_id = " . $this->db->quote($this->getMetaId(), 'integer');
150 
151  $res = $this->db->query($query);
152  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
153  $this->setRBACId((int) $row->rbac_id);
154  $this->setObjId((int) $row->obj_id);
155  $this->setObjType($row->obj_type);
156  $this->setParentId((int) $row->parent_id);
157  $this->setParentType($row->parent_type);
158  $this->setSource($row->source ?? '');
159  $this->source_language = new ilMDLanguageItem($row->source_language ?? '');
160  }
161  }
162  return true;
163  }
$res
Definition: ltiservices.php:66
setRBACId(int $a_id)
setObjId(int $a_id)
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 91 of file class.ilMDTaxonPath.php.

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

91  : int
92  {
93  $fields = $this->__getFields();
94  $fields['meta_taxon_path_id'] = array('integer', $next_id = $this->db->nextId('il_meta_taxon_path'));
95 
96  if ($this->db->insert('il_meta_taxon_path', $fields)) {
97  $this->setMetaId($next_id);
98  return $this->getMetaId();
99  }
100  return 0;
101  }
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 66 of file class.ilMDTaxonPath.php.

Referenced by read().

66  : void
67  {
68  $this->source = $a_source;
69  }
+ Here is the caller graph for this function:

◆ setSourceLanguage()

ilMDTaxonPath::setSourceLanguage ( ilMDLanguageItem  $lng_obj)

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

76  : void
77  {
78  $this->source_language = $lng_obj;
79  }

◆ toXML()

ilMDTaxonPath::toXML ( ilXmlWriter  $writer)

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

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

165  : void
166  {
167  $writer->xmlStartTag('TaxonPath');
168 
169  $writer->xmlElement(
170  'Source',
171  array(
172  'Language' => $this->getSourceLanguageCode() ?: 'en'
173  ),
174  $this->getSource()
175  );
176 
177  // Taxon
178  $taxs = $this->getTaxonIds();
179  foreach ($taxs as $id) {
180  $tax = $this->getTaxon($id);
181  $tax->toXML($writer);
182  }
183  if (!count($taxs)) {
184  $tax = new ilMDTaxon($this->getRBACId(), $this->getObjId());
185  $tax->toXML($writer);
186  }
187 
188  $writer->xmlEndTag('TaxonPath');
189  }
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 103 of file class.ilMDTaxonPath.php.

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

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

Field Documentation

◆ $source

string ilMDTaxonPath::$source = ''
private

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

Referenced by getSource().

◆ $source_language

ilMDLanguageItem ilMDTaxonPath::$source_language = null
private

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


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