ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilMDRights Class Reference
+ Inheritance diagram for ilMDRights:
+ Collaboration diagram for ilMDRights:

Public Member Functions

 setCosts ($a_costs)
 
 getCosts ()
 
 setCopyrightAndOtherRestrictions ($a_caor)
 
 getCopyrightAndOtherRestrictions ()
 
 setDescription ($a_description)
 
 getDescription ()
 
 setDescriptionLanguage (&$lng_obj)
 
getDescriptionLanguage ()
 
 getDescriptionLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
 parseDescriptionFromImport ($a_description)
 
 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
 __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 lookupRightsByTypeAndCopyright (array $a_types, array $a_copyright)
 
static _lookupDescription ($a_rbac_id, $a_obj_id)
 Lookup description (copyright) More...
 
static _getId ($a_rbac_id, $a_obj_id)
 

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

Member Function Documentation

◆ __getFields() [1/2]

ilMDRights::__getFields ( )

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

171 {
172 return array('rbac_id' => array('integer',$this->getRBACId()),
173 'obj_id' => array('integer',$this->getObjId()),
174 'obj_type' => array('text',$this->getObjType()),
175 'costs' => array('text',$this->getCosts()),
176 'cpr_and_or' => array('text',$this->getCopyrightAndOtherRestrictions()),
177 'description' => array('text',$this->getDescription()),
178 'description_language' => array('text',$this->getDescriptionLanguageCode()));
179 }
getCopyrightAndOtherRestrictions()

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 138 of file class.ilMDRights.php.

139 {
140 return array('rbac_id' => $this->getRBACId(),
141 'obj_id' => $this->getObjId(),
142 'obj_type' => ilUtil::prepareDBString($this->getObjType()),
143 'costs' => ilUtil::prepareDBString($this->getCosts()),
144 'copyright_and_other_restrictions' => ilUtil::prepareDBString($this->getCopyrightAndOtherRestrictions()),
145 'description' => ilUtil::prepareDBString($this->getDescription()),
146 'description_language' => ilUtil::prepareDBString($this->getDescriptionLanguageCode()));
147 }
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]

static ilMDRights::_getId (   $a_rbac_id,
  $a_obj_id 
)
static

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

274 {
275 global $DIC;
276
277 $ilDB = $DIC['ilDB'];
278
279 $query = "SELECT meta_rights_id FROM il_meta_rights " .
280 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
281 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
282
283 $res = $ilDB->query($query);
284 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
285 return $row->meta_rights_id;
286 }
287 return false;
288 }
$query
foreach($_POST as $key=> $value) $res
global $ilDB
$DIC
Definition: xapitoken.php:46

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilMD\getRights(), and ilMDKeywordExposer\getRights().

+ Here is the caller graph for this function:

◆ _getId() [2/2]

ilMDRights::_getId (   $a_rbac_id,
  $a_obj_id 
)

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

191 {
192 global $ilDB;
193
194 $query = "SELECT meta_rights_id FROM il_meta_rights " .
195 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id) . " " .
196 "AND obj_id = " . $ilDB->quote($a_obj_id);
197
198 $res = $ilDB->query($query);
199 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
200 return $row->meta_rights_id;
201 }
202 return false;
203 }

References $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

◆ _lookupDescription()

static ilMDRights::_lookupDescription (   $a_rbac_id,
  $a_obj_id 
)
static

Lookup description (copyright)

@access public

Parameters
intrbac_id
intobj_id

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

259 {
260 global $DIC;
261
262 $ilDB = $DIC['ilDB'];
263
264 $query = "SELECT description FROM il_meta_rights " .
265 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
266 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
267 $res = $ilDB->query($query);
268 $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
269 return $row->description ? $row->description : '';
270 }

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilOerHarvester\deleteDeprecated(), ilMDCopyrightSelectionGUI\fillTemplate(), and ilMDEditorGUI\listQuickEditCopyright().

+ Here is the caller graph for this function:

◆ delete() [1/2]

ilMDRights::delete ( )

Reimplemented from ilMDBase.

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

153 {
154 global $DIC;
155
156 $ilDB = $DIC['ilDB'];
157
158 if ($this->getMetaId()) {
159 $query = "DELETE FROM il_meta_rights " .
160 "WHERE meta_rights_id = " . $ilDB->quote($this->getMetaId(), 'integer');
161
162 $this->db->query($query);
163
164 return true;
165 }
166 return false;
167 }

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

+ Here is the call graph for this function:

◆ delete() [2/2]

ilMDRights::delete ( )

Reimplemented from ilMDBase.

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

123 {
124 global $ilDB;
125
126 if ($this->getMetaId()) {
127 $query = "DELETE FROM il_meta_rights " .
128 "WHERE meta_rights_id = " . $ilDB->quote($this->getMetaId());
129
130 $this->db->query($query);
131
132 return true;
133 }
134 return false;
135 }

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

+ Here is the call graph for this function:

◆ getCopyrightAndOtherRestrictions() [1/2]

ilMDRights::getCopyrightAndOtherRestrictions ( )

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

