\App\Base\Abstracts\ControllersAdminManageModelsPage

Base for admin page that manages a Model

Summary

Methods
Properties
Constants
__construct()
getForm()
getFormDefinition()
formValidate()
formSubmitted()
getRouteVerbs()
renderPage()
getPageTitle()
getCurrentLocale()
addBackButton()
getRouteGroup()
checkPermission()
addActionLink()
process()
getTemplate()
getInfo()
addFlashMessage()
dropFlashMessages()
getFlashMessages()
calcTokenId()
tokenIsActive()
getCurrentUser()
hasLoggedUser()
isHomePage()
getRequest()
getRouteInfo()
__toString()
getUrl()
getRouteName()
getControllerUrl()
getDestParam()
canBeFPC()
getTranslator()
__call()
getContainer()
getApp()
getLog()
getTemplates()
getDebugbar()
getDb()
getPdo()
getSchema()
getEventManager()
getWebRouter()
getCrudRouter()
getRouters()
getUtils()
getSiteData()
getAssets()
getGuzzle()
getImagine()
getMailer()
getSesMailer()
getSmtpMailer()
getCache()
getHtmlRenderer()
getIcons()
getElasticsearch()
getEnv()
getAppRouteInfo()
getAppWebsite()
requestUrl()
getObject()
getTable()
getPaginator()
addNewButton()
getActionButton()
getDeleteButton()
getEditButton()
getFrontendModelButton()
setAdminActionLogData()
getAdminActionLogData()
getModelTableName()
getObjectClass()
$translators
No constants found
getFormId()
isSubmitted()
addSubmitButton()
fillConfirmationForm()
beforeRender()
prepareTemplate()
getBaseTemplateData()
getTemplateData()
getAccessPermission()
checkCredentials()
renderActionButtons()
addActionButton()
getTemplateName()
getTokenHeader()
getToken()
getTokenValidationData()
getTokenData()
getRouteData()
getResponse()
doRedirect()
getService()
getSearchParameters()
getTableHeader()
getTableElements()
loadObject()
newEmptyObject()
getObjectIdQueryParam()
$template_data
$page_title
$locale
$current_user_model
$action_buttons
$template
$current_user
$route_info
$request
$response
$container
$objectInstance
$admin_action_log_data
N/A
processFormSubmit()
No private properties found
N/A

Properties

$translators

$translators : array

Type

array — translators

$template_data

$template_data : array

Type

array — template data

$page_title

$page_title : string

Type

string — page title

$locale

$locale : string

Type

string — locale

$current_user_model

$current_user_model : \App\Site\Models\User

Type

User — current user model

$action_buttons

$action_buttons : array

Type

array — action_buttons

$template

$template : \League\Plates\Template\Template

Type

\League\Plates\Template\Template — template object

$current_user

$current_user : array

Type

array — current user data

$route_info

$route_info : \App\Site\Routing\RouteInfo

Type

RouteInfo — route info object

$request

$request : \Symfony\Component\HttpFoundation\Request

Type

\Symfony\Component\HttpFoundation\Request — request object

$response

$response : \Symfony\Component\HttpFoundation\Response

Type

\Symfony\Component\HttpFoundation\Response — response object

$container

$container : \Psr\Container\ContainerInterface

Type

\Psr\Container\ContainerInterface — container

$objectInstance

$objectInstance : \App\Base\Abstracts\Models\BaseModel|null

Type

BaseModel|null — object instance

$admin_action_log_data

$admin_action_log_data : array|null

Type

array|null — admin_log data

Methods

__construct()

__construct(\Psr\Container\ContainerInterface  $container, \Symfony\Component\HttpFoundation\Request|null  $request, \App\Site\Routing\RouteInfo  $route_info) : mixed

{@inheriydocs}

Parameters

\Psr\Container\ContainerInterface $container
\Symfony\Component\HttpFoundation\Request|null $request
\App\Site\Routing\RouteInfo $route_info

Throws

\Degami\Basics\Exceptions\BasicException
\Degami\PHPFormsApi\Exceptions\FormException
\App\Base\Exceptions\PermissionDeniedException
\DI\DependencyException
\DI\NotFoundException
\Degami\SqlSchema\Exceptions\OutOfRangeException

Returns

