ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
ContProfileTableBuilder.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
21 namespace ILIAS\Container\Skills;
22 
27 
29 {
30  public function __construct(
31  protected SkillInternalManagerService $manager_service,
32  protected SkillProfileService $profile_service,
33  protected \ilSkillManagementSettings $skmg_settings,
34  protected int $cont_ref_id,
35  protected int $cont_member_role_id,
36  object $parent_gui,
37  string $parent_cmd
38  ) {
39  parent::__construct($parent_gui, $parent_cmd);
40  }
41 
42  protected function getId(): string
43  {
44  return "cont_profile";
45  }
46 
47  protected function getTitle(): string
48  {
49  global $DIC;
50  return $DIC->language()->txt("cont_skill_ass_profiles");
51  }
52 
53  protected function getRetrieval(): RetrievalInterface
54  {
55  return $this->manager_service->contProfileRetrieval(
56  $this->profile_service,
57  $this->skmg_settings,
58  $this->cont_member_role_id
59  );
60  }
61 
62  protected function transformRow(array $data_row): array
63  {
64  global $DIC;
65  $lng = $DIC->language();
66 
67  if ($this->profile_service->lookupProfileRefId($data_row["profile_id"]) > 0) {
68  $context = $lng->txt("skmg_context_local");
69  } else {
70  $context = $lng->txt("skmg_context_global");
71  }
72 
73  return [
74  "id" => $data_row["profile_id"],
75  "title" => $data_row["title"],
76  "context" => $context
77  ];
78  }
79 
80  protected function activeAction(string $action, array $data_row): bool
81  {
82  switch ($action) {
83  case "confirmDeleteSingleLocalProfile":
84  case "editProfile":
85  return ($data_row["profile_ref_id"] > 0);
86  case "confirmRemoveSingleGlobalProfile":
87  return ($data_row["profile_ref_id"] === 0);
88  }
89  return true;
90  }
91 
93  {
94  global $DIC;
95  $lng = $DIC->language();
96 
97  $table = $table
98  ->textColumn("title", $lng->txt("cont_skill_profile"))
99  ->textColumn("context", $lng->txt("context"));
100 
101  $DIC->ctrl()->setParameterByClass("ilskillprofilegui", "local_context", true);
102 
103  // Add single actions for different profile types
104  $table = $table
106  "editProfile",
107  $lng->txt("edit"),
108  ["ilSkillProfileGUI"],
109  "showLevelsWithLocalContext",
110  "sprof_id"
111  )
112  ->singleAction(
113  "confirmDeleteSingleLocalProfile",
114  $lng->txt("delete")
115  )
116  ->singleAction(
117  "confirmRemoveSingleGlobalProfile",
118  $lng->txt("remove")
119  );
120 
121  return $table;
122  }
123 }
singleRedirectAction(string $action, string $title, array $class_path, string $cmd="", string $id_param="")
$context
Definition: webdav.php:31
textColumn(string $key, string $title, bool $sortable=false)
global $DIC
Definition: shib_login.php:26
__construct(Container $dic, ilPlugin $plugin)
global $lng
Definition: privfeed.php:31
__construct(protected SkillInternalManagerService $manager_service, protected SkillProfileService $profile_service, protected \ilSkillManagementSettings $skmg_settings, protected int $cont_ref_id, protected int $cont_member_role_id, object $parent_gui, string $parent_cmd)