ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $ilCtrl, $ilUser, $lng, $tpl, ilCalendarSettings\_getInstance(), ilCalendarUserSettings\_getInstanceByUserId(), settings(), and user().

57  {
58  global $ilUser,$tpl,$lng,$ilCtrl;
59 
60  $this->tpl = $tpl;
61  $this->lng = $lng;
62  $this->lng->loadLanguageModule('dateplaner');
63  $this->lng->loadLanguageModule('jscalendar');
64 
65  $this->ctrl = $ilCtrl;
66 
67  $this->user = $ilUser;
69  $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
70  }
static _getInstance()
get singleton instance
static _getInstanceByUserId($a_user_id)
get singleton instance
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ cancel()

ilCalendarUserSettingsGUI::cancel ( )

cancel editing

public

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

116  {
117  $this->ctrl->returnToParent($this);
118  }

◆ executeCommand()

ilCalendarUserSettingsGUI::executeCommand ( )

Execute command.

public

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

References $ilSetting, and $ilUser.

80  {
81  global $ilUser, $ilSetting;
82 
83 
84  $next_class = $this->ctrl->getNextClass();
85 
86  switch ($next_class) {
87  default:
88  $cmd = $this->ctrl->getCmd("show");
89  $this->$cmd();
90  break;
91  }
92  return true;
93  }
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17

◆ initSettingsForm()

ilCalendarUserSettingsGUI::initSettingsForm ( )

show settings table

public

Returns

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

References ilCalendarUtil\_getShortTimeZoneList(), array, ilCalendarUserSettings\CAL_EXPORT_TZ_TZ, ilCalendarUserSettings\CAL_EXPORT_TZ_UTC, date, 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().

