ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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

Constructor & Destructor Documentation

◆ __construct()

ilCalendarUserSettingsGUI::__construct ( )

Constructor.

public

Parameters

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

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

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  }
static _getInstance()
get singleton instance
settings()
Definition: settings.php:2
global $DIC
Definition: saml.php:7
static _getInstanceByUserId($a_user_id)
get singleton instance
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

Member Function Documentation

◆ cancel()

ilCalendarUserSettingsGUI::cancel ( )

cancel editing

public

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

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

◆ executeCommand()

ilCalendarUserSettingsGUI::executeCommand ( )

Execute command.

public

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

References $DIC, $ilSetting, and $ilUser.

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 $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17

◆ initSettingsForm()

ilCalendarUserSettingsGUI::initSettingsForm ( )

show settings table

public

Returns

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

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(), ilFormPropertyGUI\setInfo(), ilSelectInputGUI\setOptions(), settings(), ilRadioGroupInputGUI\setValue(), ilCalendarSettings\TIME_FORMAT_12, and ilCalendarSettings\TIME_FORMAT_24.

Referenced by show().

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');
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  }
This class represents an option in a radio group.
settings()
Definition: settings.php:2
This class represents a selection list property in a property form.
This class represents a property form user interface.
static getHourSelection($a_format)
Get hour selectio depending on user specific hour format.
This class represents a section header in a property form.
This class represents a checkbox property in a property form.
static _getShortTimeZoneList()
get short timezone list
setInfo($a_info)
Set Information Text.
This class represents a property in a property form.
setOptions($a_options)
Set Options.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilCalendarUserSettingsGUI::save ( )

save settings

public

Returns

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

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

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  }
settings()
Definition: settings.php:2
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ show()

ilCalendarUserSettingsGUI::show ( )

show settings

public

Parameters

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

References initSettingsForm().

Referenced by save().

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  }
+ 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: