ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $lng, $ilCtrl;
48 
49  $this->ctrl = $ilCtrl;
50  $this->lng = $lng;
51 
52  $this->setFormName('filteredquestions');
53  $this->setStyle('table', 'fullwidth');
54 
55  $this->setRowTemplate("tpl.il_as_tst_dynamic_question_set_selection_row.html", "Modules/Test");
56 
57  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
58 
59  $this->enable('header');
60  $this->disable('sort');
61  $this->disable('select_all');
62  $this->disable('numinfo');
63 
64  $this->setDisableFilterHiding(true);
65  }
66 
70  public function getFilterSelection()
71  {
73  }
74 
79  {
80  $this->filterSelection = $filterSelection;
81  }
82 
83  public function initTitle($titleLangVar)
84  {
85  $this->setTitle($this->lng->txt($titleLangVar));
86  }
87 
88  public function initColumns($totalQuestionsColumnHeaderLangVar)
89  {
90  $this->addColumn($this->lng->txt($totalQuestionsColumnHeaderLangVar), 'num_total_questions', '250');
91 
92  $this->addColumn($this->lng->txt("tst_num_correct_answered_questions"), 'num_correct_answered_questions', '');
93  $this->addColumn($this->lng->txt("tst_num_wrong_answered_questions"), 'num_wrong_answered_questions', '');
94  $this->addColumn($this->lng->txt("tst_num_non_answered_questions_skipped"), 'num_non_answered_questions_skipped', '');
95  $this->addColumn($this->lng->txt("tst_num_non_answered_questions_notseen"), 'num_non_answered_questions_notseen', '');
96  }
97 
101  public function initFilter()
102  {
103  if ($this->isTaxonomyFilterEnabled()) {
104  require_once 'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php';
105 
106  foreach ($this->taxIds as $taxId) {
107  $postvar = "tax_$taxId";
108 
109  $inp = new ilTaxSelectInputGUI($taxId, $postvar, true);
110  $this->addFilterItem($inp);
111  #$inp->readFromSession();
112 
113  if ($this->getFilterSelection()->hasSelectedTaxonomy($taxId)) {
114  $inp->setValue($this->getFilterSelection()->getSelectedTaxonomy($taxId));
115  }
116 
117  $this->filter[$postvar] = $inp->getValue();
118  }
119  }
120 
121  if ($this->isAnswerStatusFilterEnabled()) {
122  require_once 'Services/Form/classes/class.ilSelectInputGUI.php';
123  require_once 'Services/Form/classes/class.ilRadioOption.php';
124 
125  $inp = new ilSelectInputGUI($this->lng->txt('tst_question_answer_status'), 'question_answer_status');
126  $inp->setOptions(array(
127  ilAssQuestionList::ANSWER_STATUS_FILTER_ALL_NON_CORRECT => $this->lng->txt('tst_question_answer_status_all_non_correct'),
128  ilAssQuestionList::ANSWER_STATUS_FILTER_NON_ANSWERED_ONLY => $this->lng->txt('tst_question_answer_status_non_answered'),
129  ilAssQuestionList::ANSWER_STATUS_FILTER_WRONG_ANSWERED_ONLY => $this->lng->txt('tst_question_answer_status_wrong_answered')
130  ));
131  $this->addFilterItem($inp);
132  $inp->readFromSession();
133 
134  if ($this->getFilterSelection()->hasAnswerStatusSelection()) {
135  $inp->setValue($this->getFilterSelection()->getAnswerStatusSelection());
136  }
137 
138  $this->filter['question_answer_status'] = $inp->getValue();
139  }
140  }
141 
149  public function fillRow($data)
150  {
151  $this->tpl->setVariable('NUM_ALL_QUESTIONS', $data['total_all']);
152  $this->tpl->setVariable('NUM_CORRECT_ANSWERED_QUESTIONS', $data['correct_answered']);
153  $this->tpl->setVariable('NUM_WRONG_ANSWERED_QUESTIONS', $data['wrong_answered']);
154  $this->tpl->setVariable('NUM_NON_ANSWERED_QUESTIONS_SKIPPED', $data['non_answered_skipped']);
155  $this->tpl->setVariable('NUM_NON_ANSWERED_QUESTIONS_NOTSEEN', $data['non_answered_notseen']);
156  }
157 
161  public function setTaxIds($taxIds)
162  {
163  $this->taxIds = $taxIds;
164  }
165 
169  public function getTaxIds()
170  {
171  return $this->taxIds;
172  }
173 
177  public function isAnswerStatusFilterEnabled()
178  {
180  }
181 
186  {
187  $this->answerStatusFilterEnabled = $answerStatusFilterEnabled;
188  }
189 
193  public function isTaxonomyFilterEnabled()
194  {
196  }
197 
202  {
203  $this->taxonomyFilterEnabled = $taxonomyFilterEnabled;
204  }
205 }
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)
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.
Create styles array
The data for the language used.
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