ILIAS  release_8 Revision v8.24
ilSurveyQuestionTableGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilSurveyQuestionTableGUI:
+ Collaboration diagram for ilSurveyQuestionTableGUI:

Public Member Functions

 __construct (object $a_parent_obj, string $a_parent_cmd, ilObjSurvey $a_survey_obj, bool $a_read_only=false)
 
- Public Member Functions inherited from ilTable2GUI
 __construct (?object $a_parent_obj, string $a_parent_cmd="", string $a_template_context="")
 
 setOpenFormTag (bool $a_val)
 
 getOpenFormTag ()
 
 setCloseFormTag (bool $a_val)
 
 getCloseFormTag ()
 
 determineLimit ()
 
 getSelectableColumns ()
 Get selectable columns. More...
 
 determineSelectedColumns ()
 
 isColumnSelected (string $col)
 
 getSelectedColumns ()
 
 resetOffset (bool $a_in_determination=false)
 
 initFilter ()
 
 getParentObject ()
 
 getParentCmd ()
 
 setTopAnchor (string $a_val)
 
 getTopAnchor ()
 
 setNoEntriesText (string $a_text)
 
 getNoEntriesText ()
 
 setIsDataTable (bool $a_val)
 
 getIsDataTable ()
 
 setEnableTitle (bool $a_enabletitle)
 
 getEnableTitle ()
 
 setEnableHeader (bool $a_enableheader)
 
 getEnableHeader ()
 
 setEnableNumInfo (bool $a_val)
 
 getEnableNumInfo ()
 
 setTitle (string $a_title, string $a_icon="", string $a_icon_alt="")
 
 setDescription (string $a_val)
 
 getDescription ()
 
 setOrderField (string $a_order_field)
 
 getOrderField ()
 
 setData (array $a_data)
 Set table data. More...
 
 getData ()
 
 dataExists ()
 
 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 separately) More...
 
 getPrefix ()
 
 addFilterItem (ilTableFilterItem $a_input_item, bool $a_optional=false)
 
 addFilterItemByMetaType (string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
 Add filter by standard type. More...
 
 getFilterItems (bool $a_optionals=false)
 
 getFilterItemByPostVar (string $a_post_var)
 
 setFilterCols (int $a_val)
 
 getFilterCols ()
 
 setDisableFilterHiding (bool $a_val=true)
 
 getDisableFilterHiding ()
 
 isFilterSelected (string $a_col)
 Is given filter selected? More...
 
 getSelectedFilters ()
 
 determineSelectedFilters ()
 
 setCustomPreviousNext (string $a_prev_link, string $a_next_link)
 
 setFormAction (string $a_form_action, bool $a_multipart=false)
 
 getFormAction ()
 
 setFormName (string $a_name="")
 
 getFormName ()
 get the name of the parent form More...
 
 setId (string $a_val)
 
 getId ()
 
 setDisplayAsBlock (bool $a_val)
 
 getDisplayAsBlock ()
 
 setSelectAllCheckbox (string $a_select_all_checkbox, bool $a_select_all_on_top=false)
 
 setExternalSorting (bool $a_val)
 
 getExternalSorting ()
 
 setFilterCommand (string $a_val, string $a_caption="")
 
 getFilterCommand ()
 
 setResetCommand (string $a_val, string $a_caption="")
 
 getResetCommand ()
 
 setExternalSegmentation (bool $a_val)
 
 getExternalSegmentation ()
 
 setRowTemplate (string $a_template, string $a_template_dir="")
 Set row template. More...
 
 setDefaultOrderField (string $a_defaultorderfield)
 
 getDefaultOrderField ()
 
 setDefaultOrderDirection (string $a_defaultorderdirection)
 
 getDefaultOrderDirection ()
 
 setDefaultFilterVisiblity (bool $a_status)
 
 getDefaultFilterVisibility ()
 
 clearCommandButtons ()
 
 addCommandButton (string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
 
 addCommandButtonInstance (ilButtonBase $a_button)
 
 addMultiItemSelectionButton (string $a_sel_var, array $a_options, string $a_cmd, string $a_text, string $a_default_selection='')
 
 setCloseCommand (string $a_link)
 
 addMultiCommand (string $a_cmd, string $a_text)
 
 addHiddenInput (string $a_name, string $a_value)
 
 addHeaderCommand (string $a_href, string $a_text, string $a_target="", string $a_img="")
 
 setTopCommands (bool $a_val)
 
 getTopCommands ()
 
 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)
 
 getNavParameter ()
 
 setOrderLink (string $key, string $order_dir)
 
 fillHeader ()
 
 determineOffsetAndOrder (bool $a_omit_offset=false)
 
 storeNavParameter ()
 
 getHTML ()
 Get HTML. More...
 
 numericOrdering (string $a_field)
 Should this field be sorted numeric? More...
 
 render ()
 
 writeFilterToSession ()
 
 resetFilter ()
 
 fillFooter ()
 
 getLinkbar (string $a_num)
 
 fillHiddenRow ()
 
 fillActionRow ()
 
 setHeaderHTML (string $html)
 
 storeProperty (string $type, string $value)
 
 loadProperty (string $type)
 
 getCurrentState ()
 get current settings for order, limit, columns and filter More...
 
 setContext (string $id)
 
 getContext ()
 
 setShowRowsSelector (bool $a_value)
 Toggle rows-per-page selector. More...
 
 getShowRowsSelector ()
 
 setShowTemplates (bool $a_value)
 
 getShowTemplates ()
 
 restoreTemplate (string $a_name)
 Restore state from template. More...
 
 saveTemplate (string $a_name)
 Save current state as template. More...
 
 deleteTemplate (string $a_name)
 
 getLimit ()
 
 getOffset ()
 
 setExportFormats (array $formats)
 Set available export formats. More...
 
 setPrintMode (bool $a_value=false)
 
 getPrintMode ()
 
 getExportMode ()
 
 exportData (int $format, bool $send=false)
 Export and optionally send current table data. More...
 
 setEnableAllCommand (bool $a_value)
 
 setRowSelectorLabel (string $row_selector_label)
 
 getRowSelectorLabel ()
 
 setPreventDoubleSubmission (bool $a_val)
 
 getPreventDoubleSubmission ()
 
 setLimit (int $a_limit=0, int $a_default_limit=0)
 set max. More...
 
- Public Member Functions inherited from ilTableGUI
 __construct (array $a_data=[], bool $a_global_tpl=true)
 
 setTemplate (ilTemplate $a_tpl)
 
 getTemplateObject ()
 
 setData (array $a_data)
 Set table data. More...
 
 getData ()
 
 setTitle (string $a_title, string $a_icon="", string $a_icon_alt="")
 
 setHelp (string $a_help_page, string $a_help_icon, string $a_help_icon_alt="")
 
 setHeaderNames (array $a_header_names)
 
 getColumnCount ()
 
 setHeaderVars (array $a_header_vars, array $a_header_params=[])
 
 setColumnWidth (array $a_column_width)
 set table column widths More...
 
 setOneColumnWidth (string $a_column_width, int $a_column_number)
 
 setMaxCount (int $a_max_count)
 set max. More...
 
 setLimit (int $a_limit=0, int $a_default_limit=0)
 set max. More...
 
 getLimit ()
 
 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 separately) More...
 
 setOffset (int $a_offset)
 set dataset offset More...
 
 getOffset ()
 
 setOrderColumn (string $a_order_column="", string $a_default_column="")
 
 getOrderColumn ()
 
 setOrderDirection (string $a_order_direction)
 
 getOrderDirection ()
 
 setFooter (string $a_style, string $a_previous="", string $a_next="")
 
 enable (string $a_module_name)
 
 disable (string $a_module_name)
 
 sortData ()
 
 render ()
 
 renderHeader ()
 
 setOrderLink (string $key, string $order_dir)
 
 setStyle (string $a_element, string $a_style)
 
 getStyle (string $a_element)
 
 setBase (string $a_base)
 
 getBase ()
 
 getFormName ()
 get the name of the parent form More...
 
 setFormName (string $a_name="cmd")
 
 getSelectAllCheckbox ()
 get the name of the checkbox that should be toggled with a select all button More...
 
 setSelectAllCheckbox (string $a_select_all_checkbox)
 
 clearActionButtons ()
 
 addActionButton (string $btn_name, string $btn_value)
 

Protected Member Functions

 importData ()
 
 fillRow (array $a_set)
 Standard Version of Fill Row. More...
 
- Protected Member Functions inherited from ilTable2GUI
 getRequestedValues ()
 
 prepareOutput ()
 Anything that must be done before HTML is generated. More...
 
 isFilterVisible ()
 Check if filter is visible: manually shown (session, db) or default value set. More...
 
 isAdvMDFilter (ilAdvancedMDRecordGUI $a_gui, ilTableFilterItem $a_element)
 Check if filter element is based on adv md. More...
 
 fillRow (array $a_set)
 Standard Version of Fill Row. More...
 
 getFilterValue (ilTableFilterItem $a_item)
 Get current filter value. More...
 
 setFilterValue (ilTableFilterItem $a_item, $a_value)
 
 fillMetaExcel (ilExcel $a_excel, int &$a_row)
 Add meta information to excel export. More...
 
 fillHeaderExcel (ilExcel $a_excel, int &$a_row)
 Excel Version of Fill Header. More...
 
 fillRowExcel (ilExcel $a_excel, int &$a_row, array $a_set)
 Excel Version of Fill Row. More...
 
 fillMetaCSV (ilCSVWriter $a_csv)
 Add meta information to csv export. More...
 
 fillHeaderCSV (ilCSVWriter $a_csv)
 CSV Version of Fill Header. More...
 
 fillRowCSV (ilCSVWriter $a_csv, array $a_set)
 CSV Version of Fill Row. More...
 

