ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups 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
executeCommand ()
 execute command
- Public Member Functions inherited from ilTestServiceGUI
 isContextWithinTestPass ()
 setContextWithinTestPass ($contextWithinTestPass)
 ilTestServiceGUI (ilObjTest $a_object)
 The constructor takes the test object reference as parameter.
 setParticipantData ($participantData)
 getParticipantData ()
 getCommand ($cmd)
 Retrieves the ilCtrl command.
 getPassOverview ($active_id, $targetclass="", $targetcommand="", $short=FALSE, $hide_details=FALSE, $adminMode=false)
 Returns the pass overview for a given active ID.
 getPassListOfAnswers (&$result_array, $active_id, $pass, $show_solutions=FALSE, $only_answered_questions=FALSE, $show_question_only=FALSE, $show_reached_points=FALSE, $anchorNav=false)
 Returns the list of answers of a users test pass.
 getPassListOfAnswersWithScoring (&$result_array, $active_id, $pass, $show_solutions=FALSE)
 Returns the list of answers of a users test pass and offers a scoring option.
 getResultsSignature ()
 Returns HTML code for a signature field.
 getResultsUserdata ($testSession, $active_id, $overwrite_anonymity=FALSE)
 Returns the user data for a test results output.
 getCorrectSolutionOutput ($question_id, $active_id, $pass)
 Returns an output of the solution to an answer compared to the correct solution.
 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.
 getResultsHeadUserAndPass ($active_id, $pass)
 Returns the user and pass data for a test results output.
 getQuestionResultForTestUsers ($question_id, $test_id)
 Creates a HTML representation for the results of a given question in a test.

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 ($redirect=true)
 saveNextManScoringParticipantScreen ()
 saveReturnManScoringParticipantScreen ()
 buildManScoringParticipantForm ($questionGuiList, $activeId, $pass, $initValues=false)
 sendManScoringParticipantNotification ()
 buildManScoringParticipantsTable ($withData=false)

Additional Inherited Members

- Protected Member Functions inherited from ilTestServiceGUI
 isPdfDeliveryRequest ()
 getPassDetailsOverview ($result_array, $active_id, $pass, $targetGUI, $targetCMD, $questionDetailsCMD, $questionAnchorNav)
 buildPassDetailsOverviewTableGUI ($targetGUI, $targetCMD)
 isGradingMessageRequired ()
 getGradingMessage ($activeId)
- Protected Attributes inherited from ilTestServiceGUI
 $db
 $testSessionFactory = null
 $testSequenceFactory = null
 $participantData

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:
class.ilTestScoringGUI.php 57379 2015-01-22 16:38:29Z mjansen

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

Member Function Documentation

ilTestScoringGUI::applyManScoringParticipantsFilter ( )
private

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

References buildManScoringParticipantsTable(), and showManScoringParticipantsTable().

{
$table = $this->buildManScoringParticipantsTable(false);
$table->resetOffset();
$table->writeFilterToSession();
}

+ Here is the call graph for this function:

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

Definition at line 365 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().

{
global $ilCtrl, $lng;
require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
require_once 'Services/Form/classes/class.ilFormSectionHeaderGUI.php';
require_once 'Services/Form/classes/class.ilCustomInputGUI.php';
require_once 'Services/Form/classes/class.ilCheckboxInputGUI.php';
require_once 'Services/Form/classes/class.ilTextInputGUI.php';
require_once 'Services/Form/classes/class.ilTextAreaInputGUI.php';
$ilCtrl->setParameter($this, 'active_id', $activeId);
$ilCtrl->setParameter($this, 'pass', $pass);
$form = new ilPropertyFormGUI();
$form->setFormAction($ilCtrl->getFormAction($this));
$form->setTitle( sprintf($lng->txt('manscoring_results_pass'), $pass + 1) );
$form->setTableWidth('100%');
foreach($questionGuiList as $questionId => $questionGUI)
{
$questionHeader = sprintf($lng->txt('tst_manscoring_question_section_header'), $questionGUI->object->getTitle());
$questionSolution = $questionGUI->getSolutionOutput($activeId, $pass, false, false, true, false, false, true);
$bestSolution = $questionGUI->object->getSuggestedSolutionOutput();
$sect = new ilFormSectionHeaderGUI();
$sect->setTitle( $questionHeader . ' ['. $this->lng->txt('question_id_short') . ': ' . $questionGUI->object->getId() . ']');
$form->addItem($sect);
$cust = new ilCustomInputGUI($lng->txt('tst_manscoring_input_question_and_user_solution'));
$cust->setHtml($questionSolution);
$form->addItem($cust);
$text = new ilTextInputGUI($lng->txt('tst_change_points_for_question'), "question__{$questionId}__points");
if( $initValues ) $text->setValue( assQuestion::_getReachedPoints($activeId, $questionId, $pass) );
$form->addItem($text);
$nonedit = new ilNonEditableValueGUI($lng->txt('tst_manscoring_input_max_points_for_question'), "question__{$questionId}__maxpoints");
if( $initValues ) $nonedit->setValue( assQuestion::_getMaximumPoints($questionId) );
$form->addItem($nonedit);
$area = new ilTextAreaInputGUI($lng->txt('set_manual_feedback'), "question__{$questionId}__feedback");
$area->setUseRTE(true);
if( $initValues ) $area->setValue( $this->object->getManualFeedback($activeId, $questionId, $pass) );
$form->addItem($area);
if(strlen(trim($bestSolution)))
{
$cust = new ilCustomInputGUI($lng->txt('tst_show_solution_suggested'));
$cust->setHtml($bestSolution);
$form->addItem($cust);
}
}
$sect = new ilFormSectionHeaderGUI();
$sect->setTitle($lng->txt('tst_participant'));
$form->addItem($sect);
$check = new ilCheckboxInputGUI($lng->txt('set_manscoring_done'), 'manscoring_done');
if( $initValues && ilTestService::isManScoringDone($activeId) ) $check->setChecked(true);
$form->addItem($check);
$check = new ilCheckboxInputGUI($lng->txt('tst_manscoring_user_notification'), 'manscoring_notify');
$form->addItem($check);
$form->addCommandButton('saveManScoringParticipantScreen', $lng->txt('save'));
$form->addCommandButton('saveReturnManScoringParticipantScreen', $lng->txt('save_return'));
$form->addCommandButton('saveNextManScoringParticipantScreen', $lng->txt('save_and_next'));
return $form;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestScoringGUI::buildManScoringParticipantsTable (   $withData = false)
private
Returns
ilTestManScoringParticipantsTableGUI

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

Referenced by applyManScoringParticipantsFilter(), resetManScoringParticipantsFilter(), saveNextManScoringParticipantScreen(), and showManScoringParticipantsTable().

{
require_once 'Modules/Test/classes/tables/class.ilTestManScoringParticipantsTableGUI.php';
if($withData)
{
$participantStatusFilterValue = $table->getFilterItemByPostVar('participant_status')->getValue();
$table->setData($this->object->getTestParticipantsForManualScoring($participantStatusFilterValue));
}
return $table;
}

+ Here is the caller graph for this function:

& ilTestScoringGUI::executeCommand ( )

execute command

Reimplemented from ilTestServiceGUI.

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

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

{
global $ilAccess;
if( !$ilAccess->checkAccess("write", "", $this->ref_id) )
{
// allow only write access
ilUtil::sendFailure($this->lng->txt("cannot_edit_test"), true);
$this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
}
require_once 'Modules/Test/classes/class.ilObjAssessmentFolder.php';
{
// allow only if at least one question type is marked for manual scoring
ilUtil::sendFailure($this->lng->txt("manscoring_not_allowed"), true);
$this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
}
$cmd = $this->ctrl->getCmd();
$next_class = $this->ctrl->getNextClass($this);
if (strlen($cmd) == 0)
{
$this->ctrl->redirect($this, "manscoring");
}
$cmd = $this->getCommand($cmd);
$this->buildSubTabs();
switch($next_class)
{
default:
$ret =& $this->$cmd();
break;
}
return $ret;
}

+ Here is the call graph for this function:

ilTestScoringGUI::fetchActiveIdParameter ( )
private

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

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

Referenced by saveManScoringParticipantScreen(), and showManScoringParticipantScreen().

{
global $ilCtrl;
// fetch active_id
if( !isset($_GET['active_id']) || !(int)$_GET['active_id'] )
{
// allow only write access
ilUtil::sendFailure('no active id given!', true);
$ilCtrl->redirectByClass("ilobjtestgui", "infoScreen");
}
else
{
$activeId = (int)$_GET['active_id'];
}
return $activeId;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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().

{
// fetch pass nr
$maxPass = $this->object->_getMaxPass($activeId);
if( isset($_GET["pass"]) && 0 <= (int)$_GET["pass"] && $maxPass >= (int)$_GET["pass"] )
{
$pass = $_GET["pass"];
}
elseif( $this->object->getPassScoring() == SCORE_LAST_PASS )
{
$pass = $maxPass;
}
else
{
$pass = $this->object->_getResultPass($activeId);
}
return $pass;
}

+ Here is the caller graph for this function:

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.

References ilTestServiceGUI\ilTestServiceGUI().

{
}

+ Here is the call graph for this function:

ilTestScoringGUI::resetManScoringParticipantsFilter ( )
private

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

References buildManScoringParticipantsTable(), and showManScoringParticipantsTable().

{
$table = $this->buildManScoringParticipantsTable(false);
$table->resetOffset();
$table->resetFilter();
}

+ Here is the call graph for this function:

ilTestScoringGUI::saveManScoringParticipantScreen (   $redirect = true)
private

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

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

Referenced by saveNextManScoringParticipantScreen(), and saveReturnManScoringParticipantScreen().

{
global $tpl, $ilCtrl, $lng;
$activeId = $this->fetchActiveIdParameter();
$pass = $this->fetchPassParameter($activeId);
$questionGuiList = $this->service->getManScoringQuestionGuiList($activeId, $pass);
$form = $this->buildManScoringParticipantForm($questionGuiList, $activeId, $pass, false);
$form->setValuesByPost();
if( !$form->checkInput() )
{
ilUtil::sendFailure(sprintf($lng->txt('tst_save_manscoring_failed'), $pass + 1));
return $this->showManScoringParticipantScreen($form);
}
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$maxPointsByQuestionId = array();
$maxPointsExceeded = false;
foreach($questionGuiList as $questionId => $questionGui)
{
$reachedPoints = $form->getItemByPostVar("question__{$questionId}__points")->getValue();
$maxPoints = assQuestion::_getMaximumPoints($questionId);
if( $reachedPoints > $maxPoints )
{
$maxPointsExceeded = true;
$form->getItemByPostVar("question__{$questionId}__points")->setAlert( sprintf(
$lng->txt('tst_manscoring_maxpoints_exceeded_input_alert'), $maxPoints
));
}
$maxPointsByQuestionId[$questionId] = $maxPoints;
}
if( $maxPointsExceeded )
{
ilUtil::sendFailure(sprintf($lng->txt('tst_save_manscoring_failed'), $pass + 1));
return $this->showManScoringParticipantScreen($form);
}
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
foreach($questionGuiList as $questionId => $questionGui)
{
$reachedPoints = $form->getItemByPostVar("question__{$questionId}__points")->getValue();
$activeId, $questionId, $reachedPoints, $maxPointsByQuestionId[$questionId],
$pass, 1, $this->object->areObligationsEnabled()
);
$feedback = ilUtil::stripSlashes(
$form->getItemByPostVar("question__{$questionId}__feedback")->getValue(),
);
$this->object->saveManualFeedback($activeId, $questionId, $pass, $feedback);
$notificationData[$questionId] = array(
'points' => $reachedPoints, 'feedback' => $feedback
);
}
include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
$this->object->getId(), ilObjTestAccess::_getParticipantId($activeId)
);
$manScoringDone = $form->getItemByPostVar("manscoring_done")->getChecked();
ilTestService::setManScoringDone($activeId, $manScoringDone);
$manScoringNotify = $form->getItemByPostVar("manscoring_notify")->getChecked();
if($manScoringNotify)
{
require_once 'Modules/Test/classes/notifications/class.ilTestManScoringParticipantNotification.php';
$this->object->_getUserIdFromActiveId($activeId), $this->object->getRefId()
);
$notification->setAdditionalInformation(array(
'test_title' => $this->object->getTitle(),
'test_pass' => $pass + 1,
'questions_gui_list' => $questionGuiList,
'questions_scoring_data' => $notificationData
));
$notification->send();
}
require_once './Modules/Test/classes/class.ilTestScoring.php';
$scorer = new ilTestScoring($this->object);
$scorer->setPreserveManualScores(true);
$scorer->recalculateSolutions();
if($this->object->getAnonymity() == 0)
{
$name_real_or_anon = $user_name['firstname'].' '. $user_name['lastname'];
}
else
{
$name_real_or_anon = $lng->txt('anonymous');
}
ilUtil::sendSuccess(sprintf($lng->txt('tst_saved_manscoring_successfully'), $pass + 1, $name_real_or_anon ), true);
if($redirect == true)
{
$ilCtrl->redirect($this, 'showManScoringParticipantScreen');
}
else
{
return;
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestScoringGUI::saveNextManScoringParticipantScreen ( )
private

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

References $_GET, $ilCtrl, ilTestServiceGUI\$participantData, $redirect, buildManScoringParticipantsTable(), and saveManScoringParticipantScreen().

{
global $ilCtrl;
$table = $this->buildManScoringParticipantsTable(true);
$redirect = false;
$participantData = $table->getInternalyOrderedDataValues();
foreach($participantData as $index => $participant)
{
if($participant['active_id'] == $_GET['active_id'])
{
$nextIndex = $index + 1;
break;
}
}
if( isset($participantData[$nextIndex]) )
{
$ilCtrl->setParameter($this, 'active_id', $participantData[$nextIndex]['active_id']);
$ilCtrl->redirect($this, 'showManScoringParticipantScreen');
}
$ilCtrl->redirectByClass("iltestscoringgui", "showManScoringParticipantsTable");
}

+ Here is the call graph for this function:

ilTestScoringGUI::saveReturnManScoringParticipantScreen ( )
private

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

References $ilCtrl, and saveManScoringParticipantScreen().

{
global $ilCtrl;
$ilCtrl->redirectByClass("iltestscoringgui", "showManScoringParticipantsTable");
}

+ Here is the call graph for this function:

ilTestScoringGUI::sendManScoringParticipantNotification ( )
private

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

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

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

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

Referenced by saveManScoringParticipantScreen().

{
global $tpl, $lng;
$activeId = $this->fetchActiveIdParameter();
$pass = $this->fetchPassParameter($activeId);
$contentHTML = '';
// pass overview table
if( $this->object->getNrOfTries() != 1 )
{
require_once 'Modules/Test/classes/tables/class.ilTestPassManualScoringOverviewTableGUI.php';
$table = new ilTestPassManualScoringOverviewTableGUI($this, 'showManScoringParticipantScreen');
$userId = $this->object->_getUserIdFromActiveId($activeId);
$userFullname = $this->object->userLookupFullName($userId, false, true);
$tableTitle = sprintf($lng->txt('tst_pass_overview_for_participant'), $userFullname);
$table->setTitle($tableTitle);
$passOverviewData = $this->service->getPassOverviewData($activeId);
$table->setData($passOverviewData['passes']);
$contentHTML .= $table->getHTML().'<br />';
}
// pass scoring form
if($form === null)
{
$questionGuiList = $this->service->getManScoringQuestionGuiList($activeId, $pass);
$form = $this->buildManScoringParticipantForm($questionGuiList, $activeId, $pass, true);
}
$contentHTML .= $form->getHTML();
// set content
$tpl->setContent($contentHTML);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestScoringGUI::showManScoringParticipantsTable ( )
private

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

References ilTestServiceGUI\$tpl, and buildManScoringParticipantsTable().

Referenced by applyManScoringParticipantsFilter(), and resetManScoringParticipantsFilter().

{
global $tpl;
$table = $this->buildManScoringParticipantsTable(true);
$tpl->setContent( $table->getHTML() );
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

const ilTestScoringGUI::PART_FILTER_ACTIVE_ONLY = 1
const ilTestScoringGUI::PART_FILTER_ALL_USERS = 3
const ilTestScoringGUI::PART_FILTER_INACTIVE_ONLY = 2
const ilTestScoringGUI::PART_FILTER_MANSCORING_DONE = 4
const ilTestScoringGUI::PART_FILTER_MANSCORING_NONE = 5

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