Skip to content

Commit

Permalink
TA: use PresentationTable for results, icons OK/MostlyOK/NotOK
Browse files Browse the repository at this point in the history
  • Loading branch information
nhaagen committed Sep 12, 2023
1 parent d28ab38 commit a6a7841
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions Modules/Test/classes/Results/class.ilTestResultsOverviewTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
class ilTestResultsOverviewTable
{
private const ENV = 'e';
private const LNG = 'l';
private const URL_NAMESPACE = ['taresult', 'vc'];
private const PARAM_MODE = 'm';
private const MODE_OPT_ALL = "all";
Expand Down Expand Up @@ -61,7 +62,10 @@ public function __construct(
$this->getViewControls($ui_factory, $lng, $target, $mode, $sortation),
$this->getMapping()
)
->withEnvironment([self::ENV => $environment])
->withEnvironment([
self::ENV => $environment,
self::LNG => $lng
])
->withData($results);
}

Expand Down Expand Up @@ -161,6 +165,7 @@ protected function getMapping(): \Closure
{
return function ($row, $question, $ui_factory, $environment) {
$env = $environment[self::ENV];
$lng = $environment[self::LNG];

$title = sprintf(
'%s [ID: %s]',
Expand Down Expand Up @@ -206,13 +211,23 @@ protected function getMapping(): \Closure

switch($question->getCorrect()) {
case ilQuestionResult::CORRECT_FULL:
$icon_name = 'icon_ok.svg';
$label = $lng->txt("answer_is_right");
break;
case ilQuestionResult::CORRECT_PARTIAL:
$icon_name = 'icon_mostly_ok.svg';
$label = $lng->txt("answer_is_not_correct_but_positive");
break;
case ilQuestionResult::CORRECT_NONE:
$correct_icon = $ui_factory->symbol()->icon()
->standard('pequ', 'Question')
->withSize('small');
$icon_name = 'icon_not_ok.svg';
$label = $lng->txt("answer_is_wrong");
break;
}
$path = ilUtil::getImagePath($icon_name);
$correct_icon = $ui_factory->symbol()->icon()->custom(
$path,
$label
);

return $row
->withHeadline($title)
Expand Down

0 comments on commit a6a7841

Please sign in to comment.