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

Public Member Functions

getTaxonIds ()
 
getTaxon ($a_taxon_id)
 
addTaxon ()
 
 setSource ($a_source)
 
 getSource ()
 
 setSourceLanguage (&$lng_obj)
 
getSourceLanguage ()
 
 getSourceLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
getTaxonIds ()
 
getTaxon ($a_taxon_id)
 
addTaxon ()
 
 setSource ($a_source)
 
 getSource ()
 
 setSourceLanguage (&$lng_obj)
 
getSourceLanguage ()
 
 getSourceLanguageCode ()
 
 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.ilMDTaxonPath.php.

Member Function Documentation

◆ __getFields() [1/2]

ilMDTaxonPath::__getFields ( )

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

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

Referenced by save().

141  {
142  return array('rbac_id' => array('integer',$this->getRBACId()),
143  'obj_id' => array('integer',$this->getObjId()),
144  'obj_type' => array('text',$this->getObjType()),
145  'parent_type' => array('text',$this->getParentType()),
146  'parent_id' => array('integer',$this->getParentId()),
147  'source' => array('text',$this->getSource()),
148  'source_language' => array('text',$this->getSourceLanguageCode()));
149  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getFields() [2/2]

ilMDTaxonPath::__getFields ( )

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

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

143  {
144  return array('rbac_id' => $this->getRBACId(),
145  'obj_id' => $this->getObjId(),
146  'obj_type' => ilUtil::prepareDBString($this->getObjType()),
147  'parent_type' => $this->getParentType(),
148  'parent_id' => $this->getParentId(),
149  'source' => ilUtil::prepareDBString($this->getSource()),
150  'source_language' => ilUtil::prepareDBString($this->getSourceLanguageCode()));
151  }
Create styles array
The data for the language used.
static prepareDBString($a_str)
prepare a string for db writing (insert/update)
+ Here is the call graph for this function:

◆ _getIds() [1/2]

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

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

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

201  {
202  global $ilDB;
203 
204  $query = "SELECT meta_taxon_path_id FROM il_meta_taxon_path " .
205  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id) . " " .
206  "AND obj_id = " . $ilDB->quote($a_obj_id) . " " .
207  "AND parent_id = " . $ilDB->quote($a_parent_id) . " " .
208  "AND parent_type = " . $ilDB->quote($a_parent_type);
209 
210  $res = $ilDB->query($query);
211  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
212  $ids[] = $row->meta_taxon_path_id;
213  }
214  return $ids ? $ids : array();
215  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB

◆ _getIds() [2/2]

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

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

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

Referenced by ilMDClassification\getTaxonPathIds().

211  {
212  global $ilDB;
213 
214  $query = "SELECT meta_taxon_path_id FROM il_meta_taxon_path " .
215  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
216  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
217  "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
218  "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
219 
220  $res = $ilDB->query($query);
221  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
222  $ids[] = $row->meta_taxon_path_id;
223  }
224  return $ids ? $ids : array();
225  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ addTaxon() [1/2]

& ilMDTaxonPath::addTaxon ( )

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

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

