main
in package
Class main
Represents a class for managing pages in the intranet.
Table of Contents
Properties
Methods
- __construct() : void
- Class constructor.
- __destruct() : mixed
- Destructor method.
- all() : array<string|int, mixed>|bool
- Retrieves all pages.
- delete() : bool
- Deletes a record from the tpages table based on the given value and column.
- get() : array<string|int, mixed>|bool
- Retrieves a specific page.
- getall() : array<string|int, mixed>|bool
- insert() : bool
- Insert a new page into the database.
- update() : bool
- Updates a record in the tpages table with the given value based on the specified column and page ID.
Properties
$tpages
protected
tab_pages
$tpages
Methods
__construct()
Class constructor.
public
__construct() : void
Initializes the object by creating a new instance of tab_pages and assigning it to the $tpages property.
__destruct()
Destructor method.
public
__destruct() : mixed
Unsets the "tpages" property.
all()
Retrieves all pages.
public
all(string $pg[, string $sort = 'module' ][, string $filter = '' ]) : array<string|int, mixed>|bool
Parameters
- $pg : string
- $sort : string = 'module'
-
The sorting method to use. (Default: 'module')
- $filter : string = ''
Return values
array<string|int, mixed>|bool —An array containing all the pages retrieved, or boolean false if retrieval fails.
delete()
Deletes a record from the tpages table based on the given value and column.
public
delete(string $val[, string $col = 'url' ]) : bool
Parameters
- $val : string
-
The value to match for deletion.
- $col : string = 'url'
-
(optional) The column to match the value against. Defaults to 'url'.
Return values
bool —Returns true if the record was successfully deleted, false otherwise.
get()
Retrieves a specific page.
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 for the value in.
Return values
array<string|int, mixed>|bool —An array containing the specific page retrieved, or boolean false if retrieval fails.
getall()
public
getall(string $col, string $val) : array<string|int, mixed>|bool
Parameters
- $col : string
- $val : string
Return values
array<string|int, mixed>|boolinsert()
Insert a new page into the database.
public
insert(string $mod, string $name, string $path, string $file, string $url[, string $isadmin = '0' ]) : bool
Parameters
- $mod : string
-
The module name for the page.
- $name : string
-
The name of the page.
- $path : string
-
The path of the page.
- $file : string
-
The file name of the page.
- $url : string
-
The URL of the page.
- $isadmin : string = '0'
-
The admin flag for the page. (Default: '0')
Return values
bool —True if the page is successfully inserted, false otherwise.
update()
Updates a record in the tpages table with the given value based on the specified column and page ID.
public
update(string $col, string $val, string $pid) : bool
Parameters
- $col : string
-
The column to update.
- $val : string
-
The new value to set.
- $pid : string
-
The page ID to identify the record.
Return values
bool —Returns true if the record was successfully updated, false otherwise.