ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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=[], $enableCommenting=false)
 
 isQuestionCommentingEnabled ()
 
 setQuestionCommentingEnabled (bool $questionCommentingEnabled)
 
 setQuestionData ($questionData)
 
 getSelectableColumns ()
 Get selectable columns. More...
 
 initFilter ()
 Init filter. More...
 
 fillHeader ()
 
 fillRow (array $a_set)
 fill row @access 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)
 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 ()
 
 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

 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 = []
 
 $questionCommentingEnabled = false
 
- 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
 

Private Attributes

RequestDataCollector $request
 
GeneralQuestionPropertiesRepository $questionrepository
 

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

Author
Helmut Schottmüller ilias.nosp@m.@aur.nosp@m.ealis.nosp@m..de
Version
$Id$

\

@ilCtrl_Calls ilQuestionBrowserTableGUI: ilFormPropertyDispatchGUI

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

Constructor & Destructor Documentation

◆ __construct()

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

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

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

References $c, $confirmdelete, $DIC, $taxIds, ILIAS\GlobalScreen\Provider\__construct(), ilTable2GUI\addColumn(), ilTable2GUI\addCommandButton(), ilTable2GUI\addMultiCommand(), ILIAS\Repository\ctrl(), ilTableGUI\disable(), ilTableGUI\enable(), ilTable2GUI\getSelectedColumns(), getWriteAccess(), initFilter(), isQuestionCommentingEnabled(), ILIAS\Repository\lng(), renderer(), 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().

+ Here is the call graph for this function:

Member Function Documentation

◆ fillHeader()

ilQuestionBrowserTableGUI::fillHeader ( )

Reimplemented from ilTable2GUI.

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

348 : void
349 {
350 foreach ($this->column as $key => $column) {
351 if (strcmp($column['text'], $this->lng->txt("points")) == 0) {
352 $this->column[$key]['text'] = $this->lng->txt("points") . " (" . $this->totalPoints . ")";
353 }
354 }
355 parent::fillHeader();
356 }

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

+ Here is the call graph for this function:

◆ fillRow()

ilQuestionBrowserTableGUI::fillRow ( array  $a_set)

fill row @access public

Parameters

return void

Reimplemented from ilTable2GUI.

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

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

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

+ Here is the call graph for this function:

◆ getCommentsAjaxLink()

ilQuestionBrowserTableGUI::getCommentsAjaxLink (   $questionId)
protected

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

559 : string
560 {
561 $ajax_hash = ilCommonActionDispatcherGUI::buildAjaxHash(1, $this->request->getRefId(), 'quest', $this->parent_obj->getObject()->getId(), 'quest', $questionId);
562 $update_code = "il.UI.counter.getCounterObject($(\".ilTableOuter\")).incrementStatusCount(1);";
563 return ilCommentGUI::getListCommentsJSCall($ajax_hash, $update_code);
564 }
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.

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

Referenced by getCommentsHtml().

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

◆ getCommentsHtml()

ilQuestionBrowserTableGUI::getCommentsHtml (   $qData)
protected

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

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

References ilTable2GUI\$id, getCommentsAjaxLink(), and renderer().

Referenced by fillRow().

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

◆ getEditable()

ilQuestionBrowserTableGUI::getEditable ( )

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

515 : bool
516 {
517 return $this->editable;
518 }

References $editable.

Referenced by fillRow().

+ Here is the caller graph for this function:

◆ getSelectableColumns()

ilQuestionBrowserTableGUI::getSelectableColumns ( )

Get selectable columns.

Returns
array key: column id, val: true/false -> default on/off

Reimplemented from ilTable2GUI.

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

223 : array
224 {
225 global $DIC;
226 $lng = $DIC['lng'];
227 $cols["description"] = [
228 "txt" => $lng->txt("description"),
229 "default" => true
230 ];
231 $cols["type"] = [
232 "txt" => $lng->txt("question_type"),
233 "default" => true
234 ];
235 if (!$this->confirmdelete) {
236 $cols["points"] = [
237 "txt" => $lng->txt("points"),
238 "default" => true
239 ];
240 $cols["statistics"] = [
241 "txt" => $lng->txt("statistics"),
242 "default" => true
243 ];
244 $cols["author"] = [
245 "txt" => $lng->txt("author"),
246 "default" => true
247 ];
248 $cols['lifecycle'] = [
249 'txt' => $lng->txt('qst_lifecycle'),
250 'default' => true
251 ];
252 if ($this->isQuestionCommentingEnabled()) {
253 $cols["comments"] = [
254 "txt" => $lng->txt("comments"),
255 "default" => true
256 ];
257 }
258 $cols["created"] = [
259 "txt" => $lng->txt("create_date"),
260 "default" => true
261 ];
262 $cols["tstamp"] = [
263 "txt" => $lng->txt("last_update"),
264 "default" => true
265 ];
266 }
267 return $cols;
268 }
return true
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

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

