/** * Init settings property form * * @access protected */ protected function initFormSettings() { if (is_object($this->form)) { return true; } include_once 'Services/Calendar/classes/class.ilCalendarUtil.php'; include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this)); $this->form->setTitle($this->lng->txt('cal_global_settings')); $this->form->addCommandButton('save', $this->lng->txt('save')); #$this->form->addCommandButton('cancel',$this->lng->txt('cancel')); $check = new ilCheckboxInputGUI($this->lng->txt('enable_calendar'), 'enable'); $check->setValue(1); $check->setChecked($this->settings->isEnabled() ? true : false); $this->form->addItem($check); $server_tz = new ilNonEditableValueGUI($this->lng->txt('cal_server_tz')); $server_tz->setValue(ilTimeZone::_getDefaultTimeZone()); $this->form->addItem($server_tz); $select = new ilSelectInputGUI($this->lng->txt('cal_def_timezone'), 'default_timezone'); $select->setOptions(ilCalendarUtil::_getShortTimeZoneList()); $select->setInfo($this->lng->txt('cal_def_timezone_info')); $select->setValue($this->settings->getDefaultTimeZone()); $this->form->addItem($select); $year = date("Y"); $select = new ilSelectInputGUI($this->lng->txt('cal_def_date_format'), 'default_date_format'); $select->setOptions(array(ilCalendarSettings::DATE_FORMAT_DMY => '31.10.' . $year, ilCalendarSettings::DATE_FORMAT_YMD => $year . "-10-31", ilCalendarSettings::DATE_FORMAT_MDY => "10/31/" . $year)); $select->setInfo($this->lng->txt('cal_def_date_format_info')); $select->setValue($this->settings->getDefaultDateFormat()); $this->form->addItem($select); $select = new ilSelectInputGUI($this->lng->txt('cal_def_time_format'), 'default_time_format'); $select->setOptions(array(ilCalendarSettings::TIME_FORMAT_24 => '13:00', ilCalendarSettings::TIME_FORMAT_12 => '1:00pm')); $select->setInfo($this->lng->txt('cal_def_time_format_info')); $select->setValue($this->settings->getDefaultTimeFormat()); $this->form->addItem($select); // Weekstart $radio = new ilRadioGroupInputGUI($this->lng->txt('cal_def_week_start'), 'default_week_start'); $radio->setValue($this->settings->getDefaultWeekStart()); $option = new ilRadioOption($this->lng->txt('l_su'), 0); $radio->addOption($option); $option = new ilRadioOption($this->lng->txt('l_mo'), 1); $radio->addOption($option); $this->form->addItem($radio); // Day start $day_start = new ilSelectInputGUI($this->lng->txt('cal_day_start'), 'dst'); $day_start->setOptions(ilCalendarUtil::getHourSelection($this->settings->getDefaultTimeFormat())); $day_start->setValue($this->settings->getDefaultDayStart()); $this->form->addItem($day_start); $day_end = new ilSelectInputGUI($this->lng->txt('cal_day_end'), 'den'); $day_end->setOptions(ilCalendarUtil::getHourSelection($this->settings->getDefaultTimeFormat())); $day_end->setValue($this->settings->getDefaultDayEnd()); $this->form->addItem($day_end); $sync = new ilCheckboxInputGUI($this->lng->txt('cal_webcal_sync'), 'webcal'); $sync->setValue(1); $sync->setChecked($this->settings->isWebCalSyncEnabled()); $sync->setInfo($this->lng->txt('cal_webcal_sync_info')); $sync_min = new ilNumberInputGUI('', 'webcal_hours'); $sync_min->setSize(2); $sync_min->setMaxLength(3); $sync_min->setValue($this->settings->getWebCalSyncHours()); $sync_min->setSuffix($this->lng->txt('hours')); $sync->addSubItem($sync_min); $this->form->addItem($sync); // enable milestone planning in groups $mil = new ilFormSectionHeaderGUI(); $mil->setTitle($this->lng->txt('cal_milestone_settings')); $this->form->addItem($mil); $checkm = new ilCheckboxInputGUI($this->lng->txt('cal_enable_group_milestones'), 'enable_grp_milestones'); $checkm->setValue(1); $checkm->setChecked($this->settings->getEnableGroupMilestones() ? true : false); $checkm->setInfo($this->lng->txt('cal_enable_group_milestones_desc')); $this->form->addItem($checkm); // Consultation hours $con = new ilFormSectionHeaderGUI(); $con->setTitle($this->lng->txt('cal_ch_form_header')); $this->form->addItem($con); $ch = new ilCheckboxInputGUI($this->lng->txt('cal_ch_form'), 'ch'); $ch->setInfo($this->lng->txt('cal_ch_form_info')); $ch->setValue(1); $ch->setChecked($this->settings->areConsultationHoursEnabled()); $this->form->addItem($ch); // repository visibility default $rep = new ilFormSectionHeaderGUI(); $rep->setTitle($GLOBALS['lng']->txt('cal_setting_global_vis_repos')); $this->form->addItem($rep); $crs = new ilCheckboxInputGUI($GLOBALS['lng']->txt('cal_setting_global_crs_vis'), 'visible_crs'); $crs->setInfo($GLOBALS['lng']->txt('cal_setting_global_crs_vis_info')); $crs->setValue(1); $crs->setInfo($GLOBALS['lng']->txt('cal_setting_global_crs_vis_info')); $crs->setChecked($this->settings->isCourseCalendarEnabled()); $this->form->addItem($crs); $grp = new ilCheckboxInputGUI($GLOBALS['lng']->txt('cal_setting_global_grp_vis'), 'visible_grp'); $grp->setInfo($GLOBALS['lng']->txt('cal_setting_global_grp_vis_info')); $grp->setValue(1); $grp->setInfo($GLOBALS['lng']->txt('cal_setting_global_grp_vis_info')); $grp->setChecked($this->settings->isGroupCalendarEnabled()); $this->form->addItem($grp); // Notifications $not = new ilFormSectionHeaderGUI(); $not->setTitle($this->lng->txt('notifications')); $this->form->addItem($not); $cgn = new ilCheckboxInputGUI($this->lng->txt('cal_notification'), 'cn'); $cgn->setOptionTitle($this->lng->txt('cal_notification_crsgrp')); $cgn->setValue(1); $cgn->setChecked($this->settings->isNotificationEnabled()); $cgn->setInfo($this->lng->txt('cal_adm_notification_info')); $this->form->addItem($cgn); $cnu = new ilCheckboxInputGUI('', 'cnu'); $cnu->setOptionTitle($this->lng->txt('cal_notification_users')); $cnu->setValue(1); $cnu->setChecked($this->settings->isUserNotificationEnabled()); $cnu->setInfo($this->lng->txt('cal_adm_notification_user_info')); $this->form->addItem($cnu); // Registration $book = new ilFormSectionHeaderGUI(); $book->setTitle($this->lng->txt('cal_registrations')); $this->form->addItem($book); $cgn = new ilCheckboxInputGUI($this->lng->txt('cal_cg_registrations'), 'cgr'); $cgn->setValue(1); $cgn->setChecked($this->settings->isCGRegistrationEnabled()); $cgn->setInfo($this->lng->txt('cal_cg_registration_info')); $this->form->addItem($cgn); // Synchronisation cache $sec = new ilFormSectionHeaderGUI(); $sec->setTitle($this->lng->txt('cal_cache_settings')); $this->form->addItem($sec); $cache = new ilRadioGroupInputGUI($this->lng->txt('cal_sync_cache'), 'sync_cache'); $cache->setValue((int) $this->settings->isSynchronisationCacheEnabled()); $cache->setInfo($this->lng->txt('cal_sync_cache_info')); $cache->setRequired(true); $sync_cache = new ilRadioOption($this->lng->txt('cal_sync_disabled'), 0); $cache->addOption($sync_cache); $sync_cache = new ilRadioOption($this->lng->txt('cal_sync_enabled'), 1); $cache->addOption($sync_cache); $cache_t = new ilNumberInputGUI('', 'sync_cache_time'); $cache_t->setValue($this->settings->getSynchronisationCacheMinutes()); $cache_t->setMinValue(0); $cache_t->setSize(3); $cache_t->setMaxLength(3); $cache_t->setSuffix($this->lng->txt('form_minutes')); $sync_cache->addSubItem($cache_t); $this->form->addItem($cache); // Calendar cache $cache = new ilRadioGroupInputGUI($this->lng->txt('cal_cache'), 'cache'); $cache->setValue((int) $this->settings->isCacheUsed()); $cache->setInfo($this->lng->txt('cal_cache_info')); $cache->setRequired(true); $sync_cache = new ilRadioOption($this->lng->txt('cal_cache_disabled'), 0); $cache->addOption($sync_cache); $sync_cache = new ilRadioOption($this->lng->txt('cal_cache_enabled'), 1); $cache->addOption($sync_cache); $cache_t = new ilNumberInputGUI('', 'cache_time'); $cache_t->setValue($this->settings->getCacheMinutes()); $cache_t->setMinValue(0); $cache_t->setSize(3); $cache_t->setMaxLength(3); $cache_t->setSuffix($this->lng->txt('form_minutes')); $sync_cache->addSubItem($cache_t); $this->form->addItem($cache); }
/** * show settings table * * @access public * @return */ public function initSettingsForm() { if (is_object($this->form)) { return true; } include_once 'Services/Calendar/classes/class.ilCalendarUtil.php'; include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); $this->form->setFormAction($this->ctrl->getFormAction($this, 'save')); $this->form->setTitle($this->lng->txt('cal_user_settings')); $this->form->addCommandButton('save', $this->lng->txt('save')); $this->form->addCommandButton('cancel', $this->lng->txt('cancel')); $select = new ilSelectInputGUI($this->lng->txt('cal_user_timezone'), 'timezone'); $select->setOptions(ilCalendarUtil::_getShortTimeZoneList()); $select->setInfo($this->lng->txt('cal_timezone_info')); $select->setValue($this->user_settings->getTimeZone()); $this->form->addItem($select); $export_type = new ilRadioGroupInputGUI($this->lng->txt('cal_export_timezone'), 'export_tz'); $export_type->setValue($this->user_settings->getExportTimeZoneType()); $export_tz = new ilRadioOption($this->lng->txt('cal_export_timezone_tz'), ilCalendarUserSettings::CAL_EXPORT_TZ_TZ); $export_type->addOption($export_tz); $export_utc = new ilRadioOption($this->lng->txt('cal_export_timezone_utc'), ilCalendarUserSettings::CAL_EXPORT_TZ_UTC); $export_type->addOption($export_utc); $this->form->addItem($export_type); $year = date("Y"); $select = new ilSelectInputGUI($this->lng->txt('cal_user_date_format'), 'date_format'); $select->setOptions(array(ilCalendarSettings::DATE_FORMAT_DMY => '31.10.' . $year, ilCalendarSettings::DATE_FORMAT_YMD => $year . "-10-31", ilCalendarSettings::DATE_FORMAT_MDY => "10/31/" . $year)); $select->setInfo($this->lng->txt('cal_date_format_info')); $select->setValue($this->user_settings->getDateFormat()); $this->form->addItem($select); $select = new ilSelectInputGUI($this->lng->txt('cal_user_time_format'), 'time_format'); $select->setOptions(array(ilCalendarSettings::TIME_FORMAT_24 => '13:00', ilCalendarSettings::TIME_FORMAT_12 => '1:00pm')); $select->setInfo($this->lng->txt('cal_time_format_info')); $select->setValue($this->user_settings->getTimeFormat()); $this->form->addItem($select); // Week/Month View $week_month = new ilFormSectionHeaderGUI(); $week_month->setTitle($this->lng->txt('cal_week_month_view')); $this->form->addItem($week_month); $radio = new ilRadioGroupInputGUI($this->lng->txt('cal_week_start'), 'weekstart'); $radio->setValue($this->user_settings->getWeekStart()); $option = new ilRadioOption($this->lng->txt('l_su'), 0); $radio->addOption($option); $option = new ilRadioOption($this->lng->txt('l_mo'), 1); $radio->addOption($option); $this->form->addItem($radio); // Day/Week View $week_month = new ilFormSectionHeaderGUI(); $week_month->setTitle($this->lng->txt('cal_day_week_view')); $this->form->addItem($week_month); $day_start = new ilSelectInputGUI($this->lng->txt('cal_day_start'), 'dst'); $day_start->setOptions(ilCalendarUtil::getHourSelection($this->user_settings->getTimeFormat())); $day_start->setValue($this->user_settings->getDayStart()); $this->form->addItem($day_start); $day_end = new ilSelectInputGUI($this->lng->txt('cal_day_end'), 'den'); $day_end->setOptions(ilCalendarUtil::getHourSelection($this->user_settings->getTimeFormat())); $day_end->setValue($this->user_settings->getDayEnd()); $this->form->addItem($day_end); }