Documentation

main

Class main

Represents a class for managing tickets, articles, messages and times.

Table of Contents

Properties

$ttickets  : tab_tickets
$ttickets_articles  : tab_tickets_articles
$ttickets_messages  : tab_tickets_messages
$ttickets_times  : tab_tickets_times

Methods

__construct()  : mixed
Constructor for the class.
__destruct()  : void
Destructor for the class.
all()  : array<string|int, mixed>|bool
Retrieves all tickets with optional filters.
articlesdelete()  : bool
Delete records from the ttickets_articles table based on the given value and column.
articlesget()  : array<string|int, mixed>|bool
Get articles from the database based on the given column and value.
articlesgetall()  : array<string|int, mixed>|bool
Get all articles from the database based on a specific value and column.
articlesinsert()  : bool
Insert an article into the database for a ticket.
articlesupdate()  : bool
Update records in the ttickets_articles table based on the given column, value and id.
calculatetimes()  : string|int|float
Calculate the total time and pause time based on the given ticket number and optional message ID.
calculatetimestech()  : string
Calculate the total time worked by a technician based on the given user ID and type.
checkifrunning()  : bool
counttickets()  : int|string
Count the number of tickets based on the given status for active tickets.
delete()  : bool
Delete records from the ttickets table based on the given value and column.
generatearticlesmodaltext()  : string
Generate the text for the articles modal based on the given tmid.
get()  : array<string|int, mixed>|bool
Get ticket information from the database.
getall()  : array<string|int, mixed>|bool
Get all tickets from the database based on a specific value and column.
getalltickets()  : array<string|int, mixed>|bool
Retrieve all tickets based on specified parameters.
getoverduetickets()  : array<string|int, mixed>|bool
Retrieves overdue tickets for a specific user.
gettimesandmesage()  : array<string|int, mixed>|false
Get times and messages for a given ticket ID.
insert()  : int|string|bool
Insert a ticket into the database.
messagesdelete()  : bool
Delete records from the ttickets_messages table based on the given value and column.
messagesget()  : array<string|int, mixed>|bool
Get messages from the database for a given value and column.
messagesgetall()  : array<string|int, mixed>|bool
Get all messages from the database based on a given column and value.
messagesinsert()  : string|int|bool
Insert a new message into the ttickets_messages table.
messagesupdate()  : bool
Update records in the ttickets_messages table based on the given column, value, and ID.
timesdelete()  : bool
Delete records from the ttickets_times table based on the given value and column.
timesget()  : array<string|int, mixed>|bool
Get times from the database based on a certain value and column.
timesgetall()  : array<string|int, mixed>|bool
Retrieve all time records from the database based on a specific value and column.
timesinsert()  : bool
Insert a new record into the ttickets_times table with the specified values.
timesupdate()  : bool
Update records in the ttickets_times table based on the given column, value, and ID.
update()  : bool
Update a record in the ttickets table based on the given column, value, and ticket ID.
makeartcols()  : string
Generate HTML code for displaying an article with its amount, title, and serial number.
mergeoverduesandnormals()  : array<string|int, mixed>|false
Merge overdue tickets and normal tickets based on the given status.
round_to_nearest_quarter()  : float|int
Round the given time to the nearest quarter.

Properties

$ttickets

protected tab_tickets $ttickets

Handles all activities with the database for the tickets table

$ttickets_articles

protected tab_tickets_articles $ttickets_articles

Handles all activities with the database for the tickets_articles table

$ttickets_messages

protected tab_tickets_messages $ttickets_messages

Handles all activities with the database for the tickets_messages table

$ttickets_times

protected tab_tickets_times $ttickets_times

Handles all activities with the database for the tickets_times table

Methods

__construct()

Constructor for the class.

public __construct() : mixed

Initializes the objects for ticket, ticket articles, ticket messages, and ticket times.

__destruct()

Destructor for the class.

public __destruct() : void

This method is automatically called when the object is destroyed. It is responsible for cleaning up any resources that were allocated by the object.

all()

Retrieves all tickets with optional filters.

public all([string $sort = 'id' ][, string $order = 'ASC' ][, string $statusactives = '0' ][, string $resubs = '0' ]) : array<string|int, mixed>|bool
Parameters
$sort : string = 'id'

The field to sort the tickets by (optional). Defaults to 'id'.

$order : string = 'ASC'

The sorting order (optional). Defaults to 'ASC'.

$statusactives : string = '0'

The status value for active tickets (optional). Defaults to '0'.

$resubs : string = '0'

The value for resubmission tickets flag (optional). Defaults to '0'.

Return values
array<string|int, mixed>|bool

Returns an array of tickets if successful, or false on failure.

articlesdelete()

Delete records from the ttickets_articles table based on the given value and column.

public articlesdelete(string $val[, string $col = 'tmid' ]) : bool
Parameters
$val : string

The value to match against the column.

$col : string = 'tmid'

The column to match against. If not provided, the default column is 'tmid'.

Return values
bool

Returns true if the records are deleted successfully, false otherwise.

articlesget()

Get articles from the database based on the given column and value.

public articlesget(string $val[, string $col = 'tmid' ]) : array<string|int, mixed>|bool
Parameters
$val : string

The value of the column to search for.

$col : string = 'tmid'

The column to search in. Default is 'tmid'.

Return values
array<string|int, mixed>|bool

An array of articles if found, or false if no articles are found.

articlesgetall()

Get all articles from the database based on a specific value and column.

public articlesgetall(string $val[, string $col = 'tmid' ]) : array<string|int, mixed>|bool
Parameters
$val : string

The value to search for.

$col : string = 'tmid'

The column to search in. Default is 'tmid'.

Return values
array<string|int, mixed>|bool

An array of articles if found, false otherwise.

articlesinsert()

Insert an article into the database for a ticket.

public articlesinsert(string $tnumber, string $tmid, string $aid, string $amount[, string $type = '0' ][, string $serial = '' ]) : bool
Parameters
$tnumber : string

The ticket number.

$tmid : string

The ticket message ID.

$aid : string

The article ID.

$amount : string

The amount of the article.

$type : string = '0'

The type of the article. Default is '0'.

$serial : string = ''

The serial number of the article. Default is empty string.

Return values
bool

True if the article is successfully inserted, false otherwise.

articlesupdate()

Update records in the ttickets_articles table based on the given column, value and id.

public articlesupdate(string $col, string $val, string $id) : bool
Parameters
$col : string

The column to update.

$val : string

The new value for the updated column.

$id : string

The id of the record to be updated.

Return values
bool

Returns true if the record is updated successfully, false otherwise.

calculatetimes()

Calculate the total time and pause time based on the given ticket number and optional message ID.

public calculatetimes(string $tnumber[, string $tmid = '' ]) : string|int|float
Parameters
$tnumber : string

The ticket number to calculate the times for.

$tmid : string = ''

The message ID to filter the times by. If not provided, all times for the ticket number will be calculated.

Return values
string|int|float

Returns the total time and pause time in HH:MM format if successful, otherwise returns 0.

calculatetimestech()

Calculate the total time worked by a technician based on the given user ID and type.

public calculatetimestech(string $uid, string $type) : string
Parameters
$uid : string

The user ID of the technician.

$type : string

The type of calculation to perform. Possible values are '1' for current month, '2' for previous month, and any other value for all time.

Return values
string

Returns the total time worked by the technician in HH:MM format.

checkifrunning()

public checkifrunning(string $val[, string $col = 'tnumber' ][, string $type = '-1' ]) : bool
Parameters
$val : string
$col : string = 'tnumber'
$type : string = '-1'
Return values
bool

counttickets()

Count the number of tickets based on the given status for active tickets.

public counttickets(string $statusactives) : int|string
Parameters
$statusactives : string

The status of the tickets to count.

Return values
int|string

Returns the count of tickets as an integer if there are any, or '0' as a string if there are no tickets.

delete()

Delete records from the ttickets table based on the given value and column.

public delete(string $val[, string $col = 'id' ]) : bool
Parameters
$val : string

The value to match against the column.

$col : string = 'id'

The column to match against. If not provided, the default column is 'id'.

Return values
bool

Returns true if the records are deleted successfully, false otherwise.

generatearticlesmodaltext()

Generate the text for the articles modal based on the given tmid.

public generatearticlesmodaltext(string $tmid) : string
Parameters
$tmid : string

The tmid value to get the articles for.

Return values
string

The generated text for the articles modal.

get()

Get ticket information from the database.

public get(string $val[, string $col = 'number' ]) : array<string|int, mixed>|bool
Parameters
$val : string

The value to search for.

$col : string = 'number'

The column to search in. Default is 'number'.

Return values
array<string|int, mixed>|bool

An array containing the ticket information if found, or false if not found.

getall()

Get all tickets from the database based on a specific value and column.

public getall(string $val[, string $col = 'number' ]) : array<string|int, mixed>|bool
Parameters
$val : string

The value to search for.

$col : string = 'number'

The column to search in. Default is 'number'.

Return values
array<string|int, mixed>|bool

An array of tickets if found, false otherwise.

getalltickets()

Retrieve all tickets based on specified parameters.

public getalltickets(string $pg, string $statusactives, array<string|int, mixed> $cust, array<string|int, mixed> $status, array<string|int, mixed> $tech) : array<string|int, mixed>|bool
Parameters
$pg : string

The current page number.

$statusactives : string

The active status for tickets.

$cust : array<string|int, mixed>

An array of customer IDs to filter tickets by.

$status : array<string|int, mixed>

An array of status IDs to filter tickets by.

$tech : array<string|int, mixed>

An array of tech IDs to filter tickets by.

Return values
array<string|int, mixed>|bool

Returns an array of tickets if found, or false if no tickets are found.

getoverduetickets()

Retrieves overdue tickets for a specific user.

public getoverduetickets(string $uid[, string $grp = '1' ][, string $sort = 'resubmission' ][, string $order = 'ASC' ]) : array<string|int, mixed>|bool
Parameters
$uid : string

The user ID.

$grp : string = '1'

The group ID (optional). Defaults to '1'.

$sort : string = 'resubmission'

The sorting method (optional). Defaults to 'resubmission'.

$order : string = 'ASC'

The sorting order (optional). Defaults to 'ASC'.

Return values
array<string|int, mixed>|bool

Returns an array of overdue tickets if successful, or false on failure.

gettimesandmesage()

Get times and messages for a given ticket ID.

public gettimesandmesage(string $tid) : array<string|int, mixed>|false
Parameters
$tid : string

The ticket ID to retrieve times and messages for.

Return values
array<string|int, mixed>|false

Returns an array of times and messages if the ticket exists, false otherwise.

insert()

Insert a ticket into the database.

public insert(string $number, string $statusid, string $subject, string $customerid, string $customerno, string $tech, string $resub[, string $customername = '' ]) : int|string|bool
Parameters
$number : string

The ticket number.

$statusid : string

The ticket status ID.

$subject : string

The subject of the ticket.

$customerid : string

The customer ID associated with the ticket.

$customerno : string

The customer number associated with the ticket.

$tech : string

The technician assigned to the ticket.

$resub : string

The re-submission ID of the ticket.

$customername : string = ''

The name of the customer associated with the ticket. Default is empty string.

Return values
int|string|bool

The ID of the inserted ticket, or a string if any error occurred, or false otherwise.

messagesdelete()

Delete records from the ttickets_messages table based on the given value and column.

public messagesdelete(string $val[, string $col = 'tid' ]) : bool
Parameters
$val : string

The value to match against the column.

$col : string = 'tid'

The column to match against. If not provided, the default column is 'tid'.

Return values
bool

Returns true if the records are deleted successfully, false otherwise.

messagesget()

Get messages from the database for a given value and column.

public messagesget(string $val[, string $col = 'tnumber' ]) : array<string|int, mixed>|bool
Parameters
$val : string

The value to search for.

$col : string = 'tnumber'

The column to search in. Default is 'tnumber'.

Return values
array<string|int, mixed>|bool

An array of messages if found, false otherwise.

messagesgetall()

Get all messages from the database based on a given column and value.

public messagesgetall(string $col, string $val[, string $sort = 'created' ][, string $order = 'DESC' ]) : array<string|int, mixed>|bool
Parameters
$col : string

The column to search for the value.

$val : string

The value to search for in the column.

$sort : string = 'created'

The column to sort the results by. Default is 'created'.

$order : string = 'DESC'

The order to sort the results in. Default is 'DESC'.

Return values
array<string|int, mixed>|bool

An array of messages if found, false otherwise.

messagesinsert()

Insert a new message into the ttickets_messages table.

public messagesinsert(string $tid, string $tnumber, string $typeid, string $uid, string $email, string $message[, string $uname = '' ]) : string|int|bool
Parameters
$tid : string

The ticket id associated with the message.

$tnumber : string

The ticket number associated with the message.

$typeid : string

The type id associated with the message.

$uid : string

The user id associated with the message.

$email : string

The email associated with the message.

$message : string

The content of the message.

$uname : string = ''

The username associated with the message. If not provided, the default is an empty string.

Return values
string|int|bool

Returns the newly inserted message id if successful, an integer error code if there was an error, or false if the insertion failed.

messagesupdate()

Update records in the ttickets_messages table based on the given column, value, and ID.

public messagesupdate(string $col, string $val, string $id) : bool
Parameters
$col : string

The column to update.

$val : string

The value to update.

$id : string

The ID of the records to update.

Return values
bool

Returns true if the records are updated successfully, false otherwise.

timesdelete()

Delete records from the ttickets_times table based on the given value and column.

public timesdelete(string $val[, string $col = 'tmid' ]) : bool
Parameters
$val : string

The value to match against the column.

$col : string = 'tmid'

The column to match against. If not provided, the default column is 'tmid'.

Return values
bool

Returns true if the records are deleted successfully, false otherwise.

timesget()

Get times from the database based on a certain value and column.

public timesget(string $val[, string $col = 'tmid' ]) : array<string|int, mixed>|bool
Parameters
$val : string

The value to search for.

$col : string = 'tmid'

The column to search in. Default is 'tmid'.

Return values
array<string|int, mixed>|bool

An array of times if found, false otherwise.

timesgetall()

Retrieve all time records from the database based on a specific value and column.

public timesgetall(string $val[, string $col = 'tnumber' ]) : array<string|int, mixed>|bool
Parameters
$val : string

The value to match against the specified column.

$col : string = 'tnumber'

The column to match the value against. Default is 'tnumber'.

Return values
array<string|int, mixed>|bool

An array of time records if any are found, false otherwise.

timesinsert()

Insert a new record into the ttickets_times table with the specified values.

public timesinsert(string $tnumber, string $tmid, string $tech[, string $type = '0' ]) : bool
Parameters
$tnumber : string

The ticket number.

$tmid : string

The ticketmessage id.

$tech : string

The name of the technician.

$type : string = '0'

The type. If not provided, the default value is '0'.

Return values
bool

Returns true if the record is inserted successfully, false otherwise.

timesupdate()

Update records in the ttickets_times table based on the given column, value, and ID.

public timesupdate(string $col, string $val, string $id) : bool
Parameters
$col : string

The column to update.

$val : string

The new value to set for the column.

$id : string

The ID of the record to update.

Return values
bool

Returns true if the record is updated successfully, false otherwise.

update()

Update a record in the ttickets table based on the given column, value, and ticket ID.

public update(string $col, string $val, string $tid) : bool
Parameters
$col : string

The column to update.

$val : string

The new value to set in the specified column.

$tid : string

The ticket ID of the record to update.

Return values
bool

Returns true if the record is updated successfully, false otherwise.

makeartcols()

Generate HTML code for displaying an article with its amount, title, and serial number.

private makeartcols(string $amount, string $title, string $serial) : string
Parameters
$amount : string

The amount of the article.

$title : string

The title of the article.

$serial : string

The serial number of the article. If not provided, it will be an empty string.

Return values
string

Returns the generated HTML code.

mergeoverduesandnormals()

Merge overdue tickets and normal tickets based on the given status.

private mergeoverduesandnormals(string $statusactives) : array<string|int, mixed>|false
Parameters
$statusactives : string

The status to filter the normal tickets. Only tickets with this status will be merged.

Return values
array<string|int, mixed>|false

Returns an array containing merged tickets if both overdue and normal tickets are available. Returns an array containing only overdue tickets if normal tickets are not available. Returns an array containing only normal tickets if overdue tickets are not available. Returns false if both overdue and normal tickets are not available.

round_to_nearest_quarter()

Round the given time to the nearest quarter.

private round_to_nearest_quarter(string $time) : float|int
Parameters
$time : string

The time to be rounded in HH:MM format.

Return values
float|int

The rounded time in decimal format.


        
On this page

Search results