ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilTestScoringGUI Class Reference

Scoring class for tests. More...

+ Inheritance diagram for ilTestScoringGUI:
+ Collaboration diagram for ilTestScoringGUI:

Public Member Functions

 ilTestScoringGUI (ilObjTest $a_object)
 ilTestScoringGUI constructor More...
 
executeCommand ()
 execute command More...
 
- Public Member Functions inherited from ilTestServiceGUI
 ilTestServiceGUI (ilObjTest $a_object)
 The constructor takes the test object reference as parameter. More...
 
executeCommand ()
 execute command More...
 
 getCommand ($cmd)
 Retrieves the ilCtrl command. More...
 
 getPassOverview ($active_id, $targetclass="", $targetcommand="", $short=FALSE, $hide_details=FALSE)
 Returns the pass overview for a given active ID. More...
 
 getFinalStatement ($active_id)
 Returns the final statement for a user. More...
 
 getPassListOfAnswers (&$result_array, $active_id, $pass, $show_solutions=FALSE, $only_answered_questions=FALSE, $show_question_only=FALSE, $show_reached_points=FALSE)
 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...
 
 getPassDetailsOverview ($result_array, $active_id, $pass, $targetclass="", $targetcommandsort="", $targetcommanddetails="", $standard_header=TRUE)
 Returns the pass details overview for a given active ID and pass. More...
 
 getResultsSignature ()
 Returns HTML code for a signature field. More...
 
 getResultsUserdata ($testSession, $active_id, $overwrite_anonymity=FALSE)
 Returns the user data for a test results output. More...
 
 getCorrectSolutionOutput ($question_id, $active_id, $pass)
 Returns an output of the solution to an answer compared to the correct solution. More...
 
 getResultsOfUserOutput ($testSession, $active_id, $pass, $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...
 

Data Fields

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
 
- Data Fields inherited from ilTestServiceGUI
 $object = null
 
 $service = null
 
 $lng
 
 $tpl
 
 $ctrl
 
 $ilias
 
 $tree
 
 $ref_id
 

Private Member Functions

 fetchActiveIdParameter ()
 
 fetchPassParameter ($activeId)
 
 showManScoringParticipantsTable ()
 
 applyManScoringParticipantsFilter ()
 
 resetManScoringParticipantsFilter ()
 
 showManScoringParticipantScreen (ilPropertyFormGUI $form=null)
 
 saveManScoringParticipantScreen ()
 
 buildManScoringParticipantForm ($questionGuiList, $activeId, $pass, $initValues=false)
 
 sendManScoringParticipantNotification ()
 

Additional Inherited Members

- Protected Attributes inherited from ilTestServiceGUI
 $testSessionFactory = null
 
 $testSequenceFactory = null
 

Detailed Description

Scoring class for tests.

Author
Helmut Schottmüller helmu.nosp@m.t.sc.nosp@m.hottm.nosp@m.uell.nosp@m.er@ma.nosp@m.c.co.nosp@m.m
Björn Heyser bheys.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de
Version
$Id$

Definition at line 17 of file class.ilTestScoringGUI.php.

Member Function Documentation

◆ applyManScoringParticipantsFilter()

ilTestScoringGUI::applyManScoringParticipantsFilter ( )
private

Definition at line 150 of file class.ilTestScoringGUI.php.

References showManScoringParticipantsTable().

151  {
152  require_once 'Modules/Test/classes/tables/class.ilTestManScoringParticipantsTableGUI.php';
153  $table = new ilTestManScoringParticipantsTableGUI($this);
154 
155  $table->resetOffset();
156  $table->writeFilterToSession();
157 
159  }
+ Here is the call graph for this function:

◆ buildManScoringParticipantForm()

ilTestScoringGUI::buildManScoringParticipantForm (   $questionGuiList,
  $activeId,
  $pass,
  $initValues = false 
)
private

Definition at line 319 of file class.ilTestScoringGUI.php.

References $ilCtrl, ilTestServiceGUI\$lng, $pass, assQuestion\_getMaximumPoints(), assQuestion\_getReachedPoints(), ilTestService\isManScoringDone(), ilCheckboxInputGUI\setChecked(), ilCustomInputGUI\setHtml(), ilTextInputGUI\setValue(), ilNonEditableValueGUI\setValue(), and ilTextAreaInputGUI\setValue().

Referenced by saveManScoringParticipantScreen(), and showManScoringParticipantScreen().

320  {
321  global $ilCtrl, $lng;
322 
323  require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
324  require_once 'Services/Form/classes/class.ilFormSectionHeaderGUI.php';
325  require_once 'Services/Form/classes/class.ilCustomInputGUI.php';
326  require_once 'Services/Form/classes/class.ilCheckboxInputGUI.php';
327  require_once 'Services/Form/classes/class.ilTextInputGUI.php';
328  require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php';
329 
330  $ilCtrl->setParameter($this, 'active_id', $activeId);
331  $ilCtrl->setParameter($this, 'pass', $pass);
332 
333  $form = new ilPropertyFormGUI();
334  $form->setFormAction($ilCtrl->getFormAction($this));
335 
336  $form->setTitle( sprintf($lng->txt('manscoring_results_pass'), $pass + 1) );
337  $form->setTableWidth('100%');
338 
339  foreach($questionGuiList as $questionId => $questionGUI)
340  {
341  $questionHeader = sprintf($lng->txt('tst_manscoring_question_section_header'), $questionGUI->object->getTitle());
342  $questionSolution = $questionGUI->getSolutionOutput($activeId, $pass, false, false, true, false, false, true);
343  $bestSolution = $questionGUI->object->getSuggestedSolutionOutput();
344 
345  $sect = new ilFormSectionHeaderGUI();
346  $sect->setTitle( $questionHeader . ' ['. $this->lng->txt('question_id_short') . ': ' . $questionGUI->object->getId() . ']');
347  $form->addItem($sect);
348 
349  $cust = new ilCustomInputGUI($lng->txt('tst_manscoring_input_question_and_user_solution'));
350  $cust->setHtml($questionSolution);
351  $form->addItem($cust);
352 
353  $text = new ilTextInputGUI($lng->txt('tst_change_points_for_question'), "question__{$questionId}__points");
354  if( $initValues ) $text->setValue( assQuestion::_getReachedPoints($activeId, $questionId, $pass) );
355  $form->addItem($text);
356 
357  $nonedit = new ilNonEditableValueGUI($lng->txt('tst_manscoring_input_max_points_for_question'), "question__{$questionId}__maxpoints");
358  if( $initValues ) $nonedit->setValue( assQuestion::_getMaximumPoints($questionId) );
359  $form->addItem($nonedit);
360 
361  $area = new ilTextAreaInputGUI($lng->txt('set_manual_feedback'), "question__{$questionId}__feedback");
362  $area->setUseRTE(true);
363  if( $initValues ) $area->setValue( $this->object->getManualFeedback($activeId, $questionId, $pass) );
364  $form->addItem($area);
365 
366  $cust = new ilCustomInputGUI($lng->txt('tst_manscoring_input_best_solution'));
367  $cust->setHtml($bestSolution);
368  $form->addItem($cust);
369  }
370 
371  $sect = new ilFormSectionHeaderGUI();
372  $sect->setTitle($lng->txt('tst_participant'));
373  $form->addItem($sect);
374 
375  $check = new ilCheckboxInputGUI($lng->txt('set_manscoring_done'), 'manscoring_done');
376  if( $initValues && ilTestService::isManScoringDone($activeId) ) $check->setChecked(true);
377  $form->addItem($check);
378 
379  $check = new ilCheckboxInputGUI($lng->txt('tst_manscoring_user_notification'), 'manscoring_notify');
380  $form->addItem($check);
381 
382  $form->addCommandButton('saveManScoringParticipantScreen', $lng->txt('save'));
383 
384  return $form;
385  }
setHtml($a_html)
Set Html.
This class represents a property form user interface.
This class represents a section header in a property form.
setValue($a_value)
Set Value.
static isManScoringDone($activeId)
reads the flag wether manscoring is done for the given test active or not from the global settings (s...
This class represents a checkbox property in a property form.
global $ilCtrl
Definition: ilias.php:18
setChecked($a_checked)
Set Checked.
This class represents a text property in a property form.
_getMaximumPoints($question_id)
Returns the maximum points, a learner can reach answering the question.
This class represents a custom property in a property form.
_getReachedPoints($active_id, $question_id, $pass=NULL)
Returns the points, a learner has reached answering the question.
This class represents a non editable value in a property form.
This class represents a text area property in a property form.
setValue($a_value)
Set Value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

& ilTestScoringGUI::executeCommand ( )

execute command

Definition at line 97 of file class.ilTestScoringGUI.php.

References $cmd, $ret, ilObjAssessmentFolder\_mananuallyScoreableQuestionTypesExists(), ilTestServiceGUI\getCommand(), and ilUtil\sendFailure().

Referenced by ilTestScoringByQuestionsGUI\__construct().

98  {
99  global $ilAccess;
100 
101  if( !$ilAccess->checkAccess("write", "", $this->ref_id) )
102  {
103  // allow only write access
104  ilUtil::sendFailure($this->lng->txt("cannot_edit_test"), true);
105  $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
106  }
107 
108  require_once 'Modules/Test/classes/class.ilObjAssessmentFolder.php';
110  {
111  // allow only if at least one question type is marked for manual scoring
112  ilUtil::sendFailure($this->lng->txt("manscoring_not_allowed"), true);
113  $this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
114  }
115 
116  $cmd = $this->ctrl->getCmd();
117  $next_class = $this->ctrl->getNextClass($this);
118 
119  if (strlen($cmd) == 0)
120  {
121  $this->ctrl->redirect($this, "manscoring");
122  }
123 
124  $cmd = $this->getCommand($cmd);
125  $this->buildSubTabs();
126  switch($next_class)
127  {
128  default:
129  $ret =& $this->$cmd();
130  break;
131  }
132 
133  return $ret;
134  }
$cmd
Definition: sahs_server.php:35
getCommand($cmd)
Retrieves the ilCtrl command.
static _mananuallyScoreableQuestionTypesExists()
Returns the fact wether manually scoreable question types exist or not.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fetchActiveIdParameter()

ilTestScoringGUI::fetchActiveIdParameter ( )
private

Definition at line 53 of file class.ilTestScoringGUI.php.

References $_GET, $ilCtrl, and ilUtil\sendFailure().

Referenced by saveManScoringParticipantScreen(), and showManScoringParticipantScreen().

54  {
55  global $ilCtrl;
56 
57  // fetch active_id
58 
59  if( !isset($_GET['active_id']) || !(int)$_GET['active_id'] )
60  {
61  // allow only write access
62  ilUtil::sendFailure('no active id given!', true);
63  $ilCtrl->redirectByClass("ilobjtestgui", "infoScreen");
64  }
65  else
66  {
67  $activeId = (int)$_GET['active_id'];
68  }
69 
70  return $activeId;
71  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fetchPassParameter()

ilTestScoringGUI::fetchPassParameter (   $activeId)
private

Definition at line 73 of file class.ilTestScoringGUI.php.

References $_GET, $pass, and SCORE_LAST_PASS.

Referenced by saveManScoringParticipantScreen(), and showManScoringParticipantScreen().

74  {
75  // fetch pass nr
76 
77  $maxPass = $this->object->_getMaxPass($activeId);
78  if( isset($_GET["pass"]) && 0 <= (int)$_GET["pass"] && $maxPass >= (int)$_GET["pass"] )
79  {
80  $pass = $_GET["pass"];
81  }
82  elseif( $this->object->getPassScoring() == SCORE_LAST_PASS )
83  {
84  $pass = $maxPass;
85  }
86  else
87  {
88  $pass = $this->object->_getResultPass($activeId);
89  }
90 
91  return $pass;
92  }
const SCORE_LAST_PASS
$_GET["client_id"]
+ Here is the caller graph for this function:

◆ ilTestScoringGUI()

ilTestScoringGUI::ilTestScoringGUI ( ilObjTest  $a_object)

ilTestScoringGUI constructor

The constructor takes the test object reference as parameter

Parameters
object$a_objectAssociated ilObjTest class public

Definition at line 34 of file class.ilTestScoringGUI.php.

35  {
36  parent::ilTestServiceGUI($a_object);
37  }

◆ resetManScoringParticipantsFilter()

ilTestScoringGUI::resetManScoringParticipantsFilter ( )
private

Definition at line 161 of file class.ilTestScoringGUI.php.

References showManScoringParticipantsTable().

162  {
163  require_once 'Modules/Test/classes/tables/class.ilTestManScoringParticipantsTableGUI.php';
164  $table = new ilTestManScoringParticipantsTableGUI($this);
165 
166  $table->resetOffset();
167  $table->resetFilter();
168 
170  }
+ Here is the call graph for this function:

◆ saveManScoringParticipantScreen()

ilTestScoringGUI::saveManScoringParticipantScreen ( )
private

Definition at line 214 of file class.ilTestScoringGUI.php.

References $ilCtrl, ilTestServiceGUI\$lng, $pass, ilTestServiceGUI\$tpl, assQuestion\_getMaximumPoints(), ilObjTestAccess\_getParticipantId(), ilObjAdvancedEditing\_getUsedHTMLTagsAsString(), assQuestion\_setReachedPoints(), ilLPStatusWrapper\_updateStatus(), buildManScoringParticipantForm(), fetchActiveIdParameter(), fetchPassParameter(), ilUtil\sendFailure(), ilUtil\sendSuccess(), ilMailNotification\setAdditionalInformation(), ilTestService\setManScoringDone(), showManScoringParticipantScreen(), and ilUtil\stripSlashes().

215  {
216  global $tpl, $ilCtrl, $lng;
217 
218  $activeId = $this->fetchActiveIdParameter();
219  $pass = $this->fetchPassParameter($activeId);
220 
221  $questionGuiList = $this->service->getManScoringQuestionGuiList($activeId, $pass);
222  $form = $this->buildManScoringParticipantForm($questionGuiList, $activeId, $pass, false);
223 
224  $form->setValuesByPost();
225 
226  if( !$form->checkInput() )
227  {
228  ilUtil::sendFailure(sprintf($lng->txt('tst_save_manscoring_failed'), $pass + 1));
229  return $this->showManScoringParticipantScreen($form);
230  }
231 
232  include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
233 
234  $maxPointsByQuestionId = array();
235  $maxPointsExceeded = false;
236  foreach($questionGuiList as $questionId => $questionGui)
237  {
238  $reachedPoints = $form->getItemByPostVar("question__{$questionId}__points")->getValue();
239  $maxPoints = assQuestion::_getMaximumPoints($questionId);
240 
241  if( $reachedPoints > $maxPoints )
242  {
243  $maxPointsExceeded = true;
244 
245  $form->getItemByPostVar("question__{$questionId}__points")->setAlert( sprintf(
246  $lng->txt('tst_manscoring_maxpoints_exceeded_input_alert'), $maxPoints
247  ));
248  }
249 
250  $maxPointsByQuestionId[$questionId] = $maxPoints;
251  }
252 
253  if( $maxPointsExceeded )
254  {
255  ilUtil::sendFailure(sprintf($lng->txt('tst_save_manscoring_failed'), $pass + 1));
256  return $this->showManScoringParticipantScreen($form);
257  }
258 
259  include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
260 
261  foreach($questionGuiList as $questionId => $questionGui)
262  {
263  $reachedPoints = $form->getItemByPostVar("question__{$questionId}__points")->getValue();
264 
266  $activeId, $questionId, $reachedPoints, $maxPointsByQuestionId[$questionId],
267  $pass, 1, $this->object->areObligationsEnabled()
268  );
269 
270  $feedback = ilUtil::stripSlashes(
271  $form->getItemByPostVar("question__{$questionId}__feedback")->getValue(),
273  );
274 
275  $this->object->saveManualFeedback($activeId, $questionId, $pass, $feedback);
276 
277  $notificationData[$questionId] = array(
278  'points' => $reachedPoints, 'feedback' => $feedback
279  );
280  }
281 
282  include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
283  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
285  $this->object->getId(), ilObjTestAccess::_getParticipantId($activeId)
286  );
287 
288  $manScoringDone = $form->getItemByPostVar("manscoring_done")->getChecked();
289  ilTestService::setManScoringDone($activeId, $manScoringDone);
290 
291  $manScoringNotify = $form->getItemByPostVar("manscoring_notify")->getChecked();
292  if($manScoringNotify)
293  {
294  require_once 'Modules/Test/classes/notifications/class.ilTestManScoringParticipantNotification.php';
295 
296  $notification = new ilTestManScoringParticipantNotification(
297  $this->object->_getUserIdFromActiveId($activeId), $this->object->getRefId()
298  );
299 
300  $notification->setAdditionalInformation(array(
301  'test_title' => $this->object->getTitle(),
302  'test_pass' => $pass + 1,
303  'questions_gui_list' => $questionGuiList,
304  'questions_scoring_data' => $notificationData
305  ));
306 
307  $notification->send();
308  }
309 
310  require_once './Modules/Test/classes/class.ilTestScoring.php';
311  $scorer = new ilTestScoring($this->object);
312  $scorer->setPreserveManualScores(true);
313  $scorer->recalculateSolutions();
314 
315  ilUtil::sendSuccess(sprintf($lng->txt('tst_saved_manscoring_successfully'), $pass + 1), true);
316  $ilCtrl->redirect($this, 'showManScoringParticipantScreen');
317  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
showManScoringParticipantScreen(ilPropertyFormGUI $form=null)
static setManScoringDone($activeId, $manScoringDone)
stores the flag wether manscoring is done for the given test active or not within the global settings...
static _updateStatus($a_obj_id, $a_usr_id, $a_obj=null, $a_percentage=false, $a_no_raise=false, $a_force_raise=false)
Update status.
& _getUsedHTMLTagsAsString($a_module="")
Returns a string of all allowed HTML tags for text editing.
global $ilCtrl
Definition: ilias.php:18
buildManScoringParticipantForm($questionGuiList, $activeId, $pass, $initValues=false)
_getParticipantId($active_id)
Get user id for active id.
_getMaximumPoints($question_id)
Returns the maximum points, a learner can reach answering the question.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Class ilTestScoring.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
_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...
setAdditionalInformation($a_info)
Additional information for creating notification mails.
+ Here is the call graph for this function:

◆ sendManScoringParticipantNotification()

ilTestScoringGUI::sendManScoringParticipantNotification ( )
private

Definition at line 387 of file class.ilTestScoringGUI.php.

388  {
389  }

◆ showManScoringParticipantScreen()

ilTestScoringGUI::showManScoringParticipantScreen ( ilPropertyFormGUI  $form = null)
private

Definition at line 172 of file class.ilTestScoringGUI.php.

References ilTestServiceGUI\$lng, $pass, ilTestServiceGUI\$tpl, buildManScoringParticipantForm(), fetchActiveIdParameter(), and fetchPassParameter().

Referenced by saveManScoringParticipantScreen().

173  {
174  global $tpl, $lng;
175 
176  $activeId = $this->fetchActiveIdParameter();
177  $pass = $this->fetchPassParameter($activeId);
178 
179  $contentHTML = '';
180 
181  // pass overview table
182 
183  if( $this->object->getNrOfTries() != 1 )
184  {
185  require_once 'Modules/Test/classes/tables/class.ilTestPassManualScoringOverviewTableGUI.php';
186  $table = new ilTestPassManualScoringOverviewTableGUI($this, 'showManScoringParticipantScreen');
187 
188  $userId = $this->object->_getUserIdFromActiveId($activeId);
189  $userFullname = $this->object->userLookupFullName($userId, false, true);
190  $tableTitle = sprintf($lng->txt('tst_pass_overview_for_participant'), $userFullname);
191  $table->setTitle($tableTitle);
192 
193  $passOverviewData = $this->service->getPassOverviewData($activeId);
194  $table->setData($passOverviewData['passes']);
195 
196  $contentHTML .= $table->getHTML().'<br />';
197  }
198 
199  // pass scoring form
200 
201  if($form === null)
202  {
203  $questionGuiList = $this->service->getManScoringQuestionGuiList($activeId, $pass);
204  $form = $this->buildManScoringParticipantForm($questionGuiList, $activeId, $pass, true);
205  }
206 
207  $contentHTML .= $form->getHTML();
208 
209  // set content
210 
211  $tpl->setContent($contentHTML);
212  }
buildManScoringParticipantForm($questionGuiList, $activeId, $pass, $initValues=false)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showManScoringParticipantsTable()

ilTestScoringGUI::showManScoringParticipantsTable ( )
private

Definition at line 136 of file class.ilTestScoringGUI.php.

References ilTestServiceGUI\$tpl.

Referenced by applyManScoringParticipantsFilter(), and resetManScoringParticipantsFilter().

137  {
138  global $tpl;
139 
140  require_once 'Modules/Test/classes/tables/class.ilTestManScoringParticipantsTableGUI.php';
141  $table = new ilTestManScoringParticipantsTableGUI($this);
142 
143  $participantStatusFilterValue = $table->getFilterItemByPostVar('participant_status')->getValue();
144 
145  $table->setData( $this->object->getTestParticipantsForManualScoring($participantStatusFilterValue) );
146 
147  $tpl->setContent( $table->getHTML() );
148  }
+ Here is the caller graph for this function:

Field Documentation

◆ PART_FILTER_ACTIVE_ONLY

const ilTestScoringGUI::PART_FILTER_ACTIVE_ONLY = 1

◆ PART_FILTER_ALL_USERS

const ilTestScoringGUI::PART_FILTER_ALL_USERS = 3

◆ PART_FILTER_INACTIVE_ONLY

const ilTestScoringGUI::PART_FILTER_INACTIVE_ONLY = 2

◆ PART_FILTER_MANSCORING_DONE

const ilTestScoringGUI::PART_FILTER_MANSCORING_DONE = 4

◆ PART_FILTER_MANSCORING_NONE

const ilTestScoringGUI::PART_FILTER_MANSCORING_NONE = 5

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