ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $ilUser, ilCalendarSettings\_getInstance(), ilObjectFactory\getInstanceByObjId(), read(), settings(), and user().

47  {
48  global $ilUser;
49 
50  if ($ilUser->getId() == $a_user_id) {
51  $this->user = $ilUser;
52  } else {
53  $this->user = ilObjectFactory::getInstanceByObjId($a_user_id, false);
54  }
56  $this->read();
57  }
static _getInstance()
get singleton instance
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
settings()
Definition: settings.php:2
+ 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 81 of file class.ilCalendarUserSettings.php.

References $ilUser.

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

82  {
83  global $ilUser;
84 
85  return self::_getInstanceByUserId($ilUser->getId());
86  }
$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 261 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 227 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 204 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 185 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 134 of file class.ilCalendarUserSettings.php.

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

135  {
136  switch ($this->getExportTimeZoneType()) {
137  case self::CAL_EXPORT_TZ_TZ:
138  return $this->getTimeZone();
139 
140  case self::CAL_EXPORT_TZ_UTC:
141  include_once './Services/Calendar/classes/class.ilTimeZone.php';
142  return ilTimeZone::UTC;
143  }
144  }
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 116 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 291 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 250 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 95 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 166 of file class.ilCalendarUserSettings.php.

References $weekstart.

Referenced by save().

167  {
168  return (int) $this->weekstart;
169  }
+ Here is the caller graph for this function:

◆ read()

ilCalendarUserSettings::read ( )
protected

read

protected

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

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

Referenced by __construct().

321  {
322  $this->timezone = $this->user->getTimeZone();
323  $this->export_tz_type = (
324  ($this->user->getPref('export_tz_type') !== false) ?
325  $this->user->getPref('export_tz_type') :
327  );
328  $this->date_format = $this->user->getDateFormat();
329  $this->time_format = $this->user->getTimeFormat();
330  if (($weekstart = $this->user->getPref('weekstart')) === false) {
331  $weekstart = $this->settings->getDefaultWeekStart();
332  }
333  $this->calendar_selection_type = $this->user->getPref('calendar_selection_type') ?
334  $this->user->getPref('calendar_selection_type') :
335  self::CAL_SELECTION_MEMBERSHIP;
336 
337  $this->weekstart = $weekstart;
338 
339  $this->setDayStart(
340  $this->user->getPref('day_start') !== false ?
341  $this->user->getPref('day_start') :
342  $this->settings->getDefaultDayStart()
343  );
344  $this->setDayEnd(
345  $this->user->getPref('day_end') !== false ?
346  $this->user->getPref('day_end') :
347  $this->settings->getDefaultDayEnd()
348  );
349  $this->setShowWeeks(
350  $this->user->getPref('show_weeks') !== false ?
351  $this->user->getPref('show_weeks') :
352  $this->settings->getShowWeeks()
353  );
354  }
Set timezone
setDayStart($a_start)
Set start of day.
user()
Definition: user.php:4
settings()
Definition: settings.php:2
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 301 of file class.ilCalendarUserSettings.php.

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

302  {
303  $this->user->writePref('user_tz', $this->getTimeZone());
304  $this->user->writePref('export_tz_type', $this->getExportTimeZoneType());
305  $this->user->writePref('weekstart', $this->getWeekStart());
306  $this->user->writePref('date_format', $this->getDateFormat());
307  $this->user->writePref('time_format', $this->getTimeFormat());
308  $this->user->writePref('calendar_selection_type', $this->getCalendarSelectionType());
309  $this->user->writePref('day_start', $this->getDayStart());
310  $this->user->writePref('day_end', $this->getDayEnd());
311  $this->user->writePref('show_weeks', $this->getShowWeeks());
312  }
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 271 of file class.ilCalendarUserSettings.php.

References $a_type.

272  {
273  $this->calendar_selection_type = $a_type;
274  }
$a_type
Definition: workflow.php:92

◆ setDateFormat()

ilCalendarUserSettings::setDateFormat (   $a_format)

set date format

public

Parameters
intdate
Returns

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

217  {
218  $this->date_format = $a_format;
219  }

◆ setDayEnd()

ilCalendarUserSettings::setDayEnd (   $a_end)

Set day end.

Returns
Parameters
int$a_end

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

Referenced by read().

196  {
197  $this->day_end = $a_end;
198  }
+ 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 176 of file class.ilCalendarUserSettings.php.

Referenced by read().

177  {
178  $this->day_start = $a_start;
179  }
+ Here is the caller graph for this function:

◆ setExportTimeZoneType()

ilCalendarUserSettings::setExportTimeZoneType (   $a_type)

Set export timezone type.

Parameters
type$a_type

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

References $a_type.

126  {
127  $this->export_tz_type = $a_type;
128  }
$a_type
Definition: workflow.php:92

◆ setShowWeeks()

ilCalendarUserSettings::setShowWeeks (   $a_val)

Set show weeks.

Parameters
bool$a_valshow weeks

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

Referenced by read().

282  {
283  $this->show_weeks = $a_val;
284  }
+ Here is the caller graph for this function:

◆ setTimeFormat()

ilCalendarUserSettings::setTimeFormat (   $a_format)

set time format

public

Parameters
inttime
Returns

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

240  {
241  $this->time_format = $a_format;
242  }

◆ setTimeZone()

ilCalendarUserSettings::setTimeZone (   $a_tz)

set timezone

public

Parameters

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

References timezone.

108  {
109  $this->timezone = $a_tz;
110  }
Set timezone

◆ setWeekStart()

ilCalendarUserSettings::setWeekStart (   $a_weekstart)

set week start

public

Parameters

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

156  {
157  $this->weekstart = $a_weekstart;
158  }

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: