ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
StandardTopItemsProvider.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\MainMenu\Provider;
22 
34 
41 {
43 
45 
47 
49 
51 
53 
55 
57 
58 
62  public static function getInstance(): StandardTopItemsProvider
63  {
64  global $DIC;
65  if (!isset(self::$instance)) {
66  self::$instance = new self($DIC);
67  }
68 
69  return self::$instance;
70  }
71 
72 
76  public function __construct(Container $dic)
77  {
78  parent::__construct($dic);
79  $this->basic_access_helper = BasicAccessCheckClosuresSingleton::getInstance();
80  $this->repository_identification = $this->if->identifier('repository');
81  $this->personal_workspace_identification = $this->if->identifier('personal_workspace');
82  $this->achievements_identification = $this->if->identifier('achievements');
83  $this->communication_identification = $this->if->identifier('communication');
84  $this->organisation_identification = $this->if->identifier('organisation');
85  $this->administration_identification = $this->if->identifier('administration');
86  }
87 
88 
92  public function getStaticTopItems(): array
93  {
94  $f = function ($id) {
95  return $this->dic->language()->txt($id);
96  };
97 
98  // Dashboard
99  $title = $this->dic->language()->txt("mm_dashboard");
100  $icon = $this->dic->ui()->factory()->symbol()->icon()->standard(Standard::DSHS, $title);
101  $dashboard = $this->mainmenu->topLinkItem($this->if->identifier('mm_pd_crs_grp'))
102  ->withSymbol($icon)
103  ->withTitle($title)
104  ->withAction("ilias.php?baseClass=ilDashboardGUI&cmd=jumpToMemberships")
105  ->withPosition(10)
106  ->withNonAvailableReason($this->dic->ui()->factory()->legacy("{$this->dic->language()->txt('component_not_active')}"))
108  function () {
109  return true;
110  }
111  )
113  $this->basic_access_helper->isUserLoggedIn()
114  );
115 
116  $title = $f("mm_repository");
117  $icon = $this->dic->ui()->factory()->symbol()->icon()->standard(Standard::REP, $title);
118 
119  $repository = $this->mainmenu->topParentItem($this->getRepositoryIdentification())
120  ->withVisibilityCallable($this->basic_access_helper->isRepositoryReadable())
121  ->withSymbol($icon)
122  ->withTitle($title)
123  ->withPosition(20);
124 
125  $title = $f("mm_personal_workspace");
126  $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("standard/icon_wksp.svg"), $title);
127 
128  $personal_workspace = $this->mainmenu->topParentItem($this->getPersonalWorkspaceIdentification())
129  ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
130  ->withSymbol($icon)
131  ->withTitle($title)
132  ->withPosition(30);
133 
134  $title = $f("mm_achievements");
135  $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("standard/icon_achv.svg"), $title);
136 
137  $achievements = $this->mainmenu->topParentItem($this->getAchievementsIdentification())
138  ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
139  ->withSymbol($icon)
140  ->withTitle($title)
141  ->withPosition(40);
142 
143  $title = $f("mm_communication");
144  $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("standard/icon_comu.svg"), $title);
145 
146  $communication = $this->mainmenu->topParentItem($this->getCommunicationIdentification())
147  ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
148  ->withSymbol($icon)
149  ->withTitle($title)
150  ->withPosition(50);
151 
152  $title = $f("mm_organisation");
153  $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(\ilUtil::getImagePath("standard/icon_orga.svg"), $title);
154 
155  $organisation = $this->mainmenu->topParentItem($this->getOrganisationIdentification())
156  ->withVisibilityCallable($this->basic_access_helper->isUserLoggedIn())
157  ->withSymbol($icon)
158  ->withTitle($title)
159  ->withPosition(60);
160 
161  $title = $f("mm_administration");
162  $icon = $this->dic->ui()->factory()->symbol()->icon()->standard("adm", $title);
163 
164  $administration = $this->mainmenu->topParentItem($this->getAdministrationIdentification())
165  ->withSupportsAsynchronousLoading(false)
166  ->withAvailableCallable($this->basic_access_helper->isUserLoggedIn())
167  ->withSymbol($icon)
168  ->withTitle($title)
169  ->withPosition(70)
170  ->withVisibilityCallable($this->basic_access_helper->hasAdministrationAccess());
171 
172  $dd_renderer = new TopParentItemDrilldownRenderer();
173  $ti = new TypeInformation(get_class($administration), get_class($administration));
174  $ti->setRenderer($dd_renderer);
175  $administration = $administration->setTypeInformation($ti);
176 
177 
178  return [
179  $dashboard,
180  $repository,
181  $personal_workspace,
182  $achievements,
183  $communication,
184  $organisation,
185  $administration
186  ];
187  }
188 
189 
193  public function getProviderNameForPresentation(): string
194  {
195  return "Default";
196  }
197 
198 
202  public function getStaticSubItems(): array
203  {
204  return [];
205  }
206 
207 
212  {
214  }
215 
216 
221  {
223  }
224 
225 
230  {
232  }
233 
234 
239  {
241  }
242 
243 
248  {
250  }
251 
252 
257  {
259  }
260 }
if(!file_exists('../ilias.ini.php'))
withAvailableCallable(callable $is_available)
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:35
withVisibilityCallable(callable $is_visible)
global $DIC
Definition: shib_login.php:25
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:24
__construct(Container $dic, ilPlugin $plugin)