19declare(strict_types=1);
55 $this->
user = $DIC->user();
57 if ($this->
user->getId() !== $a_user_id) {
62 throw new DomainException(
'Invalid user id given: ' . $a_user_id);
71 if (isset(self::$instances[$a_user_id])) {
72 return self::$instances[$a_user_id];
81 $ilUser =
$DIC[
'ilUser'];
92 $this->timezone = $a_tz;
102 $this->export_tz_type = $a_type;
119 $this->weekstart = $a_weekstart;
129 $this->day_start = $a_start;
139 $this->day_end = $a_end;
149 $this->date_format = $a_format;
159 $this->time_format = $a_format;
183 $this->calendar_selection_type = $a_type;
188 $this->show_weeks = $a_val;
205 $this->
user->writePref(
'day_end', (
string) $this->
getDayEnd());
209 protected function read(): void
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') :
218 $this->
user->getDateFormat()
220 $this->time_format = (
int) $this->
user->getTimeFormat();
221 if (($weekstart = $this->
user->getPref(
'weekstart')) ===
false) {
222 $weekstart = $this->
settings->getDefaultWeekStart();
224 $this->calendar_selection_type = (
int) $this->
user->getPref(
'calendar_selection_type') ?
225 (
int) $this->
user->getPref(
'calendar_selection_type') :
231 $this->
user->getPref(
'day_start') ?
232 (
int) $this->user->getPref(
'day_start') :
233 $this->settings->getDefaultDayStart()
236 $this->
user->getPref(
'day_end') ?
237 (
int) $this->user->getPref(
'day_end') :
238 $this->settings->getDefaultDayEnd()
241 $this->
user->getPref(
'show_weeks') !==
null ?
242 (
bool) $this->user->getPref(
'show_weeks') :
243 $this->settings->getShowWeeks()
252 switch ((
string) $format) {
Stores all calendar relevant settings.
const CAL_SELECTION_ITEMS
setWeekStart(int $a_weekstart)
translateDateFormatToId(DateFormat $format)
setDayStart(int $a_start)
getCalendarSelectionType()
get calendar selection type ("MyMembership" or "Selected Items")
setCalendarSelectionType(int $a_type)
set calendar selection type
setDateFormat(int $a_format)
int $calendar_selection_type
const CAL_SELECTION_MEMBERSHIP
setTimeZone(string $a_tz)
ilCalendarSettings $settings
setShowWeeks(bool $a_val)
__construct(int $a_user_id)
static _getInstanceByUserId(int $a_user_id)
setExportTimeZoneType(int $a_type)
setTimeFormat(int $a_format)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id