ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilPDGlobalScreenProvider.php
Go to the documentation of this file.
1<?php
2
5
12{
13
17 protected $top_item;
18
19
20 public function __construct(\ILIAS\DI\Container $dic)
21 {
22 parent::__construct($dic);
23 $this->top_item = $this->if->identifier('desktop');
24 }
25
26
35 {
36 return $this->top_item;
37 }
38
39
43 public function getStaticTopItems() : array
44 {
46
47 // Personal Desktop TopParentItem
48 return [$this->mainmenu->topParentItem($this->getTopItem())
49 ->withTitle($this->dic->language()->txt("personal_desktop"))
50 ->withPosition(1)
51 ->withVisibilityCallable(
52 function () use ($dic) {
53 return (bool) ($dic->user()->getId() != ANONYMOUS_USER_ID);
54 }
55 )];
56 }
57
58
62 public function getStaticSubItems() : array
63 {
65
66 $dic->language()->loadLanguageModule("pd");
67
68 // overview
69 $entries[] = $this->mainmenu->link($this->if->identifier('mm_pd_sel_items'))
70 ->withTitle($this->dic->language()->txt("overview"))
71 ->withAction("ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSelectedItems")
72 ->withParent($this->getTopItem())
73 ->withPosition(1)
74 ->withNonAvailableReason($this->dic->ui()->factory()->legacy("{$this->dic->language()->txt('component_not_active')}"))
75 ->withAvailableCallable(
76 function () use ($dic) {
77 return $dic->settings()->get('disable_my_offers', 0) == 0;
78 }
79 )
80 ->withVisibilityCallable(
81 function () use ($dic) {
82 $pdItemsViewSettings = new ilPDSelectedItemsBlockViewSettings($dic->user());
83
84 return (bool) $pdItemsViewSettings->allViewsEnabled() || $pdItemsViewSettings->enabledSelectedItems();
85 }
86 );
87
88 // my groups and courses, if both is available
89 $entries[] = $this->mainmenu->link($this->if->identifier('mm_pd_crs_grp'))
90 ->withTitle($this->dic->language()->txt("my_courses_groups"))
91 ->withAction("ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToMemberships")
92 ->withParent($this->getTopItem())
93 ->withPosition(2)
94 ->withNonAvailableReason($this->dic->ui()->factory()->legacy("{$this->dic->language()->txt('component_not_active')}"))
95 ->withAvailableCallable(
96 function () use ($dic) {
97 return $dic->settings()->get('disable_my_memberships', 0) == 0;
98 }
99 )
100 ->withVisibilityCallable(
101 function () use ($dic) {
102 $pdItemsViewSettings = new ilPDSelectedItemsBlockViewSettings($dic->user());
103
104 return (bool) $pdItemsViewSettings->allViewsEnabled() || $pdItemsViewSettings->enabledMemberships();
105 }
106 );
107
108 // achievements
109 $entries[] = $this->mainmenu->link($this->if->identifier('mm_pd_achiev'))
110 ->withTitle($this->dic->language()->txt("pd_achievements"))
111 ->withAction($dic->ctrl()->getLinkTargetByClass(["ilPersonalDesktopGUI", "ilAchievementsGUI"], ""))
112 ->withParent($this->getTopItem())
113 ->withPosition(7)
114 ->withAvailableCallable(
115 function () use ($dic) {
116 $achievements = new ilAchievements();
117
118 return (bool) $achievements->isAnyActive();
119 }
120 );
121
122 return $entries;
123 }
124}
An exception for terminatinating execution or to throw for unit testing.
Maybe a separate service in the future.
Class ilPDGlobalScreenProvider.
__construct(\ILIAS\DI\Container $dic)
getTopItem()
Some other components want to provide Items for the main menu which are located at the PD TopTitem by...
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
Definition: confirmReg.php:12
Class HTTPServicesTest.
Class BaseForm.