ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilSurveyQuestionblockbrowserTableGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24include_once('./Services/Table/classes/class.ilTable2GUI.php');
25
35{
39 protected $rbacreview;
40
44 protected $user;
45
49 protected $access;
50
51 protected $editable = true;
52 protected $writeAccess = false;
53 protected $browsercolumns = array();
54
62 public function __construct($a_parent_obj, $a_parent_cmd, $a_object, $a_write_access = false)
63 {
64 global $DIC;
65
66 $this->rbacreview = $DIC->rbac()->review();
67 $this->user = $DIC->user();
68 $this->access = $DIC->access();
69 parent::__construct($a_parent_obj, $a_parent_cmd);
70
71 $lng = $DIC->language();
72 $ilCtrl = $DIC->ctrl();
73
74 $this->lng = $lng;
75 $this->ctrl = $ilCtrl;
76
77 $this->setWriteAccess($a_write_access);
78
79 $this->setFormName('surveyquestionblockbrowser');
80 $this->setStyle('table', 'fullwidth');
81 $this->addColumn('', 'f', '1%');
82 $this->addColumn($this->lng->txt("title"), 'title', '');
83 $this->addColumn($this->lng->txt("contains"), 'contains', '');
84 $this->addColumn($this->lng->txt("obj_svy"), 'svy', '');
85
86 $this->setPrefix('cb');
87 $this->setSelectAllCheckbox('cb');
88
89 $this->addMultiCommand('insertQuestionblocks', $this->lng->txt('insert'));
90
91 $this->setRowTemplate("tpl.il_svy_svy_questionblockbrowser_row.html", "Modules/Survey");
92
93 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
94 $this->setDefaultOrderField("title");
95 $this->setDefaultOrderDirection("asc");
96
97 $this->enable('sort');
98 $this->enable('header');
99 $this->enable('select_all');
100 $this->setFilterCommand('filterQuestionblockBrowser');
101 $this->setResetCommand('resetfilterQuestionblockBrowser');
102
103 $this->initFilter();
104 $this->initData($a_object);
105 }
106
107 public function initData($a_object)
108 {
109 $arrFilter = array();
110 foreach ($this->getFilterItems() as $item) {
111 if ($item->getValue() !== false) {
112 $arrFilter[$item->getPostVar()] = $item->getValue();
113 }
114 }
115 $data = $a_object->getQuestionblocksTable($arrFilter);
116
117 $this->setData($data);
118 }
119
123 public function initFilter()
124 {
128
129 // title
130 include_once("./Services/Form/classes/class.ilTextInputGUI.php");
131 $ti = new ilTextInputGUI($lng->txt("title"), "title");
132 $ti->setMaxLength(64);
133 $ti->setSize(20);
134 $ti->setValidationRegexp('/^[^%]+$/is');
135 $this->addFilterItem($ti);
136 $ti->readFromSession();
137 $this->filter["title"] = $ti->getValue();
138 }
139
147 public function fillRow($data)
148 {
150 $ilAccess = $this->access;
151
152 $this->tpl->setVariable('QUESTIONBLOCK_ID', $data["questionblock_id"]);
153 $this->tpl->setVariable("TITLE", ilUtil::prepareFormOutput($data["title"]));
154 $this->tpl->setVariable("CONTAINS", ilUtil::prepareFormOutput($data["contains"]));
155 $this->tpl->setVariable("SVY", ilUtil::prepareFormOutput($data['svy']));
156 }
157
158 public function setEditable($value)
159 {
160 $this->editable = $value;
161 }
162
163 public function getEditable()
164 {
165 return $this->editable;
166 }
167
168 public function setWriteAccess($value)
169 {
170 $this->writeAccess = $value;
171 }
172
173 public function getWriteAccess()
174 {
175 return $this->writeAccess;
176 }
177}
user()
Definition: user.php:4
An exception for terminatinating execution or to throw for unit testing.
__construct($a_parent_obj, $a_parent_cmd, $a_object, $a_write_access=false)
Constructor.
Class ilTable2GUI.
setPrefix($a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
getFilterItems($a_optionals=false)
Get filter items.
setData($a_data)
set table data @access public
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addMultiCommand($a_cmd, $a_text)
Add Command button.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
setDefaultOrderField($a_defaultorderfield)
Set Default order field.
setSelectAllCheckbox($a_select_all_checkbox)
Set the name of the checkbox that should be toggled with a select all 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.
setFormName($a_formname="")
Set Form name.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setDefaultOrderDirection($a_defaultorderdirection)
Set Default order direction.
setFilterCommand($a_val, $a_caption=null)
Set filter command.
setStyle($a_element, $a_style)
enable($a_module_name)
enables particular modules of table
This class represents a text property in a property form.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
global $ilCtrl
Definition: ilias.php:18
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18