ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
5 require_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  {
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 
122  public function populateParametersFromPost()
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 
146  public function populateParametersFromPropertyForm(ilPropertyFormGUI $form, $timezone)
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  list($date, $time) = explode(' ', $item->getDate()->get(IL_CAL_DATETIME));
161 
162  if( $item->getMode() == ilDateTimeInputGUI::MODE_SELECT )
163  {
164  list($y, $m, $d) = explode('-', $date);
165 
166  $this->addHiddenItem("{$item->getPostVar()}[date][y]", $y);
167  $this->addHiddenItem("{$item->getPostVar()}[date][m]", $m);
168  $this->addHiddenItem("{$item->getPostVar()}[date][d]", $d);
169 
170  if( $item->getShowTime() )
171  {
172  list($h, $m, $s) = explode('-', $time);
173 
174  $this->addHiddenItem("{$item->getPostVar()}[time][h]", $h);
175  $this->addHiddenItem("{$item->getPostVar()}[time][m]", $m);
176  $this->addHiddenItem("{$item->getPostVar()}[time][s]", $s);
177  }
178  }
179  else
180  {
181  $this->addHiddenItem("{$item->getPostVar()}[date]", $date);
182  $this->addHiddenItem("{$item->getPostVar()}[time]", $time);
183  }
184 
185  break;
186 
187  case 'duration':
188 
189  $this->addHiddenItem("{$item->getPostVar()}[MM]", (int)$item->getMonths());
190  $this->addHiddenItem("{$item->getPostVar()}[dd]", (int)$item->getDays());
191  $this->addHiddenItem("{$item->getPostVar()}[hh]", (int)$item->getHours());
192  $this->addHiddenItem("{$item->getPostVar()}[mm]", (int)$item->getMinutes());
193  $this->addHiddenItem("{$item->getPostVar()}[ss]", (int)$item->getSeconds());
194 
195  break;
196 
197  case 'dateduration':
198 
199  $this->addHiddenItem(
200  "{$item->getPostVar()}[start][date][y]",
201  (int) $item->getStart()->get(IL_CAL_FKT_DATE,'Y',$timezone)
202  );
203  $this->addHiddenItem(
204  "{$item->getPostVar()}[start][date][m]",
205  (int) $item->getStart()->get(IL_CAL_FKT_DATE,'m',$timezone)
206  );
207  $this->addHiddenItem(
208  "{$item->getPostVar()}[start][date][d]",
209  (int) $item->getStart()->get(IL_CAL_FKT_DATE,'d',$timezone)
210  );
211  $this->addHiddenItem(
212  "{$item->getPostVar()}[start][time][h]",
213  (int) $item->getStart()->get(IL_CAL_FKT_DATE,'H',$timezone)
214  );
215  $this->addHiddenItem(
216  "{$item->getPostVar()}[start][time][m]",
217  (int) $item->getStart()->get(IL_CAL_FKT_DATE,'i',$timezone)
218  );
219  $this->addHiddenItem(
220  "{$item->getPostVar()}[start][time][s]",
221  (int) $item->getStart()->get(IL_CAL_FKT_DATE,'s',$timezone)
222  );
223  $this->addHiddenItem(
224  "{$item->getPostVar()}[end][date][y]",
225  (int) $item->getEnd()->get(IL_CAL_FKT_DATE,'Y',$timezone)
226  );
227  $this->addHiddenItem(
228  "{$item->getPostVar()}[end][date][m]",
229  (int) $item->getEnd()->get(IL_CAL_FKT_DATE,'m',$timezone)
230  );
231  $this->addHiddenItem(
232  "{$item->getPostVar()}[end][date][d]",
233  (int) $item->getEnd()->get(IL_CAL_FKT_DATE,'d',$timezone)
234  );
235  $this->addHiddenItem(
236  "{$item->getPostVar()}[end][time][h]",
237  (int) $item->getEnd()->get(IL_CAL_FKT_DATE,'H',$timezone)
238  );
239  $this->addHiddenItem(
240  "{$item->getPostVar()}[end][time][m]",
241  (int) $item->getEnd()->get(IL_CAL_FKT_DATE,'i',$timezone)
242  );
243  $this->addHiddenItem(
244  "{$item->getPostVar()}[end][time][s]",
245  (int) $item->getEnd()->get(IL_CAL_FKT_DATE,'s',$timezone)
246  );
247 
248  break;
249 
250  case 'checkboxgroup':
251 
252  if( is_array($item->getValue()) )
253  {
254  foreach( $item->getValue() as $option )
255  {
256  $this->addHiddenItem("{$item->getPostVar()}[]", $option);
257  }
258  }
259 
260  break;
261 
262  case 'checkbox':
263 
264  if( $item->getChecked() )
265  {
266  $this->addHiddenItem($item->getPostVar(), 1);
267  }
268 
269  break;
270 
271  default:
272 
273  $this->addHiddenItem($item->getPostVar(), $item->getValue());
274  }
275  }
276  }
277 }