ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
class.ilTestResultsToolbarGUI.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
28 {
29  public ilCtrl $ctrl;
31 
32  private ?string $certificateLinkTarget = null;
33  private ?string $showBestSolutionsLinkTarget = null;
34  private ?string $hideBestSolutionsLinkTarget = null;
35  private array $participantSelectorOptions = [];
36 
38  {
39  $this->ctrl = $ctrl;
40  $this->tpl = $tpl;
42  }
43 
44  public function build(): void
45  {
46  $this->setId('tst_results_toolbar');
47 
48  $print_button = $this->ui->factory()->button()->standard($this->lng->txt('print'), '')
49  ->withOnLoadCode(fn($id) => "$('#$id').on('click', ()=>{window.print();})");
50  $this->addComponent($print_button);
51 
52  if ($this->getCertificateLinkTarget() !== null
53  && $this->getCertificateLinkTarget() !== '') {
54  $this->addButton($this->lng->txt('certificate'), $this->getCertificateLinkTarget());
55  }
56 
57  if ($this->getShowBestSolutionsLinkTarget() !== null
58  && $this->getShowBestSolutionsLinkTarget() !== '') {
59  $this->addSeparator();
60  $this->addButton(
61  $this->lng->txt('tst_btn_show_best_solutions'),
63  );
64  } elseif ($this->getHideBestSolutionsLinkTarget() !== null
65  && $this->getHideBestSolutionsLinkTarget() !== '') {
66  $this->addSeparator();
67  $this->addButton(
68  $this->lng->txt('tst_btn_hide_best_solutions'),
70  );
71  }
72 
73  if (count($this->getParticipantSelectorOptions())) {
74  $this->addSeparator();
75 
76  $dropdown = $this->ui->factory()->dropdown()
77  ->standard($this->getParticipantSelectorLinksArray())
78  ->withLabel($this->lng->txt('tst_res_jump_to_participant_hint_opt'));
79  $this->addComponent($dropdown);
80  }
81  }
82 
83  public function setCertificateLinkTarget(string $certificateLinkTarget): void
84  {
85  $this->certificateLinkTarget = $certificateLinkTarget;
86  }
87 
88  public function getCertificateLinkTarget(): ?string
89  {
91  }
92 
93  public function setShowBestSolutionsLinkTarget(string $showBestSolutionsLinkTarget): void
94  {
95  $this->showBestSolutionsLinkTarget = $showBestSolutionsLinkTarget;
96  }
97 
98  public function getShowBestSolutionsLinkTarget(): ?string
99  {
101  }
102 
103  public function setHideBestSolutionsLinkTarget(string $hideBestSolutionsLinkTarget): void
104  {
105  $this->hideBestSolutionsLinkTarget = $hideBestSolutionsLinkTarget;
106  }
107 
108  public function getHideBestSolutionsLinkTarget(): ?string
109  {
111  }
112 
113  public function setParticipantSelectorOptions(array $participantSelectorOptions): void
114  {
115  $this->participantSelectorOptions = $participantSelectorOptions;
116  }
117 
118  public function getParticipantSelectorOptions(): array
119  {
121  }
122 
123  public function getParticipantSelectorLinksArray(): array
124  {
125  $options = [];
126  foreach ($this->getParticipantSelectorOptions() as $key => $val) {
127  $options[] = $this->ui->factory()->link()->standard($val, "#participant_active_{$key}");
128  }
129 
130  return $options;
131  }
132 }
setCertificateLinkTarget(string $certificateLinkTarget)
__construct(ilCtrl $ctrl, ilGlobalTemplateInterface $tpl, ilLanguage $lng)
setHideBestSolutionsLinkTarget(string $hideBestSolutionsLinkTarget)
addComponent(\ILIAS\UI\Component\Component $a_comp)
setParticipantSelectorOptions(array $participantSelectorOptions)
setId(string $a_val)
__construct(VocabulariesInterface $vocabularies)
addButton(string $a_txt, string $a_cmd, string $a_target="", ?int $a_acc_key=null, string $a_additional_attrs='', string $a_id="", string $a_class='submit')
string $key
Consumer key/client ID value.
Definition: System.php:193
setShowBestSolutionsLinkTarget(string $showBestSolutionsLinkTarget)