ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
class.ilMDRights.php
Go to the documentation of this file.
1
<?
php
2
/*
3
+-----------------------------------------------------------------------------+
4
| ILIAS open source |
5
+-----------------------------------------------------------------------------+
6
| Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7
| |
8
| This program is free software; you can redistribute it and/or |
9
| modify it under the terms of the GNU General Public License |
10
| as published by the Free Software Foundation; either version 2 |
11
| of the License, or (at your option) any later version. |
12
| |
13
| This program is distributed in the hope that it will be useful, |
14
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
| GNU General Public License for more details. |
17
| |
18
| You should have received a copy of the GNU General Public License |
19
| along with this program; if not, write to the Free Software |
20
| Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21
+-----------------------------------------------------------------------------+
22
*/
23
24
31
include_once
'class.ilMDBase.php'
;
32
33
class
ilMDRights
extends
ilMDBase
34
{
35
// SET/GET
36
public
function
setCosts
($a_costs)
37
{
38
switch
($a_costs) {
39
case
'Yes'
:
40
case
'No'
:
41
$this->costs = $a_costs;
42
return
true
;
43
44
default
:
45
return
false
;
46
}
47
}
48
public
function
getCosts
()
49
{
50
return
$this->costs;
51
}
52
public
function
setCopyrightAndOtherRestrictions
($a_caor)
53
{
54
switch
($a_caor) {
55
case
'Yes'
:
56
case
'No'
:
57
$this->caor = $a_caor;
58
return
true
;
59
60
default
:
61
return
false
;
62
}
63
}
64
public
function
getCopyrightAndOtherRestrictions
()
65
{
66
return
$this->caor;
67
}
68
public
function
setDescription
($a_description)
69
{
70
$this->description = $a_description;
71
}
72
public
function
getDescription
()
73
{
74
return
$this->description
;
75
}
76
public
function
setDescriptionLanguage
(&$lng_obj)
77
{
78
if
(is_object($lng_obj)) {
79
$this->description_language = $lng_obj;
80
}
81
}
82
public
function
&
getDescriptionLanguage
()
83
{
84
return
is_object($this->description_language) ? $this->description_language :
false
;
85
}
86
public
function
getDescriptionLanguageCode
()
87
{
88
return
is_object($this->description_language) ? $this->description_language->getLanguageCode() :
false
;
89
}
90
91
public
function
save
()
92
{
93
global
$ilDB
;
94
95
$fields = $this->
__getFields
();
96
$fields[
'meta_rights_id'
] = array(
'integer'
,$next_id =
$ilDB
->nextId(
'il_meta_rights'
));
97
98
if
($this->db->insert(
'il_meta_rights'
, $fields)) {
99
$this->
setMetaId
($next_id);
100
return
$this->
getMetaId
();
101
}
102
return
false
;
103
}
104
105
public
function
update
()
106
{
107
global
$ilDB
;
108
109
if
($this->
getMetaId
()) {
110
if
($this->db->update(
111
'il_meta_rights'
,
112
$this->__getFields(),
113
array(
"meta_rights_id"
=> array(
'integer'
,$this->
getMetaId
()))
114
)) {
115
return
true
;
116
}
117
}
118
return
false
;
119
}
120
121
public
function
delete
()
122
{
123
global
$ilDB
;
124
125
if
($this->
getMetaId
()) {
126
$query
=
"DELETE FROM il_meta_rights "
.
127
"WHERE meta_rights_id = "
. $ilDB->quote($this->
getMetaId
(),
'integer'
);
128
129
$this->db->query(
$query
);
130
131
return
true
;
132
}
133
return
false
;
134
}
135
136
137
public
function
__getFields
()
138
{
139
return
array(
'rbac_id'
=> array(
'integer'
,$this->
getRBACId
()),
140
'obj_id'
=> array(
'integer'
,$this->
getObjId
()),
141
'obj_type'
=> array(
'text'
,$this->
getObjType
()),
142
'costs'
=> array(
'text'
,$this->
getCosts
()),
143
'cpr_and_or'
=> array(
'text'
,$this->
getCopyrightAndOtherRestrictions
()),
144
'description'
=> array(
'text'
,$this->
getDescription
()),
145
'description_language'
=> array(
'text'
,$this->
getDescriptionLanguageCode
()));
146
}
147
148
public
function
read
()
149
{
150
global
$ilDB
;
151
152
include_once
'Services/MetaData/classes/class.ilMDLanguageItem.php'
;
153
154
155
if
($this->
getMetaId
()) {
156
$query
=
"SELECT * FROM il_meta_rights "
.
157
"WHERE meta_rights_id = "
. $ilDB->quote($this->
getMetaId
(),
'integer'
);
158
159
160
$res
= $this->db->query(
$query
);
161
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
162
$this->
setRBACId
(
$row
->rbac_id);
163
$this->
setObjId
(
$row
->obj_id);
164
$this->
setObjType
(
$row
->obj_type);
165
$this->
setDescription
(
$row
->description);
166
$this->
setDescriptionLanguage
(
new
ilMDLanguageItem
(
$row
->description_language));
167
$this->
setCosts
(
$row
->costs);
168
$this->
setCopyrightAndOtherRestrictions
(
$row
->cpr_and_or);
169
}
170
return
true
;
171
}
172
return
false
;
173
}
174
175
/*
176
* XML Export of all meta data
177
* @param object (xml writer) see class.ilMD2XML.php
178
*
179
*/
180
public
function
toXML
(&$writer)
181
{
182
$writer->xmlStartTag(
'Rights'
, array(
'Cost'
=> $this->
getCosts
()
183
? $this->
getCosts
()
184
:
'No'
,
185
'CopyrightAndOtherRestrictions'
=> $this->
getCopyrightAndOtherRestrictions
()
186
? $this->
getCopyrightAndOtherRestrictions
()
187
:
'No'
));
188
include_once
'./Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php'
;
189
$writer->xmlElement(
190
'Description'
,
191
array(
'Language'
=> $this->
getDescriptionLanguageCode
()
192
? $this->
getDescriptionLanguageCode
()
193
:
'en'
),
194
ilMDCopyrightSelectionEntry::lookupCopyyrightTitle
($this->
getDescription
())
195
);
196
$writer->xmlEndTag(
'Rights'
);
197
}
198
207
public
static
function
_lookupDescription
($a_rbac_id, $a_obj_id)
208
{
209
global
$ilDB
;
210
211
$query
=
"SELECT description FROM il_meta_rights "
.
212
"WHERE rbac_id = "
.
$ilDB
->quote($a_rbac_id,
'integer'
) .
" "
.
213
"AND obj_id = "
.
$ilDB
->quote($a_obj_id,
'integer'
) .
" "
;
214
$res
=
$ilDB
->query(
$query
);
215
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
);
216
return
$row
->description ?
$row
->description :
''
;
217
}
218
219
// STATIC
220
public
static
function
_getId
($a_rbac_id, $a_obj_id)
221
{
222
global
$ilDB
;
223
224
$query
=
"SELECT meta_rights_id FROM il_meta_rights "
.
225
"WHERE rbac_id = "
.
$ilDB
->quote($a_rbac_id,
'integer'
) .
" "
.
226
"AND obj_id = "
.
$ilDB
->quote($a_obj_id,
'integer'
);
227
228
$res
=
$ilDB
->query(
$query
);
229
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
230
return
$row
->meta_rights_id;
231
}
232
return
false
;
233
}
234
}
$row
$row
Definition:
10autofilter-selection-1.php:74
php
An exception for terminatinating execution or to throw for unit testing.
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
ilMDBase
Definition:
class.ilMDBase.php:33
ilMDBase\getObjType
getObjType()
Definition:
class.ilMDBase.php:111
ilMDBase\getMetaId
getMetaId()
Definition:
class.ilMDBase.php:123
ilMDBase\setObjId
setObjId($a_id)
Definition:
class.ilMDBase.php:99
ilMDBase\setMetaId
setMetaId($a_meta_id, $a_read_data=true)
Definition:
class.ilMDBase.php:115
ilMDBase\getRBACId
getRBACId()
Definition:
class.ilMDBase.php:95
ilMDBase\getObjId
getObjId()
Definition:
class.ilMDBase.php:103
ilMDBase\setObjType
setObjType($a_type)
Definition:
class.ilMDBase.php:107
ilMDBase\setRBACId
setRBACId($a_id)
Definition:
class.ilMDBase.php:91
ilMDCopyrightSelectionEntry\lookupCopyyrightTitle
static lookupCopyyrightTitle($a_cp_string)
Lookup copyright title.
Definition:
class.ilMDCopyrightSelectionEntry.php:88
ilMDLanguageItem
Definition:
class.ilMDLanguageItem.php:33
ilMDRights
Definition:
class.ilMDRights.php:34
ilMDRights\getCopyrightAndOtherRestrictions
getCopyrightAndOtherRestrictions()
Definition:
class.ilMDRights.php:64
ilMDRights\getDescriptionLanguage
& getDescriptionLanguage()
Definition:
class.ilMDRights.php:82
ilMDRights\save
save()
Definition:
class.ilMDRights.php:91
ilMDRights\__getFields
__getFields()
Definition:
class.ilMDRights.php:137
ilMDRights\setCosts
setCosts($a_costs)
Definition:
class.ilMDRights.php:36
ilMDRights\update
update()
Definition:
class.ilMDRights.php:105
ilMDRights\getDescriptionLanguageCode
getDescriptionLanguageCode()
Definition:
class.ilMDRights.php:86
ilMDRights\setDescription
setDescription($a_description)
Definition:
class.ilMDRights.php:68
ilMDRights\setDescriptionLanguage
setDescriptionLanguage(&$lng_obj)
Definition:
class.ilMDRights.php:76
ilMDRights\getCosts
getCosts()
Definition:
class.ilMDRights.php:48
ilMDRights\setCopyrightAndOtherRestrictions
setCopyrightAndOtherRestrictions($a_caor)
Definition:
class.ilMDRights.php:52
ilMDRights\toXML
toXML(&$writer)
Definition:
class.ilMDRights.php:180
ilMDRights\_getId
static _getId($a_rbac_id, $a_obj_id)
Definition:
class.ilMDRights.php:220
ilMDRights\_lookupDescription
static _lookupDescription($a_rbac_id, $a_obj_id)
Lookup description (copyright)
Definition:
class.ilMDRights.php:207
ilMDRights\read
read()
Definition:
class.ilMDRights.php:148
ilMDRights\getDescription
getDescription()
Definition:
class.ilMDRights.php:72
$description
$description
Definition:
no_cookie.tpl.php:7
$query
$query
Definition:
proxy_ylocal.php:13
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
$ilDB
global $ilDB
Definition:
storeScorm2004.php:19
Services
MetaData
classes
class.ilMDRights.php
Generated on Sat Oct 4 2025 19:01:20 for ILIAS by
1.9.4 (using
Doxyfile
)