ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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  {
70  $this->determineOffsetAndOrder();
71 
73  $this->lm->getId(),
78  );
79 
80  if (count($questions["set"]) == 0 && $this->getOffset() > 0) {
81  $this->resetOffset();
83  $this->lm->getId(),
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 }
setData(array $a_data)
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setFormAction(string $a_form_action, bool $a_multipart=false)
setEnableTitle(bool $a_enabletitle)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
setId(string $a_val)
static _lookupTitle(int $a_obj_id)
resetOffset(bool $a_in_determination=false)
setExternalSorting(bool $a_val)
__construct(object $a_parent_obj, string $a_parent_cmd, ilObjLearningModule $a_lm)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
global $DIC
Definition: shib_login.php:22
ILIAS TestQuestionPool Questions PublicInterface $questioninfo
__construct(Container $dic, ilPlugin $plugin)
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)
determineOffsetAndOrder(bool $a_omit_offset=false)
setEnableHeader(bool $a_enableheader)
setMaxCount(int $a_max_count)
set max.
setExternalSegmentation(bool $a_val)