ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 {
75 require_once 'Modules/Test/classes/class.ilTestSkillEvaluationGUI.php';
76
77 $link = ilLinkButton::getInstance(); // always returns a new instance
78 $link->setUrl($this->ctrl->getLinkTargetByClass('ilTestSkillEvaluationGUI', ilTestSkillEvaluationGUI::CMD_SHOW));
79 $link->setCaption($this->lng->txt("tst_show_comp_results"), false);
80 $this->addButtonInstance($link);
81
82 $this->addSeparator();
83 }
84
85 $this->addButton($this->lng->txt('print'), 'javascript:window.print();');
86
87 if( strlen($this->getPdfExportLinkTarget()) )
88 {
89 require_once 'Services/UIComponent/Button/classes/class.ilLinkButton.php';
90 $link = ilLinkButton::getInstance(); // always returns a new instance
91 $link->setUrl($this->getPdfExportLinkTarget());
92 $link->setCaption($this->getPdfExportLabel(), false);
93 $link->setOmitPreventDoubleSubmission(true);
94 $this->addButtonInstance($link);
95 }
96
97 if( strlen($this->getCertificateLinkTarget()) )
98 {
99 $this->addButton( $this->lng->txt('certificate'), $this->getCertificateLinkTarget() );
100 }
101
102 if( strlen($this->getShowBestSolutionsLinkTarget()) )
103 {
104 $this->addSeparator();
105 $this->addButton( $this->lng->txt('tst_btn_show_best_solutions'), $this->getShowBestSolutionsLinkTarget() );
106 }
107 elseif( strlen($this->getHideBestSolutionsLinkTarget()) )
108 {
109 $this->addSeparator();
110 $this->addButton( $this->lng->txt('tst_btn_hide_best_solutions'), $this->getHideBestSolutionsLinkTarget() );
111 }
112
113 if( count($this->getParticipantSelectorOptions()) )
114 {
115 $this->addSeparator();
116
117 require_once 'Services/Form/classes/class.ilSelectInputGUI.php';
118 $sel = new ilSelectInputGUI('', 'active_id');
119 $sel->setOptions($this->getParticipantSelectorOptionsWithHintOption());
120 $this->addInputItem($sel);
121
122 $link = ilLinkButton::getInstance(); // always returns a new instance
123 $link->setUrl('#');
124 $link->setId('ilTestResultParticipantJumper');
125 $link->setCaption($this->lng->txt('tst_res_jump_to_participant_btn'), false);
126 $this->addButtonInstance($link);
127
128 $this->tpl->addJavaScript('Modules/Test/js/ilTestResultParticipantSelector.js');
129 }
130 }
131
132 private function getPdfExportLabel()
133 {
134 return $this->lng->txt('pdf_export');
135 }
136
138 {
139 $this->pdfExportLinkTarget = $pdfExportLinkTarget;
140 }
141
142 public function getPdfExportLinkTarget()
143 {
145 }
146
148 {
149 $this->certificateLinkTarget = $certificateLinkTarget;
150 }
151
152 public function getCertificateLinkTarget()
153 {
155 }
156
158 {
159 $this->showBestSolutionsLinkTarget = $showBestSolutionsLinkTarget;
160 }
161
163 {
165 }
166
168 {
169 $this->hideBestSolutionsLinkTarget = $hideBestSolutionsLinkTarget;
170 }
171
173 {
175 }
176
178 {
179 $this->participantSelectorOptions = $participantSelectorOptions;
180 }
181
183 {
185 }
186
188 {
189 $options = array($this->lng->txt('tst_res_jump_to_participant_hint_opt'));
190
191 if( function_exists('array_replace') )
192 {
193 return array_replace($options, $this->getParticipantSelectorOptions());
194 }
195
196 foreach($this->getParticipantSelectorOptions() as $key => $val)
197 {
198 $options[$key] = $val;
199 }
200
201 return $options;
202 }
203
205 {
207 }
208
210 {
211 $this->skillResultButtonEnabled = $skillResultButtonEnabled;
212 }
213}
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.
if(!is_array($argv)) $options