32 private \ILIAS\TestQuestionPool\InternalRequestService
$request;
34 protected \ILIAS\Notes\Service
$notes;
56 $this->
setId(
"qpl_confirm_del_" . $a_parent_obj->object->getRefId());
58 $this->
setId(
"qpl_qst_brows_" . $a_parent_obj->object->getRefId());
65 $ilCtrl = $DIC[
'ilCtrl'];
66 $this->request = $DIC->testQuestionPool()->internal()->request();
68 $this->
ctrl = $ilCtrl;
69 $this->questioninfo = $DIC->testQuestionPool()->questionInfo();
71 $this->renderer = $DIC->ui()->renderer();
72 $this->ui_factory = $DIC->ui()->factory();
81 $this->
setStyle(
'table',
'fullwidth');
86 if (strcmp(
$c,
'description') == 0) {
87 $this->
addColumn($this->
lng->txt(
"description"),
'description',
'');
89 if (strcmp(
$c,
'type') == 0) {
90 $this->
addColumn($this->
lng->txt(
"question_type"),
'ttype',
'');
93 if (strcmp(
$c,
'points') == 0) {
94 $this->
addColumn($this->
lng->txt(
"points"),
'points',
'',
false,
'ilCenterForced');
96 if (strcmp(
$c,
'statistics') == 0) {
99 if (strcmp(
$c,
'author') == 0) {
100 $this->
addColumn($this->
lng->txt(
"author"),
'author',
'');
102 if (
$c ==
'lifecycle') {
103 $this->
addColumn($this->
lng->txt(
'qst_lifecycle'),
'lifecycle',
'');
106 $this->
addColumn($this->
lng->txt(
"ass_comments"),
'comments',
'');
108 if (strcmp(
$c,
'created') == 0) {
109 $this->
addColumn($this->
lng->txt(
"create_date"),
'created',
'');
111 if (strcmp(
$c,
'tstamp') == 0) {
112 $this->
addColumn($this->
lng->txt(
"last_update"),
'tstamp',
'');
118 $this->
addColumn($this->
lng->txt(
"title"),
'title',
'');
120 if (strcmp(
$c,
'description') == 0) {
121 $this->
addColumn($this->
lng->txt(
"description"),
'description',
'');
123 if (strcmp(
$c,
'type') == 0) {
124 $this->
addColumn($this->
lng->txt(
"question_type"),
'ttype',
'');
141 $this->
setRowTemplate(
"tpl.il_as_qpl_questionbrowser_row.html",
"Modules/TestQuestionPool");
155 $this->
enable(
'select_all');
160 $this->notes = $DIC->notes();
162 $this->notes->gui()->initJavascript();
190 foreach ($questionData as
$key =>
$data) {
191 $notes_context = $this->notes
194 $this->parent_obj->object->getId(),
195 $data[
'question_id'],
198 $numComments = $this->notes
200 ->getNrOfCommentsForContext($notes_context);
202 if ($this->
filter[
'commented'] && !$numComments) {
203 unset($questionData[
$key]);
207 $questionData[
$key][
'comments'] = $numComments;
218 $cols[
"description"] = array(
219 "txt" =>
$lng->
txt(
"description"),
222 $cols[
"type"] = array(
223 "txt" =>
$lng->
txt(
"question_type"),
226 if (!$this->confirmdelete) {
227 $cols[
"points"] = array(
231 $cols[
"statistics"] = array(
232 "txt" =>
$lng->
txt(
"statistics"),
235 $cols[
"author"] = array(
239 $cols[
'lifecycle'] = array(
240 'txt' =>
$lng->
txt(
'qst_lifecycle'),
244 $cols[
"comments"] = array(
245 "txt" =>
$lng->
txt(
"comments"),
249 $cols[
"created"] = array(
250 "txt" =>
$lng->
txt(
"create_date"),
253 $cols[
"tstamp"] = array(
254 "txt" =>
$lng->
txt(
"last_update"),
270 $ti->setMaxLength(64);
271 $ti->setValidationRegexp(
'/^[^%]+$/is');
274 $ti->readFromSession();
275 $this->
filter[
"title"] = $ti->getValue();
279 $ti->setMaxLength(64);
281 $ti->setValidationRegexp(
'/^[^%]+$/is');
283 $ti->readFromSession();
284 $this->
filter[
"description"] = $ti->getValue();
286 if (!$this->confirmdelete) {
289 $ti->setMaxLength(64);
291 $ti->setValidationRegexp(
'/^[^%]+$/is');
293 $ti->readFromSession();
294 $this->
filter[
"author"] = $ti->getValue();
298 $lifecycleOptions = array_merge(
299 array(
'' => $this->
lng->txt(
'qst_lifecycle_filter_all')),
305 $lifecycleInp->readFromSession();
306 $this->
filter[
'lifecycle'] = $lifecycleInp->getValue();
310 $options[
""] =
$lng->
txt(
'filter_all_question_types');
311 foreach ($types as $translation => $row) {
312 $options[$row[
'type_tag']] = $translation;
318 $si->readFromSession();
319 $this->
filter[
"type"] = $si->getValue();
321 if ($this->parent_obj->object->getShowTaxonomies()) {
322 foreach ($this->taxIds as $taxId) {
323 $postvar =
"tax_$taxId";
327 $inp->readFromSession();
328 $this->
filter[$postvar] = $inp->getValue();
344 if (strcmp(
$column[
'text'], $this->
lng->txt(
"points")) == 0) {
345 $this->column[
$key][
'text'] = $this->
lng->txt(
"points") .
" (" . $this->totalPoints .
")";
348 parent::fillHeader();
360 $this->
ctrl->setParameterByClass(
"ilAssQuestionPageGUI",
"q_id", $a_set[
"question_id"]);
361 $this->
ctrl->setParameterByClass(
"ilAssQuestionPreviewGUI",
"q_id", $a_set[
"question_id"]);
362 $this->
ctrl->setParameterByClass($class,
"q_id", $a_set[
"question_id"]);
367 if (!$this->confirmdelete) {
368 $this->tpl->setCurrentBlock(
'checkbox');
369 $this->tpl->setVariable(
'CB_QUESTION_ID', $a_set[
"question_id"]);
370 $this->tpl->parseCurrentBlock();
372 if ($a_set[
"complete"] == 0) {
373 $icon = $this->ui_factory->symbol()->icon()->custom(
ilUtil::getImagePath(
"standard/icon_alert.svg"), $this->
lng->txt(
"warning_question_not_complete"));
374 $this->tpl->setCurrentBlock(
"qpl_warning");
375 $this->tpl->setVariable(
"ICON_WARNING", $this->renderer->render(
$icon));
376 $this->tpl->parseCurrentBlock();
378 $points = $a_set[
"points"];
380 $this->totalPoints += $points;
383 if (strcmp($c,
'points') == 0) {
384 $this->tpl->setCurrentBlock(
'points');
385 $this->tpl->setVariable(
"QUESTION_POINTS", $points);
386 $this->tpl->parseCurrentBlock();
388 if (strcmp($c,
'statistics') == 0) {
389 $this->tpl->setCurrentBlock(
'statistics');
391 $this->tpl->setVariable(
"TXT_ASSESSMENT", $this->
lng->txt(
"statistics"));
392 $this->tpl->setVariable(
"IMG_ASSESSMENT",
ilUtil::getImagePath(
"assessment.gif",
"Modules/TestQuestionPool"));
393 $this->tpl->parseCurrentBlock();
395 if (strcmp($c,
'author') == 0) {
396 $this->tpl->setCurrentBlock(
'author');
397 $this->tpl->setVariable(
"QUESTION_AUTHOR", $a_set[
"author"]);
398 $this->tpl->parseCurrentBlock();
400 if ($c ==
'lifecycle') {
403 $this->tpl->setCurrentBlock(
'lifecycle');
404 $this->tpl->setVariable(
"QUESTION_LIFECYCLE",
$lifecycle->getTranslation($this->lng));
405 $this->tpl->parseCurrentBlock();
408 $this->tpl->setCurrentBlock(
'comments');
410 $this->tpl->parseCurrentBlock();
412 if (strcmp($c,
'created') == 0) {
413 $this->tpl->setCurrentBlock(
'created');
415 $this->tpl->parseCurrentBlock();
417 if (strcmp($c,
'tstamp') == 0) {
418 $this->tpl->setCurrentBlock(
'updated');
420 $this->tpl->parseCurrentBlock();
424 $actions[] = $this->ui_factory->link()->standard(
425 $this->
lng->txt(
'preview'),
429 $actions[] = $this->ui_factory->link()->standard(
430 $this->
lng->txt(
'statistics'),
435 $this->
ctrl->setParameterByClass($a_set[
'type_tag'] .
'GUI',
'q_id', $a_set[
'question_id']);
436 $editHref = $this->
ctrl->getLinkTargetByClass($a_set[
'type_tag'] .
'GUI',
'editQuestion');
437 $this->
ctrl->setParameterByClass($a_set[
'type_tag'] .
'GUI',
'q_id', null);
438 $actions[] = $this->ui_factory->link()->standard($this->
lng->txt(
'edit_question'), $editHref);
440 $editPageHref = $this->
ctrl->getLinkTargetByClass(
'ilAssQuestionPageGUI',
'edit');
441 $actions[] = $this->ui_factory->link()->standard($this->
lng->txt(
'edit_page'), $editPageHref);
445 $this->
ctrl->setParameter($this->parent_obj,
'q_id', $a_set[
'question_id']);
446 $moveHref = $this->
ctrl->getLinkTarget($this->parent_obj,
'move');
447 $this->
ctrl->setParameter($this->parent_obj,
'q_id', null);
448 $actions[] = $this->ui_factory->link()->standard($this->
lng->txt(
'move'), $moveHref);
450 $this->
ctrl->setParameter($this->parent_obj,
'q_id', $a_set[
'question_id']);
451 $copyHref = $this->
ctrl->getLinkTarget($this->parent_obj,
'copy');
452 $this->
ctrl->setParameter($this->parent_obj,
'q_id', null);
453 $actions[] = $this->ui_factory->link()->standard($this->
lng->txt(
'copy'), $copyHref);
455 $this->
ctrl->setParameter($this->parent_obj,
'q_id', $a_set[
'question_id']);
456 $deleteHref = $this->
ctrl->getLinkTarget($this->parent_obj,
'deleteQuestions');
457 $this->
ctrl->setParameter($this->parent_obj,
'q_id', null);
458 $actions[] = $this->ui_factory->link()->standard($this->
lng->txt(
'delete'), $deleteHref);
462 $this->
ctrl->setParameterByClass(
'ilAssQuestionFeedbackEditingGUI',
'q_id', $a_set[
'question_id']);
464 $this->
ctrl->setParameterByClass(
'ilAssQuestionFeedbackEditingGUI',
'q_id', null);
465 $actions[] = $this->ui_factory->link()->standard($this->
lng->txt(
'tst_feedback'), $feedbackHref);
467 $this->
ctrl->setParameterByClass(
'ilAssQuestionHintsGUI',
'q_id', $a_set[
'question_id']);
469 $this->
ctrl->setParameterByClass(
'ilAssQuestionHintsGUI',
'q_id', null);
470 $actions[] = $this->ui_factory->link()->standard($this->
lng->txt(
'tst_question_hints_tab'), $hintsHref);
474 $actions[] = $this->ui_factory->link()->standard($this->
lng->txt(
'ass_comments'), $this->
getCommentsAjaxLink($a_set[
'question_id']));
477 $this->tpl->setCurrentBlock(
'hidden');
478 $this->tpl->setVariable(
'HIDDEN_QUESTION_ID', $a_set[
"question_id"]);
479 $this->tpl->parseCurrentBlock();
483 if (strcmp($c,
'description') == 0) {
484 $this->tpl->setCurrentBlock(
'description');
485 $this->tpl->setVariable(
"QUESTION_COMMENT", $a_set[
'description']);
486 $this->tpl->parseCurrentBlock();
488 if (strcmp($c,
'type') == 0) {
489 $this->tpl->setCurrentBlock(
'type');
490 $this->tpl->setVariable(
"QUESTION_TYPE", $this->questioninfo->getQuestionTypeName($a_set[
"question_id"]));
491 $this->tpl->parseCurrentBlock();
494 $this->tpl->setVariable(
'QUESTION_ID', $a_set[
"question_id"]);
495 if (!$this->confirmdelete) {
497 $this->tpl->setVariable(
'QUESTION_TITLE_LINKED', $a_set[
'title']);
499 $dropdown = $this->ui_factory->dropdown()->standard($actions)->withLabel($this->
lng->txt(
'actions'));
501 $this->tpl->setVariable(
'ACTIONS', $this->renderer->render($dropdown));
503 $this->tpl->setVariable(
'QUESTION_ID_UNLINKED', $a_set[
'question_id']);
504 $this->tpl->setVariable(
'QUESTION_TITLE_UNLINKED', $a_set[
'title']);
510 $this->editable = $value;
520 $this->writeAccess = $value;
534 if (in_array($a_field, array(
'points',
'created',
'tstamp',
'comments'))) {
543 if (!$qData[
'comments']) {
549 $comment_glyph = $this->ui_factory->symbol()->glyph()->comment()->withCounter(
550 $this->ui_factory->counter()->status($qData[
'comments'])
552 return "document.getElementById('$id').onclick = function (event) { $ajax_link; };";
554 return $this->renderer->render($comment_glyph);
560 $update_code =
"il.UI.counter.getCounterObject($(\".ilTableOuter\")).incrementStatusCount(1);";
static getInstance($identifier)
enable(string $a_module_name)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setFormAction(string $a_form_action, bool $a_multipart=false)
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
static _getGUIClassNameForId($a_q_id)
addCommandButton(string $a_cmd, string $a_text, string $a_onclick='', string $a_id="", string $a_class="")
setResetCommand(string $a_val, string $a_caption="")
setSelectAllCheckbox(string $a_select_all_checkbox, bool $a_select_all_on_top=false)
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
withAdditionalOnLoadCode(Closure $binder)
ILIAS TestQuestionPool InternalRequestService $request
setFormName(string $a_name="")
__construct($a_parent_obj, $a_parent_cmd, $a_write_access=false, $confirmdelete=false, $taxIds=array(), $enableCommenting=false)
const CMD_SHOW_LIST
command constants
const CMD_SHOW
command constants
setStyle(string $a_element, string $a_style)
setShowRowsSelector(bool $a_value)
Toggle rows-per-page selector.
$questionCommentingEnabled
setDefaultOrderField(string $a_defaultorderfield)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setFilterCommand(string $a_val, string $a_caption="")
isQuestionCommentingEnabled()
setDefaultOrderDirection(string $a_defaultorderdirection)
getCommentsAjaxLink($questionId)
ILIAS Notes Service $notes
fillRow(array $a_set)
fill row public
ILIAS UI Factory $ui_factory
isCommentsColumnSelected()
setQuestionCommentingEnabled(bool $questionCommentingEnabled)
setQuestionData($questionData)
static buildAjaxHash(int $node_type, ?int $node_id, string $obj_type, int $obj_id, string $sub_type=null, int $sub_id=null, int $news_id=0)
Build ajax hash.
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)
ILIAS UI Renderer $renderer
QuestionInfoService $questioninfo
filter(string $filter_id, $class_path, string $cmd, bool $activated=true, bool $expanded=true)
static getListCommentsJSCall(string $a_hash, string $a_update_code=null)
Get list comments js call.
addMultiCommand(string $a_cmd, string $a_text)
numericOrdering(string $a_field)
static getDraftInstance()
static _getQuestionTypes($all_tags=false, $fixOrder=false, $withDeprecatedTypes=true)