ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ilQuestionBrowserTableGUI Class Reference
+ Inheritance diagram for ilQuestionBrowserTableGUI:
+ Collaboration diagram for ilQuestionBrowserTableGUI:

Public Member Functions

 __construct ($a_parent_obj, $a_parent_cmd, $a_write_access=false, $confirmdelete=false, $taxIds=array(), $enableCommenting=false)
 
 isQuestionCommentingEnabled ()
 
 setQuestionCommentingEnabled (bool $questionCommentingEnabled)
 
 setQuestionData ($questionData)
 
 getSelectableColumns ()
 
 initFilter ()
 Init filter. More...
 
 fillHeader ()
 
 fillRow (array $a_set)
 fill row public More...
 
 setEditable ($value)
 
 getEditable ()
 
 setWriteAccess ($value)
 
 getWriteAccess ()
 
 numericOrdering (string $a_field)
 
- 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 ()
 
 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)
 
- 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

 isCommentsColumnSelected ()
 
 getCommentsHtml ($qData)
 
 getCommentsAjaxLink ($questionId)
 
- 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 Notes Service $notes
 
ILIAS UI Factory $ui_factory
 
ILIAS UI Renderer $renderer
 
 $editable = true
 
 $writeAccess = false
 
 $totalPoints = 0
 
 $confirmdelete
 
array $filter = []
 
 $taxIds = array()
 
 $questionCommentingEnabled = false
 
- 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
 

Private Attributes

ILIAS TestQuestionPool InternalRequestService $request
 
QuestionInfoService $questioninfo
 

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

Constructor & Destructor Documentation

◆ __construct()

ilQuestionBrowserTableGUI::__construct (   $a_parent_obj,
  $a_parent_cmd,
  $a_write_access = false,
  $confirmdelete = false,
  $taxIds = array(),
  $enableCommenting = false 
)

Definition at line 50 of file class.ilQuestionBrowserTableGUI.php.

References Vendor\Package\$c, $confirmdelete, $DIC, ilTableGUI\$lng, $taxIds, ILIAS\MetaData\Repository\Validation\Data\__construct(), ilTable2GUI\addColumn(), ilTable2GUI\addCommandButton(), ilTable2GUI\addMultiCommand(), ILIAS\Repository\ctrl(), ilTableGUI\disable(), ilTableGUI\enable(), ilTable2GUI\getSelectedColumns(), getWriteAccess(), initFilter(), isQuestionCommentingEnabled(), ILIAS\Repository\lng(), ilTable2GUI\setDefaultOrderDirection(), ilTable2GUI\setDefaultOrderField(), ilTable2GUI\setFilterCommand(), ilTable2GUI\setFormAction(), ilTable2GUI\setFormName(), ilTable2GUI\setId(), setQuestionCommentingEnabled(), ilTable2GUI\setResetCommand(), ilTable2GUI\setRowTemplate(), ilTable2GUI\setSelectAllCheckbox(), ilTable2GUI\setShowRowsSelector(), ilTableGUI\setStyle(), and setWriteAccess().

