ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
50 parent::__construct();
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 {
111 $headerText .= '<br /><br />'.$this->lng->txt('tst_nonpool_questions_get_lost_warning');
112 }
113
114 return $headerText;
115 }
116
117 public function build()
118 {
119 $this->setHeaderText( $this->buildHeaderText() );
120 }
121
123 {
124 foreach ($_POST as $key => $value)
125 {
126 if (strcmp($key, "cmd") != 0)
127 {
128 if (is_array($value))
129 {
130 foreach ($value as $k => $v)
131 {
132 $this->addHiddenItem("{$key}[{$k}]", $v);
133 }
134 }
135 else
136 {
137 $this->addHiddenItem($key, $value);
138 }
139 }
140 }
141 }
142
147 {
148 foreach ($form->getInputItemsRecursive() as $key => $item)
149 {
150 //vd("$key // {$item->getType()} // ".json_encode($_POST[$item->getPostVar()]));
151
152 switch( $item->getType() )
153 {
154 case 'section_header':
155
156 continue;
157
158 case 'datetime':
159
160 $datetime = $item->getDate();
161 if($datetime instanceof ilDateTime)
162 {
163 list($date, $time) = explode(' ', $datetime->get(IL_CAL_DATETIME));
164 if(!($date instanceof ilDate))
165 {
166 $this->addHiddenItem($item->getPostVar(), $date . ' ' . $time);
167 }
168 else
169 {
170 $this->addHiddenItem($item->getPostVar(), $date);
171 }
172 }
173 else
174 {
175 $this->addHiddenItem($item->getPostVar(), '');
176 }
177
178 break;
179
180 case 'duration':
181
182 $this->addHiddenItem("{$item->getPostVar()}[MM]", (int)$item->getMonths());
183 $this->addHiddenItem("{$item->getPostVar()}[dd]", (int)$item->getDays());
184 $this->addHiddenItem("{$item->getPostVar()}[hh]", (int)$item->getHours());
185 $this->addHiddenItem("{$item->getPostVar()}[mm]", (int)$item->getMinutes());
186 $this->addHiddenItem("{$item->getPostVar()}[ss]", (int)$item->getSeconds());
187
188 break;
189
190 case 'dateduration':
191
192 foreach(array("start", "end") as $type)
193 {
194 $postVar = $item->getPostVar() . '[' . $type .']';
195 $datetime = $item->{'get' . ucfirst($type)}();
196
197 if($datetime instanceof ilDateTime)
198 {
199 list($date, $time) = explode(' ', $datetime->get(IL_CAL_DATETIME));
200 if(!($date instanceof ilDate))
201 {
202 $this->addHiddenItem($postVar, $date . ' ' . $time);
203 }
204 else
205 {
206 $this->addHiddenItem($postVar, $date);
207 }
208 }
209 else
210 {
211 $this->addHiddenItem($postVar, '');
212 }
213 }
214
215 break;
216
217 case 'checkboxgroup':
218
219 if( is_array($item->getValue()) )
220 {
221 foreach( $item->getValue() as $option )
222 {
223 $this->addHiddenItem("{$item->getPostVar()}[]", $option);
224 }
225 }
226
227 break;
228
229 case 'select':
230
231 $value = $item->getValue();
232 if( !is_array($value) )
233 {
234 $value = array($value);
235 }
236 foreach( $value as $option )
237 {
238 $this->addHiddenItem("{$item->getPostVar()}[]", $option);
239 }
240
241 break;
242
243 case 'checkbox':
244
245 if( $item->getChecked() )
246 {
247 $this->addHiddenItem($item->getPostVar(), 1);
248 }
249
250 break;
251
252 default:
253
254 $this->addHiddenItem($item->getPostVar(), $item->getValue());
255 }
256 }
257 }
258}
sprintf('%.4f', $callTime)
$_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)