4 include_once(
'./Services/Table/classes/class.ilTable2GUI.php');
5 require_once
'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php';
73 public function __construct($a_parent_obj, $a_parent_cmd, $parentRefId)
77 $this->renderer = $DIC->ui()->renderer();
78 $this->factory = $DIC->ui()->factory();
79 $this->access = $DIC[
'ilAccess'];
81 $this->
setId(
'tst_qst_lst_' . $parentRefId);
86 $this->
setStyle(
'table',
'fullwidth');
90 $this->
setRowTemplate(
"tpl.il_as_tst_questions_row.html",
"Modules/Test");
92 $this->
setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
106 'qid' => array(
'txt' => $this->lng->txt(
'question_id'),
'default' =>
true),
107 'description' => array(
'txt' => $this->lng->txt(
'description'),
'default' =>
false),
108 'author' => array(
'txt' => $this->lng->txt(
'author'),
'default' =>
false),
109 'lifecycle' => array(
'txt' => $this->lng->txt(
'qst_lifecycle'),
'default' =>
true),
110 'working_time' => array(
'txt' => $this->lng->txt(
'working_time'),
'default' =>
false)
139 $this->
addColumn($this->lng->txt(
'order'),
'f',
'1%');
143 $this->
addColumn($this->lng->txt(
'question_id'),
'qid',
'');
146 $this->
addColumn($this->lng->txt(
"tst_question_title"),
'title',
'');
149 $this->
addColumn($this->lng->txt(
"obligatory"),
'obligatory',
'');
153 $this->
addColumn($this->lng->txt(
'description'),
'description',
'');
156 $this->
addColumn($this->lng->txt(
"tst_question_type"),
'type',
'');
160 $this->
addColumn($this->lng->txt(
'author'),
'author',
'');
163 $this->
addColumn($this->lng->txt(
'qst_lifecycle'),
'lifecycle',
'');
169 $this->
addColumn($this->lng->txt(
'qpl'),
'qpl',
'');
171 $this->
addColumn($this->lng->txt(
'actions'),
'',
'1%');
177 $this->
addMultiCommand(
'removeQuestions', $this->lng->txt(
'remove_question'));
182 $this->
addMultiCommand(
'insertQuestionsBefore', $this->lng->txt(
'insert_before'));
183 $this->
addMultiCommand(
'insertQuestionsAfter', $this->lng->txt(
'insert_after'));
188 $this->
addMultiCommand(
'copyAndLinkToQuestionpool', $this->lng->txt(
'copy_and_link_to_questionpool'));
206 $this->tpl->setVariable(
"CHECKBOX_QID",
$data[
'question_id']);
210 $this->position += 10;
213 $this->tpl->setVariable(
"QUESTION_POSITION", $inputField);
214 $this->tpl->setVariable(
"POSITION_QID",
$data[
'question_id']);
218 $this->tpl->setVariable(
"QUESTION_ID_PRESENTATION",
$data[
'question_id']);
223 if (!
$data[
'complete']) {
225 $this->tpl->setVariable(
"ALT_WARNING", $this->lng->txt(
"warning_question_not_complete"));
226 $this->tpl->setVariable(
"TITLE_WARNING", $this->lng->txt(
"warning_question_not_complete"));
234 $this->tpl->setVariable(
"QUESTION_COMMENT",
$data[
"description"] ?
$data[
"description"] :
' ');
238 $this->tpl->setVariable(
"QUESTION_POINTS",
$data[
"points"]);
241 $this->tpl->setVariable(
"QUESTION_AUTHOR",
$data[
"author"]);
247 $this->tpl->setVariable(
"QUESTION_LIFECYCLE", $lifecycle);
249 $this->tpl->setVariable(
"QUESTION_LIFECYCLE",
'');
254 $this->tpl->setVariable(
"QUESTION_WORKING_TIME",
$data[
"working_time"]);
257 $question_pool_title = $this->lng->txt(
'tst_question_not_from_pool_info');
260 $question_pool_title = $this->buildPossiblyLinkedQuestonPoolTitle(
266 $data[
"orig_obj_fi"],
271 $this->tpl->setVariable(
277 $actions->setId(
'qst' .
$data[
"question_id"]);
278 $actions->setListTitle($this->lng->txt(
'actions'));
281 $this->lng->txt(
'preview'),
287 $this->lng->txt(
'statistics'),
294 $actions->addItem($this->lng->txt(
'edit_question'),
'', $editHref);
297 $actions->addItem($this->lng->txt(
'edit_page'),
'', $editPageHref);
300 $actions->addItem($this->lng->txt(
'move'),
'', $moveHref);
303 $actions->addItem($this->lng->txt(
'copy'),
'', $copyHref);
306 $actions->addItem($this->lng->txt(
'delete'),
'', $deleteHref);
309 $actions->addItem($this->lng->txt(
'tst_feedback'),
'', $feedbackHref);
312 $actions->addItem($this->lng->txt(
'tst_question_hints_tab'),
'', $hintsHref);
314 $this->tpl->setVariable(
'ROW_ACTIONS', $actions->getHTML());
322 $this->ctrl->setParameter($this->
getParentObject(),
'removeQid', $rowData[
'question_id']);
327 $button->setCaption(
'remove_question');
328 $button->setUrl($removeUrl);
330 return $button->render();
335 return '<a href="' . $this->
getPreviewLink($rowData) .
'">' . $rowData[
"title"] .
'</a>';
341 $this->ctrl->setParameterByClass(
347 $this->ctrl->setParameterByClass(
353 $this->ctrl->setParameterByClass(
356 $rowData[
'question_id']
359 $this->ctrl->setParameterByClass(
362 $rowData[
'question_id']
365 $this->ctrl->setParameterByClass(
371 $question_href = $this->ctrl->getLinkTargetByClass(
375 $this->ctrl->setParameterByClass($target_class,
'eqpl',
'');
376 $this->ctrl->setParameterByClass($target_class,
'eqid',
'');
377 $this->ctrl->setParameterByClass($target_class,
'q_id',
'');
378 $this->ctrl->setParameterByClass($target_class,
'calling_test',
'');
380 return $question_href;
383 protected function getEditLink(array $rowData,
string $target_class,
string $cmd) : string
385 $this->ctrl->setParameterByClass(
391 $this->ctrl->setParameterByClass(
394 $rowData[
'question_id']
396 $this->ctrl->setParameterByClass(
402 $link = $this->ctrl->getLinkTargetByClass(array_merge(
403 self::CLASS_PATH_FOR_EDIT_LINKS,
407 $this->ctrl->setParameterByClass($target_class,
'ref_id',
'');
408 $this->ctrl->setParameterByClass($target_class,
'q_id',
'');
409 $this->ctrl->setParameterByClass($target_class,
'calling_test',
'');
419 if (!$rowData[
'obligationPossible']) {
428 $checkedAttr = $rowData[
'obligatory'] ?
'checked="checked"' :
'';
429 return '<input type="checkbox" name="obligatory[' . $rowData[
'question_id'] .
']" value="1" ' . $checkedAttr .
' />';
439 return '<input type="text" name="order[q_' . $questionId .
']" value="' .
$position .
'" maxlength="4" size="4" />';
448 return $this->lng->txt(
'saveOrderAndObligations');
452 return $this->lng->txt(
'saveObligations');
456 return $this->lng->txt(
'saveOrder');
459 return $this->lng->txt(
'save');
468 return $this->lng->txt(
'points') .
' (' . $this->
getTotalPoints() .
')';
471 return $this->lng->txt(
'points');
483 return $this->lng->txt(
'working_time');
addCommandButton($a_cmd, $a_text, $a_onclick='', $a_id="", $a_class=null)
Add Command button.
static getInstance($identifier)
setQuestionManagingEnabled(bool $questionManagingEnabled)
buildQuestionTitleLink(array $rowData)
isQuestionRemoveRowButtonEnabled()
setStyle($a_element, $a_style)
buildQuestionRemoveButton(array $rowData)
setObligatoryQuestionsHandlingEnabled(bool $obligatoryQuestionsHandlingEnabled)
$obligatoryQuestionsHandlingEnabled
setExternalSegmentation($a_val)
Set external segmentation.
static _getQuestionTypeName($type_tag)
Return the translation for a given question type tag.
static get($a_glyph, $a_text="")
Get glyph html.
static _lookupTitle($a_id)
lookup object title
setQuestionRemoveRowButtonEnabled(bool $questionRemoveRowButtonEnabled)
getPreviewLink(array $rowData)
getParentCmd()
Get parent command.
getParentObject()
Get parent object.
const CMD_SHOW_LIST
command constants
static _getAllReferences($a_id)
get all reference ids of object
const CMD_SHOW
command constants
$questionRemoveRowButtonEnabled
$positionInsertCommandsEnabled
buildTableSaveCommandLabel()
setTotalWorkingTime(string $totalWorkingTime)
const CLASS_PATH_FOR_EDIT_LINKS
setSelectAllCheckbox($a_select_all_checkbox, $a_select_all_on_top=false)
Set the name of the checkbox that should be toggled with a select all button.
setPositionInsertCommandsEnabled(bool $positionInsertCommandsEnabled)
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
addMultiCommand($a_cmd, $a_text)
Add Command button.
enable($a_module_name)
enables particular modules of table
buildPositionInput($questionId, $position)
$questionPositioningEnabled
setRowTemplate($a_template, $a_template_dir="")
Set row template.
isTableSaveCommandRequired()
buildObligatoryColumnContent(array $rowData)
setQuestionPositioningEnabled(bool $questionPositioningEnabled)
isQuestionPositioningEnabled()
isColumnSelected($a_col)
Is given column selected?
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
isQuestionManagingEnabled()
setFormName($a_formname="")
Set Form name.
__construct(Container $dic, ilPlugin $plugin)
isPositionInsertCommandsEnabled()
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
getEditLink(array $rowData, string $target_class, string $cmd)
__construct($a_parent_obj, $a_parent_cmd, $parentRefId)
Constructor.
setTotalPoints(float $totalPoints)
isCheckboxColumnRequired()
isObligatoryQuestionsHandlingEnabled()