ILIAS  eassessment Revision 61809
 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 ($a_object)
 ilTestScoringGUI constructor
executeCommand ()
 execute command
 scoringfilter ()
 Selects a participant for manual scoring.
 scoringfilterreset ()
 Resets the manual scoring filter.
 setManScoringDone ()
 Save a user as manual scored.
 manscoring ()
 Shows the test scoring GUI.
 setPointsManual ()
 Sets the points of a question manually.
 setFeedbackManual ()
 selectQuestion ()
 Selects a question for manual scoring.
 scoringParticipants ($q_id=0)
 List of user answers and reached points for the selected question.
 evaluationDetail ()
- Public Member Functions inherited from ilTestServiceGUI
 ilTestServiceGUI ($a_object)
 ilTestScoringGUI constructor
 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, $compare_solutions=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 ($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 ($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.

Additional Inherited Members

- Data Fields inherited from ilTestServiceGUI
 $object
 $lng
 $tpl
 $ctrl
 $ilias
 $tree
 $ref_id

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
Version
$Id$

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

Member Function Documentation

ilTestScoringGUI::evaluationDetail ( )

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

References $_GET, $pass, and ilObjUser\_lookupName().

{
global $ilUser;
$active_id = $_GET["userdetail"];
$pass = $this->object->_getResultPass($active_id);
$question_id = $_GET["answer"];
$question_gui = $this->object->createQuestionGUI("", $question_id);
$user_id = $this->object->_getUserIdFromActiveId($active_id);
$uname = ilObjUser::_lookupName($user_id);
$this->tpl = new ilTemplate("tpl.il_as_tst_correct_solution_output.html", TRUE, TRUE, "Modules/Test");
$result_output = $question_gui->getSolutionOutput($active_id, $pass, TRUE, FALSE, FALSE, $this->object->getShowSolutionFeedback());
$best_output = $question_gui->getSolutionOutput("", NULL, FALSE, FALSE, FALSE);
$this->tpl->setVariable("TEXT_YOUR_SOLUTION", "Antwort von ". $uname["lastname"] . ", " . $uname["firstname"]);
$maxpoints = $question_gui->object->getMaximumPoints();
if ($maxpoints == 1)
{
$this->tpl->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("point") . ")");
}
else
{
$this->tpl->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("points") . ")");
}
$this->tpl->setVariable("SOLUTION_OUTPUT", $result_output);
$your_points = "Der Benutzer hat %s von %s möglichen Punkten erreicht.";
$this->tpl->setVariable("RECEIVED_POINTS", sprintf($your_points, $question_gui->object->getReachedPoints($active_id, $pass), $maxpoints));
$this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
$this->tpl->setVariable("BACKLINK_TEXT", "<< " . $this->lng->txt("back"));
}

+ Here is the call graph for this function:

& ilTestScoringGUI::executeCommand ( )

execute command

Reimplemented from ilTestServiceGUI.

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

References $_POST, $cmd, $ret, and ilTestServiceGUI\getCommand().

{
$cmd = $this->ctrl->getCmd();
$next_class = $this->ctrl->getNextClass($this);
if (strlen($_POST['FORM']))
{
switch ($_POST['FORM'])
{
case 'formQuestionScoring':
$cmd = 'selectQuestion';
break;
}
}
if (strlen($cmd) == 0)
{
$this->ctrl->redirect($this, "manscoring");
}
$cmd = $this->getCommand($cmd);
switch($next_class)
{
default:
$ret =& $this->$cmd();
break;
}
return $ret;
}

+ Here is the call graph for this function:

ilTestScoringGUI::ilTestScoringGUI (   $a_object)

ilTestScoringGUI constructor

The constructor takes the test object reference as parameter

Parameters
object$a_objectAssociated ilObjTest class public

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

References ilTestServiceGUI\ilTestServiceGUI().

{
$this->ctrl->saveParameter($this, "active_id");
$this->ctrl->saveParameter($this, "userfilter");
$this->ctrl->saveParameter($this, "pass");
}

+ Here is the call graph for this function:

ilTestScoringGUI::manscoring ( )

Shows the test scoring GUI.

Parameters
integer$active_idThe acitve ID of the participant to score

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

References $_GET, $_POST, $data, $pass, $type, ilObjAssessmentFolder\_getManualScoring(), assQuestion\_getQuestionInfo(), ilRTE\_getRTEClassname(), ilObject\_lookupObjectId(), ilObject\_lookupType(), ilTestServiceGUI\getPassListOfAnswersWithScoring(), ilTestServiceGUI\getPassOverview(), and ilUtil\sendInfo().

Referenced by scoringfilter(), scoringfilterreset(), scoringParticipants(), selectQuestion(), setManScoringDone(), and setPointsManual().

{
global $ilAccess;
if (!$ilAccess->checkAccess("write", "", $this->ref_id))
{
// allow only write access
ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
$this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
}
$active_id = (strlen($_POST["participants"])) ? $_POST["participants"] : ((strlen($_GET["active_id"])) ? $_GET["active_id"] : 0);
$userfiltervalue = (strlen($_POST["userfilter"])) ? $_POST["userfilter"] : ((strlen($_GET["userfilter"])) ? $_GET["userfilter"] : 0);
if (strcmp($this->ctrl->getCmd(), "scoringfilterreset") == 0)
{
$active_id = 0;
$userfiltervalue = 0;
}
include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
if (count($scoring) == 0)
{
// allow only if question types are marked for manual scoring
ilUtil::sendInfo($this->lng->txt("manscoring_not_allowed"));
return;
}
$pass = $this->object->_getResultPass($active_id);
if (array_key_exists("pass", $_GET))
{
if (strlen($_GET["pass"]))
{
$maxpass = $this->object->_getMaxPass($active_id);
if ($_GET["pass"] <= $maxpass) $pass = $_GET["pass"];
}
}
$participantsfilter = ($userfiltervalue) ? $userfiltervalue : 0;
$participants =& $this->object->getTestParticipantsForManualScoring($participantsfilter);
if (!array_key_exists($active_id, $participants)) $active_id = 0;
$this->ctrl->setParameter($this, "active_id", $active_id);
$this->ctrl->setParameter($this, "userfilter", $userfiltervalue);
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.il_as_tst_manual_scoring.html", "Modules/Test");
if ($active_id > 0)
{
$this->tpl->setCurrentBlock("manscoring_done");
$this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "scoringfilter"));
$this->tpl->setVariable("SAVE", $this->lng->txt("save"));
$this->tpl->setVariable("TEXT_MANSCORING_DONE", $this->lng->txt("set_manscoring_done"));
$assessmentSetting = new ilSetting("assessment");
$manscoring_done = $assessmentSetting->get("manscoring_done_" . $active_id);
if ($manscoring_done)
{
$this->tpl->setVariable("CHECKED_MANSCORING_DONE", ' checked="checked"');
}
$this->tpl->parseCurrentBlock();
}
if (array_key_exists("question", $_POST) || strlen($_GET["anchor"]))
{
if (strlen($_GET["anchor"]))
{
$question_id = $_GET["anchor"];
}
else
{
$keys = array_keys($_POST["question"]);
$question_id = $keys[0];
}
$this->tpl->setCurrentBlock("lastchanged");
$this->tpl->setVariable("LAST_CHANGED", $question_id);
$this->tpl->parseCurrentBlock();
}
$counter = 1;
foreach ($participants as $participant_active_id => $data)
{
$this->tpl->setCurrentBlock("participants");
$this->tpl->setVariable("ID_PARTICIPANT", $data["active_id"]);
$suffix = "";
if ($this->object->getAnonymity())
{
$suffix = " " . $counter++;
}
if ($active_id > 0)
{
if ($active_id == $data["active_id"])
{
$this->tpl->setVariable("SELECTED_PARTICIPANT", " selected=\"selected\"");
}
}
$this->tpl->setVariable("TEXT_PARTICIPANT", $this->object->userLookupFullName($data["usr_id"], FALSE, TRUE, $suffix));
$this->tpl->parseCurrentBlock();
}
$userfilter = array(
"1" => $this->lng->txt("usr_active_only"),
"2" => $this->lng->txt("usr_inactive_only"),
//"3" => $this->lng->txt("all_users"),
"4" => $this->lng->txt("manscoring_done"),
"5" => $this->lng->txt("manscoring_none"),
//"6" => $this->lng->txt("manscoring_pending")
);
foreach ($userfilter as $selection => $filtertext)
{
$this->tpl->setCurrentBlock("userfilter");
$this->tpl->setVariable("VALUE_USERFILTER", $selection);
$this->tpl->setVariable("TEXT_USERFILTER", $filtertext);
if ($userfiltervalue == $selection)
{
$this->tpl->setVariable("SELECTED_USERFILTER", " selected=\"selected\"");
}
$this->tpl->parseCurrentBlock();
}
// ############# select a question for manual scoring ##############
$questions = $this->object->getTestQuestions();
foreach ($questions as $data)
{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$info =& assQuestion::_getQuestionInfo($data['question_id']);
$type = $info["question_type_fi"];
if (in_array($type, $scoring))
{
$this->tpl->setCurrentBlock("questions");
$this->tpl->setVariable("ID_QUESTION", $data['question_id']);
if ($_POST['questions'] > 0)
{
if ($_POST['questions'] == $data['question_id'])
{
$this->tpl->setVariable("SELECTED_QUESTION", " selected=\"selected\"");
}
$this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "selectQuestion"));
}
$this->tpl->setVariable("TEXT_QUESTION", $data['title']);
$this->tpl->parseCurrentBlock();
}
}
$this->tpl->setCurrentBlock("questselect");
$this->tpl->setVariable("FILTER_CLASS_QUESTION", ($_POST['questions'] > 0) ? "filteractive" : "filterinactive");
$this->tpl->setVariable("TEXT_SELECT_QUESTION", $this->lng->txt("manscoring_select_question"));
$this->tpl->setVariable("PLEASE_SELECT_QUESTION", $this->lng->txt('question'));
$this->tpl->setVariable("BUTTON_SELECT_QUESTION", $this->lng->txt("to_filter"));
$this->tpl->parseCurrentBlock();
// ##########
$this->tpl->setVariable("PLEASE_SELECT", $this->lng->txt("participants"));
$this->tpl->setVariable("SELECT_USERFILTER", $this->lng->txt("user_status"));
$this->tpl->setVariable("SELECT_SCOREDFILTER", $this->lng->txt("manscoring"));
$this->tpl->setVariable("BUTTON_SELECT", $this->lng->txt("to_filter"));
$this->tpl->setVariable("BUTTON_RESET", $this->lng->txt("reset"));
$this->tpl->setVariable("FILTER_CLASS", ($active_id) ? "filteractive" : "filterinactive");
$this->tpl->setVariable("FILTER_CLASS_USERFILTER", ($userfiltervalue) ? "filteractive" : "filterinactive");
$this->tpl->setVariable("TEXT_SELECT_USER", $this->lng->txt("manscoring_select_user"));
if ($active_id > 0)
{
// print pass overview
if ($this->object->getNrOfTries() != 1)
{
$overview = $this->getPassOverview($active_id, "iltestscoringgui", "manscoring");
$this->tpl->setVariable("PASS_OVERVIEW", $overview);
}
// print pass details with scoring
if (strlen($pass))
{
$result_array =& $this->object->getTestResult($active_id, $pass);
$scoring = $this->getPassListOfAnswersWithScoring($result_array, $active_id, $pass, TRUE);
$this->tpl->setVariable("SCORING_DATA", $scoring);
}
}
$this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "scoringfilter"));
include_once "./Services/RTE/classes/class.ilRTE.php";
$rtestring = ilRTE::_getRTEClassname();
include_once "./Services/RTE/classes/class.$rtestring.php";
$rte = new $rtestring();
$rte->addPlugin("latex");
$rte->addButton("latex"); $rte->addButton("pastelatex");
include_once "./classes/class.ilObject.php";
$obj_id = ilObject::_lookupObjectId($_GET["ref_id"]);
$obj_type = ilObject::_lookupType($_GET["ref_id"], TRUE);
$rte->addRTESupport($obj_id, "fdb", "assessment");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestScoringGUI::scoringfilter ( )

Selects a participant for manual scoring.

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

References manscoring().

{
$this->manscoring();
}

+ Here is the call graph for this function:

ilTestScoringGUI::scoringfilterreset ( )

Resets the manual scoring filter.

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

References manscoring().

{
$this->manscoring();
}

+ Here is the call graph for this function:

ilTestScoringGUI::scoringParticipants (   $q_id = 0)

List of user answers and reached points for the selected question.

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

References $_POST, $data, $name, $pass, $row, $type, ilObjAssessmentFolder\_getManualScoring(), assQuestion\_getMaximumPoints(), assQuestion\_getQuestionInfo(), assQuestion\_setReachedPoints(), exit, manscoring(), ilUtil\sendInfo(), and ilUtil\sendSuccess().

Referenced by selectQuestion().

{
global $ilAccess, $ilUser;
if ((!$ilAccess->checkAccess("tst_statistics", "", $this->ref_id)) && (!$ilAccess->checkAccess("write", "", $this->ref_id)))
{
// allow only evaluation access
ilUtil::sendInfo($this->lng->txt("cannot_edit_test"), true);
$this->ctrl->redirectByClass("ilobjtestgui", "infoScreen");
}
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
if ($_POST["cmd"]["scoringParticipants"])
{
foreach ($_POST as $key => $value)
{
if (($value > "") && (preg_match("/(\d+)_(\d+)/", $key, $matches)))
{
$pass = $this->object->_getResultPass($matches[1]);
$maxpoints = assQuestion::_getMaximumPoints($matches[2]);
assQuestion::_setReachedPoints($matches[1], $matches[2], $value, $maxpoints, $pass, 1);
}
}
$q_id = $_POST["qid"];
}
$this->manscoring($q_id);
$template = new ilTemplate("tpl.il_as_tst_scoring_question.html", TRUE, TRUE, "Modules/Test");
$data =& $this->object->getCompleteEvaluationData(FALSE);
$foundParticipants =& $data->getParticipants();
if (count($foundParticipants) == 0)
{
$this->tpl->setVariable("EVALUATION_DATA", $this->lng->txt("tst_no_evaluation_data"));
}
$eval_complete = array();
$partcount = 1;
foreach ($data->getParticipants() as $active_id => $userdata)
{
$evalrow = array();
$pass = $this->object->_getResultPass($active_id);
array_push($evalrow, $partcount++. ". ". $userdata->getName());
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
$type = $info["question_type_fi"];
if (in_array($type, $scoring))
{
$question_data = $userdata->getPass($pass)->getAnsweredQuestionByQuestionId($q_id);
$reached = $question_data["reached"];
$name = $active_id."_".$q_id;
$htmloutput = "<input type=\"text\" name=\"".$name."\" size=\"2\" value=\"".$reached."\" />"." ";
// Solution
$htmloutput .= " [<a href=\"".$this->ctrl->getLinkTargetByClass(get_class($this), "evaluationDetail") . "&userdetail=".$active_id."&answer=".$q_id. "\" target=\"popup\" onclick=\"";
$htmloutput .= "window.open('', 'popup', 'width=600, height=300, scrollbars=yes, toolbar=no, status=no, resizable=yes, menubar=no, location=no, directories=no')";
$htmloutput .= "\">". "Antwort"."</a>]";
array_push($evalrow, $htmloutput);
}
array_push($eval_complete, $evalrow);
}
if (count($evalrow) < 2) exit; // es gibt keine Fragen zur manuellen Bewertung
$template->setVariable("HEADING", $this->lng->txt("manscoring_question_eval"));
$counter = 0;
$color_class = array("tblrow1", "tblrow2");
foreach ($eval_complete as $row)
{
foreach ($row as $key => $value)
{
$template->setCurrentBlock("questions_datacol");
$template->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
$template->setVariable("TXT_DATA", $value);
$template->parseCurrentBlock();
}
$template->setCurrentBlock("questions_row");
$template->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
$template->parseCurrentBlock();
$counter++;
}
$template->setVariable("QID", $q_id);
$template->setVariable("BUTTON_SAVE", "Punkte speichern");
$manscoring = $template->get();
$this->tpl->setVariable("SCORING_DATA", "");
$this->tpl->setVariable("QUESTION_MANSCORING", $manscoring);
$this->tpl->parseCurrentBlock();
if ($_POST["cmd"]["scoringParticipants"])
{
ilUtil::sendSuccess($this->lng->txt("manscoring_questions_success"), true);
$this->ctrl->redirect($this, "manscoring");
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestScoringGUI::selectQuestion ( )

Selects a question for manual scoring.

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

References $_GET, $_POST, manscoring(), and scoringParticipants().

{
$_GET["active_id"] = 0;
if (!$_POST["questions"])
{
$this->manscoring();
}
else
{
$this->scoringParticipants($_POST["questions"]);
}
}

+ Here is the call graph for this function:

ilTestScoringGUI::setFeedbackManual ( )

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

References $_GET, $_POST, ilObjAdvancedEditing\_getUsedHTMLTagsAsString(), ilUtil\sendFailure(), ilUtil\sendSuccess(), setPointsManual(), and ilUtil\stripSlashes().

{
if (array_key_exists("feedback", $_POST))
{
$feedbacks = array_keys($_POST["feedback"]);
$question_id = $feedbacks[0];
include_once "./Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php";
$feedback = ilUtil::stripSlashes($_POST["feedback"][$question_id], FALSE, ilObjAdvancedEditing::_getUsedHTMLTagsAsString("assessment"));
$result = $this->object->saveManualFeedback($_GET["active_id"], $question_id, $_GET["pass"], $feedback);
if ($result)
{
ilUtil::sendSuccess($this->lng->txt("tst_set_feedback_done"));
}
else
{
ilUtil::sendFailure($this->lng->txt("tst_set_feedback_not_done"));
}
}
$this->setPointsManual();
}

+ Here is the call graph for this function:

ilTestScoringGUI::setManScoringDone ( )

Save a user as manual scored.

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

References $_GET, $_POST, and manscoring().

{
$manscoring_done = ($_POST["manscoring_done"]) ? 1 : 0;
$assessmentSetting = new ilSetting("assessment");
$assessmentSetting->set("manscoring_done_" . $_GET["active_id"], $manscoring_done);
$this->manscoring();
}

+ Here is the call graph for this function:

ilTestScoringGUI::setPointsManual ( )

Sets the points of a question manually.

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

References $_GET, $_POST, $points, assQuestion\_getMaximumPoints(), ilObjTestAccess\_getParticipantId(), assQuestion\_setReachedPoints(), ilLPStatusWrapper\_updateStatus(), manscoring(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

Referenced by setFeedbackManual().

{
if (array_key_exists("question", $_POST))
{
$keys = array_keys($_POST["question"]);
$question_id = $keys[0];
$points = $_POST["question"][$question_id];
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$maxpoints = assQuestion::_getMaximumPoints($question_id);
$result = assQuestion::_setReachedPoints($_GET["active_id"], $question_id, $points, $maxpoints, $_GET["pass"], 1);
// update learning progress
include_once "./Modules/Test/classes/class.ilObjTestAccess.php";
include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
ilLPStatusWrapper::_updateStatus($this->object->getId(),
if ($result)
{
ilUtil::sendSuccess($this->lng->txt("tst_change_points_done"));
}
else
{
ilUtil::sendFailure($this->lng->txt("tst_change_points_not_done"));
}
}
$this->manscoring();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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