class AdmindashboardController extends Controller

Implements support for our Admindashboard controller.

Traits

A trait that support operations related to APIs and their associated JSON responses.

Properties

protected string $_action

The name of the current action.

from  Controller
protected string $_controller

The name of the current controller.

from  Controller
Input $request

Instance of Input class that performs much of our request tasks.

from  Controller
View $view

Instance of view class.

from  Controller
static string|null $rawInputOverride

Raw JSON override for tests

from  JsonResponse
static bool $testing

When true, do not send headers or exit; just echo JSON and return.

from  JsonResponse
static int $lastStatus

Captured status for tests (optional convenience).

from  JsonResponse
static array $lastHeaders

Captured headers for tests (optional convenience).

from  JsonResponse

Methods

__construct(string $controller, string $action)

Constructor for the parent Controller class. This constructor gets called when an instance of the child class is instantiated.

static void
appStart()

Initializes ErrorHandler and SessionManager and starts execution of the app.

void
_set_reporting()

Manages the displaying of error messages and other reporting for this application.

void
logViewForTesting(View $view)

Captures the current View instance during testing so that test assertions (e.g., assertViewContains) can access view-bound variables.

void
onConstruct()

Runs when the object is constructed.

bool
apiCsrfCheck()

Checks if CSRF token has been tampered with.

array|string
get(string|null $input = null)

Supports operations related to handling POST and GET requests.

void
jsonError(string $message, int $status = 400, array $errors = [])

Makes JSON Response for error payloads.

void
jsonRedirect(string $url)

Returns json response success = true and sets path for redirect.

void
jsonResponse(mixed $data, int $status = 200, array $extraHeaders = [])

Sends a JSON response with headers and status code.

void
preflight()

Respond to CORS preflight.

static void
setRawInputOverride(mixed $payload = null)

Inject JSON body by providing payload parameter. Also performs cleanup to avoid leaking into other tests.

void
attachmentsAction()

Displays list of attachments.

void
attachmentDetailsAction(int $id)

Displays details for a particular E-mail attachment.

void
deleteAclAction()

Deletes ACL from acl table.

void
deleteAction(int $id)

Performs delete action on a user.

void
deleteAttachmentAction(int $id)

Deletes an attachment and sets deleted field in table to 1.

void
deleteImageAction()

Deletes an image associated with a user's profile.

void
deleteJobAction(int $id)

Delete a job and redirects back to queueManager.

void
deleteNotificationAction(int $id)

Delete a notification and redirects back to main notifications page.

void
detailsAction(int $id)

Presents information about a particular user's profile.

void
editAclAction(int|string $id)

Supports ability to edit ACLs not assigned to a user through a web form.

void
editAction(int $id)

Supports ability for administrators to edit user profiles.

void
editAttachmentsAction(int|string $id)

Creates or edits the details of an existing E-mail attachment.

void
indexAction()

The default action for this controller. It performs rendering of this site's admin dashboard page.

void
jobDetailsAction(int $id)

Renders view with information related to a job within the queue table.

void
manageACLsAction()

Renders view for managing ACLs.

void
notificationDetailsAction(int $id)

Displays information for a particular notification within the database channel

void
notificationsAction()

Get list of notifications that are found in the database channel.

void
previewAction(int $id)

Previews an attachment.

void
queueManagerAction()

Retrieves list of jobs in queue and renders queue_manager view.

void
setResetPasswordAction(int $id)

Support ability to toggle on or off the reset password flag for a particular user.

void
setStatusAction(int $id)

Sets active status for a particular user. The administrator can toggle the setting on or off using a web form.

Details

in Controller at line 47
__construct(string $controller, string $action)

Constructor for the parent Controller class. This constructor gets called when an instance of the child class is instantiated.

Parameters

string $controller

The name of the controller obtained while parsing the URL.

string $action

The name of the action specified in the path of the URL.

in Application at line 26
static void appStart()

Initializes ErrorHandler and SessionManager and starts execution of the app.

Return Value

void

in Application at line 51
private void _set_reporting()

Manages the displaying of error messages and other reporting for this application.

Return Value

void

in Controller at line 67
protected void logViewForTesting(View $view)

Captures the current View instance during testing so that test assertions (e.g., assertViewContains) can access view-bound variables.

This method should be called in controller actions before rendering a view. It stores the View object in ApplicationTestCase::$controllerOutput['view'] when the application is running in the 'testing' environment.

Parameters

View $view

The View instance to capture.

Return Value

void

at line 336
void onConstruct()

Runs when the object is constructed.

Return Value

void

in JsonResponse at line 47
bool apiCsrfCheck()

Checks if CSRF token has been tampered with.

Return Value

bool

True if token is valid, otherwise we return false.

in JsonResponse at line 62
array|string get(string|null $input = null)

Supports operations related to handling POST and GET requests.

Similar in behavior to the get function from the Input class but for JSON related operations.

Parameters

string|null $input

Field name from POST/GET request, or null to get all.

Return Value

array|string

Sanitized input as array or string.

in JsonResponse at line 97
void jsonError(string $message, int $status = 400, array $errors = [])

Makes JSON Response for error payloads.

Parameters

string $message

The error message.

int $status

The status code.

array $errors

The array of errors.

Return Value

void

in JsonResponse at line 110
void jsonRedirect(string $url)

Returns json response success = true and sets path for redirect.

Parameters

string $url

The url for redirection.

Return Value

void

in JsonResponse at line 125
void jsonResponse(mixed $data, int $status = 200, array $extraHeaders = [])

Sends a JSON response with headers and status code.

Parameters

mixed $data

The JSON response.

int $status

The status code.

array $extraHeaders

Any extra headers.

Return Value

void

in JsonResponse at line 174
void preflight()

Respond to CORS preflight.

Return Value

void

in JsonResponse at line 190
static void setRawInputOverride(mixed $payload = null)

Inject JSON body by providing payload parameter. Also performs cleanup to avoid leaking into other tests.

Parameters

mixed $payload

The JSON payload or null.

Return Value

void

at line 30
void attachmentsAction()

Displays list of attachments.

Return Value

void

at line 44
void attachmentDetailsAction(int $id)

Displays details for a particular E-mail attachment.

Parameters

int $id

Primary key for attachment record.

Return Value

void

at line 56
void deleteAclAction()

Deletes ACL from acl table.

Return Value

void

at line 70
void deleteAction(int $id)

Performs delete action on a user.

Parameters

int $id

The id for the user we want to delete.

Return Value

void

at line 85
void deleteAttachmentAction(int $id)

Deletes an attachment and sets deleted field in table to 1.

Parameters

int $id

The primary key for the attachment's database record.

Return Value

void

at line 96
void deleteImageAction()

Deletes an image associated with a user's profile.

Return Value

void

at line 110
void deleteJobAction(int $id)

Delete a job and redirects back to queueManager.

Parameters

int $id

The id of the job to remove from the queue table.

Return Value

void

at line 125
void deleteNotificationAction(int $id)

Delete a notification and redirects back to main notifications page.

Parameters

int $id

The id of the notification to remove from the notification table.

Return Value

void

at line 140
void detailsAction(int $id)

Presents information about a particular user's profile.

Parameters

int $id

The id of the user whose details we want to view.

Return Value

void

at line 155
void editAclAction(int|string $id)

Supports ability to edit ACLs not assigned to a user through a web form.

Parameters

int|string $id

The id of the ACL we want to modify.

Return Value

void

at line 180
void editAction(int $id)

Supports ability for administrators to edit user profiles.

Parameters

int $id

The id of the user whose profile we want to modify.

Return Value

void

at line 222
void editAttachmentsAction(int|string $id)

Creates or edits the details of an existing E-mail attachment.

Parameters

int|string $id

The primary key for the record associated with an E-mail attachment.

Return Value

void

at line 247
void indexAction()

The default action for this controller. It performs rendering of this site's admin dashboard page.

Return Value

void

at line 266
void jobDetailsAction(int $id)

Renders view with information related to a job within the queue table.

Parameters

int $id

the id of job in the queue table.

Return Value

void

at line 278
void manageACLsAction()

Renders view for managing ACLs.

Return Value

void

at line 311
void notificationDetailsAction(int $id)

Displays information for a particular notification within the database channel

Parameters

int $id

The id of the notification.

Return Value

void

at line 323
void notificationsAction()

Get list of notifications that are found in the database channel.

Return Value

void

at line 346
void previewAction(int $id)

Previews an attachment.

Parameters

int $id

The primary key for the record of the attachment.

Return Value

void

at line 355
void queueManagerAction()

Retrieves list of jobs in queue and renders queue_manager view.

Return Value

void

at line 371
void setResetPasswordAction(int $id)

Support ability to toggle on or off the reset password flag for a particular user.

Parameters

int $id

The id of the user whose reset password flag we want to modify.

Return Value

void

at line 396
void setStatusAction(int $id)

Sets active status for a particular user. The administrator can toggle the setting on or off using a web form.

Parameters

int $id

The id of the user we want to activate or inactivate.

Return Value

void