Documentation

CalendarForm extends CalendarLibrary

Calendar Class CalendarForm

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
FORM_FIELD_TYPE_CHECKBOX  = 'checkbox'
Registration form field as a HTML-tag checkbox
FORM_FIELD_TYPE_FIELDSET  = 'fieldset'
Registration form field as a HTML-tag fieldset
FORM_FIELD_TYPE_FIRSTNAME  = 'firstname'
Registration form field for the name of the registree as a HTML-tag input[type=text]
FORM_FIELD_TYPE_INPUTTEXT  = 'inputtext'
Registration form field as a HTML-tag input[type=text]
FORM_FIELD_TYPE_LASTNAME  = 'lastname'
Registration form field for the surname of the registree as a HTML-tag input[type=text]
FORM_FIELD_TYPE_MAIL  = 'mail'
Registration form field for the e-mail address of the registree as a HTML-tag input[type=text]
FORM_FIELD_TYPE_RADIO  = 'radio'
Registration form field as a HTML-tag radio
FORM_FIELD_TYPE_SALUTATION  = 'salutation'
Registration form field for the salutation of the registree as a HTML-tag select
FORM_FIELD_TYPE_SEATING  = 'seating'
Registration form field for the number of registering seats as a HTML-tag select
FORM_FIELD_TYPE_SELECT  = 'select'
Registration form field as a HTML-tag select
FORM_FIELD_TYPE_TERMS  = 'agb'
Registration form field to accept the registration term as a HTML-tag input[type=checkbox]
FORM_FIELD_TYPE_TEXTAREA  = 'textarea'
Registration form field as a HTML-tag textarea
FORM_FIELD_TYPES_REGISTRATION  = [self::FORM_FIELD_TYPE_MAIL, self::FORM_FIELD_TYPE_SEATING, self::FORM_FIELD_TYPE_TERMS, self::FORM_FIELD_TYPE_SALUTATION, self::FORM_FIELD_TYPE_FIRSTNAME, self::FORM_FIELD_TYPE_LASTNAME]
List of registration data registration form field types which can only be used once per form.
FORM_FIELD_TYPES_REGULAR  = [self::FORM_FIELD_TYPE_INPUTTEXT, self::FORM_FIELD_TYPE_TEXTAREA, self::FORM_FIELD_TYPE_SELECT, self::FORM_FIELD_TYPE_RADIO, self::FORM_FIELD_TYPE_CHECKBOX, self::FORM_FIELD_TYPE_FIELDSET]
List of regular registration form field types which can be used multiple times per form.
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
$csvSeparator  : string
CSV separator
$errMessage  : string
Error message
$id  : int
Form id
$inputfields  : array<string|int, mixed>
Input fields
$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
$sort  : int
Sort order
$status  : bool
Status
$title  : string
Title
$cx  : Cx
$em  : EntityManager

Methods

__construct()  : mixed
Form constructor
checkAccess()  : null
Checks the access level for the given action
copy()  : int
Copy the form and returns the new or copied form id
delete()  : bool
Delete the form
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
get()  : mixed
Loads the form attributes
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
getExceptionDates()  : array<string|int, mixed>
Returns all series dates based on the given post data
getFormEntity()  : RegistrationForm
Set form entity
getFormFieldEntity()  : RegistrationFormField
Get form field entity
getFormFieldNameEntity()  : RegistrationFormFieldName
Get formFieldName entity
getFrontendLanguages()  : null
Initialize the active frontend languages array
getHeadlinePlaceholders()  : array<string|int, mixed>
Get the list of calendar headline placeholders
getInputFieldsAsArray()  : array<string|int, mixed>
Get input fields as array
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
getLastInputfieldId()  : int
Return's the max input id
getSettings()  : null
Prepares the settings from database to array format
getUserDateTimeFromIntern()  : DateTime
Returns a \DateTime object in user timezone
init()  : mixed
Initialize $cx and $em
save()  : bool
Save the form data's into database
saveOrder()  : bool
Save the form sort order
switchStatus()  : bool
Switch status of the form
triggerEvent()  : null
Trigger the event
applyRegistrationFormFieldsDiffToDb()  : mixed
Applies a diff calculated with createRegistrationFormFieldsDiff()
createRegistrationFormFieldsDiff()  : mixed
Diffs existing form fields with supplied data
executeLegacySqlWithDoctrineEvents()  : mixed
Executes $sql using the legacy database abstraction
executeSqlWithDoctrineEventsFormFormField()  : mixed
Creates or updates a form field and its names
hasChangeInEntityFields()  : bool
Determines if a list of data contains a change between old and new entity
hasChangeInFields()  : bool
Determines whether a set of fields has been changed
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.
saveInputfields()  : bool
Save the form input fields

Constants

ATTACHMENT_FIELD_KEY

Attachment field key

public string ATTACHMENT_FIELD_KEY = 'attachment_id'

FORM_FIELD_TYPE_CHECKBOX

Registration form field as a HTML-tag checkbox

public string FORM_FIELD_TYPE_CHECKBOX = 'checkbox'

FORM_FIELD_TYPE_FIELDSET

Registration form field as a HTML-tag fieldset

public string FORM_FIELD_TYPE_FIELDSET = 'fieldset'

FORM_FIELD_TYPE_FIRSTNAME

Registration form field for the name of the registree as a HTML-tag input[type=text]

public string FORM_FIELD_TYPE_FIRSTNAME = 'firstname'

FORM_FIELD_TYPE_INPUTTEXT

Registration form field as a HTML-tag input[type=text]

public string FORM_FIELD_TYPE_INPUTTEXT = 'inputtext'

FORM_FIELD_TYPE_LASTNAME

Registration form field for the surname of the registree as a HTML-tag input[type=text]

public string FORM_FIELD_TYPE_LASTNAME = 'lastname'

FORM_FIELD_TYPE_MAIL

Registration form field for the e-mail address of the registree as a HTML-tag input[type=text]

public string FORM_FIELD_TYPE_MAIL = 'mail'

FORM_FIELD_TYPE_RADIO

Registration form field as a HTML-tag radio

public string FORM_FIELD_TYPE_RADIO = 'radio'

FORM_FIELD_TYPE_SALUTATION

Registration form field for the salutation of the registree as a HTML-tag select

public string FORM_FIELD_TYPE_SALUTATION = 'salutation'

FORM_FIELD_TYPE_SEATING

Registration form field for the number of registering seats as a HTML-tag select

public string FORM_FIELD_TYPE_SEATING = 'seating'

FORM_FIELD_TYPE_SELECT

Registration form field as a HTML-tag select

public string FORM_FIELD_TYPE_SELECT = 'select'

FORM_FIELD_TYPE_TERMS

Registration form field to accept the registration term as a HTML-tag input[type=checkbox]

public string FORM_FIELD_TYPE_TERMS = 'agb'

FORM_FIELD_TYPE_TEXTAREA

Registration form field as a HTML-tag textarea

public string FORM_FIELD_TYPE_TEXTAREA = 'textarea'

FORM_FIELD_TYPES_REGISTRATION

List of registration data registration form field types which can only be used once per form.

public array<string|int, mixed> FORM_FIELD_TYPES_REGISTRATION = [self::FORM_FIELD_TYPE_MAIL, self::FORM_FIELD_TYPE_SEATING, self::FORM_FIELD_TYPE_TERMS, self::FORM_FIELD_TYPE_SALUTATION, self::FORM_FIELD_TYPE_FIRSTNAME, self::FORM_FIELD_TYPE_LASTNAME]

FORM_FIELD_TYPES_REGULAR

List of regular registration form field types which can be used multiple times per form.

public array<string|int, mixed> FORM_FIELD_TYPES_REGULAR = [self::FORM_FIELD_TYPE_INPUTTEXT, self::FORM_FIELD_TYPE_TEXTAREA, self::FORM_FIELD_TYPE_SELECT, self::FORM_FIELD_TYPE_RADIO, self::FORM_FIELD_TYPE_CHECKBOX, self::FORM_FIELD_TYPE_FIELDSET]

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

$inputfields

Input fields

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

$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()

Methods

__construct()

Form constructor

public __construct([int $id = null ]) : mixed

Loads the form attributes by the given id

Parameters
$id : int = null

form id

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

copy()

Copy the form and returns the new or copied form id

public copy() : int
Return values
int

new form id

delete()

Delete the form

public delete() : bool
Return values
bool

true on success false otherwise

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

get()

Loads the form attributes

public get(int $formId) : mixed
Parameters
$formId : int

Form id

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

getExceptionDates()

Returns all series dates based on the given post data

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

Array of dates

getFormEntity()

Set form entity

public getFormEntity(int $id[, array<string|int, mixed> $formDatas = array() ]) : RegistrationForm
Parameters
$id : int

form id

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

form field values

Return values
RegistrationForm

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>

getInputFieldsAsArray()

Get input fields as array

public getInputFieldsAsArray(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>

post data

Return values
array<string|int, mixed>

the array of input fields

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

getLastInputfieldId()

Return's the max input id

public getLastInputfieldId() : int
Return values
int

last input field id, false on error state

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

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

save()

Save the form data's into database

public save(array<string|int, mixed> $data) : bool
Parameters
$data : array<string|int, mixed>

posted data from the user

Return values
bool

true on success false otherwise

saveOrder()

Save the form sort order

public saveOrder(int $order) : bool
Parameters
$order : int

form sorting order

Return values
bool

true on success false otherwise

switchStatus()

Switch status of the form

public switchStatus() : bool
Return values
bool

true on success false otherwise

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

applyRegistrationFormFieldsDiffToDb()

Applies a diff calculated with createRegistrationFormFieldsDiff()

protected applyRegistrationFormFieldsDiffToDb(RegistrationForm $form, array<string|int, mixed> $changedFields, array<string|int, mixed> $deletedFields, array<string|int, mixed> $createdFields) : mixed
Parameters
$form : RegistrationForm

Current form

$changedFields : array<string|int, mixed>

FieldID=>Array of field data of fields with a change

$deletedFields : array<string|int, mixed>

FieldID=>List of field entities to delete

$createdFields : array<string|int, mixed>

FieldID=>Array of field data of new fields

Tags
throws
TransactionFailedException

on SQL error

createRegistrationFormFieldsDiff()

Diffs existing form fields with supplied data

protected createRegistrationFormFieldsDiff(RegistrationForm $form, array<string|int, mixed> $formFields, array<string|int, mixed> $data, array<string|int, mixed> &$changedFields, array<string|int, mixed> &$deletedFields, array<string|int, mixed> &$createdFields) : mixed
Parameters
$form : RegistrationForm

Current form

$formFields : array<string|int, mixed>

List of RegistrationFormField entities that exist

$data : array<string|int, mixed>

Data to create diff to

$changedFields : array<string|int, mixed>

(reference) Changed fields will be in this array

$deletedFields : array<string|int, mixed>

(reference) Deleted fields will be in this array

$createdFields : array<string|int, mixed>

(reference) New fields will be in this array

executeLegacySqlWithDoctrineEvents()

Executes $sql using the legacy database abstraction

protected executeLegacySqlWithDoctrineEvents(array<string|int, mixed> $entities, string $eventName, string $sql) : mixed

Triggers pre$eventName and post$eventName for all entities in $entities before/after executing $sql. Throws a TransactionFailedException if executing $sql was not successful.

Parameters
$entities : array<string|int, mixed>

List of Doctrine entities

$eventName : string

Doctrine event name without "pre" or "post prefix

$sql : string

SQL to execute

Tags
throws
TransactionFailedException

If SQL generated an error

executeSqlWithDoctrineEventsFormFormField()

Creates or updates a form field and its names

protected executeSqlWithDoctrineEventsFormFormField(RegistrationForm $form, array<string|int, mixed> $fieldData, mixed $eventSuffix, callable $fieldQueryCallback, callable $fieldNameQueryCallback) : mixed
Parameters
$form : RegistrationForm

Current form

$fieldData : array<string|int, mixed>

FieldID=>Array of field data of new fields or fields with a change

$eventSuffix : mixed
$fieldQueryCallback : callable

Callback to generate the field entity query

$fieldNameQueryCallback : callable

Callback to generate the field name entity query

hasChangeInEntityFields()

Determines if a list of data contains a change between old and new entity

protected hasChangeInEntityFields(array<string|int, mixed> $data, callable $originalEntityCallback, callable $newEntityCallback, array<string|int, mixed> $fields) : bool

The callbacks will receive $data's key and value as first and second argument.

Parameters
$data : array<string|int, mixed>

Key=>value array of data

$originalEntityCallback : callable

Callback to get the original entity from an entry in $data

$newEntityCallback : callable

Callback to get the new entity from an entry in $data

$fields : array<string|int, mixed>

List of fields to check

Return values
bool

True if there's at least one change, false otherwise

hasChangeInFields()

Determines whether a set of fields has been changed

protected hasChangeInFields(EntityBase $originalEntity, EntityBase $newEntity, array<string|int, mixed> $fields) : bool
Parameters
$originalEntity : EntityBase

Original entity

$newEntity : EntityBase

New entity

$fields : array<string|int, mixed>

List of fields to check

Return values
bool

True if there's at least one change, false otherwise

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
)

saveInputfields()

Save the form input fields

protected saveInputfields(RegistrationForm $form, array<string|int, mixed> $data[, bool &$hasChange = false ]) : bool
Parameters
$form : RegistrationForm

Current form

$data : array<string|int, mixed>

Data to save

$hasChange : bool = false

(optional, reference) This is set to true if there's a change to the database

Return values
bool

true on success false otherwise


        
On this page

Search results