Magrathea PHP 2

Admin
in package
implements iAdmin

Class for managing Magrathea's Admin

Table of Contents

Interfaces

iAdmin

Properties

$adminLogo  : string
$extraMenu  : array<string|int, mixed>
$favicon  : mixed
$primaryColor  : string
$title  : string
$adminFeatures  : array<string|int, mixed>
$crudFeatures  : array<string|int, mixed>

Methods

__construct()  : mixed
Constructor. Adds the base javascript file for the admin panel.
AddFeaturesArray()  : Admin
Inserts an array of features.
AddFeaturesMenu()  : AdminMenu
Adds menu items for all registered CRUD features.
AddJs()  : Admin
Add a JS file to the admin panel.
AddMagratheaMenu()  : AdminMenu
Adds the default Magrathea menu sections to the menu.
AddMenuItem()  : itself
Adds one or more menu items to the extra menu.
AddTests()  : Admin
Adds Magrathea's built-in tests to the test manager.
Auth()  : bool
Checks if a user has authorization to access the admin.
BuildMenu()  : AdminMenu
Builds the admin menu.
GetFeatures()  : array<string|int, mixed>
Gets all registered admin features.
GetMenuItem()  : array<string|int, mixed>
Gets the menu item for a specific feature.
Initialize()  : mixed
Initializes the admin, adding Magrathea tests.
SetAdminLogo()  : Admin
Defines admin logo
SetFeatures()  : mixed
Sets the default features for the admin panel.
SetLogo()  : Admin
Defines admin logo (alias)
SetPrimaryColor()  : Admin
Sets the primary color from a hexadecimal value.
SetPrimaryColorDecimal()  : Admin
Sets the primary color from a decimal RGB string.
SetTitle()  : Admin
Sets title
AddCrudFeature()  : Admin
Adds a CRUD admin feature.
AddFeature()  : Admin
Adds an admin feature.
LoadAppConfig()  : mixed
Loads the AppConfig feature.
LoadCache()  : mixed
Loads the Cache feature.
LoadFileEditor()  : mixed
Loads the File Editor feature.
LoadUser()  : mixed
Loads User and UserLog features.

Properties

public string $adminLogo = __DIR__ . "/views/logo.svg"

Path to the admin logo file.

$extraMenu

public array<string|int, mixed> $extraMenu = []

Extra items to be added to the menu.

$favicon

public mixed $favicon = __DIR__ . "/views/magrathea_logo.svg"

$primaryColor

public string $primaryColor = "203, 128, 8"

Primary color for the admin panel in RGB decimal format.

$title

public string $title = "Magrathea Admin"

Title for the admin panel.

$adminFeatures

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

Holds all registered admin features.

$crudFeatures

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

Holds keys of all registered CRUD features.

Methods

__construct()

Constructor. Adds the base javascript file for the admin panel.

public __construct() : mixed

AddFeaturesArray()

Inserts an array of features.

public AddFeaturesArray(array<string|int, mixed> $arrFeatures) : Admin
Parameters
$arrFeatures : array<string|int, mixed>

array of features

Return values
Admin

itself

AddJs()

Add a JS file to the admin panel.

public AddJs(string $filePath) : Admin
Parameters
$filePath : string

path of js file

Return values
Admin

itself

AddMenuItem()

Adds one or more menu items to the extra menu.

public AddMenuItem(array<string|int, mixed> ...$item) : itself
Parameters
$item : array<string|int, mixed>

menu item ["title", "link"]

Return values
itself

AddTests()

Adds Magrathea's built-in tests to the test manager.

public AddTests() : Admin
Return values
Admin

itself

Auth()

Checks if a user has authorization to access the admin.

public Auth(AdminUser $user) : bool
Parameters
$user : AdminUser
Return values
bool

GetFeatures()

Gets all registered admin features.

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

GetMenuItem()

Gets the menu item for a specific feature.

public GetMenuItem(string $key) : array<string|int, mixed>
Parameters
$key : string

key of the feature

Return values
array<string|int, mixed>

menu item

Initialize()

Initializes the admin, adding Magrathea tests.

public Initialize() : mixed

Defines admin logo

public SetAdminLogo(string $logo) : Admin
Parameters
$logo : string

logo address

Return values
Admin

itself

SetFeatures()

Sets the default features for the admin panel.

public SetFeatures() : mixed

Defines admin logo (alias)

public SetLogo(string $logo) : Admin
Parameters
$logo : string

logo address

Return values
Admin

itself

SetPrimaryColor()

Sets the primary color from a hexadecimal value.

public SetPrimaryColor(string $color) : Admin
Parameters
$color : string

Color as hexaRGB

Return values
Admin

itself

SetPrimaryColorDecimal()

Sets the primary color from a decimal RGB string.

public SetPrimaryColorDecimal(string $color) : Admin
Parameters
$color : string

Color as Decimal RGB

Return values
Admin

itself

SetTitle()

Sets title

public SetTitle(mixed $t) : Admin
Parameters
$t : mixed
Return values
Admin

itself

AddFeature()

Adds an admin feature.

protected AddFeature(AdminFeature $feature[, string|null $key = null ]) : Admin
Parameters
$feature : AdminFeature

feature class to be added

$key : string|null = null

(optional) key for the feature. If not provided, featureId will be used.

Return values
Admin

itself

LoadAppConfig()

Loads the AppConfig feature.

protected LoadAppConfig() : mixed

LoadCache()

Loads the Cache feature.

protected LoadCache() : mixed

LoadFileEditor()

Loads the File Editor feature.

protected LoadFileEditor() : mixed

LoadUser()

Loads User and UserLog features.

protected LoadUser() : mixed

        
On this page

Search results