mixed —

getForm()

getForm() : \Degami\PHPFormsApi\Form

get form object

Returns

\Degami\PHPFormsApi\Form —

getFormDefinition()

getFormDefinition(\Degami\PHPFormsApi\Form  $form, array  $form_state) : \Degami\PHPFormsApi\Form

gets form definition object

Parameters

\Degami\PHPFormsApi\Form $form
array $form_state

Returns

\Degami\PHPFormsApi\Form —

formValidate()

formValidate(\Degami\PHPFormsApi\Form  $form, array  $form_state) : bool|string

validates form submission

Parameters

\Degami\PHPFormsApi\Form $form
array $form_state

Returns

bool|string —

formSubmitted()

formSubmitted(\Degami\PHPFormsApi\Form  $form, array  $form_state) : mixed|\Symfony\Component\HttpFoundation\Response

handles form submission

Parameters

\Degami\PHPFormsApi\Form $form
array $form_state

Returns

mixed|\Symfony\Component\HttpFoundation\Response —

getRouteVerbs()

getRouteVerbs() : array

returns valid route HTTP verbs

Returns

array —

renderPage()

renderPage(\App\Site\Routing\RouteInfo|null  $route_info = null, array  $route_data = []) : \Symfony\Component\HttpFoundation\Response|self

controller entrypoint

Parameters

\App\Site\Routing\RouteInfo|null $route_info
array $route_data

Throws

\App\Base\Exceptions\PermissionDeniedException

Returns

\Symfony\Component\HttpFoundation\Response|self —

getPageTitle()

getPageTitle() : string

gets page title

Returns

string —

getCurrentLocale()

getCurrentLocale() : string

{@inheritdocs}

Throws

\Degami\Basics\Exceptions\BasicException
\DI\DependencyException
\DI\NotFoundException

Returns

string —

addBackButton()

addBackButton(array|null  $query_params = null) : mixed

adds a back button to page

Parameters

array|null $query_params

Throws

\Degami\Basics\Exceptions\BasicException
\DI\DependencyException
\DI\NotFoundException

Returns

mixed —

getRouteGroup()

getRouteGroup() : string

gets route group

Returns

string —

checkPermission()

checkPermission(string  $permission_name) : bool

checks if current user has specified permission

Parameters

string $permission_name

Throws

\Degami\Basics\Exceptions\BasicException

Returns

bool —

addActionLink()

addActionLink( $key,  $link_id,  $link_text, string  $link_href = '#', string  $link_class = 'btn btn-sm btn-light', array  $attributes = []) : self

adds an action link

Parameters

$key
$link_id
$link_text
string $link_href
string $link_class
array $attributes

Returns

self —

process()

process(\App\Site\Routing\RouteInfo|null  $route_info = null, array  $route_data = []) : \Symfony\Component\HttpFoundation\Response|self

controller action

Parameters

\App\Site\Routing\RouteInfo|null $route_info
array $route_data

Returns

\Symfony\Component\HttpFoundation\Response|self —

getTemplate()

getTemplate() : \League\Plates\Template\Template

get current template

Returns

\League\Plates\Template\Template —

getInfo()

getInfo() : array

gets info about current page

Returns

array —

addFlashMessage()

addFlashMessage(string  $type, string  $message) : self

adds a flash message for next response

Parameters

string $type
string $message

Throws

\DI\DependencyException
\DI\NotFoundException

Returns

self —

dropFlashMessages()

dropFlashMessages() : self

removes all currently stored flash messages

Returns

self —

getFlashMessages()

getFlashMessages() : array

gets currently stored flash messages

Returns

array —

calcTokenId()

calcTokenId(int  $uid, string  $username) : string

calculates JWT token id

Parameters

int $uid
string $username

Returns

string —

tokenIsActive()

tokenIsActive(\Lcobucci\JWT\Token  $token) : bool

checks if token is still active

Parameters

\Lcobucci\JWT\Token $token

Throws

\DI\DependencyException
\DI\NotFoundException

Returns

bool —

getCurrentUser()

getCurrentUser(bool  $reset = false) : \App\Site\Models\User|\App\Site\Models\GuestUser|null

gets current user

Parameters

bool $reset

Throws

\DI\DependencyException
\DI\NotFoundException

