ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilSkillUsageTableGUI.php
Go to the documentation of this file.
1 <?php
2 
21 
28 {
31  protected Tree\SkillTreeFactory $tree_factory;
32  protected Tree\SkillTreeManager $tree_manager;
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  {
86  $lng = $this->lng;
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 }
setData(array $a_data)
setFormAction(string $a_form_action, bool $a_multipart=false)
ilSkillTreeRepository $tree_repo
setDescription(string $a_val)
static _lookupTitle(int $a_obj_id, int $a_tref_id=0)
Tree SkillTreeFactory $tree_factory
__construct($a_parent_obj, string $a_parent_cmd, string $a_cskill_id, array $a_usage, $a_mode="")
ilLanguage $lng
$path
Definition: ltiservices.php:32
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
TableGUI class for skill usages.
static getObjTypeString(string $a_type)
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
Tree SkillTreeManager $tree_manager
setEnableNumInfo(bool $a_val)
__construct(Container $dic, ilPlugin $plugin)
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)
static getTypeInfoString(string $a_type)