ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 99 of file class.ilMDLanguage.php.

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

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

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

Referenced by save().

128  {
129  return array('rbac_id' => array('integer',$this->getRBACId()),
130  'obj_id' => array('integer',$this->getObjId()),
131  'obj_type' => array('text',$this->getObjType()),
132  'parent_type' => array('text',$this->getParentType()),
133  'parent_id' => array('integer',$this->getParentId()),
134  'language' => array('text',$this->getLanguageCode()));
135  }
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 146 of file class.ilMDLanguage.php.

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

147  {
148  global $ilDB;
149 
150  $query = "SELECT meta_language_id FROM il_meta_language ".
151  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
152  "AND obj_id = ".$ilDB->quote($a_obj_id)." ".
153  "AND parent_id = ".$ilDB->quote($a_parent_id)." ".
154  "AND parent_type = ".$ilDB->quote($a_parent_type);
155 
156  $res = $ilDB->query($query);
157  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
158  {
159  $ids[] = $row->meta_language_id;
160  }
161  return $ids ? $ids : array();
162  }
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 177 of file class.ilMDLanguage.php.

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

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

178  {
179  global $ilDB;
180 
181  $query = "SELECT meta_language_id FROM il_meta_language ".
182  "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
183  "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
184  "AND parent_id = ".$ilDB->quote($a_parent_id ,'integer')." ".
185  "AND parent_type = ".$ilDB->quote($a_parent_type ,'text');
186 
187  $res = $ilDB->query($query);
188  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
189  {
190  $ids[] = $row->meta_language_id;
191  }
192  return $ids ? $ids : array();
193  }
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  {
58  $lang = $row->language;
59  }
60  return $lang;
61  }
global $ilDB
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
+ 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  {
88  $query = "DELETE FROM il_meta_language ".
89  "WHERE meta_language_id = ".$ilDB->quote($this->getMetaId());
90 
91  $this->db->query($query);
92 
93  return true;
94  }
95  return false;
96  }
global $ilDB
+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDLanguage::delete ( )

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

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

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

◆ getLanguage() [1/2]

& ilMDLanguage::getLanguage ( )

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

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

◆ getLanguage() [2/2]

& ilMDLanguage::getLanguage ( )

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

Referenced by toXML().

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

◆ getLanguageCode() [1/2]

ilMDLanguage::getLanguageCode ( )

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

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

◆ getLanguageCode() [2/2]

ilMDLanguage::getLanguageCode ( )

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

Referenced by __getFields(), and toXML().

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

◆ read() [1/2]

ilMDLanguage::read ( )

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

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

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

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

53  {
54  if($this->db->autoExecute('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 80 of file class.ilMDLanguage.php.

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

81  {
82  global $ilDB;
83 
84  $fields = $this->__getFields();
85  $fields['meta_language_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_language'));
86 
87  if($this->db->insert('il_meta_language',$fields))
88  {
89  $this->setMetaId($next_id);
90  return $this->getMetaId();
91  }
92  return false;
93  }
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  {
40  $this->language =& $lng_obj;
41  }
42  }

◆ setLanguage() [2/2]

ilMDLanguage::setLanguage ( $lng_obj)

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

Referenced by read().

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

◆ toXML() [1/2]

ilMDLanguage::toXML ( $writer)

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

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

140  {
141  $writer->xmlElement('Language',array('Language' => $this->getLanguageCode()),$this->getLanguage());
142  }
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 167 of file class.ilMDLanguage.php.

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

168  {
169  $writer->xmlElement('Language',array('Language' => $this->getLanguageCode() ?
170  $this->getLanguageCode() :
171  'en'),
172  $this->getLanguage());
173  }
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  {
71  if($this->db->autoExecute('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 95 of file class.ilMDLanguage.php.

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

96  {
97  global $ilDB;
98 
99  if($this->getMetaId())
100  {
101  if($this->db->update('il_meta_language',
102  $this->__getFields(),
103  array("meta_language_id" => array('integer',$this->getMetaId()))))
104  {
105  return true;
106  }
107  }
108  return false;
109  }
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: