ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/Form/classes/class.ilNumberInputGUI.php';
5require_once 'Services/Table/classes/class.ilTable2GUI.php';
6
14{
15 const PARENT_DEFAULT_CMD = 'showManScoringByQuestionParticipantsTable';
16 const PARENT_APPLY_FILTER_CMD = 'applyManScoringByQuestionFilter';
17 const PARENT_RESET_FILTER_CMD = 'resetManScoringByQuestionFilter';
18 const PARENT_SAVE_SCORING_CMD = 'saveManScoringByQuestion';
19
20 private $manPointsPostData = array();
21
22 private $curQuestionMaxPoints = null;
23
27 protected $first_row_rendered = false;
28
32 protected $first_row = true;
33
34 public function __construct($parentObj)
35 {
36 $this->setFilterCommand(self::PARENT_APPLY_FILTER_CMD);
37 $this->setResetCommand(self::PARENT_RESET_FILTER_CMD);
38 global $DIC;
39
40 $ilCtrl = $DIC->ctrl();
41 $tpl = $DIC->ui()->mainTemplate();
42 $tpl->addJavaScript('./Services/RTE/tiny_mce_3_5_11/tiny_mce.js');
43 $this->setId('man_scor_by_qst_' . $parentObj->object->getId());
44
45 parent::__construct($parentObj, self::PARENT_DEFAULT_CMD);
46
47 $this->setFormAction($ilCtrl->getFormAction($parentObj, self::PARENT_DEFAULT_CMD));
48 $this->setRowTemplate("tpl.il_as_tst_man_scoring_by_question_tblrow.html", "Modules/Test");
49 $this->setShowRowsSelector(true);
50
51 $this->initColumns();
52 $this->initFilter();
53 }
54
55 private function initColumns()
56 {
57 $this->addColumn($this->lng->txt('name'), 'lastname');
58 $this->addColumn($this->lng->txt('tst_reached_points'), 'reached_points');
59 $this->addColumn($this->lng->txt('tst_maximum_points'), 'max_points');
60 $this->addColumn($this->lng->txt('tst_feedback'), 'feedback', '30%');
61 $this->addColumn($this->lng->txt('finalized_evaluation'), 'finalized_evaluation');
62 $this->addColumn($this->lng->txt('finalized_by'), 'finalized_by');
63 $this->addColumn($this->lng->txt('finalized_on'), 'finalized_on');
64 $this->addColumn('', '');
65 }
66
67 public function initFilter()
68 {
69 $this->setDisableFilterHiding(true);
70
71 include_once 'Services/Form/classes/class.ilSelectInputGUI.php';
72 $available_questions = new ilSelectInputGUI($this->lng->txt('question'), 'question');
73 $select_questions = array();
74 if (!$this->getParentObject()->object->isRandomTest()) {
75 $questions = $this->getParentObject()->object->getTestQuestions();
76 } else {
77 $questions = $this->getParentObject()->object->getPotentialRandomTestQuestions();
78 }
80 foreach ($questions as $data) {
81 include_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
82 $info = assQuestion::_getQuestionInfo($data['question_id']);
83 $type = $info["question_type_fi"];
84 if (in_array($type, $scoring)) {
85 $maxpoints = assQuestion::_getMaximumPoints($data["question_id"]);
86 if ($maxpoints == 1) {
87 $maxpoints = ' (' . $maxpoints . ' ' . $this->lng->txt('point') . ')';
88 } else {
89 $maxpoints = ' (' . $maxpoints . ' ' . $this->lng->txt('points') . ')';
90 }
91
92 $select_questions[$data["question_id"]] = $data['title'] . $maxpoints . ' [' . $this->lng->txt('question_id_short') . ': ' . $data["question_id"] . ']';
93 }
94 }
95 if (!$select_questions) {
96 $select_questions[0] = $this->lng->txt('tst_no_scorable_qst_available');
97 }
98 $available_questions->setOptions(array('' => $this->lng->txt('please_choose')) + $select_questions);
99 $this->addFilterItem($available_questions);
100 $available_questions->readFromSession();
101 $this->filter['question'] = $available_questions->getValue();
102
103 $pass = new ilSelectInputGUI($this->lng->txt('pass'), 'pass');
104 $passes = array();
105 $max_pass = $this->getParentObject()->object->getMaxPassOfTest();
106 for ($i = 1; $i <= $max_pass; $i++) {
107 $passes[$i] = $i;
108 }
109 $pass->setOptions($passes);
110 $this->addFilterItem($pass);
111 $pass->readFromSession();
112 $this->filter['pass'] = $pass->getValue();
113 $correction = new ilSelectInputGUI(
114 $this->lng->txt('finalized_evaluation'),
115 'finalize_evaluation'
116 );
117 $evaluated = array(
118 $this->lng->txt('all_users'),
119 $this->lng->txt('evaluated_users'),
120 $this->lng->txt('not_evaluated_users')
121 );
122 $correction->setOptions($evaluated);
123 $this->addFilterItem($correction);
124 $correction->readFromSession();
125 $this->filter['finalize_evaluation'] = $correction->getValue();
126 }
127
131 public function fillRow($row)
132 {
133 global $DIC;
134 $ilCtrl = $DIC->ctrl();
135 $ilAccess = $DIC->access();
136
137 $this->tpl->setVariable('VAL_NAME', $row['participant']->getName());
138 if (
139 $this->getParentObject()->object->anonymity == 1 ||
140 (
141 $this->getParentObject()->object->getAnonymity() == 2 &&
142 false == $ilAccess->checkAccess('write', '', $this->getParentObject()->object->getRefId())
143 )
144 ) {
145 $this->tpl->setVariable('VAL_NAME', $this->lng->txt("anonymous"));
146 }
147
148 if (!$this->first_row_rendered) {
149 $this->first_row_rendered = true;
150 $this->tpl->touchBlock('row_js');
151 }
152
153 $this->tpl->setVariable('VAL_NAME', $row['participant']->getName());
154 $this->tpl->setVariable('VAL_REACHED_POINTS', $row['reached_points']);
155 $this->tpl->setVariable('VAL_MAX_POINTS', $row['maximum_points']);
156 $finalized = (isset($row['feedback']['finalized_evaluation']) && $row['feedback']['finalized_evaluation'] == 1);
157 $this->tpl->setVariable(
158 'VAL_EVALUATED',
159 ($finalized) ? $this->lng->txt('yes') : $this->lng->txt('no')
160 );
161 $fin_usr_id = $row['feedback']['finalized_by_usr_id'];
162
163 $this->tpl->setVariable('VAL_MODAL_CORRECTION', $row['feedback']['feedback']);
164 if ($fin_usr_id > 0) {
165 $this->tpl->setVariable('VAL_FINALIZED_BY', ilObjUser::_lookupFullname($fin_usr_id));
166 }
167 $fin_timestamp = $row['feedback']['finalized_tstamp'];
168 if ($fin_timestamp > 0) {
169 $time = new ilDateTime($fin_timestamp, 3);
170 $this->tpl->setVariable('VAL_FINALIZED_ON', \ilDatePresentation::formatDate($time));
171 }
172
173 $this->tpl->setVariable('VAL_PASS', $row['pass_id']);
174 $this->tpl->setVariable('VAL_ACTIVE_ID', $row['active_id']);
175 $this->tpl->setVariable('VAL_QUESTION_ID', $row['qst_id']);
176
177 if ($this->first_row) {
178 $this->tpl->touchBlock('scoring_by_question_refresher');
179 $this->tpl->parseCurrentBlock();
180 $this->first_row = false;
181 }
182
183 $ilCtrl->setParameter($this->getParentObject(), 'qst_id', $row['qst_id']);
184 $ilCtrl->setParameter($this->getParentObject(), 'active_id', $row['active_id']);
185 $ilCtrl->setParameter($this->getParentObject(), 'pass_id', $row['pass_id']);
186 $this->tpl->setVariable('VAL_LINK_ANSWER', $ilCtrl->getLinkTarget($this->getParentObject(), 'getAnswerDetail', '', true, false));
187 $ilCtrl->setParameter($this->getParentObject(), 'qst_id', '');
188 $ilCtrl->setParameter($this->getParentObject(), 'active_id', '');
189 $ilCtrl->setParameter($this->getParentObject(), 'pass_id', '');
190 $this->tpl->setVariable('VAL_TXT_ANSWER', $this->lng->txt('tst_eval_show_answer'));
191 $this->tpl->setVariable('ANSWER_TITLE', $this->lng->txt('answer_of') . ': ' . $row['participant']->getName());
192 }
193
195 {
196 $this->manPointsPostData = $manPointsPostData;
197 }
198
199 public function getCurQuestionMaxPoints()
200 {
202 }
203
205 {
206 $this->curQuestionMaxPoints = $curQuestionMaxPoints;
207 }
208}
An exception for terminatinating execution or to throw for unit testing.
static _getMaximumPoints($question_id)
Returns the maximum points, a learner can reach answering the question.
static _getQuestionInfo($question_id)
Returns question information from the database.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
@classDescription Date and time handling
static _getManualScoring()
Retrieve the manual scoring settings.
static _lookupFullname($a_user_id)
Lookup Full Name.
This class represents a selection list property in a property form.
Class ilTable2GUI.
setDisableFilterHiding($a_val=true)
Set disable filter hiding.
setShowRowsSelector($a_value)
Toggle rows-per-page selector.
getParentObject()
Get parent object.
setResetCommand($a_val, $a_caption=null)
Set reset filter command.
setRowTemplate($a_template, $a_template_dir="")
Set row template.
addFilterItem($a_input_item, $a_optional=false)
Add filter item.
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.
setId($a_val)
Set id.
setFormAction($a_form_action, $a_multipart=false)
Set Form action parameter.
setFilterCommand($a_val, $a_caption=null)
Set filter command.
global $ilCtrl
Definition: ilias.php:18
$i
Definition: metadata.php:24
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$type
$DIC
Definition: xapitoken.php:46