23use ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher;
43 $collector->collectOnce();
47 if (!$item instanceof
isGroup) {
50 if ($this->
has($item->getProviderIdentification()->serialize())) {
55 $item->getProviderIdentification()->serialize(),
59 count($item->getEntries()),
63 $this->cache[$new->getId()] = $new;
76 'SELECT g.*, (SELECT COUNT(id) FROM gs_footer_items WHERE parent = g.id) AS items
77 FROM gs_footer_items AS g
79 ORDER BY g.position ASC'
83 $group = $this->fromDB($row);
84 $this->cache[$group->getId()] = $group;
94 $row[
'is_active'] === 1,
95 (
int) $row[
'position'],
96 (
int) ($row[
'items'] ?? 0),
101 public function get(
string $identifier): ?
Group
103 if (isset($this->cache[$identifier]) && $this->
has($identifier)) {
104 return $this->cache[$identifier];
107 $row = $this->db->queryF(
108 'SELECT g.*, (SELECT COUNT(id) FROM gs_footer_items WHERE parent = g.id) AS items
109 FROM gs_footer_items AS g
110 WHERE g.type = 1 AND g.id = %s
111 ORDER BY g.position ASC',
118 return $this->fromDB($row);
121 public function has(
string $identifier): bool
123 return $this->db->queryF(
124 'SELECT id FROM ' . self::TABLE_NAME .
' WHERE id = %s AND type = 1',
132 return new GroupDTO(
'',
'',
true, 0, 0,
false);
137 if ($group->
getId() ===
'' || !$this->has($group->
getId())) {
138 return $this->create($group);
141 return $this->update($group);
146 if ($this->provider ===
null) {
147 throw new \LogicException(
'No provider set');
149 if ($group->
getId() ===
'') {
150 $group = $group->
withId($this->provider->getNewIdentification()->serialize());
155 'id' => [
'text', $group->
getId()],
156 'type' => [
'inetger', 1],
157 'title' => [
'text', $group->
getTitle()],
159 'is_active' => [
'integer', $group->
isActive() ? 1 : 0],
160 'parent' => [
'text',
null],
161 'core' => [
'integer', $group->
isCore() ? 1 : 0],
172 'title' => [
'text', $group->
getTitle()],
174 'is_active' => [
'integer', $group->
isActive() ? 1 : 0],
175 'parent' => [
'text',
null],
176 'core' => [
'integer', $group->
isCore() ? 1 : 0],
178 [
'id' => [
'text', $group->
getId()]]
183 public function delete(
Group $group):
void
185 if ($group->isCore()) {
189 if ($group->getItems() > 0) {
193 $this->db->manipulateF(
194 'DELETE FROM ' . self::TABLE_NAME .
' WHERE id = %s',
203 public function all(): \Generator
205 if (!$this->loaded) {
208 yield
from $this->cache;
215 [
'position' => [
'integer', $position]],
216 [
'id' => [
'text',
$id]]
227 $this->db->manipulate(
'DELETE FROM ' . self::TABLE_NAME);
228 $this->syncWithGlobalScreen($collector);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins