ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ILIAS\Administration\AdministrationMainBarProvider Class Reference

Class AdministrationMainBarProvider. More...

+ Inheritance diagram for ILIAS\Administration\AdministrationMainBarProvider:
+ Collaboration diagram for ILIAS\Administration\AdministrationMainBarProvider:

Public Member Functions

 __construct (Container $dic)
 @inheritDoc More...
 
 getStaticTopItems ()
 
 getStaticSubItems ()
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider
 __construct (Container $dic)
 @inheritDoc More...
 
 getAllIdentifications ()
 @inheritDoc More...
 
 provideTypeInformation ()
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 __construct (protected Container $dic)
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
 getFullyQualifiedClassName ()
 
 getProviderNameForPresentation ()
 
 getStaticTopItems ()
 
 getStaticSubItems ()
 
 provideTypeInformation ()
 
 getAllIdentifications ()
 

Protected Member Functions

 getIconForGroup (string $group, string $title)
 
- Protected Member Functions inherited from ILIAS\GlobalScreen\Provider\AbstractProvider
 globalScreen ()
 

Private Member Functions

 getGroups ()
 

Private Attributes

ilRbacReview $rbac_review
 
ilObjUser $user
 

Additional Inherited Members

- Protected Attributes inherited from ILIAS\GlobalScreen\Scope\MainMenu\Provider\AbstractStaticMainMenuProvider
Container $dic
 
IdentificationProviderInterface $if
 
MainMenuItemFactory $mainmenu
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Administration\AdministrationMainBarProvider::__construct ( Container  $dic)

Member Function Documentation

◆ getGroups()

ILIAS\Administration\AdministrationMainBarProvider::getGroups ( )
private

Definition at line 148 of file AdministrationMainBarProvider.php.

148 : array
149 {
150 if (!$this->dic->offsetExists('tree')) { // isDependencyAvailable does not work, Fatal error: Uncaught Error: Call to undefined method ILIAS\DI\Container::tree() in /var/www/html/components/ILIAS/DI/src/Container.php on line 294
151 return [[], []];
152 }
153 $tree = $this->dic->repositoryTree();
154 $lng = $this->dic->language();
155
156 $admin_request = new AdminGUIRequest(
157 $this->dic->http(),
158 $this->dic->refinery()
159 );
160
161
162 $objects = $tree->getChilds(SYSTEM_FOLDER_ID);
163
164 foreach ($objects as $object) {
165 $new_objects[$object["title"] . ":" . $object["child"]]
166 = $object;
167 // have to set it manually as translation type of main node cannot be "sys" as this type is a orgu itself.
168 if ($object["type"] === "orgu") {
169 $new_objects[$object["title"] . ":" . $object["child"]]["title"] = $lng->txt("objs_orgu");
170 }
171 }
172
173 // add entry for switching to repository admin
174 // this is only available to the Administrator role
175 // note: please see showChilds methods which prevents infinite look
176 if ($this->rbac_review->isAssigned($this->user->getId(), SYSTEM_ROLE_ID)) {
177 $new_objects[$lng->txt("repository_admin") . ":" . ROOT_FOLDER_ID]
178 = array(
179 "tree" => 1,
180 "child" => ROOT_FOLDER_ID,
181 "ref_id" => ROOT_FOLDER_ID,
182 "depth" => 3,
183 "type" => "root",
184 "title" => $lng->txt("repository_admin"),
185 "description" => $lng->txt("repository_admin_desc"),
186 "desc" => $lng->txt("repository_admin_desc"),
187 );
188 }
189
190 $new_objects[$lng->txt("general_settings") . ":" . SYSTEM_FOLDER_ID]
191 = array(
192 "tree" => 1,
193 "child" => SYSTEM_FOLDER_ID,
194 "ref_id" => SYSTEM_FOLDER_ID,
195 "depth" => 2,
196 "type" => "adm",
197 "title" => $lng->txt("general_settings"),
198 );
199 ksort($new_objects);
200
201 // determine items to show
202 $items = array();
203 foreach ($new_objects as $c) {
204 // check visibility
205 if ($c["type"] !== "adm" && $tree->getParentId((int) $c["ref_id"]) === ROOT_FOLDER_ID
206 && $admin_request->getAdminMode() !== "repository"
207 ) {
208 continue;
209 }
210 // these objects may exist due to test cases that didnt clear
211 // data properly
212 if ($c["type"] == "" || $c["type"] === "objf"
213 || $c["type"] === "xxx"
214 ) {
215 continue;
216 }
217 $items[] = $c;
218 }
219
220 $titems = array();
221 foreach ($items as $i) {
222 $titems[$i["type"]] = $i;
223 }
224
225 // admin menu layout
226 $layout = array(
227 "maintenance" =>
228 array("adma", "serv", "cron", "bnmk", "lngf", "hlps", "wfe", 'fils', 'logs', 'sysc', "recf", "root"),
229 "layout_and_navigation" =>
230 array("mme", "gsfo", "dshs", "stys", "adve", "stus"),
231 "repository_and_objects" =>
232 array("reps", "crss", "grps", "prgs", "bibs", "blga", "cpad", "chta", "facs", "frma", "lrss",
233 "mcts", "mobs", "svyf", "assf", "wbrs", 'lsos'),
234 "personal_workspace" =>
235 array("tags", "cals", "prfa", "prss", "nots"),
236 "achievements" =>
237 array("lhts", "skmg", "trac", "bdga", "cert"),
238 "communication" =>
239 array("mail", "cadm", "nwss", "coms", "adn", "awra", "nota"),
240 "user_administration" =>
241 array("usrf", "rolf", "otpl", "auth", "ps"),
242 "search_and_find" =>
243 array("seas", "mds", "taxs"),
244 "extending_ilias" =>
245 array('ecss', "ltis", "wbdv", "cmis", "maps", "cmps"),
246 "legal_regulations" =>
247 array("impr" ,"tos", "accs", 'dpro')
248 );
249 $groups = [];
250 // now get all items and groups that are accessible
251 foreach ($layout as $group => $entries) {
252 $groups[$group] = array();
253 $entries_since_last_sep = false;
254 foreach ($entries as $e) {
255 if ($e === "---" || (isset($titems[$e]["type"]) && $titems[$e]["type"] != "")) {
256 if ($e === "---" && $entries_since_last_sep) {
257 $groups[$group][] = $e;
258 $entries_since_last_sep = false;
259 } else {
260 if ($e !== "---") {
261 $groups[$group][] = $e;
262 $entries_since_last_sep = true;
263 }
264 }
265 }
266 }
267 }
268
269 return [$groups, $titems];
270 }
const SYSTEM_ROLE_ID
Definition: constants.php:29
const SYSTEM_FOLDER_ID
Definition: constants.php:35
const ROOT_FOLDER_ID
Definition: constants.php:32
$c
Definition: deliver.php:25
global $lng
Definition: privfeed.php:31

References $c, Vendor\Package\$e, $lng, ROOT_FOLDER_ID, SYSTEM_FOLDER_ID, and SYSTEM_ROLE_ID.

Referenced by ILIAS\Administration\AdministrationMainBarProvider\getStaticSubItems().

+ Here is the caller graph for this function:

◆ getIconForGroup()

ILIAS\Administration\AdministrationMainBarProvider::getIconForGroup ( string  $group,
string  $title 
)
protected

Definition at line 130 of file AdministrationMainBarProvider.php.

130 : Icon
131 {
132 $icon_map = array(
133 "maintenance" => "icon_sysa",
134 "layout_and_navigation" => "icon_laya",
135 "repository_and_objects" => "icon_repa",
136 "personal_workspace" => "icon_pwsa",
137 "achievements" => "icon_achva",
138 "communication" => "icon_coma",
139 "user_administration" => "icon_usra",
140 "search_and_find" => "icon_safa",
141 "extending_ilias" => "icon_exta",
142 'legal_regulations' => 'icon_lega',
143 );
144 $icon_path = \ilUtil::getImagePath("standard/" . $icon_map[$group] . ".svg");
145 return $this->dic->ui()->factory()->symbol()->icon()->custom($icon_path, $title);
146 }
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

References ilUtil\getImagePath().

Referenced by ILIAS\Administration\AdministrationMainBarProvider\getStaticSubItems().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStaticSubItems()

ILIAS\Administration\AdministrationMainBarProvider::getStaticSubItems ( )
Returns
isItem[] These are Entries which will be available for configuration.

Implements ILIAS\GlobalScreen\Scope\MainMenu\Provider\StaticMainMenuProvider.

Definition at line 54 of file AdministrationMainBarProvider.php.

