ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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", "Modules/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  {
96  $lng = $this->lng;
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 }
setData(array $a_data)
enable(string $a_module_name)
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...
setFormAction(string $a_form_action, bool $a_multipart=false)
__construct(object $a_parent_obj, string $a_parent_cmd, ilObjSurvey $a_object, bool $a_write_access=false)
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
setResetCommand(string $a_val, string $a_caption="")
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
getQuestionblocksTable(array $arrFilter)
Retrieve data for question block browser.
static prepareFormOutput($a_str, bool $a_strip=false)
setFormName(string $a_name="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilLanguage $lng
global $DIC
Definition: feed.php:28
setStyle(string $a_element, string $a_style)
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setFilterCommand(string $a_val, string $a_caption="")
setDefaultOrderDirection(string $a_defaultorderdirection)
__construct(Container $dic, ilPlugin $plugin)
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)
getFilterItems(bool $a_optionals=false)
addMultiCommand(string $a_cmd, string $a_text)
setPrefix(string $a_prefix)