55  {
56  include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDTaxon.php';
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:

◆ addTaxon() [2/2]

& ilMDTaxonPath::addTaxon ( )

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

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

55  {
56  include_once 'Services/MetaData/classes/class.ilMDTaxon.php';
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() [1/2]

ilMDTaxonPath::delete ( )

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

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

121  {
122  global $ilDB;
123 
124  if ($this->getMetaId()) {
125  $query = "DELETE FROM il_meta_taxon_path " .
126  "WHERE meta_taxon_path_id = " . $ilDB->quote($this->getMetaId(), 'integer');
127  $res = $ilDB->manipulate($query);
128 
129  foreach ($this->getTaxonIds() as $id) {
130  $tax = $this->getTaxon($id);
131  $tax->delete();
132  }
133 
134  return true;
135  }
136  return false;
137  }
if(!array_key_exists('StateId', $_REQUEST)) $id
& getTaxon($a_taxon_id)
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDTaxonPath::delete ( )

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

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

122  {
123  global $ilDB;
124 
125  if ($this->getMetaId()) {
126  $query = "DELETE FROM il_meta_taxon_path " .
127  "WHERE meta_taxon_path_id = " . $ilDB->quote($this->getMetaId());
128 
129  $this->db->query($query);
130 
131  foreach ($this->getTaxonIds() as $id) {
132  $tax = $this->getTaxon($id);
133  $tax->delete();
134  }
135 
136  return true;
137  }
138  return false;
139  }
if(!array_key_exists('StateId', $_REQUEST)) $id
& getTaxon($a_taxon_id)
$query
global $ilDB
+ Here is the call graph for this function:

◆ getSource() [1/2]

ilMDTaxonPath::getSource ( )

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

References $source.

Referenced by __getFields(), and toXML().

71  {
72  return $this->source;
73  }
$source
Definition: linkback.php:22
+ Here is the caller graph for this function:

◆ getSource() [2/2]

ilMDTaxonPath::getSource ( )

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

References $source.

71  {
72  return $this->source;
73  }
$source
Definition: linkback.php:22

◆ getSourceLanguage() [1/2]

& ilMDTaxonPath::getSourceLanguage ( )

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

81  {
82  return is_object($this->source_language) ? $this->source_language : false;
83  }

◆ getSourceLanguage() [2/2]

& ilMDTaxonPath::getSourceLanguage ( )

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

81  {
82  return is_object($this->source_language) ? $this->source_language : false;
83  }

◆ getSourceLanguageCode() [1/2]

ilMDTaxonPath::getSourceLanguageCode ( )

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

Referenced by __getFields(), and toXML().

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

◆ getSourceLanguageCode() [2/2]

ilMDTaxonPath::getSourceLanguageCode ( )

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

85  {
86  return is_object($this->source_language) ? $this->source_language->getLanguageCode() : false;
87  }

◆ getTaxon() [1/2]

& ilMDTaxonPath::getTaxon (   $a_taxon_id)

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

43  {
44  include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDTaxon.php';
45 
46  if (!$a_taxon_id) {
47  return false;
48  }
49  $tax = new ilMDTaxon();
50  $tax->setMetaId($a_taxon_id);
51 
52  return $tax;
53  }

◆ getTaxon() [2/2]

& ilMDTaxonPath::getTaxon (   $a_taxon_id)

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

Referenced by delete(), and toXML().

43  {
44  include_once 'Services/MetaData/classes/class.ilMDTaxon.php';
45 
46  if (!$a_taxon_id) {
47  return false;
48  }
49  $tax = new ilMDTaxon();
50  $tax->setMetaId($a_taxon_id);
51 
52  return $tax;
53  }
+ Here is the caller graph for this function:

◆ getTaxonIds() [1/2]

& ilMDTaxonPath::getTaxonIds ( )

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

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

37  {
38  include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDTaxon.php';
39 
40  return ilMDTaxon::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_taxon_path');
41  }
static _getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
+ Here is the call graph for this function:

◆ getTaxonIds() [2/2]

& ilMDTaxonPath::getTaxonIds ( )

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

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

Referenced by delete(), and toXML().

37  {
38  include_once 'Services/MetaData/classes/class.ilMDTaxon.php';
39 
40  return ilMDTaxon::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_taxon_path');
41  }
static _getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read() [1/2]

ilMDTaxonPath::read ( )

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

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

152  {
153  global $ilDB;
154 
155  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
156 
157  if ($this->getMetaId()) {
158  $query = "SELECT * FROM il_meta_taxon_path " .
159  "WHERE meta_taxon_path_id = " . $ilDB->quote($this->getMetaId(), 'integer');
160 
161  $res = $ilDB->query($query);
162  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
163  $this->setRBACId($row->rbac_id);
164  $this->setObjId($row->obj_id);
165  $this->setObjType($row->obj_type);
166  $this->setParentId($row->parent_id);
167  $this->setParentType($row->parent_type);
168  $this->setSource($row->source);
169  $this->source_language = new ilMDLanguageItem($row->source_language);
170  }
171  }
172  return true;
173  }
setObjType($a_type)
foreach($_POST as $key=> $value) $res
setObjId($a_id)
setRBACId($a_id)
$query
setParentId($a_id)
global $ilDB
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ read() [2/2]

ilMDTaxonPath::read ( )

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

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

154  {
155  global $ilDB;
156 
157  include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
158 
159  if ($this->getMetaId()) {
160  $query = "SELECT * FROM il_meta_taxon_path " .
161  "WHERE meta_taxon_path_id = " . $ilDB->quote($this->getMetaId());
162 
163  $res = $this->db->query($query);
164  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
165  $this->setRBACId($row->rbac_id);
166  $this->setObjId($row->obj_id);
167  $this->setObjType($row->obj_type);
168  $this->setParentId($row->parent_id);
169  $this->setParentType($row->parent_type);
170  $this->setSource(ilUtil::stripSlashes($row->source));
171  $this->source_language = new ilMDLanguageItem($row->source_language);
172  }
173  }
174  return true;
175  }
setObjType($a_type)
foreach($_POST as $key=> $value) $res
setObjId($a_id)
setRBACId($a_id)
$query
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
setParentId($a_id)
global $ilDB
setParentType($a_parent_type)
+ Here is the call graph for this function:

◆ save() [1/2]

ilMDTaxonPath::save ( )

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

References $ilDB, __getFields(), array, ilMDBase\getMetaId(), and ilMDBase\setMetaId().

91  {
92  global $ilDB;
93 
94  $fields = $this->__getFields();
95  $fields['meta_taxon_path_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_taxon_path'));
96 
97  if ($this->db->insert('il_meta_taxon_path', $fields)) {
98  $this->setMetaId($next_id);
99  return $this->getMetaId();
100  }
101  return false;
102  }
setMetaId($a_meta_id, $a_read_data=true)
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ save() [2/2]

ilMDTaxonPath::save ( )

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

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

91  {
92  if ($this->db->autoExecute(
93  'il_meta_taxon_path',
94  $this->__getFields(),
96  )) {
97  $this->setMetaId($this->db->getLastInsertId());
98 
99  return $this->getMetaId();
100  }
101  return false;
102  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ setSource() [1/2]

ilMDTaxonPath::setSource (   $a_source)

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

Referenced by read().

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

◆ setSource() [2/2]

ilMDTaxonPath::setSource (   $a_source)

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

67  {
68  $this->source = $a_source;
69  }

◆ setSourceLanguage() [1/2]

ilMDTaxonPath::setSourceLanguage ( $lng_obj)

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

75  {
76  if (is_object($lng_obj)) {
77  $this->source_language = $lng_obj;
78  }
79  }

◆ setSourceLanguage() [2/2]

ilMDTaxonPath::setSourceLanguage ( $lng_obj)

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

75  {
76  if (is_object($lng_obj)) {
77  $this->source_language = $lng_obj;
78  }
79  }

◆ toXML() [1/2]

ilMDTaxonPath::toXML ( $writer)

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

References $id, array, ilMDBase\getObjId(), ilMDBase\getRBACId(), getSource(), getSourceLanguageCode(), getTaxon(), and getTaxonIds().

181  {
182  $writer->xmlStartTag('TaxonPath');
183 
184  $writer->xmlElement(
185  'Source',
186  array('Language' => $this->getSourceLanguageCode()
187  ? $this->getSourceLanguageCode()
188  : 'en'),
189  $this->getSource()
190  );
191 
192  // Taxon
193  $taxs = $this->getTaxonIds();
194  foreach ($taxs as $id) {
195  $tax =&$this->getTaxon($id);
196  $tax->toXML($writer);
197  }
198  if (!count($taxs)) {
199  include_once 'Services/MetaData/classes/class.ilMDTaxon.php';
200  $tax = new ilMDTaxon($this->getRBACId(), $this->getObjId());
201  $tax->toXML($writer);
202  }
203 
204  $writer->xmlEndTag('TaxonPath');
205  }
if(!array_key_exists('StateId', $_REQUEST)) $id
& getTaxon($a_taxon_id)
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDTaxonPath::toXML ( $writer)

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

References $id, array, getSource(), getSourceLanguageCode(), getTaxon(), and getTaxonIds().

183  {
184  $writer->xmlStartTag('TaxonPath');
185 
186  $writer->xmlElement('Source', array('Language' => $this->getSourceLanguageCode()), $this->getSource());
187 
188  // Taxon
189  foreach ($this->getTaxonIds() as $id) {
190  $tax =&$this->getTaxon($id);
191  $tax->toXML($writer);
192  }
193 
194  $writer->xmlEndTag('TaxonPath');
195  }
if(!array_key_exists('StateId', $_REQUEST)) $id
& getTaxon($a_taxon_id)
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ update() [1/2]

ilMDTaxonPath::update ( )

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

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

105  {
106  global $ilDB;
107 
108  if ($this->getMetaId()) {
109  if ($this->db->update(
110  'il_meta_taxon_path',
111  $this->__getFields(),
112  array("meta_taxon_path_id" => array('integer',$this->getMetaId()))
113  )) {
114  return true;
115  }
116  }
117  return false;
118  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

◆ update() [2/2]

ilMDTaxonPath::update ( )

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

References $ilDB, ilMDBase\getMetaId(), and ilDBConstants\MDB2_AUTOQUERY_UPDATE.

105  {
106  global $ilDB;
107 
108  if ($this->getMetaId()) {
109  if ($this->db->autoExecute(
110  'il_meta_taxon_path',
111  $this->__getFields(),
113  "meta_taxon_path_id = " . $ilDB->quote($this->getMetaId())
114  )) {
115  return true;
116  }
117  }
118  return false;
119  }
global $ilDB
+ Here is the call graph for this function:

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