ILIAS  release_8 Revision v8.24
ilMDRights Class Reference
+ Inheritance diagram for ilMDRights:
+ Collaboration diagram for ilMDRights:

Public Member Functions

 setCosts (string $a_costs)
 
 getCosts ()
 
 setCopyrightAndOtherRestrictions (string $a_caor)
 
 getCopyrightAndOtherRestrictions ()
 
 setDescription (string $a_description)
 
 getDescription ()
 
 setDescriptionLanguage (ilMDLanguageItem $lng_obj)
 
 getDescriptionLanguage ()
 
 getDescriptionLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (ilXmlWriter $writer)
 
 parseDescriptionFromImport (string $a_description)
 
- Public Member Functions inherited from ilMDBase
 __construct (int $a_rbac_id=0, int $a_obj_id=0, string $a_type='')
 constructor More...
 
 read ()
 
 setRBACId (int $a_id)
 
 getRBACId ()
 
 setObjId (int $a_id)
 
 getObjId ()
 
 setObjType (string $a_type)
 
 getObjType ()
 
 setMetaId (int $a_meta_id, bool $a_read_data=true)
 
 getMetaId ()
 
 setParentType (string $a_parent_type)
 
 getParentType ()
 
 setParentId (int $a_id)
 
 getParentId ()
 
 setExportMode (bool $a_export_mode=true)
 
 getExportMode ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (ilXmlWriter $writer)
 

Static Public Member Functions

static lookupRightsByTypeAndCopyright (array $a_types, array $a_copyright)
 
static _lookupDescription (int $a_rbac_id, int $a_obj_id)
 
static _getId (int $a_rbac_id, int $a_obj_id)
 

Private Attributes

string $costs = ''
 
string $caor = ''
 
string $description = ''
 
ilMDLanguageItem $description_language = null
 

Additional Inherited Members

- Protected Attributes inherited from ilMDBase
ilLogger $log
 
ilDBInterface $db
 

Detailed Description

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

Member Function Documentation

◆ __getFields()

ilMDRights::__getFields ( )
Returns
array<string, array<string, mixed>>

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

156 : array
157 {
158 return array(
159 'rbac_id' => array('integer', $this->getRBACId()),
160 'obj_id' => array('integer', $this->getObjId()),
161 'obj_type' => array('text', $this->getObjType()),
162 'costs' => array('text', $this->getCosts()),
163 'cpr_and_or' => array('text', $this->getCopyrightAndOtherRestrictions()),
164 'description' => array('text', $this->getDescription()),
165 'description_language' => array('text', $this->getDescriptionLanguageCode())
166 );
167 }
getCopyrightAndOtherRestrictions()

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

Referenced by save(), and update().

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

◆ _getId()

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

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

236 : int
237 {
238 global $DIC;
239
240 $ilDB = $DIC->database();
241
242 $query = "SELECT meta_rights_id FROM il_meta_rights " .
243 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
244 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
245
246 $res = $ilDB->query($query);
247 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
248 return (int) $row->meta_rights_id;
249 }
250 return 0;
251 }
global $DIC
Definition: feed.php:28
$res
Definition: ltiservices.php:69
$query

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

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

+ Here is the caller graph for this function:

◆ _lookupDescription()

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

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

217 : string
218 {
219 global $DIC;
220
221 $ilDB = $DIC->database();
222
223 $query = "SELECT description FROM il_meta_rights " .
224 "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
225 "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer') . " ";
226 $res = $ilDB->query($query);
227 $row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT);
228
229 if (isset($row) && isset($row->description)) {
230 return $row->description;
231 }
232 return '';
233 }

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()

ilMDRights::delete ( )

Reimplemented from ilMDBase.

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

140 : bool
141 {
142 if ($this->getMetaId()) {
143 $query = "DELETE FROM il_meta_rights " .
144 "WHERE meta_rights_id = " . $this->db->quote($this->getMetaId(), 'integer');
145
146 $this->db->query($query);
147
148 return true;
149 }
150 return false;
151 }

References $query, and ilMDBase\getMetaId().

+ Here is the call graph for this function:

◆ getCopyrightAndOtherRestrictions()

ilMDRights::getCopyrightAndOtherRestrictions ( )

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

89 : string
90 {
91 return $this->caor;
92 }

References $caor.

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getCosts()

ilMDRights::getCosts ( )

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

71 : string
72 {
73 return $this->costs;
74 }

References $costs.

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDescription()

ilMDRights::getDescription ( )

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

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

References $description.

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ getDescriptionLanguage()

ilMDRights::getDescriptionLanguage ( )

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

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

◆ getDescriptionLanguageCode()

ilMDRights::getDescriptionLanguageCode ( )

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

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

Referenced by __getFields(), and toXML().

+ Here is the caller graph for this function:

◆ lookupRightsByTypeAndCopyright()

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

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

37 : array
38 {
39 global $DIC;
40
41 $db = $DIC->database();
42
43 $query = 'SELECT rbac_id FROM il_meta_rights ' .
44 'WHERE ' . $db->in('obj_type', $a_types, false, 'text') . ' ' .
45 'AND ' . $db->in('description', $a_copyright, false, 'text');
46 $res = $db->query($query);
47
49
50 $obj_ids = [];
51 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
52 $obj_ids[] = (int) $row->rbac_id;
53 }
54 return $obj_ids;
55 }
static getLogger(string $a_component_id)
Get component logger.
ilDBInterface $db
query(string $query)
Run a (read-only) Query on the database.
in(string $field, array $values, bool $negate=false, string $type="")

