Documentation

NewsletterLib

Class newsletter library

Newsletter module class

Tags
copyright

CLOUDREXX CMS - CLOUDREXX AG

author

Cloudrexx Development Team info@cloudrexx.com

access

public

version
1.0.0
subpackage

module_newsletter

todo

Edit PHP DocBlocks!

Table of Contents

Constants

UNSUBSCRIBE_BEHAVIOR_AUTOMATIC  = 'automatic'
UNSUBSCRIBE_BEHAVIOR_MANUAL  = 'manual'
USER_TYPE_ACCESS  = 'access'
USER_TYPE_CORE  = 'core'
USER_TYPE_CRM  = 'crm'
USER_TYPE_NEWSLETTER  = 'newsletter'

Properties

$_arrRecipientTitles  : mixed
$arrLists  : array<string|int, mixed>
List of present Lists

Methods

_addList()  : bool
Add a list with the given name and status
_addRecipient()  : bool
Add a recipient with the given parameter values and subscribe to the lists with their ID present in $arrLists
_addRecipientTitle()  : mixed
_createDatesDropdown()  : mixed
Create and select the date dropdowns for choosing the birthday
_deleteRecipient()  : mixed
_emailCode()  : mixed
_getAssociatedListsOfRecipient()  : array<string|int, mixed>
Returns an array of List IDs to which the recipient with the given ID is subscribed
_getHTML()  : mixed
_getRecipientTitleMenu()  : mixed
_getRecipientTitles()  : mixed
_getSettings()  : mixed
This is a workaround for PHP 7 compatability.
_initRecipientTitles()  : mixed
_isUniqueRecipientEmail()  : mixed
_setRecipientLists()  : bool
Add the recipient with the given ID to all the lists with their IDs present in the array
_updateRecipient()  : mixed
_validateRecipientAttributes()  : mixed
autoCleanRegisters()  : mixed
Auto clean a registers
getListIdByName()  : int
Returns the ID of the list specified by its name
getListNameById()  : mixed
Get newsletter list name by given id
getLists()  : array<string|int, mixed>
Returns an array of all Newsletter lists
GetProfileURL()  : mixed
Return link to the profile of a user
getRecipientLocaleIdByRecipientId()  : int
Returns the Language ID for a newsletter recipient
getSettings()  : mixed
This is a workaround for PHP 7 compatability.
GetUnsubscribeURL()  : mixed
Get the URL to the page to unsubscribe
getUsersPreferredLanguageId()  : int
Returns the Language ID for a newsletter user
parseConsentView()  : string
Parses the consent icons
sendConsentConfirmationMail()  : bool
Send a consent confirmation mail to users based on mailing list
_getGroups()  : array<string|int, mixed>
Return the access user groups
getCountryMenu()  : mixed
getListRecipientCount()  : int
Return the count of recipients of a list
getRecipientListAssociation()  : array<string|int, mixed>
Get the list associations for all recipients.
getSetting()  : string
Return a setting from the settings table
getUserDateTime()  : string
Get a user dateTime in H:i:s d.m.Y format from db data
prepareForRegExp()  : mixed
prepareNewsletterLinksForSend()  : mixed

Constants

UNSUBSCRIBE_BEHAVIOR_AUTOMATIC

public mixed UNSUBSCRIBE_BEHAVIOR_AUTOMATIC = 'automatic'

Properties

$arrLists

List of present Lists

private static array<string|int, mixed> $arrLists = null
Tags
see
getListIdByName()
static

Methods

_addList()

Add a list with the given name and status

public static _addList(string $listName[, bool $listStatus = false ][, mixed $notificationMail = '' ]) : bool

Upon successfully adding a new list, resets the $arrLists class variable to null.

Parameters
$listName : string

The new list name

$listStatus : bool = false

The new list status, defaults to false for inactive

$notificationMail : mixed = ''
Tags
static
Return values
bool

True on success, false otherwise

_addRecipient()

Add a recipient with the given parameter values and subscribe to the lists with their ID present in $arrLists

public static _addRecipient(string $email, string $uri, string $sex, mixed $salutation, string $title, string $lastname, string $firstname, mixed $position, string $company, mixed $industry_sector, string $address, string $zip, string $city, string $country, mixed $phone_office, mixed $phone_private, mixed $phone_mobile, mixed $fax, mixed $notes, string $birthday, string $status, array<string|int, mixed> $arrLists, int $language, mixed $source) : bool
Parameters
$email : string

The e-mail address

$uri : string

The website URL

$sex : string

The sex

$salutation : mixed
$title : string

The title

$lastname : string

The last name

$firstname : string

The first name

$position : mixed
$company : string

The company name

$industry_sector : mixed
$address : string

The address address

$zip : string

The ZIP

$city : string

The city

$country : string

The country ID

$phone_office : mixed
$phone_private : mixed
$phone_mobile : mixed
$fax : mixed
$notes : mixed
$birthday : string

The birth date

$status : string

The active status

$arrLists : array<string|int, mixed>

The array of subscribed list IDs

$language : int

The preferred language ID

$source : mixed
Tags
static
Return values
bool

True on success, false otherwise

_addRecipientTitle()

public _addRecipientTitle(mixed $title) : mixed
Parameters
$title : mixed

_createDatesDropdown()

Create and select the date dropdowns for choosing the birthday

public _createDatesDropdown([array<string|int, mixed>|string $birthday = '' ]) : mixed
Parameters
$birthday : array<string|int, mixed>|string = ''

_deleteRecipient()

public _deleteRecipient(mixed $id) : mixed
Parameters
$id : mixed

_getAssociatedListsOfRecipient()

Returns an array of List IDs to which the recipient with the given ID is subscribed

public static _getAssociatedListsOfRecipient(int $recipientId[, bool $onlyActiveLists = true ]) : array<string|int, mixed>

On failure, or if the ID is invalid or empty, the empty array is returned.

Parameters
$recipientId : int

The recipient ID

$onlyActiveLists : bool = true

Return all lists if false, all lists otherwise. Defaults to true

Tags
static
Return values
array<string|int, mixed>

The array of subscribed List IDs on success, the empty array otherwise

_getHTML()

public _getHTML([mixed $onlyId = false ]) : mixed
Parameters
$onlyId : mixed = false

_getRecipientTitleMenu()

public _getRecipientTitleMenu([mixed $selected = 0 ][, mixed $attrs = '' ]) : mixed
Parameters
$selected : mixed = 0
$attrs : mixed = ''

_getSettings()

This is a workaround for PHP 7 compatability.

public _getSettings() : mixed

As the method _getSettings was used in mixed scope.

Tags
todo

Refactor settings handling of component by migrating to \Cx\Setting

_isUniqueRecipientEmail()

public _isUniqueRecipientEmail(mixed $email, mixed $recipientId[, mixed $copy = false ]) : mixed
Parameters
$email : mixed
$recipientId : mixed
$copy : mixed = false

_setRecipientLists()

Add the recipient with the given ID to all the lists with their IDs present in the array

public static _setRecipientLists(int $recipientId, array<string|int, mixed> $arrLists, string $source[, bool $setTime = false ]) : bool
Parameters
$recipientId : int

The recipient ID

$arrLists : array<string|int, mixed>

The array of list IDs to subscribe

$source : string

One of "opt-in", "backend", "api"

$setTime : bool = false

(optional) if set to true, consent is stored as confirmed

Tags
static
Return values
bool

True on success, false otherwise

_updateRecipient()

public _updateRecipient(mixed $recipientAttributeStatus, mixed $id, mixed $email, mixed $uri, mixed $sex, mixed $salutation, mixed $title, mixed $lastname, mixed $firstname, mixed $position, mixed $company, mixed $industry_sector, mixed $address, mixed $zip, mixed $city, mixed $country, mixed $phone_office, mixed $phone_private, mixed $phone_mobile, mixed $fax, mixed $notes, mixed $birthday, mixed $status, mixed $arrLists, mixed $language, mixed $source[, mixed $setTime = false ]) : mixed
Parameters
$recipientAttributeStatus : mixed
$id : mixed
$email : mixed
$uri : mixed
$sex : mixed
$salutation : mixed
$title : mixed
$lastname : mixed
$firstname : mixed
$position : mixed
$company : mixed
$industry_sector : mixed
$address : mixed
$zip : mixed
$city : mixed
$country : mixed
$phone_office : mixed
$phone_private : mixed
$phone_mobile : mixed
$fax : mixed
$notes : mixed
$birthday : mixed
$status : mixed
$arrLists : mixed
$language : mixed
$source : mixed
$setTime : mixed = false

_validateRecipientAttributes()

public _validateRecipientAttributes(mixed $recipientAttributeStatus, mixed $recipient_website, mixed $recipient_sex, mixed $recipient_salutation, mixed $recipient_title, mixed $recipient_lastname, mixed $recipient_firstname, mixed $recipient_position, mixed $recipient_company, mixed $recipient_industry, mixed $recipient_address, mixed $recipient_zip, mixed $recipient_city, mixed $recipient_country, mixed $recipient_phone, mixed $recipient_private, mixed $recipient_mobile, mixed $recipient_fax, mixed $recipient_birthday) : mixed
Parameters
$recipientAttributeStatus : mixed
$recipient_website : mixed
$recipient_sex : mixed
$recipient_salutation : mixed
$recipient_title : mixed
$recipient_lastname : mixed
$recipient_firstname : mixed
$recipient_position : mixed
$recipient_company : mixed
$recipient_industry : mixed
$recipient_address : mixed
$recipient_zip : mixed
$recipient_city : mixed
$recipient_country : mixed
$recipient_phone : mixed
$recipient_private : mixed
$recipient_mobile : mixed
$recipient_fax : mixed
$recipient_birthday : mixed

getListIdByName()

Returns the ID of the list specified by its name

public static getListIdByName(string $list_name) : int

Used for importing/setting up User-List relations

Parameters
$list_name : string

The List name

Return values
int

The matching list ID if found, null otherwise

getListNameById()

Get newsletter list name by given id

public getListNameById(int $listId) : mixed
Parameters
$listId : int

List id

Return values
mixed

string or null

getLists()

Returns an array of all Newsletter lists

public static getLists([mixed $excludeHiddenLists = false ][, mixed $extendedInfo = false ]) : array<string|int, mixed>
Parameters
$excludeHiddenLists : mixed = false
$extendedInfo : mixed = false
Tags
internal

Made public for mediadir and access module -- RK / TD

Return values
array<string|int, mixed>

The array of Newsletter lists

GetProfileURL()

Return link to the profile of a user

public GetProfileURL(mixed $code, mixed $email[, mixed $type = self::USER_TYPE_NEWSLETTER ][, mixed $htmlTag = true ]) : mixed
Parameters
$code : mixed
$email : mixed
$type : mixed = self::USER_TYPE_NEWSLETTER
$htmlTag : mixed = true

getRecipientLocaleIdByRecipientId()

Returns the Language ID for a newsletter recipient

public getRecipientLocaleIdByRecipientId(int $id, string $type) : int

If the recipients's preferred language can not be found, the default language ID is returned.

Parameters
$id : int

id of the recipient or the linked access/crm user

$type : string

User type (see constants)

Return values
int

Language ID

getSettings()

This is a workaround for PHP 7 compatability.

public static getSettings() : mixed

As the method _getSettings was used in mixed scope.

Tags
todo

Refactor settings handling of component by migrating to \Cx\Setting

GetUnsubscribeURL()

Get the URL to the page to unsubscribe

public GetUnsubscribeURL(mixed $code, mixed $email[, mixed $type = self::USER_TYPE_NEWSLETTER ][, mixed $htmlTag = true ]) : mixed
Parameters
$code : mixed
$email : mixed
$type : mixed = self::USER_TYPE_NEWSLETTER
$htmlTag : mixed = true

getUsersPreferredLanguageId()

Returns the Language ID for a newsletter user

public getUsersPreferredLanguageId(string $email, string $type) : int

If the user's preferred language can not be found, the default language ID is returned. For crm email addresses this will be the system default language by now

Parameters
$email : string

E-mail address of the user

$type : string

User type (see constants)

Return values
int

Language ID

parseConsentView()

Parses the consent icons

public static parseConsentView(string $source, string $consent) : string
Parameters
$source : string

Either "backend", "api", "opt-in", "undefined"

$consent : string

Date parseable by DateTime or empty string

Return values
string

HTML content

sendConsentConfirmationMail()

Send a consent confirmation mail to users based on mailing list

public sendConsentConfirmationMail(array<string|int, mixed> $categoryIds[, string $email = '' ]) : bool
Parameters
$categoryIds : array<string|int, mixed>

Category to send mail for

$email : string = ''

(optional) Only sends the mail to this user

Return values
bool

False if something went wrong, true otherwise

_getGroups()

Return the access user groups

protected _getGroups([string $orderBy = "`group_name`" ]) : array<string|int, mixed>
Parameters
$orderBy : string = "`group_name`"
Tags
author

Stefan Heinemann sh@adfinis.com

Return values
array<string|int, mixed>

getCountryMenu()

protected getCountryMenu([mixed $selectedCountry = 0 ][, mixed $mantatory = false ]) : mixed
Parameters
$selectedCountry : mixed = 0
$mantatory : mixed = false

getListRecipientCount()

Return the count of recipients of a list

protected static getListRecipientCount(int $id) : int
Parameters
$id : int
Tags
author

Stefan Heinemann sh@adfinis.com

Return values
int

getRecipientListAssociation()

Get the list associations for all recipients.

protected getRecipientListAssociation() : array<string|int, mixed>

This method does return all recipients and their list associations as they are found in the database. This means that also inactive and non-confirmed recipients are returned. Further it will return all list associations, irrespective of the recipients consent state.

Return values
array<string|int, mixed>

The returned array will have the following structure:

[
    'newsletter_user' => [
        <recipient_id> => [
            <list_id>,
            ...
        ],
        ...
    ],
    'access_user' => [
        <recipient_id> => [
            <list_id>,
            ...
        ],
        ...
    ]
]

Note that the recipients are grouped by source type. newsletter_user refers to recipients managed directly by the Newsletter component. access_users are recipients managed by the Access component.

getSetting()

Return a setting from the settings table

protected getSetting(string $name) : string
Parameters
$name : string
Tags
author

Stefan Heinemann sh@adfinis.com

Return values
string

| bool

getUserDateTime()

Get a user dateTime in H:i:s d.m.Y format from db data

protected static getUserDateTime(string $userDateTime) : string
Parameters
$userDateTime : string

DateTime from a db

Return values
string

Return a formatted dateTime as string

prepareForRegExp()

protected static prepareForRegExp(mixed $Text) : mixed
Parameters
$Text : mixed

prepareNewsletterLinksForSend()

protected static prepareNewsletterLinksForSend(mixed $MailId, mixed $MailHtmlContent, mixed $UserId, mixed $recipientType[, mixed $langId = null ]) : mixed
Parameters
$MailId : mixed
$MailHtmlContent : mixed
$UserId : mixed
$recipientType : mixed
$langId : mixed = null

        
On this page

Search results