ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLMQuestionListTableGUI.php
Go to the documentation of this file.
1<?php
2
25{
26 protected \ILIAS\TestQuestionPool\Questions\PublicInterface $questioninfo;
30
31 public function __construct(
32 object $a_parent_obj,
33 string $a_parent_cmd,
35 ) {
36 global $DIC;
37
38 $this->ctrl = $DIC->ctrl();
39 $this->lng = $DIC->language();
40 $this->access = $DIC->access();
41 $this->rbacsystem = $DIC->rbac()->system();
42 $ilCtrl = $DIC->ctrl();
43
44 $this->lm = $a_lm;
45 $this->questioninfo = $DIC->testQuestion();
46 $this->setId("lm_qst" . $this->lm->getId());
47
48 parent::__construct($a_parent_obj, $a_parent_cmd);
49
50 $this->addColumn($this->lng->txt("pg"));
51 $this->addColumn($this->lng->txt("question"));
52 $this->addColumn($this->lng->txt("cont_users_answered"));
53 $this->addColumn($this->lng->txt("cont_correct_after_first"));
54 $this->addColumn($this->lng->txt("cont_second"));
55 $this->addColumn($this->lng->txt("cont_third_and_more"));
56 $this->addColumn($this->lng->txt("cont_never"));
57
58 $this->setExternalSorting(true);
59 $this->setExternalSegmentation(true);
60 $this->setEnableHeader(true);
61 $this->setFormAction($ilCtrl->getFormAction($this->parent_obj, $this->parent_cmd));
62 $this->setRowTemplate("tpl.lm_question_row.html", "components/ILIAS/LearningModule");
63 $this->setEnableTitle(true);
64
65 $this->getItems();
66 }
67
68 public function getItems(): void
69 {
71
73 $this->lm->getId(),
74 ilUtil::stripSlashes($this->getOrderField()),
75 ilUtil::stripSlashes($this->getOrderDirection()),
76 ilUtil::stripSlashes($this->getOffset()),
77 ilUtil::stripSlashes($this->getLimit())
78 );
79
80 if (count($questions["set"]) == 0 && $this->getOffset() > 0) {
81 $this->resetOffset();
83 $this->lm->getId(),
84 ilUtil::stripSlashes($this->getOrderField()),
85 ilUtil::stripSlashes($this->getOrderDirection()),
86 ilUtil::stripSlashes($this->getOffset()),
87 ilUtil::stripSlashes($this->getLimit())
88 );
89 }
90
91 $this->setMaxCount($questions["cnt"]);
92 $this->setData($questions["set"]);
93 }
94
95 protected function fillRow(array $a_set): void
96 {
97 $this->tpl->setVariable(
98 "PAGE_TITLE",
99 ilLMObject::_lookupTitle($a_set["page_id"])
100 );
101 $this->tpl->setVariable(
102 "QUESTION",
103 $this->questioninfo->getGeneralQuestionProperties($a_set["question_id"])->getQuestionText()
104 );
105
106 $stats = ilPageQuestionProcessor::getQuestionStatistics($a_set["question_id"]);
107
108 $this->tpl->setVariable("VAL_ANSWERED", (int) $stats["all"]);
109 if ($stats["all"] == 0) {
110 $this->tpl->setVariable("VAL_CORRECT_FIRST", 0);
111 $this->tpl->setVariable("VAL_CORRECT_SECOND", 0);
112 $this->tpl->setVariable("VAL_CORRECT_THIRD_OR_MORE", 0);
113 $this->tpl->setVariable("VAL_NEVER", 0);
114 } else {
115 $this->tpl->setVariable("VAL_CORRECT_FIRST", $stats["first"] .
116 " (" . (100 / $stats["all"] * $stats["first"]) . " %)");
117 $this->tpl->setVariable("VAL_CORRECT_SECOND", $stats["second"] .
118 " (" . (100 / $stats["all"] * $stats["second"]) . " %)");
119 $this->tpl->setVariable("VAL_CORRECT_THIRD_AND_MORE", $stats["third_or_more"] .
120 " (" . (100 / $stats["all"] * $stats["third_or_more"]) . " %)");
121 $nev = $stats["all"] - $stats["first"] - $stats["second"] - $stats["third_or_more"];
122 $this->tpl->setVariable("VAL_NEVER", $nev .
123 " (" . (100 / $stats["all"] * $nev) . " %)");
124 }
125 }
126}
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.
ILIAS TestQuestionPool Questions PublicInterface $questioninfo
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="")
Interface ilAccessHandler This interface combines all available interfaces which can be called via gl...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26