Documentation

CalendarEventManager extends CalendarLibrary

Calendar Class EventManager

Tags
subpackage

module_calendar

author

Cloudrexx info@cloudrexx.com

copyright

CLOUDREXX CMS - CLOUDREXX AG

version
1.00

Table of Contents

Constants

ATTACHMENT_FIELD_KEY  = 'attachment_id'
Attachment field key
MAP_FIELD_KEY  = 'map_id'
map field key
PICTURE_FIELD_KEY  = 'picture_id'
Picture field key
SHOW_EVENTS_OF_TODAY  = 0
Setting value for option frontendPastEvents defining that all events having their start date as of today shall be listed in frontend till the end of today.
SHOW_EVENTS_UNTIL_END  = 1
Setting value for option frontendPastEvents defining that only those events shall be listed in frontend that have not yet ended (end date lies in the past)
SHOW_EVENTS_UNTIL_START  = 2
Setting value for option frontendPastEvents defining that only those events shall be listed in frontend that have not yet started (start date lies in the future)

Properties

$_objTpl  : object
Template object
$arrCommunityGroups  : array<string|int, mixed>
Community group array
$arrFrontendLanguages  : array<string|int, mixed>
active frontend languages
$arrSettings  : array<string|int, mixed>
Settings array
$countEvents  : int
Event count
$csvSeparator  : string
CSV separator
$errMessage  : string
Error message
$eventList  : array<string|int, mixed>
Event list
$listType  : string
show only upcoming events or all events possible options are all or upcoming
$moduleLangVar  : string
module language variable prefix
$moduleName  : string
module name
$moduleTablePrefix  : string
module table prefix
$okMessage  : type
Success message
$pageContent  : string
template content
$settings  : array<string|int, mixed>
Static settings array to cache the fetched data from the database
$cx  : Cx
$em  : EntityManager
$selectedEventIds  : array<string|int, mixed>
$syncedIds  : array<string|int, mixed>
$author  : string
Author name
$categoryId  : int
Category id
$clock  : string
Clock
$date  : string
Date
$endDate  : int
End date
$needAuth  : bool
Need authorization
$numEvents  : int
Num Events
$onlyActive  : bool
Only active
$onlyConfirmed  : bool
Only confirmed
$searchTerm  : string
Search term
$sepDateTime  : string
Seprator date time
$showSeries  : bool
show series
$sortDirection  : string
Sort Direction
$startDate  : int
Start date
$startPos  : int
Start position
$time  : string
Time

Methods

