ILIAS  release_8 Revision v8.24
ilTestQuestionsTableGUI Class Reference
+ Inheritance diagram for ilTestQuestionsTableGUI:
+ Collaboration diagram for ilTestQuestionsTableGUI:

Public Member Functions

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

Protected Member Functions

 initColumns ()
 
 initCommands ()
 
 buildQuestionRemoveButton (array $rowData)
 
 buildQuestionTitleLink (array $rowData)
 
 getPreviewLink (array $rowData)
 
 getQuestionEditLink (array $rowData, string $target_class, string $cmd, array $target_class_path=[])
 
 getEditLink (array $rowData, string $target_class, string $cmd, array $target_class_path=[])
 
 buildObligatoryColumnContent (array $rowData)
 
 buildPositionInput ($questionId, $position)
 
 buildTableSaveCommandLabel ()
 
 buildPointsHeader ()
 
 isTableSaveCommandRequired ()
 
 isCheckboxColumnRequired ()
 
- 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

 $questionRemoveRowButtonEnabled = false
 
 $questionManagingEnabled = false
 
 $positionInsertCommandsEnabled = false
 
 $questionPositioningEnabled = false
 
 $obligatoryQuestionsHandlingEnabled = false
 
float $totalPoints = 0
 
string $totalWorkingTime = ''
 
ILIAS UI Renderer $renderer
 
ILIAS UI Factory $factory
 
- 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

const CLASS_PATH_FOR_QUESTION_EDIT_LINKS = [ilRepositoryGUI::class, ilObjQuestionPoolGUI::class]
 
int $position = 0
 
int $parent_ref_id
 
ilAccess $access
 

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
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilTestQuestionsTableGUI::__construct (   $a_parent_obj,
  $a_parent_cmd,
  $parentRefId 
)

Definition at line 68 of file class.ilTestQuestionsTableGUI.php.

69 {
70 global $DIC;
71
72 $this->renderer = $DIC->ui()->renderer();
73 $this->factory = $DIC->ui()->factory();
74 $this->access = $DIC['ilAccess'];
75
76 $this->setId('tst_qst_lst_' . $parentRefId);
77
78 $this->parent_ref_id = (int) $parentRefId;
79
80 parent::__construct($a_parent_obj, $a_parent_cmd);
81
82 $this->setFormName('questionbrowser');
83 $this->setStyle('table', 'fullwidth');
84
85 $this->setExternalSegmentation(true);
86
87 $this->setRowTemplate("tpl.il_as_tst_questions_row.html", "Modules/Test");
88
89 $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
90
91 $this->disable('sort');
92 $this->enable('header');
93
94 $this->setShowRowsSelector(false);
95 }
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
setExternalSegmentation(bool $a_val)
setFormName(string $a_name="")
setFormAction(string $a_form_action, bool $a_multipart=false)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
enable(string $a_module_name)
setStyle(string $a_element, string $a_style)
disable(string $a_module_name)
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\access(), ILIAS\Repository\ctrl(), ilTableGUI\disable(), ilTableGUI\enable(), ILIAS\Repository\int(), ilTable2GUI\setExternalSegmentation(), ilTable2GUI\setFormAction(), ilTable2GUI\setFormName(), ilTable2GUI\setId(), ilTable2GUI\setRowTemplate(), ilTable2GUI\setShowRowsSelector(), and ilTableGUI\setStyle().

+ Here is the call graph for this function:

Member Function Documentation

◆ buildObligatoryColumnContent()

ilTestQuestionsTableGUI::buildObligatoryColumnContent ( array  $rowData)
protected

Definition at line 390 of file class.ilTestQuestionsTableGUI.php.

390 : string
391 {
392 if (!$rowData['obligationPossible']) {
393 return ' ';
394 }
395
396 if ($rowData['obligatory'] && !$this->isQuestionManagingEnabled()) {
397 $icon = $this->factory->symbol()->icon()->custom(
398 ilUtil::getImagePath("icon_checked.svg"),
399 $this->lng->txt('question_obligatory')
400 );
401 return $this->renderer->render($icon);
402 }
403
404 $checkedAttr = $rowData['obligatory'] ? 'checked="checked"' : '';
405 return '<input type="checkbox" name="obligatory[' . $rowData['question_id'] . ']" value="1" ' . $checkedAttr . ' />';
406 }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)