Protected Attributes

ILIAS DI UIServices $ui
 
ilObjSurvey $object
 
bool $read_only
 
- Protected Attributes inherited from ilTable2GUI
string $requested_tmpl_delete
 
string $requested_tmpl_create
 
string $requested_nav_par2 = ""
 
string $requested_nav_par = ""
 
string $requested_nav_par1 = ""
 
ILIAS Table TableGUIRequest $table_request = null
 
array $selected_columns = []
 
ilCtrl $ctrl
 
object $parent_obj = null
 
string $parent_cmd = ""
 
string $close_command = ""
 
string $top_anchor = "il_table_top"
 
array $filters = array()
 
array $optional_filters = array()
 
string $filter_cmd = 'applyFilter'
 
string $reset_cmd = 'resetFilter'
 
int $filter_cols = 5
 
bool $ext_sort = false
 
bool $ext_seg = false
 
string $context = ""
 
array $mi_sel_buttons = []
 
bool $disable_filter_hiding = false
 
bool $top_commands = true
 
array $selectable_columns = array()
 
array $selected_column = array()
 
bool $show_templates = false
 
bool $show_rows_selector = true
 
bool $rows_selector_off = false
 
bool $nav_determined = false
 
bool $limit_determined = false
 
bool $filters_determined = false
 
bool $columns_determined = false
 
bool $open_form_tag = true
 
bool $close_form_tag = true
 
array $export_formats = []
 
int $export_mode = 0
 
bool $print_mode = false
 
bool $enable_command_for_all = false
 
bool $restore_filter = false
 
array $restore_filter_values = []
 
bool $default_filter_visibility = false
 
array $sortable_fields = array()
 
bool $prevent_double_submission = true
 
string $row_selector_label = ""
 
bool $select_all_on_top = false
 
array $sel_buttons = []
 
string $nav_value = ''
 
string $noentriestext = ''
 
string $css_row = ''
 
bool $display_as_block = false
 
string $description = ''
 
string $id = ""
 
bool $custom_prev_next = false
 
string $reset_cmd_txt = ""
 
string $defaultorderfield = ""
 
string $defaultorderdirection = ""
 
array $column = []
 
bool $datatable = false
 
bool $num_info = false
 
bool $form_multipart = false
 
array $row_data = []
 
string $order_field = ""
 
array $selected_filter = []
 
string $form_action = ""
 
string $formname = ""
 
string $sort_order = ""
 
array $buttons = []
 
array $multi = []
 
array $hidden_inputs = []
 
array $header_commands = []
 
string $row_template = ""
 
string $row_template_dir = ""
 
string $filter_cmd_txt = ""
 
string $custom_prev = ""
 
string $custom_next = ""
 
array $raw_post_data = null
 
ilGlobalTemplateInterface $main_tpl
 
- Protected Attributes inherited from ilTableGUI
string $sort_order
 
string $link_params
 
array $header_params
 
 $tpl
 
ilLanguage $lng
 

Additional Inherited Members

- Static Public Member Functions inherited from ilTable2GUI
static getAllCommandLimit ()
 
- Static Public Member Functions inherited from ilTableGUI
static linkbar (string $AScript, int $AHits, int $ALimit, int $AOffset, array $AParams=array(), array $ALayout=array(), string $prefix='')
 
- Data Fields inherited from ilTable2GUI
const FILTER_TEXT = 1
 
const FILTER_SELECT = 2
 
const FILTER_DATE = 3
 
const FILTER_LANGUAGE = 4
 
const FILTER_NUMBER_RANGE = 5
 
const FILTER_DATE_RANGE = 6
 
const FILTER_DURATION_RANGE = 7
 
const FILTER_DATETIME_RANGE = 8
 
const FILTER_CHECKBOX = 9
 
const EXPORT_EXCEL = 1
 
const EXPORT_CSV = 2
 
const ACTION_ALL_LIMIT = 1000
 
- Data Fields inherited from ilTableGUI
string $title = ""
 
string $icon = ""
 
string $icon_alt = ""
 
string $help_page = ""
 
string $help_icon = ""
 
string $help_icon_alt = ""
 
array $header_names = []
 
array $header_vars = []
 
array $linkbar_vars = []
 
array $data = []
 
int $column_count = 0
 
array $column_width = []
 
int $max_count = 0
 
int $limit = 0
 
bool $max_limit = false
 
int $offset = 0
 
string $order_column = ""
 
string $order_direction = ""
 
string $footer_style = ""
 
string $footer_previous = ""
 
string $footer_next = ""
 
bool $lang_support = true
 
bool $global_tpl = false
 
string $form_name = ""
 
string $select_all_checkbox = ""
 
array $action_buttons = []
 
string $prefix = ""
 
string $base = ""
 
array $enabled
 
array $styles
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Survey question table GUI class

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.d.nosp@m.e

Definition at line 24 of file class.ilSurveyQuestionTableGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilSurveyQuestionTableGUI::__construct ( object  $a_parent_obj,
string  $a_parent_cmd,
ilObjSurvey  $a_survey_obj,
bool  $a_read_only = false 
)

Definition at line 30 of file class.ilSurveyQuestionTableGUI.php.

35 {
36 global $DIC;
37
38 $this->ctrl = $DIC->ctrl();
39 $this->lng = $DIC->language();
40 $ilCtrl = $DIC->ctrl();
41 $lng = $DIC->language();
42 $this->ui = $DIC->ui();
43
44 $this->object = $a_survey_obj;
45 $this->read_only = $a_read_only;
46
47 parent::__construct($a_parent_obj, $a_parent_cmd);
48
49 $this->setId("il_svy_qst");
50 $this->setLimit(9999);
51
52 $edit_manager = $DIC->survey()
53 ->internal()
54 ->domain()
55 ->edit();
56
57 if (!$this->read_only) {
58 // command dropdown
59 if (count($edit_manager->getMoveSurveyQuestions()) === 0 ||
60 $edit_manager->getMoveSurveyId() !== $this->object->getId()) {
61 $this->addMultiCommand("createQuestionblock", $lng->txt("define_questionblock"));
62 $this->addMultiCommand("unfoldQuestionblock", $lng->txt("unfold"));
63 $this->addMultiCommand("removeQuestions", $lng->txt("remove_question"));
64 $this->addMultiCommand("moveQuestions", $lng->txt("move"));
65 $this->addMultiCommand("copyQuestionsToPool", $lng->txt("survey_copy_questions_to_pool"));
66 } else {
67 $this->addMultiCommand("insertQuestionsBefore", $lng->txt("insert_before"));
68 $this->addMultiCommand("insertQuestionsAfter", $lng->txt("insert_after"));
69 }
70
71 // right side
72 $this->addCommandButton("saveObligatory", $lng->txt("save_obligatory_state"));
73
74 $this->setSelectAllCheckbox("id[]");
75 $this->addColumn("", "");
76 $this->addColumn($lng->txt("survey_order"), "");
77 }
78
79 $this->addColumn($lng->txt("title"), "");
80 $this->addColumn($lng->txt("obligatory"), "");
81 $this->addColumn($lng->txt("description"), "");
82 $this->addColumn($lng->txt("type"), "");
83 $this->addColumn($lng->txt("author"), "");
84 $this->addColumn($lng->txt("survey_question_pool"), "");
85
86 if (!$this->read_only) {
87 $this->addColumn("", "");
88 }
89
90 $this->setDefaultOrderField("order");
91 $this->setDefaultOrderDirection("asc");
92
93 $this->setFormAction($ilCtrl->getFormAction($a_parent_obj));
94 $this->setRowTemplate("tpl.il_svy_svy_question_table.html", "Modules/Survey");
95
96 $this->setShowRowsSelector(true);
97
98 $this->importData();
99 }
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...
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setLimit(int $a_limit=0, int $a_default_limit=0)
set max.
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
addMultiCommand(string $a_cmd, string $a_text)
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)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setDefaultOrderDirection(string $a_defaultorderdirection)
ilLanguage $lng
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ilTableGUI\$lng, ILIAS\GlobalScreen\Provider\__construct(), ilTable2GUI\addColumn(), ilTable2GUI\addCommandButton(), ilTable2GUI\addMultiCommand(), ILIAS\Repository\ctrl(), importData(), ILIAS\Repository\lng(), ilTable2GUI\setDefaultOrderDirection(), ilTable2GUI\setDefaultOrderField(), ilTable2GUI\setFormAction(), ilTable2GUI\setId(), ilTable2GUI\setLimit(), ilTable2GUI\setRowTemplate(), ilTable2GUI\setSelectAllCheckbox(), ilTable2GUI\setShowRowsSelector(), ilLanguage\txt(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

Member Function Documentation

◆ fillRow()

ilSurveyQuestionTableGUI::fillRow ( array  $a_set)
protected

Standard Version of Fill Row.

Most likely to be overwritten by derived class.

Parameters
array$a_setdata array

Reimplemented from ilTable2GUI.

Definition at line 198 of file class.ilSurveyQuestionTableGUI.php.

198 : void
199 {
201 $ilCtrl = $this->ctrl;
202
203 $obligatory = "";
204
205 switch ($a_set["type"]) {
206 case "block":
207 if (!$this->read_only) {
208 // checkbox
209 $this->tpl->setCurrentBlock("checkable");
210 $this->tpl->setVariable("QUESTION_ID", $a_set["id"]);
211 $this->tpl->parseCurrentBlock();
212
213 // order
214 if ($a_set["position"]) {
215 $this->tpl->setCurrentBlock("order");
216 $this->tpl->setVariable("ORDER_NAME", "order[" . $a_set["id"] . "]");
217 $this->tpl->setVariable("ORDER_VALUE", $a_set["position"]);
218 $this->tpl->parseCurrentBlock();
219 }
220 }
221
222 $this->tpl->setVariable("TYPE", $lng->txt("questionblock"));
223 break;
224
225 case "question":
226 $this->tpl->setVariable("DESCRIPTION", $a_set["description"]);
227 $this->tpl->setVariable("TYPE", $a_set["question_type"]);
228 $this->tpl->setVariable("AUTHOR", $a_set["author"]);
229 $this->tpl->setVariable("POOL", $a_set["pool"] ?? "");
230
231 if ($a_set["heading"] ?? false) {
232 $this->tpl->setCurrentBlock("heading");
233 $this->tpl->setVariable("TXT_HEADING", $a_set["heading"]);
234 $this->tpl->parseCurrentBlock();
235 }
236
237 if ($a_set["block_id"]) {
238 $this->tpl->setVariable("TITLE_INDENT", " style=\"padding-left:30px\"");
239 }
240
241 if (!$this->read_only) {
242 // checkbox
243 $this->tpl->setCurrentBlock("checkable");
244 $this->tpl->setVariable("QUESTION_ID", $a_set["id"]);
245 $this->tpl->parseCurrentBlock();
246
247 if ($a_set["block_id"]) {
248 $this->tpl->setVariable("CHECKABLE_INDENT", " style=\"padding-left:30px\"");
249 }
250
251 // order
252 if ($a_set["position"] ?? false) {
253 $this->tpl->setCurrentBlock("order");
254 if (!$a_set["block_id"]) {
255 $this->tpl->setVariable("ORDER_NAME", "order[q_" . $a_set["id"] . "]");
256 } else {
257 $this->tpl->setVariable("ORDER_NAME", "block_order[" . $a_set["block_id"] . "][" . $a_set["id"] . "]");
258 }
259 $this->tpl->setVariable("ORDER_VALUE", $a_set["position"]);
260 $this->tpl->parseCurrentBlock();
261 if ($a_set["block_id"]) {
262 $this->tpl->setVariable("ORDER_INDENT", " style=\"padding-left:30px\"");
263 }
264 }
265
266 // obligatory
267 $checked = $a_set["obligatory"] ? " checked=\"checked\"" : "";
268 $obligatory = "<input type=\"checkbox\" name=\"obligatory[" .
269 $a_set["id"] . "]\" value=\"1\"" . $checked . " />";
270 } elseif ($a_set["obligatory"]) {
271 $obligatory = $this->ui->renderer()->render(
272 $this->ui->factory()->symbol()->icon()->custom(ilUtil::getImagePath("icon_checked.svg"), $lng->txt("question_obligatory"))
273 );
274 }
275 $this->tpl->setVariable("OBLIGATORY", $obligatory);
276 break;
277
278 case "heading":
279 if (!$this->read_only) {
280 // checkbox
281 $this->tpl->setCurrentBlock("checkable");
282 $this->tpl->setVariable("QUESTION_ID", $a_set["id"]);
283 $this->tpl->parseCurrentBlock();
284 if ($a_set["in_block"]) {
285 $this->tpl->setVariable("CHECKABLE_INDENT", " style=\"padding-left:30px\"");
286 $this->tpl->setVariable("TITLE_INDENT", " style=\"padding-left:30px\"");
287 }
288 }
289
290 $this->tpl->setVariable("TYPE", $lng->txt("heading"));
291 break;
292 }
293
294 if (!$this->read_only) {
295 $this->tpl->setCurrentBlock("actions");
296
297 $ilCtrl->setParameter($this->parent_obj, "q_id", $a_set["id"]);
298
299 $list = new ilAdvancedSelectionListGUI();
300 $list->setId($a_set["id"]);
301 $list->setListTitle($lng->txt("actions"));
302 if ($a_set["url"]) {
303 $list->addItem($lng->txt("edit"), "", $a_set["url"]);
304 }
305
306 if ($a_set["heading"] ?? false) {
307 $list->addItem(
308 $lng->txt("survey_edit_heading"),
309 "",
310 $ilCtrl->getLinkTarget($this->parent_obj, "editheading")
311 );
312
313 $list->addItem(
314 $lng->txt("survey_delete_heading"),
315 "",
316 $ilCtrl->getLinkTarget($this->parent_obj, "removeheading")
317 );
318 } elseif ($a_set["type"] === "question") {
319 $list->addItem(
320 $lng->txt("add_heading"),
321 "",
322 $ilCtrl->getLinkTarget($this->parent_obj, "addHeading")
323 );
324 }
325
326 $this->tpl->setVariable("ACTION", $list->getHTML());
327
328 $ilCtrl->setParameter($this->parent_obj, "q_id", "");
329
330 $this->tpl->parseCurrentBlock();
331
332 // #11186
333 if ($a_set["url"]) {
334 $this->tpl->setCurrentBlock("title_edit");
335 $this->tpl->setVariable("TITLE", $a_set["title"]);
336 $this->tpl->setVariable("URL_TITLE", $a_set["url"]);
337 } else {
338 $this->tpl->setCurrentBlock("title_static");
339 $this->tpl->setVariable("TITLE", $a_set["title"]);
340 }
341 } else {
342 $this->tpl->setCurrentBlock("title_static");
343 $this->tpl->setVariable("TITLE", $a_set["title"]);
344 }
345 $this->tpl->parseCurrentBlock();
346 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

References ilTable2GUI\$ctrl, ilTableGUI\$lng, ilUtil\getImagePath(), ilLanguage\txt(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ importData()

ilSurveyQuestionTableGUI::importData ( )
protected

Definition at line 101 of file class.ilSurveyQuestionTableGUI.php.

101 : void
102 {
103 $ilCtrl = $this->ctrl;
104
105 $table_data = [];
106 $survey_questions = $this->object->getSurveyQuestions();
107 if (count($survey_questions) > 0) {
109
110 $questionpools = $this->object->getQuestionpoolTitles(true);
111
112 $table_data = array();
113 $last_questionblock_id = $position = $block_position = 0;
114 foreach ($survey_questions as $question_id => $data) {
115 // question block
116 if ($data["questionblock_id"] > 0 &&
117 $data["questionblock_id"] != $last_questionblock_id) {
118 $id = "qb_" . $data["questionblock_id"];
119
120 $table_data[$id] = array("id" => $id,
121 "type" => "block",
122 "title" => $data["questionblock_title"]);
123
124 if (!$this->read_only) {
125 // order
126 if (count($survey_questions) > 1) {
127 $position += 10;
128 $table_data[$id]["position"] = $position;
129 }
130
131 $ilCtrl->setParameter($this->parent_obj, "bl_id", $data["questionblock_id"]);
132 $table_data[$id]["url"] = $ilCtrl->getLinkTarget($this->parent_obj, "editQuestionblock");
133 $ilCtrl->setParameter($this->parent_obj, "bl_id", "");
134 }
135
136 $block_position = 0;
137 }
138
139 // question
140
141 $id = $data["question_id"];
142
143 $table_data[$id] = array("id" => $id,
144 "type" => "question",
145 "heading" => $data["heading"],
146 "title" => $data["title"],
147 "description" => $data["description"],
148 "author" => $data["author"],
149 "block_id" => $data["questionblock_id"],
150 "obligatory" => (bool) $data["obligatory"]);
151
152 // question type
153 foreach ($questiontypes as $trans => $typedata) {
154 if (strcmp($typedata["type_tag"], $data["type_tag"]) === 0) {
155 $table_data[$id]["question_type"] = $trans;
156 }
157 }
158
159 // pool title
160 if ($data["original_id"]) {
161 $original_fi = SurveyQuestion::lookupObjFi($data["original_id"]);
162 if (isset($questionpools[$original_fi])) {
163 $table_data[$id]["pool"] = $questionpools[$original_fi];
164 } else {
165 // #11186
166 $table_data[$id]["pool"] = "-";
167 }
168 }
169
170 if (!$this->read_only) {
171 if ($data["obj_fi"] > 0) {
172 // edit url
173 $q_gui = $data["type_tag"] . "GUI";
174 $ilCtrl->setParameterByClass($q_gui, "q_id", $id);
175 $table_data[$id]["url"] = $ilCtrl->getLinkTargetByClass($q_gui, "editQuestion") .
176 $ilCtrl->setParameterByClass($q_gui, "q_id", "");
177 }
178
179 // order
180 if (count($survey_questions) > 1) {
181 if (!$data["questionblock_id"]) {
182 $position += 10;
183 $table_data[$id]["position"] = $position;
184 } else {
185 $block_position += 10;
186 $table_data[$id]["position"] = $block_position;
187 }
188 }
189 }
190
191 $last_questionblock_id = $data["questionblock_id"];
192 }
193 }
194
195 $this->setData($table_data);
196 }
static lookupObjFi(int $a_qid)
static _getQuestiontypes()
Get all available question types.
setData(array $a_data)
Set table data.

References ilTable2GUI\$ctrl, ilTableGUI\$data, ilTable2GUI\$id, ilObjSurveyQuestionPool\_getQuestiontypes(), SurveyQuestion\lookupObjFi(), and ilTable2GUI\setData().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $object

ilObjSurvey ilSurveyQuestionTableGUI::$object
protected

Definition at line 27 of file class.ilSurveyQuestionTableGUI.php.

◆ $read_only

bool ilSurveyQuestionTableGUI::$read_only
protected

Definition at line 28 of file class.ilSurveyQuestionTableGUI.php.

◆ $ui

ILIAS DI UIServices ilSurveyQuestionTableGUI::$ui
protected

Definition at line 26 of file class.ilSurveyQuestionTableGUI.php.


The documentation for this class was generated from the following file: