ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Skill\Table\ProfileUserAssignmentTable Class Reference
+ Collaboration diagram for ILIAS\Skill\Table\ProfileUserAssignmentTable:

Public Member Functions

 __construct (Profile\SkillProfile $profile, Access\SkillTreeAccess $tree_access_manager)
 
 getComponent ()
 

Protected Member Functions

 getColumns ()
 
 getActions ()
 
 getDataRetrieval ()
 
 getAssignmentTitle (int $obj_id)
 

Protected Attributes

ilCtrl $ctrl
 
ilLanguage $lng
 
UI Factory $ui_fac
 
UI Renderer $ui_ren
 
ServerRequestInterface $request
 
ArrayBasedRequestWrapper $query
 
Data Factory $df
 
Service SkillAdminGUIRequest $admin_gui_request
 
Profile SkillProfile $profile
 
Access SkillTreeAccess $tree_access_manager
 
Profile SkillProfileManager $profile_manager
 
string $requested_table_profile_user_ass_action = ""
 
array $requested_table_profile_user_ass_ids = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Skill\Table\ProfileUserAssignmentTable::__construct ( Profile\SkillProfile  $profile,
Access\SkillTreeAccess  $tree_access_manager 
)

Definition at line 53 of file class.ProfileUserAssignmentTable.php.

54 {
55 global $DIC;
56
57 $this->ctrl = $DIC->ctrl();
58 $this->lng = $DIC->language();
59 $this->ui_fac = $DIC->ui()->factory();
60 $this->ui_ren = $DIC->ui()->renderer();
61 $this->request = $DIC->http()->request();
62 $this->query = $DIC->http()->wrapper()->query();
63 $this->df = new Data\Factory();
64 $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
65
66 $this->profile = $profile;
67 $this->tree_access_manager = $tree_access_manager;
68 $this->profile_manager = $DIC->skills()->internal()->manager()->getProfileManager();
69 $this->requested_table_profile_user_ass_action = $this->admin_gui_request->getTableProfileUserAssignmentAction();
70 $this->requested_table_profile_user_ass_ids = $this->admin_gui_request->getTableProfileUserAssignmentIds();
71 }
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Skill\Table\ProfileUserAssignmentTable\$profile, ILIAS\Skill\Table\ProfileUserAssignmentTable\$tree_access_manager, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\profile().

Referenced by ILIAS\Skill\Table\ProfileUserAssignmentTable\getDataRetrieval().

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

Member Function Documentation

◆ getActions()

ILIAS\Skill\Table\ProfileUserAssignmentTable::getActions ( )
protected

Definition at line 133 of file class.ProfileUserAssignmentTable.php.

133 : array
134 {
135 $query_params_namespace = ["skl_profile_user_assignment_table"];
136
137 $url_builder_delete = new UI\URLBuilder($this->df->uri($this->request->getUri()->__toString()));
138 list($url_builder_delete, $action_parameter_token_delete, $row_id_token_delete) =
139 $url_builder_delete->acquireParameters(
140 $query_params_namespace,
141 "action",
142 "ass_ids"
143 );
144
145 $actions = [];
146 if ($this->tree_access_manager->hasManageProfilesPermission() && !$this->profile->getRefId() > 0) {
147 $actions["delete"] = $this->ui_fac->table()->action()->multi(
148 $this->lng->txt("delete"),
149 $url_builder_delete->withParameter($action_parameter_token_delete, "removeUsers"),
150 $row_id_token_delete
151 )
152 ->withAsync();
153 }
154
155 return $actions;
156 }

References ILIAS\Repository\lng().

Referenced by ILIAS\Skill\Table\ProfileUserAssignmentTable\getComponent().

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

◆ getAssignmentTitle()

ILIAS\Skill\Table\ProfileUserAssignmentTable::getAssignmentTitle ( int  $obj_id)
protected

Definition at line 227 of file class.ProfileUserAssignmentTable.php.

227 : string
228 {
229 $type = \ilObject::_lookupType($obj_id);
230 switch ($type) {
231 case "usr":
232 $ass_title = \ilUserUtil::getNamePresentation($obj_id);
233 break;
234
235 case "role":
236 $ass_title = \ilObjRole::_lookupTitle($obj_id);
237 break;
238
239 default:
240 $ass_title = $this->lng->txt("not_available");
241 }
242
243 return $ass_title;
244 }
static _lookupType(int $id, bool $reference=false)
static _lookupTitle(int $obj_id)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link='', bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path=null)
Default behaviour is:

References ilObject\_lookupTitle(), ilObject\_lookupType(), ilUserUtil\getNamePresentation(), and ILIAS\Repository\lng().

Referenced by ILIAS\Skill\Table\ProfileUserAssignmentTable\getComponent().

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

◆ getColumns()

ILIAS\Skill\Table\ProfileUserAssignmentTable::getColumns ( )
protected

Definition at line 121 of file class.ProfileUserAssignmentTable.php.

121 : array
122 {
123 $columns = [
124 "type" => $this->ui_fac->table()->column()->text($this->lng->txt("type"))
125 ->withIsSortable(false),
126 "name" => $this->ui_fac->table()->column()->text($this->lng->txt("name")),
127 "object" => $this->ui_fac->table()->column()->text($this->lng->txt("object"))
128 ];
129
130 return $columns;
131 }

References ILIAS\Repository\lng().

Referenced by ILIAS\Skill\Table\ProfileUserAssignmentTable\getComponent().

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

◆ getComponent()

ILIAS\Skill\Table\ProfileUserAssignmentTable::getComponent ( )

Definition at line 73 of file class.ProfileUserAssignmentTable.php.

73 : UI\Component\Table\Data
74 {
75 $columns = $this->getColumns();
76 $actions = $this->getActions();
77 $data_retrieval = $this->getDataRetrieval();
78
79 if ($this->requested_table_profile_user_ass_action === "removeUsers") {
80 $items = [];
81 foreach ($this->requested_table_profile_user_ass_ids as $id) {
82 if ($id === "ALL_OBJECTS") {
83 $all_assignments = $this->profile_manager->getAssignments($this->profile->getId());
84 foreach ($all_assignments as $assignment) {
85 $items[] = $this->ui_fac->modal()->interruptiveItem()->standard(
86 (string) $assignment->getId(),
87 $this->getAssignmentTitle($assignment->getId())
88 );
89 }
90 } else {
91 $items[] = $this->ui_fac->modal()->interruptiveItem()->standard(
92 $id,
93 $this->getAssignmentTitle((int) $id)
94 );
95 }
96 }
97 echo($this->ui_ren->renderAsync([
98 $this->ui_fac->modal()->interruptive(
99 "",
100 empty($items) ? $this->lng->txt("no_checkbox") : $this->lng->txt("skmg_confirm_user_removal"),
101 $this->ctrl->getFormActionByClass("ilskillprofilegui", "removeUsers")
102 )
103 ->withAffectedItems($items)
104 ->withActionButtonLabel(empty($items) ? $this->lng->txt("ok") : $this->lng->txt("delete"))
105 ]));
106 exit();
107 }
108
109 $table = $this->ui_fac->table()
110 ->data($data_retrieval, $this->lng->txt("skmg_assigned_users"), $columns)
111 ->withId(
112 self::class . "_" .
113 $this->profile->getId()
114 )
115 ->withActions($actions)
116 ->withRequest($this->request);
117
118 return $table;
119 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
exit

References $id, exit, ILIAS\Skill\Table\ProfileUserAssignmentTable\getActions(), ILIAS\Skill\Table\ProfileUserAssignmentTable\getAssignmentTitle(), ILIAS\Skill\Table\ProfileUserAssignmentTable\getColumns(), ILIAS\Skill\Table\ProfileUserAssignmentTable\getDataRetrieval(), ILIAS\Repository\lng(), and ILIAS\Repository\profile().

+ Here is the call graph for this function:

◆ getDataRetrieval()

ILIAS\Skill\Table\ProfileUserAssignmentTable::getDataRetrieval ( )
protected

Definition at line 158 of file class.ProfileUserAssignmentTable.php.

158 : UI\Component\Table\DataRetrieval
159 {
160 $data_retrieval = new class (
163 ) implements UI\Component\Table\DataRetrieval {
164 use TableRecords;
165
166 public function __construct(
167 protected Profile\SkillProfile $profile,
168 protected Profile\SkillProfileManager $profile_manager
169 ) {
170 }
171
172 public function getRows(
173 UI\Component\Table\DataRowBuilder $row_builder,
174 array $visible_column_ids,
175 Data\Range $range,
176 Data\Order $order,
177 ?array $filter_data,
178 ?array $additional_parameters
179 ): \Generator {
180 $records = $this->getRecords($range, $order);
181 foreach ($records as $idx => $record) {
182 $row_id = $record["id"];
183
184 yield $row_builder->buildDataRow((string) $row_id, $record);
185 }
186 }
187
188 public function getTotalRowCount(
189 ?array $filter_data,
190 ?array $additional_parameters
191 ): ?int {
192 return count($this->getRecords());
193 }
194
195 protected function getRecords(?Data\Range $range = null, ?Data\Order $order = null): array
196 {
197 $assignments = $this->profile_manager->getAssignments($this->profile->getId());
198
199 $records = [];
200 $i = 0;
201 foreach ($assignments as $assignment) {
202 $records[$i]["id"] = $assignment->getId();
203 $records[$i]["type"] = $assignment->getType();
204 $records[$i]["name"] = $assignment->getName();
205 $records[$i]["object"] = ($assignment instanceof Profile\SkillProfileRoleAssignment)
206 ? $assignment->getObjTitle()
207 : "";
208
209 $i++;
210 }
211
212 if ($order) {
213 $records = $this->orderRecords($records, $order);
214 }
215
216 if ($range) {
217 $records = $this->limitRecords($records, $range);
218 }
219
220 return $records;
221 }
222 };
223
224 return $data_retrieval;
225 }
__construct(Profile\SkillProfile $profile, Access\SkillTreeAccess $tree_access_manager)
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ILIAS\Skill\Table\ProfileUserAssignmentTable\$profile, ILIAS\Skill\Table\ProfileUserAssignmentTable\$profile_manager, ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Skill\Table\ProfileUserAssignmentTable\__construct(), and ILIAS\Repository\profile().

Referenced by ILIAS\Skill\Table\ProfileUserAssignmentTable\getComponent().

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

Field Documentation

◆ $admin_gui_request

Service SkillAdminGUIRequest ILIAS\Skill\Table\ProfileUserAssignmentTable::$admin_gui_request
protected

Definition at line 43 of file class.ProfileUserAssignmentTable.php.

◆ $ctrl

ilCtrl ILIAS\Skill\Table\ProfileUserAssignmentTable::$ctrl
protected

Definition at line 36 of file class.ProfileUserAssignmentTable.php.

◆ $df

Data Factory ILIAS\Skill\Table\ProfileUserAssignmentTable::$df
protected

Definition at line 42 of file class.ProfileUserAssignmentTable.php.

◆ $lng

ilLanguage ILIAS\Skill\Table\ProfileUserAssignmentTable::$lng
protected

Definition at line 37 of file class.ProfileUserAssignmentTable.php.

◆ $profile

Profile SkillProfile ILIAS\Skill\Table\ProfileUserAssignmentTable::$profile
protected

◆ $profile_manager

Profile SkillProfileManager ILIAS\Skill\Table\ProfileUserAssignmentTable::$profile_manager
protected

◆ $query

ArrayBasedRequestWrapper ILIAS\Skill\Table\ProfileUserAssignmentTable::$query
protected

Definition at line 41 of file class.ProfileUserAssignmentTable.php.

◆ $request

ServerRequestInterface ILIAS\Skill\Table\ProfileUserAssignmentTable::$request
protected

Definition at line 40 of file class.ProfileUserAssignmentTable.php.

◆ $requested_table_profile_user_ass_action

string ILIAS\Skill\Table\ProfileUserAssignmentTable::$requested_table_profile_user_ass_action = ""
protected

Definition at line 47 of file class.ProfileUserAssignmentTable.php.

◆ $requested_table_profile_user_ass_ids

array ILIAS\Skill\Table\ProfileUserAssignmentTable::$requested_table_profile_user_ass_ids = []
protected

Definition at line 51 of file class.ProfileUserAssignmentTable.php.

◆ $tree_access_manager

Access SkillTreeAccess ILIAS\Skill\Table\ProfileUserAssignmentTable::$tree_access_manager
protected

◆ $ui_fac

UI Factory ILIAS\Skill\Table\ProfileUserAssignmentTable::$ui_fac
protected

Definition at line 38 of file class.ProfileUserAssignmentTable.php.

◆ $ui_ren

UI Renderer ILIAS\Skill\Table\ProfileUserAssignmentTable::$ui_ren
protected

Definition at line 39 of file class.ProfileUserAssignmentTable.php.


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