ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilTestToplistGUI Class Reference
+ Collaboration diagram for ilTestToplistGUI:

Public Member Functions

 __construct (protected readonly ilObjTest $test_obj, protected readonly TestTopListRepository $repository, protected readonly ilCtrlInterface $ctrl, protected readonly ilGlobalTemplateInterface $tpl, protected readonly ilLanguage $lng, protected readonly ilObjUser $user, protected readonly UIFactory $ui_factory, protected readonly UIRenderer $ui_renderer, protected readonly DataFactory $data_factory, protected readonly GlobalHttpState $http_state)
 
 executeCommand ()
 

Protected Member Functions

 showResultsToplistsCmd ()
 
 buildMedianMarkPanel ()
 
 buildResultsToplists (TopListOrder $order_by)
 
 buildTable (string $title, TopListType $list_type, TopListOrder $order_by)
 
 isTopTenRankingTableRequired ()
 
 isOwnRankingTableRequired ()
 

Detailed Description

Author
Maximilian Becker mbeck.nosp@m.er@d.nosp@m.ataba.nosp@m.y.de \

Definition at line 36 of file class.ilTestToplistGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilTestToplistGUI::__construct ( protected readonly ilObjTest  $test_obj,
protected readonly TestTopListRepository  $repository,
protected readonly ilCtrlInterface  $ctrl,
protected readonly ilGlobalTemplateInterface  $tpl,
protected readonly ilLanguage  $lng,
protected readonly ilObjUser  $user,
protected readonly UIFactory  $ui_factory,
protected readonly UIRenderer  $ui_renderer,
protected readonly DataFactory  $data_factory,
protected readonly GlobalHttpState  $http_state 
)

Definition at line 38 of file class.ilTestToplistGUI.php.

49  {
50  }

Member Function Documentation

◆ buildMedianMarkPanel()

ilTestToplistGUI::buildMedianMarkPanel ( )
protected

Definition at line 81 of file class.ilTestToplistGUI.php.

References $data, ILIAS\Repository\lng(), and ILIAS\Repository\user().

81  : Panel
82  {
83  $title = $this->lng->txt('tst_median_mark_panel');
84 
85  // BH: this really is the "mark of median" ??!
86  $activeId = $this->test_obj->getActiveIdOfUser($this->user->getId());
87  $data = $this->test_obj->getCompleteEvaluationData();
88  $median = $data->getStatistics()->median();
89  $pct = $data->getParticipant($activeId)->getMaxpoints() ? ($median / $data->getParticipant($activeId)->getMaxpoints()) * 100.0 : 0;
90  $mark = $this->test_obj->getMarkSchema()->getMatchingMark($pct);
91  $content = $mark->getShortName();
92 
93  return $this->ui_factory->panel()->standard(
94  $title,
95  $this->ui_factory->legacy()->content($content)
96  );
97  }
This describes how a panel could be modified during construction of UI.
Definition: Panel.php:30
+ Here is the call graph for this function:

◆ buildResultsToplists()

ilTestToplistGUI::buildResultsToplists ( TopListOrder  $order_by)
protected
Returns
array<Data>

Definition at line 102 of file class.ilTestToplistGUI.php.

References buildTable(), isOwnRankingTableRequired(), isTopTenRankingTableRequired(), ILIAS\Repository\lng(), and ILIAS\Mail\Folder\USER.

102  : array
103  {
104  $tables = [];
105 
106  if ($this->isTopTenRankingTableRequired()) {
107  $tables[] = $this->buildTable(
108  $this->lng->txt('toplist_by_' . $order_by->getLabel()),
109  TopListType::GENERAL,
110  $order_by
111  )->withId('tst_top_list' . $this->test_obj->getRefId());
112  }
113 
114  if ($this->isOwnRankingTableRequired()) {
115  $tables[] = $this->buildTable(
116  count($tables) == 0 ? $this->lng->txt('toplist_by_score' . $order_by->getLabel()) : '',
118  $order_by
119  )->withId('tst_own_list' . $this->test_obj->getRefId());
120  }
121 
122  return $tables;
123  }
buildTable(string $title, TopListType $list_type, TopListOrder $order_by)
+ Here is the call graph for this function:

◆ buildTable()

ilTestToplistGUI::buildTable ( string  $title,
TopListType  $list_type,
TopListOrder  $order_by 
)
protected

Definition at line 125 of file class.ilTestToplistGUI.php.

References ILIAS\Repository\lng(), ILIAS\UI\examples\Deck\repository(), and ILIAS\Repository\user().

Referenced by buildResultsToplists().

125  : Data
126  {
127  $table = new DataRetrieval(
128  $this->test_obj,
129  $this->repository,
130  $this->lng,
131  $this->user,
132  $this->ui_factory,
133  $this->ui_renderer,
134  $this->data_factory,
135  $list_type,
136  $order_by
137  );
138  return $this->ui_factory->table()
139  ->data($table, $title, $table->getColumns())
140  ->withRequest($this->http_state->request());
141  }
repository()
description: > Example for rendering a repository card
Definition: repository.php:33
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilTestToplistGUI::executeCommand ( )

Definition at line 55 of file class.ilTestToplistGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and showResultsToplistsCmd().

55  : void
56  {
57  if (!$this->test_obj->getHighscoreEnabled()) {
58  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('permission_denied'), true);
59  $this->ctrl->redirectByClass(ilObjTestGUI::class);
60  }
61 
62  $this->ctrl->saveParameter($this, 'active_id');
63 
64  $cmd = $this->ctrl->getCmd();
65 
66  switch ($cmd) {
67  default:
68  $this->showResultsToplistsCmd();
69  }
70  }
+ Here is the call graph for this function:

◆ isOwnRankingTableRequired()

ilTestToplistGUI::isOwnRankingTableRequired ( )
protected

Definition at line 148 of file class.ilTestToplistGUI.php.

Referenced by buildResultsToplists().

148  : bool
149  {
150  return $this->test_obj->getHighscoreOwnTable();
151  }
+ Here is the caller graph for this function:

◆ isTopTenRankingTableRequired()

ilTestToplistGUI::isTopTenRankingTableRequired ( )
protected

Definition at line 143 of file class.ilTestToplistGUI.php.

Referenced by buildResultsToplists().

143  : bool
144  {
145  return $this->test_obj->getHighscoreTopTable();
146  }
+ Here is the caller graph for this function:

◆ showResultsToplistsCmd()

ilTestToplistGUI::showResultsToplistsCmd ( )
protected

Definition at line 72 of file class.ilTestToplistGUI.php.

Referenced by executeCommand().

72  : void
73  {
74  $this->tpl->setContent($this->ui_renderer->render([
75  $this->buildMedianMarkPanel(),
76  ...$this->buildResultsToplists(TopListOrder::BY_SCORE),
77  ...$this->buildResultsToplists(TopListOrder::BY_TIME),
78  ]));
79  }
+ Here is the caller graph for this function:

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