Support

Reference for the Support module: every class and function, with its full signature, parameters and return type. Create support tickets from members or anonymous visitors, render chat and ticket-creation UI, and map ticket, message and resolution rows to immutable data objects.

This page is a pure reference. It documents only what the module's source defines: the ticket data objects, the database helpers that insert and map ticket rows, and the two UI component classes.

Classes

SupportChatUi

Support chat UI components.

Functions

Message

SupportChatUi::Message(string $name, string $message, CalendarDateTimeData $time, string $align = 'left'): void

Render a single chat message bubble.

NameTypeDescription
$namestringName of the sender.
$messagestringMessage text.
$timeCalendarDateTimeDataTime when the message was sent.
$alignstringAlignment: 'left' or 'right'.

Returns void

SupportDatabase

Static functions that insert support tickets and map ticket, message and resolution rows to their data objects.

fromMessageRow

SupportDatabase::fromMessageRow(stdClass $row): SupportTicketMessageData

Map a support_ticket_message row to data.

NameTypeDescription
$rowstdClassA support_ticket_message row.

Returns SupportTicketMessageData The mapped message data.

fromResolutionRow

SupportDatabase::fromResolutionRow(stdClass $row): SupportTicketResolutionData

Map a support_ticket_resolution row to data.

NameTypeDescription
$rowstdClassA support_ticket_resolution row.

Returns SupportTicketResolutionData The mapped resolution data.

fromRow

SupportDatabase::fromRow(stdClass $row): SupportTicketData

Map a support_ticket row to data.

NameTypeDescription
$rowstdClassA support_ticket row.

Returns SupportTicketData The mapped ticket data.

InsertAnonymousTicket

SupportDatabase::InsertAnonymousTicket(string $email, string $phone, string $text): int

Insert a support ticket with only an email, phone and message, timestamped with the current time.

NameTypeDescription
$emailstringEmail address.
$phonestringPhone number.
$textstringTicket text.

Returns int The new ticket id.

InsertTicket

SupportDatabase::InsertTicket(int|null $memberId, string $email, string $phone, string $text, string|null $tableName = null, int|null $tableId = null): int

Insert a new support ticket with optional member ID and table reference.

NameTypeDescription
$memberIdint|nullMember ID (null for anonymous tickets).
$emailstringEmail address.
$phonestringPhone number.
$textstringTicket text.
$tableNamestring|nullOptional table name this ticket is linked to.
$tableIdint|nullOptional table ID this ticket is linked to.

Returns int The new ticket id.

SupportTicketData

Immutable data for a single support ticket. Fields and constructor only.

Properties

PropertyTypeDescription
$data->idintThe ticket id (readonly).
$data->memberIdint|nullThe member id, or null for anonymous tickets (readonly).
$data->emailstringEmail address (readonly).
$data->phonestringPhone number (readonly).
$data->textstringTicket text (readonly).
$data->tableNamestring|nullOptional table name this ticket is linked to (readonly).
$data->tableIdint|nullOptional table id this ticket is linked to (readonly).
$data->addedCalendarDateTimeDataWhen the ticket was added (readonly).

__construct

new SupportTicketData(int $id = 0, int|null $memberId = null, string $email = '', string $phone = '', string $text = '', string|null $tableName = null, int|null $tableId = null, CalendarDateTimeData $added = new CalendarDateTimeData())

Create support ticket data.

NameTypeDescription
$idintThe ticket id.
$memberIdint|nullThe member id, or null for anonymous tickets.
$emailstringEmail address.
$phonestringPhone number.
$textstringTicket text.
$tableNamestring|nullOptional table name this ticket is linked to.
$tableIdint|nullOptional table id this ticket is linked to.
$addedCalendarDateTimeDataWhen the ticket was added.

Returns SupportTicketData

SupportTicketMessageData

Immutable data for a single message on a support ticket. Fields and constructor only.

Properties

PropertyTypeDescription
$data->idintThe message id (readonly).
$data->ticketIdintThe ticket this message belongs to (readonly).
$data->textstringMessage text (readonly).
$data->adminUserIdint|nullThe admin user id that sent the message, or null (readonly).
$data->addedCalendarDateTimeDataWhen the message was added (readonly).

__construct

new SupportTicketMessageData(int $id = 0, int $ticketId = 0, string $text = '', int|null $adminUserId = null, CalendarDateTimeData $added = new CalendarDateTimeData())

Create support ticket message data.

NameTypeDescription
$idintThe message id.
$ticketIdintThe ticket this message belongs to.
$textstringMessage text.
$adminUserIdint|nullThe admin user id that sent the message, or null.
$addedCalendarDateTimeDataWhen the message was added.

Returns SupportTicketMessageData

SupportTicketResolutionData

Immutable data for the resolution of a support ticket. Fields and constructor only.

Properties

PropertyTypeDescription
$data->idintThe resolution id (readonly).
$data->ticketIdintThe ticket this resolution belongs to (readonly).
$data->successboolWhether the ticket was resolved successfully (readonly).
$data->adminNotesstring|nullOptional admin notes on the resolution (readonly).
$data->addedCalendarDateTimeDataWhen the resolution was added (readonly).

__construct

new SupportTicketResolutionData(int $id = 0, int $ticketId = 0, bool $success = false, string|null $adminNotes = null, CalendarDateTimeData $added = new CalendarDateTimeData())

Create support ticket resolution data.

NameTypeDescription
$idintThe resolution id.
$ticketIdintThe ticket this resolution belongs to.
$successboolWhether the ticket was resolved successfully.
$adminNotesstring|nullOptional admin notes on the resolution.
$addedCalendarDateTimeDataWhen the resolution was added.

Returns SupportTicketResolutionData

SupportTicketUi

Support ticket UI components.

Functions

CreatePanel

SupportTicketUi::CreatePanel(string $successUrl): void

Render a panel with an action form that collects an email, phone and message, inserts an anonymous support ticket on submit, and redirects to the success url.

NameTypeDescription
$successUrlstringThe url to redirect to after the ticket is submitted.

Returns void