Blesta
  • Package
  • Class
  • Tree
  • Deprecated

Packages

  • blesta
    • app
      • controllers
      • models
    • components
      • areyouahuman
      • auth
        • motp
        • oath
      • delivery
        • interfax
        • postal
          • methods
      • download
      • email
      • events
        • default
      • exchange
        • rates
          • google
            • finance
          • yahoo
            • finance
      • gateway
        • payments
      • gateways
      • invoice
        • delivery
        • templates
          • quickbooks
            • invoice
      • json
      • modules
      • net
        • amazon
          • s3
        • http
        • net
          • geo
            • ip
      • plugins
      • recaptcha
      • reports
        • aging
          • invoices
        • custom
          • report
        • invoice
          • creation
        • tax
          • liability
        • transactions
          • applied
          • received
      • security
      • session
        • cart
      • settingscollection
      • upgrades
        • tasks
      • upload
      • vcard
    • helpers
      • currency
        • format
      • data
        • structure
          • array
          • string
      • text
        • parser
      • widget
        • client
  • minPHP
    • components
      • input
      • record
    • helpers
      • color
      • data
        • structure
      • date
      • form
      • html
      • javascript
      • xml
    • lib
  • None
  • PHP

Classes

  • Accounts
  • ApiKeys
  • CalendarEvents
  • ClientGroups
  • Clients
  • Companies
  • Contacts
  • Countries
  • Coupons
  • CronTasks
  • Currencies
  • EmailGroups
  • Emails
  • Encryption
  • GatewayManager
  • Invoices
  • InvoiceTemplateManager
  • Languages
  • Logs
  • Marketplace
  • ModuleClientMeta
  • ModuleManager
  • Navigation
  • PackageGroups
  • PackageOptionGroups
  • PackageOptions
  • Packages
  • Payments
  • Permissions
  • PluginManager
  • Pricings
  • ReportManager
  • ServiceChanges
  • Services
  • Settings
  • Staff
  • StaffGroups
  • States
  • Taxes
  • Themes
  • Transactions
  • Users

Class Staff

Staff management

Model
Extended by AppModel
Extended by Staff
Package: blesta\app\models
Copyright: Copyright (c) 2010, Phillips Data, Inc.
License: The Blesta License Agreement
Link: Blesta
Located at app/models/staff.php

Methods summary

public
# __construct( )

Initialize Staff

Initialize Staff

Overrides

AppModel::__construct
public integer
# add( array $vars )

Add a staff member

Add a staff member

Parameters

$vars
array
$vars An array of staff member info including: - user_id The user ID belonging to this staff member - first_name The first name of this staff member - last_name The last name of this staff member - email The email address of this staff member - email_mobile The mobile email address of this staff member - status The status of this staff member 'active', 'inactive' (optional, default active) - groups An array of staff group IDs this staff member belongs to

Returns

integer
The ID of the staff member added, void on error
public
# edit( integer $staff_id, array $vars )

Updates the given staff member with only the values given in $vars

Updates the given staff member with only the values given in $vars

Parameters

$staff_id
integer
$staff_id The ID of the staff member to update
$vars
array
$vars An array of staff member info including: - first_name The first name of this staff member (optional) - last_name The last name of this staff member (optional) - email The email address of this staff member (optional) - email_mobile The mobile email address of this staff member (optional) - status The status of this staff member 'active', 'inactive' (optional, default 'active') - groups An array of staff group IDs this staff member belongs to (optional)
public
# delete( integer $staff_id )

Permanently removes the staff member from the system

Permanently removes the staff member from the system

Parameters

$staff_id
integer
$staff_id The ID of the staff member to remove from the system
public
# assignGroup( integer $staff_id, integer $staff_group_id )

Assigns the given staff ID to the given staff group ID

Assigns the given staff ID to the given staff group ID

Parameters

$staff_id
integer
$staff_id The ID of the staff member to assign to the given group
$staff_group_id
integer
$staff_group_id The ID of the staff group to assign to the given staff member
public
# addNotice( array $vars )

Adds a staff email notice

Adds a staff email notice

Parameters

$vars
array
$vars An array of staff notice information including: - staff_group_id The ID of the staff group this notice will be added to - staff_id The ID of the staff member - action The email group action
public
# addNotices( mixed $staff_id, mixed $staff_group_id, array $actions )

Adds multiple staff email notices

Adds multiple staff email notices

Parameters

$staff_id
mixed
$staff_id The ID of the staff member
$staff_group_id
mixed
$staff_group_id The ID of the staff group these notices will be added to
$actions
array
$vars A list of staff notices, each containing: - action The email group action
public
# deleteNotice( integer $staff_id, integer $staff_group_id, string $action = null )

Deletes the given staff group notice

Deletes the given staff group notice

Parameters

$staff_id
integer
$staff_id The ID of the staff member
$staff_group_id
integer
$staff_group_id The ID of the staff group the notice belongs to
$action
string
$action The email group action to remove (optional, default null to delete all notices)
public mixed
# get( integer $staff_id, integer $company_id = null )

Fetches a staff member and all associated staff settings and staff groups

Fetches a staff member and all associated staff settings and staff groups

Parameters

$staff_id
integer
$staff_id The ID of the staff member
$company_id
integer
$company_id The ID of the company to set staff settings for (optional, if null, no settings will be set)

Returns

mixed
An array of objects or false if no results.

See

Staff::getByUserId()
public mixed
# getByUserId( integer $user_id, integer $company_id = null )

Fetches a staff member and all associated staff settings and staff groups

Fetches a staff member and all associated staff settings and staff groups

Parameters

$user_id
integer
$user_id The ID of the user
$company_id
integer
$company_id The ID of the company to set staff settings for (optional, if null, no settings will be set)

Returns

mixed
An array of objects or false if no results.

See

Staff::get()
public array
# getAllByEmailAction( string $action, integer $company_id, string $notice_type = "all", string $status = null )

Fetches all staff members that can be sent the email corresponding to the given email group action

Fetches all staff members that can be sent the email corresponding to the given email group action

Parameters

$action
string
$action The email group action representing an email type
$company_id
integer
$company_id The ID of the company whose staff members to fetch from
$notice_type
string
$notice_type The type of email notice to fetch (optional) one of: - all Any email notice type - null Notice types that are not set - bcc BCC notice types - to To notice types
$status
string
$status The status of the staff member ("active", "inactive", or null for all; optional, default null)

Returns

array
A list of stdClass objects, each representing a staff member
public mixed
# getList( integer $company_id = null, string $status = null, integer $page = 1, string $order_by = array('id'=>"ASC") )

Fetches a list of all staff members

Fetches a list of all staff members

Parameters

$company_id
integer
$company_id The company ID to fetch (optional, default null)
$status
string
$status The status of the staff member to retrieve ('active', 'inactive', default null for all)
$page
integer
$page The page to return results for
$order_by
string
$order_by The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)

Returns

mixed
An array of objects when $count is false, an integer when $count is true, or false if no results.
public integer
# getListCount( integer $company_id = null, string $status = null )

Returns the total number of staff members returned from Staff::getList(), useful in constructing pagination for the getList() method.

Returns the total number of staff members returned from Staff::getList(), useful in constructing pagination for the getList() method.

Parameters

$company_id
integer
$company_id The company ID to fetch (optional, default null)
$status
string
$status The status of the staff member to retrieve ('active', 'inactive', default null for all)

Returns

integer
The total number of staff members

See

Staff::getList()
public array
# getAll( integer $company_id = null, string $status = null, integer $staff_group_id = null )

Returns a list of all staff members

Returns a list of all staff members

Parameters

$company_id
integer
$company_id The ID of the company from which to fetch staff (optional)
$status
string
$status The status of the staff to fetch ('active' or 'inactive', null for all)
$staff_group_id
integer
$staff_group_id The ID of the client group that the staff must belong to (optional)

Returns

array
A list of stdClass objects each representing a staff member
public array
# getNotices( integer $staff_id, integer $staff_group_id = null, boolean $group_by_action = true )

Fetches all staff group notices

Fetches all staff group notices

Parameters

$staff_id
integer
$staff_id The ID of the staff member
$staff_group_id
integer
$staff_group_id The ID of the staff group (optional, default null for all)
$group_by_action
boolean
$group_by_action True to group by the action, false otherwise (optional, default true)

Returns

array
A list of all staff group notices
public
# addQuickLink( integer $staff_id, integer $company_id, array $vars )

