ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\Skill\Table\ProfileTable Class Reference
+ Collaboration diagram for ILIAS\Skill\Table\ProfileTable:

Public Member Functions

 __construct (int $ref_id, int $skill_tree_id)
 
 getComponent ()
 

Protected Member Functions

 getColumns ()
 
 getActions ()
 
 getDataRetrieval ()
 

Protected Attributes

ilCtrl $ctrl
 
ilLanguage $lng
 
UI Factory $ui_fac
 
UI Renderer $ui_ren
 
ServerRequestInterface $request
 
ArrayBasedRequestWrapper $query
 
Data Factory $df
 
Access SkillTreeAccess $tree_access_manager
 
Profile SkillProfileManager $profile_manager
 
Service SkillAdminGUIRequest $admin_gui_request
 
string $requested_table_profile_action = ""
 
array $requested_table_profile_ids = []
 
int $skill_tree_id = 0
 

Detailed Description

Author
Thomas Famula famul.nosp@m.a@le.nosp@m.ifos..nosp@m.de

Definition at line 35 of file class.ProfileTable.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Skill\Table\ProfileTable::__construct ( int  $ref_id,
int  $skill_tree_id 
)

Definition at line 55 of file class.ProfileTable.php.

References $DIC, ILIAS\Skill\Table\ProfileTable\$skill_tree_id, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

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

56  {
57  global $DIC;
58 
59  $this->ctrl = $DIC->ctrl();
60  $this->lng = $DIC->language();
61  $this->ui_fac = $DIC->ui()->factory();
62  $this->ui_ren = $DIC->ui()->renderer();
63  $this->request = $DIC->http()->request();
64  $this->query = $DIC->http()->wrapper()->query();
65  $this->df = new Data\Factory();
66  $this->tree_access_manager = $DIC->skills()->internal()->manager()->getTreeAccessManager($ref_id);
67  $this->profile_manager = $DIC->skills()->internal()->manager()->getProfileManager();
68  $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
69  $this->requested_table_profile_action = $this->admin_gui_request->getTableProfileAction();
70  $this->requested_table_profile_ids = $this->admin_gui_request->getTableProfileIds();
71  $this->skill_tree_id = $skill_tree_id;
72  }
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ getActions()

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

Definition at line 139 of file class.ProfileTable.php.

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

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

139  : array
140  {
141  $query_params_namespace = ["skl_profile_table"];
142 
143  $uri_edit = $this->df->uri(
144  ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTargetByClass("ilskillprofilegui", "showLevelsWithTableContext")
145  );
146  $url_builder_edit = new UI\URLBuilder($uri_edit);
147  list($url_builder_edit, $action_parameter_token_edit, $row_id_token_edit) =
148  $url_builder_edit->acquireParameters(
149  $query_params_namespace,
150  "action",
151  "profile_ids"
152  );
153 
154  $url_builder_delete = new UI\URLBuilder($this->df->uri($this->request->getUri()->__toString()));
155  list($url_builder_delete, $action_parameter_token_delete, $row_id_token_delete) =
156  $url_builder_delete->acquireParameters(
157  $query_params_namespace,
158  "action",
159  "profile_ids"
160  );
161 
162  $uri_export = $this->df->uri(
163  ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTargetByClass("ilskillprofilegui", "exportProfiles")
164  );
165  $url_builder_export = new UI\URLBuilder($uri_export);
166  list($url_builder_export, $action_parameter_token_export, $row_id_token_export) =
167  $url_builder_export->acquireParameters(
168  $query_params_namespace,
169  "action",
170  "profile_ids"
171  );
172 
173  $actions = [
174  "edit" => $this->ui_fac->table()->action()->single(
175  $this->tree_access_manager->hasManageProfilesPermission() ? $this->lng->txt("edit") : $this->lng->txt("show"),
176  $url_builder_edit->withParameter($action_parameter_token_edit, "editProfile"),
177  $row_id_token_edit
178  )
179  ];
180  if ($this->tree_access_manager->hasManageProfilesPermission()) {
181  $actions["delete"] = $this->ui_fac->table()->action()->multi(
182  $this->lng->txt("delete"),
183  $url_builder_delete->withParameter($action_parameter_token_delete, "deleteProfiles"),
184  $row_id_token_delete
185  )
186  ->withAsync();
187  $actions["export"] = $this->ui_fac->table()->action()->multi(
188  $this->lng->txt("export"),
189  $url_builder_export->withParameter($action_parameter_token_export, "exportProfiles"),
190  $row_id_token_export
191  );
192  }
193 
194  return $actions;
195  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColumns()

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

Definition at line 124 of file class.ProfileTable.php.

References ILIAS\Repository\lng().

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

124  : array
125  {
126  $columns = [
127  "title" => $this->ui_fac->table()->column()->text($this->lng->txt("title")),
128  "context" => $this->ui_fac->table()->column()->text($this->lng->txt("context"))
129  ->withIsSortable(false),
130  "users" => $this->ui_fac->table()->column()->text($this->lng->txt("users"))
131  ->withIsSortable(false),
132  "roles" => $this->ui_fac->table()->column()->text($this->lng->txt("roles"))
133  ->withIsSortable(false),
134  ];
135 
136  return $columns;
137  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getComponent()

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

Definition at line 74 of file class.ProfileTable.php.

References $id, ILIAS\Repository\ctrl(), exit, ILIAS\Skill\Table\ProfileTable\getActions(), ILIAS\Skill\Table\ProfileTable\getColumns(), ILIAS\Skill\Table\ProfileTable\getDataRetrieval(), and ILIAS\Repository\lng().

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_action === "deleteProfiles") {
81  $items = [];
82  foreach ($this->requested_table_profile_ids as $id) {
83  if ($id === "ALL_OBJECTS") {
84  $profiles = $this->skill_tree_id
85  ? $this->profile_manager->getProfilesForSkillTree($this->skill_tree_id)
86  : $this->profile_manager->getProfilesForAllSkillTrees();
87  foreach ($profiles as $profile) {
88  $items[] = $this->ui_fac->modal()->interruptiveItem()->standard(
89  (string) $profile->getId(),
90  $profile->getTitle()
91  );
92  }
93  } else {
94  $items[] = $this->ui_fac->modal()->interruptiveItem()->standard(
95  $id,
96  $this->profile_manager->lookupTitle((int) $id)
97  );
98  }
99  }
100  echo($this->ui_ren->renderAsync([
101  $this->ui_fac->modal()->interruptive(
102  "",
103  empty($items) ? $this->lng->txt("no_checkbox") : $this->lng->txt("skmg_delete_profiles"),
104  $this->ctrl->getFormActionByClass("ilskillprofilegui", "deleteProfiles")
105  )
106  ->withAffectedItems($items)
107  ->withActionButtonLabel(empty($items) ? $this->lng->txt("ok") : $this->lng->txt("delete"))
108  ]));
109  exit();
110  }
111 
112  $table = $this->ui_fac->table()
113  ->data($this->lng->txt("skmg_skill_profiles"), $columns, $data_retrieval)
114  ->withId(
115  self::class . "_" .
116  $this->skill_tree_id
117  )
118  ->withActions($actions)
119  ->withRequest($this->request);
120 
121  return $table;
122  }
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\ProfileTable::getDataRetrieval ( )
protected

Definition at line 197 of file class.ProfileTable.php.

References ILIAS\Skill\Table\ProfileTable\$lng, ILIAS\Skill\Table\ProfileTable\$profile_manager, ILIAS\UI\Implementation\Component\Table\$range, ILIAS\Skill\Table\ProfileTable\$skill_tree_id, ILIAS\Skill\Table\ProfileTable\__construct(), ilObject\_lookupObjectId(), ilObject\_lookupTitle(), and ILIAS\Repository\lng().

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

197  : UI\Component\Table\DataRetrieval
198  {
199  $data_retrieval = new class (
200  $this->lng,
203  ) implements UI\Component\Table\DataRetrieval {
204  use TableRecords;
205 
206  public function __construct(
207  protected \ilLanguage $lng,
208  protected int $skill_tree_id,
209  protected Profile\SkillProfileManager $skill_profile_manager
210  ) {
211  }
212 
213  public function getRows(
214  UI\Component\Table\DataRowBuilder $row_builder,
215  array $visible_column_ids,
216  Data\Range $range,
217  Data\Order $order,
218  ?array $filter_data,
219  ?array $additional_parameters
220  ): \Generator {
221  $records = $this->getRecords($range, $order);
222  foreach ($records as $idx => $record) {
223  $row_id = (string) $record["profile_id"];
224 
225  yield $row_builder->buildDataRow($row_id, $record);
226  }
227  }
228 
229  public function getTotalRowCount(
230  ?array $filter_data,
231  ?array $additional_parameters
232  ): ?int {
233  return count($this->getRecords());
234  }
235 
236  protected function getRecords(Data\Range $range = null, Data\Order $order = null): array
237  {
238  if ($this->skill_tree_id) {
239  $profiles = $this->skill_profile_manager->getProfilesForSkillTree($this->skill_tree_id);
240  } else {
241  $profiles = $this->skill_profile_manager->getProfilesForAllSkillTrees();
242  }
243 
244  $records = [];
245  $i = 0;
246  foreach ($profiles as $profile) {
247  $records[$i]["profile_id"] = $profile->getId();
248  $records[$i]["title"] = $profile->getTitle();
249  $profile_ref_id = $this->skill_profile_manager->lookupRefId($profile->getId());
250  $profile_obj_id = \ilContainerReference::_lookupObjectId($profile_ref_id);
251  $profile_obj_title = \ilObject::_lookupTitle($profile_obj_id);
252  if ($profile_ref_id > 0) {
253  $records[$i]["context"] = $this->lng->txt("skmg_context_local") . " (" . $profile_obj_title . ")";
254  } else {
255  $records[$i]["context"] = $this->lng->txt("skmg_context_global");
256  }
257  $records[$i]["users"] = $this->skill_profile_manager->countUsers($profile->getId());
258  $records[$i]["roles"] = $this->skill_profile_manager->countRoles($profile->getId());
259  $i++;
260  }
261 
262  if ($order) {
263  $records = $this->orderRecords($records, $order);
264  }
265 
266  if ($range) {
267  $records = $this->limitRecords($records, $range);
268  }
269 
270  return $records;
271  }
272  };
273 
274  return $data_retrieval;
275  }
Profile SkillProfileManager $profile_manager
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupTitle(int $obj_id)
static _lookupObjectId(int $ref_id)
__construct(int $ref_id, int $skill_tree_id)
+ 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\ProfileTable::$admin_gui_request
protected

Definition at line 46 of file class.ProfileTable.php.

◆ $ctrl

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

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

◆ $df

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

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

◆ $lng

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

◆ $profile_manager

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

◆ $query

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

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

◆ $request

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

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

◆ $requested_table_profile_action

string ILIAS\Skill\Table\ProfileTable::$requested_table_profile_action = ""
protected

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

◆ $requested_table_profile_ids

array ILIAS\Skill\Table\ProfileTable::$requested_table_profile_ids = []
protected

Definition at line 52 of file class.ProfileTable.php.

◆ $skill_tree_id

int ILIAS\Skill\Table\ProfileTable::$skill_tree_id = 0
protected

◆ $tree_access_manager

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

Definition at line 44 of file class.ProfileTable.php.

◆ $ui_fac

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

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

◆ $ui_ren

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

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


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