ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 ()
 
 translateDateFormatToId (DateFormat $format)
 

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 51 of file class.ilCalendarUserSettings.php.

52 {
53 global $DIC;
54
55 $this->user = $DIC->user();
56
57 if ($this->user->getId() !== $a_user_id) {
58 $user = ilObjectFactory::getInstanceByObjId($a_user_id, false);
59 if ($user instanceof ilObjUser) {
60 $this->user = $user;
61 } else {
62 throw new DomainException('Invalid user id given: ' . $a_user_id);
63 }
64 }
66 $this->read();
67 }
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: shib_login.php:26

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 171 of file class.ilCalendarUserSettings.php.

171 : int
172 {
174 }

References $calendar_selection_type.

Referenced by save().

+ Here is the caller graph for this function:

◆ getDateFormat()

ilCalendarUserSettings::getDateFormat ( )

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

152 : int
153 {
154 return $this->date_format;
155 }

References $date_format.

Referenced by save().

+ Here is the caller graph for this function:

◆ getDayEnd()

ilCalendarUserSettings::getDayEnd ( )

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

142 : int
143 {
144 return $this->day_end;
145 }

References $day_end.

Referenced by save().

+ Here is the caller graph for this function:

◆ getDayStart()

ilCalendarUserSettings::getDayStart ( )

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

132 : int
133 {
134 return $this->day_start;
135 }

References $day_start.

Referenced by save().

+ Here is the caller graph for this function:

◆ getExportTimeZone()

ilCalendarUserSettings::getExportTimeZone ( )

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

105 : string
106 {
107 switch ($this->getExportTimeZoneType()) {
109 return $this->getTimeZone();
110
112 return ilTimeZone::UTC;
113 }
114 return '';
115 }

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 95 of file class.ilCalendarUserSettings.php.

95 : int
96 {
98 }

References $export_tz_type.

Referenced by getExportTimeZone(), and save().

+ Here is the caller graph for this function:

◆ getShowWeeks()

ilCalendarUserSettings::getShowWeeks ( )

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

191 : bool
192 {
193 return $this->show_weeks;
194 }

References $show_weeks.

Referenced by save().

+ Here is the caller graph for this function:

◆ getTimeFormat()

ilCalendarUserSettings::getTimeFormat ( )

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

162 : int
163 {
164 return $this->time_format;
165 }

References $time_format.

Referenced by save().

+ Here is the caller graph for this function:

◆ getTimeZone()

ilCalendarUserSettings::getTimeZone ( )

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

85 : string
86 {
87 return $this->timezone;
88 }

References $timezone.

Referenced by getExportTimeZone(), and save().

+ Here is the caller graph for this function:

◆ getWeekStart()

ilCalendarUserSettings::getWeekStart ( )

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

122 : int
123 {
124 return $this->weekstart;
125 }

References $weekstart.

Referenced by save().

+ Here is the caller graph for this function:

◆ read()

ilCalendarUserSettings::read ( )
protected

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

209 : void
210 {
211 $this->timezone = (string) $this->user->getTimeZone();
212 $this->export_tz_type = (int) (
213 ($this->user->getPref('export_tz_type') !== false) ?
214 $this->user->getPref('export_tz_type') :
216 );
217 $this->date_format = $this->translateDateFormatToId(
218 $this->user->getDateFormat()
219 );
220 $this->time_format = (int) $this->user->getTimeFormat();
221 if (($weekstart = $this->user->getPref('weekstart')) === false) {
222 $weekstart = $this->settings->getDefaultWeekStart();
223 }
224 $this->calendar_selection_type = (int) $this->user->getPref('calendar_selection_type') ?
225 (int) $this->user->getPref('calendar_selection_type') :
227
228 $this->weekstart = (int) $weekstart;
229
230 $this->setDayStart(
231 $this->user->getPref('day_start') ?
232 (int) $this->user->getPref('day_start') :
233 $this->settings->getDefaultDayStart()
234 );
235 $this->setDayEnd(
236 $this->user->getPref('day_end') ?
237 (int) $this->user->getPref('day_end') :
238 $this->settings->getDefaultDayEnd()
239 );
240 $this->setShowWeeks(
241 $this->user->getPref('show_weeks') !== null ?
242 (bool) $this->user->getPref('show_weeks') :
243 $this->settings->getShowWeeks()
244 );
245 }
translateDateFormatToId(DateFormat $format)

