19 declare(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'];
82 return self::_getInstanceByUserId($ilUser->getId());
92 $this->timezone = $a_tz;
102 $this->export_tz_type = $a_type;
108 case self::CAL_EXPORT_TZ_TZ:
111 case self::CAL_EXPORT_TZ_UTC:
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') :
226 self::CAL_SELECTION_MEMBERSHIP;
228 $this->weekstart = (
int) $weekstart;
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') :
241 $this->
user->getPref(
'show_weeks') !==
null ?
242 (bool) $this->
user->getPref(
'show_weeks') :
252 switch ((
string) $format) {
setTimeFormat(int $a_format)
const CAL_SELECTION_MEMBERSHIP
setDayStart(int $a_start)
setCalendarSelectionType(int $a_type)
set calendar selection type
setShowWeeks(bool $a_val)
static _getInstanceByUserId(int $a_user_id)
translateDateFormatToId(DateFormat $format)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
getCalendarSelectionType()
get calendar selection type ("MyMembership" or "Selected Items")
const CAL_SELECTION_ITEMS
ilCalendarSettings $settings
__construct(int $a_user_id)
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
int $calendar_selection_type
setWeekStart(int $a_weekstart)
setTimeZone(string $a_tz)
setExportTimeZoneType(int $a_type)
setDateFormat(int $a_format)