ILIAS  release_7 Revision v7.30-3-g800a261c036
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{
20 protected $ctrl;
21
22 protected $has_write; // [bool]
23
24 public function __construct($a_parent_obj, $a_parent_cmd = "", $a_has_write = false)
25 {
26 global $DIC;
27
28 $this->ctrl = $DIC->ctrl();
29 $this->lng = $DIC->language();
30 $ilCtrl = $DIC->ctrl();
31 $lng = $DIC->language();
32
33 $this->has_write = (bool) $a_has_write;
34
35 parent::__construct($a_parent_obj, $a_parent_cmd);
36
37 $this->setId("repnwitgrptbl");
38
39 $this->setTitle($lng->txt("rep_new_item_groups"));
40
41 if ($this->has_write) {
42 $this->addColumn("", "", 1);
43 }
44 $this->addColumn($lng->txt("cmps_add_new_rank"), "");
45 $this->addColumn($lng->txt("title"), "");
46 $this->addColumn($lng->txt("rep_new_item_group_nr_subitems"), "");
47
48 if ($this->has_write) {
49 $this->addColumn($lng->txt("action"), "");
50 }
51
52 if ($this->has_write) {
53 $this->addCommandButton("saveNewItemGroupOrder", $lng->txt("cmps_save_options"));
54 $this->addMultiCommand("confirmDeleteNewItemGroup", $lng->txt("delete"));
55 }
56
57 $this->setEnableHeader(true);
58 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
59 $this->setRowTemplate("tpl.table_row_new_item_group.html", "Services/Repository");
60 $this->setLimit(10000);
61
62 $this->setExternalSorting(true);
63 $this->getGroups();
64 }
65
69 public function getGroups()
70 {
72
73 $data = array();
74
76
77 if ($subitems[0]) {
78 ilUtil::sendInfo(sprintf(
79 $lng->txt("rep_new_item_group_unassigned_subitems"),
80 is_array($subitems[0]) ? sizeof($subitems[0]) : 0
81 ));
82 unset($subitems[0]);
83 }
84
86 $data[] = array(
87 "id" => $item["id"],
88 "pos" => $item["pos"],
89 "title" => $item["title"],
90 "type" => $item["type"],
91 "subitems" => is_array($subitems[$item["id"]]) ? sizeof($subitems[$item["id"]]) : 0
92 );
93 }
94
95 $data = ilUtil::sortArray($data, "pos", "asc", true);
96
97 $this->setData($data);
98 }
99
100 protected function fillRow($a_set)
101 {
103 $ilCtrl = $this->ctrl;
104
105 if ($this->has_write) {
106 $this->tpl->setVariable("VAR_MULTI", "grp_id[]");
107 $this->tpl->setVariable("VAL_MULTI", $a_set["id"]);
108 }
109
110 $this->tpl->setVariable("VAR_POS", "grp_order[" . $a_set["id"] . "]");
111 $this->tpl->setVariable("VAL_POS", $a_set["pos"]);
112 $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
113
115 $this->tpl->setVariable("VAL_ITEMS", $a_set["subitems"]);
116
117 if ($this->has_write) {
118 $ilCtrl->setParameter($this->parent_obj, "grp_id", $a_set["id"]);
119 $url = $ilCtrl->getLinkTarget($this->parent_obj, "editNewItemGroup");
120 $ilCtrl->setParameter($this->parent_obj, "grp_id", "");
121
122 $this->tpl->setVariable("URL_EDIT", $url);
123 $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
124 }
125 }
126 }
127}
An exception for terminatinating execution or to throw for unit testing.
TableGUI class for new item groups.
__construct($a_parent_obj, $a_parent_cmd="", $a_has_write=false)
ilTable2GUI constructor.
fillRow($a_set)
Standard Version of Fill Row.
Class ilTable2GUI.
setEnableHeader($a_enableheader)
Set Enable Header.
setExternalSorting($a_val)
Set external sorting.
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.
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.
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 $DIC
Definition: goto.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$url