tab_menue_access
in package
Class tab_menue_access
Represents the access to the 'menue_access' table in the database.
Table of Contents
Properties
- $allowedCols : array<string|int, mixed>
- $db : db_master
- Database connection object.
Methods
- __construct() : void
- Constructor method for the class.
- __destruct() : void
- Destructor method.
- all() : array<string|int, mixed>|bool
- Retrieves all records from the `menue_access` table.
- delete() : bool
- Deletes a record from the `menue_access` table based on the given `id`.
- get() : array<string|int, mixed>|bool
- Retrieves records from the `menue_access` table based on the specified value and column.
- getaccessfrommidandgid() : string
- getfrommidandgid() : array<string|int, mixed>|bool
- insert() : bool
- Insert a record into the `menue_access` table.
- update() : bool
- Updates the access level of a record in the `menue_access` table based on the given ID.
Properties
$allowedCols
protected
array<string|int, mixed>
$allowedCols
= ['id', 'menue', 'group', 'access']
List of allowed column names
$db
Database connection object.
protected
db_master
$db
This class represents a connection to a database and provides methods for executing queries and interacting with the database. It uses the PHP PDO extension for database connectivity.
Tags
Methods
__construct()
Constructor method for the class.
public
__construct() : void
Initializes the object by setting the database connection.
__destruct()
Destructor method.
public
__destruct() : void
Unsets the db
and allowedCols
properties of the object.
all()
Retrieves all records from the `menue_access` table.
public
all([string $sort = 'menue' ][, string $dir = 'ASC' ]) : array<string|int, mixed>|bool
Parameters
- $sort : string = 'menue'
-
The column to sort the results by. Default is 'menue'.
- $dir : string = 'ASC'
-
The sorting direction. Default is 'ASC'.
Return values
array<string|int, mixed>|bool —Returns an array of records if successful, otherwise returns false.
delete()
Deletes a record from the `menue_access` table based on the given `id`.
public
delete(string $maid) : bool
Parameters
- $maid : string
-
The ID of the record to be deleted.
Return values
bool —Returns true if the record was deleted successfully, false otherwise.
get()
Retrieves records from the `menue_access` table based on the specified value and column.
public
get(string $val[, string $col = 'group' ]) : array<string|int, mixed>|bool
Parameters
- $val : string
-
The value to match in the specified column.
- $col : string = 'group'
-
The column to search for the specified value. Default is 'group'.
Return values
array<string|int, mixed>|bool —Returns an array of matching records if successful, otherwise returns false.
getaccessfrommidandgid()
public
getaccessfrommidandgid(string $mid, string $gid) : string
Parameters
- $mid : string
- $gid : string
Return values
stringgetfrommidandgid()
public
getfrommidandgid(string $mid, string $gid) : array<string|int, mixed>|bool
Parameters
- $mid : string
- $gid : string
Return values
array<string|int, mixed>|boolinsert()
Insert a record into the `menue_access` table.
public
insert(string $mid, string $gid, string $accesslvl) : bool
Parameters
- $mid : string
-
The value of the "menue" column.
- $gid : string
-
The value of the "group" column.
- $accesslvl : string
-
The value of the "access" column.
Return values
bool —Returns true if the record is successfully inserted, otherwise false.
update()
Updates the access level of a record in the `menue_access` table based on the given ID.
public
update(string $accesslvl, string $maid) : bool
Parameters
- $accesslvl : string
-
The new access level value.
- $maid : string
-
The ID of the record to be updated.
Return values
bool —Returns true if the record was updated successfully, false otherwise.