Documentation

CRequest
in package

It handles all input requests and provides facilities for their use.

Tags

Table of Contents

$attributes  : array<int, string>
$charset  : string
$filters  : array<string|int, array<string|int, mixed>>
$format  : string
$htmlframe  : string
$http_authorization  : string
$items_per_page  : int
$method  : string
$module_name  : string
$order_by  : array<string|int, mixed>
$origin_request  : string
$page  : int
$params  : array<string|int, mixed>
$request  : string
$route  : CRoute
$sets  : string
$with_related_elements  : bool
$with_relations  : bool
__construct()  : mixed
__construct
getAttributes()  : array<string|int, mixed>
Get the attributes
getCharset()  : string
Get the Charset
getCurrentPage()  : int
Get the current page requested
getFilter()  : array<string|int, string>|null
Get a single filter
getFilters()  : array<string|int, array<string|int, mixed>>
Get the filters
getFormat()  : string
Get the format
getHtmlFrame()  : string
Get the HTML Frame required (only for HTML response)
getHttpAuthorization()  : string
Get the token
getItemsPerPage()  : int
Get the maximum of elements per page
getMethod()  : string
Get the method (POST, GET, PATCH, DELETE, ...)
getModuleName()  : string
Get the module name
getOrderBy()  : array<string|int, mixed>
Get the order of output data
getOriginRequest()  : string
Get the type of original request
getParameter()  : string|null
Get a single parameter
getParameters()  : array<string|int, mixed>
Get the parameters
getRequest()  : string
Get the type of final Request
getSets()  : string
Get the string of the original parameters
getWithRelatedElements()  : bool
Returns whether the result should contain elements from other related tables
getWithRelations()  : bool
Get if the output must be with relations
goRedirect()  : void
If there has been a redirect request via next_url it executes it when called
inputFile()  : string
Import one or more files to upload
removeUploadedFile()  : void
Remove newly uploaded files in case of any other errors
setHtmlFrame()  : void
Set the HTML Frame required (only for HTML response) The central HTML frame can be changed here
setFilters()  : void
Determine which filters were requested
setFormat()  : void
Set format type of output
setHttpAuthorization()  : void
Look for the token sent in the request or from the session if one exists
setMethod()  : void
Determine which method was requested
setParameters()  : void
Determine which parameters were requested

Properties

$attributes

protected array<int, string> $attributes = []

other input parameters that are not filters

Tags

$charset

protected static string $charset = DEFAULT_CHARSET
Tags

$filters

protected array<string|int, array<string|int, mixed>> $filters = []

filters as: id, name, etc. i.e $filters['id']['=',12]

Tags

$format

protected static string $format = DEFAULT_FORMAT_OUTPUT
Tags

$http_authorization

protected string $http_authorization = ''
Tags

$items_per_page

protected int $items_per_page = DEFAULT_ITEMS_PER_REQUEST
Tags

$order_by

protected array<string|int, mixed> $order_by = []
Tags
protected bool $with_related_elements
Tags

Methods

__construct()

__construct

public __construct() : mixed
Tags
Return values
mixed

getAttributes()

Get the attributes

public getAttributes() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

the list of the attributes (all requests excluding filters)

getCharset()

Get the Charset

public static getCharset() : string
Tags
Return values
string

the current charset

getCurrentPage()

Get the current page requested

public getCurrentPage() : int
Tags
Return values
int

the number of the current page

getFilter()

Get a single filter

public getFilter(string $name) : array<string|int, string>|null
Parameters
$name : string

the name of the filter

Tags
Return values
array<string|int, string>|null

the filter

getFilters()

Get the filters

public getFilters() : array<string|int, array<string|int, mixed>>
Tags
Return values
array<string|int, array<string|int, mixed>>

the list of all filters

getFormat()

Get the format

public static getFormat() : string
Tags
Return values
string

the current format

getHtmlFrame()

Get the HTML Frame required (only for HTML response)

public static getHtmlFrame() : string
Tags
Return values
string

the current html frame name (insertForm, modifyForm,...)

getHttpAuthorization()

Get the token

public getHttpAuthorization() : string
Tags
Return values
string

the token

getItemsPerPage()

Get the maximum of elements per page

public getItemsPerPage() : int
Tags
Return values
int

The maximum of elements per page

getMethod()

Get the method (POST, GET, PATCH, DELETE, ...)

public static getMethod() : string
Tags
Return values
string

the current method request

getModuleName()

Get the module name

public static getModuleName() : string
Tags
Return values
string

the cuirrent module name

getOrderBy()

Get the order of output data

public getOrderBy() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

the list of the columns order

getOriginRequest()

Get the type of original request

public getOriginRequest() : string
Tags
Return values
string

the original request

getParameter()

Get a single parameter

public getParameter(string $name) : string|null
Parameters
$name : string

the parameter name

Tags
Return values
string|null

the parameter value

getParameters()

Get the parameters

public getParameters() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

the list of the parameters

getRequest()

Get the type of final Request

public getRequest() : string
Tags
Return values
string

the routed request

getSets()

Get the string of the original parameters

public getSets() : string
Tags
Return values
string

the string of the input parameters

getWithRelatedElements()

Returns whether the result should contain elements from other related tables

public getWithRelatedElements() : bool
Tags
Return values
bool

true if the result must contain elements from other related tables

getWithRelations()

Get if the output must be with relations

public getWithRelations() : bool
Tags
Return values
bool

true if the data must be with relations

goRedirect()

If there has been a redirect request via next_url it executes it when called

public static goRedirect() : void
Tags
Return values
void

inputFile()

Import one or more files to upload

public inputFile() : string
Tags
throws
Exception

in case of a bad request

Return values
string

list of all uploaded files separated by semicolons

removeUploadedFile()

Remove newly uploaded files in case of any other errors

public removeUploadedFile() : void
Tags
Return values
void

setHtmlFrame()

Set the HTML Frame required (only for HTML response) The central HTML frame can be changed here

public static setHtmlFrame(string $htmlframe) : void
Parameters
$htmlframe : string

the current html frame name (insertForm, modifyForm,...)

Tags
Return values
void

setFilters()

Determine which filters were requested

protected setFilters() : void
Tags
throws
Exception

if is not a valid page request

Return values
void

setFormat()

Set format type of output

protected setFormat([string|null $format = null ]) : void
Parameters
$format : string|null = null

the format type name (json, xml, html OR text) default is declared in config.php as DEFAULT_FORMAT_OUTPUT NOTE: If it is null it gets the value from HTTP_ACCEPT if it is valid otherwise it is the default value

Tags
Return values
void

setHttpAuthorization()

Look for the token sent in the request or from the session if one exists

protected setHttpAuthorization() : void
Tags
Return values
void

setMethod()

Determine which method was requested

protected setMethod() : void
Tags
Return values
void

setParameters()

Determine which parameters were requested

protected setParameters() : void
Tags
Return values
void

        

Search results