Message class

access public
package kocuj_internal_lib
inherited_from \KocujIL\V12a\Classes\ComponentObject

 Methods

Constructor

__construct(object $projectObj) : void
Inherited
access public

Parameters

$projectObj

object

\KocujIL\V12a\Classes\Project object for current project

Action for admin header

actionAdminHead() : void
access public

Action for admin notices

actionAdminNotices() : void
access public

Action for admin footer scripts

actionPrintFooterScripts() : void
access public

Add message

addMessage(string $id, string $content, integer $type = \KocujIL\V12a\Enums\Project\Components\Backend\Message\Type::INFORMATION, integer $closable = \KocujIL\V12a\Enums\Project\Components\Backend\Message\Closable::NOT_CLOSABLE, array $pages = array(), array $attr = array()) : void
access public

Parameters

$id

string

Message identifier; must be unique

$content

string

Message content

$type

integer

Message type; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\Backend\Message\Type: INFORMATION (for information message), WARNING (for warning message), ERROR (for error message) or SUCCESS (for success message) - default: \KocujIL\V12a\Enums\Project\Components\Backend\Message\Type::INFORMATION

$closable

integer

Message closable status; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\Backend\Message\Closable: NOT_CLOSABLE (for message without closing button) or CLOSABLE (for message with closing button) - default: \KocujIL\V12a\Enums\Project\Components\Backend\Message\Closable::NOT_CLOSABLE

$pages

array

Settings pages list for current project where this message should be displayed; it should be identifiers from settings page for current project only; if it is empty, this message will be displayed on all settings pages for current project - default: empty

$attr

array

Additional attributes; there are available the following attributes: "class" (string type; CSS class for message div), "closecallback" (array or string type; if message is closable, it is callback executed during closing the message), "permissions" (array type; permissions for message to display; if empty, no permissions are required to display this message), "style" (string type; CSS style for message div) - default: empty

Add message for all pages in administration panel

addMessageForAllPages(string $id, string $content, integer $type = \KocujIL\V12a\Enums\Project\Components\Backend\Message\Type::INFORMATION, integer $closable = \KocujIL\V12a\Enums\Project\Components\Backend\Message\Closable::NOT_CLOSABLE, array $attr = array()) : void
access public

Parameters

$id

string

Message identifier; must be unique

$content

string

Message content

$type

integer

Message type; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\Backend\Message\Type: INFORMATION (for information message), WARNING (for warning message), ERROR (for error message) or SUCCESS (for success message) - default: \KocujIL\V12a\Enums\Project\Components\Backend\Message\Type::INFORMATION

$closable

integer

Message closable status; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\Backend\Message\Closable: NOT_CLOSABLE (for message without closing button) or CLOSABLE (for message with closing button) - default: \KocujIL\V12a\Enums\Project\Components\Backend\Message\Closable::NOT_CLOSABLE

$attr

array

Additional attributes; there are available the following attributes: "class" (string type; CSS class for message div), "closecallback" (array or string type; if message is closable, it is callback executed during closing the message), "permissions" (array type; permissions for message to display; if empty, no permissions are required to display this message), "style" (string type; CSS style for message div) - default: empty

Check if message exists

checkMessage(string $id) : boolean
access public

Parameters

$id

string

Message identifier

Returns

booleanMessage exists (true) or not (false)

Check if message is closed

checkMessageClosed(string $id) : boolean
access public

Parameters

$id

string

Message identifier

Returns

booleanMessage is closed (true) or not (false)

Check permissions to display message

checkMessagePermissions(string $id) : boolean
access public

Parameters

$id

string

Message identifier

Returns

booleanPermission to display this message are correct (true) or not (false)

Check if message will be displayed

checkMessageToDisplay(string $id) : boolean
access public

Parameters

$id

string

Message identifier

Returns

booleanMessage will be displayed (true) or not (false)

Close message

closeMessage(string $id) : void
access public

Parameters

$id

string

Message identifier

Get object of class type from component

getComponent(string $type, integer $projectCategory = \KocujIL\V12a\Enums\ProjectCategory::CORE, string $fragment = '') : object
Inherited
access public