References ilMDBase\$db, $DIC, $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilLoggerFactory\getLogger(), ilDBInterface\in(), ILIAS\Repository\int(), and ilDBInterface\query().

Referenced by ilOerHarvester\collect().

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

◆ parseDescriptionFromImport()

ilMDRights::parseDescriptionFromImport ( string  $a_description)

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

207 : void
208 {
210 if (!$entry_id) {
211 $this->setDescription($a_description);
212 } else {
214 }
215 }
static lookupCopyrightFromImport(string $copyright_text)
setDescription(string $a_description)

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

+ Here is the call graph for this function:

◆ read()

ilMDRights::read ( )

Reimplemented from ilMDBase.

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

169 : bool
170 {
171 if ($this->getMetaId()) {
172 $query = "SELECT * FROM il_meta_rights " .
173 "WHERE meta_rights_id = " . $this->db->quote($this->getMetaId(), 'integer');
174
175 $res = $this->db->query($query);
176 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
177 $this->setRBACId((int) $row->rbac_id);
178 $this->setObjId((int) $row->obj_id);
179 $this->setObjType((string) $row->obj_type);
180 $this->setDescription((string) $row->description);
181 $this->setDescriptionLanguage(new ilMDLanguageItem((string) $row->description_language));
182 $this->setCosts((string) $row->costs);
183 $this->setCopyrightAndOtherRestrictions((string) $row->cpr_and_or);
184 }
185 return true;
186 }
187 return false;
188 }
setObjType(string $a_type)
setObjId(int $a_id)
setRBACId(int $a_id)
setCosts(string $a_costs)
setCopyrightAndOtherRestrictions(string $a_caor)
setDescriptionLanguage(ilMDLanguageItem $lng_obj)

References $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:

◆ save()

ilMDRights::save ( )

Reimplemented from ilMDBase.

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

119 : int
120 {
121 $fields = $this->__getFields();
122 $fields['meta_rights_id'] = array('integer', $next_id = $this->db->nextId('il_meta_rights'));
123
124 if ($this->db->insert('il_meta_rights', $fields)) {
125 $this->setMetaId($next_id);
126 return $this->getMetaId();
127 }
128 return 0;
129 }
setMetaId(int $a_meta_id, bool $a_read_data=true)

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

+ Here is the call graph for this function:

◆ setCopyrightAndOtherRestrictions()

ilMDRights::setCopyrightAndOtherRestrictions ( string  $a_caor)

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

76 : bool
77 {
78 switch ($a_caor) {
79 case 'Yes':
80 case 'No':
81 $this->caor = $a_caor;
82 return true;
83
84 default:
85 return false;
86 }
87 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setCosts()

ilMDRights::setCosts ( string  $a_costs)

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

58 : bool
59 {
60 switch ($a_costs) {
61 case 'Yes':
62 case 'No':
63 $this->costs = $a_costs;
64 return true;
65
66 default:
67 return false;
68 }
69 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDescription()

ilMDRights::setDescription ( string  $a_description)

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

94 : void
95 {
96 $this->description = $a_description;
97 }

Referenced by parseDescriptionFromImport(), and read().

+ Here is the caller graph for this function:

◆ setDescriptionLanguage()

ilMDRights::setDescriptionLanguage ( ilMDLanguageItem  $lng_obj)

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

104 : void
105 {
106 $this->description_language = $lng_obj;
107 }

Referenced by read().

+ Here is the caller graph for this function:

◆ toXML()

ilMDRights::toXML ( ilXmlWriter  $writer)

Reimplemented from ilMDBase.

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

190 : void
191 {
192 $writer->xmlStartTag('Rights', array(
193 'Cost' => $this->getCosts() ?: 'No',
194 'CopyrightAndOtherRestrictions' => $this->getCopyrightAndOtherRestrictions() ?: 'No'
195 ));
196
197 $writer->xmlElement(
198 'Description',
199 [
200 'Language' => $this->getDescriptionLanguageCode() ?: 'en'
201 ],
203 );
204 $writer->xmlEndTag('Rights');
205 }
static _lookupCopyrightForExport(string $a_cp_string)
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.

References ilMDCopyrightSelectionEntry\_lookupCopyrightForExport(), getCopyrightAndOtherRestrictions(), getCosts(), getDescription(), getDescriptionLanguageCode(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

+ Here is the call graph for this function:

◆ update()

ilMDRights::update ( )

Reimplemented from ilMDBase.

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

131 : bool
132 {
133 return $this->getMetaId() && $this->db->update(
134 'il_meta_rights',
135 $this->__getFields(),
136 array("meta_rights_id" => array('integer', $this->getMetaId()))
137 );
138 }

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

+ Here is the call graph for this function:

Field Documentation

◆ $caor

string ilMDRights::$caor = ''
private

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

Referenced by getCopyrightAndOtherRestrictions().

◆ $costs

string ilMDRights::$costs = ''
private

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

Referenced by getCosts().

◆ $description

string ilMDRights::$description = ''
private

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

Referenced by getDescription().

◆ $description_language

ilMDLanguageItem ilMDRights::$description_language = null
private

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


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