ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 
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  $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 
121  public function populateParametersFromPost()
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  //vd("$key // {$item->getType()} // ".json_encode($_POST[$item->getPostVar()]));
143 
144  switch ($item->getType()) {
145  case 'section_header':
146 
147  continue;
148 
149  case 'datetime':
150 
151  $datetime = $item->getDate();
152  if ($datetime instanceof ilDateTime) {
153  list($date, $time) = explode(' ', $datetime->get(IL_CAL_DATETIME));
154  if (!($date instanceof ilDate)) {
155  $this->addHiddenItem($item->getPostVar(), $date . ' ' . $time);
156  } else {
157  $this->addHiddenItem($item->getPostVar(), $date);
158  }
159  } else {
160  $this->addHiddenItem($item->getPostVar(), '');
161  }
162 
163  break;
164 
165  case 'duration':
166 
167  $this->addHiddenItem("{$item->getPostVar()}[MM]", (int) $item->getMonths());
168  $this->addHiddenItem("{$item->getPostVar()}[dd]", (int) $item->getDays());
169  $this->addHiddenItem("{$item->getPostVar()}[hh]", (int) $item->getHours());
170  $this->addHiddenItem("{$item->getPostVar()}[mm]", (int) $item->getMinutes());
171  $this->addHiddenItem("{$item->getPostVar()}[ss]", (int) $item->getSeconds());
172 
173  break;
174 
175  case 'dateduration':
176 
177  foreach (array("start", "end") as $type) {
178  $postVar = $item->getPostVar() . '[' . $type . ']';
179  $datetime = $item->{'get' . ucfirst($type)}();
180 
181  if ($datetime instanceof ilDateTime) {
182  list($date, $time) = explode(' ', $datetime->get(IL_CAL_DATETIME));
183  if (!($date instanceof ilDate)) {
184  $this->addHiddenItem($postVar, $date . ' ' . $time);
185  } else {
186  $this->addHiddenItem($postVar, $date);
187  }
188  } else {
189  $this->addHiddenItem($postVar, '');
190  }
191  }
192 
193  break;
194 
195  case 'checkboxgroup':
196 
197  if (is_array($item->getValue())) {
198  foreach ($item->getValue() as $option) {
199  $this->addHiddenItem("{$item->getPostVar()}[]", $option);
200  }
201  }
202 
203  break;
204 
205  case 'select':
206 
207  $value = $item->getValue();
208  if (!is_array($value)) {
209  $value = array($value);
210  }
211  foreach ($value as $option) {
212  $this->addHiddenItem("{$item->getPostVar()}[]", $option);
213  }
214 
215  break;
216 
217  case 'checkbox':
218 
219  if ($item->getChecked()) {
220  $this->addHiddenItem($item->getPostVar(), 1);
221  }
222 
223  break;
224 
225  default:
226 
227  $this->addHiddenItem($item->getPostVar(), $item->getValue());
228  }
229  }
230  }
231 }
addHiddenItem($a_post_var, $a_value)
Add hidden item.
const IL_CAL_DATETIME
This class represents a property form user interface.
$type
populateParametersFromPropertyForm(ilPropertyFormGUI $form, $timezone)
$time
Definition: cron.php:21
Class for single dates.
if(isset($_POST['submit'])) $form
Date and time handling
Create styles array
The data for the language used.
setHeaderText($a_headertext)
Set Set header text.
getInputItemsRecursive()
returns a flat array of all input items including the possibly existing subitems recursively ...
language handling
$key
Definition: croninfo.php:18
$_POST["username"]
Confirmation screen class.