References ilTableGUI\$icon, ilUtil\getImagePath(), isQuestionManagingEnabled(), and ILIAS\Repository\lng().

Referenced by fillRow().

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

◆ buildPointsHeader()

ilTestQuestionsTableGUI::buildPointsHeader ( )
protected

Definition at line 430 of file class.ilTestQuestionsTableGUI.php.

430 : string
431 {
432 if ($this->getTotalPoints()) {
433 return $this->lng->txt('points') . ' (' . $this->getTotalPoints() . ')';
434 }
435
436 return $this->lng->txt('points');
437 }

References getTotalPoints(), and ILIAS\Repository\lng().

Referenced by initColumns().

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

◆ buildPositionInput()

ilTestQuestionsTableGUI::buildPositionInput (   $questionId,
  $position 
)
protected

Definition at line 408 of file class.ilTestQuestionsTableGUI.php.

408 : string
409 {
410 return '<input type="text" name="order[q_' . $questionId . ']" value="' . $position . '" maxlength="4" size="4" />';
411 }

References $position.

Referenced by fillRow().

+ Here is the caller graph for this function:

◆ buildQuestionRemoveButton()

ilTestQuestionsTableGUI::buildQuestionRemoveButton ( array  $rowData)
protected

Definition at line 291 of file class.ilTestQuestionsTableGUI.php.

291 : string
292 {
293 $this->ctrl->setParameter($this->getParentObject(), 'removeQid', $rowData['question_id']);
294 $removeUrl = $this->ctrl->getLinkTarget($this->getParentObject(), $this->getParentCmd());
295 $this->ctrl->setParameter($this->getParentObject(), 'removeQid', '');
296
297 $button = ilLinkButton::getInstance();
298 $button->setCaption('remove_question');
299 $button->setUrl($removeUrl);
300
301 return $button->render();
302 }

References ILIAS\Repository\ctrl(), ilLinkButton\getInstance(), ilTable2GUI\getParentCmd(), and ilTable2GUI\getParentObject().

Referenced by fillRow().

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

◆ buildQuestionTitleLink()

ilTestQuestionsTableGUI::buildQuestionTitleLink ( array  $rowData)
protected

Definition at line 304 of file class.ilTestQuestionsTableGUI.php.

304 : string
305 {
306 return '<a href="' . $this->getPreviewLink($rowData) . '">' . $rowData["title"] . '</a>';
307 }

References getPreviewLink().

Referenced by fillRow().

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

◆ buildTableSaveCommandLabel()

ilTestQuestionsTableGUI::buildTableSaveCommandLabel ( )
protected

Definition at line 413 of file class.ilTestQuestionsTableGUI.php.

413 : string
414 {
416 return $this->lng->txt('saveOrderAndObligations');
417 }
418
420 return $this->lng->txt('saveObligations');
421 }
422
423 if ($this->isQuestionPositioningEnabled()) {
424 return $this->lng->txt('saveOrder');
425 }
426
427 return $this->lng->txt('save');
428 }

References isObligatoryQuestionsHandlingEnabled(), isQuestionPositioningEnabled(), and ILIAS\Repository\lng().

Referenced by initCommands().

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

◆ fillRow()

ilTestQuestionsTableGUI::fillRow ( array  $a_set)

Standard Version of Fill Row.

Most likely to be overwritten by derived class.

Parameters
array$a_setdata array

Reimplemented from ilTable2GUI.

Definition at line 180 of file class.ilTestQuestionsTableGUI.php.

180 : void
181 {
182 if ($this->isCheckboxColumnRequired()) {
183 $this->tpl->setVariable("CHECKBOX_QID", $a_set['question_id']);
184 }
185
186 if ($this->isQuestionPositioningEnabled()) {
187 $this->position += 10;
188 $inputField = $this->buildPositionInput($a_set['question_id'], $this->position);
189
190 $this->tpl->setVariable("QUESTION_POSITION", $inputField);
191 $this->tpl->setVariable("POSITION_QID", $a_set['question_id']);
192 }
193
194 if ($this->isColumnSelected('qid')) {
195 $this->tpl->setVariable("QUESTION_ID_PRESENTATION", $a_set['question_id']);
196 }
197
198 $this->tpl->setVariable("QUESTION_TITLE", $this->buildQuestionTitleLink($a_set));
199
200 if (!$a_set['complete']) {
201 $this->tpl->setVariable("QUESTION_INCOMPLETE_WARNING", $this->lng->txt("warning_question_not_complete"));
202 }
203
205 $this->tpl->setVariable("QUESTION_OBLIGATORY", $this->buildObligatoryColumnContent($a_set));
206 }
207
208 if ($this->isColumnSelected('description')) {
209 $this->tpl->setVariable("QUESTION_COMMENT", $a_set["description"] ? $a_set["description"] : '&nbsp;');
210 }
211
212 $this->tpl->setVariable("QUESTION_TYPE", assQuestion::_getQuestionTypeName($a_set["type_tag"]));
213 $this->tpl->setVariable("QUESTION_POINTS", $a_set["points"]);
214
215 if ($this->isColumnSelected('author')) {
216 $this->tpl->setVariable("QUESTION_AUTHOR", $a_set["author"]);
217 }
218
219 if ($this->isColumnSelected('lifecycle')) {
220 try {
221 $lifecycle = ilAssQuestionLifecycle::getInstance($a_set['lifecycle'])->getTranslation($this->lng);
222 $this->tpl->setVariable("QUESTION_LIFECYCLE", $lifecycle);
224 $this->tpl->setVariable("QUESTION_LIFECYCLE", '');
225 }
226 }
227
228 $question_pool_title = $this->lng->txt('tst_question_not_from_pool_info');
229
230 if (isset($a_set['orig_obj_fi']) && ilObject::_lookupTitle($a_set['orig_obj_fi']) !== null) {
231 $question_pool_title = $this->buildPossiblyLinkedQuestonPoolTitle(
232 $this->ctrl,
233 $this->access,
234 $this->lng,
235 $this->factory,
236 $this->renderer,
237 $a_set["orig_obj_fi"],
238 ilObject::_lookupTitle($a_set["orig_obj_fi"])
239 );
240 }
241
242 $this->tpl->setVariable(
243 "QUESTION_POOL",
244 $question_pool_title
245 );
246
247 $actions = new ilAdvancedSelectionListGUI();
248 $actions->setId('qst' . $a_set["question_id"]);
249 $actions->setListTitle($this->lng->txt('actions'));
250
251 $actions->addItem(
252 $this->lng->txt('preview'),
253 '',
254 $this->getPreviewLink($a_set)
255 );
256
257 $actions->addItem(
258 $this->lng->txt('statistics'),
259 '',
260 $this->getQuestionEditLink($a_set, 'ilAssQuestionPreviewGUI', ilAssQuestionPreviewGUI::CMD_STATISTICS)
261 );
262
263 if ($this->isQuestionManagingEnabled()) {
264 $editHref = $this->getQuestionEditLink($a_set, $a_set['type_tag'] . 'GUI', 'editQuestion');
265 $actions->addItem($this->lng->txt('edit_question'), '', $editHref);
266
267 $editPageHref = $this->getQuestionEditLink($a_set, 'ilAssQuestionPageGUI', 'edit');
268 $actions->addItem($this->lng->txt('edit_page'), '', $editPageHref);
269
270 $moveHref = $this->getEditLink($a_set, get_class($this->getParentObject()), 'moveQuestions');
271 $actions->addItem($this->lng->txt('move'), '', $moveHref);
272
273 $copyHref = $this->getEditLink($a_set, get_class($this->getParentObject()), 'copyQuestion');
274 $actions->addItem($this->lng->txt('copy'), '', $copyHref);
275
276 $deleteHref = $this->getEditLink($a_set, get_class($this->getParentObject()), 'removeQuestions');
277 $actions->addItem($this->lng->txt('delete'), '', $deleteHref);
278
279 $feedbackHref = $this->getQuestionEditLink($a_set, 'ilAssQuestionFeedbackEditingGUI', ilAssQuestionFeedbackEditingGUI::CMD_SHOW);
280 $actions->addItem($this->lng->txt('tst_feedback'), '', $feedbackHref);
281
282 $hintsHref = $this->getQuestionEditLink($a_set, 'ilAssQuestionHintsGUI', ilAssQuestionHintsGUI::CMD_SHOW_LIST);
283 $actions->addItem($this->lng->txt('tst_question_hints_tab'), '', $hintsHref);
284 }
285 $this->tpl->setVariable('ROW_ACTIONS', $actions->getHTML());
287 $this->tpl->setVariable('ROW_ACTIONS', $this->buildQuestionRemoveButton($a_set));
288 }
289 }
static _getQuestionTypeName($type_tag)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const CMD_SHOW_LIST
command constants
static _lookupTitle(int $obj_id)
isColumnSelected(string $col)
buildPositionInput($questionId, $position)
getEditLink(array $rowData, string $target_class, string $cmd, array $target_class_path=[])
getQuestionEditLink(array $rowData, string $target_class, string $cmd, array $target_class_path=[])

References Vendor\Package\$e, assQuestion\_getQuestionTypeName(), ilObject\_lookupTitle(), ILIAS\Repository\access(), buildObligatoryColumnContent(), buildPositionInput(), buildQuestionRemoveButton(), buildQuestionTitleLink(), ilAssQuestionFeedbackEditingGUI\CMD_SHOW, ilAssQuestionHintsGUI\CMD_SHOW_LIST, ilAssQuestionPreviewGUI\CMD_STATISTICS, ILIAS\Repository\ctrl(), getEditLink(), ilAssQuestionLifecycle\getInstance(), ilTable2GUI\getParentObject(), getQuestionEditLink(), isCheckboxColumnRequired(), ilTable2GUI\isColumnSelected(), isObligatoryQuestionsHandlingEnabled(), isQuestionManagingEnabled(), isQuestionPositioningEnabled(), isQuestionRemoveRowButtonEnabled(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getEditLink()

ilTestQuestionsTableGUI::getEditLink ( array  $rowData,
string  $target_class,
string  $cmd,
array  $target_class_path = [] 
)
protected

Definition at line 360 of file class.ilTestQuestionsTableGUI.php.

360 : string
361 {
362 if ($target_class_path === []) {
363 $target_class_path = $target_class;
364 }
365 $this->ctrl->setParameterByClass(
366 $target_class,
367 'ref_id',
368 current(ilObject::_getAllReferences($rowData['obj_fi']))
369 );
370
371 $this->ctrl->setParameterByClass(
372 $target_class,
373 'q_id',
374 $rowData['question_id']
375 );
376 $this->ctrl->setParameterByClass(
377 $target_class,
378 'calling_test',
379 $_GET['ref_id']
380 );
381
382 $link = $this->ctrl->getLinkTargetByClass($target_class_path, $cmd);
383
384 $this->ctrl->setParameterByClass($target_class, 'ref_id', '');
385 $this->ctrl->setParameterByClass($target_class, 'q_id', '');
386 $this->ctrl->setParameterByClass($target_class, 'calling_test', '');
387 return $link;
388 }
static _getAllReferences(int $id)
get all reference ids for object ID
$_GET['client_id']
Definition: saml1-acs.php:21

References $_GET, ilObject\_getAllReferences(), and ILIAS\Repository\ctrl().

Referenced by fillRow(), and getQuestionEditLink().

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

◆ getPreviewLink()

ilTestQuestionsTableGUI::getPreviewLink ( array  $rowData)
protected

Definition at line 309 of file class.ilTestQuestionsTableGUI.php.

309 : string
310 {
311 $target_class = get_class($this->getParentObject());
312 $this->ctrl->setParameterByClass(
313 $target_class,
314 'ref_id',
315 current(ilObject::_getAllReferences($rowData['obj_fi']))
316 );
317
318 $this->ctrl->setParameterByClass(
319 $target_class,
320 'eqpl',
321 current(ilObject::_getAllReferences($rowData['obj_fi']))
322 );
323
324 $this->ctrl->setParameterByClass(
325 $target_class,
326 'eqid',
327 $rowData['question_id']
328 );
329
330 $this->ctrl->setParameterByClass(
331 $target_class,
332 'q_id',
333 $rowData['question_id']
334 );
335
336 $this->ctrl->setParameterByClass(
337 $target_class,
338 'calling_test',
339 (string) $this->parent_ref_id
340 );
341
342 $question_href = $this->ctrl->getLinkTargetByClass(
343 $target_class,
344 $this->getParentCmd()
345 );
346 $this->ctrl->setParameterByClass($target_class, 'eqpl', '');
347 $this->ctrl->setParameterByClass($target_class, 'eqid', '');
348 $this->ctrl->setParameterByClass($target_class, 'q_id', '');
349 $this->ctrl->setParameterByClass($target_class, 'calling_test', '');
350
351 return $question_href;
352 }

References ilObject\_getAllReferences(), ILIAS\Repository\ctrl(), ilTable2GUI\getParentCmd(), and ilTable2GUI\getParentObject().

Referenced by buildQuestionTitleLink().

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

◆ getQuestionEditLink()

ilTestQuestionsTableGUI::getQuestionEditLink ( array  $rowData,
string  $target_class,
string  $cmd,
array  $target_class_path = [] 
)
protected

Definition at line 354 of file class.ilTestQuestionsTableGUI.php.

354 : string
355 {
356 $target_class_path = array_merge(self::CLASS_PATH_FOR_QUESTION_EDIT_LINKS, [$target_class]);
357 return $this->getEditLink($rowData, $target_class, $cmd, $target_class_path);
358 }

References getEditLink().

Referenced by fillRow().

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

◆ getSelectableColumns()

ilTestQuestionsTableGUI::getSelectableColumns ( )

Get selectable columns.

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

Reimplemented from ilTable2GUI.

Definition at line 97 of file class.ilTestQuestionsTableGUI.php.

97 : array
98 {
99 $cols = array(
100 'qid' => array('txt' => $this->lng->txt('question_id'), 'default' => true),
101 'description' => array('txt' => $this->lng->txt('description'), 'default' => false),
102 'author' => array('txt' => $this->lng->txt('author'), 'default' => false),
103 'lifecycle' => array('txt' => $this->lng->txt('qst_lifecycle'), 'default' => true)
104 );
105
106 return $cols;
107 }
$cols
Definition: xhr_table.php:11

References $cols, and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getTotalPoints()

ilTestQuestionsTableGUI::getTotalPoints ( )

Definition at line 493 of file class.ilTestQuestionsTableGUI.php.

493 : float
494 {
495 return $this->totalPoints;
496 }

References $totalPoints.

Referenced by buildPointsHeader().

+ Here is the caller graph for this function:

◆ getTotalWorkingTime()

ilTestQuestionsTableGUI::getTotalWorkingTime ( )

Definition at line 503 of file class.ilTestQuestionsTableGUI.php.

503 : string
504 {
506 }

References $totalWorkingTime.

◆ init()

ilTestQuestionsTableGUI::init ( )

Definition at line 109 of file class.ilTestQuestionsTableGUI.php.

109 : void
110 {
111 $this->initColumns();
112 $this->initCommands();
113
114 if ($this->isQuestionManagingEnabled()) {
115 $this->setSelectAllCheckbox('q_id');
116 }
117 }
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)

References initColumns(), initCommands(), isQuestionManagingEnabled(), and ilTable2GUI\setSelectAllCheckbox().

+ Here is the call graph for this function:

◆ initColumns()

ilTestQuestionsTableGUI::initColumns ( )
protected

Definition at line 119 of file class.ilTestQuestionsTableGUI.php.

119 : void
120 {
121 if ($this->isCheckboxColumnRequired()) {
122 $this->addColumn('', 'f', '1%', true);
123 }
124
125 if ($this->isQuestionPositioningEnabled()) {
126 $this->addColumn($this->lng->txt('order'), 'f', '1%');
127 }
128
129 if ($this->isColumnSelected('qid')) {
130 $this->addColumn($this->lng->txt('question_id'), 'qid', '');
131 }
132
133 $this->addColumn($this->lng->txt("tst_question_title"), 'title', '');
134
136 $this->addColumn($this->lng->txt("obligatory"), 'obligatory', '');
137 }
138
139 if ($this->isColumnSelected('description')) {
140 $this->addColumn($this->lng->txt('description'), 'description', '');
141 }
142
143 $this->addColumn($this->lng->txt("tst_question_type"), 'type', '');
144 $this->addColumn($this->buildPointsHeader(), '', '');
145
146 if ($this->isColumnSelected('author')) {
147 $this->addColumn($this->lng->txt('author'), 'author', '');
148 }
149 if ($this->isColumnSelected('lifecycle')) {
150 $this->addColumn($this->lng->txt('qst_lifecycle'), 'lifecycle', '');
151 }
152
153 $this->addColumn($this->lng->txt('qpl'), 'qpl', '');
154
155 $this->addColumn($this->lng->txt('actions'), '', '1%');
156 }
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)

References ilTable2GUI\addColumn(), buildPointsHeader(), isCheckboxColumnRequired(), ilTable2GUI\isColumnSelected(), isObligatoryQuestionsHandlingEnabled(), isQuestionPositioningEnabled(), and ILIAS\Repository\lng().

Referenced by init().

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

◆ initCommands()

ilTestQuestionsTableGUI::initCommands ( )
protected

Definition at line 158 of file class.ilTestQuestionsTableGUI.php.

158 : void
159 {
160 if ($this->isQuestionManagingEnabled()) {
161 $this->addMultiCommand('removeQuestions', $this->lng->txt('remove_question'));
162 $this->addMultiCommand('moveQuestions', $this->lng->txt('move'));
163 }
164
165 if ($this->isPositionInsertCommandsEnabled()) {
166 $this->addMultiCommand('insertQuestionsBefore', $this->lng->txt('insert_before'));
167 $this->addMultiCommand('insertQuestionsAfter', $this->lng->txt('insert_after'));
168 }
169
170 if ($this->isQuestionManagingEnabled()) {
171 $this->addMultiCommand('copyQuestion', $this->lng->txt('copy'));
172 $this->addMultiCommand('copyAndLinkToQuestionpool', $this->lng->txt('copy_and_link_to_questionpool'));
173 }
174
175 if ($this->isTableSaveCommandRequired()) {
176 $this->addCommandButton('saveOrderAndObligations', $this->buildTableSaveCommandLabel());
177 }
178 }
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
addMultiCommand(string $a_cmd, string $a_text)

References ilTable2GUI\addCommandButton(), ilTable2GUI\addMultiCommand(), buildTableSaveCommandLabel(), isPositionInsertCommandsEnabled(), isQuestionManagingEnabled(), isTableSaveCommandRequired(), and ILIAS\Repository\lng().

Referenced by init().

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

◆ isCheckboxColumnRequired()

ilTestQuestionsTableGUI::isCheckboxColumnRequired ( )
protected

Definition at line 448 of file class.ilTestQuestionsTableGUI.php.

448 : bool
449 {
451 }

References isPositionInsertCommandsEnabled(), and isQuestionManagingEnabled().

Referenced by fillRow(), and initColumns().

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

◆ isObligatoryQuestionsHandlingEnabled()

ilTestQuestionsTableGUI::isObligatoryQuestionsHandlingEnabled ( )

Definition at line 483 of file class.ilTestQuestionsTableGUI.php.

References $obligatoryQuestionsHandlingEnabled.

Referenced by buildTableSaveCommandLabel(), fillRow(), initColumns(), and isTableSaveCommandRequired().

+ Here is the caller graph for this function:

◆ isPositionInsertCommandsEnabled()

ilTestQuestionsTableGUI::isPositionInsertCommandsEnabled ( )

Definition at line 463 of file class.ilTestQuestionsTableGUI.php.

References $positionInsertCommandsEnabled.

Referenced by initCommands(), and isCheckboxColumnRequired().

+ Here is the caller graph for this function:

◆ isQuestionManagingEnabled()

ilTestQuestionsTableGUI::isQuestionManagingEnabled ( )

◆ isQuestionPositioningEnabled()

ilTestQuestionsTableGUI::isQuestionPositioningEnabled ( )

Definition at line 473 of file class.ilTestQuestionsTableGUI.php.

References $questionPositioningEnabled.

Referenced by buildTableSaveCommandLabel(), fillRow(), initColumns(), and isTableSaveCommandRequired().

+ Here is the caller graph for this function:

◆ isQuestionRemoveRowButtonEnabled()

ilTestQuestionsTableGUI::isQuestionRemoveRowButtonEnabled ( )

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

References $questionRemoveRowButtonEnabled.

Referenced by fillRow().

+ Here is the caller graph for this function:

◆ isTableSaveCommandRequired()

ilTestQuestionsTableGUI::isTableSaveCommandRequired ( )
protected

Definition at line 439 of file class.ilTestQuestionsTableGUI.php.

439 : bool
440 {
441 if (!$this->isQuestionManagingEnabled()) {
442 return false;
443 }
444
446 }

References isObligatoryQuestionsHandlingEnabled(), isQuestionManagingEnabled(), and isQuestionPositioningEnabled().

Referenced by initCommands().

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

◆ setObligatoryQuestionsHandlingEnabled()

ilTestQuestionsTableGUI::setObligatoryQuestionsHandlingEnabled ( bool  $obligatoryQuestionsHandlingEnabled)

Definition at line 488 of file class.ilTestQuestionsTableGUI.php.

488 : void
489 {
490 $this->obligatoryQuestionsHandlingEnabled = $obligatoryQuestionsHandlingEnabled;
491 }

References $obligatoryQuestionsHandlingEnabled.

◆ setPositionInsertCommandsEnabled()

ilTestQuestionsTableGUI::setPositionInsertCommandsEnabled ( bool  $positionInsertCommandsEnabled)

Definition at line 468 of file class.ilTestQuestionsTableGUI.php.

468 : void
469 {
470 $this->positionInsertCommandsEnabled = $positionInsertCommandsEnabled;
471 }

References $positionInsertCommandsEnabled.

◆ setQuestionManagingEnabled()

ilTestQuestionsTableGUI::setQuestionManagingEnabled ( bool  $questionManagingEnabled)

Definition at line 458 of file class.ilTestQuestionsTableGUI.php.

458 : void
459 {
460 $this->questionManagingEnabled = $questionManagingEnabled;
461 }

References $questionManagingEnabled.

◆ setQuestionPositioningEnabled()

ilTestQuestionsTableGUI::setQuestionPositioningEnabled ( bool  $questionPositioningEnabled)

Definition at line 478 of file class.ilTestQuestionsTableGUI.php.

478 : void
479 {
480 $this->questionPositioningEnabled = $questionPositioningEnabled;
481 }

References $questionPositioningEnabled.

◆ setQuestionRemoveRowButtonEnabled()

ilTestQuestionsTableGUI::setQuestionRemoveRowButtonEnabled ( bool  $questionRemoveRowButtonEnabled)

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

513 : void
514 {
515 $this->questionRemoveRowButtonEnabled = $questionRemoveRowButtonEnabled;
516 }

References $questionRemoveRowButtonEnabled.

◆ setTotalPoints()

ilTestQuestionsTableGUI::setTotalPoints ( float  $totalPoints)

Definition at line 498 of file class.ilTestQuestionsTableGUI.php.

498 : void
499 {
500 $this->totalPoints = $totalPoints;
501 }

References $totalPoints.

Field Documentation

◆ $access

ilAccess ilTestQuestionsTableGUI::$access
private

Definition at line 66 of file class.ilTestQuestionsTableGUI.php.

◆ $factory

ILIAS UI Factory ilTestQuestionsTableGUI::$factory
protected

Definition at line 65 of file class.ilTestQuestionsTableGUI.php.

◆ $obligatoryQuestionsHandlingEnabled

ilTestQuestionsTableGUI::$obligatoryQuestionsHandlingEnabled = false
protected

◆ $parent_ref_id

int ilTestQuestionsTableGUI::$parent_ref_id
private

Definition at line 62 of file class.ilTestQuestionsTableGUI.php.

◆ $position

int ilTestQuestionsTableGUI::$position = 0
private

Definition at line 61 of file class.ilTestQuestionsTableGUI.php.

Referenced by buildPositionInput().

◆ $positionInsertCommandsEnabled

ilTestQuestionsTableGUI::$positionInsertCommandsEnabled = false
protected

◆ $questionManagingEnabled

ilTestQuestionsTableGUI::$questionManagingEnabled = false
protected

◆ $questionPositioningEnabled

ilTestQuestionsTableGUI::$questionPositioningEnabled = false
protected

◆ $questionRemoveRowButtonEnabled

ilTestQuestionsTableGUI::$questionRemoveRowButtonEnabled = false
protected

◆ $renderer

ILIAS UI Renderer ilTestQuestionsTableGUI::$renderer
protected

Definition at line 64 of file class.ilTestQuestionsTableGUI.php.

◆ $totalPoints

float ilTestQuestionsTableGUI::$totalPoints = 0
protected

Definition at line 59 of file class.ilTestQuestionsTableGUI.php.

Referenced by getTotalPoints(), and setTotalPoints().

◆ $totalWorkingTime

string ilTestQuestionsTableGUI::$totalWorkingTime = ''
protected

Definition at line 60 of file class.ilTestQuestionsTableGUI.php.

Referenced by getTotalWorkingTime().

◆ CLASS_PATH_FOR_QUESTION_EDIT_LINKS

const ilTestQuestionsTableGUI::CLASS_PATH_FOR_QUESTION_EDIT_LINKS = [ilRepositoryGUI::class, ilObjQuestionPoolGUI::class]
private

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


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