3 declare(strict_types=1);
34 public function __construct($a_data, $a_id, $a_call_by_reference =
true, $a_prepare_output =
true)
42 $this->
lng->loadLanguageModule(
'dateplaner');
43 $this->
lng->loadLanguageModule(
'jscalendar');
48 $next_class = $this->
ctrl->getNextClass($this);
49 $cmd = $this->
ctrl->getCmd();
53 if (!$this->rbac_system->checkAccess(
"visible,read", $this->object->getRefId())) {
54 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
57 switch ($next_class) {
58 case 'ilpermissiongui':
59 $this->tabs_gui->setTabActive(
'perm_settings');
61 $ret = $this->
ctrl->forwardCommand($perm_gui);
65 $this->tabs_gui->setTabActive(
'settings');
67 if (!$cmd || $cmd ==
'view') {
77 if ($this->
access->checkAccess(
"read",
'', $this->object->getRefId())) {
78 $this->tabs_gui->addTarget(
80 $this->
ctrl->getLinkTarget($this,
"settings"),
81 array(
"settings",
"view")
85 if ($this->
access->checkAccess(
'edit_permission',
'', $this->object->getRefId())) {
86 $this->tabs_gui->addTarget(
88 $this->
ctrl->getLinkTargetByClass(
'ilpermissiongui',
"perm"),
97 if (!$this->rbac_system->checkAccess(
"visible,read", $this->object->getRefId())) {
98 $this->error->raiseError($this->
lng->txt(
'no_permission'), $this->error->WARNING);
100 $this->tabs_gui->setTabActive(
'settings');
104 $this->tpl->addBlockFile(
'ADM_CONTENT',
'adm_content',
'tpl.settings.html',
'Services/Calendar');
105 $this->tpl->setVariable(
'CAL_SETTINGS', $form->getHTML());
117 if ($form->checkInput()) {
118 $this->calendar_settings->setEnabled((
bool) $form->getInput(
'enable'));
119 $this->calendar_settings->setDefaultWeekStart((
int) $form->getInput(
'default_week_start'));
120 $this->calendar_settings->setDefaultTimeZone($form->getInput(
'default_timezone'));
121 $this->calendar_settings->setDefaultDateFormat((
int) $form->getInput(
'default_date_format'));
122 $this->calendar_settings->setDefaultTimeFormat((
int) $form->getInput(
'default_time_format'));
123 $this->calendar_settings->setEnableGroupMilestones((
bool) $form->getInput(
'enable_grp_milestones'));
124 $this->calendar_settings->enableCourseCalendar((
bool) $form->getInput(
'enabled_crs'));
125 $this->calendar_settings->setCourseCalendarVisible((
bool) $form->getInput(
'visible_crs'));
126 $this->calendar_settings->enableGroupCalendar((
bool) $form->getInput(
'enabled_grp'));
127 $this->calendar_settings->setGroupCalendarVisible((
bool) $form->getInput(
'visible_grp'));
128 $this->calendar_settings->setDefaultDayStart((
int) $form->getInput(
'dst'));
129 $this->calendar_settings->setDefaultDayEnd((
int) $form->getInput(
'den'));
130 $this->calendar_settings->enableSynchronisationCache((
bool) $form->getInput(
'sync_cache'));
131 $this->calendar_settings->setSynchronisationCacheMinutes((
int) $form->getInput(
'sync_cache_time'));
132 $this->calendar_settings->setCacheMinutes((
int) $form->getInput(
'cache_time'));
133 $this->calendar_settings->useCache((
bool) $form->getInput(
'cache'));
134 $this->calendar_settings->enableNotification((
bool) $form->getInput(
'cn'));
135 $this->calendar_settings->enableUserNotification((
bool) $form->getInput(
'cnu'));
136 $this->calendar_settings->enableConsultationHours((
bool) $form->getInput(
'ch'));
137 $this->calendar_settings->enableCGRegistration((
bool) $form->getInput(
'cgr'));
138 $this->calendar_settings->enableWebCalSync((
bool) $form->getInput(
'webcal'));
139 $this->calendar_settings->setWebCalSyncHours((
int) $form->getInput(
'webcal_hours'));
140 $this->calendar_settings->setShowWeeks((
bool) $form->getInput(
'show_weeks'));
141 $this->calendar_settings->enableBatchFileDownloads((
bool) $form->getInput(
'batch_files'));
142 $this->calendar_settings->setDefaultCal((
int) $form->getInput(
'default_calendar_view'));
143 $this->calendar_settings->setDefaultPeriod((
int) $form->getInput(
'default_period'));
144 $this->calendar_settings->save();
145 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
146 $this->
ctrl->redirect($this,
'settings');
148 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'),
true);
167 $form->setFormAction($this->
ctrl->getFormAction($this));
168 $form->setTitle($this->
lng->txt(
'cal_global_settings'));
171 $form->addCommandButton(
'save', $this->
lng->txt(
'save'));
176 $check->setChecked($this->calendar_settings->isEnabled() ? true :
false);
181 $cb->
setInfo($this->
lng->txt(
"cal_show_weeks_info"));
183 $cb->setChecked($this->calendar_settings->getShowWeeks());
193 $batch_files_download =
new ilCheckboxInputGUI($this->
lng->txt(
'cal_batch_file_downloads'),
"batch_files");
194 $batch_files_download->
setValue(
'1');
195 $batch_files_download->setChecked($this->calendar_settings->isBatchFileDownloadsEnabled());
196 $batch_files_download->setInfo($this->
lng->txt(
'cal_batch_file_downloads_info'));
197 $form->addItem($batch_files_download);
200 $def->setTitle($this->
lng->txt(
'cal_default_settings'));
201 $form->addItem($def);
205 $form->addItem($server_tz);
209 $select->setInfo($this->
lng->txt(
'cal_def_timezone_info'));
210 $select->setValue($this->calendar_settings->getDefaultTimeZone());
211 $form->addItem($select);
214 $select =
new ilSelectInputGUI($this->
lng->txt(
'cal_def_date_format'),
'default_date_format');
215 $select->setOptions(array(
220 $select->setInfo($this->
lng->txt(
'cal_def_date_format_info'));
221 $select->setValue($this->calendar_settings->getDefaultDateFormat());
222 $form->addItem($select);
224 $select =
new ilSelectInputGUI($this->
lng->txt(
'cal_def_time_format'),
'default_time_format');
225 $select->setOptions(array(
229 $select->setInfo($this->
lng->txt(
'cal_def_time_format_info'));
230 $select->setValue($this->calendar_settings->getDefaultTimeFormat());
231 $form->addItem($select);
235 $radio->
setValue((
string) $this->calendar_settings->getDefaultWeekStart());
238 $radio->addOption($option);
240 $radio->addOption($option);
242 $form->addItem($radio);
247 $default_cal_view->addOption($option);
249 $default_cal_view->addOption($option);
251 $default_cal_view->addOption($option);
256 $list_views->setOptions([
263 $list_views->setValue($this->calendar_settings->getDefaultPeriod());
265 $default_cal_view->addOption($option);
266 $default_cal_view->setValue((
string) $this->calendar_settings->getDefaultCal());
268 $form->addItem($default_cal_view);
272 $day_start->setOptions(
275 $day_start->setValue($this->calendar_settings->getDefaultDayStart());
276 $form->addItem($day_start);
279 $day_end->setOptions(
282 $day_end->setValue($this->calendar_settings->getDefaultDayEnd());
283 $form->addItem($day_end);
287 $mil->setTitle($this->
lng->txt(
'cal_milestone_settings'));
288 $form->addItem($mil);
290 $checkm =
new ilCheckboxInputGUI($this->
lng->txt(
'cal_enable_group_milestones'),
'enable_grp_milestones');
292 $checkm->setChecked($this->calendar_settings->getEnableGroupMilestones());
293 $checkm->setInfo($this->
lng->txt(
'cal_enable_group_milestones_desc'));
294 $form->addItem($checkm);
298 $con->setTitle($this->
lng->txt(
'cal_ch_form_header'));
299 $form->addItem($con);
302 $ch->
setInfo($this->
lng->txt(
'cal_ch_form_info'));
304 $ch->setChecked($this->calendar_settings->areConsultationHoursEnabled());
309 $rep->setTitle(
$GLOBALS[
'DIC'][
'lng']->txt(
'cal_setting_global_vis_repos'));
310 $form->addItem($rep);
313 $this->
lng->txt(
'cal_setting_global_crs_act'),
316 $crs_active->
setInfo($this->
lng->txt(
'cal_setting_global_crs_act_info'));
317 $crs_active->setValue(
'1');
318 $crs_active->setChecked($this->calendar_settings->isCourseCalendarEnabled());
319 $form->addItem($crs_active);
322 $crs->setInfo(
$GLOBALS[
'DIC'][
'lng']->txt(
'cal_setting_global_crs_vis_info'));
324 $crs->setChecked($this->calendar_settings->isCourseCalendarVisible());
325 $crs_active->addSubItem($crs);
328 $this->
lng->txt(
'cal_setting_global_grp_act'),
331 $grp_active->
setInfo($this->
lng->txt(
'cal_setting_global_grp_act_info'));
332 $grp_active->setValue(
'1');
333 $grp_active->setChecked($this->calendar_settings->isGroupCalendarEnabled());
334 $form->addItem($grp_active);
337 $grp->setInfo(
$GLOBALS[
'DIC'][
'lng']->txt(
'cal_setting_global_grp_vis_info'));
339 $grp->setInfo(
$GLOBALS[
'DIC'][
'lng']->txt(
'cal_setting_global_grp_vis_info'));
340 $grp->setChecked($this->calendar_settings->isGroupCalendarVisible());
341 $grp_active->addSubItem($grp);
345 $not->setTitle($this->
lng->txt(
'notifications'));
346 $form->addItem($not);
351 $cgn->setChecked($this->calendar_settings->isNotificationEnabled());
352 $cgn->setInfo($this->
lng->txt(
'cal_adm_notification_info'));
353 $form->addItem($cgn);
356 $cnu->setOptionTitle($this->
lng->txt(
'cal_notification_users'));
358 $cnu->setChecked($this->calendar_settings->isUserNotificationEnabled());
359 $cnu->setInfo($this->
lng->txt(
'cal_adm_notification_user_info'));
360 $form->addItem($cnu);
364 $book->setTitle($this->
lng->txt(
'cal_registrations'));
365 $form->addItem($book);
369 $cgn->setChecked($this->calendar_settings->isCGRegistrationEnabled());
370 $cgn->setInfo($this->
lng->txt(
'cal_cg_registration_info'));
371 $form->addItem($cgn);
375 $sec->setTitle($this->
lng->txt(
'cal_cache_settings'));
376 $form->addItem($sec);
379 $cache->
setValue((
string) (
int) $this->calendar_settings->isSynchronisationCacheEnabled());
380 $cache->setInfo($this->
lng->txt(
'cal_sync_cache_info'));
381 $cache->setRequired(
true);
384 $cache->addOption($sync_cache);
387 $cache->addOption($sync_cache);
390 $cache_t->setValue((
string) $this->calendar_settings->getSynchronisationCacheMinutes());
391 $cache_t->setMinValue(0);
392 $cache_t->setSize(3);
393 $cache_t->setMaxLength(3);
394 $cache_t->setSuffix($this->
lng->txt(
'form_minutes'));
395 $sync_cache->addSubItem($cache_t);
397 $form->addItem($cache);
401 $cache->
setValue((
string) (
int) $this->calendar_settings->isCacheUsed());
402 $cache->setInfo($this->
lng->txt(
'cal_cache_info'));
403 $cache->setRequired(
true);
405 $sync_cache =
new ilRadioOption($this->
lng->txt(
'cal_cache_disabled'),
'0');
406 $cache->addOption($sync_cache);
409 $cache->addOption($sync_cache);
412 $cache_t->setValue((
string) $this->calendar_settings->getCacheMinutes());
413 $cache_t->setMinValue(0);
414 $cache_t->setSize(3);
415 $cache_t->setMaxLength(3);
416 $cache_t->setSuffix($this->
lng->txt(
'form_minutes'));
417 $sync_cache->addSubItem($cache_t);
418 $form->addItem($cache);
424 switch ($a_form_id) {
432 'cal_setting_global_crs_act' => [
433 $this->calendar_settings->isCourseCalendarEnabled(),
436 'cal_setting_global_crs_vis' =>
437 array($this->calendar_settings->isCourseCalendarVisible(),
442 $fields[
'cal_setting_global_vis_repos'] = array(null, null, $subitems);
445 'cal_notification_crsgrp' => array($this->calendar_settings->isNotificationEnabled(),
448 'cal_notification_users' => array($this->calendar_settings->isUserNotificationEnabled(),
452 $fields[
'cal_notification'] = array(null, null, $subitems);
454 $fields[
'cal_cg_registrations'] = array($this->calendar_settings->isCGRegistrationEnabled(),
458 return array(array(
"settings", $fields));
467 'cal_setting_global_grp_act' => [
468 $this->calendar_settings->isGroupCalendarEnabled(),
471 'cal_setting_global_grp_vis' =>
472 array($this->calendar_settings->isGroupCalendarVisible(),
478 $fields[
'cal_setting_global_vis_repos'] = array(null, null, $subitems);
481 'cal_notification_crsgrp' => array($this->calendar_settings->isNotificationEnabled(),
484 'cal_notification_users' => array($this->calendar_settings->isUserNotificationEnabled(),
488 $fields[
'cal_notification'] = array(null, null, $subitems);
490 $fields[
'cal_cg_registrations'] = array($this->calendar_settings->isCGRegistrationEnabled(),
494 return array(array(
"settings", $fields));
static _getDefaultTimeZone()
Calculate and set default time zone.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
prepareOutput(bool $show_sub_objects=true)
static _getShortTimeZoneList()
get short timezone list
static getHourSelection(int $a_format)
Get hour selection depending on user specific hour format.
__construct($a_data, $a_id, $a_call_by_reference=true, $a_prepare_output=true)
Constructor public.
settings(?ilPropertyFormGUI $form=null)
Class ilObjectGUI Basic methods of all Output classes.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $ref_id=null)
save()
save settings protected
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
addToExternalSettingsForm(int $a_form_id)
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
initCalendarSettings()
init calendar settings
initFormSettings()
Init settings property form protected.
ilCalendarSettings $calendar_settings
checkPermission(string $perm, string $cmd="", string $type="", ?int $ref_id=null)