ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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
59
61 {
62 $this->ctrl = $ctrl;
63 $this->tpl = $tpl;
64 $this->lng = $lng;
65
66 parent::__construct();
67 }
68
69 public function build()
70 {
71 $this->setId('tst_results_toolbar');
72
73 if ($this->isSkillResultButtonEnabled()) {
74 require_once 'Modules/Test/classes/class.ilTestSkillEvaluationGUI.php';
75
76 $link = ilLinkButton::getInstance(); // always returns a new instance
77 $link->setUrl($this->ctrl->getLinkTargetByClass('ilTestSkillEvaluationGUI', ilTestSkillEvaluationGUI::CMD_SHOW));
78 $link->setCaption($this->lng->txt("tst_show_comp_results"), false);
79 $this->addButtonInstance($link);
80
81 $this->addSeparator();
82 }
83
84 $this->addButton($this->lng->txt('print'), 'javascript:window.print();');
85
86 if (strlen($this->getPdfExportLinkTarget())) {
87 require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
88 $link = ilLinkButton::getInstance(); // always returns a new instance
89 $link->setUrl($this->getPdfExportLinkTarget());
90 $link->setCaption($this->getPdfExportLabel(), false);
91 $link->setOmitPreventDoubleSubmission(true);
92 $this->addButtonInstance($link);
93 }
94
95 if (strlen($this->getCertificateLinkTarget())) {
96 $this->addButton($this->lng->txt('certificate'), $this->getCertificateLinkTarget());
97 }
98
99 if (strlen($this->getShowBestSolutionsLinkTarget())) {
100 $this->addSeparator();
101 $this->addButton($this->lng->txt('tst_btn_show_best_solutions'), $this->getShowBestSolutionsLinkTarget());
102 } elseif (strlen($this->getHideBestSolutionsLinkTarget())) {
103 $this->addSeparator();
104 $this->addButton($this->lng->txt('tst_btn_hide_best_solutions'), $this->getHideBestSolutionsLinkTarget());
105 }
106
107 if (count($this->getParticipantSelectorOptions())) {
108 $this->addSeparator();
109
110 require_once 'Services/Form/classes/class.ilSelectInputGUI.php';
111 $sel = new ilSelectInputGUI('', 'active_id');
112 $sel->setOptions($this->getParticipantSelectorOptionsWithHintOption());
113 $this->addInputItem($sel);
114
115 $link = ilLinkButton::getInstance(); // always returns a new instance
116 $link->setUrl('#');
117 $link->setId('ilTestResultParticipantJumper');
118 $link->setCaption($this->lng->txt('tst_res_jump_to_participant_btn'), false);
119 $this->addButtonInstance($link);
120
121 $this->tpl->addJavaScript('Modules/Test/js/ilTestResultParticipantSelector.js');
122 }
123 }
124
125 private function getPdfExportLabel()
126 {
127 return $this->lng->txt('pdf_export');
128 }
129
131 {
132 $this->pdfExportLinkTarget = $pdfExportLinkTarget;
133 }
134
135 public function getPdfExportLinkTarget()
136 {
138 }
139
141 {
142 $this->certificateLinkTarget = $certificateLinkTarget;
143 }
144
145 public function getCertificateLinkTarget()
146 {
148 }
149
151 {
152 $this->showBestSolutionsLinkTarget = $showBestSolutionsLinkTarget;
153 }
154
156 {
158 }
159
161 {
162 $this->hideBestSolutionsLinkTarget = $hideBestSolutionsLinkTarget;
163 }
164
166 {
168 }
169
171 {
172 $this->participantSelectorOptions = $participantSelectorOptions;
173 }
174
176 {
178 }
179
181 {
182 $options = array($this->lng->txt('tst_res_jump_to_participant_hint_opt'));
183
184 if (function_exists('array_replace')) {
185 return array_replace($options, $this->getParticipantSelectorOptions());
186 }
187
188 foreach ($this->getParticipantSelectorOptions() as $key => $val) {
189 $options[$key] = $val;
190 }
191
192 return $options;
193 }
194
196 {
198 }
199
201 {
202 $this->skillResultButtonEnabled = $skillResultButtonEnabled;
203 }
204}
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
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.
special template class to simplify handling of ITX/PEAR
setSkillResultButtonEnabled($skillResultButtonEnabled)
__construct(ilCtrl $ctrl, ilTemplate $tpl, ilLanguage $lng)
setParticipantSelectorOptions($participantSelectorOptions)
setHideBestSolutionsLinkTarget($hideBestSolutionsLinkTarget)
setShowBestSolutionsLinkTarget($showBestSolutionsLinkTarget)
setPdfExportLinkTarget($pdfExportLinkTarget)
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.
$key
Definition: croninfo.php:18