ILIAS  Release_4_4_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
 ilTestServiceGUI (ilObjTest $a_object)
 The constructor takes the test object reference as parameter.
 getCommand ($cmd)
 Retrieves the ilCtrl command.
 getPassOverview ($active_id, $targetclass="", $targetcommand="", $short=FALSE, $hide_details=FALSE)
 Returns the pass overview for a given active ID.
 getFinalStatement ($active_id)
 Returns the final statement for a user.
 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.
 getPassListOfAnswersWithScoring (&$result_array, $active_id, $pass, $show_solutions=FALSE)
 Returns the list of answers of a users test pass and offers a scoring option.
 getPassDetailsOverview ($result_array, $active_id, $pass, $targetclass="", $targetcommandsort="", $targetcommanddetails="", $standard_header=TRUE)
 Returns the pass details overview for a given active ID and pass.
 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, $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 ()
 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:
class.ilTestScoringGUI.php 47010 2014-01-03 12:11:50Z mbecker

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

Member Function Documentation

ilTestScoringGUI::applyManScoringParticipantsFilter ( )
private

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

References showManScoringParticipantsTable().

{
require_once 'Modules/Test/classes/tables/class.ilTestManScoringParticipantsTableGUI.php';
$table->resetOffset();
$table->writeFilterToSession();
}

+ Here is the call graph for this function:

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

{
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);
$cust = new ilCustomInputGUI($lng->txt('tst_manscoring_input_best_solution'));
$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'));
return $form;
}

+ Here is the call graph for this function:

+ 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 161 of file class.ilTestScoringGUI.php.

References showManScoringParticipantsTable().

{
require_once 'Modules/Test/classes/tables/class.ilTestManScoringParticipantsTableGUI.php';
$table->resetOffset();
$table->resetFilter();
}

+ Here is the call graph for this function:

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

{
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();
ilUtil::sendSuccess(sprintf($lng->txt('tst_saved_manscoring_successfully'), $pass + 1), true);
$ilCtrl->redirect($this, 'showManScoringParticipantScreen');
}

+ Here is the call graph for this function:

ilTestScoringGUI::sendManScoringParticipantNotification ( )
private

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

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

{
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.

Referenced by applyManScoringParticipantsFilter(), and resetManScoringParticipantsFilter().

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

+ 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: