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

Public Member Functions

 ilMDRights ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 setCosts ($a_costs)
 
 getCosts ()
 
 setCopyrightAndOtherRestrictions ($a_caor)
 
 getCopyrightAndOtherRestrictions ()
 
 setDescription ($a_description)
 
 getDescription ()
 
 setDescriptionLanguage (&$lng_obj)
 
getDescriptionLanguage ()
 
 getDescriptionLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 _lookupDescription ($a_rbac_id, $a_obj_id)
 Lookup description (copyright) More...
 
 _getId ($a_rbac_id, $a_obj_id)
 
 ilMDRights ($a_rbac_id=0, $a_obj_id=0, $a_obj_type='')
 
 setCosts ($a_costs)
 
 getCosts ()
 
 setCopyrightAndOtherRestrictions ($a_caor)
 
 getCopyrightAndOtherRestrictions ()
 
 setDescription ($a_description)
 
 getDescription ()
 
 setDescriptionLanguage (&$lng_obj)
 
getDescriptionLanguage ()
 
 getDescriptionLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 _getId ($a_rbac_id, $a_obj_id)
 
- 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)
 

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.ilMDRights.php.

Member Function Documentation

◆ __getFields() [1/2]

ilMDRights::__getFields ( )

Definition at line 149 of file class.ilMDRights.php.

150 {
151 return array('rbac_id' => array('integer',$this->getRBACId()),
152 'obj_id' => array('integer',$this->getObjId()),
153 'obj_type' => array('text',$this->getObjType()),
154 'costs' => array('text',$this->getCosts()),
155 'cpr_and_or' => array('text',$this->getCopyrightAndOtherRestrictions()),
156 'description' => array('text',$this->getDescription()),
157 'description_language' => array('text',$this->getDescriptionLanguageCode()));
158 }
getCopyrightAndOtherRestrictions()
getDescriptionLanguageCode()

References getCopyrightAndOtherRestrictions(), getCosts(), getDescription(), getDescriptionLanguageCode(), ilMDBase\getObjId(), ilMDBase\getObjType(), 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]

ilMDRights::__getFields ( )

Definition at line 148 of file class.ilMDRights.php.

149 {
150 return array('rbac_id' => $this->getRBACId(),
151 'obj_id' => $this->getObjId(),
152 'obj_type' => ilUtil::prepareDBString($this->getObjType()),
153 'costs' => ilUtil::prepareDBString($this->getCosts()),
154 'copyright_and_other_restrictions' => ilUtil::prepareDBString($this->getCopyrightAndOtherRestrictions()),
155 'description' => ilUtil::prepareDBString($this->getDescription()),
156 'description_language' => ilUtil::prepareDBString($this->getDescriptionLanguageCode()));
157 }
static prepareDBString($a_str)
prepare a string for db writing (insert/update)

References getCopyrightAndOtherRestrictions(), getCosts(), getDescription(), getDescriptionLanguageCode(), ilMDBase\getObjId(), ilMDBase\getObjType(), ilMDBase\getRBACId(), and ilUtil\prepareDBString().

+ Here is the call graph for this function:

◆ _getId() [1/2]

ilMDRights::_getId (   $a_rbac_id,
  $a_obj_id 
)

Definition at line 234 of file class.ilMDRights.php.

235 {
236 global $ilDB;
237
238 $query = "SELECT meta_rights_id FROM il_meta_rights ".
239 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
240 "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer');
241
242 $res = $ilDB->query($query);
243 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
244 {
245 return $row->meta_rights_id;
246 }
247 return false;
248 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilMD\getRights().

+ Here is the caller graph for this function:

◆ _getId() [2/2]

ilMDRights::_getId (   $a_rbac_id,
  $a_obj_id 
)

Definition at line 203 of file class.ilMDRights.php.

204 {
205 global $ilDB;
206
207 $query = "SELECT meta_rights_id FROM il_meta_rights ".
208 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id)." ".
209 "AND obj_id = ".$ilDB->quote($a_obj_id);
210
211 $res = $ilDB->query($query);
212 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
213 {
214 return $row->meta_rights_id;
215 }
216 return false;
217 }

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

◆ _lookupDescription()

ilMDRights::_lookupDescription (   $a_rbac_id,
  $a_obj_id 
)

Lookup description (copyright)

@access public

Parameters
intrbac_id
intobj_id

Definition at line 221 of file class.ilMDRights.php.

222 {
223 global $ilDB;
224
225 $query = "SELECT description FROM il_meta_rights ".
226 "WHERE rbac_id = ".$ilDB->quote($a_rbac_id ,'integer')." ".
227 "AND obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
228 $res = $ilDB->query($query);
229 $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
230 return $row->description ? $row->description : '';
231 }

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilMDCopyrightSelectionGUI\fillTemplate(), and ilMDEditorGUI\initQuickEditForm().

+ Here is the caller graph for this function:

◆ delete() [1/2]

ilMDRights::delete ( )

Reimplemented from ilMDBase.

Definition at line 132 of file class.ilMDRights.php.

133 {
134 global $ilDB;
135
136 if($this->getMetaId())
137 {
138 $query = "DELETE FROM il_meta_rights ".
139 "WHERE meta_rights_id = ".$ilDB->quote($this->getMetaId() ,'integer');
140
141 $this->db->query($query);
142
143 return true;
144 }
145 return false;
146 }

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

+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDRights::delete ( )

Reimplemented from ilMDBase.

Definition at line 131 of file class.ilMDRights.php.

132 {
133 global $ilDB;
134
135 if($this->getMetaId())
136 {
137 $query = "DELETE FROM il_meta_rights ".
138 "WHERE meta_rights_id = ".$ilDB->quote($this->getMetaId());
139
140 $this->db->query($query);
141
142 return true;
143 }
144 return false;
145 }

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

+ Here is the call graph for this function:

◆ getCopyrightAndOtherRestrictions() [1/2]

ilMDRights::getCopyrightAndOtherRestrictions ( )

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

74 {
75 return $this->caor;
76 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getCopyrightAndOtherRestrictions() [2/2]

ilMDRights::getCopyrightAndOtherRestrictions ( )

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

74 {
75 return $this->caor;
76 }

◆ getCosts() [1/2]

ilMDRights::getCosts ( )

Definition at line 56 of file class.ilMDRights.php.

57 {
58 return $this->costs;
59 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getCosts() [2/2]

ilMDRights::getCosts ( )

Definition at line 56 of file class.ilMDRights.php.

57 {
58 return $this->costs;
59 }

◆ getDescription() [1/2]

ilMDRights::getDescription ( )

Definition at line 81 of file class.ilMDRights.php.

82 {
83 return $this->description;
84 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDescription() [2/2]

ilMDRights::getDescription ( )

Definition at line 81 of file class.ilMDRights.php.

82 {
83 return $this->description;
84 }

◆ getDescriptionLanguage() [1/2]

& ilMDRights::getDescriptionLanguage ( )

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

93 {
94 return is_object($this->description_language) ? $this->description_language : false;
95 }

◆ getDescriptionLanguage() [2/2]

& ilMDRights::getDescriptionLanguage ( )

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

93 {
94 return is_object($this->description_language) ? $this->description_language : false;
95 }

◆ getDescriptionLanguageCode() [1/2]

ilMDRights::getDescriptionLanguageCode ( )

Definition at line 96 of file class.ilMDRights.php.

97 {
98 return is_object($this->description_language) ? $this->description_language->getLanguageCode() : false;
99 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDescriptionLanguageCode() [2/2]

ilMDRights::getDescriptionLanguageCode ( )

Definition at line 96 of file class.ilMDRights.php.

97 {
98 return is_object($this->description_language) ? $this->description_language->getLanguageCode() : false;
99 }

◆ ilMDRights() [1/2]

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

Definition at line 35 of file class.ilMDRights.php.

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

◆ ilMDRights() [2/2]

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

Definition at line 35 of file class.ilMDRights.php.

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

◆ read() [1/2]

ilMDRights::read ( )

Definition at line 160 of file class.ilMDRights.php.

161 {
162 global $ilDB;
163
164 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
165
166
167 if($this->getMetaId())
168 {
169
170 $query = "SELECT * FROM il_meta_rights ".
171 "WHERE meta_rights_id = ".$ilDB->quote($this->getMetaId() ,'integer');
172
173
174 $res = $this->db->query($query);
175 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
176 {
177 $this->setRBACId($row->rbac_id);
178 $this->setObjId($row->obj_id);
179 $this->setObjType($row->obj_type);
180 $this->setDescription($row->description);
181 $this->setDescriptionLanguage(new ilMDLanguageItem($row->description_language));
182 $this->setCosts($row->costs);
183 $this->setCopyrightAndOtherRestrictions($row->cpr_and_or);
184 }
185 return true;
186 }
187 return false;
188 }
setObjId($a_id)
setObjType($a_type)
setRBACId($a_id)
setCosts($a_costs)
setDescription($a_description)
setDescriptionLanguage(&$lng_obj)
setCopyrightAndOtherRestrictions($a_caor)

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, ilMDBase\getMetaId(), setCopyrightAndOtherRestrictions(), setCosts(), setDescription(), setDescriptionLanguage(), ilMDBase\setObjId(), ilMDBase\setObjType(), and ilMDBase\setRBACId().

+ Here is the call graph for this function:

◆ read() [2/2]

ilMDRights::read ( )

Definition at line 159 of file class.ilMDRights.php.

160 {
161 global $ilDB;
162
163 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
164
165
166 if($this->getMetaId())
167 {
168
169 $query = "SELECT * FROM il_meta_rights ".
170 "WHERE meta_rights_id = ".$ilDB->quote($this->getMetaId());
171
172
173 $res = $this->db->query($query);
174 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
175 {
176 $this->setRBACId($row->rbac_id);
177 $this->setObjId($row->obj_id);
178 $this->setObjType($row->obj_type);
179 $this->setDescription(ilUtil::stripSlashes($row->description));
180 $this->setDescriptionLanguage(new ilMDLanguageItem($row->description_language));
181 $this->setCosts(ilUtil::stripSlashes($row->costs));
182 $this->setCopyrightAndOtherRestrictions(ilUtil::stripSlashes($row->copyright_and_other_restrictions));
183 }
184 return true;
185 }
186 return false;
187 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, ilMDBase\getMetaId(), setCopyrightAndOtherRestrictions(), setCosts(), setDescription(), setDescriptionLanguage(), ilMDBase\setObjId(), ilMDBase\setObjType(), ilMDBase\setRBACId(), and ilUtil\stripSlashes().

+ Here is the call graph for this function:

◆ save() [1/2]

ilMDRights::save ( )

Reimplemented from ilMDBase.

Definition at line 101 of file class.ilMDRights.php.

102 {
103 global $ilDB;
104
105 $fields = $this->__getFields();
106 $fields['meta_rights_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_rights'));
107
108 if($this->db->insert('il_meta_rights',$fields))
109 {
110 $this->setMetaId($next_id);
111 return $this->getMetaId();
112 }
113 return false;
114 }
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]

ilMDRights::save ( )

Reimplemented from ilMDBase.

Definition at line 101 of file class.ilMDRights.php.

102 {
103 if($this->db->autoExecute('il_meta_rights',
104 $this->__getFields(),
105 DB_AUTOQUERY_INSERT))
106 {
107 $this->setMetaId($this->db->getLastInsertId());
108
109 return $this->getMetaId();
110 }
111 return false;
112 }

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

+ Here is the call graph for this function:

◆ setCopyrightAndOtherRestrictions() [1/2]

ilMDRights::setCopyrightAndOtherRestrictions (   $a_caor)

Definition at line 60 of file class.ilMDRights.php.

61 {
62 switch($a_caor)
63 {
64 case 'Yes':
65 case 'No':
66 $this->caor = $a_caor;
67 return true;
68
69 default:
70 return false;
71 }
72 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCopyrightAndOtherRestrictions() [2/2]

ilMDRights::setCopyrightAndOtherRestrictions (   $a_caor)

Definition at line 60 of file class.ilMDRights.php.

61 {
62 switch($a_caor)
63 {
64 case 'Yes':
65 case 'No':
66 $this->caor = $a_caor;
67 return true;
68
69 default:
70 return false;
71 }
72 }

◆ setCosts() [1/2]

ilMDRights::setCosts (   $a_costs)

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

44 {
45 switch($a_costs)
46 {
47 case 'Yes':
48 case 'No':
49 $this->costs = $a_costs;
50 return true;
51
52 default:
53 return false;
54 }
55 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCosts() [2/2]

ilMDRights::setCosts (   $a_costs)

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

44 {
45 switch($a_costs)
46 {
47 case 'Yes':
48 case 'No':
49 $this->costs = $a_costs;
50 return true;
51
52 default:
53 return false;
54 }
55 }

◆ setDescription() [1/2]

ilMDRights::setDescription (   $a_description)

Definition at line 77 of file class.ilMDRights.php.

78 {
79 $this->description = $a_description;
80 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescription() [2/2]

ilMDRights::setDescription (   $a_description)

Definition at line 77 of file class.ilMDRights.php.

78 {
79 $this->description = $a_description;
80 }

◆ setDescriptionLanguage() [1/2]

ilMDRights::setDescriptionLanguage ( $lng_obj)

Definition at line 85 of file class.ilMDRights.php.

86 {
87 if(is_object($lng_obj))
88 {
89 $this->description_language = $lng_obj;
90 }
91 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescriptionLanguage() [2/2]

ilMDRights::setDescriptionLanguage ( $lng_obj)

Definition at line 85 of file class.ilMDRights.php.

86 {
87 if(is_object($lng_obj))
88 {
89 $this->description_language = $lng_obj;
90 }
91 }

◆ toXML() [1/2]

ilMDRights::toXML ( $writer)

Reimplemented from ilMDBase.

Definition at line 195 of file class.ilMDRights.php.

196 {
197 $writer->xmlStartTag('Rights',array('Cost' => $this->getCosts()
198 ? $this->getCosts()
199 : 'No',
200 'CopyrightAndOtherRestrictions' => $this->getCopyrightAndOtherRestrictions()
202 : 'No'));
203 include_once './Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php';
204 $writer->xmlElement(
205 'Description',array('Language' => $this->getDescriptionLanguageCode()
207 : 'en'),
209 );
210 $writer->xmlEndTag('Rights');
211 }
static lookupCopyyrightTitle($a_cp_string)
Lookup copyright title.

References getCopyrightAndOtherRestrictions(), getCosts(), getDescription(), getDescriptionLanguageCode(), and ilMDCopyrightSelectionEntry\lookupCopyyrightTitle().

+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDRights::toXML ( $writer)

Reimplemented from ilMDBase.

Definition at line 194 of file class.ilMDRights.php.

195 {
196 $writer->xmlStartTag('Rights',array('Costs' => $this->getCosts(),
197 'CopyrightAndOtherRestrictions' => $this->getCopyrightAndOtherRestrictions()));
198 $writer->xmlElement('Description',array('Language' => $this->getDescriptionLanguageCode()),$this->getDescription());
199 $writer->xmlEndTag('Rights');
200 }

References getCopyrightAndOtherRestrictions(), getCosts(), getDescription(), and getDescriptionLanguageCode().

+ Here is the call graph for this function:

◆ update() [1/2]

ilMDRights::update ( )

Reimplemented from ilMDBase.

Definition at line 116 of file class.ilMDRights.php.

117 {
118 global $ilDB;
119
120 if($this->getMetaId())
121 {
122 if($this->db->update('il_meta_rights',
123 $this->__getFields(),
124 array("meta_rights_id" => array('integer',$this->getMetaId()))))
125 {
126 return true;
127 }
128 }
129 return false;
130 }

References $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDRights::update ( )

Reimplemented from ilMDBase.

Definition at line 114 of file class.ilMDRights.php.

115 {
116 global $ilDB;
117
118 if($this->getMetaId())
119 {
120 if($this->db->autoExecute('il_meta_rights',
121 $this->__getFields(),
122 DB_AUTOQUERY_UPDATE,
123 "meta_rights_id = ".$ilDB->quote($this->getMetaId())))
124 {
125 return true;
126 }
127 }
128 return false;
129 }

References $ilDB, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

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