Returns

\App\Site\Models\User|\App\Site\Models\GuestUser|null —

hasLoggedUser()

hasLoggedUser() : bool

checks if user is logged in

Throws

\DI\DependencyException
\DI\NotFoundException

Returns

bool —

isHomePage()

isHomePage() : bool

checks if current is homepage

Throws

\Degami\Basics\Exceptions\BasicException
\DI\DependencyException
\DI\NotFoundException
\Phpfastcache\Exceptions\PhpfastcacheSimpleCacheException

Returns

bool —

getRequest()

getRequest() : \Symfony\Component\HttpFoundation\Request

gets current request object

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\Symfony\Component\HttpFoundation\Request —

getRouteInfo()

getRouteInfo() : \App\Site\Routing\RouteInfo

get route_info array

Returns

\App\Site\Routing\RouteInfo —

__toString()

__toString() : string

toString magic method

Returns

string —

the form html

getUrl()

getUrl(string  $route_name, array  $route_params = []) : string

gets url by route_name and params

Parameters

string $route_name
array $route_params

Throws

\Degami\Basics\Exceptions\BasicException

Returns

string —

getRouteName()

getRouteName() : string

gets current route name

Returns

string —

getControllerUrl()

getControllerUrl() : string

gets current controller url

Throws

\Degami\Basics\Exceptions\BasicException

Returns

string —

getDestParam()

getDestParam(null  $destination_url = null) : string

gets the destination param

Parameters

null $destination_url

Throws

\Degami\Basics\Exceptions\BasicException

Returns

string —

canBeFPC()

canBeFPC() : bool

specifies if this controller is eligible for full page cache

Returns

bool —

getTranslator()

getTranslator(string|null  $locale_code = null) : \Fisharebest\Localization\Translator

gets translator

Parameters

string|null $locale_code

Throws

\DI\DependencyException
\DI\NotFoundException

Returns

\Fisharebest\Localization\Translator —

__call()

__call(string  $name, mixed  $arguments) : mixed

{@inheritdocs}

Parameters

string $name
mixed $arguments

Throws

\App\Base\Exceptions\InvalidValueException

Returns

mixed —

getContainer()

getContainer() : \Psr\Container\ContainerInterface

gets container object

Returns

\Psr\Container\ContainerInterface —

getApp()

getApp() : \App\App

gets app object

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\App\App —

getLog()

getLog() : \Monolog\Logger

gets log object

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\Monolog\Logger —

getTemplates()

getTemplates() : \League\Plates\Engine

gets plates engine object

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\League\Plates\Engine —

getDebugbar()

getDebugbar() : \DebugBar\StandardDebugBar

gets debugbar object

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\DebugBar\StandardDebugBar —

getDb()

getDb() : \LessQL\Database

gets db object

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\LessQL\Database —

getPdo()

getPdo() : \PDO

gets PDO object

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\PDO —

getSchema()

getSchema() : \Degami\SqlSchema\Schema

gets schema object

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\Degami\SqlSchema\Schema —

getEventManager()

getEventManager() : \Gplanchat\EventManager\SharedEventEmitter

gets events manager service

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\Gplanchat\EventManager\SharedEventEmitter —

getWebRouter()

getWebRouter() : \App\Site\Routing\Web

gets routing service

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\App\Site\Routing\Web —

getCrudRouter()

getCrudRouter() : \App\Site\Routing\Crud

gets crud service

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\App\Site\Routing\Crud —

getRouters()

getRouters() : array

gets routers

Throws

\Degami\Basics\Exceptions\BasicException

Returns

array —

getUtils()

getUtils() : \App\Base\Tools\Utils\Globals

gets global utils service

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\App\Base\Tools\Utils\Globals —

getSiteData()

getSiteData() : \App\Base\Tools\Utils\SiteData

gets site data service

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\App\Base\Tools\Utils\SiteData —

getAssets()

getAssets() : \App\Base\Tools\Assets\Manager

gets assets manager

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\App\Base\Tools\Assets\Manager —

getGuzzle()

getGuzzle() : \GuzzleHttp\Client

gets guzzle service

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\GuzzleHttp\Client —

getImagine()

getImagine() : \Imagine\Gd\Imagine

gets imagine service

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\Imagine\Gd\Imagine —

getMailer()

getMailer() : \App\Base\Tools\Utils\Mailer

gets mailer service

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\App\Base\Tools\Utils\Mailer —

getSesMailer()

getSesMailer() : \Aws\Ses\SesClient

gets SES mailer service

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\Aws\Ses\SesClient —

getSmtpMailer()

getSmtpMailer() : \Swift_Mailer

gets SMTP mailer service

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\Swift_Mailer —

getCache()

getCache() : \App\Base\Tools\Cache\Manager

get cache manager

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\App\Base\Tools\Cache\Manager —

getHtmlRenderer()

getHtmlRenderer() : \App\Base\Tools\Utils\HtmlPartsRenderer

gets html renderer service

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\App\Base\Tools\Utils\HtmlPartsRenderer —

getIcons()

getIcons() : \Feather\Icons

gets icons service

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\Feather\Icons —

getElasticsearch()

getElasticsearch() : \ElasticSearch\Client

gets elasticsearch service

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\ElasticSearch\Client —

getEnv()

getEnv(string  $variable, mixed  $default = null) : mixed

gets env variable

Parameters

string $variable
mixed $default

Throws

\Degami\Basics\Exceptions\BasicException

Returns

mixed —

getAppRouteInfo()

getAppRouteInfo() : \App\Site\Routing\RouteInfo|null

gets route info

Returns

\App\Site\Routing\RouteInfo|null —

getAppWebsite()

getAppWebsite() : \App\Site\Models\Website|null

gets current website

Returns

\App\Site\Models\Website|null —

requestUrl()

requestUrl(string  $url, string  $method = 'GET', array  $options = []) : string|bool

executes an http request

Parameters

string $url
string $method
array $options

Throws

\Exception
\GuzzleHttp\Exception\GuzzleException

Returns

string|bool —

getObject()

getObject() : mixed

gets model object (loaded or new)

Throws

\DI\DependencyException
\DI\NotFoundException

Returns

mixed —

getTable()

getTable() : string

gets model table html

Returns

string —

getPaginator()

getPaginator() : string

gets paginator html

Returns

string —

addNewButton()

addNewButton() : mixed

adds a "new" button

Throws

\Degami\Basics\Exceptions\BasicException
\DI\DependencyException
\DI\NotFoundException

Returns

mixed —

getActionButton()

getActionButton(string  $action, int  $object_id, string  $class, string  $icon, string  $title = '') : string

gets action button html

Parameters

string $action
int $object_id
string $class
string $icon
string $title

Throws

\DI\DependencyException
\DI\NotFoundException

Returns

string —

getDeleteButton()

getDeleteButton(int  $object_id) : string

gets delete button html

Parameters

int $object_id

Throws

\DI\DependencyException
\DI\NotFoundException

Returns

string —

getEditButton()

getEditButton(int  $object_id) : string

gets edit button html

Parameters

int $object_id

Throws

\DI\DependencyException
\DI\NotFoundException

Returns

string —

getFrontendModelButton()

getFrontendModelButton(\App\Base\Abstracts\Models\FrontendModel  $object, string  $class = 'light', string  $icon = 'zoom-in') : string

gets "to frontend" button html

Parameters

\App\Base\Abstracts\Models\FrontendModel $object
string $class
string $icon

Throws

\Degami\Basics\Exceptions\BasicException
\Exception

Returns

string —

setAdminActionLogData()

setAdminActionLogData( $admin_action_log_data) : $this

sets admin log data

Parameters

$admin_action_log_data

Returns

$this —

getAdminActionLogData()

getAdminActionLogData() : array|null

gets admin log data

Returns

array|null —

getModelTableName()

getModelTableName() : mixed

gets model class table name

Returns

mixed —

getObjectClass()

getObjectClass() : string

gets object to show class name for loading

Returns

string —

getFormId()

getFormId() : string

gets form id

Returns

string —

isSubmitted()

isSubmitted() : bool

check if form is submitted

Returns

bool —

addSubmitButton()

addSubmitButton(\Degami\PHPFormsApi\Form  $form, bool  $inline_button = false) : \Degami\PHPFormsApi\Form

adds submit button to form

Parameters

\Degami\PHPFormsApi\Form $form
bool $inline_button

Returns

\Degami\PHPFormsApi\Form —

fillConfirmationForm()

fillConfirmationForm(string  $confirm_message, \Degami\PHPFormsApi\Form  $form, string|null  $cancel_url = null) : \Degami\PHPFormsApi\Form

gets a form for confirmation

Parameters

string $confirm_message
\Degami\PHPFormsApi\Form $form
string|null $cancel_url

Throws

\Degami\Basics\Exceptions\BasicException
\DI\DependencyException
\DI\NotFoundException

Returns

\Degami\PHPFormsApi\Form —

beforeRender()

beforeRender() : \Symfony\Component\HttpFoundation\Response|self

before render hook

Throws

\App\Base\Exceptions\PermissionDeniedException

Returns

\Symfony\Component\HttpFoundation\Response|self —

prepareTemplate()

prepareTemplate() : \League\Plates\Template\Template

prepare template object

Throws

\Degami\Basics\Exceptions\BasicException

Returns

\League\Plates\Template\Template —

getBaseTemplateData()

getBaseTemplateData() : array

prepares basic template data

Returns

array —

getTemplateData()

getTemplateData() : array

gets current page template data

Returns

array —

getAccessPermission()

getAccessPermission() : string

gets access permission name

Returns

string —

checkCredentials()

checkCredentials() : bool

checks user credentials

Throws

\Degami\Basics\Exceptions\BasicException

Returns

bool —

renderActionButtons()

renderActionButtons() : string

renders action buttons

Throws

\DI\DependencyException
\DI\NotFoundException

Returns

string —

addActionButton()

addActionButton(string  $key, string  $button_id, string  $button_text, string  $button_class = 'btn btn-sm btn-light') : self

adds an action button

Parameters

string $key
string $button_id
string $button_text
string $button_class

Returns

self —

getTemplateName()

getTemplateName() : string

gets current page template name

Returns

string —

getTokenHeader()

getTokenHeader() : string

gets Authorization token header

Returns

string —

getToken()

getToken() : \Lcobucci\JWT\Token

gets Authorization token Object

Returns

\Lcobucci\JWT\Token —

getTokenValidationData()

getTokenValidationData( $token) : \Lcobucci\JWT\ValidationData

gets token validation data

Parameters

$token

Throws

\DI\DependencyException
\DI\NotFoundException

Returns

\Lcobucci\JWT\ValidationData —

getTokenData()

getTokenData() : array|bool

gets token data

Returns

array|bool —

getRouteData()

getRouteData(null  $var_name = null) : mixed|null

gets route data

Parameters

null $var_name

Returns

mixed|null —

getResponse()

getResponse() : \Symfony\Component\HttpFoundation\Response

get response object

Returns

\Symfony\Component\HttpFoundation\Response —

doRedirect()

doRedirect( $url, array  $additional_headers = []) : \Symfony\Component\HttpFoundation\RedirectResponse

returns a redirect object

Parameters

$url
array $additional_headers

Returns

\Symfony\Component\HttpFoundation\RedirectResponse —

getService()

getService(string  $service_key) : mixed

gets registered service

Parameters

string $service_key

Throws

\Degami\Basics\Exceptions\BasicException

Returns

mixed —

getSearchParameters()

getSearchParameters() : array|null

gets search parameters

Returns

array|null —

getTableHeader()

getTableHeader() : array|null

defines table header

Returns

array|null —

getTableElements()

getTableElements(array  $data) : array

defines table rows

Parameters

array $data

Returns

array —

loadObject()

loadObject(int  $id) : \App\Base\Abstracts\Models\BaseModel

loads object by id

Parameters

int $id

Returns

\App\Base\Abstracts\Models\BaseModel —

newEmptyObject()

newEmptyObject() : \App\Base\Abstracts\Models\BaseModel

gets new empty model

Throws

\DI\DependencyException
\DI\NotFoundException

Returns

\App\Base\Abstracts\Models\BaseModel —

getObjectIdQueryParam()

getObjectIdQueryParam() : string

defines object id query param name

Returns

string —

processFormSubmit()

processFormSubmit() : void

process form submission

Throws

\App\Base\Exceptions\PermissionDeniedException
\Degami\Basics\Exceptions\BasicException