54 : array
55 {
57 $top = StandardTopItemsProvider::getInstance()->getAdministrationIdentification();
58
59 if (!$access_helper->isUserLoggedIn()() || !$access_helper->hasAdministrationAccess()()) {
60 return [];
61 }
62
63 $entries = [];
64 $this->dic->language()->loadLanguageModule('administration');
65
66 $admin_request = new AdminGUIRequest(
67 $this->dic->http(),
68 $this->dic->refinery()
69 );
70
71 [$groups, $titems] = $this->getGroups();
72 $position = 1;
73 foreach ($groups as $group => $group_items) {
74 // Is Group
75 if (is_array($group_items) && count($group_items) > 0) {
76 // Entries
77 $links = [];
78 foreach ($group_items as $group_item) {
79 if ($group_item === "---") {
80 continue;
81 }
82
83 $icon = $this->dic->ui()->factory()->symbol()->icon()->standard($titems[$group_item]["type"], $titems[$group_item]["title"]);
84
85 $ref_id = $titems[$group_item]["ref_id"];
86 if ($admin_request->getAdminMode() !== 'repository' && $ref_id == ROOT_FOLDER_ID) {
87 $identification = $this->if->identifier('mm_adm_rep');
88 $action = "ilias.php?baseClass=ilAdministrationGUI&ref_id=" . $ref_id . "&admin_mode=repository";
89 } else {
90 $identification = $this->if->identifier("mm_adm_" . $titems[$group_item]["type"]);
91 $action = "ilias.php?baseClass=ilAdministrationGUI&ref_id=" . $ref_id . "&cmd=jump";
92 }
93
94 $links[] = $this->globalScreen()
95 ->mainBar()
96 ->link($identification)
97 ->withTitle($titems[$group_item]["title"])
98 ->withAction($action)
99 ->withSymbol($icon)
100 ->withVisibilityCallable(function () use ($ref_id) {
101 return $this->dic->rbac()->system()->checkAccess('read', (int) $ref_id);
102 });
103 }
104
105 // Main entry
106 $title = $this->dic->language()->txt("adm_" . $group);
107 $entries[] = $this->globalScreen()
108 ->mainBar()
109 ->linkList($this->if->identifier('adm_content_' . $group))
110 ->withSupportsAsynchronousLoading(true)
111 ->withLinks($links)
112 ->withTitle($title)
113 ->withSymbol($this->getIconForGroup($group, $title))
114 ->withParent($top)
115 ->withPosition($position * 10)
116 ->withAlwaysAvailable(true)
117 ->withNonAvailableReason($this->dic->ui()->factory()->legacy()->content("{$this->dic->language()->txt('item_must_be_always_active')}"))
118 ->withVisibilityCallable(
119 $access_helper->hasAdministrationAccess()
120 )->withAvailableCallable(
121 $access_helper->isUserLoggedIn()
122 );
123 $position++;
124 }
125 }
126
127 return $entries;
128 }
$ref_id
Definition: ltiauth.php:66
if(!file_exists('../ilias.ini.php'))

References $ref_id, ILIAS\Administration\AdministrationMainBarProvider\getGroups(), ILIAS\Administration\AdministrationMainBarProvider\getIconForGroup(), ILIAS\GlobalScreen\Helper\BasicAccessCheckClosuresSingleton\getInstance(), ILIAS\MainMenu\Provider\StandardTopItemsProvider\getInstance(), ILIAS\GlobalScreen\Provider\AbstractProvider\globalScreen(), if, and ROOT_FOLDER_ID.

+ Here is the call graph for this function:

◆ getStaticTopItems()

ILIAS\Administration\AdministrationMainBarProvider::getStaticTopItems ( )
Returns
TopParentItem[] These are Slates which will be available for configuration.

Implements ILIAS\GlobalScreen\Scope\MainMenu\Provider\StaticMainMenuProvider.

Definition at line 48 of file AdministrationMainBarProvider.php.

48 : array
49 {
50 return [];
51 }

Field Documentation

◆ $rbac_review

ilRbacReview ILIAS\Administration\AdministrationMainBarProvider::$rbac_review
private

Definition at line 38 of file AdministrationMainBarProvider.php.

◆ $user

ilObjUser ILIAS\Administration\AdministrationMainBarProvider::$user
private

Definition at line 39 of file AdministrationMainBarProvider.php.


The documentation for this class was generated from the following file: