ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilMDLanguage Class Reference
+ Inheritance diagram for ilMDLanguage:
+ Collaboration diagram for ilMDLanguage:

Public Member Functions

 ilMDLanguage ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 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)
 
 ilMDLanguage ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 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
 ilMDBase ($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)
 
 ilMDBase ($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...
 

Additional Inherited Members

- Data Fields inherited from ilMDBase
 $rbac_id
 
 $obj_id
 
 $obj_type
 
 $export_mode = false
 

Detailed Description

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

Member Function Documentation

◆ __getFields() [1/2]

ilMDLanguage::__getFields ( )

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

136 {
137 return array('rbac_id' => array('integer',$this->getRBACId()),
138 'obj_id' => array('integer',$this->getObjId()),
139 'obj_type' => array('text',$this->getObjType()),
140 'parent_type' => array('text',$this->getParentType()),
141 'parent_id' => array('integer',$this->getParentId()),
142 'language' => array('text',$this->getLanguageCode()));
143 }

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

108 {
109 return array('rbac_id' => $this->getRBACId(),
110 'obj_id' => $this->getObjId(),
111 'obj_type' => ilUtil::prepareDBString($this->getObjType()),
112 'parent_type' => $this->getParentType(),
113 'parent_id' => $this->getParentId(),
114 'language' => ilUtil::prepareDBString($this->getLanguageCode()));
115 }
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]

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

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

186 {
187 global $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(DB_FETCHMODE_OBJECT))
197 {
198 $ids[] = $row->meta_language_id;
199 }
200 return $ids ? $ids : array();
201 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB

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

155 {
156 global $ilDB;
157
158 $query = "SELECT meta_language_id FROM il_meta_language ".
159 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
160 "AND obj_id = ".$ilDB->quote($a_obj_id)." ".
161 "AND parent_id = ".$ilDB->quote($a_parent_id)." ".
162 "AND parent_type = ".$ilDB->quote($a_parent_type);
163
164 $res = $ilDB->query($query);
165 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
166 {
167 $ids[] = $row->meta_language_id;
168 }
169 return $ids ? $ids : array();
170 }

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

52 {
53 global $ilDB;
54
55 $lang = '';
56 $query = "SELECT language FROM il_meta_language ".
57 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
58 "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ".
59 "AND obj_type = ".$ilDB->quote($a_obj_type ,'text')." ".
60 "AND parent_type = 'meta_general' ".
61 "ORDER BY meta_language_id ";
62 $ilDB->setLimit(1);
63 $res = $ilDB->query($query);
64 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
65 {
66 $lang = $row->language;
67 }
68 return $lang;
69 }

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

120 {
121 global $ilDB;
122
123 if($this->getMetaId())
124 {
125 $query = "DELETE FROM il_meta_language ".
126 "WHERE meta_language_id = ".$ilDB->quote($this->getMetaId() ,'integer');
127 $res = $ilDB->manipulate($query);
128
129 return true;
130 }
131 return false;
132 }

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

91 {
92 global $ilDB;
93
94 if($this->getMetaId())
95 {
96 $query = "DELETE FROM il_meta_language ".
97 "WHERE meta_language_id = ".$ilDB->quote($this->getMetaId());
98
99 $this->db->query($query);
100
101 return true;
102 }
103 return false;
104 }

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

+ Here is the call graph for this function:

◆ getLanguage() [1/2]

& ilMDLanguage::getLanguage ( )

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

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

Referenced by toXML().

+ Here is the caller graph for this function:

◆ getLanguage() [2/2]

& ilMDLanguage::getLanguage ( )

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

52 {
53 return is_object($this->language) ? $this->language : false;
54 }

◆ getLanguageCode() [1/2]

ilMDLanguage::getLanguageCode ( )

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

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

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getLanguageCode() [2/2]

ilMDLanguage::getLanguageCode ( )

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

56 {
57 return is_object($this->language) ? $this->language->getLanguageCode() : false;
58 }

◆ ilMDLanguage() [1/2]

ilMDLanguage::ilMDLanguage (   $a_rbac_id = 0,
  $a_obj_id = 0,
  $a_obj_type = '' 
)

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

37 {
38 parent::ilMDBase($a_rbac_id,
39 $a_obj_id,
40 $a_obj_type);
41 }

◆ ilMDLanguage() [2/2]

ilMDLanguage::ilMDLanguage (   $a_rbac_id = 0,
  $a_obj_id = 0,
  $a_obj_type = '' 
)

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

37 {
38 parent::ilMDBase($a_rbac_id,
39 $a_obj_id,
40 $a_obj_type);
41 }

◆ read() [1/2]

ilMDLanguage::read ( )

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

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

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

118 {
119 global $ilDB;
120
121 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
122
123 if($this->getMetaId())
124 {
125 $query = "SELECT * FROM il_meta_language ".
126 "WHERE meta_language_id = ".$ilDB->quote($this->getMetaId());
127
128 $res = $this->db->query($query);
129 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
130 {
131 $this->setRBACId($row->rbac_id);
132 $this->setObjId($row->obj_id);
133 $this->setObjType($row->obj_type);
134 $this->setParentId($row->parent_id);
135 $this->setParentType($row->parent_type);
136 $this->setLanguage(new ilMDLanguageItem($row->language));
137 }
138 }
139 return true;
140 }

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

89 {
90 global $ilDB;
91
92 $fields = $this->__getFields();
93 $fields['meta_language_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_language'));
94
95 if($this->db->insert('il_meta_language',$fields))
96 {
97 $this->setMetaId($next_id);
98 return $this->getMetaId();
99 }
100 return false;
101 }
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 60 of file class.ilMDLanguage.php.

61 {
62 if($this->db->autoExecute('il_meta_language',
63 $this->__getFields(),
64 DB_AUTOQUERY_INSERT))
65 {
66 $this->setMetaId($this->db->getLastInsertId());
67
68 return $this->getMetaId();
69 }
70 return false;
71 }

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

+ Here is the call graph for this function:

◆ setLanguage() [1/2]

ilMDLanguage::setLanguage ( $lng_obj)

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

73 {
74 if(is_object($lng_obj))
75 {
76 $this->language =& $lng_obj;
77 }
78 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setLanguage() [2/2]

ilMDLanguage::setLanguage ( $lng_obj)

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

45 {
46 if(is_object($lng_obj))
47 {
48 $this->language =& $lng_obj;
49 }
50 }

◆ toXML() [1/2]

ilMDLanguage::toXML ( $writer)

Reimplemented from ilMDBase.

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

176 {
177 $writer->xmlElement('Language',array('Language' => $this->getLanguageCode() ?
178 $this->getLanguageCode() :
179 'en'),
180 $this->getLanguage());
181 }

References getLanguage(), and getLanguageCode().

+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDLanguage::toXML ( $writer)

Reimplemented from ilMDBase.

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

148 {
149 $writer->xmlElement('Language',array('Language' => $this->getLanguageCode()),$this->getLanguage());
150 }

References getLanguage(), and getLanguageCode().

+ Here is the call graph for this function:

◆ update() [1/2]

ilMDLanguage::update ( )

Reimplemented from ilMDBase.

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

104 {
105 global $ilDB;
106
107 if($this->getMetaId())
108 {
109 if($this->db->update('il_meta_language',
110 $this->__getFields(),
111 array("meta_language_id" => array('integer',$this->getMetaId()))))
112 {
113 return true;
114 }
115 }
116 return false;
117 }

References $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDLanguage::update ( )

Reimplemented from ilMDBase.

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

74 {
75 global $ilDB;
76
77 if($this->getMetaId())
78 {
79 if($this->db->autoExecute('il_meta_language',
80 $this->__getFields(),
81 DB_AUTOQUERY_UPDATE,
82 "meta_language_id = ".$ilDB->quote($this->getMetaId())))
83 {
84 return true;
85 }
86 }
87 return false;
88 }

References $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

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