main
in package
Class main
Tags
Table of Contents
Properties
Methods
- __construct() : void
- Class constructor.
- __destruct() : void
- Class destructor.
- all() : array<string|int, mixed>|bool
- Retrieve all the modules.
- delete() : bool
- Deletes a module from the system.
- get() : array<string|int, mixed>|bool
- Retrieve data from the tmodules object based on a given value and column.
- insert() : string|bool
- Inserts a new module into the system.
- update() : bool
- Updates the value of a specific column in the module.
Properties
$tmodules
protected
tab_modules
$tmodules
This variable holds the tab_modules class.
Methods
__construct()
Class constructor.
public
__construct() : void
Initializes a new instance of the class with a new instance of the tab_modules class assigned to the $tmodules property.
__destruct()
Class destructor.
public
__destruct() : void
Unsets the $tmodules property, causing its memory to be freed.
all()
Retrieve all the modules.
public
all([string $sort = 'active' ][, string $dir = 'DESC' ]) : array<string|int, mixed>|bool
Retrieves all the modules from the associated tmodules object based on the given sorting and direction.
Parameters
- $sort : string = 'active'
-
The field to sort the modules by. Default value is 'active'.
- $dir : string = 'DESC'
-
The direction in which to sort the modules. Default value is 'DESC'.
Return values
array<string|int, mixed>|bool —An array of modules if successfully retrieved, otherwise a boolean value.
delete()
Deletes a module from the system.
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 value. Default is 'id'.
Return values
bool —Returns true if the module is successfully deleted, or false if an error occurs.
get()
Retrieve data from the tmodules 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 used to filter the data.
- $col : string = 'id'
-
The column to be used for filtering (default is 'id').
Return values
array<string|int, mixed>|bool —Returns an array of data if found, or false if no data is found.
insert()
Inserts a new module into the system.
public
insert(string $name, string $path[, string $active = '0' ]) : string|bool
Parameters
- $name : string
-
The name of the module to be inserted.
- $path : string
-
The path of the module to be inserted.
- $active : string = '0'
-
The active status of the module. Default is '0'.
Return values
string|bool —Returns the inserted module name if successful, or false if an error occurs.
update()
Updates the value of a specific column in the module.
public
update(string $col, string $val, string $id) : bool
Parameters
- $col : string
-
The name of the column to be updated.
- $val : string
-
The new value for the column.
- $id : string
-
The ID of the module to be updated.
Return values
bool —Returns true if the module was updated successfully, or false if an error occurs.