ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 54 of file class.ProfileUserAssignmentTable.php.

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().

55  {
56  global $DIC;
57 
58  $this->ctrl = $DIC->ctrl();
59  $this->lng = $DIC->language();
60  $this->ui_fac = $DIC->ui()->factory();
61  $this->ui_ren = $DIC->ui()->renderer();
62  $this->request = $DIC->http()->request();
63  $this->query = $DIC->http()->wrapper()->query();
64  $this->df = new Data\Factory();
65  $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
66 
67  $this->profile = $profile;
68  $this->tree_access_manager = $tree_access_manager;
69  $this->profile_manager = $DIC->skills()->internal()->manager()->getProfileManager();
70  $this->requested_table_profile_user_ass_action = $this->admin_gui_request->getTableProfileUserAssignmentAction();
71  $this->requested_table_profile_user_ass_ids = $this->admin_gui_request->getTableProfileUserAssignmentIds();
72  }
global $DIC
Definition: feed.php:28
+ 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 134 of file class.ProfileUserAssignmentTable.php.

References ILIAS\Repository\lng(), and ILIAS\Repository\profile().

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

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

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

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

228  : string
229  {
230  $type = \ilObject::_lookupType($obj_id);
231  switch ($type) {
232  case "usr":
233  $ass_title = \ilUserUtil::getNamePresentation($obj_id);
234  break;
235 
236  case "role":
237  $ass_title = \ilObjRole::_lookupTitle($obj_id);
238  break;
239 
240  default:
241  $ass_title = $this->lng->txt("not_available");
242  }
243 
244  return $ass_title;
245  }
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='ilpublicuserprofilegui')
Default behaviour is:
static _lookupTitle(int $obj_id)
static _lookupType(int $id, bool $reference=false)
+ 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 122 of file class.ProfileUserAssignmentTable.php.

References ILIAS\Repository\lng().

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

122  : array
123  {
124  $columns = [
125  "type" => $this->ui_fac->table()->column()->text($this->lng->txt("type"))
126  ->withIsSortable(false),
127  "name" => $this->ui_fac->table()->column()->text($this->lng->txt("name")),
128  "object" => $this->ui_fac->table()->column()->text($this->lng->txt("object"))
129  ];
130 
131  return $columns;
132  }
+ 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 74 of file class.ProfileUserAssignmentTable.php.

References $id, ILIAS\Repository\ctrl(), 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().

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

◆ getDataRetrieval()

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

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

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().

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

◆ $ctrl

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

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

◆ $df

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

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

◆ $lng

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

Definition at line 38 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 42 of file class.ProfileUserAssignmentTable.php.

◆ $request

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

Definition at line 41 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 48 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 52 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 39 of file class.ProfileUserAssignmentTable.php.

◆ $ui_ren

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

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


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