ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilCalendarUserSettingsGUI Class Reference
+ Collaboration diagram for ilCalendarUserSettingsGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 show ()
 show settings More...
 
 cancel ()
 cancel editing More...
 
 save ()
 save settings More...
 
 initSettingsForm ()
 show settings table More...
 

Protected Attributes

 $tpl
 
 $lng
 
 $user
 
 $settings
 
 $user_settings
 

Detailed Description

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

@ilCtrl_Calls ilCalendarUserSettingsGUI:

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

Constructor & Destructor Documentation

◆ __construct()

ilCalendarUserSettingsGUI::__construct ( )

Constructor.

@access public

Parameters

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

57 {
58 global $DIC;
59
60 $ilUser = $DIC['ilUser'];
61 $tpl = $DIC['tpl'];
62 $lng = $DIC['lng'];
63 $ilCtrl = $DIC['ilCtrl'];
64
65 $this->tpl = $tpl;
66 $this->lng = $lng;
67 $this->lng->loadLanguageModule('dateplaner');
68 $this->lng->loadLanguageModule('jscalendar');
69
70 $this->ctrl = $ilCtrl;
71
72 $this->user = $ilUser;
74 $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
75 }
user()
Definition: user.php:4
static _getInstance()
get singleton instance
static _getInstanceByUserId($a_user_id)
get singleton instance
global $ilCtrl
Definition: ilias.php:18
settings()
Definition: settings.php:2
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46

References $DIC, $ilCtrl, $ilUser, $lng, $tpl, ilCalendarSettings\_getInstance(), ilCalendarUserSettings\_getInstanceByUserId(), settings(), and user().

+ Here is the call graph for this function:

Member Function Documentation

◆ cancel()

ilCalendarUserSettingsGUI::cancel ( )

cancel editing

@access public

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

124 {
125 $this->ctrl->returnToParent($this);
126 }

◆ executeCommand()

ilCalendarUserSettingsGUI::executeCommand ( )

Execute command.

@access public

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

85 {
86 global $DIC;
87
88 $ilUser = $DIC['ilUser'];
89 $ilSetting = $DIC['ilSetting'];
90
91
92 $next_class = $this->ctrl->getNextClass();
93
94 switch ($next_class) {
95 default:
96 $cmd = $this->ctrl->getCmd("show");
97 $this->$cmd();
98 break;
99 }
100 return true;
101 }
global $ilSetting
Definition: privfeed.php:17

References $DIC, $ilSetting, and $ilUser.

◆ initSettingsForm()

ilCalendarUserSettingsGUI::initSettingsForm ( )

show settings table

@access public

Returns

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

166 {
167 if (is_object($this->form)) {
168 return true;
169 }
170 include_once('Services/Calendar/classes/class.ilCalendarUtil.php');
171 include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
172
173 $this->form = new ilPropertyFormGUI();
174 $this->form->setFormAction($this->ctrl->getFormAction($this, 'save'));
175 $this->form->setTitle($this->lng->txt('cal_user_settings'));
176 $this->form->addCommandButton('save', $this->lng->txt('save'));
177 //$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
178
179 $select = new ilSelectInputGUI($this->lng->txt('cal_user_timezone'), 'timezone');
180 $select->setOptions(ilCalendarUtil::_getShortTimeZoneList());
181 $select->setInfo($this->lng->txt('cal_timezone_info'));
182 $select->setValue($this->user_settings->getTimeZone());
183 $this->form->addItem($select);
184
185 $export_type = new ilRadioGroupInputGUI($this->lng->txt('cal_export_timezone'), 'export_tz');
186 $export_type->setValue($this->user_settings->getExportTimeZoneType());
187
188 $export_tz = new ilRadioOption($this->lng->txt('cal_export_timezone_tz'), ilCalendarUserSettings::CAL_EXPORT_TZ_TZ);
189 $export_type->addOption($export_tz);
190 $export_utc = new ilRadioOption($this->lng->txt('cal_export_timezone_utc'), ilCalendarUserSettings::CAL_EXPORT_TZ_UTC);
191 $export_type->addOption($export_utc);
192 $this->form->addItem($export_type);
193
194 $year = date("Y");
195 $select = new ilSelectInputGUI($this->lng->txt('cal_user_date_format'), 'date_format');
196 $select->setOptions(array(
197 ilCalendarSettings::DATE_FORMAT_DMY => '31.10.' . $year,
198 ilCalendarSettings::DATE_FORMAT_YMD => $year . "-10-31",
199 ilCalendarSettings::DATE_FORMAT_MDY => "10/31/" . $year));
200 $select->setInfo($this->lng->txt('cal_date_format_info'));
201 $select->setValue($this->user_settings->getDateFormat());
202 $this->form->addItem($select);
203
204 $select = new ilSelectInputGUI($this->lng->txt('cal_user_time_format'), 'time_format');
205 $select->setOptions(array(
208 $select->setInfo($this->lng->txt('cal_time_format_info'));
209 $select->setValue($this->user_settings->getTimeFormat());
210 $this->form->addItem($select);
211
212 // Week/Month View
213 $week_month = new ilFormSectionHeaderGUI();
214 $week_month->setTitle($this->lng->txt('cal_week_month_view'));
215 $this->form->addItem($week_month);
216
217 $radio = new ilRadioGroupInputGUI($this->lng->txt('cal_week_start'), 'weekstart');
218 $radio->setValue($this->user_settings->getWeekStart());
219
220 $option = new ilRadioOption($this->lng->txt('l_su'), 0);
221 $radio->addOption($option);
222 $option = new ilRadioOption($this->lng->txt('l_mo'), 1);
223 $radio->addOption($option);
224 $this->form->addItem($radio);
225
226 if ($this->settings->getShowWeeks()) {
227 //
228 $cb = new ilCheckboxInputGUI($this->lng->txt("cal_usr_show_weeks"), "show_weeks");
229 $cb->setInfo($this->lng->txt("cal_usr_show_weeks_info"));
230 $cb->setValue(1);
231 $cb->setChecked($this->user_settings->getShowWeeks());
232 $this->form->addItem($cb);
233 }
234
235 // Day/Week View
236 $week_month = new ilFormSectionHeaderGUI();
237 $week_month->setTitle($this->lng->txt('cal_day_week_view'));
238 $this->form->addItem($week_month);
239
240 $day_start = new ilSelectInputGUI($this->lng->txt('cal_day_start'), 'dst');
241 $day_start->setOptions(
242 ilCalendarUtil::getHourSelection($this->user_settings->getTimeFormat())
243 );
244 $day_start->setValue($this->user_settings->getDayStart());
245 $this->form->addItem($day_start);
246
247 $day_end = new ilSelectInputGUI($this->lng->txt('cal_day_end'), 'den');
248 $day_end->setOptions(
249 ilCalendarUtil::getHourSelection($this->user_settings->getTimeFormat())
250 );
251 $day_end->setValue($this->user_settings->getDayEnd());
252 $this->form->addItem($day_end);
253 }
static _getShortTimeZoneList()
get short timezone list
static getHourSelection($a_format)
Get hour selectio 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, ilCalendarSettings\DATE_FORMAT_DMY, ilCalendarSettings\DATE_FORMAT_MDY, ilCalendarSettings\DATE_FORMAT_YMD, ilCalendarUtil\getHourSelection(), settings(), ilCalendarSettings\TIME_FORMAT_12, and ilCalendarSettings\TIME_FORMAT_24.

Referenced by show().

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

◆ save()

ilCalendarUserSettingsGUI::save ( )

save settings

@access public

Returns

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

135 {
136 $this->user_settings->setTimeZone($_POST['timezone']);
137 $this->user_settings->setExportTimeZoneType((int) $_POST['export_tz']);
138 $this->user_settings->setWeekStart((int) $_POST['weekstart']);
139 $this->user_settings->setDateFormat((int) $_POST['date_format']);
140 $this->user_settings->setTimeFormat((int) $_POST['time_format']);
141 $this->user_settings->setDayStart((int) $_POST['dst']);
142 $this->user_settings->setDayEnd((int) $_POST['den']);
143 if ($this->settings->getShowWeeks()) {
144 $this->user_settings->setShowWeeks((int) $_POST['show_weeks']);
145 }
146
147 if (((int) $_POST['den']) < (int) $_POST['dst']) {
148 ilUtil::sendFailure($this->lng->txt('cal_dstart_dend_warn'));
149 $this->show();
150 return false;
151 }
152
153 $this->user_settings->save();
154
155 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
156 $this->ctrl->redirect($this, "show");
157 }
$_POST["username"]
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.

References $_POST, ilUtil\sendFailure(), settings(), and show().

+ Here is the call graph for this function:

◆ show()

ilCalendarUserSettingsGUI::show ( )

show settings

@access public

Parameters

return

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

111 {
112 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.user_settings.html', 'Services/Calendar');
113
114 $this->initSettingsForm();
115 $this->tpl->setVariable('CAL_SETTINGS', $this->form->getHTML());
116 }

References initSettingsForm().

Referenced by save().

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

Field Documentation

◆ $lng

ilCalendarUserSettingsGUI::$lng
protected

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

Referenced by __construct().

◆ $settings

ilCalendarUserSettingsGUI::$settings
protected

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

◆ $tpl

ilCalendarUserSettingsGUI::$tpl
protected

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

Referenced by __construct().

◆ $user

ilCalendarUserSettingsGUI::$user
protected

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

◆ $user_settings

ilCalendarUserSettingsGUI::$user_settings
protected

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


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