Documentation

NewsletterManager extends NewsletterLib

Class newsletter

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

Table of Contents

Constants

RECIPIENT_CONSENT_GIVEN  = 2
Flag to match only recipients of which consent has been given
RECIPIENT_CONSENT_IGNORE  = 0
Flag to ignore the consent state of recipients
RECIPIENT_CONSENT_PENDING  = 1
Flag to match only recipients of which consent has not yet been given
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

$_arrMailPriority  : mixed
$_arrRecipientTitles  : mixed
$_attachmentPath  : mixed
$_objTpl  : mixed
$_pageTitle  : mixed
$_stdMailPriority  : mixed
$months  : mixed
$strErrMessage  : mixed
$strOkMessage  : mixed
$act  : mixed

Methods

__construct()  : mixed
PHP5 constructor
_addList()  : bool
Add a list with the given name and status
_addMail()  : mixed
_addMailAttachment()  : mixed
_addRecipient()  : bool
Add a recipient with the given parameter values and subscribe to the lists with their ID present in $arrLists
_addRecipientTitle()  : mixed
_addTemplate()  : mixed
_changeListStatus()  : mixed
_checkUniqueListName()  : mixed
_copyMail()  : mixed
_createDatesDropdown()  : mixed
Create and select the date dropdowns for choosing the birthday
_deleteInactiveRecipients()  : void
delete all inactice recipients
_deleteList()  : mixed
_deleteMail()  : mixed
_editList()  : mixed
_editMail()  : null
Add/Edit the mail template
_editTemplate()  : mixed
_editUser()  : mixed
_emailCode()  : mixed
_flushList()  : mixed
_getAssociatedListSelection()  : mixed
_getAssociatedListsOfRecipient()  : array<string|int, mixed>
Returns an array of List IDs to which the recipient with the given ID is subscribed
_getBodyContent()  : mixed
_getEmailsDropDown()  : mixed
_getHTML()  : mixed
_getList()  : mixed
_getListHTML()  : mixed
_getMailPriorityMenu()  : mixed
_getNewsPage()  : null
Parse the news section
_getRecipientTitleMenu()  : mixed
_getRecipientTitles()  : mixed
_getSettings()  : mixed
This is a workaround for PHP 7 compatability.
_getTemplateMenu()  : mixed
_getTemplates()  : mixed
_initRecipientTitles()  : mixed
_isUniqueRecipientEmail()  : mixed
_lists()  : mixed
Display the list administration page
_mails()  : mixed
_prepareNewsletterLinksForCopy()  : mixed
_prepareNewsletterLinksForStore()  : mixed
_prepareNewsPreview()  : string
Replace the placeholders formats
_removeMailAttachment()  : mixed
_sendMail()  : mixed
Send the mails
_sendMailPage()  : mixed
Show the mail send page
_sendTestMail()  : mixed
_setMailLists()  : mixed
_setRecipientLists()  : bool
Add the recipient with the given ID to all the lists with their IDs present in the array
_showEmailFeedbackAnalysis()  : mixed
_showLinkFeedbackAnalysis()  : mixed
_showRecipientEmailFeedbackAnalysis()  : mixed
_showRecipientFeedbackAnalysis()  : mixed
_templates()  : mixed
_update()  : mixed
_updateList()  : mixed
_updateMail()  : mixed
_updateRecipient()  : mixed
_updateTemplate()  : mixed
_userList()  : mixed
_users()  : mixed
_validateRecipientAttributes()  : mixed
autoCleanRegisters()  : mixed
Auto clean a registers
CategoryDropDown()  : mixed
ConfigDispatch()  : mixed
ConfigHTML()  : mixed
DateForDB()  : mixed
dateFromInput()  : long
Takes a date in the format dd.mm.yyyy hh:mm and returns it's representation as mktime()-timestamp.
dbFromDate()  : string
Takes a mktime()-timestamp and formats it as yyyy-mm-dd hh:mm:00 for insertion in db.
delTemplate()  : mixed
emailEditParseLists()  : mixed
Parse the lists to be selected as email recipients
exportuser()  : mixed
feedback()  : mixed
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
getNewsMailContent()  : string
Get News content to send email
getPage()  : mixed
Set the backend page
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.
GetTemplateSource()  : mixed
GetUnsubscribeURL()  : mixed
Get the URL to the page to unsubscribe
getUsersPreferredLanguageId()  : int
Returns the Language ID for a newsletter user
importuser()  : mixed
interfaceSettings()  : mixed
JSadduser()  : mixed
NewsletterNotSendCount()  : mixed
NewsletterSendCount()  : mixed
parseConsentView()  : string
Parses the consent icons
parseNewsDetails()  : null
Parse the news details blocks
ParseNewsletter()  : mixed
Parse the newsletter
SelectListCategory()  : string
SelectListFields()  : string
SelectListStatus()  : string
sendConsentConfirmationMail()  : bool
Send a consent confirmation mail to users based on mailing list
showSettings()  : mixed
Parse the newsletter settings section
updateRecipientConsent()  : bool
Updates recipient consent status in the newsletter_user table.
UserCount()  : mixed
valueFromDate()  : string
Takes a mktime()-timestamp and formats it as dd.mm.yyyy hh:mm
_deleteRecipient()  : bool
Drop recipient from database
_getGroups()  : array<string|int, mixed>
Return the access user groups
_getNewsPreviewPage()  : void
Display the preview of the news in email template
_setTmpSending()  : mixed
Add the email address to the temp
attachAdditionalFieldsToRecipientImportForm()  : void
Attach the following additional fields to the recipient import form: - newsletter campaign selection - recipient list selection - consent checkbox
emailEditGetCrmMembershipFilter()  : array<string|int, mixed>
Return the Crm membership filter of an email
emailTemplates()  : void
Parse Settings E-mail templates section
escapeCsvValue()  : string
Escape a value that it could be inserted into a csv file.
getAllRecipientEmails()  : object
Return all email recipients
getAttributeOfTag()  : string
Returns the value of an attribute of the specified HTML tag name
getCountryMenu()  : mixed
getCrmMembershipConditions()  : string
Returns the where condition for the filtered crm newsletter recipients
getCssAttributeOfTag()  : string
Returns the value of an attribute of the style attribute of an HTML tag
getListRecipientCount()  : int
Returns the total number of recipients for a given recipient list.
getMailRecipientQuery()  : string
Generates the SQL query string used to retrieve recipients for a given email campaign.
getNewsletterData()  : array<string|int, mixed>
Return some newsletter data
getRecipientListAssociation()  : array<string|int, mixed>
Get the list associations for all recipients.
getSetting()  : string|bool
Return a setting from the settings table
getTmpSending()  : DBIterator
Get the emails from the tmp sending page
getUserDateTime()  : string
Get a user dateTime in H:i:s d.m.Y format from db data
getUserEditLink()  : mixed
Return the Edit link of the inform email
getUserList()  : mixed
informAdminAboutRejectedMail()  : mixed
Inform the admin about a reject
prepareForRegExp()  : mixed
prepareNewsletterLinksForSend()  : mixed
returnNewsletterUser()  : array<string|int, mixed>
Return all newsletter users and those access users who are assigned to the list and their information. If `$consent` is set to `0` or `1`, access users are only returned if also `$newsletterListId` is set.
SelectListConsent()  : string
Get HTML-select element to filter by consent state
SendEmail()  : mixed
Deliver an email campaign to a recipient
setAttributeOfTag()  : string
Sets the HTML attribute of a tag to a specified value
setCrmMembershipFilter()  : bool
Store the CRM membership filter
_getMailRecipientCount()  : mixed
emailEditGetAssociatedGroups()  : array<string|int, mixed>
Return the associated access groups of an email
emailEditParseGroups()  : mixed
Parse the groups into the mail edit page
getCurrentMailRecipientCount()  : int
Return the recipient count of the emails
getFinalMailRecipientCount()  : mixed
getLinkData()  : mixed
getNewsletterUserData()  : adodb
Return the user data
getNewsletterValues()  : array<string|int, mixed>|bool
Return the newsletter values
getTmpRecipientCount()  : int
Return the recipient count of a newsletter in the temp table
insertTmpEmail()  : mixed
Insert an email address into the email table
setMailGroups()  : mixed
Associate the user groups with the mail
updateNewsletterRecipientCount()  : mixed
Update the recipient count of a newsletter

Constants

Flag to match only recipients of which consent has been given

public int RECIPIENT_CONSENT_GIVEN = 2

Flag to ignore the consent state of recipients

public int RECIPIENT_CONSENT_IGNORE = 0

Flag to match only recipients of which consent has not yet been given

public int RECIPIENT_CONSENT_PENDING = 1

UNSUBSCRIBE_BEHAVIOR_AUTOMATIC

public mixed UNSUBSCRIBE_BEHAVIOR_AUTOMATIC = 'automatic'

Properties

$_arrMailPriority

public mixed $_arrMailPriority = array(1 => 'TXT_NEWSLETTER_VERY_HIGH', 2 => 'TXT_NEWSLETTER_HIGH', 3 => 'TXT_NEWSLETTER_MEDIUM', 4 => 'TXT_NEWSLETTER_LOW', 5 => 'TXT_NEWSLETTER_VERY_LOW')

Methods

__construct()

PHP5 constructor

public __construct() : mixed
Tags
global

\Cx\Core\Html\Sigma

global

array $_ARRAYLANG

_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

_addMail()

public _addMail(mixed $subject, mixed $template, mixed $senderMail, mixed $senderName, mixed $replyMail, mixed $smtpServer, mixed $priority, mixed $arrAttachment, mixed $htmlContent) : mixed
Parameters
$subject : mixed
$template : mixed
$senderMail : mixed
$senderName : mixed
$replyMail : mixed
$smtpServer : mixed
$priority : mixed
$arrAttachment : mixed
$htmlContent : mixed

_addMailAttachment()

public _addMailAttachment(mixed $attachment[, mixed $mailId = 0 ]) : mixed
Parameters
$attachment : mixed
$mailId : mixed = 0

_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

_addTemplate()

public _addTemplate(mixed $name, mixed $description, mixed $html, mixed $type) : mixed
Parameters
$name : mixed
$description : mixed
$html : mixed
$type : mixed

_checkUniqueListName()

public static _checkUniqueListName(mixed $listId, mixed $listName) : mixed
Parameters
$listId : mixed
$listName : 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 = ''

_deleteInactiveRecipients()

delete all inactice recipients

public _deleteInactiveRecipients() : void

_editMail()

Add/Edit the mail template

public _editMail([bool $copy = false ]) : null
Parameters
$copy : bool = false

If true, copy the newsletter mail when mailid is not empty If false, Add/Edit the newsletter mail

Return values
null

_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

_getBodyContent()

public _getBodyContent(mixed $fullContent) : mixed
Parameters
$fullContent : mixed

_getEmailsDropDown()

public _getEmailsDropDown([mixed $name = 'sendEmail' ][, mixed $selected = 0 ][, mixed $attrs = '' ]) : mixed
Parameters
$name : mixed = 'sendEmail'
$selected : mixed = 0
$attrs : mixed = ''

_getHTML()

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

_getMailPriorityMenu()

public _getMailPriorityMenu([mixed $selectedPriority = 3 ][, mixed $attributes = '' ]) : mixed
Parameters
$selectedPriority : mixed = 3
$attributes : mixed = ''

_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

_getTemplateMenu()

public _getTemplateMenu([mixed $selectedTemplate = '' ][, mixed $attributes = '' ][, mixed $type = 'e-mail' ]) : mixed
Parameters
$selectedTemplate : mixed = ''
$attributes : mixed = ''
$type : mixed = 'e-mail'

_getTemplates()

public _getTemplates([mixed $type = 'e-mail' ]) : mixed
Parameters
$type : mixed = 'e-mail'

_isUniqueRecipientEmail()

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

_lists()

Display the list administration page

public _lists() : mixed
Tags
access

private

global

array $_ARRAYLANG

global

ADONewConnection

_prepareNewsletterLinksForCopy()

public _prepareNewsletterLinksForCopy(mixed $MailHtmlContent) : mixed
Parameters
$MailHtmlContent : mixed

_prepareNewsletterLinksForStore()

public _prepareNewsletterLinksForStore(mixed $MailId) : mixed
Parameters
$MailId : mixed

_prepareNewsPreview()

Replace the placeholders formats

public _prepareNewsPreview(string $TemplateSource) : string
Parameters
$TemplateSource : string

template content

Return values
string

_removeMailAttachment()

public _removeMailAttachment(mixed $attachment[, mixed $mailId = 0 ]) : mixed
Parameters
$attachment : mixed
$mailId : mixed = 0

_setMailLists()

public _setMailLists(mixed $mailId, mixed $arrLists, mixed $mailSentDate) : mixed
Parameters
$mailId : mixed
$arrLists : mixed
$mailSentDate : mixed

_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

_updateList()

public _updateList(mixed $listId, mixed $listName, mixed $listStatus, mixed $notificationMail) : mixed
Parameters
$listId : mixed
$listName : mixed
$listStatus : mixed
$notificationMail : mixed

_updateMail()

public _updateMail(mixed $mailId, mixed $subject, mixed $template, mixed $senderMail, mixed $senderName, mixed $replyMail, mixed $smtpServer, mixed $priority, mixed $arrAttachment, mixed $htmlContent) : mixed
Parameters
$mailId : mixed
$subject : mixed
$template : mixed
$senderMail : mixed
$senderName : mixed
$replyMail : mixed
$smtpServer : mixed
$priority : mixed
$arrAttachment : mixed
$htmlContent : mixed

_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

_updateTemplate()

public _updateTemplate(mixed $id, mixed $name, mixed $description, mixed $html, mixed $type) : mixed
Parameters
$id : mixed
$name : mixed
$description : mixed
$html : mixed
$type : mixed

_userList()

public _userList() : mixed
Tags
todo

instead of just not linking the access users probably link to the access module in case the user has the appropriate rights

_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

CategoryDropDown()

public CategoryDropDown([mixed $name = 'category' ][, mixed $selected = 0 ][, mixed $attrs = '' ]) : mixed
Parameters
$name : mixed = 'category'
$selected : mixed = 0
$attrs : mixed = ''

dateFromInput()

Takes a date in the format dd.mm.yyyy hh:mm and returns it's representation as mktime()-timestamp.

public dateFromInput(mixed $value) : long
Parameters
$value : mixed

string

Return values
long

timestamp

dbFromDate()

Takes a mktime()-timestamp and formats it as yyyy-mm-dd hh:mm:00 for insertion in db.

public dbFromDate(mixed $value) : string
Parameters
$value : mixed

long timestamp

Return values
string

emailEditParseLists()

Parse the lists to be selected as email recipients

public emailEditParseLists(array<string|int, mixed> $associatedLists) : mixed
Parameters
$associatedLists : array<string|int, mixed>
Tags
author

Stefan Heinemann sh@adfinis.com

feedback()

public feedback(mixed &$users, mixed &$linkCount, mixed &$feedbackCount, mixed &$emailCount) : mixed
Parameters
$users : mixed
$linkCount : mixed
$feedbackCount : mixed
$emailCount : 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

getNewsMailContent()

Get News content to send email

public getNewsMailContent(string $importTemplate, NewsLibrary $objNewsLib, object $objNews[, bool $stripTeaser = false ]) : string
Parameters
$importTemplate : string

News Template content

$objNewsLib : NewsLibrary

News library object

$objNews : object

Database Records

$stripTeaser : bool = false

Strip the Teaser text when true

Return values
string

getPage()

Set the backend page

public getPage() : mixed
Tags
access

public

global

\Cx\Core\Html\Sigma

global

array $_ARRAYLANG

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

GetTemplateSource()

public GetTemplateSource(mixed $TemplateID) : mixed
Parameters
$TemplateID : mixed

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 static 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

parseNewsDetails()

Parse the news details blocks

public parseNewsDetails(Sigma $objNewsTpl, NewsLibrary $objNewsLib, object $objNews, int &$currentCategory) : null
Parameters
$objNewsTpl : Sigma

Template object

$objNewsLib : NewsLibrary

News library object

$objNews : object

Database Records

$currentCategory : int

Current category id

Return values
null

ParseNewsletter()

Parse the newsletter

public ParseNewsletter(mixed $subject, mixed $content_text, mixed $TemplateSource, mixed $format, mixed $TargetEmail, mixed $userData, mixed $NewsletterID[, mixed $testDelivery = false ]) : mixed
Parameters
$subject : mixed
$content_text : mixed
$TemplateSource : mixed
$format : mixed
$TargetEmail : mixed
$userData : mixed
$NewsletterID : mixed
$testDelivery : mixed = false
Tags
author

Cloudrexx AG

author

Stefan Heinemann sh@adfinis.com

SelectListCategory()

public SelectListCategory(int $selectedId) : string
Parameters
$selectedId : int
Return values
string

SelectListFields()

public SelectListFields(string $selectedFieldName) : string
Parameters
$selectedFieldName : string
Return values
string

SelectListStatus()

public SelectListStatus(int $selectedStatus) : string
Parameters
$selectedStatus : int
Return values
string

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

updateRecipientConsent()

Updates recipient consent status in the newsletter_user table.

public static updateRecipientConsent(string $email, string $source[, bool $setTime = false ]) : bool

This method updates the source and consent fields in the newsletter_user table for a given email address if the current source is different from the provided source and the consent field is NULL. Optionally, it sets the current date and time as the consent value if $setTime is set to true.

Parameters
$email : string

The recipient's email address.

$source : string

The new source of the recipient's consent.

$setTime : bool = false

If true, sets the consent field to the current date and time. Default is false.

Return values
bool

Returns true if the update was successful, otherwise false.

valueFromDate()

Takes a mktime()-timestamp and formats it as dd.mm.yyyy hh:mm

public valueFromDate([mixed $value = 0 ][, mixed $format = 'd.m.Y H:i:s' ]) : string
Parameters
$value : mixed = 0

long timestamp

$format : mixed = 'd.m.Y H:i:s'
Return values
string

_deleteRecipient()

Drop recipient from database

protected _deleteRecipient(int $id, string $type) : bool

If $type is set to static::USER_TYPE_ACCESS, then only the list associations as well as campaign sending stats associated to that recipient are dropped. The user itself is not dropped.

Parameters
$id : int

ID of recipient to remove.

$type : string

Either one of static::USER_TYPE_NEWSLETTER or static::USER_TYPE_ACCESS

Return values
bool

true on success, otherwise false. false is also returned in case recipient is invalid.

_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>

_getNewsPreviewPage()

Display the preview of the news in email template

protected _getNewsPreviewPage() : void

attachAdditionalFieldsToRecipientImportForm()

Attach the following additional fields to the recipient import form: - newsletter campaign selection - recipient list selection - consent checkbox

protected attachAdditionalFieldsToRecipientImportForm(Sigma $objTpl) : void
Parameters
$objTpl : Sigma

Template instance to add the field to

emailEditGetCrmMembershipFilter()

Return the Crm membership filter of an email

protected emailEditGetCrmMembershipFilter(int $mail) : array<string|int, mixed>
Parameters
$mail : int
Return values
array<string|int, mixed>

escapeCsvValue()

Escape a value that it could be inserted into a csv file.

protected escapeCsvValue(string $value) : string
Parameters
$value : string
Return values
string

getAllRecipientEmails()

Return all email recipients

protected getAllRecipientEmails(int $mailID[, int $consent = self::RECIPIENT_CONSENT_IGNORE ]) : object
Parameters
$mailID : int
$consent : int = self::RECIPIENT_CONSENT_IGNORE
Tags
author

Stefan Heinemann sh@adfinis.com

Return values
object

getAttributeOfTag()

Returns the value of an attribute of the specified HTML tag name

protected getAttributeOfTag(string $html, string $tagName, string $attributeName) : string
Parameters
$html : string

HTML to perform search in

$tagName : string

HTML tag to look for

$attributeName : string

HTML attribute to look for

Return values
string

Attribute value or empty string if not set

getCountryMenu()

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

getCrmMembershipConditions()

Returns the where condition for the filtered crm newsletter recipients

protected getCrmMembershipConditions(array<string|int, mixed> $crmMembershipFilter[, bool $allowOtherNewsletterType = false ]) : string
Parameters
$crmMembershipFilter : array<string|int, mixed>

the filters for the given mail

$allowOtherNewsletterType : bool = false

check if the e-mail address is an crm address

Return values
string

the WHERE statement of the sql query

getCssAttributeOfTag()

Returns the value of an attribute of the style attribute of an HTML tag

protected getCssAttributeOfTag(string $html, string $tagName, string $cssAttributeName) : string
Parameters
$html : string

HTML to perform search in

$tagName : string

HTML tag to look for

$cssAttributeName : string

CSS attribute to look for in style attribute

Return values
string

Attribute value or empty string if not set

getListRecipientCount()

Returns the total number of recipients for a given recipient list.

protected static getListRecipientCount(int $id[, int $consent = self::RECIPIENT_CONSENT_IGNORE ]) : int

This method counts unique email addresses from both newsletter and access users linked to the specified recipient list. The count can be filtered based on consent status:

  • RECIPIENT_CONSENT_IGNORE: Include all with consent or non-opt-in sources.
  • RECIPIENT_CONSENT_PENDING: Only users from non-opt-in sources without consent.
  • RECIPIENT_CONSENT_GIVEN: Only users who have explicitly given consent.
Parameters
$id : int

ID of the recipient list to query recipients for

$consent : int = self::RECIPIENT_CONSENT_IGNORE

Consent filter constant (one of the RECIPIENT_CONSENT_* values)

Tags
throws
Exception

If an unknown consent filter is provided

Return values
int

Number of matching recipients

getMailRecipientQuery()

Generates the SQL query string used to retrieve recipients for a given email campaign.

protected getMailRecipientQuery(int $mailId[, bool $distinctByType = true ][, int $consent = self::RECIPIENT_CONSENT_IGNORE ]) : string

This query aggregates recipients from various sources:

  1. Access users subscribed to selected recipient lists.
  2. Native newsletter users (if not overridden by CRM membership inclusion).
  3. Access users in selected user groups.
  4. CRM contacts based on CRM membership associations.

The result includes optional deduplication by user type and supports filtering based on explicit or pending recipient consent. CRM membership inclusion/exclusion can limit or override certain recipient sources.

Parameters
$mailId : int

The ID of the email campaign.

$distinctByType : bool = true

Whether to include a type column to distinguish recipient sources.

$consent : int = self::RECIPIENT_CONSENT_IGNORE

Consent filter (one of self::RECIPIENT_CONSENT_* constants).

  • RECIPIENT_CONSENT_IGNORE: include all except unconfirmed opt-ins.
  • RECIPIENT_CONSENT_PENDING: only users without consent.
  • RECIPIENT_CONSENT_GIVEN: only users with consent.
Tags
throws
Exception

If an invalid consent filter value is provided.

todo

Refactor the repetitive recipient query building logic for access users and user groups into reusable methods to avoid duplication and enhance maintainability.

Return values
string

The complete SQL query string to fetch campaign recipients.

getNewsletterData()

Return some newsletter data

protected getNewsletterData(int $id) : array<string|int, mixed>
Parameters
$id : int
Tags
author

Stefan Heinemann sh@adfinis.com

throws
Exception
Return values
array<string|int, mixed>

array(subject, status, count, tmp_copy)

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|bool
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

Return the Edit link of the inform email

protected getUserEditLink(int $userID, const $type) : mixed
Parameters
$userID : int
$type : const
Tags
author

Stefan Heinemann sh@adfinis.com

getUserList()

protected getUserList([string $orderField = '' ][, bool $orderAsc = true ]) : mixed
Parameters
$orderField : string = ''
$orderAsc : bool = true

informAdminAboutRejectedMail()

Inform the admin about a reject

protected informAdminAboutRejectedMail(int $newsletterID, int $userID, string $email, string $type, array<string|int, mixed> $newsletterUserData) : mixed

If an email could not be sent, inform the administrator about that (only if the option to do so was set)

Parameters
$newsletterID : int

Nesletter id

$userID : int

User Id

$email : string

E-mail id of the user

$type : string

User type

$newsletterUserData : array<string|int, mixed>

Info about the newsletter user

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

returnNewsletterUser()

Return all newsletter users and those access users who are assigned to the list and their information. If `$consent` is set to `0` or `1`, access users are only returned if also `$newsletterListId` is set.

protected returnNewsletterUser(string $where[, mixed $order = '' ][, int $newsletterListId = 0 ][, mixed $status = null ][, int $consent = -1 ][, mixed $limit = null ][, mixed $pagingPos = 0 ]) : array<string|int, mixed>
Parameters
$where : string

The where String for searching

$order : mixed = ''
$newsletterListId : int = 0

The id of the newsletter category to be selected (0 for all users)

$status : mixed = null
$consent : int = -1

Set to 0 to filter recipients by pending consent state or to 1 to filter by given consent state. Defaults to -1, no filtering by consent state.

$limit : mixed = null
$pagingPos : mixed = 0
Tags
todo

Update this DocBlock

author

Stefan Heinemann sh@adfinis.com

Return values
array<string|int, mixed>

array(array, int)

SelectListConsent()

Get HTML-select element to filter by consent state

protected SelectListConsent([int $selectedConsent = -1 ]) : string
Parameters
$selectedConsent : int = -1

Set to 0 to select consent-pending option or 1 to select consent-given option. Defaults to -1, no option selected.

Return values
string

HTML-select element for filtering by consent state.

SendEmail()

Deliver an email campaign to a recipient

protected SendEmail(int $UserID, int $NewsletterID, string $TargetEmail, bool $TmpEntry[, string $type = self::USER_TYPE_NEWSLETTER ][, bool $sealDelivery = true ]) : mixed
Parameters
$UserID : int

ID of the recipient to receive the email campaign.

$NewsletterID : int

ID of the email campaign to deliver

$TargetEmail : string

Email of the recipient to receive the email campaign.

$TmpEntry : bool

If set to TRUE, then the send operation will execute a live delivery to the recipient. Otherwise if set to FALSE, then the send operation performs a test delivery to the recipient.

$type : string = self::USER_TYPE_NEWSLETTER

Type of the recipient to receive the email campaign. One of the following:

  • NewsletterManager::USER_TYPE_NEWSLETTER (default)
  • NewsletterManager::USER_TYPE_ACCESS
  • NewsletterManager::USER_TYPE_CORE
$sealDelivery : bool = true

If set to TRUE, the email campaign will be marked as sent in the case the campaign has been delivered (or attempted to) to all recipients. If set to FALSE, the delivery check will be skipped and the campaign will not be marked as sent (in case it hasn't been so anyway already). Defaults to TRUE.

setAttributeOfTag()

Sets the HTML attribute of a tag to a specified value

protected setAttributeOfTag(string $html, string $tagName, string $attributeName, string $attributeValue) : string
Parameters
$html : string

HTML to perform search in

$tagName : string

HTML tag to look for

$attributeName : string

HTML attribute to look for

$attributeValue : string

Value to set

Return values
string

altered HTML

setCrmMembershipFilter()

Store the CRM membership filter

protected setCrmMembershipFilter(int $mailID, array<string|int, mixed> $membershipFilter, string $type, string $mailSentDate) : bool
Parameters
$mailID : int
$membershipFilter : array<string|int, mixed>
$type : string
$mailSentDate : string

sent date

Tags
author

Thomas Däppen thomas.daeppen@cloudrexx.com

Return values
bool

true if modification was made, else otherwise

_getMailRecipientCount()

private _getMailRecipientCount([mixed $mailId = null ][, mixed $limit = 0 ][, mixed $pos = 0 ]) : mixed
Parameters
$mailId : mixed = null
$limit : mixed = 0
$pos : mixed = 0

emailEditGetAssociatedGroups()

Return the associated access groups of an email

private emailEditGetAssociatedGroups(int $mail) : array<string|int, mixed>
Parameters
$mail : int
Tags
author

Stefan Heinemann sh@adfinis.com

Return values
array<string|int, mixed>

emailEditParseGroups()

Parse the groups into the mail edit page

private emailEditParseGroups([mixed $associatedGroups = array() ]) : mixed
Parameters
$associatedGroups : mixed = array()
Tags
author

Stefan Heinemann sh@adfinis.com

todo

Apparently parses one group too much

getCurrentMailRecipientCount()

Return the recipient count of the emails

private getCurrentMailRecipientCount(int $mailId[, int $consent = self::RECIPIENT_CONSENT_IGNORE ]) : int
Parameters
$mailId : int
$consent : int = self::RECIPIENT_CONSENT_IGNORE
Tags
author

Stefan Heinemann sh@adfinis.com

author

Thomas Däppen thomas.daeppen@cloudrexx.com

Return values
int

getFinalMailRecipientCount()

private getFinalMailRecipientCount([mixed $mailId = null ]) : mixed
Parameters
$mailId : mixed = null
Tags
todo

I think this should be rewritten too

getNewsletterUserData()

Return the user data

private getNewsletterUserData(int $id, string $type) : adodb
Parameters
$id : int
$type : string
Tags
author

Stefan Heinemann sh@adfinis.com

Return values
adodb

result object

getNewsletterValues()

Return the newsletter values

private getNewsletterValues(int $id) : array<string|int, mixed>|bool
Parameters
$id : int
Return values
array<string|int, mixed>|bool

getTmpRecipientCount()

Return the recipient count of a newsletter in the temp table

private getTmpRecipientCount(int $id) : int
Parameters
$id : int
Tags
author

Stefan Heinemann sh@adfinis.com

Return values
int

insertTmpEmail()

Insert an email address into the email table

private insertTmpEmail(int $mail, string $email, mixed $type) : mixed
Parameters
$mail : int
$email : string
$type : mixed
Tags
author

Stefan Heinemann sh@adfinis.com

setMailGroups()

Associate the user groups with the mail

private setMailGroups(int $mailID, array<string|int, mixed> $groups, string $mailSentDate) : mixed

Associate the access user groups with the newsletter email.

Parameters
$mailID : int
$groups : array<string|int, mixed>
$mailSentDate : string

sent date

Tags
author

Stefan Heinemann sh@adfinis.com

updateNewsletterRecipientCount()

Update the recipient count of a newsletter

private updateNewsletterRecipientCount(int $newsletter) : mixed
Parameters
$newsletter : int
Tags
author

Stefan Heinemann sh@adfinis.com


        
On this page

Search results