ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilContSkillTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2017 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/Table/classes/class.ilTable2GUI.php");
6 
15 {
19  protected $ctrl;
20 
24  protected $lng;
25 
29  protected $tpl;
30 
34  protected $container_skills;
35 
39  public function __construct($a_parent_obj, $a_parent_cmd, ilContainerSkills $a_cont_skills)
40  {
41  global $DIC;
42 
43  $this->ctrl = $DIC->ctrl();
44  $this->lng = $DIC->language();
45  $this->tpl = $DIC["tpl"];
46 
47  include_once("./Services/Skill/classes/class.ilSkillTree.php");
48  $this->skill_tree = new ilSkillTree();
49 
50  $this->container_skills = $a_cont_skills;
51 
52  parent::__construct($a_parent_obj, $a_parent_cmd);
53  $this->setData($this->getSkills());
54  $this->setTitle($this->lng->txt("cont_cont_skills"));
55 
56  $this->addColumn("", "", "1", true);
57  $this->addColumn($this->lng->txt("cont_skill"), "", "1");
58  $this->addColumn($this->lng->txt("cont_path"), "", "1");
59 
60  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj));
61  $this->setRowTemplate("tpl.cont_skill_row.html", "Services/Container/Skills");
62  $this->setSelectAllCheckbox("id");
63 
64  $this->addMultiCommand("confirmRemoveSelectedSkill", $this->lng->txt("remove"));
65  //$this->addCommandButton("", $lng->txt(""));
66  }
67 
74  public function getSkills()
75  {
76  $skills = array();
77  foreach ($this->container_skills->getSkills() as $sk) {
78  $skills[] = array(
79  "skill_id" => $sk["skill_id"],
80  "tref_id" => $sk["tref_id"],
81  "title" => ilBasicSkill::_lookupTitle($sk["skill_id"], $sk["tref_id"])
82  );
83  }
84 
85  // order skills per virtual skill tree
86  include_once("./Services/Skill/classes/class.ilVirtualSkillTree.php");
87  $vtree = new ilVirtualSkillTree();
88  $skills = $vtree->getOrderedNodeset($skills, "skill_id", "tref_id");
89 
90  return $skills;
91  }
92 
93 
97  protected function fillRow($a_set)
98  {
99  $tpl = $this->tpl;
100  $skill_tree = $this->skill_tree;
101 
102  $tpl->setVariable("TITLE", $a_set["title"]);
103  $tpl->setVariable("ID", $a_set["skill_id"] . ":" . $a_set["tref_id"]);
104 
105  $path = $this->getParentObject()->getPathString($a_set["skill_id"], $a_set["tref_id"]);
106 
107  $tpl->setVariable("PATH", $path);
108  }
109 }
__construct($a_parent_obj, $a_parent_cmd, ilContainerSkills $a_cont_skills)
Constructor.
global $DIC
Definition: saml.php:7
Skill tree.
TableGUI class for competences in containers.
Skills of a container.
getParentObject()
Get parent object.
fillRow($a_set)
Fill table row.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
Create styles array
The data for the language used.
static _lookupTitle($a_obj_id, $a_tref_id=0)
Lookup Title.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all button.