92 {
93 return $this->caor;
94 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getCopyrightAndOtherRestrictions() [2/2]

ilMDRights::getCopyrightAndOtherRestrictions ( )

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

65 {
66 return $this->caor;
67 }

◆ getCosts() [1/2]

ilMDRights::getCosts ( )

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

76 {
77 return $this->costs;
78 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getCosts() [2/2]

ilMDRights::getCosts ( )

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

49 {
50 return $this->costs;
51 }

◆ getDescription() [1/2]

ilMDRights::getDescription ( )

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

100 {
101 return $this->description;
102 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDescription() [2/2]

ilMDRights::getDescription ( )

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

73 {
74 return $this->description;
75 }

◆ getDescriptionLanguage() [1/2]

& ilMDRights::getDescriptionLanguage ( )

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

110 {
111 return is_object($this->description_language) ? $this->description_language : false;
112 }

◆ getDescriptionLanguage() [2/2]

& ilMDRights::getDescriptionLanguage ( )

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

83 {
84 return is_object($this->description_language) ? $this->description_language : false;
85 }

◆ getDescriptionLanguageCode() [1/2]

ilMDRights::getDescriptionLanguageCode ( )

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

114 {
115 return is_object($this->description_language) ? $this->description_language->getLanguageCode() : false;
116 }

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDescriptionLanguageCode() [2/2]

ilMDRights::getDescriptionLanguageCode ( )

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

87 {
88 return is_object($this->description_language) ? $this->description_language->getLanguageCode() : false;
89 }

◆ lookupRightsByTypeAndCopyright()

static ilMDRights::lookupRightsByTypeAndCopyright ( array  $a_types,
array  $a_copyright 
)
static
Parameters
string[]$a_types
string[]$a_copyright
Returns
int[]

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

41 {
42 global $DIC;
43
44 $db = $DIC->database();
45
46 $query = 'SELECT rbac_id FROM il_meta_rights ' .
47 'WHERE ' . $db->in('obj_type', $a_types, false, 'text') . ' ' .
48 'AND ' . $db->in('description', $a_copyright, false, 'text');
49 $res = $db->query($query);
50
52
53 $obj_ids = [];
54 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
55 $obj_ids[] = $row->rbac_id;
56 }
57 return $obj_ids;
58 }
static getLogger($a_component_id)
Get component logger.

References $DIC, $query, $res, ilDBConstants\FETCHMODE_OBJECT, and ilLoggerFactory\getLogger().

Referenced by ilOerHarvester\collect().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseDescriptionFromImport()

ilMDRights::parseDescriptionFromImport (   $a_description)
Parameters
$a_description
Exceptions
ilDatabaseException

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

241 {
242 $entry_id = ilMDCopyrightSelectionEntry::lookupCopyrightByText($a_description);
243 if (!$entry_id) {
244 $this->setDescription($a_description);
245 } else {
247 }
248 }
static createIdentifier($a_entry_id)
Create identifier for entry id.
setDescription($a_description)

References ilMDCopyrightSelectionEntry\createIdentifier(), ilMDCopyrightSelectionEntry\lookupCopyrightByText(), and setDescription().

+ Here is the call graph for this function:

◆ read() [1/2]

ilMDRights::read ( )

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

182 {
183 global $DIC;
184
185 $ilDB = $DIC['ilDB'];
186
187 include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
188
189
190 if ($this->getMetaId()) {
191 $query = "SELECT * FROM il_meta_rights " .
192 "WHERE meta_rights_id = " . $ilDB->quote($this->getMetaId(), 'integer');
193
194
195 $res = $this->db->query($query);
196 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
197 $this->setRBACId($row->rbac_id);
198 $this->setObjId($row->obj_id);
199 $this->setObjType($row->obj_type);
200 $this->setDescription($row->description);
201 $this->setDescriptionLanguage(new ilMDLanguageItem($row->description_language));
202 $this->setCosts($row->costs);
203 $this->setCopyrightAndOtherRestrictions($row->cpr_and_or);
204 }
205 return true;
206 }
207 return false;
208 }
setObjId($a_id)
setObjType($a_type)
setRBACId($a_id)
setCosts($a_costs)
setDescriptionLanguage(&$lng_obj)
setCopyrightAndOtherRestrictions($a_caor)

References $DIC, $ilDB, $query, $res, ilDBConstants\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 149 of file class.ilMDRights.php.

150 {
151 global $ilDB;
152
153 include_once 'Services/Migration/DBUpdate_426/classes/class.ilMDLanguageItem.php';
154
155
156 if ($this->getMetaId()) {
157 $query = "SELECT * FROM il_meta_rights " .
158 "WHERE meta_rights_id = " . $ilDB->quote($this->getMetaId());
159
160
161 $res = $this->db->query($query);
162 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
163 $this->setRBACId($row->rbac_id);
164 $this->setObjId($row->obj_id);
165 $this->setObjType($row->obj_type);
166 $this->setDescription(ilUtil::stripSlashes($row->description));
167 $this->setDescriptionLanguage(new ilMDLanguageItem($row->description_language));
168 $this->setCosts(ilUtil::stripSlashes($row->costs));
169 $this->setCopyrightAndOtherRestrictions(ilUtil::stripSlashes($row->copyright_and_other_restrictions));
170 }
171 return true;
172 }
173 return false;
174 }
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled

References $ilDB, $query, $res, ilDBConstants\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 118 of file class.ilMDRights.php.

119 {
120 global $DIC;
121
122 $ilDB = $DIC['ilDB'];
123
124 $fields = $this->__getFields();
125 $fields['meta_rights_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_rights'));
126
127 if ($this->db->insert('il_meta_rights', $fields)) {
128 $this->setMetaId($next_id);
129 return $this->getMetaId();
130 }
131 return false;
132 }
setMetaId($a_meta_id, $a_read_data=true)

References $DIC, $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 91 of file class.ilMDRights.php.

92 {
93 if ($this->db->autoExecute(
94 'il_meta_rights',
95 $this->__getFields(),
97 )) {
98 $this->setMetaId($this->db->getLastInsertId());
99
100 return $this->getMetaId();
101 }
102 return false;
103 }

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

+ Here is the call graph for this function:

◆ setCopyrightAndOtherRestrictions() [1/2]

ilMDRights::setCopyrightAndOtherRestrictions (   $a_caor)

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

80 {
81 switch ($a_caor) {
82 case 'Yes':
83 case 'No':
84 $this->caor = $a_caor;
85 return true;
86
87 default:
88 return false;
89 }
90 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCopyrightAndOtherRestrictions() [2/2]

ilMDRights::setCopyrightAndOtherRestrictions (   $a_caor)

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

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 }

◆ setCosts() [1/2]

ilMDRights::setCosts (   $a_costs)

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

64 {
65 switch ($a_costs) {
66 case 'Yes':
67 case 'No':
68 $this->costs = $a_costs;
69 return true;
70
71 default:
72 return false;
73 }
74 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCosts() [2/2]

ilMDRights::setCosts (   $a_costs)

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

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 }

◆ setDescription() [1/2]

ilMDRights::setDescription (   $a_description)

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

96 {
97 $this->description = $a_description;
98 }

Referenced by parseDescriptionFromImport(), and read().

+ Here is the caller graph for this function:

◆ setDescription() [2/2]

ilMDRights::setDescription (   $a_description)

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

69 {
70 $this->description = $a_description;
71 }

◆ setDescriptionLanguage() [1/2]

ilMDRights::setDescriptionLanguage ( $lng_obj)

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

104 {
105 if (is_object($lng_obj)) {
106 $this->description_language = $lng_obj;
107 }
108 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescriptionLanguage() [2/2]

ilMDRights::setDescriptionLanguage ( $lng_obj)

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

77 {
78 if (is_object($lng_obj)) {
79 $this->description_language = $lng_obj;
80 }
81 }

◆ toXML() [1/2]

ilMDRights::toXML ( $writer)

Reimplemented from ilMDBase.

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

216 {
217 $writer->xmlStartTag('Rights', array('Cost' => $this->getCosts()
218 ? $this->getCosts()
219 : 'No',
220 'CopyrightAndOtherRestrictions' => $this->getCopyrightAndOtherRestrictions()
222 : 'No'));
223 include_once './Services/MetaData/classes/class.ilMDCopyrightSelectionEntry.php';
224 $writer->xmlElement(
225 'Description',
226 [
227 'Language' => $this->getDescriptionLanguageCode()
229 : 'en'
230 ],
232 );
233 $writer->xmlEndTag('Rights');
234 }
static _lookupCopyright($a_cp_string)
lookup copyright by entry id

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

+ Here is the call graph for this function:

◆ toXML() [2/2]

ilMDRights::toXML ( $writer)

Reimplemented from ilMDBase.

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

182 {
183 $writer->xmlStartTag('Rights', array('Costs' => $this->getCosts(),
184 'CopyrightAndOtherRestrictions' => $this->getCopyrightAndOtherRestrictions()));
185 $writer->xmlElement('Description', array('Language' => $this->getDescriptionLanguageCode()), $this->getDescription());
186 $writer->xmlEndTag('Rights');
187 }

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 134 of file class.ilMDRights.php.

135 {
136 global $DIC;
137
138 $ilDB = $DIC['ilDB'];
139
140 if ($this->getMetaId()) {
141 if ($this->db->update(
142 'il_meta_rights',
143 $this->__getFields(),
144 array("meta_rights_id" => array('integer',$this->getMetaId()))
145 )) {
146 return true;
147 }
148 }
149 return false;
150 }

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

+ Here is the call graph for this function:

◆ update() [2/2]

ilMDRights::update ( )

Reimplemented from ilMDBase.

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

106 {
107 global $ilDB;
108
109 if ($this->getMetaId()) {
110 if ($this->db->autoExecute(
111 'il_meta_rights',
112 $this->__getFields(),
114 "meta_rights_id = " . $ilDB->quote($this->getMetaId())
115 )) {
116 return true;
117 }
118 }
119 return false;
120 }

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

+ Here is the call graph for this function:

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