51  {
52  $this->setQuestionCommentingEnabled($enableCommenting);
53 
54  // Bugfix: #0019539
55  if ($confirmdelete) {
56  $this->setId("qpl_confirm_del_" . $a_parent_obj->object->getRefId());
57  } else {
58  $this->setId("qpl_qst_brows_" . $a_parent_obj->object->getRefId());
59  }
60 
61  parent::__construct($a_parent_obj, $a_parent_cmd);
62 
63  global $DIC;
64  $lng = $DIC['lng'];
65  $ilCtrl = $DIC['ilCtrl'];
66  $this->request = $DIC->testQuestionPool()->internal()->request();
67  $this->lng = $lng;
68  $this->ctrl = $ilCtrl;
69  $this->questioninfo = $DIC->testQuestionPool()->questionInfo();
70 
71  $this->renderer = $DIC->ui()->renderer();
72  $this->ui_factory = $DIC->ui()->factory();
73 
74  $this->confirmdelete = $confirmdelete;
75  $this->setWriteAccess($a_write_access);
76  $this->taxIds = $taxIds;
77 
78  $qplSetting = new ilSetting("qpl");
79 
80  $this->setFormName('questionbrowser');
81  $this->setStyle('table', 'fullwidth');
82  if (!$confirmdelete) {
83  $this->addColumn('', '', '1%');
84  $this->addColumn($this->lng->txt("title"), 'title', '');
85  foreach ($this->getSelectedColumns() as $c) {
86  if (strcmp($c, 'description') == 0) {
87  $this->addColumn($this->lng->txt("description"), 'description', '');
88  }
89  if (strcmp($c, 'type') == 0) {
90  $this->addColumn($this->lng->txt("question_type"), 'ttype', '');
91  }
92  // According to mantis #12713
93  if (strcmp($c, 'points') == 0) {
94  $this->addColumn($this->lng->txt("points"), 'points', '', false, 'ilCenterForced');
95  }
96  if (strcmp($c, 'statistics') == 0) {
97  $this->addColumn($this->lng->txt('statistics'), '', '');
98  }
99  if (strcmp($c, 'author') == 0) {
100  $this->addColumn($this->lng->txt("author"), 'author', '');
101  }
102  if ($c == 'lifecycle') {
103  $this->addColumn($this->lng->txt('qst_lifecycle'), 'lifecycle', '');
104  }
105  if ($this->isQuestionCommentingEnabled() && $c == 'comments') {
106  $this->addColumn($this->lng->txt("ass_comments"), 'comments', '');
107  }
108  if (strcmp($c, 'created') == 0) {
109  $this->addColumn($this->lng->txt("create_date"), 'created', '');
110  }
111  if (strcmp($c, 'tstamp') == 0) {
112  $this->addColumn($this->lng->txt("last_update"), 'tstamp', '');
113  }
114  }
115  $this->addColumn($this->lng->txt('actions'), '');
116  $this->setSelectAllCheckbox('q_id');
117  } else {
118  $this->addColumn($this->lng->txt("title"), 'title', '');
119  foreach ($this->getSelectedColumns() as $c) {
120  if (strcmp($c, 'description') == 0) {
121  $this->addColumn($this->lng->txt("description"), 'description', '');
122  }
123  if (strcmp($c, 'type') == 0) {
124  $this->addColumn($this->lng->txt("question_type"), 'ttype', '');
125  }
126  }
127  }
128 
129  if ($this->getWriteAccess()) {
130  if ($confirmdelete) {
131  $this->addCommandButton('confirmDeleteQuestions', $this->lng->txt('confirm'));
132  $this->addCommandButton('cancelDeleteQuestions', $this->lng->txt('cancel'));
133  } else {
134  $this->addMultiCommand('copy', $this->lng->txt('copy'));
135  $this->addMultiCommand('move', $this->lng->txt('move'));
136  $this->addMultiCommand('exportQuestion', $this->lng->txt('export'));
137  $this->addMultiCommand('deleteQuestions', $this->lng->txt('delete'));
138  }
139  }
140 
141  $this->setRowTemplate("tpl.il_as_qpl_questionbrowser_row.html", "Modules/TestQuestionPool");
142 
143  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
144  $this->setDefaultOrderField("title");
145  $this->setDefaultOrderDirection("asc");
146 
147  $this->setShowRowsSelector(true);
148 
149  if ($confirmdelete) {
150  $this->disable('sort');
151  $this->disable('select_all');
152  } else {
153  $this->enable('sort');
154  $this->enable('header');
155  $this->enable('select_all');
156  $this->setFilterCommand('filterQuestionBrowser');
157  $this->setResetCommand('resetQuestionBrowser');
158  $this->initFilter();
159  }
160  $this->notes = $DIC->notes();
161  if ($this->isQuestionCommentingEnabled()) {
162  $this->notes->gui()->initJavascript();
163  }
164  }
enable(string $a_module_name)
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="")
setResetCommand(string $a_val, string $a_caption="")
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
setFormName(string $a_name="")
ilLanguage $lng
setId(string $a_val)
global $DIC
Definition: feed.php:28
setStyle(string $a_element, string $a_style)
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
__construct(VocabulariesInterface $vocabularies)
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)
setQuestionCommentingEnabled(bool $questionCommentingEnabled)
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)
disable(string $a_module_name)
addMultiCommand(string $a_cmd, string $a_text)
+ Here is the call graph for this function:

