ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTestServiceGUI Class Reference

Service GUI class for tests. More...

+ Inheritance diagram for ilTestServiceGUI:
+ Collaboration diagram for ilTestServiceGUI:

Public Member Functions

 ilTestServiceGUI ($a_object)
 ilTestScoringGUI constructor
executeCommand ()
 execute command
 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 ($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.

Data Fields

 $object
 $lng
 $tpl
 $ctrl
 $ilias
 $tree
 $ref_id

Detailed Description

Service GUI class for tests.

This class is the parent class for all service classes which are called from ilObjTestGUI. This is mainly done to reduce the size of ilObjTestGUI to put command service functions into classes that could be called by ilCtrl.

ilTestServiceGUI: ilObjTestGUI

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:
class.ilTestServiceGUI.php 43866 2013-08-02 08:30:01Z bheyser

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

Member Function Documentation

& ilTestServiceGUI::executeCommand ( )

execute command

Reimplemented in ilTestOutputGUI, ilTestEvaluationGUI, and ilTestScoringGUI.

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

References $cmd, $ret, and getCommand().

{
$cmd = $this->ctrl->getCmd();
$next_class = $this->ctrl->getNextClass($this);
$cmd = $this->getCommand($cmd);
switch($next_class)
{
default:
$ret =& $this->$cmd();
break;
}
return $ret;
}

+ Here is the call graph for this function:

ilTestServiceGUI::getCommand (   $cmd)

Retrieves the ilCtrl command.

Retrieves the ilCtrl command

public

Definition at line 95 of file class.ilTestServiceGUI.php.

References $cmd.

Referenced by ilTestScoringGUI\executeCommand(), ilTestEvaluationGUI\executeCommand(), ilTestOutputGUI\executeCommand(), and executeCommand().

{
return $cmd;
}

+ Here is the caller graph for this function:

ilTestServiceGUI::getCorrectSolutionOutput (   $question_id,
  $active_id,
  $pass 
)

Returns an output of the solution to an answer compared to the correct solution.

Returns an output of the solution to an answer compared to the correct solution

Parameters
integer$question_idDatabase ID of the question
integer$active_idActive ID of the active user
integer$passTest pass
Returns
string HTML code of the correct solution comparison public

Definition at line 778 of file class.ilTestServiceGUI.php.

References $pass.

Referenced by ilTestEvaluationGUI\outCorrectSolution(), and ilTestOutputGUI\outCorrectSolution().

{
global $ilUser;
$test_id = $this->object->getTestId();
$question_gui = $this->object->createQuestionGUI("", $question_id);
$template = new ilTemplate("tpl.il_as_tst_correct_solution_output.html", TRUE, TRUE, "Modules/Test");
$show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
$result_output = $question_gui->getSolutionOutput($active_id, $pass, TRUE, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
$best_output = $question_gui->getSolutionOutput($active_id, $pass, FALSE, FALSE, $show_question_only, FALSE, TRUE);
if (strlen($best_output))
{
$template->setCurrentBlock("best_solution");
$template->setVariable("TEXT_BEST_SOLUTION", $this->lng->txt("tst_best_solution_is"));
$template->setVariable("BEST_OUTPUT", $best_output);
$template->parseCurrentBlock();
}
$template->setVariable("TEXT_YOUR_SOLUTION", $this->lng->txt("tst_your_answer_was"));
$maxpoints = $question_gui->object->getMaximumPoints();
if ($maxpoints == 1)
{
$template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("point") . ")");
}
else
{
$template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()) . " (" . $maxpoints . " " . $this->lng->txt("points") . ")");
}
$template->setVariable("SOLUTION_OUTPUT", $result_output);
$template->setVariable("RECEIVED_POINTS", sprintf($this->lng->txt("you_received_a_of_b_points"), $question_gui->object->getReachedPoints($active_id, $pass), $maxpoints));
$template->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
$template->setVariable("BACKLINK_TEXT", "<< " . $this->lng->txt("back"));
return $template->get();
}

+ Here is the caller graph for this function:

ilTestServiceGUI::getFinalStatement (   $active_id)

Returns the final statement for a user.

Returns the final statement for a user

Parameters
arrayAn array containing the information on reached points, max points etc. ("test" key of ilObjTest::getTestResult)
Returns
string HTML code of the final statement public

Definition at line 219 of file class.ilTestServiceGUI.php.

Referenced by getResultsOfUserOutput(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outParticipantsResultsOverview(), ilTestEvaluationGUI\outUserPassDetails(), and ilTestEvaluationGUI\outUserResultsOverview().

{
$test_data_array = $this->object->getResultsForActiveId($active_id);
if (!$test_data_array["max_points"])
{
$percentage = 0;
}
else
{
$percentage = ($test_data_array["reached_points"]/$test_data_array["max_points"])*100;
}
$total_max = $test_data_array["max_points"];
$total_reached = $test_data_array["reached_points"];
$result_percentage = $percentage;
$result_total_reached = $total_reached;
$result_total_max = $total_max;
$mark = "";
$markects = "";
$mark_obj = $this->object->mark_schema->getMatchingMark($result_percentage);
if ($mark_obj)
{
if ($mark_obj->getPassed())
{
$mark = $this->lng->txt("mark_tst_passed");
}
else
{
$mark = $this->lng->txt("mark_tst_failed");
}
$mark = str_replace("[mark]", $mark_obj->getOfficialName(), $mark);
$mark = str_replace("[markshort]", $mark_obj->getShortName(), $mark);
$mark = str_replace("[percentage]", sprintf("%.2f", $result_percentage), $mark);
$mark = str_replace("[reached]", $result_total_reached, $mark);
$mark = str_replace("[max]", $result_total_max, $mark);
}
if ($this->object->ects_output)
{
$passed_array =& $this->object->getTotalPointsPassedArray();
$ects_mark = $this->object->getECTSGrade($passed_array, $result_total_reached, $result_total_max);
$markects = $this->lng->txt("mark_tst_ects");
$markects = str_replace("[markects]", $this->lng->txt("ects_grade_". strtolower($ects_mark)), $markects);
}
return array("mark" => $mark, "markects" => $markects);
}

+ Here is the caller graph for this function:

ilTestServiceGUI::getPassDetailsOverview (   $result_array,
  $active_id,
  $pass,
  $targetclass = "",
  $targetcommandsort = "",
  $targetcommanddetails = "",
  $standard_header = TRUE 
)

Returns the pass details overview for a given active ID and pass.

Returns the pass details overview for a given active ID and pass

Parameters
array$result_arrayAn array containing the results of the users test pass (generated by ilObjTest::getTestResult)
integer$active_idActive ID of the active user
integer$passTest pass
string$targetclassThe name of the ILIAS class for the "pass details" URL (optional)
string$targetcommandThe name of the ILIAS command for the "pass details" URL (optional)
string$targetcommanddetailsThe name of the ILIAS command which should be called for the details of an answer (optional)
boolean$standard_headerTRUE if the table headers should be plain text, FALSE if the table headers should be URL's for sortable columns
Returns
string HTML code of the pass details overview public

Definition at line 427 of file class.ilTestServiceGUI.php.

References $_GET, and ilUtil\getImagePath().

Referenced by getResultsOfUserOutput(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outUserPassDetails(), and ilTestEvaluationGUI\outUserResultsOverview().

{
global $ilUser;
$testresults = $result_array["pass"];
unset($result_array["test"]);
$user_id = $this->object->_getUserIdFromActiveId($active_id);
$sort = ($_GET["sort"]) ? ($_GET["sort"]) : "nr";
$sortorder = ($_GET["sortorder"]) ? ($_GET["sortorder"]) : "asc";
if (!$standard_header)
{
// change sortorder of result array
usort($result_array, "sortResults");
}
$color_class = array("tblrow1top", "tblrow2top");
$counter = 0;
$template = new ilTemplate("tpl.il_as_tst_pass_details_overview.html", TRUE, TRUE, "Modules/Test");
$this->ctrl->setParameterByClass($targetclass, "pass", "$pass");
if (!$testresults["total_max_points"])
{
$percentage = 0;
}
else
{
$percentage = ($testresults["total_reached_points"]/$testresults["total_max_points"])*100;
}
$total_max = $testresults["total_max_points"];
$total_reached = $testresults["total_reached_points"];
$img_title_percent = "";
$img_title_nr = "";
$hasSuggestedSolutions = FALSE;
if ($this->object->getShowSolutionSuggested())
{
foreach ($result_array as $key => $value)
{
if (strlen($value["solution"]))
{
$hasSuggestedSolutions = TRUE;
}
}
}
foreach ($result_array as $key => $value)
{
if (preg_match("/\d+/", $key))
{
if (strlen($targetclass) && strlen($targetcommanddetails))
{
$template->setCurrentBlock("linked_title");
$template->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
$template->setVariable("VALUE_QUESTION_TITLE", $value["title"]);
$this->ctrl->setParameterByClass($targetclass, "evaluation", $value["qid"]);
$this->ctrl->setParameterByClass($targetclass, "active_id", $active_id);
$template->setVariable("URL_QUESTION_TITLE", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommanddetails));
$template->parseCurrentBlock();
}
else
{
$template->setCurrentBlock("plain_title");
$template->setVariable("VALUE_QUESTION_TITLE", $value["title"]);
$template->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
$template->parseCurrentBlock();
}
if ($hasSuggestedSolutions)
{
$template->setCurrentBlock("question_suggested_solution");
$template->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
$template->setVariable("SOLUTION_HINT", $this->object->prepareTextareaOutput($value["solution"], true));
$template->parseCurrentBlock();
}
$template->setCurrentBlock("question");
$template->setVariable("COLOR_CLASS", $color_class[$counter % 2]);
$template->setVariable("VALUE_QUESTION_COUNTER", $value["nr"]);
$template->setVariable("VALUE_MAX_POINTS", $value["max"]);
$template->setVariable("VALUE_REACHED_POINTS", $value["reached"]);
$template->setVariable("VALUE_PERCENT_SOLVED", $value["percent"]);
$template->parseCurrentBlock();
$counter++;
}
}
if ($hasSuggestedSolutions)
{
$template->touchBlock("footer_suggested_solution");
}
$template->setCurrentBlock("footer");
$template->setVariable("VALUE_QUESTION_COUNTER", "<strong>" . $this->lng->txt("total") . "</strong>");
$template->setVariable("VALUE_QUESTION_TITLE", "");
$template->setVariable("VALUE_MAX_POINTS", "<strong>$total_max</strong>");
$template->setVariable("VALUE_REACHED_POINTS", "<strong>$total_reached</strong>");
$template->setVariable("VALUE_PERCENT_SOLVED", "<strong>" . sprintf("%2.2f", $percentage) . " %" . "</strong>");
$template->parseCurrentBlock();
if ($standard_header)
{
if ($hasSuggestedSolutions)
{
$template->setCurrentBlock("standard_header_suggested_solution");
$template->setVariable("SOLUTION_HINT_HEADER", $this->lng->txt("solution_hint"));
$template->parseCurrentBlock();
}
$template->setCurrentBlock("standard_header");
$template->setVariable("QUESTION_COUNTER", $this->lng->txt("tst_question_no"));
$template->setVariable("PERCENT_SOLVED", $this->lng->txt("tst_percent_solved"));
$template->setVariable("QUESTION_TITLE", $this->lng->txt("tst_question_title"));
$template->setVariable("MAX_POINTS", $this->lng->txt("tst_maximum_points"));
$template->setVariable("REACHED_POINTS", $this->lng->txt("tst_reached_points"));
$template->parseCurrentBlock();
}
else
{
if ($hasSuggestedSolutions)
{
$template->setCurrentBlock("linked_header_suggested_solution");
if (strcmp($sort, "solution") == 0)
{
$this->ctrl->setParameterByClass($targetclass, "sortorder", !strcmp($sortorder, "asc") ? "desc" : "asc");
}
else
{
$this->ctrl->setParameterByClass($targetclass, "sortorder", "asc");
}
$this->ctrl->setParameterByClass($targetclass, "sort", "solution");
$template->setVariable("URL_SOLUTION_HINT_HEADER", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
$template->setVariable("SOLUTION_HINT_HEADER", $this->lng->txt("solution_hint"));
if (strcmp($sort, "solution") == 0)
{
$image = new ilTemplate("tpl.image.html", TRUE, TRUE);
$image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.gif"));
$image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction"));
$image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction"));
$template->setVariable("IMAGE_SOLUTION_HINT_HEADER", $image->get());
}
$template->parseCurrentBlock();
}
$template->setCurrentBlock("linked_header");
$this->ctrl->setParameterByClass($targetclass, "sort", "nr");
if (strcmp($sort, "nr") == 0)
{
$this->ctrl->setParameterByClass($targetclass, "sortorder", !strcmp($sortorder, "asc") ? "desc" : "asc");
}
else
{
$this->ctrl->setParameterByClass($targetclass, "sortorder", "asc");
}
$template->setVariable("URL_QUESTION_COUNTER", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
$template->setVariable("QUESTION_COUNTER", $this->lng->txt("tst_question_no"));
if (strcmp($sort, "nr") == 0)
{
$image = new ilTemplate("tpl.image.html", TRUE, TRUE);
$image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.gif"));
$image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction"));
$image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction"));
$template->setVariable("IMAGE_QUESTION_COUNTER", $image->get());
}
$this->ctrl->setParameterByClass($targetclass, "sort", "percent");
if (strcmp($sort, "percent") == 0)
{
$this->ctrl->setParameterByClass($targetclass, "sortorder", !strcmp($sortorder, "asc") ? "desc" : "asc");
}
else
{
$this->ctrl->setParameterByClass($targetclass, "sortorder", "asc");
}
$template->setVariable("URL_PERCENT_SOLVED", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
$template->setVariable("PERCENT_SOLVED", $this->lng->txt("tst_percent_solved"));
if (strcmp($sort, "percent") == 0)
{
$image = new ilTemplate("tpl.image.html", TRUE, TRUE);
$image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.gif"));
$image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction"));
$image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction"));
$template->setVariable("IMAGE_PERCENT_SOLVED", $image->get());
}
$this->ctrl->setParameterByClass($targetclass, "sort", "title");
if (strcmp($sort, "title") == 0)
{
$this->ctrl->setParameterByClass($targetclass, "sortorder", !strcmp($sortorder, "asc") ? "desc" : "asc");
}
else
{
$this->ctrl->setParameterByClass($targetclass, "sortorder", "asc");
}
$template->setVariable("URL_QUESTION_TITLE", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
$template->setVariable("QUESTION_TITLE", $this->lng->txt("tst_question_title"));
if (strcmp($sort, "title") == 0)
{
$image = new ilTemplate("tpl.image.html", TRUE, TRUE);
$image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.gif"));
$image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction"));
$image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction"));
$template->setVariable("IMAGE_QUESTION_TITLE", $image->get());
}
$this->ctrl->setParameterByClass($targetclass, "sort", "max");
if (strcmp($sort, "max") == 0)
{
$this->ctrl->setParameterByClass($targetclass, "sortorder", strcmp($sortorder, "asc") ? "desc" : "asc");
}
else
{
$this->ctrl->setParameterByClass($targetclass, "sortorder", "asc");
}
$template->setVariable("URL_MAX_POINTS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
$template->setVariable("MAX_POINTS", $this->lng->txt("tst_maximum_points"));
if (strcmp($sort, "max") == 0)
{
$image = new ilTemplate("tpl.image.html", TRUE, TRUE);
$image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.gif"));
$image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction"));
$image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction"));
$template->setVariable("IMAGE_MAX_POINTS", $image->get());
}
$this->ctrl->setParameterByClass($targetclass, "sort", "reached");
if (strcmp($sort, "reached") == 0)
{
$this->ctrl->setParameterByClass($targetclass, "sortorder", !strcmp($sortorder, "asc") ? "desc" : "asc");
}
else
{
$this->ctrl->setParameterByClass($targetclass, "sortorder", "asc");
}
$template->setVariable("URL_REACHED_POINTS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort));
$template->setVariable("REACHED_POINTS", $this->lng->txt("tst_reached_points"));
if (strcmp($sort, "reached") == 0)
{
$image = new ilTemplate("tpl.image.html", TRUE, TRUE);
$image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.gif"));
$image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction"));
$image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction"));
$template->setVariable("IMAGE_REACHED_POINTS", $image->get());
}
$template->parseCurrentBlock();
}
return $template->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestServiceGUI::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.

Parameters
array$result_arrayAn array containing the results of the users test pass (generated by ilObjTest::getTestResult)
integer$active_idActive ID of the active user
integer$passTest pass
boolean$show_solutionsTRUE, if the solution output should be shown in the answers, FALSE otherwise
Returns
string HTML code of the list of answers public

Definition at line 275 of file class.ilTestServiceGUI.php.

References $pass.

Referenced by getResultsOfUserOutput(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outUserListOfAnswerPasses(), ilTestEvaluationGUI\outUserPassDetails(), and ilTestEvaluationGUI\outUserResultsOverview().

{
$maintemplate = new ilTemplate("tpl.il_as_tst_list_of_answers.html", TRUE, TRUE, "Modules/Test");
$counter = 1;
// output of questions with solutions
foreach ($result_array as $question_data)
{
if (($question_data["workedthrough"] == 1) || ($only_answered_questions == FALSE))
{
$template = new ilTemplate("tpl.il_as_qpl_question_printview.html", TRUE, TRUE, "Modules/TestQuestionPool");
$question = $question_data["qid"];
if (is_numeric($question))
{
$maintemplate->setCurrentBlock("printview_question");
$question_gui = $this->object->createQuestionGUI("", $question);
if (is_object($question_gui))
{
if ($show_reached_points)
{
$template->setCurrentBlock("result_points");
$template->setVariable("RESULT_POINTS", $this->lng->txt("tst_reached_points") . ": " . $question_gui->object->getReachedPoints($active_id, $pass) . " " . $this->lng->txt("of") . " " . $question_gui->object->getMaximumPoints());
$template->parseCurrentBlock();
}
$template->setVariable("COUNTER_QUESTION", $counter.". ");
$template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
$show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
$result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback());
$template->setVariable("SOLUTION_OUTPUT", $result_output);
$maintemplate->setCurrentBlock("printview_question");
$maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
$maintemplate->parseCurrentBlock();
$counter ++;
}
}
}
}
$maintemplate->setVariable("RESULTS_OVERVIEW", sprintf($this->lng->txt("tst_eval_results_by_pass"), $pass+1));
return $maintemplate->get();
}

+ Here is the caller graph for this function:

ilTestServiceGUI::getPassListOfAnswersWithScoring ( $result_array,
  $active_id,
  $pass,
  $show_solutions = FALSE 
)

Returns the list of answers of a users test pass and offers a scoring option.

Parameters
array$result_arrayAn array containing the results of the users test pass (generated by ilObjTest::getTestResult)
integer$active_idActive ID of the active user
integer$passTest pass
boolean$show_solutionsTRUE, if the solution output should be shown in the answers, FALSE otherwise
Returns
string HTML code of the list of answers public

Definition at line 328 of file class.ilTestServiceGUI.php.

References $pass, ilObjAssessmentFolder\_getManualScoring(), assQuestion\_getReachedPoints(), ilYuiUtil\initDomEvent(), and ilUtil\prepareFormOutput().

Referenced by ilTestScoringGUI\manscoring().

{
include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
$maintemplate = new ilTemplate("tpl.il_as_tst_list_of_answers.html", TRUE, TRUE, "Modules/Test");
include_once "./Modules/Test/classes/class.ilObjAssessmentFolder.php";
$counter = 1;
// output of questions with solutions
foreach ($result_array as $question_data)
{
$question = $question_data["qid"];
if (is_numeric($question))
{
$question_gui = $this->object->createQuestionGUI("", $question);
if (in_array($question_gui->object->getQuestionTypeID(), $scoring))
{
$template = new ilTemplate("tpl.il_as_qpl_question_printview.html", TRUE, TRUE, "Modules/TestQuestionPool");
$scoretemplate = new ilTemplate("tpl.il_as_tst_manual_scoring_points.html", TRUE, TRUE, "Modules/Test");
#mbecker: No such block. $this->tpl->setCurrentBlock("printview_question");
$template->setVariable("COUNTER_QUESTION", $counter.". ");
$template->setVariable("QUESTION_TITLE", $this->object->getQuestionTitle($question_gui->object->getTitle()));
$points = $question_gui->object->getMaximumPoints();
if ($points == 1)
{
$template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("point"));
}
else
{
$template->setVariable("QUESTION_POINTS", $points . " " . $this->lng->txt("points"));
}
$show_question_only = ($this->object->getShowSolutionAnswersOnly()) ? TRUE : FALSE;
$result_output = $question_gui->getSolutionOutput($active_id, $pass, $show_solutions, FALSE, $show_question_only, $this->object->getShowSolutionFeedback(), FALSE, TRUE);
$solout = $question_gui->object->getSuggestedSolutionOutput();
if (strlen($solout))
{
$scoretemplate->setCurrentBlock("suggested_solution");
$scoretemplate->setVariable("TEXT_SUGGESTED_SOLUTION", $this->lng->txt("solution_hint"));
$scoretemplate->setVariable("VALUE_SUGGESTED_SOLUTION", $solout);
$scoretemplate->parseCurrentBlock();
}
$scoretemplate->setCurrentBlock("feedback");
$scoretemplate->setVariable("FEEDBACK_NAME_INPUT", $question);
$feedback = $this->object->getManualFeedback($active_id, $question, $pass);
$scoretemplate->setVariable("VALUE_FEEDBACK", ilUtil::prepareFormOutput($this->object->prepareTextareaOutput($feedback, TRUE)));
$scoretemplate->setVariable("TEXT_MANUAL_FEEDBACK", $this->lng->txt("set_manual_feedback"));
$scoretemplate->parseCurrentBlock();
$scoretemplate->setVariable("NAME_INPUT", $question);
$this->ctrl->setParameter($this, "active_id", $active_id);
$this->ctrl->setParameter($this, "pass", $pass);
$scoretemplate->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "manscoring"));
$scoretemplate->setVariable("LABEL_INPUT", $this->lng->txt("tst_change_points_for_question"));
$scoretemplate->setVariable("VALUE_INPUT", " value=\"" . assQuestion::_getReachedPoints($active_id, $question_data["qid"], $pass) . "\"");
$scoretemplate->setVariable("VALUE_SAVE", $this->lng->txt("save"));
$template->setVariable("SOLUTION_OUTPUT", $result_output);
$maintemplate->setCurrentBlock("printview_question");
$maintemplate->setVariable("QUESTION_PRINTVIEW", $template->get());
$maintemplate->setVariable("QUESTION_SCORING", $scoretemplate->get());
$maintemplate->parseCurrentBlock();
}
$counter ++;
}
}
if ($counter == 1)
{
// no scorable questions found
$maintemplate->setVariable("NO_QUESTIONS_FOUND", $this->lng->txt("manscoring_questions_not_found"));
}
$maintemplate->setVariable("RESULTS_OVERVIEW", sprintf($this->lng->txt("manscoring_results_pass"), $pass+1));
include_once "./Services/YUI/classes/class.ilYuiUtil.php";
return $maintemplate->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestServiceGUI::getPassOverview (   $active_id,
  $targetclass = "",
  $targetcommand = "",
  $short = FALSE,
  $hide_details = FALSE 
)

Returns the pass overview for a given active ID.

Returns the pass overview for a given active ID

Returns
string HTML code of the pass overview public

Definition at line 108 of file class.ilTestServiceGUI.php.

References $pass, ilDatePresentation\formatDate(), and IL_CAL_UNIX.

Referenced by ilTestScoringGUI\manscoring(), ilTestEvaluationGUI\outParticipantsResultsOverview(), ilTestEvaluationGUI\outUserListOfAnswerPasses(), and ilTestEvaluationGUI\outUserResultsOverview().

{
global $ilUser;
if ($short)
{
$template = new ilTemplate("tpl.il_as_tst_pass_overview_short.html", TRUE, TRUE, "Modules/Test");
}
else
{
$template = new ilTemplate("tpl.il_as_tst_pass_overview.html", TRUE, TRUE, "Modules/Test");
}
$color_class = array("tblrow1", "tblrow2");
$counter = 0;
$user_id = $this->object->_getUserIdFromActiveId($active_id);
$counted_pass = $this->object->_getResultPass($active_id);
$reached_pass = $this->object->_getPass($active_id);
$result_percentage = 0;
$result_total_reached = 0;
$result_total_max = 0;
for ($pass = 0; $pass <= $reached_pass; $pass++)
{
$finishdate = $this->object->getPassFinishDate($active_id, $pass);
if ($finishdate > 0)
{
if (!$short)
{
$result_array =& $this->object->getTestResult($active_id, $pass);
if (!$result_array["pass"]["total_max_points"])
{
$percentage = 0;
}
else
{
$percentage = ($result_array["pass"]["total_reached_points"]/$result_array["pass"]["total_max_points"])*100;
}
$total_max = $result_array["pass"]["total_max_points"];
$total_reached = $result_array["pass"]["total_reached_points"];
}
if (!$hide_details)
{
if (strlen($targetclass) && strlen($targetcommand))
{
$this->ctrl->setParameterByClass($targetclass, "active_id", $active_id);
$this->ctrl->setParameterByClass($targetclass, "pass", $pass);
$template->setCurrentBlock("pass_details");
$template->setVariable("HREF_PASS_DETAILS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommand));
$template->setVariable("TEXT_PASS_DETAILS", $this->lng->txt("tst_pass_details"));
$template->parseCurrentBlock();
}
}
$template->setCurrentBlock("result_row");
if (($pass == $counted_pass) && (!$short))
{
$template->setVariable("COLOR_CLASS", "tblrowmarked");
$template->setVariable("VALUE_SCORED", "&otimes;");
if (!$result_array["test"]["total_max_points"])
{
$result_percentage = 0;
}
else
{
$result_percentage = ($result_array["test"]["total_reached_points"]/$result_array["test"]["total_max_points"])*100;
}
$result_total_max = $result_array["test"]["total_max_points"];
$result_total_reached = $result_array["test"]["total_reached_points"];
}
else
{
$template->setVariable("COLOR_CLASS", $color_class[$pass % 2]);
}
$template->setVariable("VALUE_PASS", $pass + 1);
$template->setVariable("VALUE_DATE",ilDatePresentation::formatDate(new ilDate($finishdate,IL_CAL_UNIX)));
if (!$short)
{
$template->setVariable("VALUE_ANSWERED", $this->object->getAnsweredQuestionCount($active_id, $pass) . " " . strtolower($this->lng->txt("of")) . " " . (count($result_array)-2));
$template->setVariable("VALUE_REACHED", $total_reached . " " . strtolower($this->lng->txt("of")) . " " . $total_max);
$template->setVariable("VALUE_PERCENTAGE", sprintf("%.2f", $percentage) . "%");
}
$template->parseCurrentBlock();
}
}
$template->setVariable("PASS_COUNTER", $this->lng->txt("pass"));
$template->setVariable("DATE", $this->lng->txt("date"));
if (!$short)
{
$template->setVariable("PASS_SCORED", $this->lng->txt("scored_pass"));
$template->setVariable("ANSWERED_QUESTIONS", $this->lng->txt("tst_answered_questions"));
$template->setVariable("REACHED_POINTS", $this->lng->txt("tst_reached_points"));
$template->setVariable("PERCENTAGE_CORRECT", $this->lng->txt("tst_percent_solved"));
}
$template->parseCurrentBlock();
return $template->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestServiceGUI::getQuestionResultForTestUsers (   $question_id,
  $test_id 
)

Creates a HTML representation for the results of a given question in a test.

Parameters
integer$question_idThe original id of the question
integer$test_idThe test id
Returns
string HTML code of the question results public

Definition at line 940 of file class.ilTestServiceGUI.php.

References getResultsHeadUserAndPass().

Referenced by ilTestEvaluationGUI\exportQuestionForAllParticipants().

{
$foundusers = $this->object->getParticipantsForTestAndQuestion($test_id, $question_id);
$output = "";
foreach ($foundusers as $active_id => $passes)
{
$resultpass = $this->object->_getResultPass($active_id);
for ($i = 0; $i < count($passes); $i++)
{
if (($resultpass !== null) && ($resultpass == $passes[$i]["pass"]))
{
$question_gui =& $this->object->createQuestionGUI("", $passes[$i]["qid"]);
$output .= $this->getResultsHeadUserAndPass($active_id, $resultpass+1);
$output .= $question_gui->getSolutionOutput($active_id, $resultpass, $graphicalOutput = FALSE, $result_output = FALSE, $show_question_only = FALSE, $show_feedback = FALSE);
$output .= "<br /><br /><br />";
}
}
}
$this->object->deliverPDFfromHTML($output, $question_gui->object->getTitle());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestServiceGUI::getResultsHeadUserAndPass (   $active_id,
  $pass 
)

Returns the user and pass data for a test results output.

Parameters
integer$active_idThe active ID of the user
Returns
string HTML code of the user data for the test results public

Definition at line 884 of file class.ilTestServiceGUI.php.

References $pass, and ilObjUser\_lookupLogin().

Referenced by getQuestionResultForTestUsers().

{
$template = new ilTemplate("tpl.il_as_tst_results_head_user_pass.html", TRUE, TRUE, "Modules/Test");
include_once './Services/User/classes/class.ilObjUser.php';
$user_id = $this->object->_getUserIdFromActiveId($active_id);
if (strlen(ilObjUser::_lookupLogin($user_id)) > 0)
{
$user = new ilObjUser($user_id);
}
else
{
$user = new ilObjUser();
$user->setLastname($this->lng->txt("deleted_user"));
}
$title_matric = "";
if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == FALSE)))
{
$template->setCurrentBlock("user_matric");
$template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
$template->parseCurrentBlock();
$template->setCurrentBlock("user_matric_value");
$template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
$template->parseCurrentBlock();
$template->touchBlock("user_matric_separator");
$title_matric = " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
}
$invited_user = array_pop($this->object->getInvitedUsers($user_id));
if (strlen($invited_user["clientip"]))
{
$template->setCurrentBlock("user_clientip");
$template->setVariable("TXT_CLIENT_IP", $this->lng->txt("client_ip"));
$template->parseCurrentBlock();
$template->setCurrentBlock("user_clientip_value");
$template->setVariable("VALUE_CLIENT_IP", $invited_user["clientip"]);
$template->parseCurrentBlock();
$template->touchBlock("user_clientip_separator");
$title_client = " - " . $this->lng->txt("clientip") . ": " . $invited_user["clientip"];
}
$template->setVariable("TXT_USR_NAME", $this->lng->txt("name"));
$uname = $this->object->userLookupFullName($user_id, FALSE);
$template->setVariable("VALUE_USR_NAME", $uname);
$template->setVariable("TXT_PASS", $this->lng->txt("scored_pass"));
$template->setVariable("VALUE_PASS", $pass);
return $template->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestServiceGUI::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.

Output of the pass overview for a test called by a test participant

public

Definition at line 820 of file class.ilTestServiceGUI.php.

References $_GET, $ilias, $pass, $tpl, getFinalStatement(), getPassDetailsOverview(), getPassListOfAnswers(), getResultsSignature(), and getResultsUserdata().

{
global $ilias, $tpl;
include_once("./classes/class.ilTemplate.php");
$template = new ilTemplate("tpl.il_as_tst_results_participant.html", TRUE, TRUE, "Modules/Test");
$user_id = $this->object->_getUserIdFromActiveId($active_id);
$uname = $this->object->userLookupFullName($user_id, TRUE);
if (((array_key_exists("pass", $_GET)) && (strlen($_GET["pass"]) > 0)) || (!is_null($pass)))
{
if (is_null($pass)) $pass = $_GET["pass"];
}
$statement = $this->getFinalStatement($active_id);
$user_data = $this->getResultsUserdata($active_id, TRUE);
if (!is_null($pass))
{
$result_array =& $this->object->getTestResult($active_id, $pass);
$command_solution_details = "";
if ($show_pass_details)
{
$detailsoverview = $this->getPassDetailsOverview($result_array, $active_id, $pass, "iltestservicegui", "getResultsOfUserOutput", $command_solution_details);
}
$user_id = $this->object->_getUserIdFromActiveId($active_id);
$showAllAnswers = TRUE;
if ($this->object->isExecutable($user_id))
{
$showAllAnswers = FALSE;
}
if ($show_answers)
{
$list_of_answers = $this->getPassListOfAnswers($result_array, $active_id, $pass, FALSE, $showAllAnswers, $show_question_only, $show_reached_points);
}
$template->setVariable("LIST_OF_ANSWERS", $list_of_answers);
//$template->setVariable("PASS_RESULTS_OVERVIEW", sprintf($this->lng->txt("tst_results_overview_pass"), $pass + 1));
$template->setVariable("PASS_DETAILS", $detailsoverview);
$signature = $this->getResultsSignature();
$template->setVariable("SIGNATURE", $signature);
}
$template->setVariable("TEXT_HEADING", sprintf($this->lng->txt("tst_result_user_name"), $uname));
$template->setVariable("USER_DATA", $user_data);
$template->setVariable("USER_MARK", $statement["mark"]);
if (strlen($statement["markects"]))
{
$template->setVariable("USER_MARK_ECTS", $statement["markects"]);
}
$template->parseCurrentBlock();
return $template->get();
}

+ Here is the call graph for this function:

ilTestServiceGUI::getResultsSignature ( )

Returns HTML code for a signature field.

Returns HTML code for a signature field

Returns
string HTML code of the date and signature field for the test results public

Definition at line 675 of file class.ilTestServiceGUI.php.

References ilUtil\getImagePath().

Referenced by getResultsOfUserOutput(), ilTestEvaluationGUI\outUserListOfAnswerPasses(), ilTestEvaluationGUI\outUserResultsOverview(), and ilTestOutputGUI\showListOfAnswers().

{
if ($this->object->getShowSolutionSignature() && !$this->object->getAnonymity())
{
// output of time/date and signature
$template = new ilTemplate("tpl.il_as_tst_results_userdata_signature.html", TRUE, TRUE, "Modules/Test");
$template->setVariable("TXT_DATE", $this->lng->txt("date"));
$template->setVariable("VALUE_DATE", strftime("%Y-%m-%d %H:%M:%S", time()));
$template->setVariable("TXT_SIGNATURE", $this->lng->txt("tst_signature"));
$template->setVariable("IMG_SPACER", ilUtil::getImagePath("spacer.gif"));
return $template->get();
}
else
{
return "";
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestServiceGUI::getResultsUserdata (   $active_id,
  $overwrite_anonymity = FALSE 
)

Returns the user data for a test results output.

Returns the user data for a test results output

Parameters
integer$user_idThe user ID of the user
boolean$overwrite_anonymityTRUE if the anonymity status should be overwritten, FALSE otherwise
Returns
string HTML code of the user data for the test results public

Definition at line 703 of file class.ilTestServiceGUI.php.

References $t, ilObjUser\_lookupLogin(), and ilUtil\date_mysql2time().

Referenced by getResultsOfUserOutput(), ilTestEvaluationGUI\outParticipantsPassDetails(), ilTestEvaluationGUI\outParticipantsResultsOverview(), ilTestEvaluationGUI\outUserListOfAnswerPasses(), ilTestEvaluationGUI\outUserResultsOverview(), and ilTestOutputGUI\showListOfAnswers().

{
$template = new ilTemplate("tpl.il_as_tst_results_userdata.html", TRUE, TRUE, "Modules/Test");
include_once './Services/User/classes/class.ilObjUser.php';
$user_id = $this->object->_getUserIdFromActiveId($active_id);
if (strlen(ilObjUser::_lookupLogin($user_id)) > 0)
{
$user = new ilObjUser($user_id);
}
else
{
$user = new ilObjUser();
$user->setLastname($this->lng->txt("deleted_user"));
}
$t = $this->object->getTestSession($active_id)->getSubmittedTimestamp();
if (!$t)
{
$t = $this->object->_getLastAccess($this->object->getTestSession()->getActiveId());
}
$print_date = mktime(date("H"), date("i"), date("s"), date("m") , date("d"), date("Y"));
$title_matric = "";
if (strlen($user->getMatriculation()) && (($this->object->getAnonymity() == FALSE) || ($overwrite_anonymity)))
{
$template->setCurrentBlock("user_matric");
$template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
$template->parseCurrentBlock();
$template->setCurrentBlock("user_matric_value");
$template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
$template->parseCurrentBlock();
$template->touchBlock("user_matric_separator");
$title_matric = " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
}
$invited_user = array_pop($this->object->getInvitedUsers($user_id));
if (strlen($invited_user["clientip"]))
{
$template->setCurrentBlock("user_clientip");
$template->setVariable("TXT_CLIENT_IP", $this->lng->txt("client_ip"));
$template->parseCurrentBlock();
$template->setCurrentBlock("user_clientip_value");
$template->setVariable("VALUE_CLIENT_IP", $invited_user["clientip"]);
$template->parseCurrentBlock();
$template->touchBlock("user_clientip_separator");
$title_client = " - " . $this->lng->txt("clientip") . ": " . $invited_user["clientip"];
}
$template->setVariable("TXT_TEST_TITLE", $this->lng->txt("title"));
$template->setVariable("VALUE_TEST_TITLE", $this->object->getTitle());
$template->setVariable("TXT_USR_NAME", $this->lng->txt("name"));
$uname = $this->object->userLookupFullName($user_id, $overwrite_anonymity);
$template->setVariable("VALUE_USR_NAME", $uname);
$template->setVariable("TXT_TEST_DATE", $this->lng->txt("tst_tst_date"));
$template->setVariable("VALUE_TEST_DATE", strftime("%Y-%m-%d %H:%M:%S",ilUtil::date_mysql2time($t)));
$template->setVariable("TXT_PRINT_DATE", $this->lng->txt("tst_print_date"));
$template->setVariable("VALUE_PRINT_DATE", strftime("%Y-%m-%d %H:%M:%S",$print_date));
// change the pagetitle
$pagetitle = ": " . $this->object->getTitle() . $title_matric . $title_client;
$this->tpl->setHeaderPageTitle($pagetitle);
return $template->get();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilTestServiceGUI::ilTestServiceGUI (   $a_object)

ilTestScoringGUI constructor

The constructor takes the test object reference as parameter

Parameters
object$a_objectAssociated ilObjTest class public

Definition at line 57 of file class.ilTestServiceGUI.php.

References $ilCtrl, $ilias, $lng, $tpl, and $tree.

Referenced by ilTestEvaluationGUI\ilTestEvaluationGUI(), ilTestOutputGUI\ilTestOutputGUI(), and ilTestScoringGUI\ilTestScoringGUI().

{
$this->lng =& $lng;
$this->tpl =& $tpl;
$this->ctrl =& $ilCtrl;
$this->ilias =& $ilias;
$this->object =& $a_object;
$this->tree =& $tree;
$this->ref_id = $a_object->ref_id;
}

+ Here is the caller graph for this function:

Field Documentation

ilTestServiceGUI::$ctrl

Definition at line 44 of file class.ilTestServiceGUI.php.

ilTestServiceGUI::$lng

Definition at line 42 of file class.ilTestServiceGUI.php.

Referenced by ilTestServiceGUI().

ilTestServiceGUI::$object

Definition at line 41 of file class.ilTestServiceGUI.php.

ilTestServiceGUI::$ref_id

Definition at line 47 of file class.ilTestServiceGUI.php.

ilTestServiceGUI::$tpl

Definition at line 43 of file class.ilTestServiceGUI.php.

Referenced by getResultsOfUserOutput(), and ilTestServiceGUI().

ilTestServiceGUI::$tree

Definition at line 46 of file class.ilTestServiceGUI.php.

Referenced by ilTestServiceGUI().


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