ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 39 of file class.ilCalendarUserSettingsGUI.php.

40 {
41 global $DIC;
42
43 $this->tpl = $DIC->ui()->mainTemplate();
44 $this->lng = $DIC->language();
45 $this->lng->loadLanguageModule('dateplaner');
46 $this->lng->loadLanguageModule('jscalendar');
47
48 $this->ctrl = $DIC->ctrl();
49 $this->user = $DIC->user();
51 $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
52 }
static _getInstanceByUserId(int $a_user_id)
global $DIC
Definition: shib_login.php:26

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 73 of file class.ilCalendarUserSettingsGUI.php.

73 : void
74 {
75 $this->ctrl->returnToParent($this);
76 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ executeCommand()

ilCalendarUserSettingsGUI::executeCommand ( )

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

54 : void
55 {
56 $next_class = $this->ctrl->getNextClass();
57 switch ($next_class) {
58 default:
59 $cmd = $this->ctrl->getCmd("show");
60 $this->$cmd();
61 break;
62 }
63 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ initSettingsForm()

ilCalendarUserSettingsGUI::initSettingsForm ( )

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

101 {
102 $form = new ilPropertyFormGUI();
103 $form->setFormAction($this->ctrl->getFormAction($this, 'save'));
104 $form->setTitle($this->lng->txt('cal_user_settings'));
105 $form->addCommandButton('save', $this->lng->txt('save'));
106 //$form->addCommandButton('cancel',$this->lng->txt('cancel'));
107
108 $select = new ilSelectInputGUI($this->lng->txt('cal_user_timezone'), 'timezone');
109 $select->setOptions(ilCalendarUtil::_getShortTimeZoneList());
110 $select->setInfo($this->lng->txt('cal_timezone_info'));
111 $select->setValue($this->user_settings->getTimeZone());
112 $form->addItem($select);
113
114 $export_type = new ilRadioGroupInputGUI($this->lng->txt('cal_export_timezone'), 'export_tz');
115 $export_type->setValue((string) $this->user_settings->getExportTimeZoneType());
116
117 $export_tz = new ilRadioOption(
118 $this->lng->txt('cal_export_timezone_tz'),
120 );
121 $export_type->addOption($export_tz);
122 $export_utc = new ilRadioOption(
123 $this->lng->txt('cal_export_timezone_utc'),
125 );
126 $export_type->addOption($export_utc);
127 $form->addItem($export_type);
128
129 $year = date("Y");
130 $select = new ilSelectInputGUI($this->lng->txt('cal_user_date_format'), 'date_format');
131 $select->setOptions(array(
132 ilCalendarSettings::DATE_FORMAT_DMY => '31.10.' . $year,
133 ilCalendarSettings::DATE_FORMAT_YMD => $year . "-10-31",
134 ilCalendarSettings::DATE_FORMAT_MDY => "10/31/" . $year
135 ));
136 $select->setInfo($this->lng->txt('cal_date_format_info'));
137 $select->setValue($this->user_settings->getDateFormat());
138 $form->addItem($select);
139
140 $select = new ilSelectInputGUI($this->lng->txt('cal_user_time_format'), 'time_format');
141 $select->setOptions(array(
144 ));
145 $select->setInfo($this->lng->txt('cal_time_format_info'));
146 $select->setValue($this->user_settings->getTimeFormat());
147 $form->addItem($select);
148
149 // Week/Month View
150 $week_month = new ilFormSectionHeaderGUI();
151 $week_month->setTitle($this->lng->txt('cal_week_month_view'));
152 $form->addItem($week_month);
153
154 $radio = new ilRadioGroupInputGUI($this->lng->txt('cal_week_start'), 'weekstart');
155 $radio->setValue((string) $this->user_settings->getWeekStart());
156
157 $option = new ilRadioOption($this->lng->txt('l_su'), "0");
158 $radio->addOption($option);
159 $option = new ilRadioOption($this->lng->txt('l_mo'), "1");
160 $radio->addOption($option);
161 $form->addItem($radio);
162
163 if ($this->settings->getShowWeeks()) {
164 //
165 $cb = new ilCheckboxInputGUI($this->lng->txt("cal_usr_show_weeks"), "show_weeks");
166 $cb->setInfo($this->lng->txt("cal_usr_show_weeks_info"));
167 $cb->setValue("1");
168 $cb->setChecked($this->user_settings->getShowWeeks());
169 $form->addItem($cb);
170 }
171
172 // Day/Week View
173 $week_month = new ilFormSectionHeaderGUI();
174 $week_month->setTitle($this->lng->txt('cal_day_week_view'));
175 $form->addItem($week_month);
176
177 $day_start = new ilSelectInputGUI($this->lng->txt('cal_day_start'), 'dst');
178 $day_start->setOptions(
179 ilCalendarUtil::getHourSelection($this->user_settings->getTimeFormat())
180 );
181 $day_start->setValue($this->user_settings->getDayStart());
182 $form->addItem($day_start);
183
184 $day_end = new ilSelectInputGUI($this->lng->txt('cal_day_end'), 'den');
185 $day_end->setOptions(
186 ilCalendarUtil::getHourSelection($this->user_settings->getTimeFormat())
187 );
188 $day_end->setValue($this->user_settings->getDayEnd());
189 $form->addItem($day_end);
190 return $form;
191 }
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 class represents a section header in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
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 78 of file class.ilCalendarUserSettingsGUI.php.

79 {
80 $form = $this->initSettingsForm();
81 if ($form->checkInput()) {
82 $this->user_settings->setTimeZone($form->getInput('timezone'));
83 $this->user_settings->setExportTimeZoneType((int) $form->getInput('export_tz'));
84 $this->user_settings->setWeekStart((int) $form->getInput('weekstart'));
85 $this->user_settings->setDateFormat((int) $form->getInput('date_format'));
86 $this->user_settings->setTimeFormat((int) $form->getInput('time_format'));
87 $this->user_settings->setDayStart((int) $form->getInput('dst'));
88 $this->user_settings->setDayEnd((int) $form->getInput('den'));
89 $this->user_settings->setShowWeeks((bool) $form->getInput('show_weeks'));
90 $this->user_settings->save();
91 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
92 $this->ctrl->redirect($this, "show");
93 } else {
94 $form->setValuesByPost();
95 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'), true);
96 $this->show();
97 }
98 }
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 65 of file class.ilCalendarUserSettingsGUI.php.

65 : void
66 {
67 if (!$form instanceof ilPropertyFormGUI) {
68 $form = $this->initSettingsForm();
69 }
70 $this->tpl->setContent($form->getHTML());
71 }

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 28 of file class.ilCalendarUserSettingsGUI.php.

◆ $lng

ilLanguage ilCalendarUserSettingsGUI::$lng
protected

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

◆ $settings

ilCalendarSettings ilCalendarUserSettingsGUI::$settings
protected

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

◆ $tpl

ilGlobalTemplateInterface ilCalendarUserSettingsGUI::$tpl
protected

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

◆ $user

ilObjUser ilCalendarUserSettingsGUI::$user
protected

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

◆ $user_settings

ilCalendarUserSettings ilCalendarUserSettingsGUI::$user_settings
protected

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


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