ILIAS  release_8 Revision v8.24
class.ilLMQuestionListTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
29
30 public function __construct(
31 object $a_parent_obj,
32 string $a_parent_cmd,
34 ) {
35 global $DIC;
36
37 $this->ctrl = $DIC->ctrl();
38 $this->lng = $DIC->language();
39 $this->access = $DIC->access();
40 $this->rbacsystem = $DIC->rbac()->system();
41 $ilCtrl = $DIC->ctrl();
42
43 $this->lm = $a_lm;
44
45 $this->setId("lm_qst" . $this->lm->getId());
46
47 parent::__construct($a_parent_obj, $a_parent_cmd);
48
49 $this->addColumn($this->lng->txt("pg"));
50 $this->addColumn($this->lng->txt("question"));
51 $this->addColumn($this->lng->txt("cont_users_answered"));
52 $this->addColumn($this->lng->txt("cont_correct_after_first"));
53 $this->addColumn($this->lng->txt("cont_second"));
54 $this->addColumn($this->lng->txt("cont_third_and_more"));
55 $this->addColumn($this->lng->txt("cont_never"));
56
57 $this->setExternalSorting(true);
58 $this->setExternalSegmentation(true);
59 $this->setEnableHeader(true);
60 $this->setFormAction($ilCtrl->getFormAction($this->parent_obj, $this->parent_cmd));
61 $this->setRowTemplate("tpl.lm_question_row.html", "Modules/LearningModule");
62 $this->setEnableTitle(true);
63
64 $this->getItems();
65 }
66
67 public function getItems(): void
68 {
70
72 $this->lm->getId(),
73 ilUtil::stripSlashes($this->getOrderField()),
74 ilUtil::stripSlashes($this->getOrderDirection()),
75 ilUtil::stripSlashes($this->getOffset()),
76 ilUtil::stripSlashes($this->getLimit())
77 );
78
79 if (count($questions["set"]) == 0 && $this->getOffset() > 0) {
80 $this->resetOffset();
82 $this->lm->getId(),
83 ilUtil::stripSlashes($this->getOrderField()),
84 ilUtil::stripSlashes($this->getOrderDirection()),
85 ilUtil::stripSlashes($this->getOffset()),
86 ilUtil::stripSlashes($this->getLimit())
87 );
88 }
89
90 $this->setMaxCount($questions["cnt"]);
91 $this->setData($questions["set"]);
92 }
93
94 protected function fillRow(array $a_set): void
95 {
96 $this->tpl->setVariable(
97 "PAGE_TITLE",
98 ilLMObject::_lookupTitle($a_set["page_id"])
99 );
100 $this->tpl->setVariable(
101 "QUESTION",
102 assQuestion::_getQuestionText($a_set["question_id"])
103 );
104
105 $stats = ilPageQuestionProcessor::getQuestionStatistics($a_set["question_id"]);
106
107 $this->tpl->setVariable("VAL_ANSWERED", (int) $stats["all"]);
108 if ($stats["all"] == 0) {
109 $this->tpl->setVariable("VAL_CORRECT_FIRST", 0);
110 $this->tpl->setVariable("VAL_CORRECT_SECOND", 0);
111 $this->tpl->setVariable("VAL_CORRECT_THIRD_OR_MORE", 0);
112 $this->tpl->setVariable("VAL_NEVER", 0);
113 } else {
114 $this->tpl->setVariable("VAL_CORRECT_FIRST", $stats["first"] .
115 " (" . (100 / $stats["all"] * $stats["first"]) . " %)");
116 $this->tpl->setVariable("VAL_CORRECT_SECOND", $stats["second"] .
117 " (" . (100 / $stats["all"] * $stats["second"]) . " %)");
118 $this->tpl->setVariable("VAL_CORRECT_THIRD_AND_MORE", $stats["third_or_more"] .
119 " (" . (100 / $stats["all"] * $stats["third_or_more"]) . " %)");
120 $nev = $stats["all"] - $stats["first"] - $stats["second"] - $stats["third_or_more"];
121 $this->tpl->setVariable("VAL_NEVER", $nev .
122 " (" . (100 / $stats["all"] * $nev) . " %)");
123 }
124 }
125}
static _getQuestionText(int $a_q_id)
static _lookupTitle(int $a_obj_id)
static queryQuestionsOfLearningModule(int $a_lm_id, string $a_order_field, string $a_order_dir, int $a_offset, int $a_limit)
Get questions of learning module.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(object $a_parent_obj, string $a_parent_cmd, ilObjLearningModule $a_lm)
fillRow(array $a_set)
Standard Version of Fill Row.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
class ilRbacSystem system function like checkAccess, addActiveRole ... Supporting system functions ar...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
determineOffsetAndOrder(bool $a_omit_offset=false)
setExternalSegmentation(bool $a_val)
setEnableTitle(bool $a_enabletitle)
setFormAction(string $a_form_action, bool $a_multipart=false)
resetOffset(bool $a_in_determination=false)
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)
setEnableHeader(bool $a_enableheader)
setExternalSorting(bool $a_val)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setId(string $a_val)
setData(array $a_data)
Set table data.
setMaxCount(int $a_max_count)
set max.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
global $DIC
Definition: feed.php:28
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc