31 $this->lng->loadLanguageModule(
'crs');
33 $this->tabs_gui =& $ilTabs;
35 $this->parent_ref_id = $a_ref_id;
36 $this->item_id = $a_item_id;
37 $this->ctrl->saveParameter($this,
'item_id');
47 $cmd = $this->ctrl->getCmd();
53 $this->ctrl->returnToParent($this);
56 $tpl->getStandardTemplate();
58 switch($this->ctrl->getNextClass($this))
60 case 'ilconditionhandlergui':
62 include_once
'./Services/AccessControl/classes/class.ilConditionHandlerGUI.php';
63 $this->ctrl->saveParameter($this,
'item_id',
$_GET[
'item_id']);
65 $this->ctrl->forwardCommand($new_gui);
66 $this->tabs_gui->setTabActive(
'preconditions');
70 $this->tabs_gui->setTabActive(
'timings');
76 $this->tabs_gui->setTabActive(
'timings');
90 $this->ctrl->setParameterByClass(
'ilrepositorygui',
'ref_id', $this->parent_ref_id);
91 $this->ctrl->redirectByClass(
'ilrepositorygui');
105 if(!$ilAccess->checkAccess(
'write',
'',$this->parent_ref_id) &&
106 !$ilAccess->checkAccess(
'write',
'',$this->
getItemId()))
108 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->MESSAGE);
114 $tpl->setContent($this->form->getHTML());
127 include_once
"Services/Object/classes/class.ilObjectActivation.php";
129 include_once(
'./Services/Form/classes/class.ilPropertyFormGUI.php');
131 $this->form->setFormAction($this->ctrl->getFormAction($this));
134 $this->form->setTitle($title.
': '.$this->lng->txt(
'crs_edit_timings'));
140 $dea->
setInfo($this->lng->txt(
'crs_timings_disabled_info'));
141 $timings->addOption($dea);
145 #$vis->setInfo($this->lng->txt('crs_timings_visibility'));
148 $start->setShowTime(
true);
149 #$start->setMinuteStepSize(5);
154 #$end->setMinuteStepSize(5);
155 $vis->addSubItem($end);
157 $isv =
new ilCheckboxInputGUI($this->lng->txt(
'crs_timings_visibility_short'),
'visible');
158 $isv->
setInfo($this->lng->txt(
'crs_timings_visibility'));
160 $vis->addSubItem($isv);
162 $timings->addOption($vis);
166 $tim->
setInfo($this->lng->txt(
'crs_item_presetting_info'));
168 $start =
new ilDateTimeInputGUI($this->lng->txt(
'crs_timings_sug_begin'),
'sug_start');
174 if ($tree->checkForParentType($this->parent_ref_id,
'crs'))
176 $cha =
new ilCheckboxInputGUI($this->lng->txt(
'crs_timings_changeable'),
'changeable');
179 $start =
new ilDateTimeInputGUI($this->lng->txt(
'crs_timings_early_begin'),
'early_start');
182 $late =
new ilDateTimeInputGUI($this->lng->txt(
'crs_timings_short_limit_start_end'),
'late_end');
187 $timings->addOption($tim);
189 $this->form->addItem($timings);
191 $this->form->addCommandButton(
'update',$this->lng->txt(
'save'));
192 $this->form->addCommandButton(
'cancel',$this->lng->txt(
'cancel'));
205 include_once
"Services/Object/classes/class.ilObjectActivation.php";
216 $data[
'timing_type'] = $item_data[
'timing_type'];
217 $data[
'visible'] = $item_data[
'visible'];
218 $data[
'changeable'] = $item_data[
'changeable'];
221 if($item_data[
'timing_start'] < 1)
223 $item_data[
'timing_start'] = time();
225 if($item_data[
'timing_end'] < 1)
227 $item_data[
'timing_end'] = time();
231 $data[
'timing_start'][
'date'] = $start->get(
IL_CAL_FKT_DATE,
'Y-m-d',$ilUser->getTimeZone());
232 $data[
'timing_start'][
'time'] = $start->get(
IL_CAL_FKT_DATE,
'H:i:s',$ilUser->getTimeZone());
235 $data[
'timing_end'][
'date'] = $end->get(
IL_CAL_FKT_DATE,
'Y-m-d',$ilUser->getTimeZone());
236 $data[
'timing_end'][
'time'] = $end->get(
IL_CAL_FKT_DATE,
'H:i:s',$ilUser->getTimeZone());
239 $data[
'sug_start'][
'date'] = $start->get(
IL_CAL_FKT_DATE,
'Y-m-d',
'UTC');
245 $data[
'early_start'][
'date'] = $start->get(
IL_CAL_FKT_DATE,
'Y-m-d',
'UTC');
251 $this->form->setValuesByArray($data);
265 if(!$ilAccess->checkAccess(
'write',
'',$this->parent_ref_id) &&
266 !$ilAccess->checkAccess(
'write',
'',$this->
getItemId()))
268 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->MESSAGE);
272 if($this->form->checkInput())
274 include_once
"Services/Object/classes/class.ilObjectActivation.php";
277 $activation->setTimingType($this->form->getInput(
'timing_type'));
279 $date = $this->form->getInput(
'timing_start');
281 $activation->setTimingStart($date->get(
IL_CAL_UNIX));
283 $date = $this->form->getInput(
'timing_end');
285 $activation->setTimingEnd($date->get(
IL_CAL_UNIX));
287 $date = $this->form->getInput(
'sug_start');
289 $activation->setSuggestionStart($date->get(
IL_CAL_UNIX));
291 $date = $this->form->getInput(
'sug_end');
293 $activation->setSuggestionEnd($date->get(
IL_CAL_UNIX));
295 $date = $this->form->getInput(
'early_start');
297 $activation->setEarliestStart($date->get(
IL_CAL_UNIX));
299 $date = $this->form->getInput(
'late_end');
301 $activation->setLatestEnd($date->get(
IL_CAL_UNIX));
303 $activation->toggleVisible((
bool) $this->form->getInput(
'visible'));
304 $activation->toggleChangeable((
bool) $this->form->getInput(
'changeable'));
306 if(!$activation->validateActivation())
309 $this->form->setValuesByPost();
310 $tpl->setContent($this->form->getHTML());
317 $this->ctrl->redirect($this,
"edit");
322 $this->form->setValuesByPost();
323 $tpl->setContent($this->form->getHTML());
331 $this->tabs_gui->clearTargets();
333 $ilHelp->setScreenIdComponent(
"obj");
335 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id", $this->parent_ref_id);
336 $back_link = $ilCtrl->getLinkTargetByClass(
"ilrepositorygui",
"");
337 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
$_GET[
"ref_id"]);
338 $this->tabs_gui->setBackTarget($this->lng->txt(
'btn_back'), $back_link);
340 $this->tabs_gui->addTarget(
"timings",
341 $this->ctrl->getLinkTarget($this,
'edit'),
342 "edit", get_class($this));
344 $this->ctrl->setParameterByClass(
'ilconditionhandlergui',
'item_id',$this->item_id);
345 $this->tabs_gui->addTarget(
"preconditions",
346 $this->ctrl->getLinkTargetByClass(
'ilConditionHandlerGUI',
'listConditions'),
347 "",
"ilConditionHandlerGUI");