ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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)
 
 getData ()
 
 dataExists ()
 
 setPrefix (string $a_prefix)
 
 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 ()
 
 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 ()
 
 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)
 
- 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)
 
- 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 Survey InternalGUIService $gui
 
ILIAS DI UIServices $ui
 
ilObjSurvey $object
 
bool $read_only
 
- Protected Attributes inherited from ilTable2GUI
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_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 31 of file class.ilSurveyQuestionTableGUI.php.

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().

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

Member Function Documentation

◆ fillRow()

ilSurveyQuestionTableGUI::fillRow ( array  $a_set)
protected

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

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

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

◆ importData()

ilSurveyQuestionTableGUI::importData ( )
protected

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

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

Referenced by __construct().

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

Field Documentation

◆ $gui

ILIAS Survey InternalGUIService ilSurveyQuestionTableGUI::$gui
protected

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

◆ $object

ilObjSurvey ilSurveyQuestionTableGUI::$object
protected

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

◆ $read_only

bool ilSurveyQuestionTableGUI::$read_only
protected

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

◆ $ui

ILIAS DI UIServices ilSurveyQuestionTableGUI::$ui
protected

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


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