public
|
#
__construct( )
Initialize Staff
Overrides
|
public
integer
|
#
add( array $vars )
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
|
#
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)
|
private
|
#
deleteStaffNotices( integer $staff_id, integer $staff_group_id, string $action = null )
Deletes the staff notices
Deletes the staff 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
- $action
string $action The email group action (optional)
|
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
|
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
|
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
|
private
Record
|
#
getStaff( mixed $company_id = null, mixed $status = null )
Partially constructs the query required by both Staff::getList() and
Staff::getListCount()
Partially constructs the query required by both Staff::getList() and
Staff::getListCount()
Returns
Record
The partially constructed query Record object
|
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
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
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
|
private
array
|
#
getAddRules( array $vars )
Returns the rule set for adding staff
Returns the rule set for adding staff
Parameters
- $vars
array $vars Input vars
Returns
array The rules
|
private
array
|
#
getEditRules( array $vars )
Returns the rule set for editing staff
Returns the rule set for editing staff
Parameters
- $vars
array $vars Input vars
Returns
array The rules
|
private
array
|
#
getNoticeRules( array $vars )
Fetches the rules for adding/editing a staff notice
Fetches the rules for adding/editing a staff notice
Parameters
- $vars
array $vars A list of input vars
Returns
array The staff notice rules
|
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
|