ILIAS  release_8 Revision v8.24
StandardTopItemsProvider.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
33
40{
42
44
46
48
50
52
54
56
57
61 public static function getInstance(): StandardTopItemsProvider
62 {
63 global $DIC;
64 if (!isset(self::$instance)) {
65 self::$instance = new self($DIC);
66 }
67
68 return self::$instance;
69 }
70
71
75 public function __construct(Container $dic)
76 {
78 $this->basic_access_helper = BasicAccessCheckClosuresSingleton::getInstance();
79 $this->repository_identification = $this->if->identifier('repository');
80 $this->personal_workspace_identification = $this->if->identifier('personal_workspace');
81 $this->achievements_identification = $this->if->identifier('achievements');
82 $this->communication_identification = $this->if->identifier('communication');
83 $this->organisation_identification = $this->if->identifier('organisation');
84 $this->administration_identification = $this->if->identifier('administration');
85 }
86
87
91 public function getStaticTopItems(): array
92 {
93 $f = function ($id) {
94 return $this->dic->language()->txt($id);
95 };
96
97 // Dashboard
98 $title = $this->dic->language()->txt("mm_dashboard");
99 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard(Standard::DSHS, $title);
100 $dashboard = $this->mainmenu->topLinkItem($this->if->identifier('mm_pd_crs_grp'))
101 ->withSymbol($icon)
102 ->withTitle($title)
103 ->withAction("ilias.php?baseClass=ilDashboardGUI&cmd=jumpToMemberships")
104 ->withPosition(10)
105 ->withNonAvailableReason($this->dic->ui()->factory()->legacy("{$this->dic->language()->txt('component_not_active')}"))
106 ->withAvailableCallable(
107 function () {
108 return true;
109 }
110 )
111 ->withVisibilityCallable(
112 $this->basic_access_helper->isUserLoggedIn()
113 );
114
115 $title = $f("mm_repository");
116 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard(Standard::REP, $title);
117
118 $repository = $this->mainmenu->topParentItem($this->getRepositoryIdentification())
119 ->withVisibilityCallable($this->basic_access_helper->isRepositoryReadable())
120 ->withSymbol($icon)
121 ->withTitle($title)
122 ->withPosition(20);
123
124 $title = $f("mm_personal_workspace");
125 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("icon_wksp.svg"), $title);
126
127 $personal_workspace = $this->mainmenu->topParentItem($this->getPersonalWorkspaceIdentification())
128 ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
129 ->withSymbol($icon)
130 ->withTitle($title)
131 ->withPosition(30);
132
133 $title = $f("mm_achievements");
134 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("icon_achv.svg"), $title);
135
136 $achievements = $this->mainmenu->topParentItem($this->getAchievementsIdentification())
137 ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
138 ->withSymbol($icon)
139 ->withTitle($title)
140 ->withPosition(40);
141
142 $title = $f("mm_communication");
143 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("icon_comu.svg"), $title);
144
145 $communication = $this->mainmenu->topParentItem($this->getCommunicationIdentification())
146 ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
147 ->withSymbol($icon)
148 ->withTitle($title)
149 ->withPosition(50);
150
151 $title = $f("mm_organisation");
152 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("icon_orga.svg"), $title);
153
154 $organisation = $this->mainmenu->topParentItem($this->getOrganisationIdentification())
155 ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
156 ->withSymbol($icon)
157 ->withTitle($title)
158 ->withPosition(60);
159
160 $title = $f("mm_administration");
161 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard("adm", $title);
162
163 $administration = $this->mainmenu->topParentItem($this->getAdministrationIdentification())
164 ->withSupportsAsynchronousLoading(false)
165 ->withAvailableCallable($this->basic_access_helper->isUserLoggedIn())
166 ->withSymbol($icon)
167 ->withTitle($title)
168 ->withPosition(70)
169 ->withVisibilityCallable($this->basic_access_helper->hasAdministrationAccess());
170
171 $dd_renderer = new TopParentItemDrilldownRenderer();
172 $ti = new TypeInformation(get_class($administration), get_class($administration));
173 $ti->setRenderer($dd_renderer);
174 $administration = $administration->setTypeInformation($ti);
175
176
177 return [
178 $dashboard,
179 $repository,
180 $personal_workspace,
181 $achievements,
182 $communication,
183 $organisation,
184 $administration
185 ];
186 }
187
188
192 public function getProviderNameForPresentation(): string
193 {
194 return "Default";
195 }
196
197
201 public function getStaticSubItems(): array
202 {
203 return [];
204 }
205
206
211 {
213 }
214
215
220 {
222 }
223
224
229 {
231 }
232
233
238 {
240 }
241
242
247 {
249 }
250
251
256 {
258 }
259}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:32
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: confirmReg.php:20
global $DIC
Definition: feed.php:28
This describes the specific behavior of an ILIAS standard icon.
Definition: Standard.php:27
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
withSymbol(Symbol $symbol)
@inheritDoc