ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilSkillCatTableGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2011 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once("./Services/Table/classes/class.ilTable2GUI.php");
6 
16 {
20  protected $ctrl;
21 
25  protected $access;
26 
27  const MODE_SCAT = 0;
28  const MODE_SCTP = 1;
29  protected $tref_id = 0;
30 
34  public function __construct(
35  $a_parent_obj,
36  $a_parent_cmd,
37  $a_obj_id,
38  $a_mode = self::MODE_SCAT,
39  $a_tref_id = 0
40  ) {
41  global $DIC;
42 
43  $this->ctrl = $DIC->ctrl();
44  $this->lng = $DIC->language();
45  $this->access = $DIC->access();
46 
47  $ilCtrl = $DIC->ctrl();
48  $lng = $DIC->language();
49 
50  $this->tref_id = $a_tref_id;
51  $ilCtrl->setParameter($a_parent_obj, "tmpmode", $a_mode);
52 
53  $this->mode = $a_mode;
54  include_once("./Services/Skill/classes/class.ilSkillTree.php");
55  $this->skill_tree = new ilSkillTree();
56  $this->obj_id = $a_obj_id;
57 
58  parent::__construct($a_parent_obj, $a_parent_cmd);
59 
60  if ($this->mode == self::MODE_SCAT) {
61  $childs = $this->skill_tree->getChildsByTypeFilter(
62  $a_obj_id,
63  array("skrt", "skll", "scat", "sktr")
64  );
65  $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
66  $this->setData($childs);
67  } elseif ($this->mode == self::MODE_SCTP) {
68  $childs = $this->skill_tree->getChildsByTypeFilter(
69  $a_obj_id,
70  array("skrt", "sktp", "sctp")
71  );
72  $childs = ilUtil::sortArray($childs, "order_nr", "asc", true);
73  $this->setData($childs);
74  }
75 
76  if ($this->obj_id != $this->skill_tree->readRootId()) {
77  // $this->setTitle(ilSkillTreeNode::_lookupTitle($this->obj_id));
78  }
79  $this->setTitle($lng->txt("skmg_items"));
80 
81  if ($this->tref_id == 0) {
82  $this->addColumn($this->lng->txt(""), "", "1px", true);
83  }
84  $this->addColumn($this->lng->txt("type"), "", "1px");
85  if ($this->tref_id == 0) {
86  $this->addColumn($this->lng->txt("skmg_order"), "", "1px");
87  }
88  $this->addColumn($this->lng->txt("title"));
89 
90  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
91  $this->setRowTemplate("tpl.skill_cat_row.html", "Services/Skill");
92 
93  if ($this->tref_id == 0 && $this->parent_obj->checkPermissionBool("write")) {
94  $this->addMultiCommand("cutItems", $lng->txt("cut"));
95  $this->addMultiCommand("copyItems", $lng->txt("copy"));
96  $this->addMultiCommand("deleteNodes", $lng->txt("delete"));
97  if ($a_mode == self::MODE_SCAT) {
98  $this->addMultiCommand("exportSelectedNodes", $lng->txt("export"));
99  }
100  $this->addCommandButton("saveOrder", $lng->txt("skmg_save_order"));
101  }
102  }
103 
107  protected function fillRow($a_set)
108  {
109  $lng = $this->lng;
111 
112  switch ($a_set["type"]) {
113  // category
114  case "scat":
115  $ilCtrl->setParameterByClass("ilskillcategorygui", "obj_id", $a_set["child"]);
116  $ret = $ilCtrl->getLinkTargetByClass("ilskillcategorygui", "listItems");
117  $ilCtrl->setParameterByClass("ilskillcategorygui", "obj_id", $_GET["obj_id"]);
118  break;
119 
120  // skill template reference
121  case "sktr":
122  $tid = ilSkillTemplateReference::_lookupTemplateId($a_set["child"]);
123  $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "tref_id", $a_set["child"]);
124  $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "obj_id", $tid);
125  $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatereferencegui", "listItems");
126  $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "obj_id", $_GET["obj_id"]);
127  $ilCtrl->setParameterByClass("ilskilltemplatereferencegui", "tref_id", $_GET["tref_id"]);
128  break;
129 
130  // skill
131  case "skll":
132  $ilCtrl->setParameterByClass("ilbasicskillgui", "obj_id", $a_set["child"]);
133  $ret = $ilCtrl->getLinkTargetByClass("ilbasicskillgui", "edit");
134  $ilCtrl->setParameterByClass("ilbasicskillgui", "obj_id", $_GET["obj_id"]);
135  break;
136 
137  // --------
138 
139  // template
140  case "sktp":
141  $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $a_set["child"]);
142  $ret = $ilCtrl->getLinkTargetByClass("ilbasicskilltemplategui", "edit");
143  $ilCtrl->setParameterByClass("ilbasicskilltemplategui", "obj_id", $_GET["obj_id"]);
144  break;
145 
146  // template category
147  case "sctp":
148  $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $a_set["child"]);
149  $ret = $ilCtrl->getLinkTargetByClass("ilskilltemplatecategorygui", "listItems");
150  $ilCtrl->setParameterByClass("ilskilltemplatecategorygui", "obj_id", $_GET["obj_id"]);
151  break;
152  }
153 
154  if ($this->tref_id == 0) {
155  $this->tpl->setCurrentBlock("cb");
156  $this->tpl->setVariable("CB_ID", $a_set["child"]);
157  $this->tpl->parseCurrentBlock();
158 
159  $this->tpl->setCurrentBlock("nr");
160  $this->tpl->setVariable("OBJ_ID", $a_set["child"]);
161  $this->tpl->setVariable("ORDER_NR", $a_set["order_nr"]);
162  $this->tpl->parseCurrentBlock();
163  }
164 
165  $this->tpl->setVariable("HREF_TITLE", $ret);
166 
167  $this->tpl->setVariable("TITLE", $a_set["title"]);
169  $a_set["child"],
170  $a_set["type"],
171  "",
172  ilSkillTreeNode::_lookupStatus($a_set["child"])
173  );
174  $this->tpl->setVariable("ICON", ilUtil::img($icon, ""));
175  }
176 }
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
global $DIC
Definition: saml.php:7
Skill tree.
$_GET["client_id"]
static getIconPath($a_obj_id, $a_type, $a_size="", $a_status=0)
Get icon path.
global $ilCtrl
Definition: ilias.php:18
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.
static _lookupTemplateId($a_obj_id)
Lookup template ID.
static img($a_src, $a_alt=null, $a_width="", $a_height="", $a_border=0, $a_id="", $a_class="")
Build img tag.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
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.
$ret
Definition: parser.php:6
static _lookupStatus($a_obj_id)
Lookup Status.
__construct( $a_parent_obj, $a_parent_cmd, $a_obj_id, $a_mode=self::MODE_SCAT, $a_tref_id=0)
Constructor.
fillRow($a_set)
Fill table row.