ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
StaffMainBarProvider.php
Go to the documentation of this file.
1 <?php
20 
21 use ilDashboardGUI;
33 use ilMyStaffGUI;
34 use ilUtil;
35 
41 {
45  final public function getStaticTopItems(): array
46  {
47  return [];
48  }
49 
53  final public function getStaticSubItems(): array
54  {
56  return [];
57  }
58 
59  $this->dic->language()->loadLanguageModule('mst');
60  $dic = $this->dic;
61  $items = [];
62  $top = StandardTopItemsProvider::getInstance()->getOrganisationIdentification();
63 
64  $title = $this->dic->language()->txt("mm_staff_list");
65  $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(
66  ilUtil::getImagePath("standard/icon_stff.svg"),
67  $title
68  );
69 
70  // My Staff
71  $items[] = $this->mainmenu->link($this->if->identifier('mm_pd_mst'))
72  ->withSymbol($icon)
73  ->withTitle($title)
74  ->withAction($this->dic->ctrl()->getLinkTargetByClass([
75  ilDashboardGUI::class,
76  ilMyStaffGUI::class,
77  ilMStListUsersGUI::class,
79  ->withParent($top)
80  ->withPosition(10)
81  ->withAvailableCallable(
82  static function () use ($dic) {
83  return (bool) ($dic->settings()->get('enable_my_staff'));
84  }
85  )
86  ->withVisibilityCallable(
87  function (): bool {
88  return (
90  )->hasCurrentUserAccessToMyStaff();
91  }
92  )->withNonAvailableReason($dic->ui()->factory()->legacy("{$dic->language()->txt('component_not_active')}"));
93 
94  $title = $this->dic->language()->txt("mm_enrolments");
95  $icon = $this->dic->ui()->factory()->symbol()->icon()->custom(
96  ilUtil::getImagePath("standard/icon_enrl.svg"),
97  $title
98  );
99 
100  // My Enrolments
101  $items[] = $this->mainmenu->link($this->if->identifier('mm_pd_enrol'))
102  ->withSymbol($icon)
103  ->withTitle($title)
104  ->withAction($this->dic->ctrl()->getLinkTargetByClass([
105  ilDashboardGUI::class,
106  ilMyStaffGUI::class,
107  ilMStListCoursesGUI::class,
109  ->withParent($top)
110  ->withPosition(20)
111  ->withAvailableCallable(
112  function () use ($dic) {
113  return (bool) ($dic->settings()->get("enable_my_staff"));
114  }
115  )
116  ->withVisibilityCallable(
117  function (): bool {
118  return (
120  )->hasCurrentUserAccessToCourseMemberships();
121  }
122  )->withNonAvailableReason($dic->ui()->factory()->legacy("{$dic->language()->txt('component_not_active')}"));
123 
124  // My Certificates
125  $icon = $this->dic->ui()->factory()->symbol()->icon()->standard(Standard::CERT, $title);
126  $items[] = $this->mainmenu->link($this->if->identifier("mm_pd_cert"))
127  ->withSymbol($icon)
128  ->withTitle($this->dic->language()->txt("mm_certificates"))
129  ->withAction($this->dic->ctrl()->getLinkTargetByClass([
130  ilDashboardGUI::class,
131  ilMyStaffGUI::class,
132  ilMStListCertificatesGUI::class,
134  ->withParent($top)
135  ->withPosition(30)
136  ->withAvailableCallable(
137  function (): bool {
138  return boolval($this->dic->settings()->get("enable_my_staff"));
139  }
140  )
141  ->withVisibilityCallable(
142  function (): bool {
143  return (
145  )->hasCurrentUserAccessToCertificates();
146  }
147  )->withNonAvailableReason($this->dic->ui()->factory()->legacy("{$this->dic->language()->txt("component_not_active")}"));
148 
149  // My Competences
150  $icon = $this->dic->ui()->factory()->symbol()->icon()->standard(Standard::SKMG, $title);
151  $items[] = $this->mainmenu->link($this->if->identifier("mm_pd_comp"))
152  ->withSymbol($icon)
153  ->withTitle($this->dic->language()->txt("mm_skills"))
154  ->withAction($this->dic->ctrl()->getLinkTargetByClass([
155  ilDashboardGUI::class,
156  ilMyStaffGUI::class,
157  ilMStListCompetencesGUI::class,
159  ->withParent($top)
160  ->withPosition(30)
161  ->withAvailableCallable(
162  function (): bool {
163  return boolval($this->dic->settings()->get("enable_my_staff"));
164  }
165  )
166  ->withVisibilityCallable(
167  function (): bool {
168  return (
170  )->hasCurrentUserAccessToCompetences();
171  }
172  )->withNonAvailableReason($this->dic->ui()->factory()->legacy("{$this->dic->language()->txt("component_not_active")}"));
173 
174  return $items;
175  }
176 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
if(!file_exists(getcwd() . '/ilias.ini.php'))
Definition: confirmReg.php:21
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ui()
Get the interface to get services from UI framework.
Definition: Container.php:127
settings()
Get the interface to the settings.
Definition: Container.php:135