AdminElements
extends Singleton
in package
Class for Admin Elements
Table of Contents
Properties
- $instance : array<string|int, mixed>|null
Methods
- __wakeup() : mixed
- Alert() : mixed
- Displays an alert
- Buffer() : AdminElements
- Returns the content instead of printing it
- Button() : AdminElements
- Print a button
- Checkbox() : AdminElements
- Print a Checkbox
- ErrorCard() : mixed
- Displays an error card
- Get() : string
- Gets content Buffered
- Header() : mixed
- Prints page header
- Input() : AdminElements
- Print a Input
- Instance() : static|Singleton
- MockClass() : static|Singleton
- Select() : AdminElements
- Print a Select
- SetInstance() : mixed
- Table() : void
- Prints a table
- Textarea() : AdminElements
- Print a Input
- UserCard() : mixed
- __clone() : mixed
- __construct() : mixed
- GetAttributesStr() : string
Properties
$instance
protected
static array<string|int, mixed>|null
$instance
= []
Methods
__wakeup()
public
final __wakeup() : mixed
Alert()
Displays an alert
public
Alert(string $alertMessage[, string $type = "primary" ][, mixed $showClose = true ]) : mixed
Parameters
- $alertMessage : string
-
HTML text
- $type : string = "primary"
-
style - available types: primary, secondary, success, danger, warning, info, light, dark
- $showClose : mixed = true
Buffer()
Returns the content instead of printing it
public
Buffer() : AdminElements
Return values
AdminElements —itself
Button()
Print a button
public
Button(string $name, string $click[, string|array<string|int, mixed> $class = "btn-primary" ][, string|array<string|int, mixed> $outerClass = "" ][, bool $submit = false ][, array<string|int, mixed> $extraArgs = [] ]) : AdminElements
Parameters
- $name : string
-
caption of the button
- $click : string
-
action of the button
- $class : string|array<string|int, mixed> = "btn-primary"
-
class for the button
- $outerClass : string|array<string|int, mixed> = ""
-
class for the button
- $submit : bool = false
-
is it a type=submit button? (default:false)
- $extraArgs : array<string|int, mixed> = []
-
extra data: [ "id", "styles" ]
Return values
AdminElements —itself
Checkbox()
Print a Checkbox
public
Checkbox(string $id[, string $name = "" ][, string $value = true ][, string $checked = false ][, string|array<string|int, mixed> $class = [] ][, string $switch = false ][, array<string|int, mixed> $attributes = [] ][, mixed $outerClass = "" ]) : AdminElements
Parameters
- $id : string
-
id
- $name : string = ""
-
title of the select (default: $id)
- $value : string = true
-
value for input (default: true)
- $checked : string = false
-
should it be checked? (default: false)
- $class : string|array<string|int, mixed> = []
-
class for the select
- $switch : string = false
-
should be a switch? (default: false)
- $attributes : array<string|int, mixed> = []
-
any extra attributes (as ["onchange" => "alert();"])
- $outerClass : mixed = ""
Return values
AdminElements —itself
ErrorCard()
Displays an error card
public
ErrorCard(string $message[, string $title = "Error!" ]) : mixed
Parameters
- $message : string
-
text of the card
- $title : string = "Error!"
-
title of the card
Get()
Gets content Buffered
public
Get() : string
Return values
string —content
Header()
Prints page header
public
Header(string $title[, string $error = null ]) : mixed
Parameters
- $title : string
-
title
- $error : string = null
-
error message (default: null)
Input()
Print a Input
public
Input(string $type, string $id[, string $name = "" ][, string $value = "" ][, string|array<string|int, mixed> $class = "" ][, string|array<string|int, mixed> $outerClass = "" ][, string $placeholder = "" ][, array<string|int, mixed> $attributes = [] ]) : AdminElements
Parameters
- $type : string
-
type (as "text", "disabled", "number", "email", "date")
- $id : string
-
id
- $name : string = ""
-
title of the input (default: $id)
- $value : string = ""
-
value for input (default: "")
- $class : string|array<string|int, mixed> = ""
-
class for the input
- $outerClass : string|array<string|int, mixed> = ""
-
class for the container of input
- $placeholder : string = ""
-
placeholder
- $attributes : array<string|int, mixed> = []
-
any extra attributes (as ["onkeyup" => "alert();"])
Return values
AdminElements —itself
Instance()
public
static Instance() : static|Singleton
Return values
static|SingletonMockClass()
public
static MockClass(mixed $mocker) : static|Singleton
Parameters
- $mocker : mixed
Return values
static|SingletonSelect()
Print a Select
public
Select(string $id[, string $name = "" ][, array<string|int, mixed> $options = null ][, string $value = "" ][, string|array<string|int, mixed> $class = "" ][, string $placeholder = "" ][, array<string|int, mixed> $attributes = [] ]) : AdminElements
Parameters
- $id : string
-
id
- $name : string = ""
-
title of the select
- $options : array<string|int, mixed> = null
-
array with options (as ["value" => "option caption"] or ["id", "name"])
- $value : string = ""
-
selected value
- $class : string|array<string|int, mixed> = ""
-
class for the select
- $placeholder : string = ""
-
placeholder
- $attributes : array<string|int, mixed> = []
-
any extra attributes (as ["onchange" => "alert();"])
Return values
AdminElements —itself
SetInstance()
public
SetInstance(mixed $inst) : mixed
Parameters
- $inst : mixed
Table()
Prints a table
public
Table(array<string|int, mixed> $rows[, array<string|int, mixed> $cols = null ][, mixed $extraClass = "" ]) : void
Parameters
- $rows : array<string|int, mixed>
-
row result
- $cols : array<string|int, mixed> = null
-
cols (can be in [ title, key ] format)
- $extraClass : mixed = ""
Textarea()
Print a Input
public
Textarea(string $id[, string $name = "" ][, string $value = "" ][, string|array<string|int, mixed> $class = "" ][, string|array<string|int, mixed> $outerClass = "" ][, string $placeholder = "" ][, array<string|int, mixed> $attributes = [] ]) : AdminElements
Parameters
- $id : string
-
id
- $name : string = ""
-
title of the input (default: $id)
- $value : string = ""
-
value for input (default: "")
- $class : string|array<string|int, mixed> = ""
-
class for the input
- $outerClass : string|array<string|int, mixed> = ""
-
class for the container of input
- $placeholder : string = ""
-
placeholder
- $attributes : array<string|int, mixed> = []
-
any extra attributes (as ["onkeyup" => "alert();"])
Return values
AdminElements —itself
UserCard()
public
UserCard() : mixed
__clone()
protected
final __clone() : mixed
__construct()
private
final __construct() : mixed
GetAttributesStr()
private
GetAttributesStr(mixed $attr) : string
Parameters
- $attr : mixed