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

Public Member Functions

 __construct (ilObjTestGUI|ilTestCorrectionsGUI $parent_obj, string $parent_cmd, private int $parent_ref_id, private ilAccessHandler $access, private UIFactory $ui_factory, private UIRenderer $ui_renderer, private QuestionInfoService $questioninfo)
 
 getSelectableColumns ()
 
 init ()
 
 fillRow (array $a_set)
 
 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)
 
 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

 initColumns ()
 
 initCommands ()
 
 buildQuestionRemoveButton (array $row_data)
 
 buildQuestionTitleLink (array $row_data)
 
 getPreviewLink (array $row_data)
 
 getQuestionEditLink (array $row_data, string $target_class, string $cmd, array $target_class_path=[])
 
 getEditLink (array $row_data, string $target_class, string $cmd, array $target_class_path=[])
 
 buildObligatoryColumnContent (array $row_data)
 
 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 = ''
 
- 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
 

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 34 of file class.ilTestQuestionsTableGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestQuestionsTableGUI::__construct ( ilObjTestGUI|ilTestCorrectionsGUI  $parent_obj,
string  $parent_cmd,
private int  $parent_ref_id,
private ilAccessHandler  $access,
private UIFactory  $ui_factory,
private UIRenderer  $ui_renderer,
private QuestionInfoService  $questioninfo 
)

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

References ILIAS\MetaData\Repository\Validation\Data\__construct(), ILIAS\Repository\ctrl(), ilTableGUI\disable(), ilTableGUI\enable(), ilTable2GUI\setExternalSegmentation(), ilTable2GUI\setFormAction(), ilTable2GUI\setFormName(), ilTable2GUI\setId(), ilTable2GUI\setRowTemplate(), ilTable2GUI\setShowRowsSelector(), and ilTableGUI\setStyle().

76  {
77  $this->setId('tst_qst_lst_' . $parent_ref_id);
78 
80 
81  $this->setFormName('questionbrowser');
82  $this->setStyle('table', 'fullwidth');
83 
84  $this->setExternalSegmentation(true);
85 
86  $this->setRowTemplate("tpl.il_as_tst_questions_row.html", "Modules/Test");
87 
88  $this->setFormAction($this->ctrl->getFormAction($parent_obj, $parent_cmd));
89 
90  $this->disable('sort');
91  $this->enable('header');
92 
93  $this->setShowRowsSelector(false);
94  }
enable(string $a_module_name)
setFormAction(string $a_form_action, bool $a_multipart=false)
setFormName(string $a_name="")
setId(string $a_val)
setStyle(string $a_element, string $a_style)
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
__construct(VocabulariesInterface $vocabularies)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
disable(string $a_module_name)
setExternalSegmentation(bool $a_val)
+ Here is the call graph for this function:

Member Function Documentation

◆ buildObligatoryColumnContent()

ilTestQuestionsTableGUI::buildObligatoryColumnContent ( array  $row_data)
protected

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

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

Referenced by fillRow().

384  : string
385  {
386  if (!$row_data['obligationPossible']) {
387  return ' ';
388  }
389 
390  if ($row_data['obligatory'] && !$this->isQuestionManagingEnabled()) {
391  return $this->ui_renderer->render(
392  $this->ui_factory->symbol()->icon()->custom(
393  ilUtil::getImagePath('standard/icon_alert.svg'),
394  $this->lng->txt('question_obligatory')
395  )
396  );
397  }
398 
399  $checkedAttr = $row_data['obligatory'] ? 'checked="checked"' : '';
400  return '<input type="checkbox" name="obligatory[' . $row_data['question_id'] . ']" value="1" ' . $checkedAttr . ' />';
401  }
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildPointsHeader()

ilTestQuestionsTableGUI::buildPointsHeader ( )
protected

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

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

Referenced by initColumns().

425  : string
426  {
427  if ($this->getTotalPoints()) {
428  return $this->lng->txt('points') . ' (' . $this->getTotalPoints() . ')';
429  }
430 
431  return $this->lng->txt('points');
432  }
+ 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 403 of file class.ilTestQuestionsTableGUI.php.

Referenced by fillRow().

403  : string
404  {
405  return '<input type="text" name="order[' . $questionId . ']" value="' . $position . '" maxlength="4" size="4" />';
406  }
+ Here is the caller graph for this function:

◆ buildQuestionRemoveButton()

ilTestQuestionsTableGUI::buildQuestionRemoveButton ( array  $row_data)
protected

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

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

Referenced by fillRow().

289  : string
290  {
291  $this->ctrl->setParameter($this->getParentObject(), 'removeQid', $row_data['question_id']);
292  $removeUrl = $this->ctrl->getLinkTarget($this->getParentObject(), $this->getParentCmd());
293  $this->ctrl->setParameter($this->getParentObject(), 'removeQid', '');
294 
295  return $this->ui_renderer->render($this->ui_factory->button()->standard($this->lng->txt('remove_question'), $removeUrl));
296  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildQuestionTitleLink()

ilTestQuestionsTableGUI::buildQuestionTitleLink ( array  $row_data)
protected

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

References getPreviewLink().

Referenced by fillRow().

298  : string
299  {
300  return '<a href="' . $this->getPreviewLink($row_data) . '">' . $row_data["title"] . '</a>';
301  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTableSaveCommandLabel()

ilTestQuestionsTableGUI::buildTableSaveCommandLabel ( )
protected

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

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

Referenced by initCommands().

408  : string
409  {
411  return $this->lng->txt('saveOrderAndObligations');
412  }
413 
415  return $this->lng->txt('saveObligations');
416  }
417 
418  if ($this->isQuestionPositioningEnabled()) {
419  return $this->lng->txt('saveOrder');
420  }
421 
422  return $this->lng->txt('save');
423  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fillRow()

ilTestQuestionsTableGUI::fillRow ( array  $a_set)

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

References Vendor\Package\$e, $lifecycle, 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(), getPreviewLink(), getQuestionEditLink(), isCheckboxColumnRequired(), ilTable2GUI\isColumnSelected(), isObligatoryQuestionsHandlingEnabled(), isQuestionManagingEnabled(), isQuestionPositioningEnabled(), isQuestionRemoveRowButtonEnabled(), and ILIAS\Repository\lng().

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

◆ getEditLink()

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

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

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

Referenced by fillRow(), and getQuestionEditLink().

354  : string
355  {
356  if ($target_class_path === []) {
357  $target_class_path = $target_class;
358  }
359  $this->ctrl->setParameterByClass(
360  $target_class,
361  'ref_id',
362  current(ilObject::_getAllReferences($row_data['obj_fi']))
363  );
364 
365  $this->ctrl->setParameterByClass(
366  $target_class,
367  'q_id',
368  $row_data['question_id']
369  );
370  $this->ctrl->setParameterByClass(
371  $target_class,
372  'calling_test',
373  $_GET['ref_id']
374  );
375 
376  $link = $this->ctrl->getLinkTargetByClass($target_class_path, $cmd);
377 
378  $this->ctrl->setParameterByClass($target_class, 'ref_id', '');
379  $this->ctrl->setParameterByClass($target_class, 'q_id', '');
380  $this->ctrl->setParameterByClass($target_class, 'calling_test', '');
381  return $link;
382  }
$_GET["client_id"]
Definition: webdav.php:30
static _getAllReferences(int $id)
get all reference ids for object ID
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPreviewLink()

ilTestQuestionsTableGUI::getPreviewLink ( array  $row_data)
protected

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

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

Referenced by buildQuestionTitleLink(), and fillRow().

303  : string
304  {
305  $target_class = get_class($this->getParentObject());
306  $this->ctrl->setParameterByClass(
307  $target_class,
308  'ref_id',
309  current(ilObject::_getAllReferences($row_data['obj_fi']))
310  );
311 
312  $this->ctrl->setParameterByClass(
313  $target_class,
314  'eqpl',
315  current(ilObject::_getAllReferences($row_data['obj_fi']))
316  );
317 
318  $this->ctrl->setParameterByClass(
319  $target_class,
320  'eqid',
321  $row_data['question_id']
322  );
323 
324  $this->ctrl->setParameterByClass(
325  $target_class,
326  'q_id',
327  $row_data['question_id']
328  );
329 
330  $this->ctrl->setParameterByClass(
331  $target_class,
332  'calling_test',
333  (string) $this->parent_ref_id
334  );
335 
336  $question_href = $this->ctrl->getLinkTargetByClass(
337  $target_class,
338  $this->getParentCmd()
339  );
340  $this->ctrl->setParameterByClass($target_class, 'eqpl', '');
341  $this->ctrl->setParameterByClass($target_class, 'eqid', '');
342  $this->ctrl->setParameterByClass($target_class, 'q_id', '');
343  $this->ctrl->setParameterByClass($target_class, 'calling_test', '');
344 
345  return $question_href;
346  }
static _getAllReferences(int $id)
get all reference ids for object ID
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getQuestionEditLink()

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

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

References getEditLink().

Referenced by fillRow().

348  : string
349  {
350  $target_class_path = array_merge(self::CLASS_PATH_FOR_QUESTION_EDIT_LINKS, [$target_class]);
351  return $this->getEditLink($row_data, $target_class, $cmd, $target_class_path);
352  }
getEditLink(array $row_data, string $target_class, string $cmd, array $target_class_path=[])
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSelectableColumns()

ilTestQuestionsTableGUI::getSelectableColumns ( )

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

References ILIAS\Repository\lng().

96  : array
97  {
98  $cols = [
99  'qid' => ['txt' => $this->lng->txt('question_id'), 'default' => true],
100  'description' => ['txt' => $this->lng->txt('description'), 'default' => false],
101  'author' => ['txt' => $this->lng->txt('author'), 'default' => false],
102  'lifecycle' => ['txt' => $this->lng->txt('qst_lifecycle'), 'default' => true]
103  ];
104 
105  return $cols;
106  }
+ Here is the call graph for this function:

◆ getTotalPoints()

ilTestQuestionsTableGUI::getTotalPoints ( )

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

References $totalPoints.

Referenced by buildPointsHeader().

488  : float
489  {
490  return $this->totalPoints;
491  }
+ Here is the caller graph for this function:

◆ getTotalWorkingTime()

ilTestQuestionsTableGUI::getTotalWorkingTime ( )

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

References $totalWorkingTime.

498  : string
499  {
501  }

◆ init()

ilTestQuestionsTableGUI::init ( )

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

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

108  : void
109  {
110  $this->initColumns();
111  $this->initCommands();
112 
113  if ($this->isQuestionManagingEnabled()) {
114  $this->setSelectAllCheckbox('q_id');
115  }
116  }
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
+ Here is the call graph for this function:

◆ initColumns()

ilTestQuestionsTableGUI::initColumns ( )
protected

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

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

Referenced by init().

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

◆ initCommands()

ilTestQuestionsTableGUI::initCommands ( )
protected

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

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

Referenced by init().

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

◆ isCheckboxColumnRequired()

ilTestQuestionsTableGUI::isCheckboxColumnRequired ( )
protected

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

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 478 of file class.ilTestQuestionsTableGUI.php.

References $obligatoryQuestionsHandlingEnabled.

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

478  : bool
479  {
481  }
+ Here is the caller graph for this function:

◆ isPositionInsertCommandsEnabled()

ilTestQuestionsTableGUI::isPositionInsertCommandsEnabled ( )

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

References $positionInsertCommandsEnabled.

Referenced by initCommands(), and isCheckboxColumnRequired().

458  : bool
459  {
461  }
+ Here is the caller graph for this function:

◆ isQuestionManagingEnabled()

ilTestQuestionsTableGUI::isQuestionManagingEnabled ( )

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

References $questionManagingEnabled.

Referenced by buildObligatoryColumnContent(), fillRow(), init(), initCommands(), isCheckboxColumnRequired(), and isTableSaveCommandRequired().

448  : bool
449  {
451  }
+ Here is the caller graph for this function:

◆ isQuestionPositioningEnabled()

ilTestQuestionsTableGUI::isQuestionPositioningEnabled ( )

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

References $questionPositioningEnabled.

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

468  : bool
469  {
471  }
+ Here is the caller graph for this function:

◆ isQuestionRemoveRowButtonEnabled()

ilTestQuestionsTableGUI::isQuestionRemoveRowButtonEnabled ( )

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

References $questionRemoveRowButtonEnabled.

Referenced by fillRow().

503  : bool
504  {
506  }
+ Here is the caller graph for this function:

◆ isTableSaveCommandRequired()

ilTestQuestionsTableGUI::isTableSaveCommandRequired ( )
protected

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

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

Referenced by initCommands().

434  : bool
435  {
436  if (!$this->isQuestionManagingEnabled()) {
437  return false;
438  }
439 
441  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setObligatoryQuestionsHandlingEnabled()

ilTestQuestionsTableGUI::setObligatoryQuestionsHandlingEnabled ( bool  $obligatoryQuestionsHandlingEnabled)

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

References $obligatoryQuestionsHandlingEnabled.

483  : void
484  {
485  $this->obligatoryQuestionsHandlingEnabled = $obligatoryQuestionsHandlingEnabled;
486  }

◆ setPositionInsertCommandsEnabled()

ilTestQuestionsTableGUI::setPositionInsertCommandsEnabled ( bool  $positionInsertCommandsEnabled)

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

References $positionInsertCommandsEnabled.

463  : void
464  {
465  $this->positionInsertCommandsEnabled = $positionInsertCommandsEnabled;
466  }

◆ setQuestionManagingEnabled()

ilTestQuestionsTableGUI::setQuestionManagingEnabled ( bool  $questionManagingEnabled)

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

References $questionManagingEnabled.

453  : void
454  {
455  $this->questionManagingEnabled = $questionManagingEnabled;
456  }

◆ setQuestionPositioningEnabled()

ilTestQuestionsTableGUI::setQuestionPositioningEnabled ( bool  $questionPositioningEnabled)

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

References $questionPositioningEnabled.

473  : void
474  {
475  $this->questionPositioningEnabled = $questionPositioningEnabled;
476  }

◆ setQuestionRemoveRowButtonEnabled()

ilTestQuestionsTableGUI::setQuestionRemoveRowButtonEnabled ( bool  $questionRemoveRowButtonEnabled)

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

References $questionRemoveRowButtonEnabled.

Referenced by ilTestCorrectionsGUI\showQuestionList().

508  : void
509  {
510  $this->questionRemoveRowButtonEnabled = $questionRemoveRowButtonEnabled;
511  }
+ Here is the caller graph for this function:

◆ setTotalPoints()

ilTestQuestionsTableGUI::setTotalPoints ( float  $totalPoints)

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

References $totalPoints.

493  : void
494  {
495  $this->totalPoints = $totalPoints;
496  }

Field Documentation

◆ $obligatoryQuestionsHandlingEnabled

ilTestQuestionsTableGUI::$obligatoryQuestionsHandlingEnabled = false
protected

◆ $position

int ilTestQuestionsTableGUI::$position = 0
private

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

◆ $positionInsertCommandsEnabled

ilTestQuestionsTableGUI::$positionInsertCommandsEnabled = false
protected

◆ $questionManagingEnabled

ilTestQuestionsTableGUI::$questionManagingEnabled = false
protected

◆ $questionPositioningEnabled

ilTestQuestionsTableGUI::$questionPositioningEnabled = false
protected

◆ $questionRemoveRowButtonEnabled

ilTestQuestionsTableGUI::$questionRemoveRowButtonEnabled = false
protected

◆ $totalPoints

float ilTestQuestionsTableGUI::$totalPoints = 0
protected

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

Referenced by getTotalPoints(), and setTotalPoints().

◆ $totalWorkingTime

string ilTestQuestionsTableGUI::$totalWorkingTime = ''
protected

Definition at line 65 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 37 of file class.ilTestQuestionsTableGUI.php.


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