ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilTestResultsToolbarGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once 'Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
5require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
6
14{
18 public $ctrl = null;
19
23 public $tpl = null;
24
28 public $lng = null;
29
33 private $pdfExportLinkTarget = null;
34
38 private $certificateLinkTarget = null;
39
44
49
53 private $participantSelectorOptions = array();
54
56 {
57 $this->ctrl = $ctrl;
58 $this->tpl = $tpl;
59 $this->lng = $lng;
60
62 }
63
64 public function build()
65 {
66 $this->setId('tst_results_toolbar');
67
68 $this->addButton($this->lng->txt('print'), 'javascript:window.print();');
69
70 if (strlen($this->getPdfExportLinkTarget())) {
71 require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
72 $link = ilLinkButton::getInstance(); // always returns a new instance
73 $link->setUrl($this->getPdfExportLinkTarget());
74 $link->setCaption($this->getPdfExportLabel(), false);
75 $link->setOmitPreventDoubleSubmission(true);
76 $this->addButtonInstance($link);
77 }
78
79 if (strlen($this->getCertificateLinkTarget())) {
80 $this->addButton($this->lng->txt('certificate'), $this->getCertificateLinkTarget());
81 }
82
83 if (strlen($this->getShowBestSolutionsLinkTarget())) {
84 $this->addSeparator();
85 $this->addButton($this->lng->txt('tst_btn_show_best_solutions'), $this->getShowBestSolutionsLinkTarget());
86 } elseif (strlen($this->getHideBestSolutionsLinkTarget())) {
87 $this->addSeparator();
88 $this->addButton($this->lng->txt('tst_btn_hide_best_solutions'), $this->getHideBestSolutionsLinkTarget());
89 }
90
91 if (count($this->getParticipantSelectorOptions())) {
92 $this->addSeparator();
93
94 require_once 'Services/Form/classes/class.ilSelectInputGUI.php';
95 $sel = new ilSelectInputGUI('', 'active_id');
96 $sel->setOptions($this->getParticipantSelectorOptionsWithHintOption());
97 $this->addInputItem($sel);
98
99 $link = ilLinkButton::getInstance(); // always returns a new instance
100 $link->setUrl('#');
101 $link->setId('ilTestResultParticipantJumper');
102 $link->setCaption($this->lng->txt('tst_res_jump_to_participant_btn'), false);
103 $this->addButtonInstance($link);
104
105 $this->tpl->addJavaScript('Modules/Test/js/ilTestResultParticipantSelector.js');
106 }
107 }
108
109 private function getPdfExportLabel()
110 {
111 return $this->lng->txt('pdf_export');
112 }
113
115 {
116 $this->pdfExportLinkTarget = $pdfExportLinkTarget;
117 }
118
119 public function getPdfExportLinkTarget()
120 {
122 }
123
125 {
126 $this->certificateLinkTarget = $certificateLinkTarget;
127 }
128
129 public function getCertificateLinkTarget()
130 {
132 }
133
135 {
136 $this->showBestSolutionsLinkTarget = $showBestSolutionsLinkTarget;
137 }
138
140 {
142 }
143
145 {
146 $this->hideBestSolutionsLinkTarget = $hideBestSolutionsLinkTarget;
147 }
148
150 {
152 }
153
155 {
156 $this->participantSelectorOptions = $participantSelectorOptions;
157 }
158
160 {
162 }
163
165 {
166 $options = array($this->lng->txt('tst_res_jump_to_participant_hint_opt'));
167
168 if (function_exists('array_replace')) {
169 return array_replace($options, $this->getParticipantSelectorOptions());
170 }
171
172 foreach ($this->getParticipantSelectorOptions() as $key => $val) {
173 $options[$key] = $val;
174 }
175
176 return $options;
177 }
178}
An exception for terminatinating execution or to throw for unit testing.
This class provides processing control methods.
language handling
static getInstance()
Factory.
This class represents a selection list property in a property form.
setParticipantSelectorOptions($participantSelectorOptions)
setHideBestSolutionsLinkTarget($hideBestSolutionsLinkTarget)
setShowBestSolutionsLinkTarget($showBestSolutionsLinkTarget)
setPdfExportLinkTarget($pdfExportLinkTarget)
__construct(ilCtrl $ctrl, ilGlobalTemplateInterface $tpl, ilLanguage $lng)
setCertificateLinkTarget($certificateLinkTarget)
addButtonInstance(ilButtonBase $a_button)
Add button instance.
setId($a_val)
Set id.
addInputItem(ilToolbarItem $a_item, $a_output_label=false)
Add input item.
addButton( $a_txt, $a_cmd, $a_target="", $a_acc_key="", $a_additional_attrs='', $a_id="", $a_class='submit')
Add button to toolbar.
addSeparator()
Add separator.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc