1<?php namespace ILIAS\PersonalWorkspace\Provider;
2
3use ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider;
4use ILIAS\MainMenu\Provider\StandardTopItemsProvider;
5
6/**
7 * Class WorkspaceMainBarProvider
8 *
9 * @author Fabian Schmid <fs@studer-raimann.ch>
10 */
11class WorkspaceMainBarProvider extends AbstractStaticMainMenuProvider
12{
13
14    /**
15     * @inheritDoc
16     */
17    public function getStaticTopItems() : array
18    {
19        return [];
20    }
21
22
23    /**
24     * @inheritDoc
25     */
26    public function getStaticSubItems() : array
27    {
28        $dic = $this->dic;
29
30        $title = $this->dic->language()->txt("mm_personal_and_shared_r");
31        $icon = $this->dic->ui()->factory()->symbol()->icon()->standard("fold", $title)->withIsOutlined(true);
32
33        return [
34            $this->mainmenu->link($this->if->identifier('mm_pd_wsp'))
35                ->withTitle($title)
36                ->withAction("ilias.php?baseClass=ilDashboardGUI&cmd=jumpToWorkspace")
37                ->withParent(StandardTopItemsProvider::getInstance()->getPersonalWorkspaceIdentification())
38                ->withPosition(60)
39                ->withSymbol($icon)
40                ->withNonAvailableReason($this->dic->ui()->factory()->legacy("{$this->dic->language()->txt('component_not_active')}"))
41                ->withAvailableCallable(
42                    function () use ($dic) {
43                        return (bool) (!$dic->settings()->get("disable_personal_workspace"));
44                    }
45                ),
46        ];
47    }
48}
49