References $export_tz_type, $weekstart, CAL_SELECTION_MEMBERSHIP, ILIAS\Repository\int(), setDayEnd(), setDayStart(), setShowWeeks(), ILIAS\Repository\settings(), translateDateFormatToId(), 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 196 of file class.ilCalendarUserSettings.php.

197 {
198 $this->user->writePref('user_tz', $this->getTimeZone());
199 $this->user->writePref('export_tz_type', (string) $this->getExportTimeZoneType());
200 $this->user->writePref('weekstart', (string) $this->getWeekStart());
201 $this->user->writePref('date_format', (string) $this->getDateFormat());
202 $this->user->writePref('time_format', (string) $this->getTimeFormat());
203 $this->user->writePref('calendar_selection_type', (string) $this->getCalendarSelectionType());
204 $this->user->writePref('day_start', (string) $this->getDayStart());
205 $this->user->writePref('day_end', (string) $this->getDayEnd());
206 $this->user->writePref('show_weeks', (string) $this->getShowWeeks());
207 }
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 181 of file class.ilCalendarUserSettings.php.

182 {
183 $this->calendar_selection_type = $a_type;
184 }

◆ setDateFormat()

ilCalendarUserSettings::setDateFormat ( int  $a_format)

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

147 : void
148 {
149 $this->date_format = $a_format;
150 }

◆ setDayEnd()

ilCalendarUserSettings::setDayEnd ( int  $a_end)

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

137 : void
138 {
139 $this->day_end = $a_end;
140 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setDayStart()

ilCalendarUserSettings::setDayStart ( int  $a_start)

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

127 : void
128 {
129 $this->day_start = $a_start;
130 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setExportTimeZoneType()

ilCalendarUserSettings::setExportTimeZoneType ( int  $a_type)

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

100 : void
101 {
102 $this->export_tz_type = $a_type;
103 }

◆ setShowWeeks()

ilCalendarUserSettings::setShowWeeks ( bool  $a_val)

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

186 : void
187 {
188 $this->show_weeks = $a_val;
189 }

Referenced by read().

+ Here is the caller graph for this function:

◆ setTimeFormat()

ilCalendarUserSettings::setTimeFormat ( int  $a_format)

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

157 : void
158 {
159 $this->time_format = $a_format;
160 }

◆ setTimeZone()

ilCalendarUserSettings::setTimeZone ( string  $a_tz)

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

90 : void
91 {
92 $this->timezone = $a_tz;
93 }

◆ setWeekStart()

ilCalendarUserSettings::setWeekStart ( int  $a_weekstart)

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

117 : void
118 {
119 $this->weekstart = $a_weekstart;
120 }

◆ translateDateFormatToId()

ilCalendarUserSettings::translateDateFormatToId ( DateFormat  $format)
protected
Todo:
use the data DateFormat throughout to avoid this translation

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

250 : int
251 {
252 switch ((string) $format) {
253 case 'd.m.Y':
255
256 case 'm/d/Y':
258
259 case 'Y-m-d':
260 default:
262 }
263 }

References ilCalendarSettings\DATE_FORMAT_DMY, ilCalendarSettings\DATE_FORMAT_MDY, and ilCalendarSettings\DATE_FORMAT_YMD.

Referenced by read().

+ Here is the caller graph for this function:

Field Documentation

◆ $calendar_selection_type

int ilCalendarUserSettings::$calendar_selection_type = 1
private

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

Referenced by getCalendarSelectionType().

◆ $date_format

int ilCalendarUserSettings::$date_format = 0
private

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

Referenced by getDateFormat().

◆ $day_end

int ilCalendarUserSettings::$day_end = 0
private

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

Referenced by getDayEnd().

◆ $day_start

int ilCalendarUserSettings::$day_start = 0
private

Definition at line 47 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 42 of file class.ilCalendarUserSettings.php.

Referenced by getExportTimeZoneType(), and read().

◆ $instances

array ilCalendarUserSettings::$instances = array()
static

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

◆ $settings

ilCalendarSettings ilCalendarUserSettings::$settings
protected

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

◆ $show_weeks

bool ilCalendarUserSettings::$show_weeks = true
private

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

Referenced by getShowWeeks().

◆ $time_format

int ilCalendarUserSettings::$time_format = 0
private

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

Referenced by getTimeFormat().

◆ $timezone

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

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

Referenced by getTimeZone().

◆ $user

ilObjUser ilCalendarUserSettings::$user
protected

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

Referenced by __construct().

◆ $weekstart

int ilCalendarUserSettings::$weekstart = 0
private

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