main
in package
Class main
Represents a class that interacts with the tab_groups class.
Table of Contents
Properties
Methods
- __construct() : void
- Constructor method for the class.
- __destruct() : void
- Destructor method for the class. This method is automatically called when the object is destroyed.
- all() : array<string|int, mixed>|bool
- Retrieve all records from the underlying 'tgroups' object.
- countuser() : string
- Count the number of users in the specified group.
- delete() : bool
- Deletes records from the tgroups table based on a specified value and column.
- get() : array<string|int, mixed>|bool
- Retrieve records from the underlying 'tgroups' object based on a given value and column.
- insert() : bool
- Inserts a new record into the database table.
- update() : bool
- Updates records in the tgroups table based on a specified column, value, and ID.
Properties
$tgroups
protected
tab_groups
$tgroups
Represents the tab_groups class.
Methods
__construct()
Constructor method for the class.
public
__construct() : void
Initializes a new instance of the class and sets the underlying 'tgroups' object.
__destruct()
Destructor method for the class. This method is automatically called when the object is destroyed.
public
__destruct() : void
It unsets the $tgroups property.
all()
Retrieve all records from the underlying 'tgroups' object.
public
all([string $sort = 'sort' ]) : array<string|int, mixed>|bool
Parameters
- $sort : string = 'sort'
-
The column to sort the results by. Defaults to 'sort'.
Return values
array<string|int, mixed>|bool —Returns an array of records if successful, or false if an error occurred.
countuser()
Count the number of users in the specified group.
public
countuser(string $gid) : string
Parameters
- $gid : string
-
The ID of the group to count the users in.
Return values
string —Returns the number of users in the specified group as a string.
delete()
Deletes records from the tgroups table based on a specified value and column.
public
delete(string $val[, string $col = 'id' ]) : bool
Parameters
- $val : string
-
The value to search for in the specified column.
- $col : string = 'id'
-
The column to search for the specified value. Default value is 'id'.
Return values
bool —Returns true if the records were successfully deleted, false otherwise.
get()
Retrieve records from the underlying 'tgroups' object based on a given value and column.
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'
-
The column to search in. Defaults to 'id'.
Return values
array<string|int, mixed>|bool —Returns an array of records if successful, or false if an error occurred.
insert()
Inserts a new record into the database table.
public
insert(string $name, string $icon, string $sort) : bool
Parameters
- $name : string
-
The name of the record.
- $icon : string
-
The icon of the record.
- $sort : string
-
The sort order of the record.
Return values
bool —Returns true if the record was successfully inserted, false otherwise.
update()
Updates records in the tgroups table based on a specified column, value, and ID.
public
update(string $col, string $val, string $id) : bool
Parameters
- $col : string
-
The column to be updated.
- $val : string
-
The new value for the specified column.
- $id : string
-
The ID of the record to be updated.
Return values
bool —Returns true if the record was successfully updated, false otherwise.