Adds a quicklink for a staff member

Adds a quicklink for a staff member

Parameters

$staff_id
integer
$staff_id The staff ID of this staff member
$company_id
integer
$company_id The company ID of this staff member
$vars
array
$vars An array of quicklink info including: - uri The URI of the link to save - title The title of this quicklink - order The sort order of this quicklink (optional, default 0)
public
# deleteQuickLink( integer $staff_id, integer $company_id, string $uri )

Removes a quicklink for a staff member

Removes a quicklink for a staff member

Parameters

$staff_id
integer
$staff_id The staff ID of this staff member
$company_id
integer
$company_id The company ID of this staff member
$uri
string
$uri The URI of the link to remove
public mixed
# getQuickLinks( integer $staff_id, integer $company_id )

Retrieves all quicklinks for a given staff member

Retrieves all quicklinks for a given staff member

Parameters

$staff_id
integer
$staff_id The staff ID of this staff member
$company_id
integer
$company_id The company ID of this staff member

Returns

mixed
An array of objects representing the quicklinks, or false if none exist
public
# sendNotificationEmail( string $action, integer $company_id, array $tags = null, mixed $cc = null, mixed $bcc = null, array $attachments = null, array $options = null )

Sends the notification email matching the given action to all staff members that should receive it. Sets Input errors on error

Sends the notification email matching the given action to all staff members that should receive it. Sets Input errors on error

Parameters

$action
string
$action The action that specifies the email group to use
$company_id
integer
$company_id The company ID to send this email under
$tags
array
$tags An array of replacement tags containing the key/value pairs for the replacements where the key is the tag to replace and the value is the value to replace it with (optional; A 'staff' tag will automatically be set)
$cc
mixed
$cc The CC address(es) to send to. A string, or an array of email addresses
$bcc
mixed
$bcc The BCC address(es) to send to. A string, or an array of email addresses
$attachments
array
$attachments A multi-dimensional array of attachments containing: - path The path to the attachment on the file system - name The name of the attachment (optional, default '') - encoding The file encoding (optional, default 'base64') - type The type of attachment (optional, default 'application/octet-stream')
$options
array
$options An array of options including: - to_client_id The ID of the client the message was sent to - from_staff_id The ID of the staff member the message was sent from - from The from address - from_name The from name - reply_to The reply to address
public mixed
# getSettings( integer $staff_id, integer $company_id )

Fetch all settings that may apply to this staff member. Settings are inherited in the order of staff_settings -> company_settings -> settings where "->" represents the left item inheriting (and overwriting in the case of duplicates) values found in the right item.

Fetch all settings that may apply to this staff member. Settings are inherited in the order of staff_settings -> company_settings -> settings where "->" represents the left item inheriting (and overwriting in the case of duplicates) values found in the right item.

Parameters

$staff_id
integer
$staff_id The staff ID to retrieve settings for
$company_id
integer
$company_id The company ID to retrieve settings for

Returns

mixed
An array of objects containg key/values for the settings, false if no records found
public mixed
# getSetting( integer $staff_id, string $key, integer $company_id = null )

Fetch a single setting by key name

Fetch a single setting by key name

Parameters

$staff_id
integer
$staff_id The ID of the staff member to fetch the setting for
$key
string
$key The key name of the setting to fetch
$company_id
integer
$company_id The ID of the company to inherit settings from

Returns

mixed
An stdObject containg the key and value, false if no such key exists
public
# setSettings( integer $staff_id, array $vars )

Add multiple staff settings, if duplicate key update the setting

Add multiple staff settings, if duplicate key update the setting

Parameters

$staff_id
integer
$staff_id The ID for the specified staff member
$vars
array
$vars A single dimensional array of key/value pairs of settings
public
# setSetting( integer $staff_id, string $key, string $value )

Add a staff setting, if duplicate key update the setting

Add a staff setting, if duplicate key update the setting

Parameters

$staff_id
integer
$staff_id The ID for the specified staff member
$key
string
$key The key for this staff setting
$value
string
$value The value for this staff setting
public
# unsetSetting( integer $staff_id, string $key )

Delets a staff setting

Delets a staff setting

Parameters

$staff_id
integer
$staff_id The ID for the specified staff member
$key
string
$key The key for this staff setting
public
# saveClientsWidgetsState( integer $staff_id, integer $company_id, array $widgets )

