ILIAS  release_8 Revision v8.24
class.ObjectDBRepository.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22
24
31{
32 public const DATA_TABLE_NAME = 'style_data';
33
34 protected ilDBInterface $db;
35
36 public function __construct(ilDBInterface $db)
37 {
38 $this->db = $db;
39 }
40
47 public function getOwnedStyles(array $owner_obj_ids): array
48 {
49 $db = $this->db;
50
51 $set = $db->queryF(
52 "SELECT * FROM style_usage su JOIN style_data sd " .
53 " ON (su.style_id = sd.id AND su.obj_id = sd.owner_obj) " .
54 " WHERE " . $db->in("su.obj_id", $owner_obj_ids, false, "integer"),
55 [],
56 []
57 );
58
59 $owned = [];
60 while ($rec = $db->fetchAssoc($set)) {
61 $owned[(int) $rec["owner_obj"]] = (int) $rec["style_id"];
62 }
63 return $owned;
64 }
65
66 // is a style owned by an object?
67 public function isOwned(int $obj_id, int $style_id): bool
68 {
69 $db = $this->db;
70
71 $set = $db->queryF(
72 "SELECT * FROM style_data " .
73 " WHERE id = %s AND owner_obj = %s",
74 ["integer", "integer"],
75 [$style_id, $obj_id]
76 );
77
78 if ($db->fetchAssoc($set)) {
79 return true;
80 }
81 return false;
82 }
83}
This repo stores infos on repository objects that are using booking managers as a service (resource m...
getOwnedStyles(array $owner_obj_ids)
For an array of object IDs (objects using styles) get back their owned styles (if any),...
Interface ilDBInterface.
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)
in(string $field, array $values, bool $negate=false, string $type="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...