class Page extends BaseComponent implements HtmlPageInterface

Html page

Traits

Component options
Component properties
Get index page
UiLibrary helpers
Include options for view components

Constants

SYSTEM_TEMPLATE_NAME

Control panel template name

PAGE_NOT_FOUND

Error page names

SYSTEM_ERROR_PAGE

APPLICATION_ERROR_PAGE

Properties

protected string $name Component name from BaseComponent
protected string $fullName Component full name from BaseComponent
protected string $templateName Template, extension or components library name from BaseComponent
protected string $templateUrl Template url from BaseComponent
protected string $path Component path from BaseComponent
protected integer $location Component Location from BaseComponent
protected string $fullPath Component full path from BaseComponent
protected string $filePath File path from BaseComponent
protected string $language Language code from BaseComponent
protected string $htmlCode Html code from BaseComponent
protected string|null $error Component error code from BaseComponent
protected string $basePath Base path from BaseComponent
protected array $files Component files from BaseComponent
protected string $viewPath View path from BaseComponent
protected string $extensionsPath Extensions path from BaseComponent
protected string $primaryTemplate Primary template name from BaseComponent
protected string $componentType Component type from BaseComponent
protected array $context Component context used in render from BaseComponent
protected $hasHtmlContent Return true if compoent has html file from BaseComponent
protected string|null $htmlFileName Html file name from BaseComponent
protected string $url Component url from BaseComponent
protected array $includedComponents Included compoents from BaseComponent
protected array $options Options from BaseComponent
protected boolean $removeIncludeOptions Remove include options from Options
protected string $optionsFile Optins file from Options
protected array $properties Properies from Properties
protected PageHead $head Page head properties
protected array $libraryOptions Ui Library options
protected string $currentTenplate Current template name
protected array $componentsFiles Component include files (js)
protected ViewInterface $view View

Methods

__construct(ViewInterface $view, string $defaultLanguage, array $libraryOptions = [])

Constructor

void
init()

Init component

array
getOptions()

Get options

bool
resolve(array $params = [])

Render component data

bool
isValid()

Return true if component is valid

void
addIncludedComponent(string $name, string $type)

Add included component

array
getIncludedComponents()

Get included components

mixed
create(string $name, string $language)

Create component

array
getContext()

Get context

void
setContext(array $context)

Set context

void
mergeContext(array $data)

Merge context

void
mergeRecursiveContext(array $data)

Merge recursive context

string|null
getIncludeFile(string $fileType)

Get include file url

void
setPrimaryTemplate(string $name)

Set primary template name

string
getPrimaryTemplate()

Get primary template

bool
hasParent()

Return true if component has child

string
getBasePath()

Return base path

string
getName()

Get component name

string|null
getFullName()

Get component full name

string|null
getTemplateFile()

Get template file

bool
hasError()

Return true if have error

bool
hasContent()

Return true if component have html content

void
resolveHtmlContent()

Resolev html content

bool
hasFiles(string|null $fileType = null)

Return true if component have files

array
getFiles(string|null $fileType = null)

Return files

string|null
getPath()

Get path

string
getFullPath()

Get full path

string
getComponentType()

Get component type

void
setComponentType(string $type)

Set component type

int
getLocation()

Get location

string|null
getTemplateName()

Get template or extension name

string
getLanguage()

Get language

string|null
getError()

Get error

string
getHtmlCode()

Get html code

void
setHtmlCode(string $code)

Set html code

void
setError(string $code)

Set error

void
clearContent()

Clear content

mixed
addComponentFile(string $fileExt)

Add component file

void
addFile(array $file, string $fileType)

Add file

void
parseName(string $name)

Parse component name

array
toArray()

Convert to array

string
url()

Get url

string
getRootPath(bool $relative = false)

Get root componetn path

string
getTemplatePath(string $template, int $location)

Get template path

string|false
getComponentFile(string $fileExt)

Get component file

string
getFileUrl(string $fileName)

Convert file path to url

string
getComponentFullPath(int $location, string $templateName)

Get component full path

void
resolvePath()

Resolve component path

string
getTemplateUrl()

Get template url

void
componentTypeOption()

Component type option

from Options
void
setOptionFile(string $name)

Set option file name

from Options
mixed
getOption(string $key, mixed $default = null)

Get option

from Options
void
setOption(string $key, mixed $value)

Set option value

from Options
void
loadOptions()

Load options json file

from Options
string|null
getOptionsFileName()

Get options file name

from Options
void
setOptionsFileName(string $fileName)

Set options file name

from Options
void
resolveOptionsFileName(string|null $path = null)

Resolve options file name

from Options
void
loadProperties()

Load properties json file

void
mergeProperties()

Add properties to context array

bool
hasProperties()

Return true if component have properties

array
getProperties()

Get properties

string|null
getPropertiesFileName()

Get properties file name

void
setPropertiesFileName(string $fileName)

Set properties file name

string
getIndexFile(string $currentTemlate)

Get page index file

from IndexPage
Collection
getLibraryProperties(string $name, string|null $version = null)

Return library properties

from UiLibrary
array
parseLibraryName(string $libraryName)

Parse library name (name:version)

from UiLibrary
array
getLibraryDetails(string $libraryName)

Get library details

from UiLibrary
array
getLibraryFiles(string $libraryName, string|null $version, string|null $option = null)

Get library files

from UiLibrary
array
resolveLibraryParams(Collection $properties)

Resolve library params

from UiLibrary
void
processIncludeOption()

Process component include js files option

array|null
resolveIncludeFile(string $includeFile)

Resolve include file

HtmlComponentInterface;
renderHtmlComponent(string $name, array $params = [], string|null $language = null, string|null $type = null)

Render html component

void
setCurrentTemplate(string $name)

Set current template name

PageHead
head()

Get head properties

render(string $name, array $params = [], string|null $language = null)

Render page

array
getPageIncludes(string $name, string $language)

Get page includes

void
resolvePageHead(array $head, string $templateUrl)

Resolve page head

void
setHead(Collection $head)

Set page head properties

array
getComponentsFiles()

Get components include files

string|null
getCurrentTemplate()

Get current template name

static string
getUrl(string|null $path = '', bool $full = false, string|null $language = null)

Return url link with current language code

static string
getFullUrl(string $path, string|null $language = null)

Get full page url

void
setLanguage(string $language)

Set current language

array
getPageIncludeFiles()

Get page include files

array
getTemplateIncludeFiles(string $templateName)

Get template include files

array
resolveIncludeFiles(array $include, string $url)

Resolve include files

array
getLibraryIncludeFiles(array $libraryList, string $templateName)

Get include library files

renderPageNotFound(array $data = [], string|null $language = null, string|null $templateName = null)

Render page not found

renderApplicationError(array $data = [], string|null $language = null, string|null $templateName = null)

Render application error

renderSystemError(array $error = [], string|null $language = null, string|null $templateName = null)

Render system error(s)

Details

at line 103
__construct(ViewInterface $view, string $defaultLanguage, array $libraryOptions = [])

Constructor

Parameters

ViewInterface $view
string $defaultLanguage
array $libraryOptions

at line 143
void init()

Init component

Return Value

void

in BaseComponent at line 237
array getOptions()

Get options

Return Value

array

at line 213
bool resolve(array $params = [])

Render component data

Parameters

array $params

Return Value

bool

at line 133
bool isValid()

Return true if component is valid

Return Value

bool

in BaseComponent at line 270
void addIncludedComponent(string $name, string $type)

Add included component

Parameters

string $name
string $type

Return Value

void

in BaseComponent at line 286
array getIncludedComponents()

Get included components

Return Value

array

in BaseComponent at line 298
mixed create(string $name, string $language)

Create component

Parameters

string $name
string $language

Return Value

mixed

in BaseComponent at line 315
array getContext()

Get context

Return Value

array

in BaseComponent at line 326
void setContext(array $context)

Set context

Parameters

array $context

Return Value

void

in BaseComponent at line 337
void mergeContext(array $data)

Merge context

Parameters

array $data

Return Value

void

in BaseComponent at line 348
void mergeRecursiveContext(array $data)

Merge recursive context

Parameters

array $data

Return Value

void

in BaseComponent at line 359
string|null getIncludeFile(string $fileType)

Get include file url

Parameters

string $fileType

Return Value

string|null

in BaseComponent at line 372
void setPrimaryTemplate(string $name)

Set primary template name

Parameters

string $name

Return Value

void

in BaseComponent at line 382
string getPrimaryTemplate()

Get primary template

Return Value

string

in BaseComponent at line 392
bool hasParent()

Return true if component has child

Return Value

bool

in BaseComponent at line 407
string getBasePath()

Return base path

Return Value

string

in BaseComponent at line 417
string getName()

Get component name

Return Value

string

in BaseComponent at line 427
string|null getFullName()

Get component full name

Return Value

string|null

in BaseComponent at line 438
string|null getTemplateFile()

Get template file

Return Value

string|null

in BaseComponent at line 448
bool hasError()

Return true if have error

Return Value

bool

in BaseComponent at line 458
bool hasContent()

Return true if component have html content

Return Value

bool

in BaseComponent at line 468
protected void resolveHtmlContent()

Resolev html content

Return Value

void

in BaseComponent at line 479
bool hasFiles(string|null $fileType = null)

Return true if component have files

Parameters

string|null $fileType

Return Value

bool

in BaseComponent at line 498
array getFiles(string|null $fileType = null)

Return files

Parameters

string|null $fileType

Return Value

array

in BaseComponent at line 508
string|null getPath()

Get path

Return Value

string|null

in BaseComponent at line 518
string getFullPath()

Get full path

Return Value

string

in BaseComponent at line 528
string getComponentType()

Get component type

Return Value

string

in BaseComponent at line 539
void setComponentType(string $type)

Set component type

Parameters

string $type

Return Value

void

in BaseComponent at line 549
int getLocation()

Get location

Return Value

int

in BaseComponent at line 559
string|null getTemplateName()

Get template or extension name

Return Value

string|null

in BaseComponent at line 569
string getLanguage()

Get language

Return Value

string

in BaseComponent at line 579
string|null getError()

Get error

Return Value

string|null

in BaseComponent at line 589
string getHtmlCode()

Get html code

Return Value

string

in BaseComponent at line 600
void setHtmlCode(string $code)

Set html code

Parameters

string $code

Return Value

void

in BaseComponent at line 611
void setError(string $code)

Set error

Parameters

string $code

Return Value

void

in BaseComponent at line 621
void clearContent()

Clear content

Return Value

void

in BaseComponent at line 636
mixed addComponentFile(string $fileExt)

Add component file

Parameters

string $fileExt

Return Value

mixed

in BaseComponent at line 662
void addFile(array $file, string $fileType)

Add file

Parameters

array $file
string $fileType

Return Value

void

in BaseComponent at line 675
protected void parseName(string $name)

Parse component name

Parameters

string $name

Return Value

void

in BaseComponent at line 733
array toArray()

Convert to array

Return Value

array

in BaseComponent at line 743
string url()

Get url

Return Value

string

in BaseComponent at line 754
string getRootPath(bool $relative = false)

Get root componetn path

Parameters

bool $relative

Return Value

string

in BaseComponent at line 771
string getTemplatePath(string $template, int $location)

Get template path

Parameters

string $template
int $location

Return Value

string

in BaseComponent at line 791
string|false getComponentFile(string $fileExt)

Get component file

Parameters

string $fileExt

Return Value

string|false

in BaseComponent at line 804
string getFileUrl(string $fileName)

Convert file path to url

Parameters

string $fileName

Return Value

string

in BaseComponent at line 815
string getComponentFullPath(int $location, string $templateName)

Get component full path

Parameters

int $location
string $templateName

Return Value

string

in BaseComponent at line 828
protected void resolvePath()

Resolve component path

Return Value

void

in BaseComponent at line 864
string getTemplateUrl()

Get template url

Return Value

string

in Options at line 36
protected void componentTypeOption()

Component type option

Return Value

void

in Options at line 51
void setOptionFile(string $name)

Set option file name

Parameters

string $name

Return Value

void

in Options at line 63
mixed getOption(string $key, mixed $default = null)

Get option

Parameters

string $key
mixed $default

Return Value

mixed

in Options at line 75
void setOption(string $key, mixed $value)

Set option value

Parameters

string $key
mixed $value

Return Value

void

in Options at line 85
void loadOptions()

Load options json file

Return Value

void

in Options at line 109
protected string|null getOptionsFileName()

Get options file name

Return Value

string|null

in Options at line 120
protected void setOptionsFileName(string $fileName)

Set options file name

Parameters

string $fileName

Return Value

void

in Options at line 131
protected void resolveOptionsFileName(string|null $path = null)

Resolve options file name

Parameters

string|null $path

Return Value

void

in Properties at line 50
void loadProperties()

Load properties json file

Return Value

void

in Properties at line 68
void mergeProperties()

Add properties to context array

Return Value

void

in Properties at line 78
bool hasProperties()

Return true if component have properties

Return Value

bool

in Properties at line 92
array getProperties()

Get properties

Return Value

array

in Properties at line 102
string|null getPropertiesFileName()

Get properties file name

Return Value

string|null

in Properties at line 113
void setPropertiesFileName(string $fileName)

Set properties file name

Parameters

string $fileName

Return Value

void

in IndexPage at line 24
string getIndexFile(string $currentTemlate)

Get page index file

Parameters

string $currentTemlate

Return Value

string

in UiLibrary at line 30
Collection getLibraryProperties(string $name, string|null $version = null)

Return library properties

Parameters

string $name
string|null $version

Return Value

Collection

in UiLibrary at line 54
array parseLibraryName(string $libraryName)

Parse library name (name:version)

Parameters

string $libraryName

Return Value

array

in UiLibrary at line 71
array getLibraryDetails(string $libraryName)

Get library details

Parameters

string $libraryName

Return Value

array

in UiLibrary at line 104
array getLibraryFiles(string $libraryName, string|null $version, string|null $option = null)

Get library files

Parameters

string $libraryName
string|null $version
string|null $option

Return Value

array

in UiLibrary at line 145
array resolveLibraryParams(Collection $properties)

Resolve library params

Parameters

Collection $properties

Return Value

array

in IncludeOption at line 24
protected void processIncludeOption()

Process component include js files option

Return Value

void

in IncludeOption at line 48
protected array|null resolveIncludeFile(string $includeFile)

Resolve include file

Parameters

string $includeFile Component or Url

Return Value

array|null

at line 165
HtmlComponentInterface; renderHtmlComponent(string $name, array $params = [], string|null $language = null, string|null $type = null)

Render html component

Parameters

string $name
array $params
string|null $language
string|null $type

Return Value

HtmlComponentInterface;

at line 192
void setCurrentTemplate(string $name)

Set current template name

Parameters

string $name

Return Value

void

at line 202
PageHead head()

Get head properties

Return Value

PageHead

at line 233
ComponentInterface render(string $name, array $params = [], string|null $language = null)

Render page

Parameters

string $name
array $params
string|null $language

Return Value

ComponentInterface

at line 285
protected array getPageIncludes(string $name, string $language)

Get page includes

Parameters

string $name
string $language

Return Value

array

at line 323
protected void resolvePageHead(array $head, string $templateUrl)

Resolve page head

Parameters

array $head
string $templateUrl

Return Value

void

at line 351
void setHead(Collection $head)

Set page head properties

Parameters

Collection $head

Return Value

void

at line 361
array getComponentsFiles()

Get components include files

Return Value

array

at line 371
string|null getCurrentTemplate()

Get current template name

Return Value

string|null

at line 384
static string getUrl(string|null $path = '', bool $full = false, string|null $language = null)

Return url link with current language code

Parameters

string|null $path
bool $full
string|null $language

Return Value

string

at line 398
static string getFullUrl(string $path, string|null $language = null)

Get full page url

Parameters

string $path
string|null $language

Return Value

string

at line 409
void setLanguage(string $language)

Set current language

Parameters

string $language Language code

Return Value

void

at line 419
array getPageIncludeFiles()

Get page include files

Return Value

array

at line 457
array getTemplateIncludeFiles(string $templateName)

Get template include files

Parameters

string $templateName

Return Value

array

at line 485
protected array resolveIncludeFiles(array $include, string $url)

Resolve include files

Parameters

array $include
string $url

Return Value

array

at line 535
array getLibraryIncludeFiles(array $libraryList, string $templateName)

Get include library files

Parameters

array $libraryList
string $templateName

Return Value

array

at line 573
ComponentInterface renderPageNotFound(array $data = [], string|null $language = null, string|null $templateName = null)

Render page not found

Parameters

array $data
string|null $language
string|null $templateName

Return Value

ComponentInterface

at line 590
ComponentInterface renderApplicationError(array $data = [], string|null $language = null, string|null $templateName = null)

Render application error

Parameters

array $data
string|null $language
string|null $templateName

Return Value

ComponentInterface

at line 607
ComponentInterface renderSystemError(array $error = [], string|null $language = null, string|null $templateName = null)

Render system error(s)

Parameters

array $error
string|null $language
string|null $templateName

Return Value

ComponentInterface