ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
30 
35 
36  private $taxonomyFilterEnabled = false;
37 
38  private $answerStatusFilterEnabled = false;
39 
45  public function __construct(ilCtrl $ctrl, ilLanguage $lng, $a_parent_obj, $a_parent_cmd, $tableId)
46  {
47  $this->setId($tableId);
48  $this->setPrefix($tableId);
49 
50  parent::__construct($a_parent_obj, $a_parent_cmd);
51 
52  global $lng, $ilCtrl;
53 
54  $this->ctrl = $ilCtrl;
55  $this->lng = $lng;
56 
57  $this->setFormName('filteredquestions');
58  $this->setStyle('table', 'fullwidth');
59 
60  $this->setRowTemplate("tpl.il_as_tst_dynamic_question_set_selection_row.html", "Modules/Test");
61 
62  $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, $a_parent_cmd));
63 
64  $this->enable('header');
65  $this->disable('sort');
66  $this->disable('select_all');
67  $this->disable('numinfo');
68 
69  $this->setDisableFilterHiding(true);
70  }
71 
72  public function initTitle($titleLangVar)
73  {
74  $this->setTitle($this->lng->txt($titleLangVar));
75  }
76 
77  public function initColumns($totalQuestionsColumnHeaderLangVar)
78  {
79  $this->addColumn($this->lng->txt($totalQuestionsColumnHeaderLangVar), 'num_total_questions', '250');
80 
81  $this->addColumn($this->lng->txt("tst_num_correct_answered_questions"),'num_correct_answered_questions', '');
82  $this->addColumn($this->lng->txt("tst_num_wrong_answered_questions"),'num_wrong_answered_questions', '');
83  $this->addColumn($this->lng->txt("tst_num_non_answered_questions"),'num_non_answered_questions', '');
84 
86  {
87  $this->addColumn($this->lng->txt("tst_num_postponed_questions"),'num_postponed_questions', '');
88  }
89 
90  if( $this->isShowNumMarkedQuestionsEnabled() )
91  {
92  $this->addColumn($this->lng->txt("tst_num_marked_questions"),'num_marked_questions', '');
93  }
94  }
95 
99  public function initFilter()
100  {
101  if( $this->isTaxonomyFilterEnabled() )
102  {
103  require_once 'Services/Taxonomy/classes/class.ilTaxSelectInputGUI.php';
104 
105  foreach($this->taxIds as $taxId)
106  {
107  $postvar = "tax_$taxId";
108 
109  $inp = new ilTaxSelectInputGUI($taxId, $postvar, true);
110  $this->addFilterItem($inp);
111  $inp->readFromSession();
112  $this->filter[$postvar] = $inp->getValue();
113  }
114  }
115 
116  if( $this->isAnswerStatusFilterEnabled() )
117  {
118  require_once 'Services/Form/classes/class.ilSelectInputGUI.php';
119  require_once 'Services/Form/classes/class.ilRadioOption.php';
120 
121  $inp = new ilSelectInputGUI($this->lng->txt('tst_question_answer_status'), 'question_answer_status');
122  $inp->setOptions(array(
123  ilAssQuestionList::ANSWER_STATUS_FILTER_ALL_NON_CORRECT => $this->lng->txt('tst_question_answer_status_all_non_correct'),
124  ilAssQuestionList::ANSWER_STATUS_FILTER_NON_ANSWERED_ONLY => $this->lng->txt('tst_question_answer_status_non_answered'),
125  ilAssQuestionList::ANSWER_STATUS_FILTER_WRONG_ANSWERED_ONLY => $this->lng->txt('tst_question_answer_status_wrong_answered')
126  ));
127  $this->addFilterItem($inp);
128  $inp->readFromSession();
129  $this->filter['question_answer_status'] = $inp->getValue();
130  }
131  }
132 
140  public function fillRow($data)
141  {
142  $this->tpl->setVariable('NUM_ALL_QUESTIONS', $data['total_all']);
143  $this->tpl->setVariable('NUM_CORRECT_ANSWERED_QUESTIONS', $data['correct_answered']);
144  $this->tpl->setVariable('NUM_WRONG_ANSWERED_QUESTIONS', $data['wrong_answered']);
145  $this->tpl->setVariable('NUM_NON_ANSWERED_QUESTIONS', $data['non_answered']);
146 
148  {
149  $this->tpl->setCurrentBlock('num_postponed');
150  $this->tpl->setVariable("NUM_POSTPONED_QUESTIONS", $data['postponed']);
151  $this->tpl->parseCurrentBlock();
152  }
153 
154  if( $this->isShowNumMarkedQuestionsEnabled() )
155  {
156  $this->tpl->setCurrentBlock('num_marked');
157  $this->tpl->setVariable("NUM_MARKED_QUESTIONS", $data['marked']);
158  $this->tpl->parseCurrentBlock();
159  }
160  }
161 
165  public function setTaxIds($taxIds)
166  {
167  $this->taxIds = $taxIds;
168  }
169 
173  public function getTaxIds()
174  {
175  return $this->taxIds;
176  }
177 
182  {
183  $this->showNumMarkedQuestionsEnabled = $showNumMarkedQuestionsEnabled;
184  }
185 
190  {
192  }
193 
198  {
199  $this->showNumPostponedQuestionsEnabled = $showNumPostponedQuestionsEnabled;
200  }
201 
206  {
208  }
209 
213  public function isAnswerStatusFilterEnabled()
214  {
216  }
217 
222  {
223  $this->answerStatusFilterEnabled = $answerStatusFilterEnabled;
224  }
225 
229  public function isTaxonomyFilterEnabled()
230  {
232  }
233 
238  {
239  $this->taxonomyFilterEnabled = $taxonomyFilterEnabled;
240  }
241 }
242 ?>