3 declare(strict_types=1);
36 protected \ilLanguage
$lng;
50 public function __construct(
int $top_skill_id,
int $tref_id,
int $basic_skill_id)
54 $this->
ctrl = $DIC->ctrl();
55 $this->
lng = $DIC->language();
56 $this->
user = $DIC->user();
57 $this->ui_fac = $DIC->ui()->factory();
58 $this->request = $DIC->http()->request();
60 $this->ws_tree = new \ilWorkspaceTree($this->
user->getId());
61 if (!$this->ws_tree->readRootId()) {
62 $this->ws_tree->createTreeForUser($this->
user->getId());
64 $this->ws_access = new \ilWorkspaceAccessHandler();
70 $this->tree_repo = $DIC->skills()->internal()->repo()->getTreeRepo();
71 $tree_id = $this->tree_repo->getTreeIdForNodeId($this->basic_skill_id);
72 $this->node_manager = $DIC->skills()->internal()->manager()->getTreeNodeManager($tree_id);
73 $this->assigned_material_manager = $DIC->skills()->internal()->manager()->getAssignedMaterialManager();
82 $title = $this->node_manager->getWrittenPath($this->basic_skill_id);
83 $table = $this->ui_fac->table()
84 ->data($title, $columns, $data_retrieval)
87 $this->top_skill_id .
"_" .
88 $this->tref_id .
"_" .
91 ->withActions($actions)
92 ->withRequest($this->request);
100 "title" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"skmg_skill_level"))
101 ->withIsSortable(
false),
102 "description" => $this->ui_fac->table()->column()->text($this->
lng->txt(
"description"))
103 ->withIsSortable(
false),
104 "resources" => $this->ui_fac->table()->column()->linkListing($this->
lng->txt(
"skmg_materials"))
105 ->withIsSortable(
false)
113 $query_params_namespace = [
"skl_assign_materials_table"];
115 $uri_assign = $this->df->uri(
116 ILIAS_HTTP_PATH .
"/" . $this->
ctrl->getLinkTargetByClass(
117 "ilpersonalskillsgui",
121 $url_builder_assign =
new UI\URLBuilder($uri_assign);
122 list($url_builder_assign, $action_parameter_token_assign, $row_id_token_assign) =
123 $url_builder_assign->acquireParameters(
124 $query_params_namespace,
130 "assign" => $this->ui_fac->table()->action()->single(
131 $this->
lng->txt(
"skmg_assign_materials"),
132 $url_builder_assign->withParameter($action_parameter_token_assign,
"assignMaterials"),
137 foreach ($this->assigned_material_manager->getAllAssignedMaterialsForSkill(
138 $this->user->getId(),
142 $obj_id = $this->ws_tree->lookupObjectId($material->getWorkspaceId());
144 $uri_remove = $this->df->uri(
145 ILIAS_HTTP_PATH .
"/" . $this->
ctrl->getLinkTargetByClass(
146 "ilpersonalskillsgui",
150 $url_builder_remove =
new UI\URLBuilder($uri_remove);
151 list($url_builder_remove, $action_parameter_token_remove, $row_id_token_remove, $wsp_token_remove) =
152 $url_builder_remove->acquireParameters(
153 $query_params_namespace,
158 $url_builder_remove = $url_builder_remove->withParameter($wsp_token_remove, (
string) $material->getWorkspaceId());
160 $actions[
"remove_" . $material->getLevelId() .
"_" . $material->getWorkspaceId()] =
161 $this->ui_fac->table()->action()->single(
163 $url_builder_remove->withParameter($action_parameter_token_remove,
"removeMaterial"),
173 $data_retrieval =
new class (
185 protected int $basic_skill_id,
186 protected int $tref_id,
195 public function getRows(
197 array $visible_column_ids,
201 ?array $additional_parameters
203 $records = $this->getRecords($range);
204 foreach ($records as $idx => $record) {
205 $row_id = $record[
"id"];
206 $res_ids = $record[
"res_ids"];
208 $data_row = $row_builder->buildDataRow((
string) $row_id, $record);
209 foreach ($this->assigned_material_manager->getAllAssignedMaterialsForSkill(
210 $this->user->getId(),
214 if (!in_array($material->getWorkspaceId(), $res_ids) || $row_id != $material->getLevelId()) {
215 $data_row = $data_row->withDisabledAction(
216 "remove_" . $material->getLevelId() .
"_" . $material->getWorkspaceId()
225 public function getTotalRowCount(
227 ?array $additional_parameters
229 return count($this->getRecords());
232 protected function getRecords(
Data\
Range $range = null): array
237 foreach ($skill->getLevelData() as $level) {
238 $records[$i][
"id"] = $level[
"id"];
239 $records[$i][
"title"] = $level[
"title"];
240 $records[$i][
"description"] = $level[
"description"];
242 $materials = $this->assigned_material_manager->getAssignedMaterials(
243 $this->user->getId(),
249 foreach ($materials as $m) {
250 $wsp_ids[] = $m->getWorkspaceId();
251 $obj_id = $this->ws_tree->lookupObjectId($m->getWorkspaceId());
252 $obj_links[] = $this->ui_fac->link()->standard(
254 $this->ws_access->getGotoLink($m->getWorkspaceId(), $obj_id)
257 $records[$i][
"res_ids"] = $wsp_ids;
258 $records[$i][
"resources"] = $this->ui_fac->listing()->unordered($obj_links);
264 $records = $this->limitRecords($records, $range);
271 return $data_retrieval;
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(int $top_skill_id, int $tref_id, int $basic_skill_id)
static getInstance(int $a_id=0)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Personal AssignedMaterialManager $assigned_material_manager
Both the subject and the direction need to be specified when expressing an order. ...
static _lookupTitle(int $obj_id)
ilSkillTreeRepository $tree_repo
Node SkillTreeNodeManager $node_manager
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
A simple class to express a range of whole positive numbers.
ServerRequestInterface $request
ilWorkspaceAccessHandler $ws_access
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...