Documentation

Newsletter extends NewsletterLib

Newsletter Modul

frontend newsletter class

Tags
copyright

CLOUDREXX CMS - CLOUDREXX AG

author

Cloudrexx Development Team info@cloudrexx.com

access

public

version
1.1.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
$_objTpl  : mixed
$months  : mixed
$arrLists  : array<string|int, mixed>
List of present Lists

Methods

__construct()  : mixed
Constructor
_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
_confirm()  : 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
_profile()  : mixed
_sendAuthorizeEmail()  : bool
Send notification mail to the user
_sendNotificationEmail()  : bool
Send notification mail
_setRecipientLists()  : bool
Add the recipient with the given ID to all the lists with their IDs present in the array
_unsubscribe()  : bool
Handle unsubscription requests
_updateRecipient()  : mixed
_validateRecipientAttributes()  : mixed
autoCleanRegisters()  : mixed
Auto clean a registers
displayInBrowser()  : mixed
displays newsletter contentn in browser
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
getPage()  : mixed
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
sendSubscriptionNotificationMail()  : null
Send the notificaiton about the newly subscribed lists
setBlock()  : mixed
trackLink()  : bool
track link: save feedback to database
_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
isTrackLink()  : mixed
prepareForRegExp()  : mixed
prepareNewsletterLinksForSend()  : mixed
checkCode()  : bool
checks if given code matches given email adress

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

__construct()

Constructor

public __construct(string $pageContent) : mixed
Parameters
$pageContent : string

_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

_sendAuthorizeEmail()

Send notification mail to the user

public _sendAuthorizeEmail(string $recipientEmail, string $recipientSex, string $recipientTitle, string $recipientFirstname, string $recipientLastname) : bool
Parameters
$recipientEmail : string

E-mail

$recipientSex : string

Sex

$recipientTitle : string

User title

$recipientFirstname : string

First name

$recipientLastname : string

Last name

Return values
bool

true when notification send false otherwise

_sendNotificationEmail()

Send notification mail

public _sendNotificationEmail(int $action, int $recipientId) : bool
Parameters
$action : int

1 = subscribe | 2 = unsubscribe

$recipientId : int

Id of the recipient

Return values
bool

True when notification mail send successfully, false otherwise

_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

_unsubscribe()

Handle unsubscription requests

public _unsubscribe() : bool

Uses extended functionality if the "confirmation" block is present in the page template:

  • If the "unsubscribe_behavior" is set to "manual", the recipient must confirm by pressing the button.
  • In any case, a POST request is sent by the form on the page in order to avoid unintended unsubscriptions by bots. Otherwise, the unsubscription happens immediately with parameter values from the request (usually GET, but POST is supported, too). Adds a message depending on the outcome.
Tags
global

\ADOConnection $objDatabase

global

array $_ARRAYLANG

Return values
bool

_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

displayInBrowser()

displays newsletter contentn in browser

public static displayInBrowser() : 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

sendSubscriptionNotificationMail()

Send the notificaiton about the newly subscribed lists

public sendSubscriptionNotificationMail(string $recipientEmail, string $recipientSex, string $recipientTitle, string $recipientFirstname, string $recipientLastname, array<string|int, mixed> $arrAssociatedLists, array<string|int, mixed> $arrPreAssociatedActiveLists) : null
Parameters
$recipientEmail : string

E-mail

$recipientSex : string

Sex

$recipientTitle : string

User title

$recipientFirstname : string

First name

$recipientLastname : string

Last name

$arrAssociatedLists : array<string|int, mixed>

User subscribed list

$arrPreAssociatedActiveLists : array<string|int, mixed>

User already assigned lists

Return values
null

setBlock()

public setBlock(mixed &$code) : mixed
Parameters
$code : mixed

track link: save feedback to database

public static trackLink() : bool
Return values
bool

_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

checkCode()

checks if given code matches given email adress

private static checkCode(mixed $id, string $email, string $code) : bool
Parameters
$id : mixed
$email : string
$code : string
Return values
bool

        
On this page

Search results