19 declare(strict_types=1);
50 $db = $DIC->database();
52 $query =
'SELECT rbac_id FROM il_meta_rights ' .
53 'WHERE ' .
$db->
in(
'obj_type', $a_types,
false,
'text') .
' ' .
54 'AND ' .
$db->
in(
'description', $a_copyright,
false,
'text');
61 $obj_ids[] = (
int) $row->rbac_id;
67 public function setCosts(
string $a_costs): bool
72 $this->costs = $a_costs;
90 $this->caor = $a_caor;
105 $this->description = $a_description;
115 $this->description_language = $lng_obj;
120 return is_object($this->description_language) ? $this->description_language : null;
125 return is_object($this->description_language) ? $this->description_language->getLanguageCode() :
'';
131 $fields[
'meta_rights_id'] = array(
'integer', $next_id = $this->db->nextId(
'il_meta_rights'));
133 if ($this->db->insert(
'il_meta_rights', $fields)) {
142 return $this->
getMetaId() && $this->db->update(
145 array(
"meta_rights_id" => array(
'integer', $this->
getMetaId()))
149 public function delete():
bool 152 $query =
"DELETE FROM il_meta_rights " .
153 "WHERE meta_rights_id = " . $this->db->quote($this->
getMetaId(),
'integer');
155 $this->db->query($query);
170 $costs = (string) array_search(
172 self::YES_NO_TRANSLATION
174 $cpr_and_or = (string) array_search(
176 self::YES_NO_TRANSLATION
180 'rbac_id' => array(
'integer', $this->
getRBACId()),
181 'obj_id' => array(
'integer', $this->
getObjId()),
182 'obj_type' => array(
'text', $this->
getObjType()),
183 'costs' => array(
'text', $costs),
184 'cpr_and_or' => array(
'text', $cpr_and_or),
193 $query =
"SELECT * FROM il_meta_rights " .
194 "WHERE meta_rights_id = " . $this->db->quote($this->
getMetaId(),
'integer');
196 $res = $this->db->query($query);
201 if (key_exists($row->costs ??
'', self::YES_NO_TRANSLATION)) {
202 $row->costs = self::YES_NO_TRANSLATION[$row->costs ??
''];
204 if (key_exists($row->cpr_and_or ??
'', self::YES_NO_TRANSLATION)) {
205 $row->cpr_and_or = self::YES_NO_TRANSLATION[$row->cpr_and_or ??
''];
209 $this->
setObjId((
int) $row->obj_id);
224 'Cost' => $this->
getCosts() ?:
'No',
252 $ilDB = $DIC->database();
254 $query =
"SELECT description FROM il_meta_rights " .
255 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
256 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
260 if (isset($row) && isset($row->description)) {
261 return $row->description;
267 public static function _getId(
int $a_rbac_id,
int $a_obj_id):
int 271 $ilDB = $DIC->database();
273 $query =
"SELECT meta_rights_id FROM il_meta_rights " .
274 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
275 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer');
279 return (
int) $row->meta_rights_id;
static getLogger(string $a_component_id)
Get component logger.
static _lookupCopyrightForExport(string $a_cp_string)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupDescription(int $a_rbac_id, int $a_obj_id)
static _getId(int $a_rbac_id, int $a_obj_id)
toXML(ilXmlWriter $writer)
xmlEndTag(string $tag)
Writes an endtag.
getDescriptionLanguageCode()
setDescriptionLanguage(ilMDLanguageItem $lng_obj)
const YES_NO_TRANSLATION
Compatibility fix for legacy MD classes for new db tables.
parseDescriptionFromImport(string $a_description)
query(string $query)
Run a (read-only) Query on the database.
getCopyrightAndOtherRestrictions()
static lookupCopyrightFromImport(string $copyright_text)
in(string $field, array $values, bool $negate=false, string $type="")
ilMDLanguageItem $description_language
setCopyrightAndOtherRestrictions(string $a_caor)
setDescription(string $a_description)
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
setCosts(string $a_costs)
static createIdentifier(int $a_entry_id)
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
setMetaId(int $a_meta_id, bool $a_read_data=true)
static lookupRightsByTypeAndCopyright(array $a_types, array $a_copyright)
setObjType(string $a_type)