22use ILIAS\GlobalScreen\Scope\MainMenu\Collector\Renderer\Hasher;
48 $collector->collectOnce();
55 if ($this->
has($item->getProviderIdentification()->serialize())) {
61 $item->getProviderIdentification()->serialize(),
65 $item->getParentIdentification()->serialize(),
66 $item instanceof hasAction ? (
string) $item->getAction() :
'',
67 $item instanceof hasAction ? $item->mustOpenInNewViewport() :
false,
78 $this->db->query(
'SELECT * FROM ' . self::TABLE_NAME .
' WHERE type != 1 ORDER BY position ASC')
81 $entry = $this->fromDB($row);
82 $this->cache[$entry->getId()] = $entry;
91 $row[
'is_active'] === 1,
92 (
int) $row[
'position'],
93 (
string) ($row[
'parent'] ??
''),
94 (
string) ($row[
'action'] ??
''),
95 (
bool) $row[
'external'],
100 public function get(
string $identifier): ?
Entry
102 if (isset($this->cache[$identifier]) && $this->
has($identifier)) {
103 return $this->cache[$identifier];
106 $row = $this->db->queryF(
107 'SELECT * FROM ' . self::TABLE_NAME .
' WHERE id = %s AND type != 1',
114 return $this->fromDB($row);
117 public function has(
string $identifier): bool
119 return $this->db->queryF(
120 'SELECT id FROM ' . self::TABLE_NAME .
' WHERE id = %s AND type != 1',
128 return new EntryDTO(
'',
'',
true, 0,
'',
false);
133 if ($entry->
getId() ===
'' || !$this->has($entry->
getId())) {
134 return $this->create($entry);
137 return $this->update($entry);
142 if ($this->provider ===
null) {
143 throw new \LogicException(
'No provider set');
146 if ($entry->
getId() ===
'') {
147 $entry = $entry->
withId($this->provider->getNewIdentification()->serialize());
152 'id' => [
'text', $entry->
getId()],
153 'type' => [
'integer', 2],
154 'title' => [
'text', $entry->
getTitle()],
156 'is_active' => [
'integer', $entry->
isActive() ? 1 : 0],
157 'parent' => [
'text', $entry->
getParent()],
158 'action' => [
'text', $entry->
getAction()],
159 'external' => [
'integer', $entry->
isExternal() ? 1 : 0],
160 'core' => [
'integer', $entry->
isCore() ? 1 : 0],
171 'title' => [
'text', $entry->
getTitle()],
173 'is_active' => [
'integer', $entry->
isActive() ? 1 : 0],
174 'parent' => [
'text', $entry->
getParent()],
175 'action' => [
'text', $entry->
getAction()],
176 'external' => [
'integer', $entry->
isExternal() ? 1 : 0],
177 'core' => [
'integer', $entry->
isCore() ? 1 : 0],
179 [
'id' => [
'text', $entry->
getId()]]
184 public function delete(
Entry $entry):
void
186 if ($entry->isCore()) {
190 $this->db->manipulateF(
191 'DELETE FROM ' . self::TABLE_NAME .
' WHERE id = %s',
200 public function all(): \Generator
203 yield
from $this->cache;
209 foreach ($this->cache as $entry) {
210 if ($entry->getParent() === $parent_identifier) {
220 [
'position' => [
'integer', $position]],
221 [
'id' => [
'text',
$id]]
232 $this->db->manipulate(
'DELETE FROM ' . self::TABLE_NAME .
' WHERE type != 1');
233 $this->syncWithGlobalScreen($collector);
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins