ILIAS  release_7 Revision v7.30-3-g800a261c036
StandardTopItemsProvider.php
Go to the documentation of this file.
1 <?php
17 namespace ILIAS\MainMenu\Provider;
18 
25 
32 {
33 
37  private static $instance;
66 
67 
71  public static function getInstance()
72  {
73  global $DIC;
74  if (!isset(self::$instance)) {
75  self::$instance = new self($DIC);
76  }
77 
78  return self::$instance;
79  }
80 
81 
85  public function __construct(Container $dic)
86  {
87  parent::__construct($dic);
88  $this->basic_access_helper = BasicAccessCheckClosures::getInstance();
89  $this->repository_identification = $this->if->identifier('repository');
90  $this->personal_workspace_identification = $this->if->identifier('personal_workspace');
91  $this->achievements_identification = $this->if->identifier('achievements');
92  $this->communication_identification = $this->if->identifier('communication');
93  $this->organisation_identification = $this->if->identifier('organisation');
94  $this->administration_identification = $this->if->identifier('administration');
95  }
96 
97 
101  public function getStaticTopItems() : array
102  {
103  $f = function ($id) {
104  return $this->dic->language()->txt($id);
105  };
106  $dic = $this->dic;
107 
108  // Dashboard
109  $title = $this->dic->language()->txt("mm_dashboard");
110  $icon = $this->dic->ui()->factory()->symbol()->icon()->standard(Standard::DSHS, $title)->withIsOutlined(true);
111  $dashboard = $this->mainmenu->topLinkItem($this->if->identifier('mm_pd_crs_grp'))
112  ->withSymbol($icon)
113  ->withTitle($title)
114  ->withAction("ilias.php?baseClass=ilDashboardGUI&cmd=jumpToMemberships")
115  ->withPosition(10)
116  ->withNonAvailableReason($this->dic->ui()->factory()->legacy("{$this->dic->language()->txt('component_not_active')}"))
117  ->withAvailableCallable(
118  function () use ($dic) {
119  return true;
120 
121  return $dic->settings()->get('disable_my_memberships', 0) == 0;
122  }
123  )
124  ->withVisibilityCallable(
125  $this->basic_access_helper->isUserLoggedIn()
126  );
127 
128  $title = $f("mm_repository");
129  $icon = $this->dic->ui()->factory()->symbol()->icon()->standard(Standard::REP, $title)->withIsOutlined(true);
130 
131  $repository = $this->mainmenu->topParentItem($this->getRepositoryIdentification())
132  ->withVisibilityCallable($this->basic_access_helper->isRepositoryReadable())
133  ->withSymbol($icon)
134  ->withTitle($title)
135  ->withPosition(20);
136 
137  $title = $f("mm_personal_workspace");
138  $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_wksp.svg"), $title);
139 
140  $personal_workspace = $this->mainmenu->topParentItem($this->getPersonalWorkspaceIdentification())
141  ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
142  ->withSymbol($icon)
143  ->withTitle($title)
144  ->withPosition(30);
145 
146  $title = $f("mm_achievements");
147  $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_achv.svg"), $title);
148 
149  $achievements = $this->mainmenu->topParentItem($this->getAchievementsIdentification())
150  ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
151  ->withSymbol($icon)
152  ->withTitle($title)
153  ->withPosition(40);
154 
155  $title = $f("mm_communication");
156  $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_comu.svg"), $title);
157 
158  $communication = $this->mainmenu->topParentItem($this->getCommunicationIdentification())
159  ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
160  ->withSymbol($icon)
161  ->withTitle($title)
162  ->withPosition(50);
163 
164  $title = $f("mm_organisation");
165  $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("outlined/icon_orga.svg"), $title);
166 
167  $organisation = $this->mainmenu->topParentItem($this->getOrganisationIdentification())
168  ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
169  ->withSymbol($icon)
170  ->withTitle($title)
171  ->withPosition(60);
172 
173  $title = $f("mm_administration");
174  $icon = $this->dic->ui()->factory()->symbol()->icon()->standard("adm", $title)->withIsOutlined(true);
175 
176  $administration = $this->mainmenu->topParentItem($this->getAdministrationIdentification())
177  ->withSupportsAsynchronousLoading(false)
178  ->withAvailableCallable($this->basic_access_helper->isUserLoggedIn())
179  ->withSymbol($icon)
180  ->withTitle($title)
181  ->withPosition(70)
182  ->withVisibilityCallable($this->basic_access_helper->hasAdministrationAccess());
183 
184  return [
185  $dashboard,
186  $repository,
187  $personal_workspace,
188  $achievements,
189  $communication,
190  $organisation,
191  $administration,
192  ];
193  }
194 
195 
199  public function getProviderNameForPresentation() : string
200  {
201  return "Default";
202  }
203 
204 
208  public function getStaticSubItems() : array
209  {
210  return [];
211  }
212 
213 
218  {
220  }
221 
222 
227  {
229  }
230 
231 
236  {
238  }
239 
240 
245  {
247  }
248 
249 
254  {
256  }
257 
258 
263  {
265  }
266 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:18
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
Definition: confirmReg.php:12
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)