ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilTestSettingsChangeConfirmationGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4
5require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
6
7
15{
19 protected $lng;
20
24 protected $testOBJ;
25
30
35
40
46 {
47 $this->lng = $lng;
48 $this->testOBJ = $testOBJ;
49
51 }
52
57 {
58 $this->oldQuestionSetType = $oldQuestionSetType;
59 }
60
64 public function getOldQuestionSetType()
65 {
67 }
68
73 {
74 $this->newQuestionSetType = $newQuestionSetType;
75 }
76
80 public function getNewQuestionSetType()
81 {
83 }
84
89 {
90 $this->questionLossInfoEnabled = $questionLossInfoEnabled;
91 }
92
96 public function isQuestionLossInfoEnabled()
97 {
99 }
100
101 private function buildHeaderText()
102 {
103 $headerText = sprintf(
104 $this->lng->txt('tst_change_quest_set_type_from_old_to_new_with_conflict'),
105 $this->testOBJ->getQuestionSetTypeTranslation($this->lng, $this->getOldQuestionSetType()),
106 $this->testOBJ->getQuestionSetTypeTranslation($this->lng, $this->getNewQuestionSetType())
107 );
108
109 if ($this->isQuestionLossInfoEnabled()) {
110 $headerText .= '<br /><br />' . $this->lng->txt('tst_nonpool_questions_get_lost_warning');
111 }
112
113 return $headerText;
114 }
115
116 public function build()
117 {
118 $this->setHeaderText($this->buildHeaderText());
119 }
120
122 {
123 foreach ($_POST as $key => $value) {
124 if (strcmp($key, "cmd") != 0) {
125 if (is_array($value)) {
126 foreach ($value as $k => $v) {
127 $this->addHiddenItem("{$key}[{$k}]", $v);
128 }
129 } else {
130 $this->addHiddenItem($key, $value);
131 }
132 }
133 }
134 }
135
140 {
141 foreach ($form->getInputItemsRecursive() as $key => $item) {
142 switch ($item->getType()) {
143 case 'section_header':
144
145 continue 2;
146
147 case 'datetime':
148
149 $datetime = $item->getDate();
150 if ($datetime instanceof ilDateTime) {
151 list($date, $time) = explode(' ', $datetime->get(IL_CAL_DATETIME));
152 if (!($date instanceof ilDate)) {
153 $this->addHiddenItem($item->getPostVar(), $date . ' ' . $time);
154 } else {
155 $this->addHiddenItem($item->getPostVar(), $date);
156 }
157 } else {
158 $this->addHiddenItem($item->getPostVar(), '');
159 }
160
161 break;
162
163 case 'duration':
164
165 $this->addHiddenItem("{$item->getPostVar()}[MM]", (int) $item->getMonths());
166 $this->addHiddenItem("{$item->getPostVar()}[dd]", (int) $item->getDays());
167 $this->addHiddenItem("{$item->getPostVar()}[hh]", (int) $item->getHours());
168 $this->addHiddenItem("{$item->getPostVar()}[mm]", (int) $item->getMinutes());
169 $this->addHiddenItem("{$item->getPostVar()}[ss]", (int) $item->getSeconds());
170
171 break;
172
173 case 'dateduration':
174
175 foreach (array("start", "end") as $type) {
176 $postVar = $item->getPostVar() . '[' . $type . ']';
177 $datetime = $item->{'get' . ucfirst($type)}();
178
179 if ($datetime instanceof ilDateTime) {
180 list($date, $time) = explode(' ', $datetime->get(IL_CAL_DATETIME));
181 if (!($date instanceof ilDate)) {
182 $this->addHiddenItem($postVar, $date . ' ' . $time);
183 } else {
184 $this->addHiddenItem($postVar, $date);
185 }
186 } else {
187 $this->addHiddenItem($postVar, '');
188 }
189 }
190
191 break;
192
193 case 'checkboxgroup':
194
195 if (is_array($item->getValue())) {
196 foreach ($item->getValue() as $option) {
197 $this->addHiddenItem("{$item->getPostVar()}[]", $option);
198 }
199 }
200
201 break;
202
203 case 'select':
204
205 $value = $item->getValue();
206 if (!is_array($value)) {
207 $value = array($value);
208 }
209 foreach ($value as $option) {
210 $this->addHiddenItem("{$item->getPostVar()}[]", $option);
211 }
212
213 break;
214
215 case 'checkbox':
216
217 if ($item->getChecked()) {
218 $this->addHiddenItem($item->getPostVar(), 1);
219 }
220
221 break;
222
223 default:
224
225 $this->addHiddenItem($item->getPostVar(), $item->getValue());
226 }
227 }
228 }
229}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_DATETIME
Confirmation screen class.
setHeaderText($a_headertext)
Set Set header text.
addHiddenItem($a_post_var, $a_value)
Add hidden item.
@classDescription Date and time handling
Class for single dates.
language handling
This class represents a property form user interface.
getInputItemsRecursive()
returns a flat array of all input items including the possibly existing subitems recursively
populateParametersFromPropertyForm(ilPropertyFormGUI $form, $timezone)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$type