Skip to content

Commit

Permalink
41589: Personal Resources should be Link Listing inside the Data Table
Browse files Browse the repository at this point in the history
  • Loading branch information
tfamula committed Jun 24, 2024
1 parent 677ff13 commit 6d34e45
Showing 1 changed file with 13 additions and 24 deletions.
37 changes: 13 additions & 24 deletions Services/Skill/Table/classes/class.AssignMaterialsTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected function getColumns(): array
->withIsSortable(false),
"description" => $this->ui_fac->table()->column()->text($this->lng->txt("description"))
->withIsSortable(false),
"resources" => $this->ui_fac->table()->column()->text($this->lng->txt("skmg_materials"))
"resources" => $this->ui_fac->table()->column()->linkListing($this->lng->txt("skmg_materials"))
->withIsSortable(false)
];

Expand Down Expand Up @@ -141,15 +141,6 @@ protected function getActions(): array
) as $material) {
$obj_id = $this->ws_tree->lookupObjectId($material->getWorkspaceId());

$uri_open = $this->df->uri($this->ws_access->getGotoLink($material->getWorkspaceId(), $obj_id));
$url_builder_open = new UI\URLBuilder($uri_open);
list($url_builder_open, $action_parameter_token_open, $row_id_token_open) =
$url_builder_open->acquireParameters(
$query_params_namespace,
"action",
"level_ids"
);

$uri_remove = $this->df->uri(
ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTargetByClass(
"ilpersonalskillsgui",
Expand All @@ -166,12 +157,6 @@ protected function getActions(): array
);
$url_builder_remove = $url_builder_remove->withParameter($wsp_token_remove, (string) $material->getWorkspaceId());

$actions["open_" . $material->getLevelId() . "_" . $material->getWorkspaceId()] =
$this->ui_fac->table()->action()->single(
$this->lng->txt("skmg_open") . " '" . \ilObject::_lookupTitle($obj_id) . "'",
$url_builder_open,
$row_id_token_open
);
$actions["remove_" . $material->getLevelId() . "_" . $material->getWorkspaceId()] =
$this->ui_fac->table()->action()->single(
$this->lng->txt("skmg_remove") . " '" . \ilObject::_lookupTitle($obj_id) . "'",
Expand All @@ -190,7 +175,9 @@ protected function getDataRetrieval(): UI\Component\Table\DataRetrieval
$this->tref_id,
$this->user,
$this->ws_tree,
$this->assigned_material_manager
$this->assigned_material_manager,
$this->ui_fac,
$this->ws_access
) implements UI\Component\Table\DataRetrieval {
use TableRecords;

Expand All @@ -199,7 +186,9 @@ public function __construct(
protected int $tref_id,
protected \ilObjUser $user,
protected \ilWorkspaceTree $ws_tree,
protected Personal\AssignedMaterialManager $assigned_material_manager
protected Personal\AssignedMaterialManager $assigned_material_manager,
protected UI\Factory $ui_fac,
protected \ilWorkspaceAccessHandler $ws_access
) {
}

Expand All @@ -223,9 +212,6 @@ public function getRows(
$this->tref_id,
) as $material) {
if (!in_array($material->getWorkspaceId(), $res_ids) || $row_id != $material->getLevelId()) {
$data_row = $data_row->withDisabledAction(
"open_" . $material->getLevelId() . "_" . $material->getWorkspaceId()
);
$data_row = $data_row->withDisabledAction(
"remove_" . $material->getLevelId() . "_" . $material->getWorkspaceId()
);
Expand Down Expand Up @@ -259,14 +245,17 @@ protected function getRecords(Data\Range $range = null): array
(int) $level["id"]
);
$wsp_ids = [];
$obj_titles = [];
$obj_links = [];
foreach ($materials as $m) {
$wsp_ids[] = $m->getWorkspaceId();
$obj_id = $this->ws_tree->lookupObjectId($m->getWorkspaceId());
$obj_titles[] = \ilObject::_lookupTitle($obj_id);
$obj_links[] = $this->ui_fac->link()->standard(
\ilObject::_lookupTitle($obj_id),
$this->ws_access->getGotoLink($m->getWorkspaceId(), $obj_id)
);
}
$records[$i]["res_ids"] = $wsp_ids;
$records[$i]["resources"] = implode(", ", $obj_titles);
$records[$i]["resources"] = $this->ui_fac->listing()->unordered($obj_links);

$i++;
}
Expand Down

0 comments on commit 6d34e45

Please sign in to comment.