Saves the current state of the clients widget boxes

Saves the current state of the clients widget boxes

Parameters

$staff_id
integer
$staff_id The ID of the staff member to save the widget box state for
$company_id
integer
$company_id The ID of the company to save the widget box state for (in combination with $staff_id)
$widgets
array
$widgets An array of widget state information keyed by widget name including: - open Whether or not the box is open (true/false)
public array
# getClientsWidgetsState( integer $staff_id, integer $company_id )

Fetch the current state of the clients widget boxes

Fetch the current state of the clients widget boxes

Parameters

$staff_id
integer
$staff_id The ID of the staff member to fetch the widget box state for
$company_id
integer
$company_id The ID of the company to fetch the widget box state for (in combination with $staff_id)

Returns

array
An array of widget box state data
public
# saveHomeWidgetsState( integer $staff_id, integer $company_id, array $widgets )

Saves the current state of the home (dashboard) widget boxes

Saves the current state of the home (dashboard) widget boxes

Parameters

$staff_id
integer
$staff_id The ID of the staff member to save the widget box state for
$company_id
integer
$company_id The ID of the company to save the widget box state for (in combination with $staff_id)
$widgets
array
$widgets An array of widget state information keyed by widget name including: - open Whether or not the box is open (true/false)
public array
# getHomeWidgetsState( integer $staff_id, integer $company_id )

Fetch the current state of the home (dashboard) widget boxes

Fetch the current state of the home (dashboard) widget boxes

Parameters

$staff_id
integer
$staff_id The ID of the staff member to fetch the widget box state for
$company_id
integer
$company_id The ID of the company to fetch the widget box state for (in combination with $staff_id)

Returns

array
An array of widget box state data
public
# saveBillingWidgetsState( integer $staff_id, integer $company_id, array $widgets )

Saves the current state of the billing (dashboard) widget boxes

Saves the current state of the billing (dashboard) widget boxes

Parameters

$staff_id
integer
$staff_id The ID of the staff member to save the widget box state for
$company_id
integer
$company_id The ID of the company to save the widget box state for (in combination with $staff_id)
$widgets
array
$widgets An array of widget state information keyed by widget name including: - open Whether or not the box is open (true/false)
public array
# getBillingWidgetsState( integer $staff_id, integer $company_id )

Fetch the current state of the billing (dashboard) widget boxes

Fetch the current state of the billing (dashboard) widget boxes

Parameters

$staff_id
integer
$staff_id The ID of the staff member to fetch the widget box state for
$company_id
integer
$company_id The ID of the company to fetch the widget box state for (in combination with $staff_id)

Returns

array
An array of widget box state data
public boolean
# validateStatus( string $status )

Validates the staff's 'status' field

Validates the staff's 'status' field

Parameters

$status
string
$status The status to check

Returns

boolean
True if validated, false otherwise
public boolean
# validateUniqueCompanies( array $group_ids )

Validates that none of the staff group IDs given belong to the same company

Validates that none of the staff group IDs given belong to the same company

Parameters

$group_ids
array
$group_ids An array of staff group IDs

Returns

boolean
True if none of the staff group IDs belong to the same company, false otherwise
public boolean
# validateNoticeActionExists( string $action, integer $staff_group_id )

Validates that the given action is available for this staff group

Validates that the given action is available for this staff group

Parameters

$action
string
$action The email group action
$staff_group_id
integer
$staff_group_id The ID of the staff group to check

Returns

boolean
True if the staff group has the action available, false otherwise

Methods inherited from AppModel

_(), boolToInt(), currencyToDecimal(), dateToUtc(), errors(), getPerPage(), ifSet(), loadCrypto(), setDefaultIfEmpty(), setPerPage(), setRulesIfSet(), strToBool(), systemDecrypt(), systemEncrypt(), systemHash(), truncateDecimal(), validateExists(), validateStateCountry()

Methods inherited from Model

affectedRows(), begin(), commit(), getConnection(), lastInsertId(), makeDSN(), prepare(), query(), rollBack(), setAttribute(), setFetchMode()

Magic methods summary

Properties summary

Properties inherited from AppModel

$replacement_keys

Blesta API documentation generated by ApiGen 2.8.0