ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilNewItemGroupTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once("Services/Table/classes/class.ilTable2GUI.php");
5include_once("Services/Repository/classes/class.ilObjRepositorySettings.php");
6
16{
17 protected $has_write; // [bool]
18
19 function __construct($a_parent_obj, $a_parent_cmd = "", $a_has_write = false)
20 {
21 global $ilCtrl, $lng;
22
23 $this->has_write = (bool)$a_has_write;
24
25 parent::__construct($a_parent_obj, $a_parent_cmd);
26
27 $this->setId("repnwitgrptbl");
28
29 $this->setTitle($lng->txt("rep_new_item_groups"));
30
31 if($this->has_write)
32 {
33 $this->addColumn("", "", 1);
34 }
35 $this->addColumn($lng->txt("cmps_add_new_rank"), "");
36 $this->addColumn($lng->txt("title"), "");
37 $this->addColumn($lng->txt("rep_new_item_group_nr_subitems"), "");
38
39 if($this->has_write)
40 {
41 $this->addColumn($lng->txt("action"), "");
42 }
43
44 if($this->has_write)
45 {
46 $this->addCommandButton("saveNewItemGroupOrder", $lng->txt("cmps_save_options"));
47 $this->addMultiCommand("confirmDeleteNewItemGroup", $lng->txt("delete"));
48 }
49
50 $this->setEnableHeader(true);
51 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
52 $this->setRowTemplate("tpl.table_row_new_item_group.html", "Services/Repository");
53 $this->setLimit(10000);
54
55 $this->setExternalSorting(true);
56 $this->getGroups();
57 }
58
62 function getGroups()
63 {
64 global $lng;
65
66 $data = array();
67
69
70 if($subitems[0])
71 {
72 ilUtil::sendInfo(sprintf($lng->txt("rep_new_item_group_unassigned_subitems"), sizeof($subitems[0])));
73 unset($subitems[0]);
74 }
75
77 {
78 $data[] = array(
79 "id" => $item["id"],
80 "pos" => $item["pos"],
81 "title" => $item["title"],
82 "type" => $item["type"],
83 "subitems" => sizeof($subitems[$item["id"]])
84 );
85 }
86
87 $data = ilUtil::sortArray($data, "pos", "asc", true);
88
89 $this->setData($data);
90 }
91
92 protected function fillRow($a_set)
93 {
94 global $lng, $ilCtrl;
95
96 if($this->has_write)
97 {
98 $this->tpl->setVariable("VAR_MULTI", "grp_id[]");
99 $this->tpl->setVariable("VAL_MULTI", $a_set["id"]);
100 }
101
102 $this->tpl->setVariable("VAR_POS", "grp_order[".$a_set["id"]."]");
103 $this->tpl->setVariable("VAL_POS", $a_set["pos"]);
104 $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
105
107 {
108 $this->tpl->setVariable("VAL_ITEMS", $a_set["subitems"]);
109
110 if($this->has_write)
111 {
112 $ilCtrl->setParameter($this->parent_obj, "grp_id", $a_set["id"]);
113 $url = $ilCtrl->getLinkTarget($this->parent_obj, "editNewItemGroup");
114 $ilCtrl->setParameter($this->parent_obj, "grp_id", "");
115
116 $this->tpl->setVariable("URL_EDIT", $url);
117 $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
118 }
119 }
120 }
121}
122
123?>
TableGUI class for new item groups.
__construct($a_parent_obj, $a_parent_cmd="", $a_has_write=false)
Constructor.
fillRow($a_set)
Standard Version of Fill Row.
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
setExternalSorting($a_val)
Set external sorting.
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.
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.
setLimit($a_limit=0, $a_default_limit=0)
set max.
addMultiCommand($a_cmd, $a_text)
Add Command button.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
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
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $ilCtrl
Definition: ilias.php:18
global $lng
Definition: privfeed.php:40
$url
Definition: shib_logout.php:72