ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
MapManager.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21namespace ILIAS\Help\Map;
22
25
27{
28 protected \ilObjUser $user;
29 protected \ilRbacReview $rbacreview;
30 protected \ilSetting $settings;
31 protected \ilAccessHandler $access;
34
35 public function __construct(
38 ) {
39 $this->repo = $repo->map();
40 $this->domain = $domain;
41
42 $this->access = $domain->access();
43 $this->settings = $domain->settings();
44 $this->rbacreview = $domain->rbac()->review();
45 $this->user = $domain->user();
46 }
47
48 public function saveScreenIdsForChapter(
49 int $chap,
50 array $ids
51 ): void {
52 $this->repo->saveScreenIdsForChapter($chap, $ids);
53 }
54
55 public function saveMappingEntry(
56 int $chap,
57 string $comp,
58 string $screen_id,
59 string $screen_sub_id,
60 string $perm,
61 int $module_id = 0,
62 string $full_id = ""
63 ): void {
64 $this->repo->saveMappingEntry(
65 $chap,
66 $comp,
67 $screen_id,
68 $screen_sub_id,
69 $perm,
70 $module_id,
71 $full_id
72 );
73 }
74
75 public function removeScreenIdsOfChapter(
76 int $chap,
77 int $module_id = 0
78 ): void {
79 $this->repo->removeScreenIdsOfChapter(
80 $chap,
81 $module_id
82 );
83 }
84
85 public function getScreenIdsOfChapter(
86 int $chap,
87 int $module_id = 0
88 ): array {
89 return $this->repo->getScreenIdsOfChapter(
90 $chap,
91 $module_id
92 );
93 }
94
95
96 public function getHelpSectionsForId(
97 string $a_screen_id,
98 int $a_ref_id
99 ): array {
100 if ($this->domain->module()->isAuthoringMode()) {
101 $module_ids = [0];
102 } else {
103 $module_ids = $this->domain->module()->getActiveModules();
104 }
105 $chaps = [];
106 foreach ($this->repo->getChaptersForScreenId($a_screen_id, $module_ids) as $rec) {
107 if ($rec["perm"] != "" && $rec["perm"] != "-") {
108 // check special "create*" permission
109 if ($rec["perm"] === "create*") {
110 $has_create_perm = false;
111
112 // check owner
113 if ($this->user->getId() === \ilObject::_lookupOwner(\ilObject::_lookupObjId($a_ref_id))) {
114 $has_create_perm = true;
115 } elseif ($this->rbacreview->isAssigned($this->user->getId(), SYSTEM_ROLE_ID)) { // check admin
116 $has_create_perm = true;
117 } elseif ($this->access->checkAccess("read", "", $a_ref_id)) {
118 $perm = $this->rbacreview->getUserPermissionsOnObject($this->user->getId(), $a_ref_id);
119 foreach ($perm as $p) {
120 if (strpos($p, "create_") === 0) {
121 $has_create_perm = true;
122 }
123 }
124 }
125 if ($has_create_perm) {
126 $chaps[] = $rec["chap"];
127 }
128 } elseif ($this->access->checkAccess($rec["perm"], "", $a_ref_id)) {
129 $chaps[] = $rec["chap"];
130 }
131 } else {
132 $chaps[] = $rec["chap"];
133 }
134 }
135 return $chaps;
136 }
137
145 public function hasScreenIdSections(
146 string $a_screen_id
147 ): bool {
148
149 if ($this->user->getLanguage() !== "de") {
150 return false;
151 }
152
153 if ($this->settings->get("help_mode") === "2") {
154 return false;
155 }
156
157 if ($this->domain->module()->isAuthoringMode()) {
158 $module_ids = [0];
159 } else {
160 $module_ids = $this->domain->module()->getActiveModules();
161 }
162
163 foreach ($this->repo->getChaptersForScreenId($a_screen_id, $module_ids) as $rec) {
164 return true;
165 }
166 return false;
167 }
168
169 public function deleteEntriesOfModule(
170 int $id
171 ): void {
172 $this->repo->deleteEntriesOfModule($id);
173 }
174}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
ilRbacReview $rbacreview
Definition: MapManager.php:29
__construct(InternalRepoService $repo, InternalDomainService $domain)
Definition: MapManager.php:35
InternalDomainService $domain
Definition: MapManager.php:32
saveScreenIdsForChapter(int $chap, array $ids)
Definition: MapManager.php:48
getHelpSectionsForId(string $a_screen_id, int $a_ref_id)
Definition: MapManager.php:96
hasScreenIdSections(string $a_screen_id)
Has given screen Id any sections? Note: We removed the "ref_id" parameter here, since this method sho...
Definition: MapManager.php:145
saveMappingEntry(int $chap, string $comp, string $screen_id, string $screen_sub_id, string $perm, int $module_id=0, string $full_id="")
Definition: MapManager.php:55
removeScreenIdsOfChapter(int $chap, int $module_id=0)
Definition: MapManager.php:75
ilAccessHandler $access
Definition: MapManager.php:31
MapDBRepository $repo
Definition: MapManager.php:33
getScreenIdsOfChapter(int $chap, int $module_id=0)
Definition: MapManager.php:85
static _lookupOwner(int $obj_id)
Lookup owner user ID for object ID.
static _lookupObjId(int $ref_id)
const SYSTEM_ROLE_ID
Definition: constants.php:29
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!file_exists('../ilias.ini.php'))
getLanguage()