ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
StandardTopItemsProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
31
38{
40
42
44
46
48
50
52
54
55
59 public static function getInstance(): StandardTopItemsProvider
60 {
61 global $DIC;
62 if (!isset(self::$instance)) {
63 self::$instance = new self($DIC);
64 }
65
66 return self::$instance;
67 }
68
69
73 public function __construct(Container $dic)
74 {
76 $this->basic_access_helper = BasicAccessCheckClosuresSingleton::getInstance();
77 $this->repository_identification = $this->if->identifier('repository');
78 $this->personal_workspace_identification = $this->if->identifier('personal_workspace');
79 $this->achievements_identification = $this->if->identifier('achievements');
80 $this->communication_identification = $this->if->identifier('communication');
81 $this->organisation_identification = $this->if->identifier('organisation');
82 $this->administration_identification = $this->if->identifier('administration');
83 }
84
85
89 public function getStaticTopItems(): array
90 {
91 $f = (fn($id): string => $this->dic->language()->txt($id));
92
93 // Dashboard
94 $title = $this->dic->language()->txt("mm_dashboard");
95 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard(Standard::DSHS, $title);
96 $dashboard = $this->mainmenu->topLinkItem($this->if->identifier('mm_pd_crs_grp'))
97 ->withSymbol($icon)
98 ->withTitle($title)
99 ->withAction("ilias.php?baseClass=ilDashboardGUI&cmd=jumpToMemberships")
100 ->withPosition(10)
101 ->withNonAvailableReason($this->dic->ui()->factory()->legacy()->content("{$this->dic->language()->txt('component_not_active')}"))
103 fn(): true => true
104 )
106 $this->basic_access_helper->isUserLoggedIn()
107 );
108
109 $title = $f("mm_repository");
110 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard(Standard::REP, $title);
111
112 $repository = $this->mainmenu->topParentItem($this->getRepositoryIdentification())
113 ->withVisibilityCallable($this->basic_access_helper->isRepositoryReadable())
114 ->withSymbol($icon)
115 ->withTitle($title)
116 ->withPosition(20);
117
118 $title = $f("mm_personal_workspace");
119 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("standard/icon_wksp.svg"), $title);
120
121 $personal_workspace = $this->mainmenu->topParentItem($this->getPersonalWorkspaceIdentification())
122 ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
123 ->withSymbol($icon)
124 ->withTitle($title)
125 ->withPosition(30);
126
127 $title = $f("mm_achievements");
128 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("standard/icon_achv.svg"), $title);
129
130 $achievements = $this->mainmenu->topParentItem($this->getAchievementsIdentification())
131 ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
132 ->withSymbol($icon)
133 ->withTitle($title)
134 ->withPosition(40);
135
136 $title = $f("mm_communication");
137 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("standard/icon_comu.svg"), $title);
138
139 $communication = $this->mainmenu->topParentItem($this->getCommunicationIdentification())
140 ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
141 ->withSymbol($icon)
142 ->withTitle($title)
143 ->withPosition(50);
144
145 $title = $f("mm_organisation");
146 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("standard/icon_orga.svg"), $title);
147
148 $organisation = $this->mainmenu->topParentItem($this->getOrganisationIdentification())
149 ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
150 ->withSymbol($icon)
151 ->withTitle($title)
152 ->withPosition(60);
153
154 $title = $f("mm_administration");
155 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard("adm", $title);
156
157 $administration = $this->mainmenu->topParentItem($this->getAdministrationIdentification())
158 ->withSupportsAsynchronousLoading(false)
159 ->withAvailableCallable($this->basic_access_helper->isUserLoggedIn())
160 ->withSymbol($icon)
161 ->withTitle($title)
162 ->withPosition(70)
163 ->withVisibilityCallable($this->basic_access_helper->hasAdministrationAccess());
164
165 $dd_renderer = new TopParentItemDrilldownRenderer();
166 $ti = new TypeInformation($administration::class, $administration::class);
167 $ti->setRenderer($dd_renderer);
168 $administration = $administration->setTypeInformation($ti);
169
170
171 return [
172 $dashboard,
173 $repository,
174 $personal_workspace,
175 $achievements,
176 $communication,
177 $organisation,
178 $administration
179 ];
180 }
181
182
186 #[\Override]
187 public function getProviderNameForPresentation(): string
188 {
189 return "Default";
190 }
191
192
196 public function getStaticSubItems(): array
197 {
198 return [];
199 }
200
201
206 {
208 }
209
210
215 {
217 }
218
219
224 {
226 }
227
228
233 {
235 }
236
237
242 {
244 }
245
246
251 {
253 }
254}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
return true
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This describes the specific behavior of an ILIAS standard icon.
Definition: Standard.php:27
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
withSymbol(Symbol $symbol)
@inheritDoc
withAvailableCallable(callable $is_available)
withVisibilityCallable(callable $is_visible)
if(!file_exists('../ilias.ini.php'))
global $DIC
Definition: shib_login.php:26