ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilSurveyQuestionblockbrowserTableGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2019 ILIAS open source, Extended GPL, see docs/LICENSE */
4
10{
14 protected $rbacreview;
15
19 protected $user;
20
24 protected $access;
25
26 protected $editable = true;
27 protected $writeAccess = false;
28 protected $browsercolumns = array();
29
37 public function __construct($a_parent_obj, $a_parent_cmd, $a_object, $a_write_access = false)
38 {
39 global $DIC;
40
41 $this->rbacreview = $DIC->rbac()->review();
42 $this->user = $DIC->user();
43 $this->access = $DIC->access();
44 parent::__construct($a_parent_obj, $a_parent_cmd);
45
46 $lng = $DIC->language();
47 $ilCtrl = $DIC->ctrl();
48
49 $this->lng = $lng;
50 $this->ctrl = $ilCtrl;
51
52 $this->setWriteAccess($a_write_access);
53
54 $this->setFormName('surveyquestionblockbrowser');
55 $this->setStyle('table', 'fullwidth');
56 $this->addColumn('', 'f', '1%');
57 $this->addColumn($this->lng->txt("title"), 'title', '');
58 $this->addColumn($this->lng->txt("contains"), 'contains', '');
59 $this->addColumn($this->lng->txt("obj_svy"), 'svy', '');
60
61 $this->setPrefix('cb');
62 $this->setSelectAllCheckbox('cb');
63
64 $this->addMultiCommand('insertQuestionblocks', $this->lng->txt('insert'));
65
66 $this->setRowTemplate("tpl.il_svy_svy_questionblockbrowser_row.html", "Modules/Survey");
67
68 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
69 $this->setDefaultOrderField("title");
70 $this->setDefaultOrderDirection("asc");
71
72 $this->enable('sort');
73 $this->enable('header');
74 $this->enable('select_all');
75 $this->setFilterCommand('filterQuestionblockBrowser');
76 $this->setResetCommand('resetfilterQuestionblockBrowser');
77
78 $this->initFilter();
79 $this->initData($a_object);
80 }
81
82 public function initData($a_object)
83 {
84 $arrFilter = array();
85 foreach ($this->getFilterItems() as $item) {
86 if ($item->getValue() !== false) {
87 $arrFilter[$item->getPostVar()] = $item->getValue();
88 }
89 }
90 $data = $a_object->getQuestionblocksTable($arrFilter);
91
92 $this->setData($data);
93 }
94
98 public function initFilter()
99 {
103
104 // title
105 $ti = new ilTextInputGUI($lng->txt("title"), "title");
106 $ti->setMaxLength(64);
107 $ti->setSize(20);
108 $ti->setValidationRegexp('/^[^%]+$/is');
109 $this->addFilterItem($ti);
110 $ti->readFromSession();
111 $this->filter["title"] = $ti->getValue();
112 }
113
121 public function fillRow($data)
122 {
124 $ilAccess = $this->access;
125
126 $this->tpl->setVariable('QUESTIONBLOCK_ID', $data["questionblock_id"]);
127 $this->tpl->setVariable("TITLE", ilUtil::prepareFormOutput($data["title"]));
128 $this->tpl->setVariable("CONTAINS", ilUtil::prepareFormOutput($data["contains"]));
129 $this->tpl->setVariable("SVY", ilUtil::prepareFormOutput($data['svy']));
130 }
131
132 public function setEditable($value)
133 {
134 $this->editable = $value;
135 }
136
137 public function getEditable()
138 {
139 return $this->editable;
140 }
141
142 public function setWriteAccess($value)
143 {
144 $this->writeAccess = $value;
145 }
146
147 public function getWriteAccess()
148 {
149 return $this->writeAccess;
150 }
151}
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.
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
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.
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
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46