ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ContSkillTableBuilder.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
26
28{
29 public function __construct(
30 protected SkillInternalManagerService $manager_service,
31 protected ContainerSkillManager $cont_skill_manager,
32 protected int $container_obj_id,
33 protected int $container_ref_id,
34 object $parent_gui,
35 string $parent_cmd
36 ) {
37 parent::__construct($parent_gui, $parent_cmd, false);
38 }
39
40 protected function getId(): string
41 {
42 return "cont_skill";
43 }
44
45 protected function getTitle(): string
46 {
47 global $DIC;
48 return $DIC->language()->txt("cont_cont_skills");
49 }
50
51 protected function getRetrieval(): RetrievalInterface
52 {
53 return $this->manager_service->contSkillRetrieval(
54 $this->cont_skill_manager
55 );
56 }
57
58 protected function transformRow(array $data_row): array
59 {
60 $path = $this->parent_gui->getPathString($data_row["base_skill_id"], $data_row["tref_id"]);
61
62 return [
63 "id" => $data_row["base_skill_id"] . ":" . $data_row["tref_id"],
64 "title" => $data_row["title"],
65 "path" => $path,
66 "profile_title" => $data_row["profile_title"] ?? "",
67 "base_skill_id" => $data_row["base_skill_id"],
68 "tref_id" => $data_row["tref_id"],
69 "has_profile" => isset($data_row["profile_title"])
70 ];
71 }
72
73 protected function activeAction(string $action, array $data_row): bool
74 {
75 switch ($action) {
76 case "confirmRemoveSelectedSkill":
77 // Only allow removal for skills without profile
78 return !isset($data_row["profile_title"]);
79 }
80 return true;
81 }
82
84 {
85 global $DIC;
86 $lng = $DIC->language();
87
89 ->textColumn("title", $lng->txt("cont_skill"))
90 ->textColumn("path", $lng->txt("cont_path"))
91 ->textColumn("profile_title", $lng->txt("cont_skill_profile"));
92
93 // Add multi command for removing skills
95 "confirmRemoveSelectedSkill",
96 $lng->txt("remove")
97 );
98
99 return $table;
100 }
101}
activeAction(string $action, array $data_row)
transformRow(array $data_row)
transform raw data array to table row data array
__construct(protected SkillInternalManagerService $manager_service, protected ContainerSkillManager $cont_skill_manager, protected int $container_obj_id, protected int $container_ref_id, object $parent_gui, string $parent_cmd)
textColumn(string $key, string $title, bool $sortable=false)
singleAction(string $action, string $title, bool $async=false)
$path
Definition: ltiservices.php:30
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26