ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCalendarUserSettingsGUI::__construct ( )

Constructor.

public

Parameters

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

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

52  {
53  global $ilUser,$tpl,$lng,$ilCtrl;
54 
55  $this->tpl = $tpl;
56  $this->lng = $lng;
57  $this->lng->loadLanguageModule('dateplaner');
58  $this->lng->loadLanguageModule('jscalendar');
59 
60  $this->ctrl = $ilCtrl;
61 
62  $this->user = $ilUser;
64  $this->user_settings = ilCalendarUserSettings::_getInstanceByUserId($this->user->getId());
65 
66  }
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 112 of file class.ilCalendarUserSettingsGUI.php.

113  {
114  $this->ctrl->returnToParent($this);
115  }

◆ executeCommand()

ilCalendarUserSettingsGUI::executeCommand ( )

Execute command.

public

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

References $cmd, $ilSetting, and $ilUser.

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

◆ initSettingsForm()

ilCalendarUserSettingsGUI::initSettingsForm ( )

show settings table

public

Returns

Definition at line 153 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(), ilSelectInputGUI\setOptions(), ilRadioGroupInputGUI\setValue(), ilCalendarSettings\TIME_FORMAT_12, and ilCalendarSettings\TIME_FORMAT_24.

Referenced by show().

154  {
155  if(is_object($this->form))
156  {
157  return true;
158  }
159  include_once('Services/Calendar/classes/class.ilCalendarUtil.php');
160  include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
161 
162  $this->form = new ilPropertyFormGUI();
163  $this->form->setFormAction($this->ctrl->getFormAction($this,'save'));
164  $this->form->setTitle($this->lng->txt('cal_user_settings'));
165  $this->form->addCommandButton('save',$this->lng->txt('save'));
166  $this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
167 
168  $select = new ilSelectInputGUI($this->lng->txt('cal_user_timezone'),'timezone');
170  $select->setInfo($this->lng->txt('cal_timezone_info'));
171  $select->setValue($this->user_settings->getTimeZone());
172  $this->form->addItem($select);
173 
174  $export_type = new ilRadioGroupInputGUI($this->lng->txt('cal_export_timezone'),'export_tz');
175  $export_type->setValue($this->user_settings->getExportTimeZoneType());
176 
177  $export_tz = new ilRadioOption($this->lng->txt('cal_export_timezone_tz'), ilCalendarUserSettings::CAL_EXPORT_TZ_TZ);
178  $export_type->addOption($export_tz);
179  $export_utc = new ilRadioOption($this->lng->txt('cal_export_timezone_utc'), ilCalendarUserSettings::CAL_EXPORT_TZ_UTC);
180  $export_type->addOption($export_utc);
181  $this->form->addItem($export_type);
182 
183  $year = date("Y");
184  $select = new ilSelectInputGUI($this->lng->txt('cal_user_date_format'),'date_format');
185  $select->setOptions(array(
186  ilCalendarSettings::DATE_FORMAT_DMY => '31.10.'.$year,
187  ilCalendarSettings::DATE_FORMAT_YMD => $year."-10-31",
188  ilCalendarSettings::DATE_FORMAT_MDY => "10/31/".$year));
189  $select->setInfo($this->lng->txt('cal_date_format_info'));
190  $select->setValue($this->user_settings->getDateFormat());
191  $this->form->addItem($select);
192 
193  $select = new ilSelectInputGUI($this->lng->txt('cal_user_time_format'),'time_format');
194  $select->setOptions(array(
197  $select->setInfo($this->lng->txt('cal_time_format_info'));
198  $select->setValue($this->user_settings->getTimeFormat());
199  $this->form->addItem($select);
200 
201  // Week/Month View
202  $week_month = new ilFormSectionHeaderGUI();
203  $week_month->setTitle($this->lng->txt('cal_week_month_view'));
204  $this->form->addItem($week_month);
205 
206  $radio = new ilRadioGroupInputGUI($this->lng->txt('cal_week_start'),'weekstart');
207  $radio->setValue($this->user_settings->getWeekStart());
208 
209  $option = new ilRadioOption($this->lng->txt('l_su'),0);
210  $radio->addOption($option);
211  $option = new ilRadioOption($this->lng->txt('l_mo'),1);
212  $radio->addOption($option);
213  $this->form->addItem($radio);
214 
215  // Day/Week View
216  $week_month = new ilFormSectionHeaderGUI();
217  $week_month->setTitle($this->lng->txt('cal_day_week_view'));
218  $this->form->addItem($week_month);
219 
220  $day_start = new ilSelectInputGUI($this->lng->txt('cal_day_start'),'dst');
221  $day_start->setOptions(
222  ilCalendarUtil::getHourSelection($this->user_settings->getTimeFormat())
223  );
224  $day_start->setValue($this->user_settings->getDayStart());
225  $this->form->addItem($day_start);
226 
227  $day_end = new ilSelectInputGUI($this->lng->txt('cal_day_end'),'den');
228  $day_end->setOptions(
229  ilCalendarUtil::getHourSelection($this->user_settings->getTimeFormat())
230  );
231  $day_end->setValue($this->user_settings->getDayEnd());
232  $this->form->addItem($day_end);
233  }
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.
static _getShortTimeZoneList()
get short timezone list
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.
+ 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 123 of file class.ilCalendarUserSettingsGUI.php.

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

124  {
125 
126  $this->user_settings->setTimeZone($_POST['timezone']);
127  $this->user_settings->setExportTimeZoneType((int) $_POST['export_tz']);
128  $this->user_settings->setWeekStart((int) $_POST['weekstart']);
129  $this->user_settings->setDateFormat((int) $_POST['date_format']);
130  $this->user_settings->setTimeFormat((int) $_POST['time_format']);
131  $this->user_settings->setDayStart((int) $_POST['dst']);
132  $this->user_settings->setDayEnd((int) $_POST['den']);
133 
134  if(((int) $_POST['den']) < (int) $_POST['dst'])
135  {
136  ilUtil::sendFailure($this->lng->txt('cal_dstart_dend_warn'));
137  $this->show();
138  return false;
139  }
140 
141  $this->user_settings->save();
142 
143  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
144  $this->ctrl->returnToParent($this);
145  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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 99 of file class.ilCalendarUserSettingsGUI.php.

References initSettingsForm().

Referenced by save().

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


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