ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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.

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

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  }
global $DIC
Definition: shib_login.php:22
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
+ Here is the call graph for this function:

Member Function Documentation

◆ _getInstance()

static ilCalendarUserSettings::_getInstance ( )
static

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

References $DIC.

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

78  {
79  global $DIC;
80 
81  $ilUser = $DIC['ilUser'];
82  return self::_getInstanceByUserId($ilUser->getId());
83  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ _getInstanceByUserId()

◆ getCalendarSelectionType()

ilCalendarUserSettings::getCalendarSelectionType ( )

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

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

References $calendar_selection_type.

Referenced by save().

171  : int
172  {
174  }
+ Here is the caller graph for this function:

◆ getDateFormat()

ilCalendarUserSettings::getDateFormat ( )

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

References $date_format.

Referenced by save().

152  : int
153  {
154  return $this->date_format;
155  }
+ Here is the caller graph for this function:

◆ getDayEnd()

ilCalendarUserSettings::getDayEnd ( )

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

References $day_end.

Referenced by save().

142  : int
143  {
144  return $this->day_end;
145  }
+ Here is the caller graph for this function:

◆ getDayStart()

ilCalendarUserSettings::getDayStart ( )

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

References $day_start.

Referenced by save().

132  : int
133  {
134  return $this->day_start;
135  }
+ Here is the caller graph for this function:

◆ getExportTimeZone()

ilCalendarUserSettings::getExportTimeZone ( )

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

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

105  : string
106  {
107  switch ($this->getExportTimeZoneType()) {
108  case self::CAL_EXPORT_TZ_TZ:
109  return $this->getTimeZone();
110 
111  case self::CAL_EXPORT_TZ_UTC:
112  return ilTimeZone::UTC;
113  }
114  return '';
115  }
+ Here is the call graph for this function:

◆ getExportTimeZoneType()

ilCalendarUserSettings::getExportTimeZoneType ( )

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

References $export_tz_type.

Referenced by getExportTimeZone(), and save().

95  : int
96  {
97  return $this->export_tz_type;
98  }
+ Here is the caller graph for this function:

◆ getShowWeeks()

ilCalendarUserSettings::getShowWeeks ( )

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

References $show_weeks.

Referenced by save().

191  : bool
192  {
193  return $this->show_weeks;
194  }
+ Here is the caller graph for this function:

◆ getTimeFormat()

ilCalendarUserSettings::getTimeFormat ( )

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

References $time_format.

Referenced by save().

162  : int
163  {
164  return $this->time_format;
165  }
+ Here is the caller graph for this function:

◆ getTimeZone()

ilCalendarUserSettings::getTimeZone ( )

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

References $timezone.

Referenced by getExportTimeZone(), and save().

85  : string
86  {
87  return $this->timezone;
88  }
+ Here is the caller graph for this function:

◆ getWeekStart()

ilCalendarUserSettings::getWeekStart ( )

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

References $weekstart.

Referenced by save().

122  : int
123  {
124  return $this->weekstart;
125  }
+ Here is the caller graph for this function:

◆ read()

ilCalendarUserSettings::read ( )
protected

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

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

Referenced by __construct().

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') :
226  self::CAL_SELECTION_MEMBERSHIP;
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)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ 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.

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

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")
+ 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.

Referenced by read().

137  : void
138  {
139  $this->day_end = $a_end;
140  }
+ Here is the caller graph for this function:

◆ setDayStart()

ilCalendarUserSettings::setDayStart ( int  $a_start)

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

Referenced by read().

127  : void
128  {
129  $this->day_start = $a_start;
130  }
+ 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.

Referenced by read().

186  : void
187  {
188  $this->show_weeks = $a_val;
189  }
+ 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.

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

Referenced by read().

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  }
+ 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().

◆ 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: