19 declare(strict_types=1);
71 private int $parent_ref_id,
77 $this->
setId(
'tst_qst_lst_' . $parent_ref_id);
82 $this->
setStyle(
'table',
'fullwidth');
86 $this->
setRowTemplate(
"tpl.il_as_tst_questions_row.html",
"Modules/Test");
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]
129 $this->
addColumn($this->
lng->txt(
'question_id'),
'qid',
'');
132 $this->
addColumn($this->
lng->txt(
"tst_question_title"),
'title',
'');
135 $this->
addColumn($this->
lng->txt(
"obligatory"),
'obligatory',
'');
139 $this->
addColumn($this->
lng->txt(
'description'),
'description',
'');
142 $this->
addColumn($this->
lng->txt(
"tst_question_type"),
'type',
'');
146 $this->
addColumn($this->
lng->txt(
'author'),
'author',
'');
149 $this->
addColumn($this->
lng->txt(
'qst_lifecycle'),
'lifecycle',
'');
171 $this->
addMultiCommand(
'copyAndLinkToQuestionpool', $this->
lng->txt(
'copy_and_link_to_questionpool'));
182 $this->tpl->setVariable(
"CHECKBOX_QID", $a_set[
'question_id']);
186 $this->position += 10;
189 $this->tpl->setVariable(
"QUESTION_POSITION", $inputField);
190 $this->tpl->setVariable(
"POSITION_QID", $a_set[
'question_id']);
194 $this->tpl->setVariable(
"QUESTION_ID_PRESENTATION", $a_set[
'question_id']);
199 if (!$a_set[
'complete']) {
200 $this->tpl->setVariable(
"QUESTION_INCOMPLETE_WARNING", $this->
lng->txt(
"warning_question_not_complete"));
208 $this->tpl->setVariable(
"QUESTION_COMMENT", $a_set[
"description"] ? $a_set[
"description"] :
' ');
211 $this->tpl->setVariable(
"QUESTION_TYPE", $this->questioninfo->getQuestionTypeName($a_set[
'question_id']));
212 $this->tpl->setVariable(
"QUESTION_POINTS", $a_set[
"points"]);
215 $this->tpl->setVariable(
"QUESTION_AUTHOR", $a_set[
"author"]);
221 $this->tpl->setVariable(
"QUESTION_LIFECYCLE",
$lifecycle);
223 $this->tpl->setVariable(
"QUESTION_LIFECYCLE",
'');
227 $question_pool_title = $this->
lng->txt(
'tst_question_not_from_pool_info');
230 $question_pool_title = $this->buildPossiblyLinkedQuestonPoolTitle(
236 $a_set[
"orig_obj_fi"],
241 $this->tpl->setVariable(
248 $actions[] = $this->ui_factory->link()->standard(
249 $this->
lng->txt(
'preview'),
253 $actions[] = $this->ui_factory->link()->standard(
254 $this->
lng->txt(
'statistics'),
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);
263 $actions[] = $this->ui_factory->link()->standard($this->
lng->txt(
'edit_page'), $editPageHref);
267 $actions[] = $this->ui_factory->link()->standard($this->
lng->txt(
'move'), $moveHref);
270 $actions[] = $this->ui_factory->link()->standard($this->
lng->txt(
'copy'), $copyHref);
273 $actions[] = $this->ui_factory->link()->standard($this->
lng->txt(
'delete'), $deleteHref);
276 $actions[] = $this->ui_factory->link()->standard($this->
lng->txt(
'tst_feedback'), $feedbackHref);
279 $actions[] = $this->ui_factory->link()->standard($this->
lng->txt(
'tst_question_hints_tab'), $hintsHref);
281 $dropdown = $this->ui_factory->dropdown()->standard($actions);
283 $this->tpl->setVariable(
'ROW_ACTIONS', $this->ui_renderer->render($dropdown));
291 $this->
ctrl->setParameter($this->
getParentObject(),
'removeQid', $row_data[
'question_id']);
295 return $this->ui_renderer->render($this->ui_factory->button()->standard($this->
lng->txt(
'remove_question'), $removeUrl));
300 return '<a href="' . $this->
getPreviewLink($row_data) .
'">' . $row_data[
"title"] .
'</a>';
306 $this->
ctrl->setParameterByClass(
312 $this->
ctrl->setParameterByClass(
318 $this->
ctrl->setParameterByClass(
321 $row_data[
'question_id']
324 $this->
ctrl->setParameterByClass(
327 $row_data[
'question_id']
330 $this->
ctrl->setParameterByClass(
333 (
string) $this->parent_ref_id
336 $question_href = $this->
ctrl->getLinkTargetByClass(
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',
'');
345 return $question_href;
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);
354 protected function getEditLink(array
$row_data,
string $target_class,
string $cmd, array $target_class_path = []): string
356 if ($target_class_path === []) {
357 $target_class_path = $target_class;
359 $this->
ctrl->setParameterByClass(
365 $this->
ctrl->setParameterByClass(
368 $row_data[
'question_id']
370 $this->
ctrl->setParameterByClass(
376 $link = $this->
ctrl->getLinkTargetByClass($target_class_path, $cmd);
378 $this->
ctrl->setParameterByClass($target_class,
'ref_id',
'');
379 $this->
ctrl->setParameterByClass($target_class,
'q_id',
'');
380 $this->
ctrl->setParameterByClass($target_class,
'calling_test',
'');
386 if (!$row_data[
'obligationPossible']) {
391 return $this->ui_renderer->render(
392 $this->ui_factory->symbol()->icon()->custom(
394 $this->
lng->txt(
'question_obligatory')
399 $checkedAttr = $row_data[
'obligatory'] ?
'checked="checked"' :
'';
400 return '<input type="checkbox" name="obligatory[' . $row_data[
'question_id'] .
']" value="1" ' . $checkedAttr .
' />';
405 return '<input type="text" name="order[' . $questionId .
']" value="' . $position .
'" maxlength="4" size="4" />';
411 return $this->
lng->txt(
'saveOrderAndObligations');
415 return $this->
lng->txt(
'saveObligations');
419 return $this->
lng->txt(
'saveOrder');
422 return $this->
lng->txt(
'save');
431 return $this->
lng->txt(
'points');
static getInstance($identifier)
setQuestionManagingEnabled(bool $questionManagingEnabled)
enable(string $a_module_name)
isQuestionRemoveRowButtonEnabled()
setFormAction(string $a_form_action, bool $a_multipart=false)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setObligatoryQuestionsHandlingEnabled(bool $obligatoryQuestionsHandlingEnabled)
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
static _getAllReferences(int $id)
get all reference ids for object ID
$obligatoryQuestionsHandlingEnabled
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
buildObligatoryColumnContent(array $row_data)
setQuestionRemoveRowButtonEnabled(bool $questionRemoveRowButtonEnabled)
setFormName(string $a_name="")
const CMD_SHOW_LIST
command constants
const CMD_SHOW
command constants
$questionRemoveRowButtonEnabled
buildQuestionRemoveButton(array $row_data)
$positionInsertCommandsEnabled
setStyle(string $a_element, string $a_style)
buildQuestionTitleLink(array $row_data)
isColumnSelected(string $col)
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
static _lookupTitle(int $obj_id)
buildTableSaveCommandLabel()
getQuestionEditLink(array $row_data, string $target_class, string $cmd, array $target_class_path=[])
setPositionInsertCommandsEnabled(bool $positionInsertCommandsEnabled)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
buildPositionInput($questionId, $position)
$questionPositioningEnabled
const CLASS_PATH_FOR_QUESTION_EDIT_LINKS
getPreviewLink(array $row_data)
isTableSaveCommandRequired()
getEditLink(array $row_data, string $target_class, string $cmd, array $target_class_path=[])
setQuestionPositioningEnabled(bool $questionPositioningEnabled)
isQuestionPositioningEnabled()
isQuestionManagingEnabled()
isPositionInsertCommandsEnabled()
addColumn(string $a_text, string $a_sort_field="", string $a_width="", bool $a_is_checkbox_action_column=false, string $a_class="", string $a_tooltip="", bool $a_tooltip_with_html=false)
disable(string $a_module_name)
setTotalPoints(float $totalPoints)
addMultiCommand(string $a_cmd, string $a_text)
isCheckboxColumnRequired()
isObligatoryQuestionsHandlingEnabled()
__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)
setExternalSegmentation(bool $a_val)