Documentation

tab_tickets_status
in package

Class tab_tickets_status

Tags
author

Lutz Boldt boldt@bitstore-online.de

Table of Contents

Properties

$allowedCols  : array<string|int, mixed>
$db  : db_master

Methods

__construct()  : void
Class constructor.
__destruct()  : void
Class destructor.
all()  : array<string|int, mixed>|bool
Retrieves all records from the `tickets_status` table.
delete()  : bool
Deletes a record from the "tickets_status" table based on the given column name and value.
get()  : array<string|int, mixed>|bool
Retrieves a record from the `tickets_status` table based on the specified column and value.
insert()  : bool
Insert a new ticket status into the database.
update()  : bool
Update method.

Properties

$allowedCols

protected array<string|int, mixed> $allowedCols = ['id', 'name', 'color', 'icon']

The allowed columns for some operation

Methods

__construct()

Class constructor.

public __construct() : void

Creates a new instance of the class and assigns the global database manager object to the local database object.

__destruct()

Class destructor.

public __destruct() : void

Unsets the local database object and the array of allowed columns.

all()

Retrieves all records from the `tickets_status` table.

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

(optional) The column name to sort the results by. Defaults to 'id'.

$order : string = 'ASC'

(optional) The sort order. Can be 'ASC' for ascending or 'DESC' for descending. Defaults to 'ASC'.

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

Returns an array containing all the records from the tickets_status table, sorted according to the specified column and order. If there are no records in the table, returns false.

delete()

Deletes a record from the "tickets_status" table based on the given column name and value.

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

If the provided column name is not in the allowed columns list, it defaults to "id". Checks if the given value exists in the table based on the provided column name, and if found, performs a DELETE query to remove the record.

Parameters
$val : string

The value to search for in the specified column.

$col : string = 'id'

The column name to search for the value in (default: 'id').

Return values
bool

Returns true if a record was deleted, otherwise false.

get()

Retrieves a record from the `tickets_status` table based on the specified column and value.

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

The value to search for in the specified column.

$col : string = 'id'

(optional) The column name to search in. Defaults to 'id'.

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

Returns an array containing the record from the tickets_status table that matches the specified column and value. If no matching record is found, returns false.

insert()

Insert a new ticket status into the database.

public insert(string $name, string $color, string $icon) : bool

Checks if a ticket status with the specified name already exists. If not, it escapes the input values and inserts a new record into the tickets_status table.

Parameters
$name : string

The name of the ticket status.

$color : string

The color of the ticket status.

$icon : string

The icon of the ticket status.

Return values
bool

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

update()

Update method.

public update(string $val, string $col, string $id) : bool

Updates the value of a specified column in the "tickets_status" table based on the given id. Returns true if the update is successful, false otherwise.

Parameters
$val : string

The new value to set for the specified column.

$col : string

The name of the column to update.

$id : string

The id of the row to update.

Return values
bool

True if the update is successful, false otherwise.


        
On this page

Search results