ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilSurveyQuestionblockbrowserTableGUI.php
Go to the documentation of this file.
1<?php
2
23{
25 protected ilObjUser $user;
27 protected bool $editable = true;
28 protected bool $writeAccess = false;
29 protected array $browsercolumns = array();
30 protected array $filter = [];
31
32 public function __construct(
33 object $a_parent_obj,
34 string $a_parent_cmd,
35 ilObjSurvey $a_object,
36 bool $a_write_access = false
37 ) {
38 global $DIC;
39
40 $this->rbacreview = $DIC->rbac()->review();
41 $this->user = $DIC->user();
42 $this->access = $DIC->access();
43 parent::__construct($a_parent_obj, $a_parent_cmd);
44
45 $lng = $DIC->language();
46 $ilCtrl = $DIC->ctrl();
47
48 $this->lng = $lng;
49 $this->ctrl = $ilCtrl;
50
51 $this->setWriteAccess($a_write_access);
52
53 $this->setFormName('surveyquestionblockbrowser');
54 $this->setStyle('table', 'fullwidth');
55 $this->addColumn('', 'f', '1%');
56 $this->addColumn($this->lng->txt("title"), 'title', '');
57 $this->addColumn($this->lng->txt("contains"), 'contains', '');
58 $this->addColumn($this->lng->txt("obj_svy"), 'svy', '');
59
60 $this->setPrefix('cb');
61 $this->setSelectAllCheckbox('cb');
62
63 $this->addMultiCommand('insertQuestionblocks', $this->lng->txt('insert'));
64
65 $this->setRowTemplate("tpl.il_svy_svy_questionblockbrowser_row.html", "components/ILIAS/Survey");
66
67 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
68 $this->setDefaultOrderField("title");
69 $this->setDefaultOrderDirection("asc");
70
71 $this->enable('sort');
72 $this->enable('header');
73 $this->enable('select_all');
74 $this->setFilterCommand('filterQuestionblockBrowser');
75 $this->setResetCommand('resetfilterQuestionblockBrowser');
76
77 $this->initFilter();
78 $this->initData($a_object);
79 }
80
81 public function initData(ilObjSurvey $a_object): void
82 {
83 $arrFilter = array();
84 foreach ($this->getFilterItems() as $item) {
85 if ($item->getValue() !== false) {
86 $arrFilter[$item->getPostVar()] = $item->getValue();
87 }
88 }
89 $data = $a_object->getQuestionblocksTable($arrFilter);
90
91 $this->setData($data);
92 }
93
94 public function initFilter(): void
95 {
97
98 // title
99 $ti = new ilTextInputGUI($lng->txt("title"), "title");
100 $ti->setMaxLength(64);
101 $ti->setSize(20);
102 $ti->setValidationRegexp('/^[^%]+$/is');
103 $this->addFilterItem($ti);
104 $ti->readFromSession();
105 $this->filter["title"] = $ti->getValue();
106 }
107
108 protected function fillRow(array $a_set): void
109 {
110 $this->tpl->setVariable('QUESTIONBLOCK_ID', $a_set["questionblock_id"]);
111 $this->tpl->setVariable("TITLE", ilLegacyFormElementsUtil::prepareFormOutput($a_set["title"]));
112 $this->tpl->setVariable("CONTAINS", ilLegacyFormElementsUtil::prepareFormOutput($a_set["contains"]));
113 $this->tpl->setVariable("SVY", ilLegacyFormElementsUtil::prepareFormOutput($a_set['svy']));
114 }
115
116 public function setEditable(bool $value): void
117 {
118 $this->editable = $value;
119 }
120
121 public function getEditable(): bool
122 {
123 return $this->editable;
124 }
125
126 public function setWriteAccess(bool $value): void
127 {
128 $this->writeAccess = $value;
129 }
130
131 public function getWriteAccess(): bool
132 {
133 return $this->writeAccess;
134 }
135}
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static prepareFormOutput($a_str, bool $a_strip=false)
getQuestionblocksTable(array $arrFilter)
Retrieve data for question block browser.
User class.
class ilRbacReview Contains Review functions of core Rbac.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(object $a_parent_obj, string $a_parent_cmd, ilObjSurvey $a_object, bool $a_write_access=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setFilterCommand(string $a_val, string $a_caption="")
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
setFormName(string $a_name="")
addMultiCommand(string $a_cmd, string $a_text)
setPrefix(string $a_prefix)
set prefix for sort and offset fields (if you have two or more tables on a page that you want to sort...
setFormAction(string $a_form_action, bool $a_multipart=false)
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
setDefaultOrderField(string $a_defaultorderfield)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
getFilterItems(bool $a_optionals=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setDefaultOrderDirection(string $a_defaultorderdirection)
setResetCommand(string $a_val, string $a_caption="")
setData(array $a_data)
Set table data.
ilLanguage $lng
enable(string $a_module_name)
setStyle(string $a_element, string $a_style)
This class represents a text property in a property form.
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
global $DIC
Definition: shib_login.php:26