ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTestDynamicQuestionSetStatisticTableGUI.php
Go to the documentation of this file.
1 <?php
2 
29 {
30  public const COMPLETE_TABLE_ID = 'tstDynQuestCompleteStat';
31  public const FILTERED_TABLE_ID = 'tstDynQuestFilteredStat';
32 
33  protected array $taxIds = array();
34 
35  private bool $taxonomyFilterEnabled = false;
36 
37  private bool $answerStatusFilterEnabled = false;
38 
40 
41  public function __construct(ilCtrl $ctrl, ilLanguage $lng, $a_parent_obj, $a_parent_cmd, $tableId)
42  {
43  $this->setId($tableId);
44  $this->setPrefix($tableId);
45 
46  parent::__construct($a_parent_obj, $a_parent_cmd);
47 
48  global $DIC;
49  $lng = $DIC['lng'];
50  $ilCtrl = $DIC['ilCtrl'];
51 
52  $this->ctrl = $ilCtrl;
53  $this->lng = $lng;
54 
55  $this->setFormName('filteredquestions');
56  $this->setStyle('table', 'fullwidth');
57 
58  $this->setRowTemplate("tpl.il_as_tst_dynamic_question_set_selection_row.html", "Modules/Test");
59 
60  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
61 
62  $this->enable('header');
63  $this->disable('sort');
64  $this->disable('select_all');
65  $this->disable('numinfo');
66 
67  $this->setDisableFilterHiding(true);
68  }
69 
71  {
73  }
74 
75  public function setFilterSelection(ilTestDynamicQuestionSetFilterSelection $filterSelection): void
76  {
77  $this->filterSelection = $filterSelection;
78  }
79 
80  public function initTitle(string $titleLangVar): void
81  {
82  $this->setTitle($this->lng->txt($titleLangVar));
83  }
84 
85  public function initColumns(string $totalQuestionsColumnHeaderLangVar): void
86  {
87  $this->addColumn($this->lng->txt($totalQuestionsColumnHeaderLangVar), 'num_total_questions', '250');
88 
89  $this->addColumn($this->lng->txt("tst_num_correct_answered_questions"), 'num_correct_answered_questions', '');
90  $this->addColumn($this->lng->txt("tst_num_wrong_answered_questions"), 'num_wrong_answered_questions', '');
91  $this->addColumn($this->lng->txt("tst_num_non_answered_questions_skipped"), 'num_non_answered_questions_skipped', '');
92  $this->addColumn($this->lng->txt("tst_num_non_answered_questions_notseen"), 'num_non_answered_questions_notseen', '');
93  }
94 
95  public function initFilter(): void
96  {
97  if ($this->isTaxonomyFilterEnabled()) {
98  require_once 'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php';
99 
100  foreach ($this->taxIds as $taxId) {
101  $postvar = "tax_$taxId";
102 
103  $inp = new ilTaxSelectInputGUI($taxId, $postvar, true);
104  $this->addFilterItem($inp);
105  #$inp->readFromSession();
106 
107  if ($this->getFilterSelection()->hasSelectedTaxonomy($taxId)) {
108  $inp->setValue($this->getFilterSelection()->getSelectedTaxonomy($taxId));
109  }
110 
111  $this->filter[$postvar] = $inp->getValue();
112  }
113  }
114 
115  if ($this->isAnswerStatusFilterEnabled()) {
116  require_once 'Services/Form/classes/class.ilSelectInputGUI.php';
117  require_once 'Services/Form/classes/class.ilRadioOption.php';
118 
119  $inp = new ilSelectInputGUI($this->lng->txt('tst_question_answer_status'), 'question_answer_status');
120  $inp->setOptions(array(
121  ilAssQuestionList::ANSWER_STATUS_FILTER_ALL_NON_CORRECT => $this->lng->txt('tst_question_answer_status_all_non_correct'),
122  ilAssQuestionList::ANSWER_STATUS_FILTER_NON_ANSWERED_ONLY => $this->lng->txt('tst_question_answer_status_non_answered'),
123  ilAssQuestionList::ANSWER_STATUS_FILTER_WRONG_ANSWERED_ONLY => $this->lng->txt('tst_question_answer_status_wrong_answered')
124  ));
125  $this->addFilterItem($inp);
126  $inp->readFromSession();
127 
128  if ($this->getFilterSelection()->hasAnswerStatusSelection()) {
129  $inp->setValue($this->getFilterSelection()->getAnswerStatusSelection());
130  }
131 
132  $this->filter['question_answer_status'] = $inp->getValue();
133  }
134  }
135 
136  public function fillRow(array $a_set): void
137  {
138  $this->tpl->setVariable('NUM_ALL_QUESTIONS', $a_set['total_all']);
139  $this->tpl->setVariable('NUM_CORRECT_ANSWERED_QUESTIONS', $a_set['correct_answered']);
140  $this->tpl->setVariable('NUM_WRONG_ANSWERED_QUESTIONS', $a_set['wrong_answered']);
141  $this->tpl->setVariable('NUM_NON_ANSWERED_QUESTIONS_SKIPPED', $a_set['non_answered_skipped']);
142  $this->tpl->setVariable('NUM_NON_ANSWERED_QUESTIONS_NOTSEEN', $a_set['non_answered_notseen']);
143  }
144 
145  public function setTaxIds(array $taxIds)
146  {
147  $this->taxIds = $taxIds;
148  }
149 
150  public function getTaxIds(): array
151  {
152  return $this->taxIds;
153  }
154 
155  public function isAnswerStatusFilterEnabled(): bool
156  {
158  }
159 
160  public function setAnswerStatusFilterEnabled(bool $answerStatusFilterEnabled)
161  {
162  $this->answerStatusFilterEnabled = $answerStatusFilterEnabled;
163  }
164 
165  public function isTaxonomyFilterEnabled(): bool
166  {
168  }
169 
170  public function setTaxonomyFilterEnabled(bool $taxonomyFilterEnabled): void
171  {
172  $this->taxonomyFilterEnabled = $taxonomyFilterEnabled;
173  }
174 }
setFilterSelection(ilTestDynamicQuestionSetFilterSelection $filterSelection)
enable(string $a_module_name)
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)
addFilterItem(ilTableFilterItem $a_input_item, bool $a_optional=false)
setDisableFilterHiding(bool $a_val=true)
setFormName(string $a_name="")
ilLanguage $lng
setId(string $a_val)
global $DIC
Definition: feed.php:28
setStyle(string $a_element, string $a_style)
setRowTemplate(string $a_template, string $a_template_dir="")
Set row template.
setTitle(string $a_title, string $a_icon="", string $a_icon_alt="")
const ANSWER_STATUS_FILTER_ALL_NON_CORRECT
answer status filter value domain
__construct(Container $dic, ilPlugin $plugin)
__construct(ilCtrl $ctrl, ilLanguage $lng, $a_parent_obj, $a_parent_cmd, $tableId)
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)
setPrefix(string $a_prefix)