User
extends FFTable
in package
Backend for Fuwafuwa Table (Alpine JS).
Table of Contents
Constants
Properties
- $allowAdd : mixed
- a function that returns true if add is allowed, else string (reason of disallow)
- $allowDel : mixed
- a function that returns true if delete is allowed, else string (reason of disallow)
- $allowEdit : mixed
- a function that returns true if edit is allowed, else string (reason of disallow)
- $data : array<string|int, mixed>
Methods
- __construct() : mixed
- ajaxEdit() : void
- Generic ajax function for FFTable add/edit/del.
- arrayOf() : array<string|int, mixed>
- Convert `Throwable` variable into array.
- change_password() : void
- edit() : void
- Edit user table and allow disable deletion of user data only if the user is an admin.
- edit_role() : mixed
- execute() : void
- Action dispatcher.
- FSQL() : array<string|int, mixed>
- Flat SQL array result. The order of the field is important.
- FSQL1() : string
- Single value SQL result.
- FSQLC() : array<string|int, mixed>
- Flat SQL array result Column.
- FSQLR() : array<string|int, mixed>
- Flat SQL array result Row.
- get_permission() : mixed
- limitClause() : string
- Sets a limit and offset for database queries based on provided data or default values.
- list() : void
- member_edit() : void
- members() : void
- roles() : mixed
- searchClause() : array<string|int, mixed>
- Generates a SQL WHERE clause based on provided search criteria and filters.
- set_permission() : mixed
- sortClause() : string|null
- Generates an SQL ORDER BY clause based on the provided sorting criteria.
- SQL() : mixed
- Execute SQL, if select operation return result in associative array.
- SQLBI() : void
- Bulk Insert.
- SQLBU() : void
- Bulk Update, only single pk is allowed.
- SQLR() : array<string|int, mixed>
- Execute SQL, return first row from result.
- upload_avatar() : void
- record_elist() : void
- Generic list function from query.
- record_list() : void
- Generic list function from model class.
Constants
ADD
public
mixed
ADD
= 'add'
DEL
public
mixed
DEL
= 'del'
EDIT
public
mixed
EDIT
= 'edit'
VIEW
public
mixed
VIEW
= 'view'
Properties
$allowAdd
a function that returns true if add is allowed, else string (reason of disallow)
protected
mixed
$allowAdd
$allowDel
a function that returns true if delete is allowed, else string (reason of disallow)
protected
mixed
$allowDel
$allowEdit
a function that returns true if edit is allowed, else string (reason of disallow)
protected
mixed
$allowEdit
$data
protected
array<string|int, mixed>
$data
Methods
__construct()
public
__construct() : mixed
ajaxEdit()
Generic ajax function for FFTable add/edit/del.
public
final ajaxEdit(string|BaseModel $class[, string $csrf_field = '' ]) : void
Take a model class, or a class name.
Parameters
- $class : string|BaseModel
- $csrf_field : string = ''
-
if use csrf protection, specify csrf field correspond to the one in the form
arrayOf()
Convert `Throwable` variable into array.
public
arrayOf(Throwable $th) : array<string|int, mixed>
Parameters
- $th : Throwable
Return values
array<string|int, mixed> —containing information about the Throwable object is being returned. The array includes the message, code, file, line, and trace of the Throwable object.
change_password()
public
change_password(Base $f3) : void
Parameters
- $f3 : Base
edit()
Edit user table and allow disable deletion of user data only if the user is an admin.
public
edit(Base $f3) : void
Parameters
- $f3 : Base
edit_role()
public
edit_role(mixed $f3) : mixed
Parameters
- $f3 : mixed
execute()
Action dispatcher.
public
execute(Base $f3[, string $action = "" ]) : void
Dispatch action into correspondent method.
Parameters
- $f3 : Base
- $action : string = ""
FSQL()
Flat SQL array result. The order of the field is important.
public
FSQL() : array<string|int, mixed>
Return values
array<string|int, mixed>FSQL1()
Single value SQL result.
public
FSQL1() : string
Return values
string —value of the query with 1 row, 1 column (e.g. SELECT COUNT(1))
FSQLC()
Flat SQL array result Column.
public
FSQLC() : array<string|int, mixed>
Return values
array<string|int, mixed>FSQLR()
Flat SQL array result Row.
public
FSQLR() : array<string|int, mixed>
Return values
array<string|int, mixed> —result that only needed only the first record
get_permission()
public
get_permission(mixed $f3) : mixed
Parameters
- $f3 : mixed
limitClause()
Sets a limit and offset for database queries based on provided data or default values.
public
limitClause() : string
Return values
string —a SQL LIMIT clause with the size and offset values based on the data provided. The returned string will be in the format: "LIMIT ... OFFSET ...".
list()
public
list(Base $f3) : void
Parameters
- $f3 : Base
member_edit()
public
member_edit(Base $f3) : void
Parameters
- $f3 : Base
members()
public
members(Base $f3) : void
Parameters
- $f3 : Base
roles()
public
roles(mixed $f3) : mixed
Parameters
- $f3 : mixed
searchClause()
Generates a SQL WHERE clause based on provided search criteria and filters.
public
searchClause([string $otherCond = "" ]) : array<string|int, mixed>
Parameters
- $otherCond : string = ""
Return values
array<string|int, mixed> —An array containing the WHERE clause and the corresponding parameters for a SQL query is being returned.
set_permission()
public
set_permission(mixed $f3) : mixed
Parameters
- $f3 : mixed
sortClause()
Generates an SQL ORDER BY clause based on the provided sorting criteria.
public
sortClause() : string|null
Return values
string|null —an SQL ORDER BY clause based on the array in
the data. If the array is not empty, it constructs and returns a string with the column
names and sort directions separated by commas. If the array is empty, it returns null.
SQL()
Execute SQL, if select operation return result in associative array.
public
SQL() : mixed
Return values
mixed —result in associative array
SQLBI()
Bulk Insert.
public
SQLBI(string $sql, array<string|int, mixed> $values[, int $chunk_size = 100 ]) : void
Parameters
- $sql : string
- $values : array<string|int, mixed>
- $chunk_size : int = 100
-
(optional)
SQLBU()
Bulk Update, only single pk is allowed.
public
SQLBU(string $sql, string $pk, array<string|int, mixed> $values[, int $chunk_size = 100 ]) : void
Parameters
- $sql : string
- $pk : string
- $values : array<string|int, mixed>
- $chunk_size : int = 100
-
(optional)
SQLR()
Execute SQL, return first row from result.
public
SQLR() : array<string|int, mixed>
Return values
array<string|int, mixed>upload_avatar()
public
upload_avatar(Base $f3) : void
Parameters
- $f3 : Base
record_elist()
Generic list function from query.
protected
record_elist(string $query, mixed $cquery[, string $cond = "" ]) : void
This function returns paginated data from a query.
Parameters
- $query : string
- $cquery : mixed
- $cond : string = ""
record_list()
Generic list function from model class.
protected
record_list(string $modelClass) : void
This function returns paginated data of a model class.
Parameters
- $modelClass : string