ILIAS  release_8 Revision v8.24
ilCalendarUserSettings Class Reference
+ Collaboration diagram for ilCalendarUserSettings:

Public Member Functions

 getTimeZone ()
 
 setTimeZone (string $a_tz)
 
 getExportTimeZoneType ()
 
 setExportTimeZoneType (int $a_type)
 
 getExportTimeZone ()
 
 setWeekStart (int $a_weekstart)
 
 getWeekStart ()
 
 setDayStart (int $a_start)
 
 getDayStart ()
 
 setDayEnd (int $a_end)
 
 getDayEnd ()
 
 setDateFormat (int $a_format)
 
 getDateFormat ()
 
 setTimeFormat (int $a_format)
 
 getTimeFormat ()
 
 getCalendarSelectionType ()
 get calendar selection type ("MyMembership" or "Selected Items") More...
 
 setCalendarSelectionType (int $a_type)
 set calendar selection type More...
 
 setShowWeeks (bool $a_val)
 
 getShowWeeks ()
 
 save ()
 

Static Public Member Functions

static _getInstanceByUserId (int $a_user_id)
 
static _getInstance ()
 

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 array $instances = array()
 

Protected Member Functions

 read ()
 

Protected Attributes

ilObjUser $user
 
ilCalendarSettings $settings
 

Private Member Functions

 __construct (int $a_user_id)
 

Private Attributes

int $calendar_selection_type = 1
 
string $timezone = ilTimeZone::UTC
 
int $export_tz_type = self::CAL_EXPORT_TZ_TZ
 
int $weekstart = 0
 
int $time_format = 0
 
int $date_format = 0
 
int $day_start = 0
 
int $day_end = 0
 
bool $show_weeks = true
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilCalendarUserSettings::__construct ( int  $a_user_id)
private

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

34 {
35 global $DIC;
36
37 $this->user = $DIC->user();
38
39 if ($this->user->getId() !== $a_user_id) {
40 $user = ilObjectFactory::getInstanceByObjId($a_user_id, false);
41 if ($user instanceof ilObjUser) {
42 $this->user = $user;
43 } else {
44 throw new DomainException('Invalid user id given: ' . $a_user_id);
45 }
46 }
48 $this->read();
49 }
User class.
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
global $DIC
Definition: feed.php:28

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

+ Here is the call graph for this function:

Member Function Documentation

◆ _getInstance()

static ilCalendarUserSettings::_getInstance ( )
static

◆ _getInstanceByUserId()

◆ getCalendarSelectionType()

ilCalendarUserSettings::getCalendarSelectionType ( )

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

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

153 : int
154 {
156 }

References $calendar_selection_type.

Referenced by save().

+ Here is the caller graph for this function:

◆ getDateFormat()

ilCalendarUserSettings::getDateFormat ( )

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

134 : int
135 {
136 return $this->date_format;
137 }

References $date_format.

Referenced by save().

+ Here is the caller graph for this function:

◆ getDayEnd()

ilCalendarUserSettings::getDayEnd ( )

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

124 : int
125 {
126 return $this->day_end;
127 }

References $day_end.

Referenced by save().

+ Here is the caller graph for this function:

◆ getDayStart()

ilCalendarUserSettings::getDayStart ( )

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

114 : int
115 {
116 return $this->day_start;
117 }

References $day_start.

Referenced by save().

+ Here is the caller graph for this function:

◆ getExportTimeZone()

ilCalendarUserSettings::getExportTimeZone ( )

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

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

+ Here is the call graph for this function:

◆ getExportTimeZoneType()

ilCalendarUserSettings::getExportTimeZoneType ( )

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

77 : int
78 {
80 }

References $export_tz_type.

Referenced by getExportTimeZone(), and save().

+ Here is the caller graph for this function:

◆ getShowWeeks()

ilCalendarUserSettings::getShowWeeks ( )

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

173 : bool
174 {
175 return $this->show_weeks;
176 }

References $show_weeks.

Referenced by save().

+ Here is the caller graph for this function:

◆ getTimeFormat()

ilCalendarUserSettings::getTimeFormat ( )

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

144 : int
145 {
146 return $this->time_format;
147 }

References $time_format.

Referenced by save().

+ Here is the caller graph for this function:

◆ getTimeZone()

ilCalendarUserSettings::getTimeZone ( )

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

67 : string
68 {
69 return $this->timezone;
70 }

References $timezone.

Referenced by getExportTimeZone(), and save().

+ Here is the caller graph for this function:

◆ getWeekStart()

ilCalendarUserSettings::getWeekStart ( )

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

104 : int
105 {
106 return $this->weekstart;
107 }

References $weekstart.

Referenced by save().

+ Here is the caller graph for this function:

◆ read()

ilCalendarUserSettings::read ( )
protected

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

191 : void
192 {
193 $this->timezone = (string) $this->user->getTimeZone();
194 $this->export_tz_type = (int) (
195 ($this->user->getPref('export_tz_type') !== false) ?
196 $this->user->getPref('export_tz_type') :
198 );
199 $this->date_format = (int) $this->user->getDateFormat();
200 $this->time_format = (int) $this->user->getTimeFormat();
201 if (($weekstart = $this->user->getPref('weekstart')) === false) {
202 $weekstart = $this->settings->getDefaultWeekStart();
203 }
204 $this->calendar_selection_type = (int) $this->user->getPref('calendar_selection_type') ?
205 (int) $this->user->getPref('calendar_selection_type') :
207
208 $this->weekstart = (int) $weekstart;
209
210 $this->setDayStart(
211 $this->user->getPref('day_start') ?
212 (int) $this->user->getPref('day_start') :
213 $this->settings->getDefaultDayStart()
214 );
215 $this->setDayEnd(
216 $this->user->getPref('day_end') ?
217 (int) $this->user->getPref('day_end') :
218 $this->settings->getDefaultDayEnd()
219 );
220 $this->setShowWeeks(
221 $this->user->getPref('show_weeks') !== null ?
222 (bool) $this->user->getPref('show_weeks') :
223 $this->settings->getShowWeeks()
224 );
225 }

References $export_tz_type, $weekstart, CAL_SELECTION_MEMBERSHIP, ILIAS\Repository\int(), setDayEnd(), setDayStart(), setShowWeeks(), ILIAS\Repository\settings(), and ILIAS\Repository\user().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilCalendarUserSettings::save ( )

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

179 {
180 $this->user->writePref('user_tz', $this->getTimeZone());
181 $this->user->writePref('export_tz_type', (string) $this->getExportTimeZoneType());
182 $this->user->writePref('weekstart', (string) $this->getWeekStart());
183 $this->user->writePref('date_format', (string) $this->getDateFormat());
184 $this->user->writePref('time_format', (string) $this->getTimeFormat());
185 $this->user->writePref('calendar_selection_type', (string) $this->getCalendarSelectionType());
186 $this->user->writePref('day_start', (string) $this->getDayStart());
187 $this->user->writePref('day_end', (string) $this->getDayEnd());
188 $this->user->writePref('show_weeks', (string) $this->getShowWeeks());
189 }
getCalendarSelectionType()
get calendar selection type ("MyMembership" or "Selected Items")

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

+ Here is the call graph for this function:

◆ setCalendarSelectionType()

ilCalendarUserSettings::setCalendarSelectionType ( int  $a_type)

set calendar selection type

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

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

164 {
165 $this->calendar_selection_type = $a_type;
166 }

◆ setDateFormat()

ilCalendarUserSettings::setDateFormat ( int  $a_format)

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

129 : void
130 {
131 $this->date_format = $a_format;
132 }

◆ setDayEnd()

ilCalendarUserSettings::setDayEnd ( int  $a_end)

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

119 : void
120 {
121 $this->day_end = $a_end;
122 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDayStart()

ilCalendarUserSettings::setDayStart ( int  $a_start)

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

109 : void
110 {
111 $this->day_start = $a_start;
112 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setExportTimeZoneType()

ilCalendarUserSettings::setExportTimeZoneType ( int  $a_type)

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

82 : void
83 {
84 $this->export_tz_type = $a_type;
85 }

◆ setShowWeeks()

ilCalendarUserSettings::setShowWeeks ( bool  $a_val)

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

168 : void
169 {
170 $this->show_weeks = $a_val;
171 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTimeFormat()

ilCalendarUserSettings::setTimeFormat ( int  $a_format)

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

139 : void
140 {
141 $this->time_format = $a_format;
142 }

◆ setTimeZone()

ilCalendarUserSettings::setTimeZone ( string  $a_tz)

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

72 : void
73 {
74 $this->timezone = $a_tz;
75 }

◆ setWeekStart()

ilCalendarUserSettings::setWeekStart ( int  $a_weekstart)

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

99 : void
100 {
101 $this->weekstart = $a_weekstart;
102 }

Field Documentation

◆ $calendar_selection_type

int ilCalendarUserSettings::$calendar_selection_type = 1
private

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

Referenced by getCalendarSelectionType().

◆ $date_format

int ilCalendarUserSettings::$date_format = 0
private

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

Referenced by getDateFormat().

◆ $day_end

int ilCalendarUserSettings::$day_end = 0
private

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

Referenced by getDayEnd().

◆ $day_start

int ilCalendarUserSettings::$day_start = 0
private

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

Referenced by getDayStart().

◆ $export_tz_type

int ilCalendarUserSettings::$export_tz_type = self::CAL_EXPORT_TZ_TZ
private

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

Referenced by getExportTimeZoneType(), and read().

◆ $instances

array ilCalendarUserSettings::$instances = array()
static

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

◆ $settings

ilCalendarSettings ilCalendarUserSettings::$settings
protected

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

◆ $show_weeks

bool ilCalendarUserSettings::$show_weeks = true
private

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

Referenced by getShowWeeks().

◆ $time_format

int ilCalendarUserSettings::$time_format = 0
private

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

Referenced by getTimeFormat().

◆ $timezone

string ilCalendarUserSettings::$timezone = ilTimeZone::UTC
private

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

Referenced by getTimeZone().

◆ $user

ilObjUser ilCalendarUserSettings::$user
protected

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

Referenced by __construct().

◆ $weekstart

int ilCalendarUserSettings::$weekstart = 0
private

Definition at line 25 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: