ILIAS  release_7 Revision v7.30-3-g800a261c036
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 130 of file class.ilMDLanguage.php.

131 {
132 return array('rbac_id' => array('integer',$this->getRBACId()),
133 'obj_id' => array('integer',$this->getObjId()),
134 'obj_type' => array('text',$this->getObjType()),
135 'parent_type' => array('text',$this->getParentType()),
136 'parent_id' => array('integer',$this->getParentId()),
137 'language' => array('text',$this->getLanguageCode()));
138 }

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

Referenced by save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __getFields() [2/2]

ilMDLanguage::__getFields ( )

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

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 }
static prepareDBString($a_str)
prepare a string for db writing (insert/update)

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

+ Here is the call graph for this function:

◆ _getIds() [1/2]

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

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

184 {
185 global $DIC;
186
187 $ilDB = $DIC['ilDB'];
188
189 $query = "SELECT meta_language_id FROM il_meta_language " .
190 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
191 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
192 "AND parent_id = " . $ilDB->quote($a_parent_id, 'integer') . " " .
193 "AND parent_type = " . $ilDB->quote($a_parent_type, 'text');
194
195 $res = $ilDB->query($query);
196 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
197 $ids[] = $row->meta_language_id;
198 }
199 return $ids ? $ids : array();
200 }
global $DIC
Definition: goto.php:24
$query
foreach($_POST as $key=> $value) $res
global $ilDB

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

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

+ Here is the caller graph for this function:

◆ _getIds() [2/2]

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

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

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 }

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

◆ _lookupFirstLanguage()

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

Lookup first language.

@access public

Parameters

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

44 {
45 global $DIC;
46
47 $ilDB = $DIC['ilDB'];
48
49 $lang = '';
50 $query = "SELECT language FROM il_meta_language " .
51 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
52 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " " .
53 "AND obj_type = " . $ilDB->quote($a_obj_type, 'text') . " " .
54 "AND parent_type = 'meta_general' " .
55 "ORDER BY meta_language_id ";
56 $ilDB->setLimit(1);
57 $res = $ilDB->query($query);
58 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
59 $lang = $row->language;
60 }
61 return $lang;
62 }
$lang
Definition: xapiexit.php:8

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

Referenced by ilECSCourseSettings\buildJson().

+ Here is the caller graph for this function:

◆ delete() [1/2]

ilMDLanguage::delete ( )

Reimplemented from ilMDBase.

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

114 {
115 global $DIC;
116
117 $ilDB = $DIC['ilDB'];
118
119 if ($this->getMetaId()) {
120 $query = "DELETE FROM il_meta_language " .
121 "WHERE meta_language_id = " . $ilDB->quote($this->getMetaId(), 'integer');
122 $res = $ilDB->manipulate($query);
123
124 return true;
125 }
126 return false;
127 }

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

+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDLanguage::delete ( )

Reimplemented from ilMDBase.

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

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 }

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

+ Here is the call graph for this function:

◆ getLanguage() [1/2]

& ilMDLanguage::getLanguage ( )

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

72 {
73 return is_object($this->language) ? $this->language : false;
74 }
language()
Definition: language.php:2

References language().

Referenced by toXML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLanguage() [2/2]

& ilMDLanguage::getLanguage ( )

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

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

References language().

+ Here is the call graph for this function:

◆ getLanguageCode() [1/2]

ilMDLanguage::getLanguageCode ( )

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

76 {
77 return is_object($this->language) ? $this->language->getLanguageCode() : false;
78 }

References language().

Referenced by __getFields(), and toXML().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLanguageCode() [2/2]

ilMDLanguage::getLanguageCode ( )

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

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

References language().

+ Here is the call graph for this function:

◆ read() [1/2]

ilMDLanguage::read ( )

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

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

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

+ Here is the call graph for this function:

◆ read() [2/2]

ilMDLanguage::read ( )

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

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 }

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

+ Here is the call graph for this function:

◆ save() [1/2]

ilMDLanguage::save ( )

Reimplemented from ilMDBase.

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

81 {
82 global $DIC;
83
84 $ilDB = $DIC['ilDB'];
85
86 $fields = $this->__getFields();
87 $fields['meta_language_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_language'));
88 if ($this->db->insert('il_meta_language', $fields)) {
89 $this->setMetaId($next_id);
90 return $this->getMetaId();
91 }
92 return false;
93 }
setMetaId($a_meta_id, $a_read_data=true)

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

+ Here is the call graph for this function:

◆ save() [2/2]

ilMDLanguage::save ( )

Reimplemented from ilMDBase.

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

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 }

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

+ Here is the call graph for this function:

◆ setLanguage() [1/2]

ilMDLanguage::setLanguage ( $lng_obj)

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

66 {
67 if (is_object($lng_obj)) {
68 $this->language = &$lng_obj;
69 }
70 }

References language().

Referenced by read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLanguage() [2/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 }

References language().

+ Here is the call graph for this function:

◆ toXML() [1/2]

ilMDLanguage::toXML ( $writer)

Reimplemented from ilMDBase.

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

171 {
172 $writer->xmlElement(
173 'Language',
174 array('Language' => $this->getLanguageCode() ?
175 $this->getLanguageCode() :
176 'en'),
177 $this->getLanguage()
178 );
179 }

References getLanguage(), and getLanguageCode().

+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDLanguage::toXML ( $writer)

Reimplemented from ilMDBase.

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

137 {
138 $writer->xmlElement('Language', array('Language' => $this->getLanguageCode()), $this->getLanguage());
139 }

References getLanguage(), and getLanguageCode().

+ Here is the call graph for this function:

◆ update() [1/2]

ilMDLanguage::update ( )

Reimplemented from ilMDBase.

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

96 {
97 global $DIC;
98
99 $ilDB = $DIC['ilDB'];
100
101 if ($this->getMetaId()) {
102 if ($this->db->update(
103 'il_meta_language',
104 $this->__getFields(),
105 array("meta_language_id" => array('integer',$this->getMetaId()))
106 )) {
107 return true;
108 }
109 }
110 return false;
111 }

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

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDLanguage::update ( )

Reimplemented from ilMDBase.

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

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 }

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

+ Here is the call graph for this function:

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