ILIAS  release_7 Revision v7.30-3-g800a261c036
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
5include_once("./Services/Table/classes/class.ilTable2GUI.php");
6
16{
20 protected $access;
21
25 public function __construct(
26 $a_parent_obj,
27 $a_parent_cmd,
28 $a_tree,
29 $a_node_id,
30 $a_tax
31 ) {
32 global $DIC;
33
34 $this->ctrl = $DIC->ctrl();
35 $this->lng = $DIC->language();
36 $this->access = $DIC->access();
37
38 $ilCtrl = $DIC->ctrl();
39 $lng = $DIC->language();
40
41 if ($a_node_id == "") {
42 $a_node_id = $a_tree->readRootId();
43 }
44
45 $this->tree = $a_tree;
46 $this->tax = $a_tax;
47 $this->node_id = $a_node_id;
48
49 parent::__construct($a_parent_obj, $a_parent_cmd);
50
51 $childs = $this->tree->getChildsByTypeFilter(
52 $a_node_id,
53 array("taxn")
54 );
55
56 if ($a_tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
57 $childs = ilUtil::sortArray($childs, "order_nr", "asc", false);
58 } else {
59 $childs = ilUtil::sortArray($childs, "title", "asc", false);
60 }
61 $this->setData($childs);
62
63 $this->setTitle($lng->txt("tax_nodes"));
64
65 $this->addColumn($this->lng->txt(""), "", "1px", true);
66 if ($this->tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
67 $this->addColumn($this->lng->txt("tax_order"), "order_nr", "1px");
68 $this->setDefaultOrderField("order_nr");
69 $this->setDefaultOrderDirection("asc");
70 }
71 $this->addColumn($this->lng->txt("title"));
72
73 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
74 $this->setRowTemplate("tpl.tax_row.html", "Services/Taxonomy");
75
76 $this->addMultiCommand("deleteItems", $lng->txt("delete"));
77 $this->addMultiCommand("moveItems", $lng->txt("move"));
78 $this->addCommandButton("saveSorting", $lng->txt("save"));
79 }
80
81
87 public function numericOrdering($a_field)
88 {
89 if (in_array($a_field, array("order_nr"))) {
90 return true;
91 }
92 }
93
97 protected function fillRow($a_set)
98 {
100 $ilCtrl = $this->ctrl;
101
102 $ilCtrl->setParameter($this->parent_obj, "tax_node", $a_set["child"]);
103 $ret = $ilCtrl->getLinkTargetByClass("ilobjtaxonomygui", "listNodes");
104 $ilCtrl->setParameter($this->parent_obj, "tax_node", $_GET["tax_node"]);
105 if ($this->tax->getSortingMode() == ilObjTaxonomy::SORT_MANUAL) {
106 $this->tpl->setCurrentBlock("order");
107 $this->tpl->setVariable("ORDER_NR", $a_set["order_nr"]);
108 $this->tpl->setVariable("ONODE_ID", $a_set["child"]);
109 $this->tpl->parseCurrentBlock();
110 }
111
112 $this->tpl->setVariable("HREF_TITLE", $ret);
113
114 $this->tpl->setVariable("TITLE", ilUtil::prepareFormOutput($a_set["title"]));
115 $this->tpl->setVariable("NODE_ID", $a_set["child"]);
116 }
117}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
Class ilTable2GUI.
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
setData($a_data)
set table data @access public
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
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.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
TableGUI class for taxonomies.
__construct( $a_parent_obj, $a_parent_cmd, $a_tree, $a_node_id, $a_tax)
Constructor.
fillRow($a_set)
Fill table row.
numericOrdering($a_field)
Should this field be sorted numeric?
static sortArray( $array, $a_array_sortby, $a_array_sortorder=0, $a_numeric=false, $a_keep_keys=false)
sortArray
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
global $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ret
Definition: parser.php:6