158  {
159  if (is_object($this->form)) {
160  return true;
161  }
162  include_once('Services/Calendar/classes/class.ilCalendarUtil.php');
163  include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
164 
165  $this->form = new ilPropertyFormGUI();
166  $this->form->setFormAction($this->ctrl->getFormAction($this, 'save'));
167  $this->form->setTitle($this->lng->txt('cal_user_settings'));
168  $this->form->addCommandButton('save', $this->lng->txt('save'));
169  //$this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
170 
171  $select = new ilSelectInputGUI($this->lng->txt('cal_user_timezone'), 'timezone');
173  $select->setInfo($this->lng->txt('cal_timezone_info'));
174  $select->setValue($this->user_settings->getTimeZone());
175  $this->form->addItem($select);
176 
177  $export_type = new ilRadioGroupInputGUI($this->lng->txt('cal_export_timezone'), 'export_tz');
178  $export_type->setValue($this->user_settings->getExportTimeZoneType());
179 
180  $export_tz = new ilRadioOption($this->lng->txt('cal_export_timezone_tz'), ilCalendarUserSettings::CAL_EXPORT_TZ_TZ);
181  $export_type->addOption($export_tz);
182  $export_utc = new ilRadioOption($this->lng->txt('cal_export_timezone_utc'), ilCalendarUserSettings::CAL_EXPORT_TZ_UTC);
183  $export_type->addOption($export_utc);
184  $this->form->addItem($export_type);
185 
186  $year = date("Y");
187  $select = new ilSelectInputGUI($this->lng->txt('cal_user_date_format'), 'date_format');
188  $select->setOptions(array(
189  ilCalendarSettings::DATE_FORMAT_DMY => '31.10.' . $year,
190  ilCalendarSettings::DATE_FORMAT_YMD => $year . "-10-31",
191  ilCalendarSettings::DATE_FORMAT_MDY => "10/31/" . $year));
192  $select->setInfo($this->lng->txt('cal_date_format_info'));
193  $select->setValue($this->user_settings->getDateFormat());
194  $this->form->addItem($select);
195 
196  $select = new ilSelectInputGUI($this->lng->txt('cal_user_time_format'), 'time_format');
197  $select->setOptions(array(
200  $select->setInfo($this->lng->txt('cal_time_format_info'));
201  $select->setValue($this->user_settings->getTimeFormat());
202  $this->form->addItem($select);
203 
204  // Week/Month View
205  $week_month = new ilFormSectionHeaderGUI();
206  $week_month->setTitle($this->lng->txt('cal_week_month_view'));
207  $this->form->addItem($week_month);
208 
209  $radio = new ilRadioGroupInputGUI($this->lng->txt('cal_week_start'), 'weekstart');
210  $radio->setValue($this->user_settings->getWeekStart());
211 
212  $option = new ilRadioOption($this->lng->txt('l_su'), 0);
213  $radio->addOption($option);
214  $option = new ilRadioOption($this->lng->txt('l_mo'), 1);
215  $radio->addOption($option);
216  $this->form->addItem($radio);
217 
218  if ($this->settings->getShowWeeks()) {
219  //
220  $cb = new ilCheckboxInputGUI($this->lng->txt("cal_usr_show_weeks"), "show_weeks");
221  $cb->setInfo($this->lng->txt("cal_usr_show_weeks_info"));
222  $cb->setValue(1);
223  $cb->setChecked($this->user_settings->getShowWeeks());
224  $this->form->addItem($cb);
225  }
226 
227  // Day/Week View
228  $week_month = new ilFormSectionHeaderGUI();
229  $week_month->setTitle($this->lng->txt('cal_day_week_view'));
230  $this->form->addItem($week_month);
231 
232  $day_start = new ilSelectInputGUI($this->lng->txt('cal_day_start'), 'dst');
233  $day_start->setOptions(
234  ilCalendarUtil::getHourSelection($this->user_settings->getTimeFormat())
235  );
236  $day_start->setValue($this->user_settings->getDayStart());
237  $this->form->addItem($day_start);
238 
239  $day_end = new ilSelectInputGUI($this->lng->txt('cal_day_end'), 'den');
240  $day_end->setOptions(
241  ilCalendarUtil::getHourSelection($this->user_settings->getTimeFormat())
242  );
243  $day_end->setValue($this->user_settings->getDayEnd());
244  $this->form->addItem($day_end);
245  }
This class represents an option in a radio group.
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.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
setOptions($a_options)
Set Options.
Create styles array
The data for the language used.
settings()
Definition: settings.php:2
+ 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 126 of file class.ilCalendarUserSettingsGUI.php.

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

127  {
128  $this->user_settings->setTimeZone($_POST['timezone']);
129  $this->user_settings->setExportTimeZoneType((int) $_POST['export_tz']);
130  $this->user_settings->setWeekStart((int) $_POST['weekstart']);
131  $this->user_settings->setDateFormat((int) $_POST['date_format']);
132  $this->user_settings->setTimeFormat((int) $_POST['time_format']);
133  $this->user_settings->setDayStart((int) $_POST['dst']);
134  $this->user_settings->setDayEnd((int) $_POST['den']);
135  if ($this->settings->getShowWeeks()) {
136  $this->user_settings->setShowWeeks((int) $_POST['show_weeks']);
137  }
138 
139  if (((int) $_POST['den']) < (int) $_POST['dst']) {
140  ilUtil::sendFailure($this->lng->txt('cal_dstart_dend_warn'));
141  $this->show();
142  return false;
143  }
144 
145  $this->user_settings->save();
146 
147  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
148  $this->ctrl->redirect($this, "show");
149  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
settings()
Definition: settings.php:2
$_POST["username"]
+ Here is the call graph for this function:

◆ show()

ilCalendarUserSettingsGUI::show ( )

show settings

public

Parameters

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

References initSettingsForm().

Referenced by save().

103  {
104  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.user_settings.html', 'Services/Calendar');
105 
106  $this->initSettingsForm();
107  $this->tpl->setVariable('CAL_SETTINGS', $this->form->getHTML());
108  }
+ 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: