ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilTaxonomyTableGUI.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  function __construct($a_parent_obj, $a_parent_cmd, $a_tree,
21  $a_node_id, $a_tax)
22  {
23  global $ilCtrl, $lng, $ilAccess, $lng;
24 
25  if ($a_node_id == "")
26  {
27  $a_node_id = $a_tree->readRootId();
28  }
29 
30  $this->tree = $a_tree;
31  $this->tax = $a_tax;
32  $this->node_id = $a_node_id;
33 
34  parent::__construct($a_parent_obj, $a_parent_cmd);
35 
36  $childs = $this->tree->getChildsByTypeFilter($a_node_id,
37  array("taxn"));
38 
39  if ($a_tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL)
40  {
41  $childs = ilUtil::sortArray($childs, "order_nr", "asc", false);
42  }
43  else
44  {
45  $childs = ilUtil::sortArray($childs, "title", "asc", false);
46  }
47  $this->setData($childs);
48 
49  $this->setTitle($lng->txt("tax_nodes"));
50 
51  $this->addColumn($this->lng->txt(""), "", "1px", true);
52  if ($this->tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL)
53  {
54  $this->addColumn($this->lng->txt("tax_order"), "order_nr", "1px");
55  $this->setDefaultOrderField("order_nr");
56  $this->setDefaultOrderDirection("asc");
57  }
58  $this->addColumn($this->lng->txt("title"));
59 
60  $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
61  $this->setRowTemplate("tpl.tax_row.html", "Services/Taxonomy");
62 
63  $this->addMultiCommand("deleteItems", $lng->txt("delete"));
64  $this->addMultiCommand("moveItems", $lng->txt("move"));
65  $this->addCommandButton("saveSorting", $lng->txt("save"));
66  }
67 
68 
74  function numericOrdering($a_field)
75  {
76  if (in_array($a_field, array("order_nr")))
77  {
78  return true;
79  }
80  }
81 
85  protected function fillRow($a_set)
86  {
87  global $lng, $ilCtrl;
88 
89  $ilCtrl->setParameter($this->parent_obj, "tax_node", $a_set["child"]);
90  $ret = $ilCtrl->getLinkTargetByClass("ilobjtaxonomygui", "listNodes");
91  $ilCtrl->setParameter($this->parent_obj, "tax_node", $_GET["tax_node"]);
92  if ($this->tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL)
93  {
94  $this->tpl->setCurrentBlock("order");
95  $this->tpl->setVariable("ORDER_NR", $a_set["order_nr"]);
96  $this->tpl->setVariable("ONODE_ID", $a_set["child"]);
97  $this->tpl->parseCurrentBlock();
98  }
99 
100  $this->tpl->setVariable("HREF_TITLE", $ret);
101 
102  $this->tpl->setVariable("TITLE", ilUtil::prepareFormOutput($a_set["title"]));
103  $this->tpl->setVariable("NODE_ID", $a_set["child"]);
104  }
105 
106 }
107 ?>