Member Function Documentation

◆ fillHeader()

ilQuestionBrowserTableGUI::fillHeader ( )

Definition at line 341 of file class.ilQuestionBrowserTableGUI.php.

References ilTable2GUI\$column, ILIAS\LTI\ToolProvider\$key, and ILIAS\Repository\lng().

341  : void
342  {
343  foreach ($this->column as $key => $column) {
344  if (strcmp($column['text'], $this->lng->txt("points")) == 0) {
345  $this->column[$key]['text'] = $this->lng->txt("points") . " (" . $this->totalPoints . ")";
346  }
347  }
348  parent::fillHeader();
349  }
string $key
Consumer key/client ID value.
Definition: System.php:193
+ Here is the call graph for this function:

◆ fillRow()

ilQuestionBrowserTableGUI::fillRow ( array  $a_set)

fill row public

Parameters

Definition at line 357 of file class.ilQuestionBrowserTableGUI.php.

References Vendor\Package\$c, ilTableGUI\$icon, $lifecycle, assQuestionGUI\_getGUIClassNameForId(), ilAssQuestionFeedbackEditingGUI\CMD_SHOW, ilAssQuestionPreviewGUI\CMD_SHOW, ilAssQuestionHintsGUI\CMD_SHOW_LIST, ilAssQuestionPreviewGUI\CMD_STATISTICS, ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), getCommentsAjaxLink(), getCommentsHtml(), getEditable(), ilUtil\getImagePath(), ilAssQuestionLifecycle\getInstance(), ilTable2GUI\getSelectedColumns(), getWriteAccess(), IL_CAL_UNIX, isQuestionCommentingEnabled(), and ILIAS\Repository\lng().

357  : void
358  {
359  $class = strtolower(assQuestionGUI::_getGUIClassNameForId($a_set["question_id"]));
360  $this->ctrl->setParameterByClass("ilAssQuestionPageGUI", "q_id", $a_set["question_id"]);
361  $this->ctrl->setParameterByClass("ilAssQuestionPreviewGUI", "q_id", $a_set["question_id"]);
362  $this->ctrl->setParameterByClass($class, "q_id", $a_set["question_id"]);
363  $points = 0;
364 
365  $actions = [];
366 
367  if (!$this->confirmdelete) {
368  $this->tpl->setCurrentBlock('checkbox');
369  $this->tpl->setVariable('CB_QUESTION_ID', $a_set["question_id"]);
370  $this->tpl->parseCurrentBlock();
371 
372  if ($a_set["complete"] == 0) {
373  $icon = $this->ui_factory->symbol()->icon()->custom(ilUtil::getImagePath("standard/icon_alert.svg"), $this->lng->txt("warning_question_not_complete"));
374  $this->tpl->setCurrentBlock("qpl_warning");
375  $this->tpl->setVariable("ICON_WARNING", $this->renderer->render($icon));
376  $this->tpl->parseCurrentBlock();
377  } else {
378  $points = $a_set["points"];
379  }
380  $this->totalPoints += $points;
381 
382  foreach ($this->getSelectedColumns() as $c) {
383  if (strcmp($c, 'points') == 0) {
384  $this->tpl->setCurrentBlock('points');
385  $this->tpl->setVariable("QUESTION_POINTS", $points);
386  $this->tpl->parseCurrentBlock();
387  }
388  if (strcmp($c, 'statistics') == 0) {
389  $this->tpl->setCurrentBlock('statistics');
390  $this->tpl->setVariable("LINK_ASSESSMENT", $this->ctrl->getLinkTargetByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_STATISTICS));
391  $this->tpl->setVariable("TXT_ASSESSMENT", $this->lng->txt("statistics"));
392  $this->tpl->setVariable("IMG_ASSESSMENT", ilUtil::getImagePath("assessment.gif", "Modules/TestQuestionPool"));
393  $this->tpl->parseCurrentBlock();
394  }
395  if (strcmp($c, 'author') == 0) {
396  $this->tpl->setCurrentBlock('author');
397  $this->tpl->setVariable("QUESTION_AUTHOR", $a_set["author"]);
398  $this->tpl->parseCurrentBlock();
399  }
400  if ($c == 'lifecycle') {
401  $lifecycle = ilAssQuestionLifecycle::getInstance($a_set['lifecycle']);
402 
403  $this->tpl->setCurrentBlock('lifecycle');
404  $this->tpl->setVariable("QUESTION_LIFECYCLE", $lifecycle->getTranslation($this->lng));
405  $this->tpl->parseCurrentBlock();
406  }
407  if ($c == 'comments' && $this->isQuestionCommentingEnabled()) {
408  $this->tpl->setCurrentBlock('comments');
409  $this->tpl->setVariable("COMMENTS", $this->getCommentsHtml($a_set));
410  $this->tpl->parseCurrentBlock();
411  }
412  if (strcmp($c, 'created') == 0) {
413  $this->tpl->setCurrentBlock('created');
414  $this->tpl->setVariable('QUESTION_CREATED', ilDatePresentation::formatDate(new ilDateTime($a_set['created'], IL_CAL_UNIX)));
415  $this->tpl->parseCurrentBlock();
416  }
417  if (strcmp($c, 'tstamp') == 0) {
418  $this->tpl->setCurrentBlock('updated');
419  $this->tpl->setVariable('QUESTION_UPDATED', ilDatePresentation::formatDate(new ilDateTime($a_set['tstamp'], IL_CAL_UNIX)));
420  $this->tpl->parseCurrentBlock();
421  }
422  }
423 
424  $actions[] = $this->ui_factory->link()->standard(
425  $this->lng->txt('preview'),
426  $this->ctrl->getLinkTargetByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW)
427  );
428 
429  $actions[] = $this->ui_factory->link()->standard(
430  $this->lng->txt('statistics'),
431  $this->ctrl->getLinkTargetByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_STATISTICS)
432  );
433 
434  if ($this->getEditable()) {
435  $this->ctrl->setParameterByClass($a_set['type_tag'] . 'GUI', 'q_id', $a_set['question_id']);
436  $editHref = $this->ctrl->getLinkTargetByClass($a_set['type_tag'] . 'GUI', 'editQuestion');
437  $this->ctrl->setParameterByClass($a_set['type_tag'] . 'GUI', 'q_id', null);
438  $actions[] = $this->ui_factory->link()->standard($this->lng->txt('edit_question'), $editHref);
439 
440  $editPageHref = $this->ctrl->getLinkTargetByClass('ilAssQuestionPageGUI', 'edit');
441  $actions[] = $this->ui_factory->link()->standard($this->lng->txt('edit_page'), $editPageHref);
442  }
443 
444  if ($this->getWriteAccess()) {
445  $this->ctrl->setParameter($this->parent_obj, 'q_id', $a_set['question_id']);
446  $moveHref = $this->ctrl->getLinkTarget($this->parent_obj, 'move');
447  $this->ctrl->setParameter($this->parent_obj, 'q_id', null);
448  $actions[] = $this->ui_factory->link()->standard($this->lng->txt('move'), $moveHref);
449 
450  $this->ctrl->setParameter($this->parent_obj, 'q_id', $a_set['question_id']);
451  $copyHref = $this->ctrl->getLinkTarget($this->parent_obj, 'copy');
452  $this->ctrl->setParameter($this->parent_obj, 'q_id', null);
453  $actions[] = $this->ui_factory->link()->standard($this->lng->txt('copy'), $copyHref);
454 
455  $this->ctrl->setParameter($this->parent_obj, 'q_id', $a_set['question_id']);
456  $deleteHref = $this->ctrl->getLinkTarget($this->parent_obj, 'deleteQuestions');
457  $this->ctrl->setParameter($this->parent_obj, 'q_id', null);
458  $actions[] = $this->ui_factory->link()->standard($this->lng->txt('delete'), $deleteHref);
459  }
460 
461  if ($this->getEditable()) {
462  $this->ctrl->setParameterByClass('ilAssQuestionFeedbackEditingGUI', 'q_id', $a_set['question_id']);
463  $feedbackHref = $this->ctrl->getLinkTargetByClass('ilAssQuestionFeedbackEditingGUI', ilAssQuestionFeedbackEditingGUI::CMD_SHOW);
464  $this->ctrl->setParameterByClass('ilAssQuestionFeedbackEditingGUI', 'q_id', null);
465  $actions[] = $this->ui_factory->link()->standard($this->lng->txt('tst_feedback'), $feedbackHref);
466 
467  $this->ctrl->setParameterByClass('ilAssQuestionHintsGUI', 'q_id', $a_set['question_id']);
468  $hintsHref = $this->ctrl->getLinkTargetByClass('ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
469  $this->ctrl->setParameterByClass('ilAssQuestionHintsGUI', 'q_id', null);
470  $actions[] = $this->ui_factory->link()->standard($this->lng->txt('tst_question_hints_tab'), $hintsHref);
471  }
472 
473  if ($this->isQuestionCommentingEnabled()) {
474  $actions[] = $this->ui_factory->link()->standard($this->lng->txt('ass_comments'), $this->getCommentsAjaxLink($a_set['question_id']));
475  }
476  } else {
477  $this->tpl->setCurrentBlock('hidden');
478  $this->tpl->setVariable('HIDDEN_QUESTION_ID', $a_set["question_id"]);
479  $this->tpl->parseCurrentBlock();
480  }
481 
482  foreach ($this->getSelectedColumns() as $c) {
483  if (strcmp($c, 'description') == 0) {
484  $this->tpl->setCurrentBlock('description');
485  $this->tpl->setVariable("QUESTION_COMMENT", $a_set['description']);
486  $this->tpl->parseCurrentBlock();
487  }
488  if (strcmp($c, 'type') == 0) {
489  $this->tpl->setCurrentBlock('type');
490  $this->tpl->setVariable("QUESTION_TYPE", $this->questioninfo->getQuestionTypeName($a_set["question_id"]));
491  $this->tpl->parseCurrentBlock();
492  }
493  }
494  $this->tpl->setVariable('QUESTION_ID', $a_set["question_id"]);
495  if (!$this->confirmdelete) {
496  $this->tpl->setVariable('QUESTION_HREF_LINKED', $this->ctrl->getLinkTargetByClass('ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_SHOW));
497  $this->tpl->setVariable('QUESTION_TITLE_LINKED', $a_set['title']);
498 
499  $dropdown = $this->ui_factory->dropdown()->standard($actions)->withLabel($this->lng->txt('actions'));
500 
501  $this->tpl->setVariable('ACTIONS', $this->renderer->render($dropdown));
502  } else {
503  $this->tpl->setVariable('QUESTION_ID_UNLINKED', $a_set['question_id']);
504  $this->tpl->setVariable('QUESTION_TITLE_UNLINKED', $a_set['title']);
505  }
506  }
static _getGUIClassNameForId($a_q_id)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
const IL_CAL_UNIX
const CMD_SHOW_LIST
command constants
$lifecycle
+ Here is the call graph for this function:

◆ getCommentsAjaxLink()

ilQuestionBrowserTableGUI::getCommentsAjaxLink (   $questionId)
protected

Definition at line 557 of file class.ilQuestionBrowserTableGUI.php.

References ilCommonActionDispatcherGUI\buildAjaxHash(), and ilNoteGUI\getListCommentsJSCall().

Referenced by fillRow(), and getCommentsHtml().

557  : string
558  {
559  $ajax_hash = ilCommonActionDispatcherGUI::buildAjaxHash(1, $this->request->getRefId(), 'quest', $this->parent_obj->object->getId(), 'quest', $questionId);
560  $update_code = "il.UI.counter.getCounterObject($(\".ilTableOuter\")).incrementStatusCount(1);";
561  return ilCommentGUI::getListCommentsJSCall($ajax_hash, $update_code);
562  }
static buildAjaxHash(int $node_type, ?int $node_id, string $obj_type, int $obj_id, string $sub_type=null, int $sub_id=null, int $news_id=0)
Build ajax hash.
static getListCommentsJSCall(string $a_hash, string $a_update_code=null)
Get list comments js call.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCommentsHtml()

ilQuestionBrowserTableGUI::getCommentsHtml (   $qData)
protected

Definition at line 541 of file class.ilQuestionBrowserTableGUI.php.

References ilTable2GUI\$id, getCommentsAjaxLink(), and ILIAS\UI\Implementation\Component\withAdditionalOnLoadCode().

Referenced by fillRow().

541  : string
542  {
543  if (!$qData['comments']) {
544  return '';
545  }
546 
547  $ajax_link = $this->getCommentsAjaxLink($qData['question_id']);
548 
549  $comment_glyph = $this->ui_factory->symbol()->glyph()->comment()->withCounter(
550  $this->ui_factory->counter()->status($qData['comments'])
551  )->withAdditionalOnLoadCode(function ($id) use ($ajax_link): string {
552  return "document.getElementById('$id').onclick = function (event) { $ajax_link; };";
553  });
554  return $this->renderer->render($comment_glyph);
555  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getEditable()

ilQuestionBrowserTableGUI::getEditable ( )

Definition at line 513 of file class.ilQuestionBrowserTableGUI.php.

References $editable.

Referenced by fillRow().

513  : bool
514  {
515  return $this->editable;
516  }
+ Here is the caller graph for this function:

◆ getSelectableColumns()

ilQuestionBrowserTableGUI::getSelectableColumns ( )

Definition at line 214 of file class.ilQuestionBrowserTableGUI.php.

References $DIC, ilTableGUI\$lng, isQuestionCommentingEnabled(), and ilLanguage\txt().

214  : array
215  {
216  global $DIC;
217  $lng = $DIC['lng'];
218  $cols["description"] = array(
219  "txt" => $lng->txt("description"),
220  "default" => true
221  );
222  $cols["type"] = array(
223  "txt" => $lng->txt("question_type"),
224  "default" => true
225  );
226  if (!$this->confirmdelete) {
227  $cols["points"] = array(
228  "txt" => $lng->txt("points"),
229  "default" => true
230  );
231  $cols["statistics"] = array(
232  "txt" => $lng->txt("statistics"),
233  "default" => true
234  );
235  $cols["author"] = array(
236  "txt" => $lng->txt("author"),
237  "default" => true
238  );
239  $cols['lifecycle'] = array(
240  'txt' => $lng->txt('qst_lifecycle'),
241  'default' => true
242  );
243  if ($this->isQuestionCommentingEnabled()) {
244  $cols["comments"] = array(
245  "txt" => $lng->txt("comments"),
246  "default" => true
247  );
248  }
249  $cols["created"] = array(
250  "txt" => $lng->txt("create_date"),
251  "default" => true
252  );
253  $cols["tstamp"] = array(
254  "txt" => $lng->txt("last_update"),
255  "default" => true
256  );
257  }
258  return $cols;
259  }
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
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

◆ getWriteAccess()

ilQuestionBrowserTableGUI::getWriteAccess ( )

Definition at line 523 of file class.ilQuestionBrowserTableGUI.php.

References $writeAccess.

Referenced by __construct(), and fillRow().

523  : bool
524  {
525  return $this->writeAccess;
526  }
+ Here is the caller graph for this function:

◆ initFilter()

ilQuestionBrowserTableGUI::initFilter ( )

Init filter.

Definition at line 264 of file class.ilQuestionBrowserTableGUI.php.

References $comments, $DIC, ilTableGUI\$lng, ilObjQuestionPool\_getQuestionTypes(), ilTable2GUI\addFilterItem(), ILIAS\Repository\filter(), ilAssQuestionLifecycle\getDraftInstance(), isQuestionCommentingEnabled(), ILIAS\Repository\lng(), ilSelectInputGUI\setOptions(), and ilLanguage\txt().

Referenced by __construct().

264  : void
265  {
266  global $DIC;
267  $lng = $DIC['lng'];
268 
269  $ti = new ilTextInputGUI($lng->txt("title"), "title");
270  $ti->setMaxLength(64);
271  $ti->setValidationRegexp('/^[^%]+$/is');
272  $ti->setSize(20);
273  $this->addFilterItem($ti);
274  $ti->readFromSession();
275  $this->filter["title"] = $ti->getValue();
276 
277  // description
278  $ti = new ilTextInputGUI($lng->txt("description"), "description");
279  $ti->setMaxLength(64);
280  $ti->setSize(20);
281  $ti->setValidationRegexp('/^[^%]+$/is');
282  $this->addFilterItem($ti);
283  $ti->readFromSession();
284  $this->filter["description"] = $ti->getValue();
285 
286  if (!$this->confirmdelete) {
287  // author
288  $ti = new ilTextInputGUI($lng->txt("author"), "author");
289  $ti->setMaxLength(64);
290  $ti->setSize(20);
291  $ti->setValidationRegexp('/^[^%]+$/is');
292  $this->addFilterItem($ti);
293  $ti->readFromSession();
294  $this->filter["author"] = $ti->getValue();
295  }
296 
297  // lifecycle
298  $lifecycleOptions = array_merge(
299  array('' => $this->lng->txt('qst_lifecycle_filter_all')),
300  ilAssQuestionLifecycle::getDraftInstance()->getSelectOptions($this->lng)
301  );
302  $lifecycleInp = new ilSelectInputGUI($this->lng->txt('qst_lifecycle'), 'lifecycle');
303  $lifecycleInp->setOptions($lifecycleOptions);
304  $this->addFilterItem($lifecycleInp);
305  $lifecycleInp->readFromSession();
306  $this->filter['lifecycle'] = $lifecycleInp->getValue();
307 
309  $options = array();
310  $options[""] = $lng->txt('filter_all_question_types');
311  foreach ($types as $translation => $row) {
312  $options[$row['type_tag']] = $translation;
313  }
314 
315  $si = new ilSelectInputGUI($this->lng->txt("question_type"), "type");
316  $si->setOptions($options);
317  $this->addFilterItem($si);
318  $si->readFromSession();
319  $this->filter["type"] = $si->getValue();
320 
321  if ($this->parent_obj->object->getShowTaxonomies()) {
322  foreach ($this->taxIds as $taxId) {
323  $postvar = "tax_$taxId";
324 
325  $inp = new ilTaxSelectInputGUI($taxId, $postvar, true);
326  $this->addFilterItem($inp);
327  $inp->readFromSession();
328  $this->filter[$postvar] = $inp->getValue();
329  }
330  }
331 
332  // comments
333  if ($this->isQuestionCommentingEnabled()) {
334  $comments = new ilCheckboxInputGUI($lng->txt('ass_commented_questions_only'), 'commented');
335  $this->addFilterItem($comments);
336  $comments->readFromSession();
337  $this->filter['commented'] = $comments->getChecked();
338  }
339  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a selection list property in a property form.
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...
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
setOptions(array $a_options)
ilLanguage $lng
global $DIC
Definition: feed.php:28
$comments
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isCommentsColumnSelected()

ilQuestionBrowserTableGUI::isCommentsColumnSelected ( )
protected

Definition at line 182 of file class.ilQuestionBrowserTableGUI.php.

References ilTable2GUI\getSelectedColumns().

Referenced by setQuestionData().

182  : bool
183  {
184  return in_array('comments', $this->getSelectedColumns());
185  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isQuestionCommentingEnabled()

ilQuestionBrowserTableGUI::isQuestionCommentingEnabled ( )
Returns
bool

Definition at line 169 of file class.ilQuestionBrowserTableGUI.php.

References $questionCommentingEnabled.

Referenced by __construct(), fillRow(), getSelectableColumns(), initFilter(), and setQuestionData().

169  : bool
170  {
172  }
+ Here is the caller graph for this function:

◆ numericOrdering()

ilQuestionBrowserTableGUI::numericOrdering ( string  $a_field)
Parameters
string$a_field
Returns
bool

Definition at line 532 of file class.ilQuestionBrowserTableGUI.php.

532  : bool
533  {
534  if (in_array($a_field, array('points', 'created', 'tstamp', 'comments'))) {
535  return true;
536  }
537 
538  return false;
539  }

◆ setEditable()

ilQuestionBrowserTableGUI::setEditable (   $value)

Definition at line 508 of file class.ilQuestionBrowserTableGUI.php.

508  : void
509  {
510  $this->editable = $value;
511  }

◆ setQuestionCommentingEnabled()

ilQuestionBrowserTableGUI::setQuestionCommentingEnabled ( bool  $questionCommentingEnabled)
Parameters
bool$questionCommentingEnabled

Definition at line 177 of file class.ilQuestionBrowserTableGUI.php.

References $questionCommentingEnabled.

Referenced by __construct().

177  : void
178  {
179  $this->questionCommentingEnabled = $questionCommentingEnabled;
180  }
+ Here is the caller graph for this function:

◆ setQuestionData()

ilQuestionBrowserTableGUI::setQuestionData (   $questionData)

Definition at line 187 of file class.ilQuestionBrowserTableGUI.php.

References ilTableGUI\$data, ILIAS\LTI\ToolProvider\$key, ILIAS\Repository\filter(), isCommentsColumnSelected(), isQuestionCommentingEnabled(), and ilTable2GUI\setData().

187  : void
188  {
189  if ($this->isQuestionCommentingEnabled() && ($this->isCommentsColumnSelected() || $this->filter['commented'])) {
190  foreach ($questionData as $key => $data) {
191  $notes_context = $this->notes
192  ->data()
193  ->context(
194  $this->parent_obj->object->getId(),
195  $data['question_id'],
196  'quest'
197  );
198  $numComments = $this->notes
199  ->domain()
200  ->getNrOfCommentsForContext($notes_context);
201 
202  if ($this->filter['commented'] && !$numComments) {
203  unset($questionData[$key]);
204  continue;
205  }
206 
207  $questionData[$key]['comments'] = $numComments;
208  }
209  }
210 
211  $this->setData($questionData);
212  }
setData(array $a_data)
string $key
Consumer key/client ID value.
Definition: System.php:193
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
+ Here is the call graph for this function:

◆ setWriteAccess()

ilQuestionBrowserTableGUI::setWriteAccess (   $value)

Definition at line 518 of file class.ilQuestionBrowserTableGUI.php.

Referenced by __construct().

518  : void
519  {
520  $this->writeAccess = $value;
521  }
+ Here is the caller graph for this function:

Field Documentation

◆ $confirmdelete

ilQuestionBrowserTableGUI::$confirmdelete
protected

Definition at line 40 of file class.ilQuestionBrowserTableGUI.php.

Referenced by __construct().

◆ $editable

ilQuestionBrowserTableGUI::$editable = true
protected

Definition at line 37 of file class.ilQuestionBrowserTableGUI.php.

Referenced by getEditable().

◆ $filter

array ilQuestionBrowserTableGUI::$filter = []
protected

Definition at line 41 of file class.ilQuestionBrowserTableGUI.php.

◆ $notes

ILIAS Notes Service ilQuestionBrowserTableGUI::$notes
protected

Definition at line 34 of file class.ilQuestionBrowserTableGUI.php.

◆ $questionCommentingEnabled

ilQuestionBrowserTableGUI::$questionCommentingEnabled = false
protected

◆ $questioninfo

QuestionInfoService ilQuestionBrowserTableGUI::$questioninfo
private

Definition at line 33 of file class.ilQuestionBrowserTableGUI.php.

◆ $renderer

ILIAS UI Renderer ilQuestionBrowserTableGUI::$renderer
protected

Definition at line 36 of file class.ilQuestionBrowserTableGUI.php.

◆ $request

ILIAS TestQuestionPool InternalRequestService ilQuestionBrowserTableGUI::$request
private

Definition at line 32 of file class.ilQuestionBrowserTableGUI.php.

◆ $taxIds

ilQuestionBrowserTableGUI::$taxIds = array()
protected

Definition at line 43 of file class.ilQuestionBrowserTableGUI.php.

Referenced by __construct().

◆ $totalPoints

ilQuestionBrowserTableGUI::$totalPoints = 0
protected

Definition at line 39 of file class.ilQuestionBrowserTableGUI.php.

◆ $ui_factory

ILIAS UI Factory ilQuestionBrowserTableGUI::$ui_factory
protected

Definition at line 35 of file class.ilQuestionBrowserTableGUI.php.

◆ $writeAccess

ilQuestionBrowserTableGUI::$writeAccess = false
protected

Definition at line 38 of file class.ilQuestionBrowserTableGUI.php.

Referenced by getWriteAccess().


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