19 declare(strict_types=1);
35 $this->catalog = $a_catalog;
43 public function setEntry(
string $a_entry): void
45 $this->entry = $a_entry;
56 $fields[
'meta_identifier_id'] = array(
'integer', $next_id = $this->db->nextId(
'il_meta_identifier'));
58 if ($this->db->insert(
'il_meta_identifier', $fields)) {
67 return $this->
getMetaId() && $this->db->update(
70 array(
"meta_identifier_id" => array(
'integer', $this->
getMetaId()))
74 public function delete():
bool 77 $query =
"DELETE FROM il_meta_identifier " .
78 "WHERE meta_identifier_id = " . $this->db->quote($this->
getMetaId(),
'integer');
79 $res = $this->db->manipulate($query);
91 'rbac_id' => array(
'integer', $this->
getRBACId()),
92 'obj_id' => array(
'integer', $this->
getObjId()),
93 'obj_type' => array(
'text', $this->
getObjType()),
95 'parent_id' => array(
'integer', $this->
getParentId()),
96 'catalog' => array(
'text', $this->
getCatalog()),
97 'entry' => array(
'text', $this->
getEntry())
104 $query =
"SELECT * FROM il_meta_identifier " .
105 "WHERE meta_identifier_id = " . $this->db->quote($this->
getMetaId(),
'integer');
107 $res = $this->db->query($query);
110 $this->
setObjId((
int) $row->obj_id);
123 $entry_default = ($this->
getObjId() === 0)
127 $entry = $this->
getEntry() ?: $entry_default;
131 $entry = $entry_default;
135 if ($catalog !==
'') {
137 'Catalog' => $catalog,
141 $writer->
xmlElement(
'Identifier', array(
'Entry' => $entry));
150 public static function _getIds(
int $a_rbac_id,
int $a_obj_id,
int $a_parent_id,
string $a_parent_type): array
154 $ilDB = $DIC->database();
156 $query =
"SELECT meta_identifier_id FROM il_meta_identifier " .
157 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
158 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" " .
159 "AND parent_id = " .
$ilDB->quote($a_parent_id,
'integer') .
" " .
160 "AND parent_type = " .
$ilDB->quote($a_parent_type,
'text');
165 $ids[] = (
int) $row->meta_identifier_id;
173 public static function _getEntriesForObj(
int $a_rbac_id,
int $a_obj_id,
string $a_obj_type): array
177 $ilDB = $DIC->database();
179 $query =
"SELECT meta_identifier_id, catalog, entry FROM il_meta_identifier " .
180 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
" " .
181 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" " .
182 "AND obj_type = " .
$ilDB->quote($a_obj_type,
'text');
187 $entries[
$r[
"meta_identifier_id"]] =
189 "catalog" => $r[
"catalog"],
190 "entry" => $r[
"entry"]
203 $ilDB = $DIC->database();
205 $query =
"SELECT meta_identifier_id, catalog, entry, obj_id FROM il_meta_identifier " .
206 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer');
208 if ($a_obj_type !==
"") {
210 " AND obj_type = " .
$ilDB->quote($a_obj_type,
'text');
216 $entries[
$r[
"meta_identifier_id"]] =
218 "catalog" => $r[
"catalog"],
219 "entry" => $r[
"entry"],
220 "obj_id" => $r[
"obj_id"]
234 $ilDB = $DIC->database();
236 $query =
"SELECT meta_identifier_id, obj_id FROM il_meta_identifier " .
237 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
238 " AND obj_type = " .
$ilDB->quote($a_obj_type,
'text') .
239 " AND catalog = " .
$ilDB->quote($a_catalog,
'text') .
240 " AND entry = " .
$ilDB->quote($a_entry,
'text');
241 $s =
$ilDB->query($query);
242 if (
$r =
$ilDB->fetchAssoc($s)) {
251 public static function readIdData(
int $a_rbac_id,
string $a_obj_type,
string $a_catalog,
string $a_entry): array
255 $ilDB = $DIC->database();
257 $query =
"SELECT * FROM il_meta_identifier " .
258 "WHERE rbac_id = " .
$ilDB->quote($a_rbac_id,
'integer') .
259 " AND obj_type = " .
$ilDB->quote($a_obj_type,
'text') .
260 " AND catalog = " .
$ilDB->quote($a_catalog,
'text') .
261 " AND entry = " .
$ilDB->quote($a_entry,
'text');
262 $s =
$ilDB->query($query);
264 while (
$r =
$ilDB->fetchAssoc($s)) {
static readIdData(int $a_rbac_id, string $a_obj_type, string $a_catalog, string $a_entry)
static existsIdInRbacObject(int $a_rbac_id, string $a_obj_type, string $a_catalog, string $a_entry)
toXML(ilXmlWriter $writer)
setEntry(string $a_entry)
static _getEntriesForObj(int $a_rbac_id, int $a_obj_id, string $a_obj_type)
static _getIds(int $a_rbac_id, int $a_obj_id, int $a_parent_id, string $a_parent_type)
setParentType(string $a_parent_type)
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 _getEntriesForRbacObj(int $a_rbac_id, string $a_obj_type="")
setObjType(string $a_type)
setCatalog(string $a_catalog)