ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 34 of file class.ProfileTable.php.

Constructor & Destructor Documentation

◆ __construct()

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

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

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->tree_access_manager = $DIC->skills()->internal()->manager()->getTreeAccessManager($ref_id);
66 $this->profile_manager = $DIC->skills()->internal()->manager()->getProfileManager();
67 $this->admin_gui_request = $DIC->skills()->internal()->gui()->admin_request();
68 $this->requested_table_profile_action = $this->admin_gui_request->getTableProfileAction();
69 $this->requested_table_profile_ids = $this->admin_gui_request->getTableProfileIds();
70 $this->skill_tree_id = $skill_tree_id;
71 }
$ref_id
Definition: ltiauth.php:66
global $DIC
Definition: shib_login.php:26

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

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

+ 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 138 of file class.ProfileTable.php.

138 : array
139 {
140 $query_params_namespace = ["skl_profile_table"];
141
142 $url_builder_delete = new UI\URLBuilder($this->df->uri($this->request->getUri()->__toString()));
143 list($url_builder_delete, $action_parameter_token_delete, $row_id_token_delete) =
144 $url_builder_delete->acquireParameters(
145 $query_params_namespace,
146 "action",
147 "profile_ids"
148 );
149
150 $uri_export = $this->df->uri(
151 ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTargetByClass("ilskillprofilegui", "exportProfiles")
152 );
153 $url_builder_export = new UI\URLBuilder($uri_export);
154 list($url_builder_export, $action_parameter_token_export, $row_id_token_export) =
155 $url_builder_export->acquireParameters(
156 $query_params_namespace,
157 "action",
158 "profile_ids"
159 );
160
161 $actions = [];
162 if ($this->tree_access_manager->hasManageProfilesPermission()) {
163 $actions["delete"] = $this->ui_fac->table()->action()->multi(
164 $this->lng->txt("delete"),
165 $url_builder_delete->withParameter($action_parameter_token_delete, "deleteProfiles"),
166 $row_id_token_delete
167 )
168 ->withAsync();
169 $actions["export"] = $this->ui_fac->table()->action()->multi(
170 $this->lng->txt("export"),
171 $url_builder_export->withParameter($action_parameter_token_export, "exportProfiles"),
172 $row_id_token_export
173 );
174 }
175
176 return $actions;
177 }

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

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

+ 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 123 of file class.ProfileTable.php.

123 : array
124 {
125 $columns = [
126 "title" => $this->ui_fac->table()->column()->link($this->lng->txt("title")),
127 "context" => $this->ui_fac->table()->column()->text($this->lng->txt("context"))
128 ->withIsSortable(false),
129 "users" => $this->ui_fac->table()->column()->text($this->lng->txt("users"))
130 ->withIsSortable(false),
131 "roles" => $this->ui_fac->table()->column()->text($this->lng->txt("roles"))
132 ->withIsSortable(false),
133 ];
134
135 return $columns;
136 }

References ILIAS\Repository\lng().

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

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

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

+ Here is the call graph for this function:

◆ getDataRetrieval()

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

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

179 : UI\Component\Table\DataRetrieval
180 {
181 $data_retrieval = new class (
187 ) implements UI\Component\Table\DataRetrieval {
188 use TableRecords;
189
190 public function __construct(
191 protected \ilLanguage $lng,
192 protected int $skill_tree_id,
193 protected Profile\SkillProfileManager $skill_profile_manager,
194 protected UI\Factory $ui_fac,
195 protected \ilCtrl $ctrl
196 ) {
197 }
198
199 public function getRows(
200 UI\Component\Table\DataRowBuilder $row_builder,
201 array $visible_column_ids,
202 Data\Range $range,
203 Data\Order $order,
204 ?array $filter_data,
205 ?array $additional_parameters
206 ): \Generator {
207 $records = $this->getRecords($range, $order);
208 foreach ($records as $idx => $record) {
209 $row_id = (string) $record["profile_id"];
210
211 yield $row_builder->buildDataRow($row_id, $record);
212 }
213 }
214
215 public function getTotalRowCount(
216 ?array $filter_data,
217 ?array $additional_parameters
218 ): ?int {
219 return count($this->getRecords());
220 }
221
222 protected function getRecords(?Data\Range $range = null, ?Data\Order $order = null): array
223 {
224 if ($this->skill_tree_id) {
225 $profiles = $this->skill_profile_manager->getProfilesForSkillTree($this->skill_tree_id);
226 } else {
227 $profiles = $this->skill_profile_manager->getProfilesForAllSkillTrees();
228 }
229
230 $records = [];
231 $i = 0;
232 foreach ($profiles as $profile) {
233 $records[$i]["profile_id"] = $profile->getId();
234 $this->ctrl->setParameterByClass("ilskillprofilegui", "sprof_id", $profile->getId());
235 $records[$i]["title"] = $this->ui_fac->link()->standard(
236 $profile->getTitle(),
237 $this->ctrl->getLinkTargetByClass("ilskillprofilegui", "showLevels")
238 );
239 $this->ctrl->clearParameterByClass("ilskillprofilegui", "sprof_id");
240 $profile_ref_id = $this->skill_profile_manager->lookupRefId($profile->getId());
241 $profile_obj_id = \ilContainerReference::_lookupObjectId($profile_ref_id);
242 $profile_obj_title = \ilObject::_lookupTitle($profile_obj_id);
243 if ($profile_ref_id > 0) {
244 $records[$i]["context"] = $this->lng->txt("skmg_context_local") . " (" . $profile_obj_title . ")";
245 } else {
246 $records[$i]["context"] = $this->lng->txt("skmg_context_global");
247 }
248 $records[$i]["users"] = $this->skill_profile_manager->countUsers($profile->getId());
249 $records[$i]["roles"] = $this->skill_profile_manager->countRoles($profile->getId());
250 $i++;
251 }
252
253 if ($order) {
254 $records = $this->orderRecords($records, $order);
255 }
256
257 if ($range) {
258 $records = $this->limitRecords($records, $range);
259 }
260
261 return $records;
262 }
263 };
264
265 return $data_retrieval;
266 }
__construct(int $ref_id, int $skill_tree_id)
Profile SkillProfileManager $profile_manager
Class ilCtrl provides processing control methods.
language handling
static _lookupObjectId(int $ref_id)
static _lookupTitle(int $obj_id)
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\ProfileTable\$ctrl, 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\$ui_fac, ILIAS\Skill\Table\ProfileTable\__construct(), ilObject\_lookupObjectId(), ilObject\_lookupTitle(), ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by ILIAS\Skill\Table\ProfileTable\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\ProfileTable::$admin_gui_request
protected

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

◆ $ctrl

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

◆ $df

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

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

◆ $request

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

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

◆ $requested_table_profile_action

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

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

◆ $requested_table_profile_ids

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

Definition at line 51 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 43 of file class.ProfileTable.php.

◆ $ui_fac

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

◆ $ui_ren

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

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


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