ILIAS  release_8 Revision v8.24
class.ilSkillUsageTableGUI.php
Go to the documentation of this file.
1<?php
2
21
28{
33 protected int $skill_id = 0;
34 protected int $tref_id = 0;
35
36 public function __construct($a_parent_obj, string $a_parent_cmd, string $a_cskill_id, array $a_usage, $a_mode = "")
37 {
38 global $DIC;
39
40 $this->ctrl = $DIC->ctrl();
41 $this->lng = $DIC->language();
42 $this->access = $DIC->access();
43 $ilCtrl = $DIC->ctrl();
44
45 $this->tree_repo = $DIC->skills()->internal()->repo()->getTreeRepo();
46 $this->tree_factory = $DIC->skills()->internal()->factory()->tree();
47 $this->tree_manager = $DIC->skills()->internal()->manager()->getTreeManager();
48
49 $id_parts = explode(":", $a_cskill_id);
50 $this->skill_id = (int) $id_parts[0];
51 $this->tref_id = (int) $id_parts[1];
52
53 $data = [];
54 foreach ($a_usage as $k => $v) {
55 $data[] = array("type" => $k, "usages" => $v);
56 }
57
58 parent::__construct($a_parent_obj, $a_parent_cmd);
59 $this->setData($data);
60
61 $tree = $this->tree_repo->getTreeForNodeId($this->skill_id);
62 if ($a_mode == "tree") {
63 $tree_obj = $this->tree_manager->getTree($tree->getTreeId());
64 $title = $tree_obj->getTitle() . " > " . ilSkillTreeNode::_lookupTitle($this->skill_id, $this->tref_id);
65 $this->setTitle($title);
66 } else {
67 $this->setTitle(ilSkillTreeNode::_lookupTitle($this->skill_id, $this->tref_id));
68 }
69
70 $path = $tree->getSkillTreePathAsString($this->skill_id, $this->tref_id);
71 $this->setDescription($path);
72
73 $this->addColumn($this->lng->txt("skmg_type"), "", "50%");
74 $this->addColumn($this->lng->txt("skmg_number"), "", "50%");
75
76 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
77 $this->setRowTemplate("tpl.skill_usage_row.html", "Services/Skill");
78 $this->setEnableNumInfo(false);
79
80 // $this->addMultiCommand("", $lng->txt(""));
81// $this->addCommandButton("", $lng->txt(""));
82 }
83
84 protected function fillRow(array $a_set): void
85 {
87 $this->tpl->setVariable("TYPE_INFO", ilSkillUsage::getTypeInfoString($a_set["type"]));
88 $this->tpl->setVariable("NUMBER", count($a_set["usages"]));
89 $this->tpl->setVariable("OBJ_TYPE", ilSkillUsage::getObjTypeString($a_set["type"]));
90 }
91}
static _lookupTitle(int $a_obj_id, int $a_tref_id=0)
TableGUI class for skill usages.
ilSkillTreeRepository $tree_repo
Tree SkillTreeManager $tree_manager
fillRow(array $a_set)
Standard Version of Fill Row.
__construct($a_parent_obj, string $a_parent_cmd, string $a_cskill_id, array $a_usage, $a_mode="")
Tree SkillTreeFactory $tree_factory
static getObjTypeString(string $a_type)
static getTypeInfoString(string $a_type)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
setEnableNumInfo(bool $a_val)
setDescription(string $a_val)
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setData(array $a_data)
Set table data.
ilLanguage $lng
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Interface ilSkillTreeRepository.
$path
Definition: ltiservices.php:32
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...