Blesta Source Documentation

EmailGroups extends AppModel

Email Group management

Table of Contents

Methods

__construct() Initialize Email Groups
add() Adds an email group
delete() Deletes an email group
edit() Updates an email group
getAll() Fetches a list of all email groups irrespective of company
getAllByNoticeType() Fetches a list of all email groups by the notice type
getAllEmails() Fetches a list of all emails and email groups under a company for a specific type and language
getByAction() Fetches an email group
validateType() Validates an email group's 'type' field
getRules() Returns the rule set for adding/editing email groups
Methods

__construct()

Initialize Email Groups

public __construct() : mixed

add()

Adds an email group

public add(array<string|int, mixed> $vars) : mixed
Parameters
$vars : array<string|int, mixed>

An array of variable email group info, including:

  • action A unique action
  • type The type of user this email group applies to (optional, default 'client')
  • notice_type The type of notice this email is for ('bcc', 'to', or null for none; optional, default null)
  • plugin_dir The directory where the plugin resides that is associated with this email group (optional)
  • tags Tags that apply to this group (optional, default NULL)
Return values
mixed —

The email group ID, or void on error

delete()

Deletes an email group

public delete(int $id) : mixed
Parameters
$id : int

The email group ID

edit()

Updates an email group

public edit(int $id, array<string|int, mixed> $vars) : mixed
Parameters
$id : int

The ID of the email group to edit

$vars : array<string|int, mixed>

An array of variable email group info, including:

  • action A unique action
  • type The type of user this email group applies to (optional, default 'client')
  • notice_type The type of notice this email is for ('bcc', 'to', or null for none; optional)
  • plugin_dir The directory where the plugin resides that is associated with this email group (optional)
  • tags Tags that apply to this group (optional, default NULL)

getAll()

Fetches a list of all email groups irrespective of company

public getAll([string $type = 'client' ][, bool $core = true ]) : array<string|int, mixed>
Parameters
$type : string = 'client'

The type of email groups to fetch, one of the following (optional, default "client")

  • client
  • staff
  • shared
$core : bool = true

True to fetch all core email groups, or false to fetch all plugin-related email groups

Return values
array<string|int, mixed> —

A list of stdClass objects representing email groups

getAllByNoticeType()

Fetches a list of all email groups by the notice type

public getAllByNoticeType(mixed $notice_type[, string $type = null ][, string $core = true ]) : array<string|int, mixed>
Parameters
$notice_type : mixed

A string representing the notice type to fetch, one of the following:

  • bcc The BCC type
  • to The To type
  • null
$type : string = null

The type of email groups to fetch, one of the following (optional)

  • client
  • staff
  • shared
$core : string = true

True to fetch all core email groups, or false to fetch all plugin-related email groups (optional, default true)

Return values
array<string|int, mixed> —

A list of stdClass objects representing email groups

getAllEmails()

Fetches a list of all emails and email groups under a company for a specific type and language

public getAllEmails(int $company_id[, string $type = 'client' ][, string $core = true ][, string $lang = null ]) : array<string|int, mixed>
Parameters
$company_id : int

The company ID to fetch email groups for

$type : string = 'client'

The type of email group to get, "client", "staff", "shared" (optional, default "client")

$core : string = true

True to fetch all core email groups, or false to fetch all plugin-related email groups (optional, default true)

$lang : string = null

The language in ISO 636-1 2-char + "_"

  • ISO 3166-1 2-char (e.g. en_us) (optional, defaults to default language)
Return values
array<string|int, mixed> —

A list of stdClass objects representing emails

getByAction()

Fetches an email group

public getByAction(string $action) : mixed
Parameters
$action : string

The type of email group to fetch

Return values
mixed —

An stdClass object representing the email group, or false if one does not exist

validateType()

Validates an email group's 'type' field

public validateType(string $type) : bool
Parameters
$type : string

The type

Return values
bool —

True if type is validated, false otherwise

getRules()

Returns the rule set for adding/editing email groups

private getRules(array<string|int, mixed> $vars[, bool $edit = false ]) : array<string|int, mixed>
Parameters
$vars : array<string|int, mixed>

The input vars

$edit : bool = false

True to fetch the edit rules, or false for the add rules (default false)

Return values
array<string|int, mixed> —

Email group rules

Tags
subpackage

app.models

copyright

Copyright (c) 2010, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results