SupportManagerResponses extends SupportManagerModel
SupportManagerResponses model
Table of Contents
Methods
| __construct() | Constructor |
| add() | Adds a new response |
| addCategory() | Adds a new category |
| delete() | Deletes a response |
| deleteCategory() | Deletes a response category and moves |
| edit() | Updates a response |
| editCategory() | Updates a category |
| get() | Retrieves a predefined response |
| getAll() | Retrieves a list of all responses from the given category |
| getAllCategories() | Retrieves a list of all categories from the given category |
| getCategory() | Retrieves a category |
| validateCategoryCompany() | Validates that the given category belongs to the company given |
| validateDeleteCategory() | Validates that the given category can be deleted |
| getCategoryDeleteRules() | Retrieves the rules for deleting a category |
| getCategoryRules() | Retrieves the rules for adding/editing a category |
| getRules() | Retrieves the rules for adding/editing a response |
Methods
__construct()
Constructor
public
__construct() : mixed
add()
Adds a new response
public
add(array<string|int, mixed> $vars) : mixed
Parameters
- $vars : array<string|int, mixed>
-
A list of input vars, including:
- category_id The ID of the category this response is assigned to
- name The name of the response
- details The details (response)
Return values
mixed —An stdClass object representing the predefined response, or void on error
addCategory()
Adds a new category
public
addCategory(array<string|int, mixed> $vars) : stdClass
Parameters
- $vars : array<string|int, mixed>
-
A list of input vars, including:
- company_id The ID of the company this category belongs to
- parent_id The ID of the parent category to assign this category to
- name The name of the category
Return values
stdClass —An stdClass object representing the category, or void on error
delete()
Deletes a response
public
delete(int $response_id) : mixed
Parameters
- $response_id : int
-
The ID of the response to delete
deleteCategory()
Deletes a response category and moves
public
deleteCategory(int $category_id) : mixed
Parameters
- $category_id : int
-
The ID of the category to delete
edit()
Updates a response
public
edit(int $response_id, array<string|int, mixed> $vars) : mixed
Parameters
- $response_id : int
-
The ID of the response to update
- $vars : array<string|int, mixed>
-
A list of input vars, including:
- category_id The ID of the category this response is assigned to
- name The name of the response
- details The details (response)
Return values
mixed —An stdClass object representing the predefined response, or void on error
editCategory()
Updates a category
public
editCategory(int $category_id, array<string|int, mixed> $vars) : stdClass
Parameters
- $category_id : int
-
The ID of the category to update
- $vars : array<string|int, mixed>
-
A list of input vars, including:
- parent_id The ID of the parent category to assign this category to
- name The name of the category
Return values
stdClass —An stdClass object representing the category, or void on error
get()
Retrieves a predefined response
public
get(int $response_id) : mixed
Parameters
- $response_id : int
-
The ID of the predefined response to fetch
Return values
mixed —An stdClass object representing the predefined response, or false if none exist
getAll()
Retrieves a list of all responses from the given category
public
getAll(int $company_id, int $category_id) : array<string|int, mixed>
Parameters
- $company_id : int
-
The ID of the company
- $category_id : int
-
The ID of the category to fetch responses from
Return values
array<string|int, mixed> —A list of stdClass objects representing responses
getAllCategories()
Retrieves a list of all categories from the given category
public
getAllCategories(int $company_id[, int $category_id = null ]) : array<string|int, mixed>
Parameters
- $company_id : int
-
The ID of the company
- $category_id : int = null
-
The ID of the category to fetch categories from
Return values
array<string|int, mixed> —A list of stdClass objects representing categories
getCategory()
Retrieves a category
public
getCategory(int $category_id) : mixed
Parameters
- $category_id : int
-
The ID of the category to fetch
Return values
mixed —An stdClass object representing the category, or false if none exist
validateCategoryCompany()
Validates that the given category belongs to the company given
public
validateCategoryCompany(int $category_id, int $company_id) : mixed
Parameters
- $category_id : int
-
The ID of the category
- $company_id : int
-
The ID of the company
validateDeleteCategory()
Validates that the given category can be deleted
public
validateDeleteCategory(int $category_id) : bool
Parameters
- $category_id : int
-
The ID of the category to delete
Return values
bool —True if the category can be deleted, false otherwise
getCategoryDeleteRules()
Retrieves the rules for deleting a category
private
getCategoryDeleteRules() : array<string|int, mixed>
Return values
array<string|int, mixed> —A list of rules
getCategoryRules()
Retrieves the rules for adding/editing a category
private
getCategoryRules(array<string|int, mixed> $vars[, bool $edit = false ]) : array<string|int, mixed>
Parameters
- $vars : array<string|int, mixed>
-
A list of input vars to validate
- $edit : bool = false
-
True to fetch the edit rules, false for the add rules (optional, default false)
Return values
array<string|int, mixed> —A list of rules
getRules()
Retrieves the rules for adding/editing a response
private
getRules(array<string|int, mixed> $vars[, bool $edit = false ]) : array<string|int, mixed>
Parameters
- $vars : array<string|int, mixed>
-
A list of input vars to validate
- $edit : bool = false
-
True to fetch the edit rules, false for the add rules (optional, default false)
Return values
array<string|int, mixed> —A list of rules