ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
◀ 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
$DIC
;
94
95
$ilDB
= $DIC[
'ilDB'
];
96
97
$fields = $this->
__getFields
();
98
$fields[
'meta_rights_id'
] = array(
'integer'
,$next_id =
$ilDB
->nextId(
'il_meta_rights'
));
99
100
if
($this->db->insert(
'il_meta_rights'
, $fields)) {
101
$this->
setMetaId
($next_id);
102
return
$this->
getMetaId
();
103
}
104
return
false
;
105
}
106
107
public
function
update
()
108
{
109
global
$DIC
;
110
111
$ilDB
= $DIC[
'ilDB'
];
112
113
if
($this->
getMetaId
()) {
114
if
($this->db->update(
115
'il_meta_rights'
,
116
$this->__getFields(),
117
array(
"meta_rights_id"
=> array(
'integer'
,$this->
getMetaId
()))
118
)) {
119
return
true
;
120
}
121
}
122
return
false
;
123
}
124
125
public
function
delete
()
126
{
127
global
$DIC
;
128
129
$ilDB
= $DIC[
'ilDB'
];
130
131
if
($this->
getMetaId
()) {
132
$query
=
"DELETE FROM il_meta_rights "
.
133
"WHERE meta_rights_id = "
.
$ilDB
->quote($this->
getMetaId
(),
'integer'
);
134
135
$this->db->query(
$query
);
136
137
return
true
;
138
}
139
return
false
;
140
}
141
142
143
public
function
__getFields
()
144
{
145
return
array(
'rbac_id'
=> array(
'integer'
,$this->
getRBACId
()),
146
'obj_id'
=> array(
'integer'
,$this->
getObjId
()),
147
'obj_type'
=> array(
'text'
,$this->
getObjType
()),
148
'costs'
=> array(
'text'
,$this->
getCosts
()),
149
'cpr_and_or'
=> array(
'text'
,$this->
getCopyrightAndOtherRestrictions
()),
150
'description'
=> array(
'text'
,$this->
getDescription
()),
151
'description_language'
=> array(
'text'
,$this->
getDescriptionLanguageCode
()));
152
}
153
154
public
function
read
()
155
{
156
global
$DIC
;
157
158
$ilDB
= $DIC[
'ilDB'
];
159
160
include_once
'Services/Migration/DBUpdate_5295/classes/class.ilMDLanguageItem.php'
;
161
162
163
if
($this->
getMetaId
()) {
164
$query
=
"SELECT * FROM il_meta_rights "
.
165
"WHERE meta_rights_id = "
.
$ilDB
->quote($this->
getMetaId
(),
'integer'
);
166
167
168
$res
= $this->db->query(
$query
);
169
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
170
$this->
setRBACId
(
$row
->rbac_id);
171
$this->
setObjId
(
$row
->obj_id);
172
$this->
setObjType
(
$row
->obj_type);
173
$this->
setDescription
(
$row
->description);
174
$this->
setDescriptionLanguage
(
new
ilMDLanguageItem
(
$row
->description_language));
175
$this->
setCosts
(
$row
->costs);
176
$this->
setCopyrightAndOtherRestrictions
(
$row
->cpr_and_or);
177
}
178
return
true
;
179
}
180
return
false
;
181
}
182
183
/*
184
* XML Export of all meta data
185
* @param object (xml writer) see class.ilMD2XML.php
186
*
187
*/
188
public
function
toXML
(&$writer)
189
{
190
$writer->xmlStartTag(
'Rights'
, array(
'Cost'
=> $this->
getCosts
()
191
? $this->
getCosts
()
192
:
'No'
,
193
'CopyrightAndOtherRestrictions'
=> $this->
getCopyrightAndOtherRestrictions
()
194
? $this->
getCopyrightAndOtherRestrictions
()
195
:
'No'
));
196
include_once
'./Services/Migration/DBUpdate_5295/classes/class.ilMDCopyrightSelectionEntry.php'
;
197
$writer->xmlElement(
198
'Description'
,
199
array(
'Language'
=> $this->
getDescriptionLanguageCode
()
200
? $this->
getDescriptionLanguageCode
()
201
:
'en'
),
202
ilMDCopyrightSelectionEntry::lookupCopyyrightTitle
($this->
getDescription
())
203
);
204
$writer->xmlEndTag(
'Rights'
);
205
}
206
215
public
static
function
_lookupDescription
($a_rbac_id, $a_obj_id)
216
{
217
global
$DIC
;
218
219
$ilDB
= $DIC[
'ilDB'
];
220
221
$query
=
"SELECT description FROM il_meta_rights "
.
222
"WHERE rbac_id = "
.
$ilDB
->quote($a_rbac_id,
'integer'
) .
" "
.
223
"AND obj_id = "
.
$ilDB
->quote($a_obj_id,
'integer'
) .
" "
;
224
$res
=
$ilDB
->query(
$query
);
225
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
);
226
return
$row
->description ?
$row
->description :
''
;
227
}
228
229
// STATIC
230
public
static
function
_getId
($a_rbac_id, $a_obj_id)
231
{
232
global
$DIC
;
233
234
$ilDB
= $DIC[
'ilDB'
];
235
236
$query
=
"SELECT meta_rights_id FROM il_meta_rights "
.
237
"WHERE rbac_id = "
.
$ilDB
->quote($a_rbac_id,
'integer'
) .
" "
.
238
"AND obj_id = "
.
$ilDB
->quote($a_obj_id,
'integer'
);
239
240
$res
=
$ilDB
->query(
$query
);
241
while
(
$row
=
$res
->fetchRow(
ilDBConstants::FETCHMODE_OBJECT
)) {
242
return
$row
->meta_rights_id;
243
}
244
return
false
;
245
}
246
}
ilMDBase\setObjType
setObjType($a_type)
Definition:
class.ilMDBase.php:109
ilMDRights\update
update()
Definition:
class.ilMDRights.php:107
$description
$description
Definition:
no_cookie.tpl.php:7
ilMDRights\read
read()
Definition:
class.ilMDRights.php:154
ilMDRights
Definition:
class.ilMDRights.php:33
ilMDRights\setCosts
setCosts($a_costs)
Definition:
class.ilMDRights.php:36
$DIC
global $DIC
Definition:
saml.php:7
ilMDRights\__getFields
__getFields()
Definition:
class.ilMDRights.php:170
ilMDRights\_getId
static _getId($a_rbac_id, $a_obj_id)
Definition:
class.ilMDRights.php:230
ilMDBase\getRBACId
getRBACId()
Definition:
class.ilMDBase.php:97
ilMDRights\getCosts
getCosts()
Definition:
class.ilMDRights.php:48
ilMDRights\toXML
toXML(&$writer)
Definition:
class.ilMDRights.php:188
ilMDRights\getDescriptionLanguageCode
getDescriptionLanguageCode()
Definition:
class.ilMDRights.php:86
ilMDRights\getDescriptionLanguage
& getDescriptionLanguage()
Definition:
class.ilMDRights.php:82
ilMDRights\save
save()
Definition:
class.ilMDRights.php:91
ilMDRights\setDescriptionLanguage
setDescriptionLanguage(&$lng_obj)
Definition:
class.ilMDRights.php:76
ilMDRights\_lookupDescription
static _lookupDescription($a_rbac_id, $a_obj_id)
Lookup description (copyright)
Definition:
class.ilMDRights.php:215
ilMDBase\setMetaId
setMetaId($a_meta_id, $a_read_data=true)
Definition:
class.ilMDBase.php:117
$res
foreach($_POST as $key=> $value) $res
Definition:
save_question_post_data.php:15
ilMDLanguageItem
Definition:
class.ilMDLanguageItem.php:32
ilMDRights\setCopyrightAndOtherRestrictions
setCopyrightAndOtherRestrictions($a_caor)
Definition:
class.ilMDRights.php:52
ilMDBase\setObjId
setObjId($a_id)
Definition:
class.ilMDBase.php:101
ilMDBase\setRBACId
setRBACId($a_id)
Definition:
class.ilMDBase.php:93
ilMDRights\getCopyrightAndOtherRestrictions
getCopyrightAndOtherRestrictions()
Definition:
class.ilMDRights.php:64
$query
$query
Definition:
proxy_ylocal.php:13
$row
$row
Definition:
migrateto20.php:360
ilMDBase\getMetaId
getMetaId()
Definition:
class.ilMDBase.php:125
ilMDBase\getObjId
getObjId()
Definition:
class.ilMDBase.php:105
$ilDB
global $ilDB
Definition:
storeScorm2004.php:16
ilMDCopyrightSelectionEntry\lookupCopyyrightTitle
static lookupCopyyrightTitle($a_cp_string)
Lookup copyright title.
Definition:
class.ilMDCopyrightSelectionEntry.php:104
ilMDRights\setDescription
setDescription($a_description)
Definition:
class.ilMDRights.php:68
php
ilMDBase\getObjType
getObjType()
Definition:
class.ilMDBase.php:113
ilDBConstants\FETCHMODE_OBJECT
const FETCHMODE_OBJECT
Definition:
class.ilDBConstants.php:13
ilMDBase
Definition:
class.ilMDBase.php:32
ilMDRights\getDescription
getDescription()
Definition:
class.ilMDRights.php:72
Services
Migration
DBUpdate_5295
classes
class.ilMDRights.php
Generated on Thu Jan 16 2025 19:02:26 for ILIAS by
1.8.13 (using
Doxyfile
)