__construct()  : mixed
Loads the event manager configuration
_addToEventList()  : bool
Checks the event for adding it into eventlist
_clearEmptyEvents()  : null
Clears the empty events
_getCoorinates()  : bool
Return Coorinates
_getDetailLink()  : string
Returns the Event detail page link
_importEvents()  : null
Import Events
_sortEventList()  : null
Sort the event list
checkAccess()  : null
Checks the access level for the given action
cmp()  : bool
Compare function
detachEntity()  : null
Detach the entity
detachJoinedEntity()  : null
Detach the jointed entity
format2userDate()  : string
Returns the date string (according to the calendar's configuration) from a \DateTime object.
format2userDateTime()  : string
Returns the date/time string (according to the calendar's configuration) from a \DateTime object.
format2userTime()  : string
Returns the time string 'H:i' from a \DateTime object
formatDateTime2user()  : string
Returns a date/time string from a \DateTime object.
generateKey()  : string
generates the random key
generateRecurrencesOfEvent()  : mixed
Generate the next recurrence of a series event.
getBoxes()  : string
Returns the calendar boxes
getCalendarBoxJS()  : string
Returns the javascript used for the calendar boxes
getCommunityGroups()  : null
Initilize the available group
getComponent()  : SystemComponentController
Get component controller object
getDateFormat()  : string
Return's the dataformat based on the type
getDateTime()  : DateTime
Returns a \DateTime object from a calendar date/time string.
getDbDateTimeFromIntern()  : DateTime
Returns a \DateTime object in db timezone
getDetailMonthBox()  : mixed
Get Calendar month box for event detail view
getEvent()  : null
Get the event using calendar event class and assign it into $this->eventList
getEventList()  : null
Get's list of event and assign into $this->eventList
getEventsWithDate()  : array<string|int, mixed>
Returns the events with date
getExeceptionDates()  : array<string|int, mixed>
Returns all series dates based on the given post data
getExternalEvent()  : null
Import events
getFrontendLanguages()  : null
Initialize the active frontend languages array
getHeadlinePlaceholders()  : array<string|int, mixed>
Get the list of calendar headline placeholders
getIdsOfSelectedEvents()  : array<string|int, mixed>
getInternDateTimeFromDb()  : DateTime
Returns a \DateTime object from a date/time string.
getInternDateTimeFromUser()  : DateTime
Returns a \DateTime object from a date/time string.
getJavascript()  : string
Return's the billing address javascript
getMultiDateBlock()  : null
show date and time by user settings > several day view
getPriorityImage()  : mixed
getSettings()  : null
Prepares the settings from database to array format
getSingleDateBlock()  : null
show date and time by user settings > single day view > start-/endtime separated by start-/enddate
getUserDateTimeFromIntern()  : DateTime
Returns a \DateTime object in user timezone
init()  : mixed
Initialize $cx and $em
isDateExists()  : bool
Check whether the given date exists in the datetime array
parseRegistrationPlaceholders()  : null
Parse the registration related palceholders $hostUri and $hostTarget should be set before calling this method
showEvent()  : null
Sets the placeholders used for the event
showEventList()  : null
Sets the placeholders used for the event list view
triggerEvent()  : null
Trigger the event
urlfind()  : bool
Find the url exists or not
fetchNextRecurrence()  : CalendarEvent
Fetch the next recurrence date
getNextRecurrenceDate()  : mixed
Calculate the next recurrence date
isLastWeekdayOfMonth()  : mixed
Checks if $date is the last $weekday of the set month.
parseDateTimeString()  : array<string|int, mixed>
Split a datetime string (i.E.: '08.06.2015 13:37') into an array containing the date, hour and minutes information as separate elements.
parseRegistrationList()  : void
Parse a list of existing registrations of event $event.

Constants

ATTACHMENT_FIELD_KEY

Attachment field key

public string ATTACHMENT_FIELD_KEY = 'attachment_id'

SHOW_EVENTS_OF_TODAY

Setting value for option frontendPastEvents defining that all events having their start date as of today shall be listed in frontend till the end of today.

public int SHOW_EVENTS_OF_TODAY = 0

SHOW_EVENTS_UNTIL_END

Setting value for option frontendPastEvents defining that only those events shall be listed in frontend that have not yet ended (end date lies in the past)

public int SHOW_EVENTS_UNTIL_END = 1

SHOW_EVENTS_UNTIL_START

Setting value for option frontendPastEvents defining that only those events shall be listed in frontend that have not yet started (start date lies in the future)

public int SHOW_EVENTS_UNTIL_START = 2
Tags
todo

Implement behavior of this option

Properties

$arrCommunityGroups

Community group array

public array<string|int, mixed> $arrCommunityGroups = array()
Tags
access

public

$arrFrontendLanguages

active frontend languages

public array<string|int, mixed> $arrFrontendLanguages = array()
Tags
access

public

$arrSettings

Settings array

public array<string|int, mixed> $arrSettings = array()
Tags
access

public

$listType

show only upcoming events or all events possible options are all or upcoming

public string $listType

default is all

$moduleLangVar

module language variable prefix

public string $moduleLangVar = "CALENDAR"
Tags
access

public

$moduleTablePrefix

module table prefix

public string $moduleTablePrefix = "calendar"
Tags
access

public

$settings

Static settings array to cache the fetched data from the database

public static array<string|int, mixed> $settings = array()

$syncedIds

protected static array<string|int, mixed> $syncedIds

List of indexData of calendar events synced from a remote location

Methods

__construct()

Loads the event manager configuration

public __construct([int $startDate = null ][, int $endDate = null ][, int $categoryId = null ][, string $searchTerm = null ][, bool $showSeries = true ][, bool $needAuth = false ][, bool $onlyActive = false ][, int $startPos = 0 ][, int $numEvents = 'n' ][, string $sortDirection = 'ASC' ][, bool $onlyConfirmed = true ][, string $author = null ][, mixed $listType = 'all' ]) : mixed
Parameters
$startDate : int = null

Start date Unix timestamp

$endDate : int = null

End date timestamp

$categoryId : int = null

Category Id

$searchTerm : string = null

Search Term

$showSeries : bool = true

Show Series

$needAuth : bool = false

Need authorization

$onlyActive : bool = false

Only active Events

$startPos : int = 0

Start position

$numEvents : int = 'n'

Number of events

$sortDirection : string = 'ASC'

Sort direction, possible values ASC, DESC

$onlyConfirmed : bool = true

only confirmed Entries

$author : string = null

author name

$listType : mixed = 'all'

_addToEventList()

Checks the event for adding it into eventlist

public _addToEventList(object $objEvent) : bool

This will used the check the whether the gievn event object is valid to add into event list

Parameters
$objEvent : object

Event object

Return values
bool

true if the event is valid, false oterwise

_clearEmptyEvents()

Clears the empty events

public _clearEmptyEvents() : null

Empty events will be found if event title is empty

Return values
null

_getCoorinates()

Return Coorinates

public _getCoorinates(string $street, string $zipcode, string $city) : bool
Parameters
$street : string

Street addres

$zipcode : string

postal code

$city : string

Name of the city

Return values
bool

true or false

Returns the Event detail page link

public _getDetailLink(object $objEvent) : string
Parameters
$objEvent : object

Event object

Return values
string

link for the detail page

checkAccess()

Checks the access level for the given action

public checkAccess(string $strAction) : null

It checks the access level for the given action and return's null if access is granted otherwise it redirect the action to the respective fallback pages.

Parameters
$strAction : string

possible values are add_event, edit_event, my_events

Return values
null

cmp()

Compare function

public cmp(array<string|int, mixed> $a, array<string|int, mixed> $b) : bool
Parameters
$a : array<string|int, mixed>

first array

$b : array<string|int, mixed>

second array

Return values
bool

TRUE on success or FALSE on failure.

detachEntity()

Detach the entity

public detachEntity(object $entity, string $methodName, array<string|int, mixed> $relation, array<string|int, mixed> $joinEntityRelation) : null
Parameters
$entity : object

entity object

$methodName : string

method name

$relation : array<string|int, mixed>

relationship array

$joinEntityRelation : array<string|int, mixed>

joined entity's relationship array

Return values
null

detachJoinedEntity()

Detach the jointed entity

public detachJoinedEntity(object $entity, array<string|int, mixed> $relations, array<string|int, mixed> $joinEntityRelation) : null
Parameters
$entity : object

entity object

$relations : array<string|int, mixed>

relationship array

$joinEntityRelation : array<string|int, mixed>

joined entity's relationship array

Return values
null

format2userDate()

Returns the date string (according to the calendar's configuration) from a \DateTime object.

public format2userDate(DateTime $dateTime) : string

The SUPPLIED \DateTime object must be in INTERNAL timezone. The RETURNED date string will be in USER timezone.

Parameters
$dateTime : DateTime

DateTime object in internal timezone

Return values
string

A date string

format2userDateTime()

Returns the date/time string (according to the calendar's configuration) from a \DateTime object.

public format2userDateTime(DateTime $dateTime) : string

The SUPPLIED \DateTime object must be in INTERNAL timezone. The RETURNED date/time string will be in USER timezone.

Parameters
$dateTime : DateTime

DateTime object in internal timezone

Return values
string

A date/time string

format2userTime()

Returns the time string 'H:i' from a \DateTime object

public format2userTime(DateTime $dateTime) : string

The SUPPLIED \DateTime object must be in INTERNAL timezone. The RETURNED time string will be in USER timezone.

Parameters
$dateTime : DateTime

DateTime object in internal timezone

Return values
string

A time string

formatDateTime2user()

Returns a date/time string from a \DateTime object.

public formatDateTime2user(DateTime $dateTime, string $format) : string

The SUPPLIED \DateTime object must be in INTERNAL timezone. The RETURNED date/time string will be in USER timezone.

Parameters
$dateTime : DateTime

DateTime object in internal timezone

$format : string

Format string

Return values
string

A date/time string formatted according to $format

generateKey()

generates the random key

public generateKey() : string
Return values
string

combination of alphabet and number in random order

generateRecurrencesOfEvent()

Generate the next recurrence of a series event.

public generateRecurrencesOfEvent(CalendarEvent $objEvent[, array<string|int, mixed> $additionalRecurrences = array() ]) : mixed
Parameters
$objEvent : CalendarEvent

Event instance to check for recurrences for.

$additionalRecurrences : array<string|int, mixed> = array()

Array of additional (manually set) recurrence dates as DateTime objects.

getBoxes()

Returns the calendar boxes

public getBoxes(int $boxes, year $year[, int $month = 0 ][, int $day = 0 ][, int $catid = 0 ]) : string
Parameters
$boxes : int

Number of boxes

$year : year

Year

$month : int = 0

month

$day : int = 0

day

$catid : int = 0

category id

Return values
string

calendar boxes

getCalendarBoxJS()

Returns the javascript used for the calendar boxes

public getCalendarBoxJS() : string
Return values
string

javascript

getCommunityGroups()

Initilize the available group

public getCommunityGroups() : null

Fetch the available group from the database and assign those values into $this->arrCommunityGroups

Return values
null

getDateFormat()

Return's the dataformat based on the type

public getDateFormat([int $type = null ]) : string

Return's the dateformat by the given type 1 => frontend (javascript format alone) else backend

Parameters
$type : int = null

type 1 => frontend (javascript format alone) else backend

Return values
string

Date format

getDateTime()

Returns a \DateTime object from a calendar date/time string.

public getDateTime(string $date[, int $hour = 0 ][, int $minute = 0 ]) : DateTime

The format of a calendar date/time string can be configured in the settings section of the calendar component.

Note: In constrast to this method, the method getUserDateTimeFromUser() expects a PHP date/time string.

The SUPPLIED calendar date/time string must be in USER timezone. The RETURNED \DateTime object will be in INTERNAL timezone.

Parameters
$date : string

A calendar date/time string in user timezone

$hour : int = 0

Hour value

$minute : int = 0

Minute value

Return values
DateTime

\DateTime object in internal timezone

getDbDateTimeFromIntern()

Returns a \DateTime object in db timezone

public getDbDateTimeFromIntern(DateTime $dateTime) : DateTime

The SUPPLIED \DateTime object must be in INTERNAL timezone. The RETURNED \DateTime object will be in DB timezone.

Parameters
$dateTime : DateTime

\DateTime object in internal timezone

Return values
DateTime

\DateTime in db timezone

getEvent()

Get the event using calendar event class and assign it into $this->eventList

public getEvent(mixed $event[, int $eventStartDate = 0 ][, bool $forceCalculateSeries = false ]) : null
Parameters
$event : mixed

\Cx\Modules\Calendar\Controller\CalendarEvent or Event id

$eventStartDate : int = 0

Unix timestamp of start date. Set to 0 to load all occurrences of $event.

$forceCalculateSeries : bool = false

Whether or not to calculate the event's next serie's occurrence. Default to FALSE to only perform the calculation in FRONTEND-Mode

Return values
null

getEventList()

Get's list of event and assign into $this->eventList

public getEventList() : null
Return values
null

getEventsWithDate()

Returns the events with date

public getEventsWithDate() : array<string|int, mixed>
Return values
array<string|int, mixed>

Events list

getExeceptionDates()

Returns all series dates based on the given post data

public getExeceptionDates() : array<string|int, mixed>
Return values
array<string|int, mixed>

Array of dates

getExternalEvent()

Import events

public getExternalEvent(int $eventId, int $eventStartDate) : null
Parameters
$eventId : int

Event id

$eventStartDate : int

Unix timestamp of start date

Return values
null

getFrontendLanguages()

Initialize the active frontend languages array

public getFrontendLanguages() : null

Fetch the active frontend languages from the database and assign those values into $this->arrFrontendLanguages

Return values
null

getHeadlinePlaceholders()

Get the list of calendar headline placeholders

public static getHeadlinePlaceholders() : array<string|int, mixed>
Return values
array<string|int, mixed>

getIdsOfSelectedEvents()

public static getIdsOfSelectedEvents() : array<string|int, mixed>
Return values
array<string|int, mixed>

IDs of events loaded by getEventList()

getInternDateTimeFromDb()

Returns a \DateTime object from a date/time string.

public getInternDateTimeFromDb([string $time = 'now' ]) : DateTime

The SUPPLIED date/time string must be in DB timezone. The RETURNED \DateTime object will be in INTERNAL timezone.

Parameters
$time : string = 'now'

A date/time string in db timezone

Return values
DateTime

\DateTime object in internal timezone

getInternDateTimeFromUser()

Returns a \DateTime object from a date/time string.

public getInternDateTimeFromUser([string $time = 'now' ]) : DateTime

The SUPPLIED date/time string must be in USER timezone. The RETURNED \DateTime object will be in INTERNAL timezone.

Parameters
$time : string = 'now'

A date/time string in user timezone

Return values
DateTime

\DateTime object in internal timezone

getJavascript()

Return's the billing address javascript

public getJavascript() : string
Return values
string

Billing HereDoc phpscript

getMultiDateBlock()

show date and time by user settings > several day view

public getMultiDateBlock(object $objEvent, string $separatorDateTime, string $separatorSeveralDays, bool $showClock, int $part) : null
Parameters
$objEvent : object

Event object

$separatorDateTime : string

Date time separator

$separatorSeveralDays : string

SeveralDays separator

$showClock : bool

true to show clock, false to hide

$part : int

Part of the multi date event

Return values
null

getSettings()

Prepares the settings from database to array format

public getSettings() : null

Loads the settings values from the database and assign those values into $this->arrSettings

Return values
null

getSingleDateBlock()

show date and time by user settings > single day view > start-/endtime separated by start-/enddate

public getSingleDateBlock(object $objEvent, bool $showStartDate, bool $showEndDate, string $separatorDate, int $showTimeType, bool $showStartTime, bool $showEndTime, string $separatorDateTime, string $separatorTime, bool $showClock) : null
Parameters
$objEvent : object

Event object

$showStartDate : bool

true to show start date, false to hide

$showEndDate : bool

true to show clock, false to hide

$separatorDate : string

Date separator

$showTimeType : int

Event time type

$showStartTime : bool

true to show start time, false to hide

$showEndTime : bool

true to show end time, false to hide

$separatorDateTime : string

Date time separator

$separatorTime : string

Time separator

$showClock : bool

true to show clock, false to hide

Return values
null

getUserDateTimeFromIntern()

Returns a \DateTime object in user timezone

public getUserDateTimeFromIntern(DateTime $dateTime) : DateTime

The SUPPLIED \DateTime object must be in INTERNAL timezone. The RETURNED \DateTime object will be in USER timezone.

Parameters
$dateTime : DateTime

\DateTime object in internal timezone

Return values
DateTime

\DateTime in user timezone

isDateExists()

Check whether the given date exists in the datetime array

public isDateExists(DateTime $dateTime[, array<string|int, mixed> $dateTimeArray = array() ]) : bool
Parameters
$dateTime : DateTime
$dateTimeArray : array<string|int, mixed> = array()
Return values
bool

True when date exists, false otherwise

parseRegistrationPlaceholders()

Parse the registration related palceholders $hostUri and $hostTarget should be set before calling this method

public parseRegistrationPlaceholders(Sigma $objTpl, CalendarEvent $event[, string $hostUri = '' ][, string $hostTarget = '' ][, mixed $invite = null ]) : null
Parameters
$objTpl : Sigma

Template instance

$event : CalendarEvent

Event instance

$hostUri : string = ''

Host uri of the event(internal/external)

$hostTarget : string = ''

Host uri target type (_blank/null)

$invite : mixed = null
Return values
null

showEvent()

Sets the placeholders used for the event

public showEvent(object $objTpl, int $eventId, int $eventStartDate[, mixed &$start = null ]) : null
Parameters
$objTpl : object

Template object

$eventId : int

Event Id

$eventStartDate : int

Description

$start : mixed = null
Return values
null

showEventList()

Sets the placeholders used for the event list view

public showEventList(object $objTpl[, int $type = '' ][, mixed &$firstEndDate = null ]) : null
Parameters
$objTpl : object

Template object

$type : int = ''

Event type

$firstEndDate : mixed = null
Return values
null

triggerEvent()

Trigger the event

public triggerEvent(string $eventName[, object $entity = null ][, array<string|int, mixed> $relations = array() ][, bool $isDetach = false ]) : null
Parameters
$eventName : string

trigger event name

$entity : object = null

entity object

$relations : array<string|int, mixed> = array()

entity relations

$isDetach : bool = false

is detachable entity

Return values
null

urlfind()

Find the url exists or not

public urlfind(string $url) : bool
Parameters
$url : string

url

Return values
bool

true on url exists, false otherwise

fetchNextRecurrence()

Fetch the next recurrence date

protected fetchNextRecurrence(CalendarEvent $objEvent, CalendarEvent $recurrenceEvent[, array<string|int, mixed> &$additionalRecurrences = array() ]) : CalendarEvent

The event $recurrenceEvent is advanced to the next recurrence date based on the set series options of $objEvent. Additionally the array $additionalRecurrences is checked for any manually added recurrences that will occur before the next regular recurrence. If there are any, then $recurrenceEvent will not be advanced to the next recurrence date.

Parameters
$objEvent : CalendarEvent

Original event of which the recurrence is calculated on.

$recurrenceEvent : CalendarEvent

Event on which the next recurrence shall be calculated on.

$additionalRecurrences : array<string|int, mixed> = array()

Array of additional (manually added) recurrences as DateTime objects. If an additional recurrence is returned, then the DateTime object of that particular recurrence is being removed from the array $additionalRecurrences.

Return values
CalendarEvent

The next calculated recurrence event. This is either a manually added recurrence or the next regular recurrence based on the series options.

getNextRecurrenceDate()

Calculate the next recurrence date

protected getNextRecurrenceDate(CalendarEvent $objEvent, CalendarEvent $objCloneEvent[, array<string|int, mixed> &$additionalRecurrences = array() ]) : mixed

The event $objCloneEvent is advanced to the next recurrence date based on the set series options of $objEvent.

Parameters
$objEvent : CalendarEvent

Original event of which the recurrence is calculated on.

$objCloneEvent : CalendarEvent

Event on which the next recurrence shall be calculated on.

$additionalRecurrences : array<string|int, mixed> = array()

Array of additional (manually added) recurrences as DateTime objects.

isLastWeekdayOfMonth()

Checks if $date is the last $weekday of the set month.

protected isLastWeekdayOfMonth(DateTime $date, string $weekday) : mixed
Parameters
$date : DateTime
$weekday : string

One of Monday to Sunday.

parseDateTimeString()

Split a datetime string (i.E.: '08.06.2015 13:37') into an array containing the date, hour and minutes information as separate elements.

protected parseDateTimeString(string $datetime[, bool $allDay = false ][, bool $end = false ]) : array<string|int, mixed>
Parameters
$datetime : string

The datetime string to parse.

$allDay : bool = false

If set to TRUE, then the returned hour and minutes value are set to 0, unless $end is also set to TRUE.

$end : bool = false

If set to TRUE and $allDay is also set to TRUE, then the returned hour is set to 23 and the minutes to 59. If $allDay is not set to TRUE, then this argument has no effect.

Return values
array<string|int, mixed>

Return parsed datetime as array having the following format:

array(
     d.m.Y,
     G,
     m
)

parseRegistrationList()

Parse a list of existing registrations of event $event.

protected parseRegistrationList(Sigma $template, CalendarEvent $event) : void
Parameters
$template : Sigma

Template instance to be used for parsing the registration list(s).

$event : CalendarEvent

Event of which the existing registrations shall be listed.


        
On this page

Search results