ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
StandardTopItemsProvider.php
Go to the documentation of this file.
2
9
16{
17
21 private static $instance;
50
51
55 public static function getInstance()
56 {
57 global $DIC;
58 if (!isset(self::$instance)) {
59 self::$instance = new self($DIC);
60 }
61
62 return self::$instance;
63 }
64
65
69 public function __construct(Container $dic)
70 {
72 $this->basic_access_helper = BasicAccessCheckClosures::getInstance();
73 $this->repository_identification = $this->if->identifier('repository');
74 $this->personal_workspace_identification = $this->if->identifier('personal_workspace');
75 $this->achievements_identification = $this->if->identifier('achievements');
76 $this->communication_identification = $this->if->identifier('communication');
77 $this->organisation_identification = $this->if->identifier('organisation');
78 $this->administration_identification = $this->if->identifier('administration');
79 }
80
81
85 public function getStaticTopItems() : array
86 {
87 $f = function ($id) {
88 return $this->dic->language()->txt($id);
89 };
91
92 // Dashboard
93 $title = $this->dic->language()->txt("mm_dashboard");
94 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard(Standard::DSHS, $title)->withIsOutlined(true);
95 $dashboard = $this->mainmenu->topLinkItem($this->if->identifier('mm_pd_crs_grp'))
96 ->withSymbol($icon)
97 ->withTitle($title)
98 ->withAction("ilias.php?baseClass=ilDashboardGUI&cmd=jumpToMemberships")
99 ->withPosition(10)
100 ->withNonAvailableReason($this->dic->ui()->factory()->legacy("{$this->dic->language()->txt('component_not_active')}"))
101 ->withAvailableCallable(
102 function () use ($dic) {
103 return true;
104
105 return $dic->settings()->get('disable_my_memberships', 0) == 0;
106 }
107 )
108 ->withVisibilityCallable(
109 $this->basic_access_helper->isUserLoggedIn()
110 );
111
112 $title = $f("mm_repository");
113 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard(Standard::REP, $title)->withIsOutlined(true);
114
115 $repository = $this->mainmenu->topParentItem($this->getRepositoryIdentification())
116 ->withVisibilityCallable($this->basic_access_helper->isRepositoryReadable())
117 ->withSymbol($icon)
118 ->withTitle($title)
119 ->withPosition(20);
120
121 $title = $f("mm_personal_workspace");
122 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_wksp.svg"), $title);
123
124 $personal_workspace = $this->mainmenu->topParentItem($this->getPersonalWorkspaceIdentification())
125 ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
126 ->withSymbol($icon)
127 ->withTitle($title)
128 ->withPosition(30);
129
130 $title = $f("mm_achievements");
131 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_achv.svg"), $title);
132
133 $achievements = $this->mainmenu->topParentItem($this->getAchievementsIdentification())
134 ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
135 ->withSymbol($icon)
136 ->withTitle($title)
137 ->withPosition(40);
138
139 $title = $f("mm_communication");
140 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_comu.svg"), $title);
141
142 $communication = $this->mainmenu->topParentItem($this->getCommunicationIdentification())
143 ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
144 ->withSymbol($icon)
145 ->withTitle($title)
146 ->withPosition(50);
147
148 $title = $f("mm_organisation");
149 $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_orga.svg"), $title);
150
151 $organisation = $this->mainmenu->topParentItem($this->getOrganisationIdentification())
152 ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn(static function () : bool {
153 return (bool) ilMyStaffAccess::getInstance()->hasCurrentUserAccessToMyStaff();
154 }))
155 ->withSymbol($icon)
156 ->withTitle($title)
157 ->withPosition(60)
158 ->withAvailableCallable(
159 static function () : bool {
160 return (bool) ilMyStaffAccess::getInstance()->hasCurrentUserAccessToMyStaff();
161 });
162
163 $title = $f("mm_administration");
164 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard("adm", $title)->withIsOutlined(true);
165
166 $administration = $this->mainmenu->topParentItem($this->getAdministrationIdentification())
167 ->withSupportsAsynchronousLoading(false)
168 ->withAvailableCallable($this->basic_access_helper->isUserLoggedIn())
169 ->withSymbol($icon)
170 ->withTitle($title)
171 ->withPosition(70)
172 ->withVisibilityCallable($this->basic_access_helper->hasAdministrationAccess());
173
174 return [
175 $dashboard,
176 $repository,
177 $personal_workspace,
178 $achievements,
179 $communication,
180 $organisation,
181 $administration,
182 ];
183 }
184
185
189 public function getProviderNameForPresentation() : string
190 {
191 return "Default";
192 }
193
194
198 public function getStaticSubItems() : array
199 {
200 return [];
201 }
202
203
208 {
210 }
211
212
217 {
219 }
220
221
226 {
228 }
229
230
235 {
237 }
238
239
244 {
246 }
247
248
253 {
255 }
256}
An exception for terminatinating execution or to throw for unit testing.
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:18
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
Definition: confirmReg.php:12
This describes the specific behavior of an ILIAS standard icon.
Definition: Standard.php:10
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
withSymbol(Symbol $symbol)
@inheritDoc
$DIC
Definition: xapitoken.php:46