ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilCalendarUserSettings Class Reference
+ Collaboration diagram for ilCalendarUserSettings:

Public Member Functions

 getTimeZone ()
 get Time zone More...
 
 setTimeZone ($a_tz)
 set timezone More...
 
 getExportTimeZoneType ()
 Get export timezone setting. More...
 
 setExportTimeZoneType ($a_type)
 Set export timezone type. More...
 
 getExportTimeZone ()
 Get export timezone. More...
 
 setWeekStart ($a_weekstart)
 set week start More...
 
 getWeekStart ()
 get weekstart More...
 
 setDayStart ($a_start)
 Set start of day. More...
 
 getDayStart ()
 get start of day More...
 
 setDayEnd ($a_end)
 Set day end. More...
 
 getDayEnd ()
 Get end of day. More...
 
 setDateFormat ($a_format)
 set date format More...
 
 getDateFormat ()
 get date format More...
 
 setTimeFormat ($a_format)
 set time format More...
 
 getTimeFormat ()
 get time format More...
 
 getCalendarSelectionType ()
 get calendar selection type ("MyMembership" or "Selected Items") More...
 
 setCalendarSelectionType ($a_type)
 set calendar selection type More...
 
 setShowWeeks ($a_val)
 Set show weeks. More...
 
 getShowWeeks ()
 Get show weeks. More...
 
 save ()
 save More...
 

Static Public Member Functions

static _getInstanceByUserId ($a_user_id)
 get singleton instance More...
 
static _getInstance ()
 get instance for logged in user More...
 

Data Fields

const CAL_SELECTION_MEMBERSHIP = 1
 
const CAL_SELECTION_ITEMS = 2
 
const CAL_EXPORT_TZ_TZ = 1
 
const CAL_EXPORT_TZ_UTC = 2
 

Static Public Attributes

static $instances = array()
 

Protected Member Functions

 read ()
 read More...
 

Protected Attributes

 $user
 
 $settings
 

Private Member Functions

 __construct ($a_user_id)
 Constructor. More...
 

Private Attributes

 $calendar_selection_type = 1
 
 $timezone
 
 $export_tz_type = self::CAL_EXPORT_TZ_TZ
 
 $weekstart
 
 $time_format
 
 $date_format
 
 $day_start
 
 $day_end
 
 $show_weeks = true
 

Detailed Description

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

Definition at line 11 of file class.ilCalendarUserSettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarUserSettings::__construct (   $a_user_id)
private

Constructor.

private

Parameters

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

References $DIC, $ilUser, ilCalendarSettings\_getInstance(), ilObjectFactory\getInstanceByObjId(), read(), settings(), and user().

47  {
48  global $DIC;
49 
50  $ilUser = $DIC['ilUser'];
51 
52  if ($ilUser->getId() == $a_user_id) {
53  $this->user = $ilUser;
54  } else {
55  $this->user = ilObjectFactory::getInstanceByObjId($a_user_id, false);
56  }
58  $this->read();
59  }
static _getInstance()
get singleton instance
settings()
Definition: settings.php:2
global $DIC
Definition: saml.php:7
user()
Definition: user.php:4
$ilUser
Definition: imgupload.php:18
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
+ Here is the call graph for this function:

Member Function Documentation

◆ _getInstance()

static ilCalendarUserSettings::_getInstance ( )
static

get instance for logged in user

Returns
object ilCalendarUserSettings

Definition at line 83 of file class.ilCalendarUserSettings.php.

References $DIC, and $ilUser.

Referenced by ilCalendarSelectionBlockGUI\__construct(), ilCalendarPresentationGUI\__construct(), ilCalendarCategoryGUI\appendCalendarSelection(), ilCalendarSelectionBlockGUI\getCalendars(), ilPDCalendarBlockGUI\initCategories(), ilCalendarCategories\initialize(), and ilCalendarCategoryGUI\switchCalendarMode().

84  {
85  global $DIC;
86 
87  $ilUser = $DIC['ilUser'];
88 
89  return self::_getInstanceByUserId($ilUser->getId());
90  }
global $DIC
Definition: saml.php:7
$ilUser
Definition: imgupload.php:18
+ Here is the caller graph for this function:

◆ _getInstanceByUserId()

◆ getCalendarSelectionType()

ilCalendarUserSettings::getCalendarSelectionType ( )

get calendar selection type ("MyMembership" or "Selected Items")

Returns

Definition at line 265 of file class.ilCalendarUserSettings.php.

References $calendar_selection_type.

Referenced by save().

+ Here is the caller graph for this function:

◆ getDateFormat()

ilCalendarUserSettings::getDateFormat ( )

get date format

public

Returns
int date format

Definition at line 231 of file class.ilCalendarUserSettings.php.

References $date_format.

Referenced by save().

+ Here is the caller graph for this function:

◆ getDayEnd()

ilCalendarUserSettings::getDayEnd ( )

Get end of day.

Returns

Definition at line 208 of file class.ilCalendarUserSettings.php.

References $day_end.

Referenced by save().

+ Here is the caller graph for this function:

◆ getDayStart()

ilCalendarUserSettings::getDayStart ( )

get start of day

Returns

Definition at line 189 of file class.ilCalendarUserSettings.php.

References $day_start.

Referenced by save().

+ Here is the caller graph for this function:

◆ getExportTimeZone()

ilCalendarUserSettings::getExportTimeZone ( )

Get export timezone.

Returns
type

Definition at line 138 of file class.ilCalendarUserSettings.php.

References getExportTimeZoneType(), getTimeZone(), and ilTimeZone\UTC.

139  {
140  switch ($this->getExportTimeZoneType()) {
141  case self::CAL_EXPORT_TZ_TZ:
142  return $this->getTimeZone();
143 
144  case self::CAL_EXPORT_TZ_UTC:
145  include_once './Services/Calendar/classes/class.ilTimeZone.php';
146  return ilTimeZone::UTC;
147  }
148  }
getExportTimeZoneType()
Get export timezone setting.
+ Here is the call graph for this function:

◆ getExportTimeZoneType()

ilCalendarUserSettings::getExportTimeZoneType ( )

Get export timezone setting.

Returns
type

Definition at line 120 of file class.ilCalendarUserSettings.php.

References $export_tz_type.

Referenced by getExportTimeZone(), and save().

+ Here is the caller graph for this function:

◆ getShowWeeks()

ilCalendarUserSettings::getShowWeeks ( )

Get show weeks.

Returns
bool show weeks

Definition at line 295 of file class.ilCalendarUserSettings.php.

References $show_weeks.

Referenced by save().

+ Here is the caller graph for this function:

◆ getTimeFormat()

ilCalendarUserSettings::getTimeFormat ( )

get time format

public

Returns
int time format

Definition at line 254 of file class.ilCalendarUserSettings.php.

References $time_format.

Referenced by save().

+ Here is the caller graph for this function:

◆ getTimeZone()

ilCalendarUserSettings::getTimeZone ( )

get Time zone

public

Parameters

Definition at line 99 of file class.ilCalendarUserSettings.php.

References $timezone.

Referenced by getExportTimeZone(), and save().

+ Here is the caller graph for this function:

◆ getWeekStart()

ilCalendarUserSettings::getWeekStart ( )

get weekstart

public

Returns

Definition at line 170 of file class.ilCalendarUserSettings.php.

References $weekstart.

Referenced by save().

171  {
172  return (int) $this->weekstart;
173  }
+ Here is the caller graph for this function:

◆ read()

ilCalendarUserSettings::read ( )
protected

read

protected

Definition at line 324 of file class.ilCalendarUserSettings.php.

References $export_tz_type, $weekstart, setDayEnd(), setDayStart(), setShowWeeks(), settings(), and user().

Referenced by __construct().

325  {
326  $this->timezone = $this->user->getTimeZone();
327  $this->export_tz_type = (
328  ($this->user->getPref('export_tz_type') !== false) ?
329  $this->user->getPref('export_tz_type') :
331  );
332  $this->date_format = $this->user->getDateFormat();
333  $this->time_format = $this->user->getTimeFormat();
334  if (($weekstart = $this->user->getPref('weekstart')) === false) {
335  $weekstart = $this->settings->getDefaultWeekStart();
336  }
337  $this->calendar_selection_type = $this->user->getPref('calendar_selection_type') ?
338  $this->user->getPref('calendar_selection_type') :
339  self::CAL_SELECTION_MEMBERSHIP;
340 
341  $this->weekstart = $weekstart;
342 
343  $this->setDayStart(
344  $this->user->getPref('day_start') !== false ?
345  $this->user->getPref('day_start') :
346  $this->settings->getDefaultDayStart()
347  );
348  $this->setDayEnd(
349  $this->user->getPref('day_end') !== false ?
350  $this->user->getPref('day_end') :
351  $this->settings->getDefaultDayEnd()
352  );
353  $this->setShowWeeks(
354  $this->user->getPref('show_weeks') !== false ?
355  $this->user->getPref('show_weeks') :
356  $this->settings->getShowWeeks()
357  );
358  }
settings()
Definition: settings.php:2
setDayStart($a_start)
Set start of day.
user()
Definition: user.php:4
setShowWeeks($a_val)
Set show weeks.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilCalendarUserSettings::save ( )

save

public

Definition at line 305 of file class.ilCalendarUserSettings.php.

References getCalendarSelectionType(), getDateFormat(), getDayEnd(), getDayStart(), getExportTimeZoneType(), getShowWeeks(), getTimeFormat(), getTimeZone(), getWeekStart(), and user().

306  {
307  $this->user->writePref('user_tz', $this->getTimeZone());
308  $this->user->writePref('export_tz_type', $this->getExportTimeZoneType());
309  $this->user->writePref('weekstart', $this->getWeekStart());
310  $this->user->writePref('date_format', $this->getDateFormat());
311  $this->user->writePref('time_format', $this->getTimeFormat());
312  $this->user->writePref('calendar_selection_type', $this->getCalendarSelectionType());
313  $this->user->writePref('day_start', $this->getDayStart());
314  $this->user->writePref('day_end', $this->getDayEnd());
315  $this->user->writePref('show_weeks', $this->getShowWeeks());
316  }
user()
Definition: user.php:4
getCalendarSelectionType()
get calendar selection type ("MyMembership" or "Selected Items")
getExportTimeZoneType()
Get export timezone setting.
+ Here is the call graph for this function:

◆ setCalendarSelectionType()

ilCalendarUserSettings::setCalendarSelectionType (   $a_type)

set calendar selection type

Parameters
int$typeself::CAL_SELECTION_MEMBERSHIP | self::CAL_SELECTION_ITEM
Returns
void

Definition at line 275 of file class.ilCalendarUserSettings.php.

References $a_type.

276  {
277  $this->calendar_selection_type = $a_type;
278  }
$a_type
Definition: workflow.php:92

◆ setDateFormat()

ilCalendarUserSettings::setDateFormat (   $a_format)

set date format

public

Parameters
intdate
Returns

Definition at line 220 of file class.ilCalendarUserSettings.php.

221  {
222  $this->date_format = $a_format;
223  }

◆ setDayEnd()

ilCalendarUserSettings::setDayEnd (   $a_end)

Set day end.

Returns
Parameters
int$a_end

Definition at line 199 of file class.ilCalendarUserSettings.php.

Referenced by read().

200  {
201  $this->day_end = $a_end;
202  }
+ Here is the caller graph for this function:

◆ setDayStart()

ilCalendarUserSettings::setDayStart (   $a_start)

Set start of day.

Returns
Parameters
int$a_start

Definition at line 180 of file class.ilCalendarUserSettings.php.

Referenced by read().

181  {
182  $this->day_start = $a_start;
183  }
+ Here is the caller graph for this function:

◆ setExportTimeZoneType()

ilCalendarUserSettings::setExportTimeZoneType (   $a_type)

Set export timezone type.

Parameters
type$a_type

Definition at line 129 of file class.ilCalendarUserSettings.php.

References $a_type.

130  {
131  $this->export_tz_type = $a_type;
132  }
$a_type
Definition: workflow.php:92

◆ setShowWeeks()

ilCalendarUserSettings::setShowWeeks (   $a_val)

Set show weeks.

Parameters
bool$a_valshow weeks

Definition at line 285 of file class.ilCalendarUserSettings.php.

Referenced by read().

286  {
287  $this->show_weeks = $a_val;
288  }
+ Here is the caller graph for this function:

◆ setTimeFormat()

ilCalendarUserSettings::setTimeFormat (   $a_format)

set time format

public

Parameters
inttime
Returns

Definition at line 243 of file class.ilCalendarUserSettings.php.

244  {
245  $this->time_format = $a_format;
246  }

◆ setTimeZone()

ilCalendarUserSettings::setTimeZone (   $a_tz)

set timezone

public

Parameters

Definition at line 111 of file class.ilCalendarUserSettings.php.

112  {
113  $this->timezone = $a_tz;
114  }

◆ setWeekStart()

ilCalendarUserSettings::setWeekStart (   $a_weekstart)

set week start

public

Parameters

Definition at line 159 of file class.ilCalendarUserSettings.php.

160  {
161  $this->weekstart = $a_weekstart;
162  }

Field Documentation

◆ $calendar_selection_type

ilCalendarUserSettings::$calendar_selection_type = 1
private

Definition at line 24 of file class.ilCalendarUserSettings.php.

Referenced by getCalendarSelectionType().

◆ $date_format

ilCalendarUserSettings::$date_format
private

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

Referenced by getDateFormat().

◆ $day_end

ilCalendarUserSettings::$day_end
private

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

Referenced by getDayEnd().

◆ $day_start

ilCalendarUserSettings::$day_start
private

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

Referenced by getDayStart().

◆ $export_tz_type

ilCalendarUserSettings::$export_tz_type = self::CAL_EXPORT_TZ_TZ
private

Definition at line 26 of file class.ilCalendarUserSettings.php.

Referenced by getExportTimeZoneType(), and read().

◆ $instances

ilCalendarUserSettings::$instances = array()
static

Definition at line 19 of file class.ilCalendarUserSettings.php.

◆ $settings

ilCalendarUserSettings::$settings
protected

Definition at line 22 of file class.ilCalendarUserSettings.php.

◆ $show_weeks

ilCalendarUserSettings::$show_weeks = true
private

Definition at line 37 of file class.ilCalendarUserSettings.php.

Referenced by getShowWeeks().

◆ $time_format

ilCalendarUserSettings::$time_format
private

Definition at line 28 of file class.ilCalendarUserSettings.php.

Referenced by getTimeFormat().

◆ $timezone

ilCalendarUserSettings::$timezone
private

Definition at line 25 of file class.ilCalendarUserSettings.php.

Referenced by getTimeZone().

◆ $user

ilCalendarUserSettings::$user
protected

Definition at line 21 of file class.ilCalendarUserSettings.php.

◆ $weekstart

ilCalendarUserSettings::$weekstart
private

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

Referenced by getWeekStart(), and read().

◆ CAL_EXPORT_TZ_TZ

const ilCalendarUserSettings::CAL_EXPORT_TZ_TZ = 1

◆ CAL_EXPORT_TZ_UTC

const ilCalendarUserSettings::CAL_EXPORT_TZ_UTC = 2

◆ CAL_SELECTION_ITEMS

const ilCalendarUserSettings::CAL_SELECTION_ITEMS = 2

◆ CAL_SELECTION_MEMBERSHIP


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