19 declare(strict_types=1);
51 $db = $DIC->database();
53 $query =
'SELECT rbac_id FROM il_meta_rights ' .
54 'WHERE ' .
$db->
in(
'obj_type', $a_types,
false,
'text') .
' ' .
55 'AND ' .
$db->
in(
'description', $a_copyright,
false,
'text');
62 $obj_ids[] = (
int) $row->rbac_id;
68 public function setCosts(
string $a_costs): bool
73 $this->costs = $a_costs;
91 $this->caor = $a_caor;
106 $this->description = $a_description;
116 $this->description_language = $lng_obj;
121 return is_object($this->description_language) ? $this->description_language :
null;
126 return is_object($this->description_language) ? $this->description_language->getLanguageCode() :
'';
132 $fields[
'meta_rights_id'] = array(
'integer', $next_id = $this->db->nextId(
'il_meta_rights'));
134 if ($this->db->insert(
'il_meta_rights', $fields)) {
143 return $this->
getMetaId() && $this->db->update(
146 array(
"meta_rights_id" => array(
'integer', $this->
getMetaId()))
150 public function delete():
bool 153 $query =
"DELETE FROM il_meta_rights " .
154 "WHERE meta_rights_id = " . $this->db->quote($this->
getMetaId(),
'integer');
156 $this->db->query($query);
171 $costs = (string) array_search(
173 self::YES_NO_TRANSLATION
175 $cpr_and_or = (string) array_search(
177 self::YES_NO_TRANSLATION
181 'rbac_id' => array(
'integer', $this->
getRBACId()),
182 'obj_id' => array(
'integer', $this->
getObjId()),
183 'obj_type' => array(
'text', $this->
getObjType()),
184 'costs' => array(
'text', $costs),
185 'cpr_and_or' => array(
'text', $cpr_and_or),
194 $query =
"SELECT * FROM il_meta_rights " .
195 "WHERE meta_rights_id = " . $this->db->quote($this->
getMetaId(),
'integer');
197 $res = $this->db->query($query);
202 if (key_exists($row->costs ??
'', self::YES_NO_TRANSLATION)) {
203 $row->costs = self::YES_NO_TRANSLATION[$row->costs ??
''];
205 if (key_exists($row->cpr_and_or ??
'', self::YES_NO_TRANSLATION)) {
206 $row->cpr_and_or = self::YES_NO_TRANSLATION[$row->cpr_and_or ??
''];
210 $this->
setObjId((
int) $row->obj_id);
225 'Cost' => $this->
getCosts() ?:
'No',
253 $ilDB = $DIC->database();
255 $query =
"SELECT description FROM il_meta_rights " .
256 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
257 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
261 if (isset($row) && isset($row->description)) {
262 return $row->description;
268 public static function _getId(
int $a_rbac_id,
int $a_obj_id):
int 272 $ilDB = $DIC->database();
274 $query =
"SELECT meta_rights_id FROM il_meta_rights " .
275 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
276 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer');
280 return (
int) $row->meta_rights_id;
static getLogger(string $a_component_id)
Get component logger.
static _lookupCopyrightForExport(string $a_cp_string)
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.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
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)