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 127 of file class.ilMDLanguage.php.

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 }

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 99 of file class.ilMDLanguage.php.

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 }
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 177 of file class.ilMDLanguage.php.

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 }
global $ilDB

References $ilDB, $query, $res, $row, 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 146 of file class.ilMDLanguage.php.

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 }

References $ilDB, $query, $res, $row, 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 $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 }
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349

References $ilDB, $lang, $query, $res, $row, 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 111 of file class.ilMDLanguage.php.

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 }

References $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 {
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 }

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 }

Referenced by toXML().

+ Here is the caller graph for this function:

◆ getLanguage() [2/2]

& ilMDLanguage::getLanguage ( )

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

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

◆ 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 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getLanguageCode() [2/2]

ilMDLanguage::getLanguageCode ( )

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

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

◆ read() [1/2]

ilMDLanguage::read ( )

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

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 }
setObjId($a_id)
setParentId($a_id)
setObjType($a_type)
setRBACId($a_id)
setParentType($a_parent_type)
setLanguage(&$lng_obj)

References $ilDB, $query, $res, $row, 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 109 of file class.ilMDLanguage.php.

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 }

References $ilDB, $query, $res, $row, 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 $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)

References $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 52 of file class.ilMDLanguage.php.

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 }

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

+ Here is the call graph for this function:

◆ setLanguage() [1/2]

ilMDLanguage::setLanguage ( $lng_obj)

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

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

Referenced by read().

+ 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 {
40 $this->language =& $lng_obj;
41 }
42 }

◆ toXML() [1/2]

ilMDLanguage::toXML ( $writer)

Reimplemented from ilMDBase.

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

168 {
169 $writer->xmlElement('Language',array('Language' => $this->getLanguageCode() ?
170 $this->getLanguageCode() :
171 'en'),
172 $this->getLanguage());
173 }

References getLanguage(), and getLanguageCode().

+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDLanguage::toXML ( $writer)

Reimplemented from ilMDBase.

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

140 {
141 $writer->xmlElement('Language',array('Language' => $this->getLanguageCode()),$this->getLanguage());
142 }

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 $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 }

References $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 {
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 }

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

+ Here is the call graph for this function:

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