ILIAS  release_8 Revision v8.24
class.ilTestResultsToolbarGUI.php
Go to the documentation of this file.
1<?php
2
26{
27 public ilCtrl $ctrl;
29
30 private ?string $pdfExportLinkTarget = null;
31 private ?string $certificateLinkTarget = null;
32 private ?string $showBestSolutionsLinkTarget = null;
33 private ?string $hideBestSolutionsLinkTarget = null;
34 private array $participantSelectorOptions = array();
35
37 {
38 $this->ctrl = $ctrl;
39 $this->tpl = $tpl;
41 }
42
43 public function build(): void
44 {
45 $this->setId('tst_results_toolbar');
46
47 $this->addButton($this->lng->txt('print'), 'javascript:window.print();');
48
49 if (strlen($this->getPdfExportLinkTarget())) {
50 require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
51 $link = ilLinkButton::getInstance(); // always returns a new instance
52 $link->setUrl($this->getPdfExportLinkTarget());
53 $link->setCaption($this->getPdfExportLabel(), false);
54 $link->setOmitPreventDoubleSubmission(true);
55 $this->addButtonInstance($link);
56 }
57
58 if (strlen($this->getCertificateLinkTarget())) {
59 $this->addButton($this->lng->txt('certificate'), $this->getCertificateLinkTarget());
60 }
61
62 if (strlen($this->getShowBestSolutionsLinkTarget())) {
63 $this->addSeparator();
64 $this->addButton($this->lng->txt('tst_btn_show_best_solutions'), $this->getShowBestSolutionsLinkTarget());
65 } elseif (strlen($this->getHideBestSolutionsLinkTarget())) {
66 $this->addSeparator();
67 $this->addButton($this->lng->txt('tst_btn_hide_best_solutions'), $this->getHideBestSolutionsLinkTarget());
68 }
69
70 if (count($this->getParticipantSelectorOptions())) {
71 $this->addSeparator();
72
73 require_once 'Services/Form/classes/class.ilSelectInputGUI.php';
74 $sel = new ilSelectInputGUI('', 'active_id');
75 $sel->setOptions($this->getParticipantSelectorOptionsWithHintOption());
76 $this->addInputItem($sel);
77
78 $link = ilLinkButton::getInstance(); // always returns a new instance
79 $link->setUrl('#');
80 $link->setId('ilTestResultParticipantJumper');
81 $link->setCaption($this->lng->txt('tst_res_jump_to_participant_btn'), false);
82 $this->addButtonInstance($link);
83
84 $this->tpl->addJavaScript('Modules/Test/js/ilTestResultParticipantSelector.js');
85 }
86 }
87
88 private function getPdfExportLabel(): string
89 {
90 return $this->lng->txt('pdf_export');
91 }
92
93 public function setPdfExportLinkTarget(string $pdfExportLinkTarget): void
94 {
95 $this->pdfExportLinkTarget = $pdfExportLinkTarget;
96 }
97
98 public function getPdfExportLinkTarget(): ?string
99 {
101 }
102
104 {
105 $this->certificateLinkTarget = $certificateLinkTarget;
106 }
107
108 public function getCertificateLinkTarget(): ?string
109 {
111 }
112
114 {
115 $this->showBestSolutionsLinkTarget = $showBestSolutionsLinkTarget;
116 }
117
118 public function getShowBestSolutionsLinkTarget(): ?string
119 {
121 }
122
124 {
125 $this->hideBestSolutionsLinkTarget = $hideBestSolutionsLinkTarget;
126 }
127
128 public function getHideBestSolutionsLinkTarget(): ?string
129 {
131 }
132
134 {
135 $this->participantSelectorOptions = $participantSelectorOptions;
136 }
137
138 public function getParticipantSelectorOptions(): array
139 {
141 }
142
144 {
145 $options = array($this->lng->txt('tst_res_jump_to_participant_hint_opt'));
146
147 if (function_exists('array_replace')) {
148 return array_replace($options, $this->getParticipantSelectorOptions());
149 }
150
151 foreach ($this->getParticipantSelectorOptions() as $key => $val) {
152 $options[$key] = $val;
153 }
154
155 return $options;
156 }
157}
Class ilCtrl provides processing control methods.
language handling
This class represents a selection list property in a property form.
setCertificateLinkTarget(string $certificateLinkTarget)
setShowBestSolutionsLinkTarget(string $showBestSolutionsLinkTarget)
setHideBestSolutionsLinkTarget(string $hideBestSolutionsLinkTarget)
setPdfExportLinkTarget(string $pdfExportLinkTarget)
__construct(ilCtrl $ctrl, ilGlobalTemplateInterface $tpl, ilLanguage $lng)
setParticipantSelectorOptions(array $participantSelectorOptions)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addButtonInstance(ilButtonBase $a_button)
Add button instance.
setId(string $a_val)
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')
addInputItem(ilToolbarItem $a_item, bool $a_output_label=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
string $key
Consumer key/client ID value.
Definition: System.php:193