Documentation

Context extends Context
in package

A wrapper for the real Context class that allows people to extend its functionality in ways that are apporpriate for their particular website.

Table of Contents

$contexts  : array<string|int, OODBBean>
$getters  : array<string|int, Base>
$instance  : object
The only instance of using class
$luser  : OODBBean|null
$ons  : array<string|int, array<string|int, string>>
$reqaction  : string
$reqrest  : array<string|int, string>
$roles  : array<string|int, OODBBean>
$tokenAuth  : bool
action()  : string
Return the main action part of the URL as set by .htaccess
divert()  : void
Generate a Location header for within this site
formData()  : object
Return a Formdata object
getinstance()  : object
Checks, instantiates and returns the only instance of the using class.
getOns()  : string
Get the JS for onloading the ons
hasAdmin()  : bool
Do we have a logged in admin user?
hasDeveloper()  : bool
Do we have a logged in developer user?
hasToken()  : bool
Find out if this was validated using a token, if so, it is coming from a device not a browser
hasUser()  : bool
Do we have a logged in user?
load()  : OODBBean
Load a bean
local()  : Local
Return the local object
rest()  : array<string|int, string>
Return the part of the URL after the main action as set by .htaccess
roleContext()  : OODBBean
Find a rolecontext bean
roleName()  : OODBBean
Find a rolename bean
sameUser()  : bool
Return TRUE if the user in the parameter is the same as the current user
saveOn()  : void
Save values into the on cache
setpages()  : void
Set up pagination data
setup()  : ContextBase
Initialise the context and return self
user()  : OODBBean|null
Return the current logged in user if any
utcdate()  : string
Return an iso formatted time in UTC
utcnow()  : string
Return an iso formatted time for NOW in UTC
web()  : Web
Return the Web object

Properties

$contexts

protected array<string|int, OODBBean> $contexts = []

$instance

The only instance of using class

protected static object $instance = NULL

$ons

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

$reqrest

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

$roles

protected array<string|int, OODBBean> $roles = []

Methods

action()

Return the main action part of the URL as set by .htaccess

public action() : string
Return values
string

divert()

Generate a Location header for within this site

public divert(string $where[, bool $temporary = TRUE ][, string $msg = '' ][, bool $nochange = FALSE ][, bool $use303 = FALSE ]) : void
Parameters
$where : string

The page to divert to

$temporary : bool = TRUE

TRUE if this is a temporary redirect

$msg : string = ''

A message to send

$nochange : bool = FALSE

If TRUE then reply status codes 307 and 308 will be used rather than 301 and 302

$use303 : bool = FALSE

If TRUE then 303 will be used instead of 307

Tags
psalm-return

never-return

Return values
void

formData()

Return a Formdata object

public formData([string|null $which = NULL ]) : object
Parameters
$which : string|null = NULL
Tags
psalm-suppress

LessSpecificReturnStatement

psalm-suppress

MoreSpecificReturnType

Return values
object

getinstance()

Checks, instantiates and returns the only instance of the using class.

public static getinstance() : object
Tags
template

object

psalm-return

object

psalm-suppress

MismatchingDocblockReturnType

psalm-suppress

ReservedWord

Return values
object

getOns()

Get the JS for onloading the ons

public getOns() : string
Tags
psalm-suppress

PossiblyUnusedMethod

phpcsSuppress

PhpCs.StringNotation.SingleQuoteFixer

Return values
string

hasAdmin()

Do we have a logged in admin user?

public hasAdmin() : bool
Return values
bool

hasDeveloper()

Do we have a logged in developer user?

public hasDeveloper() : bool
Return values
bool

hasToken()

Find out if this was validated using a token, if so, it is coming from a device not a browser

public hasToken() : bool
Return values
bool

hasUser()

Do we have a logged in user?

public hasUser() : bool
Return values
bool

load()

Load a bean

public load(string $bean, int $id[, bool $forupdate = FALSE ]) : OODBBean
Parameters
$bean : string

A bean type name

$id : int

A bean id

$forupdate : bool = FALSE

If TRUE then use loadforupdate

R::load returns a new bean with id 0 if the given id does not exist.

Tags
throws
MissingBean
throws
InvalidArgumentException
  • this would be an internal error
Return values
OODBBean

local()

Return the local object

public local() : Local
Tags
psalm-suppress

MoreSpecificReturnType

psalm-suppress

LessSpecificReturnStatement

psalm-suppress

MoreSpecificReturnType

Return values
Local

rest()

Return the part of the URL after the main action as set by .htaccess

public rest() : array<string|int, string>

See setup() below for how the URL is processed to create the result array.

Note that if there is nothing after the action in the URL this function returns an array with a single element containing an empty string.

Return values
array<string|int, string>

roleContext()

Find a rolecontext bean

public roleContext(string $name) : OODBBean
Parameters
$name : string

A Role Context

Tags
throws
InternalError
psalm-suppress

PossiblyUnusedMethod

Return values
OODBBean

roleName()

Find a rolename bean

public roleName(string $name) : OODBBean
Parameters
$name : string

A Role name

Tags
throws
InternalError
psalm-suppress

PossiblyUnusedMethod

Return values
OODBBean

sameUser()

Return TRUE if the user in the parameter is the same as the current user

public sameUser(OODBBean|null $user) : bool
Parameters
$user : OODBBean|null
Tags
psalm-suppress

PossiblyUnusedMethod

Return values
bool

saveOn()

Save values into the on cache

public saveOn(string $id, string $on, string $fn) : void
Parameters
$id : string
$on : string
$fn : string
Tags
psalm-suppress

PossiblyUnusedMethod

Return values
void

setpages()

Set up pagination data

public setpages([int|null $count = NULL ]) : void
Parameters
$count : int|null = NULL

If not NULL then set pages based on this

Return values
void

user()

Return the current logged in user if any

public user() : OODBBean|null
Return values
OODBBean|null

utcdate()

Return an iso formatted time in UTC

public utcdate(string $datetime) : string
Parameters
$datetime : string
Return values
string

utcnow()

Return an iso formatted time for NOW in UTC

public utcnow() : string
Return values
string

web()

Return the Web object

public web() : Web
Tags
psalm-suppress

LessSpecificReturnStatement

psalm-suppress

MoreSpecificReturnType

Return values
Web

Search results