+ Here is the call graph for this function:

◆ getWriteAccess()

ilQuestionBrowserTableGUI::getWriteAccess ( )

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

References $writeAccess.

Referenced by __construct(), and fillRow().

+ Here is the caller graph for this function:

◆ initFilter()

ilQuestionBrowserTableGUI::initFilter ( )

Init filter.

Reimplemented from ilTable2GUI.

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

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

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

Referenced by __construct().

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

◆ isCommentsColumnSelected()

ilQuestionBrowserTableGUI::isCommentsColumnSelected ( )
protected

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

191 : bool
192 {
193 return in_array('comments', $this->getSelectedColumns());
194 }

References ilTable2GUI\getSelectedColumns().

Referenced by setQuestionData().

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

◆ isQuestionCommentingEnabled()

ilQuestionBrowserTableGUI::isQuestionCommentingEnabled ( )
Returns
bool

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

References $questionCommentingEnabled.

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

+ Here is the caller graph for this function:

◆ numericOrdering()

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

Reimplemented from ilTable2GUI.

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

534 : bool
535 {
536 if (in_array($a_field, ['points', 'created', 'tstamp', 'comments'])) {
537 return true;
538 }
539
540 return false;
541 }

◆ setEditable()

ilQuestionBrowserTableGUI::setEditable (   $value)

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

510 : void
511 {
512 $this->editable = $value;
513 }

◆ setQuestionCommentingEnabled()

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

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

186 : void
187 {
188 $this->questionCommentingEnabled = $questionCommentingEnabled;
189 }

References $questionCommentingEnabled.

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setQuestionData()

ilQuestionBrowserTableGUI::setQuestionData (   $questionData)

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

196 : void
197 {
198 if ($this->isQuestionCommentingEnabled() && ($this->isCommentsColumnSelected() || $this->filter['commented'])) {
199 foreach ($questionData as $key => $data) {
200 $notes_context = $this->notes
201 ->data()
202 ->context(
203 $this->parent_obj->getObject()->getId(),
204 $data['question_id'],
205 'quest'
206 );
207 $numComments = $this->notes
208 ->domain()
209 ->getNrOfCommentsForContext($notes_context);
210
211 if ($this->filter['commented'] && !$numComments) {
212 unset($questionData[$key]);
213 continue;
214 }
215
216 $questionData[$key]['comments'] = $numComments;
217 }
218 }
219
220 $this->setData($questionData);
221 }
setData(array $a_data)
Set table data.

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

+ Here is the call graph for this function:

◆ setWriteAccess()

ilQuestionBrowserTableGUI::setWriteAccess (   $value)

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

520 : void
521 {
522 $this->writeAccess = $value;
523 }

Referenced by __construct().

+ Here is the caller graph for this function:

Field Documentation

◆ $confirmdelete

ilQuestionBrowserTableGUI::$confirmdelete
protected

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

Referenced by __construct().

◆ $editable

ilQuestionBrowserTableGUI::$editable = true
protected

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

Referenced by getEditable().

◆ $filter

array ilQuestionBrowserTableGUI::$filter = []
protected

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

◆ $notes

ILIAS Notes Service ilQuestionBrowserTableGUI::$notes
protected

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

◆ $questionCommentingEnabled

ilQuestionBrowserTableGUI::$questionCommentingEnabled = false
protected

◆ $questionrepository

GeneralQuestionPropertiesRepository ilQuestionBrowserTableGUI::$questionrepository
private

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

◆ $renderer

ILIAS UI Renderer ilQuestionBrowserTableGUI::$renderer
protected

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

◆ $request

RequestDataCollector ilQuestionBrowserTableGUI::$request
private

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

◆ $taxIds

ilQuestionBrowserTableGUI::$taxIds = []
protected

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

Referenced by __construct().

◆ $totalPoints

ilQuestionBrowserTableGUI::$totalPoints = 0
protected

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

◆ $ui_factory

ILIAS UI Factory ilQuestionBrowserTableGUI::$ui_factory
protected

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

◆ $writeAccess

ilQuestionBrowserTableGUI::$writeAccess = false
protected

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

Referenced by getWriteAccess().


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