ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilTestDynamicQuestionSetStatisticTableGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 
5 require_once 'Services/Table/classes/class.ilTable2GUI.php';
6 
17 {
18  const COMPLETE_TABLE_ID = 'tstDynQuestCompleteStat';
19  const FILTERED_TABLE_ID = 'tstDynQuestFilteredStat';
20 
24  protected $taxIds = array();
25 
26  private $taxonomyFilterEnabled = false;
27 
28  private $answerStatusFilterEnabled = false;
29 
33  protected $filterSelection = null;
34 
40  public function __construct(ilCtrl $ctrl, ilLanguage $lng, $a_parent_obj, $a_parent_cmd, $tableId)
41  {
42  $this->setId($tableId);
43  $this->setPrefix($tableId);
44 
45  parent::__construct($a_parent_obj, $a_parent_cmd);
46 
47  global $DIC;
48  $lng = $DIC['lng'];
49  $ilCtrl = $DIC['ilCtrl'];
50 
51  $this->ctrl = $ilCtrl;
52  $this->lng = $lng;
53 
54  $this->setFormName('filteredquestions');
55  $this->setStyle('table', 'fullwidth');
56 
57  $this->setRowTemplate("tpl.il_as_tst_dynamic_question_set_selection_row.html", "Modules/Test");
58 
59  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
60 
61  $this->enable('header');
62  $this->disable('sort');
63  $this->disable('select_all');
64  $this->disable('numinfo');
65 
66  $this->setDisableFilterHiding(true);
67  }
68 
72  public function getFilterSelection()
73  {
75  }
76 
81  {
82  $this->filterSelection = $filterSelection;
83  }
84 
85  public function initTitle($titleLangVar)
86  {
87  $this->setTitle($this->lng->txt($titleLangVar));
88  }
89 
90  public function initColumns($totalQuestionsColumnHeaderLangVar)
91  {
92  $this->addColumn($this->lng->txt($totalQuestionsColumnHeaderLangVar), 'num_total_questions', '250');
93 
94  $this->addColumn($this->lng->txt("tst_num_correct_answered_questions"), 'num_correct_answered_questions', '');
95  $this->addColumn($this->lng->txt("tst_num_wrong_answered_questions"), 'num_wrong_answered_questions', '');
96  $this->addColumn($this->lng->txt("tst_num_non_answered_questions_skipped"), 'num_non_answered_questions_skipped', '');
97  $this->addColumn($this->lng->txt("tst_num_non_answered_questions_notseen"), 'num_non_answered_questions_notseen', '');
98  }
99 
103  public function initFilter()
104  {
105  if ($this->isTaxonomyFilterEnabled()) {
106  require_once 'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php';
107 
108  foreach ($this->taxIds as $taxId) {
109  $postvar = "tax_$taxId";
110 
111  $inp = new ilTaxSelectInputGUI($taxId, $postvar, true);
112  $this->addFilterItem($inp);
113  #$inp->readFromSession();
114 
115  if ($this->getFilterSelection()->hasSelectedTaxonomy($taxId)) {
116  $inp->setValue($this->getFilterSelection()->getSelectedTaxonomy($taxId));
117  }
118 
119  $this->filter[$postvar] = $inp->getValue();
120  }
121  }
122 
123  if ($this->isAnswerStatusFilterEnabled()) {
124  require_once 'Services/Form/classes/class.ilSelectInputGUI.php';
125  require_once 'Services/Form/classes/class.ilRadioOption.php';
126 
127  $inp = new ilSelectInputGUI($this->lng->txt('tst_question_answer_status'), 'question_answer_status');
128  $inp->setOptions(array(
129  ilAssQuestionList::ANSWER_STATUS_FILTER_ALL_NON_CORRECT => $this->lng->txt('tst_question_answer_status_all_non_correct'),
130  ilAssQuestionList::ANSWER_STATUS_FILTER_NON_ANSWERED_ONLY => $this->lng->txt('tst_question_answer_status_non_answered'),
131  ilAssQuestionList::ANSWER_STATUS_FILTER_WRONG_ANSWERED_ONLY => $this->lng->txt('tst_question_answer_status_wrong_answered')
132  ));
133  $this->addFilterItem($inp);
134  $inp->readFromSession();
135 
136  if ($this->getFilterSelection()->hasAnswerStatusSelection()) {
137  $inp->setValue($this->getFilterSelection()->getAnswerStatusSelection());
138  }
139 
140  $this->filter['question_answer_status'] = $inp->getValue();
141  }
142  }
143 
151  public function fillRow($data)
152  {
153  $this->tpl->setVariable('NUM_ALL_QUESTIONS', $data['total_all']);
154  $this->tpl->setVariable('NUM_CORRECT_ANSWERED_QUESTIONS', $data['correct_answered']);
155  $this->tpl->setVariable('NUM_WRONG_ANSWERED_QUESTIONS', $data['wrong_answered']);
156  $this->tpl->setVariable('NUM_NON_ANSWERED_QUESTIONS_SKIPPED', $data['non_answered_skipped']);
157  $this->tpl->setVariable('NUM_NON_ANSWERED_QUESTIONS_NOTSEEN', $data['non_answered_notseen']);
158  }
159 
163  public function setTaxIds($taxIds)
164  {
165  $this->taxIds = $taxIds;
166  }
167 
171  public function getTaxIds()
172  {
173  return $this->taxIds;
174  }
175 
179  public function isAnswerStatusFilterEnabled()
180  {
182  }
183 
188  {
189  $this->answerStatusFilterEnabled = $answerStatusFilterEnabled;
190  }
191 
195  public function isTaxonomyFilterEnabled()
196  {
198  }
199 
204  {
205  $this->taxonomyFilterEnabled = $taxonomyFilterEnabled;
206  }
207 }
This class provides processing control methods.
Select taxonomy nodes input GUI.
This class represents a selection list property in a property form.
setStyle($a_element, $a_style)
global $DIC
Definition: saml.php:7
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
setId($a_val)
Set id.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title, $a_icon=0, $a_icon_alt=0)
Set title and title icon.
Class ilTable2GUI.
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
enable($a_module_name)
enables particular modules of table
setPrefix($a_prefix)
setOptions($a_options)
Set Options.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
const ANSWER_STATUS_FILTER_ALL_NON_CORRECT
answer status filter value domain
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
disable($a_module_name)
diesables particular modules of table
setFormName($a_formname="")
Set Form name.
addColumn( $a_text, $a_sort_field="", $a_width="", $a_is_checkbox_action_column=false, $a_class="", $a_tooltip="", $a_tooltip_with_html=false)
Add a column to the header.
__construct(ilCtrl $ctrl, ilLanguage $lng, $a_parent_obj, $a_parent_cmd, $tableId)
Constructor.
language handling