Class Calendar

com.woltlab.wcal.core.data.calendar

Description

Data class of calendar. Calendar holds events, has permissions and other settings

  • author: Arian Glander
  • copyright: 2001-2008 WoltLab GmbH
  • license: WoltLab
DatabaseObject
   |
   --Calendar

Direct descendents

Class Description
CalendarEditor Editor class to edit, delete or add calendars

Variable Summary

Type Name
array<integer> $permissions

Method Summary

Return Name
Calendar __construct(integer $calendarID, [array<mixed> $row = null])
static integer canAddEvent(array<Calendar> $calendars)
static array<integer> getAccessibleCalendarIDArray([array<integer> $permissions = array()])
static array<array> getAllCalendarPermissions(integer $calendarID)
static array<Calendar> getAllCalendars()
static array<mixed> getCalendarPermissions(mixed $calendarIDs, [User $user = null])
static array<Calendar> getCalendarsFromUser()
static array<Calendar> getEnabledCalendars()
static array<string> getPermissionSettings()
static array<Calendar> getSubscribedCalendars([integer $limit = 50])
static array<User> getUsersOfCalendar(Calendar $calendar)
boolean hasPermission(string $name)
integer isMarked()
boolean setPermission(string $name,  $value)

Variables

$permissions

public array<integer> $permissions = array()

Calendar permissions stored in an associative array ('canEditCalendar' => 1)


Inherited variables from DatabaseObject

DatabaseObject::$data

Methods

__construct

public Calendar __construct(integer $calendarID, [array<mixed> $row = null])

Create a new calendar object

Parameters:

  • $calendarID - id of calendar to create
  • $row - data to create the object

Redefinition of: DatabaseObject::__construct()


canAddEvent

public static integer canAddEvent(array<Calendar> $calendars)

Convinience method to get to know, if there is at least one calendar where the current user can add events

  • return: 0 or 1 - if there is one calendar to add events

Parameters:

  • $calendars - array holding the calendars to be checked

getAccessibleCalendarIDArray

public static array<integer> getAccessibleCalendarIDArray([array<integer> $permissions = array()])

Returns a list of ids of all accessible calendars for the active user.

  • return: the array of calendar ids to get

Parameters:

  • $permissions - permissions to be checked

getAllCalendarPermissions

public static array<array> getAllCalendarPermissions(integer $calendarID)

Get all calendar permissions in a form that is needed for the permission control interface

  • return: array with permissions

Parameters:

  • $calendarID - id of calendar to get permissions for

getAllCalendars

public static array<Calendar> getAllCalendars()

Returns a list of all calendars.

  • return: the calendars to return

getCalendarPermissions

public static array<mixed> getCalendarPermissions(mixed $calendarIDs, [User $user = null])

Get the permissions of the given calendar and current user

  • return: array with permissions - will be a nested array, grouped by calendarID

Parameters:

  • $calendarIDs - a string of calendar ids separated by comma or a single integer of the one calendar to get permissions for
  • $user - the user you need permissions for

getCalendarsFromUser

public static array<Calendar> getCalendarsFromUser()

Get the calendars created by this user

  • return: the calendars to get

getEnabledCalendars

public static array<Calendar> getEnabledCalendars()

Returns a list of all enabled calendars for the current user.

  • return: the calendars to return

getPermissionSettings

public static array<string> getPermissionSettings()

Get the permission settings (canAddEvent, canEditEvent, ...)

  • return: associative array (canAddEvent => 1)

getSubscribedCalendars

public static array<Calendar> getSubscribedCalendars([integer $limit = 50])

Get all subscribed calendars that are updated within the last hour

  • return: array holding the calendars

Parameters:

  • $limit - only the specified maximum of calendars will be returned

getUsersOfCalendar

public static array<User> getUsersOfCalendar(Calendar $calendar)

Get the users that use the given calendar

  • return: a list of users to return

Parameters:

  • $calendar - the calendar that is used by the users to return

hasPermission

public boolean hasPermission(string $name)

Has the user the specific calendar permission

  • return: if user has the permission or not

Parameters:

  • $name - name of calendar permission

isMarked

public integer isMarked()

Is the calendar marked

  • return: 0 or 1 if it is marked or not

setPermission

public boolean setPermission(string $name,  $value)

Has the user the specific calendar permission

  • return: if user has the permission or not

Parameters:

  • $name - name of calendar permission
  • $value

Inherited methods from DatabaseObject

DatabaseObject::__construct(), DatabaseObject::handleData(), DatabaseObject::sort(), DatabaseObject::__get()