Documentation

Content extends FFTable
in package
Uses Content, SQL

Backend for Fuwafuwa Table (Alpine JS).

Table of Contents

Constants

ADD  = 'add'
DEL  = 'del'
EDIT  = 'edit'
VIEW  = 'view'

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.
categories()  : mixed
category_edit()  : 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.
image_list()  : void
Retrieves a list of images based on a keyword search.
limitClause()  : string
Sets a limit and offset for database queries based on provided data or default values.
media_edit()  : mixed
media_list()  : mixed
page_edit()  : mixed
page_slug()  : void
Generates a unique slug for a given text input and appends a number if the slug already exists in the database.
pages()  : mixed
post_edit()  : mixed
post_slug()  : void
Generates a unique slug for a given text input and appends a number if the slug already exists in the database.
posts()  : mixed
searchClause()  : array<string|int, mixed>
Generates a SQL WHERE clause based on provided search criteria and filters.
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()  : void
Common file upload processor.
record_elist()  : void
Generic list function from query.
record_list()  : void
Generic list function from model class.

Constants

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.

categories()

public categories(mixed $f3) : mixed
Parameters
$f3 : mixed

category_edit()

public category_edit(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

image_list()

Retrieves a list of images based on a keyword search.

public image_list(Base $f3) : void
Parameters
$f3 : Base

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 ...".

media_edit()

public media_edit(mixed $f3) : mixed
Parameters
$f3 : mixed

media_list()

public media_list(mixed $f3) : mixed
Parameters
$f3 : mixed

page_edit()

public page_edit(mixed $f3) : mixed
Parameters
$f3 : mixed

page_slug()

Generates a unique slug for a given text input and appends a number if the slug already exists in the database.

public page_slug(Base $f3) : void
Parameters
$f3 : Base

pages()

public pages(mixed $f3) : mixed
Parameters
$f3 : mixed

post_edit()

public post_edit(mixed $f3) : mixed
Parameters
$f3 : mixed

post_slug()

Generates a unique slug for a given text input and appends a number if the slug already exists in the database.

public post_slug(Base $f3) : void
Parameters
$f3 : Base

posts()

public posts(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.

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()

Common file upload processor.

public upload(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

        
On this page

Search results