Secretaries Model
Handles the db actions that have to do with secretaries.
Data Structure 'first_name' 'last_name' 'email' 'mobile_number' 'phone_number' 'address' 'city' 'state' 'zip_code' 'notes' 'id_roles' 'providers' >> array with provider ids that the secretary handles 'settings' >> array with the secretary settings
public
|
|
public
integer
|
#
add( array $secretary )
Add (insert or update) a secretary user record into database.
Add (insert or update) a secretary user record into database.
Parameters
- $secretary
- Contains the secretary user data.
Returns
integer Returns the record id.
Throws
Exception When the secretary data are invalid (see validate() method).
|
public
boolean
|
#
exists( array $secretary )
Check whether a particular secretary record exists in the database.
Check whether a particular secretary record exists in the database.
Parameters
- $secretary
Contains the secretary data. The 'email' value is required to
be present at the moment.
Returns
boolean Returns whether the record exists or not.
Throws
Exception When the 'email' value is not present on the $secretary argument.
|
public
integer
|
#
insert( array $secretary )
Insert a new sercretary record into the database.
Insert a new sercretary record into the database.
Parameters
- $secretary
- Contains the secretary data.
Returns
integer Returns the new record id.
Throws
Exception When the insert operation fails.
|
public
integer
|
#
update( array $secretary )
Update an existing secretary record in the database.
Update an existing secretary record in the database.
Parameters
- $secretary
- Contains the secretary record data.
Returns
integer Retuns the record id.
Throws
Exception When the update operation fails.
|
public
integer
|
#
find_record_id( array $secretary )
Find the database record id of a secretary.
Find the database record id of a secretary.
Parameters
- $secretary
Contains the secretary data. The 'email' value is required
in order to find the record id.
Returns
integer Returns the record id
Throws
Exception When the 'email' value is not present on the $secretary array.
|
public
boolean
|
#
validate( array $secretary )
Validate secretary user data before add() operation is executed.
Validate secretary user data before add() operation is executed.
Parameters
- $secretary
- Contains the secretary user data.
Returns
boolean Returns the validation result.
|
public
boolean
|
#
delete( numeric $secretary_id )
Delete an existing secretary record from the database.
Delete an existing secretary record from the database.
Parameters
- $secretary_id
- The secretary record id to be deleted.
Returns
boolean Returns the delete operation result.
Throws
Exception When the $secretary_id is not a valid numeric value.
|
public
array
|
#
get_row( numeric $secretary_id )
Get a specific secretary record from the database.
Get a specific secretary record from the database.
Parameters
- $secretary_id
- The id of the record to be returned.
Returns
array Returns an array with the secretary user data.
Throws
Exception When the $secretary_id is not a valid numeric value.
Exception When given record id does not exist in the database.
|
public
string
|
#
get_value( string $field_name, numeric $secretary_id )
Get a specific field value from the database.
Get a specific field value from the database.
Parameters
- $field_name
- The field name of the value to be returned.
- $secretary_id
- Record id of the value to be returned.
Returns
string Returns the selected record value from the database.
Throws
Exception When the $field_name argument is not a valid string.
Exception When the $secretary_id is not a valid numeric.
Exception When the secretary record does not exist in the database.
Exception When the selected field value is not present on database.
|
public
array
|
#
get_batch( string|array $where_clause = '' )
Get all, or specific secretary records from database.
Get all, or specific secretary records from database.
Parameters
- $where_clause
(OPTIONAL) The WHERE clause of the query to be executed.
Use this to get specific secretary records.
Returns
array Returns an array with secretary records.
|
public
integer
|
#
get_secretary_role_id( )
Get the secretary users role id.
Get the secretary users role id.
Returns
integer Returns the role record id.
|
public
string
|
#
get_setting( string $setting_name, integer $secretary_id )
Get a providers setting from the database.
Get a providers setting from the database.
Parameters
- $setting_name
- The setting name that is going to be returned.
- $secretary_id
- The selected provider id.
Returns
string Returs the value of the selected user setting.
|
public
|
#
set_setting( string $setting_name, string $value, numeric $secretary_id )
Set a provider's setting value in the database.
Set a provider's setting value in the database.
The provider and settings record must already exist.
Parameters
- $setting_name
- The setting's name.
- $value
- The setting's value.
- $secretary_id
- The selected provider id.
|
public
boolean
|
#
validate_username( string $username, numeric $user_id )
Validate Records Username
Validate Records Username
Parameters
- $username
- The provider records username.
- $user_id
- The user record id.
Returns
boolean Returns the validation result.
|