19 declare(strict_types=1);
52 $this->tpl = $DIC->ui()->mainTemplate();
53 $this->
ctrl = $DIC->ctrl();
54 $this->
lng = $DIC->language();
55 $this->
lng->loadLanguageModule(
'crs');
56 $this->error = $DIC[
'ilErr'];
57 $this->tabs_gui = $DIC->tabs();
58 $this->
access = $DIC->access();
59 $this->tree = $DIC->repositoryTree();
60 $this->
user = $DIC->user();
61 $this->
help = $DIC[
"ilHelp"];
62 $this->request_wrapper = $DIC->http()->wrapper()->query();
68 $this->
ctrl->saveParameter($this,
'item_id');
75 $cmd = $this->
ctrl->getCmd();
78 if (!$this->item_id) {
79 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"crs_no_item_id_given"),
true);
80 $this->
ctrl->returnToParent($this);
83 $this->tpl->loadStandardTemplate();
85 switch ($this->
ctrl->getNextClass($this)) {
86 case 'ilconditionhandlergui':
88 $this->
ctrl->saveParameter($this,
'item_id');
89 $item_id = $this->request_wrapper->retrieve(
"item_id", $this->
refinery->kindlyTo()->int());
91 $this->
ctrl->forwardCommand($new_gui);
92 $this->tabs_gui->setTabActive(
'preconditions');
98 $this->tabs_gui->setTabActive(
'timings');
103 $this->tabs_gui->setTabActive(
'timings');
107 $this->tpl->printToStdout();
132 $this->
ctrl->setParameterByClass(
'ilrepositorygui',
'ref_id', $this->parent_ref_id);
133 $this->
ctrl->redirectByClass(
'ilrepositorygui');
140 !$this->
access->checkAccess(
'write',
'', $this->parent_ref_id) &&
143 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
148 if ($this->tree->checkForParentType($this->getParentId(),
'crs')) {
150 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
'crs_timings_warning_timing_exists'));
156 $this->tpl->setContent($form->getHTML());
162 $form->setFormAction($this->
ctrl->getFormAction($this));
164 $title = htmlspecialchars(
166 ENT_QUOTES | ENT_SUBSTITUTE,
169 $form->setTitle($title .
': ' . $this->
lng->txt(
'crs_edit_timings'));
171 $availability =
new ilCheckboxInputGUI($this->
lng->txt(
'crs_timings_availability_enabled'),
'availability');
177 $start->setShowTime(
true);
178 $availability->addSubItem($start);
182 $end->setShowTime(
true);
183 $availability->addSubItem($end);
186 $isv->
setInfo($this->
lng->txt(
'crs_timings_visibility'));
189 $availability->addSubItem($isv);
191 $form->addItem($availability);
193 $form->addCommandButton(
'update', $this->
lng->txt(
'save'));
194 $form->addCommandButton(
'cancel', $this->
lng->txt(
'cancel'));
203 !$this->
access->checkAccess(
'write',
'', $this->parent_ref_id) &&
206 $this->error->raiseError($this->
lng->txt(
'permission_denied'), $this->error->MESSAGE);
210 if ($form->checkInput()) {
215 if ($form->getInput(
'availability')) {
218 $timing_start = $form->getItemByPostVar(
'timing_start')->getDate();
219 $timing_end = $form->getItemByPostVar(
'timing_end')->getDate();
222 $form->getItemByPostVar(
'timing_start')->setAlert($this->
lng->txt(
'crs_timing_err_start_end'));
223 $form->getItemByPostVar(
'timing_end')->setAlert($this->
lng->txt(
'crs_timing_err_start_end'));
230 $this->
getActivation()->toggleVisible((
bool) $form->getInput(
'visible'));
237 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
238 $this->
ctrl->redirect($this,
"edit");
240 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'form_input_not_valid'));
244 $form->setValuesByPost();
250 $this->tabs_gui->clearTargets();
252 $this->
help->setScreenIdComponent(
"obj");
254 $this->
ctrl->setParameterByClass(
"ilrepositorygui",
"ref_id", $this->parent_ref_id);
255 $back_link = $this->
ctrl->getLinkTargetByClass(
"ilrepositorygui",
"");
256 $ref_id = $this->request_wrapper->retrieve(
"ref_id", $this->
refinery->kindlyTo()->string());
257 $this->
ctrl->setParameterByClass(
"ilrepositorygui",
"ref_id",
$ref_id);
258 $this->tabs_gui->setBackTarget($this->
lng->txt(
'btn_back'), $back_link);
260 $this->tabs_gui->addTarget(
262 $this->
ctrl->getLinkTarget($this,
'edit'),
267 $this->
ctrl->setParameterByClass(
'ilconditionhandlergui',
'item_id', $this->item_id);
268 $this->tabs_gui->addTarget(
270 $this->
ctrl->getLinkTargetByClass(
'ilConditionHandlerGUI',
'listConditions'),
272 "ilConditionHandlerGUI" 280 $crs_ref_id = $this->tree->checkForParentType($this->parent_ref_id,
'crs');
static lookupTimingMode(int $a_obj_id)
class ilConditionHandlerGUI
const IL_CRS_VIEW_TIMING_ABSOLUTE
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const TIMINGS_DEACTIVATED
ILIAS Refinery Factory $refinery
Class ilObjectActivationGUI.
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
__construct(int $ref_id, int $item_id)
static _after(ilDateTime $start, ilDateTime $end, string $a_compare_field='', string $a_tz='')
compare two dates and check start is after end This method does not consider tz offsets.
read(int $ref_id, int $parent_id=0)
ILIAS HTTP Wrapper RequestWrapper $request_wrapper
Error Handling & global info handling uses PEAR error class.
ilGlobalTemplateInterface $tpl
ilObjectActivation $activation
Class ilObjectActivation.
edit(ilPropertyFormGUI $form=null)