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 'ilconditionhandlerinterface':
62 include_once
'./Services/AccessControl/classes/class.ilConditionHandlerInterface.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'];
241 $this->form->setValuesByArray(
$data);
255 if(!$ilAccess->checkAccess(
'write',
'',$this->parent_ref_id) &&
256 !$ilAccess->checkAccess(
'write',
'',$this->
getItemId()))
258 $ilErr->raiseError($this->lng->txt(
'permission_denied'),$ilErr->MESSAGE);
262 if($this->form->checkInput())
264 include_once
"Services/Object/classes/class.ilObjectActivation.php";
267 $activation->setTimingType($this->form->getInput(
'timing_type'));
269 $date = $this->form->getInput(
'timing_start');
271 $activation->setTimingStart($date->get(
IL_CAL_UNIX));
273 $date = $this->form->getInput(
'timing_end');
275 $activation->setTimingEnd($date->get(
IL_CAL_UNIX));
277 $date = $this->form->getInput(
'sug_start');
279 $activation->setSuggestionStart($date->get(
IL_CAL_UNIX));
281 $date = $this->form->getInput(
'sug_end');
283 $activation->setSuggestionEnd($date->get(
IL_CAL_UNIX));
285 $date = $this->form->getInput(
'early_start');
287 $activation->setEarliestStart($date->get(
IL_CAL_UNIX));
289 $date = $this->form->getInput(
'late_end');
291 $activation->setLatestEnd($date->get(
IL_CAL_UNIX));
293 $activation->toggleVisible((
bool) $this->form->getInput(
'visible'));
294 $activation->toggleChangeable((
bool) $this->form->getInput(
'changeable'));
296 if(!$activation->validateActivation())
299 $this->form->setValuesByPost();
300 $tpl->setContent($this->form->getHTML());
307 $this->ctrl->redirect($this,
"edit");
312 $this->form->setValuesByPost();
313 $tpl->setContent($this->form->getHTML());
321 $this->tabs_gui->clearTargets();
323 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id", $this->parent_ref_id);
324 $back_link = $ilCtrl->getLinkTargetByClass(
"ilrepositorygui",
"");
325 $ilCtrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
$_GET[
"ref_id"]);
326 $this->tabs_gui->setBackTarget($this->lng->txt(
'btn_back'), $back_link);
328 $this->tabs_gui->addTarget(
"timings",
329 $this->ctrl->getLinkTarget($this,
'edit'),
330 "edit", get_class($this));
332 $this->ctrl->setParameterByClass(
'ilconditionhandlerinterface',
'item_id',$this->item_id);
333 $this->tabs_gui->addTarget(
"preconditions",
334 $this->ctrl->getLinkTargetByClass(
'ilConditionHandlerInterface',
'listConditions'),
335 "",
"ilConditionHandlerInterface");