Parameters

$type

string

Component type

$projectCategory

integer

Component category; must be one of the following constants from \KocujIL\V12a\Enums\ProjectCategory: CORE (for "core" category), ALL (for "all" category), FRONTEND (for "frontend" category) or BACKEND (for "backend" category) - default: \KocujIL\V12a\Enums\ProjectCategory::CORE

$fragment

string

Component fragment - default: empty

Returns

objectObject of class type from component

Get message data by id

getMessage(string $id) : array | boolean
access public

Parameters

$id

string

Message identifier

Returns

arraybooleanMessage data or false if not exists; message data have the following fields: "allpages" (if it is set to true, message will be displayed in all pages in administration panel), "closecallback" (array or string type; if message is closable, it is callback executed during closing the message), "class" (string type; CSS class for message div), "content" (content of message), "pages" (settings pages list for current project on which message is displayed or empty if it is displayed on all settings pages for current project), "permissions" (array type; permissions for message to display; if empty, no permissions are required to display this message), "style" (string type; CSS style for message div), "type" (type of message)

Get messages data

getMessages() : array
access public

Returns

arrayMessages data; each message data has the following fields: "allpages" (if it is set to true, message will be displayed in all pages in administration panel), "closecallback" (array or string type; if message is closable, it is callback executed during closing the message), "class" (string type; CSS class for message div), "content" (content of message), "pages" (settings pages list for current project on which message is displayed or empty if it is displayed on all settings pages for current project), "permissions" (array type; permissions for message to display; if empty, no permissions are required to display this message), "style" (string type; CSS style for message div), "type" (type of message)

Get option name for closed message

getOptionNameMessageClosed() : string
Static
access public

Returns

stringOption name for closed message

Get object of type \KocujIL\V12a\Classes\Project

getProjectObj() : object
Inherited
access public

Returns

objectObject of type \KocujIL\V12a\Classes\Project

Get object of class type for strings from component

getStrings(string $type, integer $projectCategory = \KocujIL\V12a\Enums\ProjectCategory::CORE) : object
Inherited
access public

Parameters

$type

string

Component type

$projectCategory

integer

Component category; must be one of the following constants from \KocujIL\V12a\Enums\ProjectCategory: CORE (for "core" category), ALL (for "all" category), FRONTEND (for "frontend" category) or BACKEND (for "backend" category) - default: \KocujIL\V12a\Enums\ProjectCategory::CORE

Returns

objectObject of class type for strings from component

Remove message

removeMessage(string $id) : void
access public

Parameters

$id

string

Message identifier

Restore closed message

restoreClosedMessage(string $id) : void
access public

Parameters

$id

string

Message identifier

Add message

addMessageForProjectOrAllPages(string $id, string $content, integer $type, integer $closable, boolean $allPages, array $pages, array $attr) : void
access private

Parameters

$id

string

Message identifier; must be unique

$content

string

Message content

$type

integer

Message type; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\Backend\Message\Type: INFORMATION (for information message), WARNING (for warning message), ERROR (for error message) or SUCCESS (for success message)

$closable

integer

Message closable status; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\Backend\Message\Closable: NOT_CLOSABLE (for message without closing button), CLOSABLE (for message with closing button and with saving information about closed message) or CLOSABLE_TEMPORARY (for message with closing button, but without saving information about closed message)

$allPages

boolean

Message will be displayed on all pages in administration panel (true) or not (false)

$pages

array

Settings pages list for current project where this message should be displayed; it should be identifiers from settings page for current project only; if it is empty, this message will be displayed on all settings pages for current project

$attr

array

Additional attributes; there are available the following attributes: "class" (string type; CSS class for message div), "closecallback" (array or string type; if message is closable, it is callback executed during closing the message), "permissions" (array type; permissions for message to display; if empty, no permissions are required to display this message), "style" (string type; CSS style for message div)

 Properties

 

Messages

$messages : array

Default

array()
access private
 

\KocujIL\V12a\Classes\Project object for current project

$projectObj : object

Default

NULL
access private