ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTestScoringByQuestionsGUI Class Reference

ilTestScoringByQuestionsGUI More...

+ Inheritance diagram for ilTestScoringByQuestionsGUI:
+ Collaboration diagram for ilTestScoringByQuestionsGUI:

Public Member Functions

 __construct (ilObjTest $a_object)
 
- Public Member Functions inherited from ilTestServiceGUI
 isContextResultPresentation ()
 
 setContextResultPresentation ($contextResultPresentation)
 
 __construct (ilObjTest $a_object)
 The constructor takes the test object reference as parameter. More...
 
 setParticipantData ($participantData)
 
 getParticipantData ()
 
 getPassOverviewTableData (ilTestSession $testSession, $passes, $withResults)
 
 setObjectiveOrientedContainer (ilTestObjectiveOrientedContainer $objectiveOrientedContainer)
 
 getObjectiveOrientedContainer ()
 
 executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 Retrieves the ilCtrl command. More...
 
 buildPassOverviewTableGUI ($targetGUI)
 
 getPassListOfAnswers (&$result_array, $active_id, $pass, $show_solutions=false, $only_answered_questions=false, $show_question_only=false, $show_reached_points=false, $anchorNav=false, ilTestQuestionRelatedObjectivesList $objectivesList=null, ilTestResultHeaderLabelBuilder $testResultHeaderLabelBuilder=null)
 Returns the list of answers of a users test pass. More...
 
 getPassListOfAnswersWithScoring (&$result_array, $active_id, $pass, $show_solutions=false)
 Returns the list of answers of a users test pass and offers a scoring option. More...
 
 getResultsSignature ()
 Returns HTML code for a signature field. More...
 
 getAdditionalUsrDataHtmlAndPopulateWindowTitle ($testSession, $active_id, $overwrite_anonymity=false)
 Returns the user data for a test results output. More...
 
 getCorrectSolutionOutput ($question_id, $active_id, $pass, ilTestQuestionRelatedObjectivesList $objectivesList=null)
 Returns an output of the solution to an answer compared to the correct solution. More...
 
 getResultsOfUserOutput ($testSession, $active_id, $pass, $targetGUI, $show_pass_details=true, $show_answers=true, $show_question_only=false, $show_reached_points=false)
 Output of the pass overview for a test called by a test participant. More...
 
 getResultsHeadUserAndPass ($active_id, $pass)
 Returns the user and pass data for a test results output. More...
 
 getQuestionResultForTestUsers ($question_id, $test_id)
 Creates a HTML representation for the results of a given question in a test. More...
 
 populatePassFinishDate ($tpl, $passFinishDate)
 
 populateExamId (ilTemplate $tpl, int $activeId, int $pass)
 
- Public Member Functions inherited from ilTestScoringGUI
 __construct (ilObjTest $a_object)
 ilTestScoringGUI constructor More...
 
 getTestAccess ()
 
 setTestAccess ($testAccess)
 
 executeCommand ()
 execute command More...
 

Protected Member Functions

 getDefaultCommand ()
 
 getActiveSubTabId ()
 
 saveManScoringByQuestion ()
 
 applyManScoringByQuestionFilter ()
 
 resetManScoringByQuestionFilter ()
 
 getAnswerDetail ()
 
- Protected Member Functions inherited from ilTestServiceGUI
 isPdfDeliveryRequest ()
 
 getPassDetailsOverviewTableGUI ($result_array, $active_id, $pass, $targetGUI, $targetCMD, $questionDetailsCMD, $questionAnchorNav, ilTestQuestionRelatedObjectivesList $objectivesList=null, $multipleObjectivesInvolved=true)
 
 buildPassDetailsOverviewTableGUI ($targetGUI, $targetCMD)
 
 isGradingMessageRequired ()
 
 getGradingMessageBuilder ($activeId)
 
 buildQuestionRelatedObjectivesList (ilLOTestQuestionAdapter $objectivesAdapter, ilTestQuestionSequence $testSequence)
 
 getFilteredTestResult ($active_id, $pass, $considerHiddenQuestions, $considerOptionalQuestions)
 
 populateContent ($content)
 
 buildUserTestResultsToolbarGUI ()
 
 outCorrectSolutionCmd ()
 
 outCorrectSolution ()
 Creates an output of the solution of an answer compared to the correct solution. More...
 
- Protected Member Functions inherited from ilTestScoringGUI
 getDefaultCommand ()
 
 getActiveSubTabId ()
 

Additional Inherited Members

- Data Fields inherited from ilTestServiceGUI
 $object = null
 
 $service = null
 
 $lng
 
 $tpl
 
 $ctrl
 
 $ilias
 
 $tree
 
 $ref_id
 
- Data Fields inherited from ilTestScoringGUI
const PART_FILTER_ACTIVE_ONLY = 1
 
const PART_FILTER_INACTIVE_ONLY = 2
 
const PART_FILTER_ALL_USERS = 3
 
const PART_FILTER_MANSCORING_DONE = 4
 
const PART_FILTER_MANSCORING_NONE = 5
 
- Protected Attributes inherited from ilTestServiceGUI
 $db
 
 $tabs
 
 $objCache
 
 $testSessionFactory = null
 
 $testSequenceFactory = null
 
 $participantData
 
- Protected Attributes inherited from ilTestScoringGUI
 $testAccess
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTestScoringByQuestionsGUI::__construct ( ilObjTest  $a_object)
Parameters
ilObjTest$a_object

Definition at line 20 of file class.ilTestScoringByQuestionsGUI.php.

21  {
22  parent::__construct($a_object);
23  }

Member Function Documentation

◆ applyManScoringByQuestionFilter()

ilTestScoringByQuestionsGUI::applyManScoringByQuestionFilter ( )
protected

Definition at line 283 of file class.ilTestScoringByQuestionsGUI.php.

References $table.

284  {
285  require_once 'Modules/Test/classes/tables/class.ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI.php';
287  $table->resetOffset();
288  $table->writeFilterToSession();
289  $this->showManScoringByQuestionParticipantsTable();
290  }
if(empty($password)) $table
Definition: pwgen.php:24

◆ getActiveSubTabId()

◆ getAnswerDetail()

ilTestScoringByQuestionsGUI::getAnswerDetail ( )
protected

Definition at line 304 of file class.ilTestScoringByQuestionsGUI.php.

References $_GET, $data, $pass, exit, and ilTestScoringGUI\getTestAccess().

305  {
306  $active_id = (int) $_GET['active_id'];
307  $pass = (int) $_GET['pass_id'];
308  $question_id = (int) $_GET['qst_id'];
309 
310  if (!$this->getTestAccess()->checkScoreParticipantsAccessForActiveId($active_id)) {
311  exit; // illegal ajax call
312  }
313 
314  $data = $this->object->getCompleteEvaluationData(false);
315  $participant = $data->getParticipant($active_id);
316 
317  $question_gui = $this->object->createQuestionGUI('', $question_id);
318 
319  $tmp_tpl = new ilTemplate('tpl.il_as_tst_correct_solution_output.html', true, true, 'Modules/Test');
320  if ($question_gui->supportsIntermediateSolutionOutput() && $question_gui->hasIntermediateSolution($active_id, $pass)) {
321  $question_gui->setUseIntermediateSolution(true);
322  $aresult_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, true, false, false, true);
323  $question_gui->setUseIntermediateSolution(false);
324  $tmp_tpl->setVariable('TEXT_ASOLUTION_OUTPUT', $this->lng->txt('autosavecontent'));
325  $tmp_tpl->setVariable('ASOLUTION_OUTPUT', $aresult_output);
326  }
327 
328  $result_output = $question_gui->getSolutionOutput($active_id, $pass, false, false, false, $this->object->getShowSolutionFeedback(), false, true);
329  $tmp_tpl->setVariable('TEXT_YOUR_SOLUTION', $this->lng->txt('answers_of') . ' ' . $participant->getName());
330 
331 
332 
333  $maxpoints = $question_gui->object->getMaximumPoints();
334 
335  $add_title = ' [' . $this->lng->txt('question_id_short') . ': ' . $question_id . ']';
336 
337  if ($maxpoints == 1) {
338  $tmp_tpl->setVariable('QUESTION_TITLE', $this->object->getQuestionTitle($question_gui->object->getTitle()) . ' (' . $maxpoints . ' ' . $this->lng->txt('point') . ')' . $add_title);
339  } else {
340  $tmp_tpl->setVariable('QUESTION_TITLE', $this->object->getQuestionTitle($question_gui->object->getTitle()) . ' (' . $maxpoints . ' ' . $this->lng->txt('points') . ')' . $add_title);
341  }
342  $tmp_tpl->setVariable('SOLUTION_OUTPUT', $result_output);
343  $tmp_tpl->setVariable('RECEIVED_POINTS', sprintf($this->lng->txt('part_received_a_of_b_points'), $question_gui->object->getReachedPoints($active_id, $pass), $maxpoints));
344 
345  echo $tmp_tpl->get();
346  exit();
347  }
$_GET["client_id"]
special template class to simplify handling of ITX/PEAR
exit
Definition: backend.php:16
$data
Definition: bench.php:6
+ Here is the call graph for this function:

◆ getDefaultCommand()

ilTestScoringByQuestionsGUI::getDefaultCommand ( )
protected
Returns
string

Definition at line 28 of file class.ilTestScoringByQuestionsGUI.php.

29  {
30  return 'showManScoringByQuestionParticipantsTable';
31  }

◆ resetManScoringByQuestionFilter()

ilTestScoringByQuestionsGUI::resetManScoringByQuestionFilter ( )
protected

Definition at line 295 of file class.ilTestScoringByQuestionsGUI.php.

References $table.

296  {
297  require_once 'Modules/Test/classes/tables/class.ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI.php';
299  $table->resetOffset();
300  $table->resetFilter();
301  $this->showManScoringByQuestionParticipantsTable();
302  }
if(empty($password)) $table
Definition: pwgen.php:24

◆ saveManScoringByQuestion()

ilTestScoringByQuestionsGUI::saveManScoringByQuestion ( )
protected

Definition at line 151 of file class.ilTestScoringByQuestionsGUI.php.

References $_POST, $DIC, ilTestServiceGUI\$participantData, $pass, assQuestion\_getMaximumPoints(), ilObjTestAccess\_getParticipantId(), assQuestion\_instantiateQuestion(), assQuestion\_setReachedPoints(), ilLPStatusWrapper\_updateStatus(), ilTestParticipantAccessFilter\getScoreParticipantsUserFilter(), and ilUtil\sendFailure().

152  {
153  global $DIC; /* @var ILIAS\DI\Container $DIC */
154 
155  if (!isset($_POST['scoring']) || !is_array($_POST['scoring'])) {
156  ilUtil::sendFailure($this->lng->txt('tst_save_manscoring_failed_unknown'));
157  $this->showManScoringByQuestionParticipantsTable();
158  return;
159  }
160 
161  $pass = key($_POST['scoring']);
162  $activeData = current($_POST['scoring']);
163 
164  require_once 'Modules/Test/classes/class.ilTestParticipantData.php';
165  $participantData = new ilTestParticipantData($DIC->database(), $DIC->language());
166  $participantData->setActiveIdsFilter(array_keys($activeData));
167 
168  $participantData->setParticipantAccessFilter(
170  );
171 
172  $participantData->load($this->object->getTestId());
173 
174  include_once 'Modules/TestQuestionPool/classes/class.assQuestion.php';
175  include_once 'Modules/Test/classes/class.ilObjTestAccess.php';
176  include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
177 
178  $oneExceededMaxPoints = false;
179  $manPointsPost = array();
180  $skipParticipant = array();
181  $maxPointsByQuestionId = array();
182  foreach ($participantData->getActiveIds() as $active_id) {
183  $questions = $activeData[$active_id];
184 
185  // check for existing test result data
186  if (!$this->object->getTestResult($active_id, $pass)) {
187  if (!isset($skipParticipant[$pass])) {
188  $skipParticipant[$pass] = array();
189  }
190 
191  $skipParticipant[$pass][$active_id] = true;
192 
193  continue;
194  }
195 
196  foreach ((array) $questions as $qst_id => $reached_points) {
197  if (!isset($manPointsPost[$pass])) {
198  $manPointsPost[$pass] = array();
199  }
200 
201  if (!isset($manPointsPost[$pass][$active_id])) {
202  $manPointsPost[$pass][$active_id] = array();
203  }
204 
205  $maxPointsByQuestionId[$qst_id] = assQuestion::_getMaximumPoints($qst_id);
206 
207  if ($reached_points > $maxPointsByQuestionId[$qst_id]) {
208  $oneExceededMaxPoints = true;
209  }
210 
211  $manPointsPost[$pass][$active_id][$qst_id] = $reached_points;
212  }
213  }
214 
215  if ($oneExceededMaxPoints) {
216  ilUtil::sendFailure(sprintf($this->lng->txt('tst_save_manscoring_failed'), $pass + 1));
217  $this->showManScoringByQuestionParticipantsTable($manPointsPost);
218  return;
219  }
220 
221  $changed_one = false;
222  $lastAndHopefullyCurrentQuestionId = null;
223  foreach ($participantData->getActiveIds() as $active_id) {
224  $questions = $activeData[$active_id];
225 
226  $update_participant = false;
227 
228  if ($skipParticipant[$pass][$active_id]) {
229  continue;
230  }
231 
232  foreach ((array) $questions as $qst_id => $reached_points) {
233  $update_participant = assQuestion::_setReachedPoints(
234  $active_id,
235  $qst_id,
236  $reached_points,
237  $maxPointsByQuestionId[$qst_id],
238  $pass,
239  1,
240  $this->object->areObligationsEnabled()
241  );
242  }
243 
244  if ($update_participant) {
245  $changed_one = true;
246 
247  $lastAndHopefullyCurrentQuestionId = $qst_id;
248 
250  $this->object->getId(),
252  );
253  }
254  }
255 
256  if ($changed_one) {
257  $qTitle = '';
258  if ($lastAndHopefullyCurrentQuestionId) {
259  $question = assQuestion::_instantiateQuestion($lastAndHopefullyCurrentQuestionId);
260  $qTitle = $question->getTitle();
261  }
262  $msg = sprintf(
263  $this->lng->txt('tst_saved_manscoring_by_question_successfully'),
264  $qTitle,
265  $pass + 1
266  );
267  ilUtil::sendSuccess($msg, true);
268 
269  /* disabled for Mantis 25850
270  require_once './Modules/Test/classes/class.ilTestScoring.php';
271  $scorer = new ilTestScoring($this->object);
272  $scorer->setPreserveManualScores(true);
273  $scorer->recalculateSolutions();
274  */
275  }
276 
277  $this->showManScoringByQuestionParticipantsTable();
278  }
static _getParticipantId($active_id)
Get user id for active id.
global $DIC
Definition: saml.php:7
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_force_raise=false)
Update status.
static _getMaximumPoints($question_id)
Returns the maximum points, a learner can reach answering the question.
static _instantiateQuestion($question_id)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
static _setReachedPoints($active_id, $question_id, $points, $maxpoints, $pass, $manualscoring, $obligationsEnabled)
Sets the points, a learner has reached answering the question Additionally objective results are upda...
+ Here is the call graph for this function:

The documentation for this class was generated from the following file: