ILIAS  release_8 Revision v8.24
ilCalendarUserSettingsGUI Class Reference
+ Collaboration diagram for ilCalendarUserSettingsGUI:

Public Member Functions

 __construct ()
 Constructor @access public. More...
 
 executeCommand ()
 
 show (?ilPropertyFormGUI $form=null)
 
 cancel ()
 
 save ()
 
 initSettingsForm ()
 

Protected Attributes

ilGlobalTemplateInterface $tpl
 
ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ilObjUser $user
 
ilCalendarSettings $settings
 
ilCalendarUserSettings $user_settings
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCalendarUserSettingsGUI::__construct ( )

Constructor @access public.

Parameters

Definition at line 45 of file class.ilCalendarUserSettingsGUI.php.

46 {
47 global $DIC;
48
49 $this->tpl = $DIC->ui()->mainTemplate();
50 $this->lng = $DIC->language();
51 $this->lng->loadLanguageModule('dateplaner');
52 $this->lng->loadLanguageModule('jscalendar');
53
54 $this->ctrl = $DIC->ctrl();
55 $this->user = $DIC->user();
57 $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
58 }
static _getInstanceByUserId(int $a_user_id)
global $DIC
Definition: feed.php:28

References $DIC, ilCalendarSettings\_getInstance(), ilCalendarUserSettings\_getInstanceByUserId(), ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ cancel()

ilCalendarUserSettingsGUI::cancel ( )

Definition at line 79 of file class.ilCalendarUserSettingsGUI.php.

79 : void
80 {
81 $this->ctrl->returnToParent($this);
82 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ executeCommand()

ilCalendarUserSettingsGUI::executeCommand ( )

Definition at line 60 of file class.ilCalendarUserSettingsGUI.php.

60 : void
61 {
62 $next_class = $this->ctrl->getNextClass();
63 switch ($next_class) {
64 default:
65 $cmd = $this->ctrl->getCmd("show");
66 $this->$cmd();
67 break;
68 }
69 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ initSettingsForm()

ilCalendarUserSettingsGUI::initSettingsForm ( )

Definition at line 106 of file class.ilCalendarUserSettingsGUI.php.

107 {
108 $form = new ilPropertyFormGUI();
109 $form->setFormAction($this->ctrl->getFormAction($this, 'save'));
110 $form->setTitle($this->lng->txt('cal_user_settings'));
111 $form->addCommandButton('save', $this->lng->txt('save'));
112 //$form->addCommandButton('cancel',$this->lng->txt('cancel'));
113
114 $select = new ilSelectInputGUI($this->lng->txt('cal_user_timezone'), 'timezone');
115 $select->setOptions(ilCalendarUtil::_getShortTimeZoneList());
116 $select->setInfo($this->lng->txt('cal_timezone_info'));
117 $select->setValue($this->user_settings->getTimeZone());
118 $form->addItem($select);
119
120 $export_type = new ilRadioGroupInputGUI($this->lng->txt('cal_export_timezone'), 'export_tz');
121 $export_type->setValue((string) $this->user_settings->getExportTimeZoneType());
122
123 $export_tz = new ilRadioOption(
124 $this->lng->txt('cal_export_timezone_tz'),
126 );
127 $export_type->addOption($export_tz);
128 $export_utc = new ilRadioOption(
129 $this->lng->txt('cal_export_timezone_utc'),
131 );
132 $export_type->addOption($export_utc);
133 $form->addItem($export_type);
134
135 $year = date("Y");
136 $select = new ilSelectInputGUI($this->lng->txt('cal_user_date_format'), 'date_format');
137 $select->setOptions(array(
138 ilCalendarSettings::DATE_FORMAT_DMY => '31.10.' . $year,
139 ilCalendarSettings::DATE_FORMAT_YMD => $year . "-10-31",
140 ilCalendarSettings::DATE_FORMAT_MDY => "10/31/" . $year
141 ));
142 $select->setInfo($this->lng->txt('cal_date_format_info'));
143 $select->setValue($this->user_settings->getDateFormat());
144 $form->addItem($select);
145
146 $select = new ilSelectInputGUI($this->lng->txt('cal_user_time_format'), 'time_format');
147 $select->setOptions(array(
150 ));
151 $select->setInfo($this->lng->txt('cal_time_format_info'));
152 $select->setValue($this->user_settings->getTimeFormat());
153 $form->addItem($select);
154
155 // Week/Month View
156 $week_month = new ilFormSectionHeaderGUI();
157 $week_month->setTitle($this->lng->txt('cal_week_month_view'));
158 $form->addItem($week_month);
159
160 $radio = new ilRadioGroupInputGUI($this->lng->txt('cal_week_start'), 'weekstart');
161 $radio->setValue((string) $this->user_settings->getWeekStart());
162
163 $option = new ilRadioOption($this->lng->txt('l_su'), "0");
164 $radio->addOption($option);
165 $option = new ilRadioOption($this->lng->txt('l_mo'), "1");
166 $radio->addOption($option);
167 $form->addItem($radio);
168
169 if ($this->settings->getShowWeeks()) {
170 //
171 $cb = new ilCheckboxInputGUI($this->lng->txt("cal_usr_show_weeks"), "show_weeks");
172 $cb->setInfo($this->lng->txt("cal_usr_show_weeks_info"));
173 $cb->setValue("1");
174 $cb->setChecked($this->user_settings->getShowWeeks());
175 $form->addItem($cb);
176 }
177
178 // Day/Week View
179 $week_month = new ilFormSectionHeaderGUI();
180 $week_month->setTitle($this->lng->txt('cal_day_week_view'));
181 $form->addItem($week_month);
182
183 $day_start = new ilSelectInputGUI($this->lng->txt('cal_day_start'), 'dst');
184 $day_start->setOptions(
185 ilCalendarUtil::getHourSelection($this->user_settings->getTimeFormat())
186 );
187 $day_start->setValue($this->user_settings->getDayStart());
188 $form->addItem($day_start);
189
190 $day_end = new ilSelectInputGUI($this->lng->txt('cal_day_end'), 'den');
191 $day_end->setOptions(
192 ilCalendarUtil::getHourSelection($this->user_settings->getTimeFormat())
193 );
194 $day_end->setValue($this->user_settings->getDayEnd());
195 $form->addItem($day_end);
196 return $form;
197 }
static _getShortTimeZoneList()
get short timezone list
static getHourSelection(int $a_format)
Get hour selection depending on user specific hour format.
This class represents a checkbox property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property form user interface.
This class represents a property in a property form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a selection list property in a property form.

References ilCalendarUtil\_getShortTimeZoneList(), ilCalendarUserSettings\CAL_EXPORT_TZ_TZ, ilCalendarUserSettings\CAL_EXPORT_TZ_UTC, ILIAS\Repository\ctrl(), ilCalendarSettings\DATE_FORMAT_DMY, ilCalendarSettings\DATE_FORMAT_MDY, ilCalendarSettings\DATE_FORMAT_YMD, ilCalendarUtil\getHourSelection(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), ilCalendarSettings\TIME_FORMAT_12, and ilCalendarSettings\TIME_FORMAT_24.

Referenced by save(), and show().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilCalendarUserSettingsGUI::save ( )

Definition at line 84 of file class.ilCalendarUserSettingsGUI.php.

85 {
86 $form = $this->initSettingsForm();
87 if ($form->checkInput()) {
88 $this->user_settings->setTimeZone($form->getInput('timezone'));
89 $this->user_settings->setExportTimeZoneType((int) $form->getInput('export_tz'));
90 $this->user_settings->setWeekStart((int) $form->getInput('weekstart'));
91 $this->user_settings->setDateFormat((int) $form->getInput('date_format'));
92 $this->user_settings->setTimeFormat((int) $form->getInput('time_format'));
93 $this->user_settings->setDayStart((int) $form->getInput('dst'));
94 $this->user_settings->setDayEnd((int) $form->getInput('den'));
95 $this->user_settings->setShowWeeks((bool) $form->getInput('show_weeks'));
96 $this->user_settings->save();
97 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
98 $this->ctrl->redirect($this, "show");
99 } else {
100 $form->setValuesByPost();
101 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'), true);
102 $this->show();
103 }
104 }
show(?ilPropertyFormGUI $form=null)

References ILIAS\Repository\ctrl(), initSettingsForm(), ILIAS\Repository\lng(), and show().

+ Here is the call graph for this function:

◆ show()

ilCalendarUserSettingsGUI::show ( ?ilPropertyFormGUI  $form = null)

Definition at line 71 of file class.ilCalendarUserSettingsGUI.php.

71 : void
72 {
73 if (!$form instanceof ilPropertyFormGUI) {
74 $form = $this->initSettingsForm();
75 }
76 $this->tpl->setContent($form->getHTML());
77 }

References initSettingsForm().

Referenced by save().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrlInterface ilCalendarUserSettingsGUI::$ctrl
protected

Definition at line 34 of file class.ilCalendarUserSettingsGUI.php.

◆ $lng

ilLanguage ilCalendarUserSettingsGUI::$lng
protected

Definition at line 35 of file class.ilCalendarUserSettingsGUI.php.

◆ $settings

ilCalendarSettings ilCalendarUserSettingsGUI::$settings
protected

Definition at line 37 of file class.ilCalendarUserSettingsGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilCalendarUserSettingsGUI::$tpl
protected

Definition at line 33 of file class.ilCalendarUserSettingsGUI.php.

◆ $user

ilObjUser ilCalendarUserSettingsGUI::$user
protected

Definition at line 36 of file class.ilCalendarUserSettingsGUI.php.

◆ $user_settings

ilCalendarUserSettings ilCalendarUserSettingsGUI::$user_settings
protected

Definition at line 38 of file class.ilCalendarUserSettingsGUI.php.


The documentation for this class was generated from the following file: