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

Public Member Functions

 setLanguage (&$lng_obj)
 
getLanguage ()
 
 getLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 setLanguage (&$lng_obj)
 
getLanguage ()
 
 getLanguageCode ()
 
 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 _lookupFirstLanguage ($a_rbac_id, $a_obj_id, $a_obj_type)
 Lookup first language. More...
 
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.ilMDLanguage.php.

Member Function Documentation

◆ __getFields() [1/2]

ilMDLanguage::__getFields ( )

Definition at line 98 of file class.ilMDLanguage.php.

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

99  {
100  return array('rbac_id' => $this->getRBACId(),
101  'obj_id' => $this->getObjId(),
102  'obj_type' => ilUtil::prepareDBString($this->getObjType()),
103  'parent_type' => $this->getParentType(),
104  'parent_id' => $this->getParentId(),
105  'language' => ilUtil::prepareDBString($this->getLanguageCode()));
106  }
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:

◆ __getFields() [2/2]

ilMDLanguage::__getFields ( )

Definition at line 123 of file class.ilMDLanguage.php.

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

Referenced by save().

124  {
125  return array('rbac_id' => array('integer',$this->getRBACId()),
126  'obj_id' => array('integer',$this->getObjId()),
127  'obj_type' => array('text',$this->getObjType()),
128  'parent_type' => array('text',$this->getParentType()),
129  'parent_id' => array('integer',$this->getParentId()),
130  'language' => array('text',$this->getLanguageCode()));
131  }
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:

◆ _getIds() [1/2]

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

Definition at line 143 of file class.ilMDLanguage.php.

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

144  {
145  global $ilDB;
146 
147  $query = "SELECT meta_language_id FROM il_meta_language " .
148  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id) . " " .
149  "AND obj_id = " . $ilDB->quote($a_obj_id) . " " .
150  "AND parent_id = " . $ilDB->quote($a_parent_id) . " " .
151  "AND parent_type = " . $ilDB->quote($a_parent_type);
152 
153  $res = $ilDB->query($query);
154  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
155  $ids[] = $row->meta_language_id;
156  }
157  return $ids ? $ids : array();
158  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB

◆ _getIds() [2/2]

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

Definition at line 174 of file class.ilMDLanguage.php.

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

Referenced by ilMDGeneral\getLanguageIds(), and ilMDEducational\getLanguageIds().

175  {
176  global $ilDB;
177 
178  $query = "SELECT meta_language_id FROM il_meta_language " .
179  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
180  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
181  "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
182  "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
183 
184  $res = $ilDB->query($query);
185  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
186  $ids[] = $row->meta_language_id;
187  }
188  return $ids ? $ids : array();
189  }
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:

◆ _lookupFirstLanguage()

static ilMDLanguage::_lookupFirstLanguage (   $a_rbac_id,
  $a_obj_id,
  $a_obj_type 
)
static

Lookup first language.

public

Parameters

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

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

Referenced by ilECSCourseSettings\buildJson().

44  {
45  global $ilDB;
46 
47  $lang = '';
48  $query = "SELECT language FROM il_meta_language " .
49  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
50  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
51  "AND obj_type = " . $ilDB->quote($a_obj_type, 'text') . " " .
52  "AND parent_type = 'meta_general' " .
53  "ORDER BY meta_language_id ";
54  $ilDB->setLimit(1);
55  $res = $ilDB->query($query);
56  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
57  $lang = $row->language;
58  }
59  return $lang;
60  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the caller graph for this function:

◆ delete() [1/2]

ilMDLanguage::delete ( )

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

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

83  {
84  global $ilDB;
85 
86  if ($this->getMetaId()) {
87  $query = "DELETE FROM il_meta_language " .
88  "WHERE meta_language_id = " . $ilDB->quote($this->getMetaId());
89 
90  $this->db->query($query);
91 
92  return true;
93  }
94  return false;
95  }
$query
global $ilDB
+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDLanguage::delete ( )

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

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

109  {
110  global $ilDB;
111 
112  if ($this->getMetaId()) {
113  $query = "DELETE FROM il_meta_language " .
114  "WHERE meta_language_id = " . $ilDB->quote($this->getMetaId(), 'integer');
115  $res = $ilDB->manipulate($query);
116 
117  return true;
118  }
119  return false;
120  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

◆ getLanguage() [1/2]

& ilMDLanguage::getLanguage ( )

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

43  {
44  return is_object($this->language) ? $this->language : false;
45  }

◆ getLanguage() [2/2]

& ilMDLanguage::getLanguage ( )

Definition at line 69 of file class.ilMDLanguage.php.

Referenced by toXML().

70  {
71  return is_object($this->language) ? $this->language : false;
72  }
+ Here is the caller graph for this function:

◆ getLanguageCode() [1/2]

ilMDLanguage::getLanguageCode ( )

Definition at line 46 of file class.ilMDLanguage.php.

47  {
48  return is_object($this->language) ? $this->language->getLanguageCode() : false;
49  }

◆ getLanguageCode() [2/2]

ilMDLanguage::getLanguageCode ( )

Definition at line 73 of file class.ilMDLanguage.php.

Referenced by __getFields(), and toXML().

74  {
75  return is_object($this->language) ? $this->language->getLanguageCode() : false;
76  }
+ Here is the caller graph for this function:

◆ read() [1/2]

ilMDLanguage::read ( )

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

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

109  {
110  global $ilDB;
111 
112  include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
113 
114  if ($this->getMetaId()) {
115  $query = "SELECT * FROM il_meta_language " .
116  "WHERE meta_language_id = " . $ilDB->quote($this->getMetaId());
117 
118  $res = $this->db->query($query);
119  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
120  $this->setRBACId($row->rbac_id);
121  $this->setObjId($row->obj_id);
122  $this->setObjType($row->obj_type);
123  $this->setParentId($row->parent_id);
124  $this->setParentType($row->parent_type);
125  $this->setLanguage(new ilMDLanguageItem($row->language));
126  }
127  }
128  return true;
129  }
setObjType($a_type)
setLanguage(&$lng_obj)
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]

ilMDLanguage::read ( )

Definition at line 133 of file class.ilMDLanguage.php.

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

134  {
135  global $ilDB;
136 
137  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
138 
139  if ($this->getMetaId()) {
140  $query = "SELECT * FROM il_meta_language " .
141  "WHERE meta_language_id = " . $ilDB->quote($this->getMetaId(), 'integer');
142 
143  $res = $this->db->query($query);
144  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
145  $this->setRBACId($row->rbac_id);
146  $this->setObjId($row->obj_id);
147  $this->setObjType($row->obj_type);
148  $this->setParentId($row->parent_id);
149  $this->setParentType($row->parent_type);
150  $this->setLanguage(new ilMDLanguageItem($row->language));
151  }
152  }
153  return true;
154  }
setObjType($a_type)
setLanguage(&$lng_obj)
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:

◆ save() [1/2]

ilMDLanguage::save ( )

Definition at line 51 of file class.ilMDLanguage.php.

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

52  {
53  if ($this->db->autoExecute(
54  'il_meta_language',
55  $this->__getFields(),
57  )) {
58  $this->setMetaId($this->db->getLastInsertId());
59 
60  return $this->getMetaId();
61  }
62  return false;
63  }
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ save() [2/2]

ilMDLanguage::save ( )

Definition at line 78 of file class.ilMDLanguage.php.

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

79  {
80  global $ilDB;
81 
82  $fields = $this->__getFields();
83  $fields['meta_language_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_language'));
84 
85  if ($this->db->insert('il_meta_language', $fields)) {
86  $this->setMetaId($next_id);
87  return $this->getMetaId();
88  }
89  return false;
90  }
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:

◆ setLanguage() [1/2]

ilMDLanguage::setLanguage ( $lng_obj)

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

37  {
38  if (is_object($lng_obj)) {
39  $this->language =&$lng_obj;
40  }
41  }

◆ setLanguage() [2/2]

ilMDLanguage::setLanguage ( $lng_obj)

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

Referenced by read().

64  {
65  if (is_object($lng_obj)) {
66  $this->language =&$lng_obj;
67  }
68  }
+ Here is the caller graph for this function:

◆ toXML() [1/2]

ilMDLanguage::toXML ( $writer)

Definition at line 136 of file class.ilMDLanguage.php.

References array, getLanguage(), and getLanguageCode().

137  {
138  $writer->xmlElement('Language', array('Language' => $this->getLanguageCode()), $this->getLanguage());
139  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDLanguage::toXML ( $writer)

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

References array, getLanguage(), and getLanguageCode().

162  {
163  $writer->xmlElement(
164  'Language',
165  array('Language' => $this->getLanguageCode() ?
166  $this->getLanguageCode() :
167  'en'),
168  $this->getLanguage()
169  );
170  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ update() [1/2]

ilMDLanguage::update ( )

Definition at line 65 of file class.ilMDLanguage.php.

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

66  {
67  global $ilDB;
68 
69  if ($this->getMetaId()) {
70  if ($this->db->autoExecute(
71  'il_meta_language',
72  $this->__getFields(),
74  "meta_language_id = " . $ilDB->quote($this->getMetaId())
75  )) {
76  return true;
77  }
78  }
79  return false;
80  }
global $ilDB
+ Here is the call graph for this function:

◆ update() [2/2]

ilMDLanguage::update ( )

Definition at line 92 of file class.ilMDLanguage.php.

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

93  {
94  global $ilDB;
95 
96  if ($this->getMetaId()) {
97  if ($this->db->update(
98  'il_meta_language',
99  $this->__getFields(),
100  array("meta_language_id" => array('integer',$this->getMetaId()))
101  )) {
102  return true;
103  }
104  }
105  return false;
106  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

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