ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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{
36 protected $editable = true;
37 protected $writeAccess = false;
38 protected $browsercolumns = array();
39
47 public function __construct($a_parent_obj, $a_parent_cmd, $a_object, $a_write_access = false)
48 {
49 parent::__construct($a_parent_obj, $a_parent_cmd);
50
51 global $lng, $ilCtrl;
52
53 $this->lng = $lng;
54 $this->ctrl = $ilCtrl;
55
56 $this->setWriteAccess($a_write_access);
57
58 $this->setFormName('surveyquestionblockbrowser');
59 $this->setStyle('table', 'fullwidth');
60 $this->addColumn('','f','1%');
61 $this->addColumn($this->lng->txt("title"),'title', '');
62 $this->addColumn($this->lng->txt("contains"),'contains', '');
63 $this->addColumn($this->lng->txt("obj_svy"),'svy', '');
64
65 $this->setPrefix('cb');
66 $this->setSelectAllCheckbox('cb');
67
68 $this->addMultiCommand('insertQuestionblocks', $this->lng->txt('insert'));
69
70 $this->setRowTemplate("tpl.il_svy_svy_questionblockbrowser_row.html", "Modules/Survey");
71
72 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
73 $this->setDefaultOrderField("title");
74 $this->setDefaultOrderDirection("asc");
75
76 $this->enable('sort');
77 $this->enable('header');
78 $this->enable('select_all');
79 $this->setFilterCommand('filterQuestionblockBrowser');
80 $this->setResetCommand('resetfilterQuestionblockBrowser');
81
82 $this->initFilter();
83 $this->initData($a_object);
84 }
85
86 function initData($a_object)
87 {
88 $arrFilter = array();
89 foreach ($this->getFilterItems() as $item)
90 {
91 if ($item->getValue() !== false)
92 {
93 $arrFilter[$item->getPostVar()] = $item->getValue();
94 }
95 }
96 $data = $a_object->getQuestionblocksTable($arrFilter);
97
98 $this->setData($data);
99 }
100
104 function initFilter()
105 {
106 global $lng, $rbacreview, $ilUser;
107
108 // title
109 include_once("./Services/Form/classes/class.ilTextInputGUI.php");
110 $ti = new ilTextInputGUI($lng->txt("title"), "title");
111 $ti->setMaxLength(64);
112 $ti->setSize(20);
113 $ti->setValidationRegexp('/^[^%]+$/is');
114 $this->addFilterItem($ti);
115 $ti->readFromSession();
116 $this->filter["title"] = $ti->getValue();
117 }
118
126 public function fillRow($data)
127 {
128 global $ilUser,$ilAccess;
129
130 $this->tpl->setVariable('QUESTIONBLOCK_ID', $data["questionblock_id"]);
131 $this->tpl->setVariable("TITLE", ilUtil::prepareFormOutput($data["title"]));
132 $this->tpl->setVariable("CONTAINS", ilUtil::prepareFormOutput($data["contains"]));
133 $this->tpl->setVariable("SVY", ilUtil::prepareFormOutput($data['svy']));
134 }
135
136 public function setEditable($value)
137 {
138 $this->editable = $value;
139 }
140
141 public function getEditable()
142 {
143 return $this->editable;
144 }
145
146 public function setWriteAccess($value)
147 {
148 $this->writeAccess = $value;
149 }
150
151 public function getWriteAccess()
152 {
153 return $this->writeAccess;
154 }
155}
156?>
__construct($a_parent_obj, $a_parent_cmd, $a_object, $a_write_access=false)
Constructor.
Class ilTable2GUI.
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.
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.
setFormName($a_formname)
Set Form name.
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.
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 $lng
Definition: privfeed.php:40
global $ilUser
Definition: imgupload.php:15