Settings form class

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

 Methods

Constructor

__construct(object $projectObj) : void
access public
inherited_from \KocujIL\V12a\Classes\ComponentObject::__construct()

Parameters

$projectObj

object

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

Constructor

__construct(object $projectObj) : void
Inherited
access public

Parameters

$projectObj

object

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

Action for adding fields

actionAddFields() : void
access public

Action for controllers

actionController() : void
todo change adding settings options when it is data set, because when there is an error, main identifier for database table is increasing at any time when this controller is checking for errors; probably controllers should be divided into two types - first which only checks data and second which is saving data
access public

Action for form header

actionFormHeader() : void
todo add possibility to enable/disable selected columns of elements list
access public

Action for tabs script

actionPrintFooterScripts() : void
access public

Add controller

addController(string $id, array|string $callbackController) : integer
access public

Parameters

$id

string

Controller identifier

$callbackController

arraystring

Callback function or method name for controller; can be global function or method from any class

Returns

integerPosition in controllers list

Add data set list controller

addDataSetController(string $id, string $title, array|string $callbackController = NULL, integer $nonceRequired = \KocujIL\V12a\Enums\Project\Components\Backend\SettingsForm\NonceRequired::NO, integer $redirectAfter = \KocujIL\V12a\Enums\Project\Components\Backend\SettingsForm\RedirectAfter::NO, integer $bulkAvailable = \KocujIL\V12a\Enums\Project\Components\Backend\SettingsForm\BulkAvailable::NO) : void
todo disallow $id = "add-new"
access public

Parameters

$id

string

Controller identifier

$title

string

Link title

$callbackController

arraystring

Callback function or method name for controller; can be global function or method from any class; can be set to NULL to make an edit controller - default: NULL

$nonceRequired

integer

Nonce is required or not; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\Backend\SettingsForm\NonceRequired: NO (when nonce are not required) or YES (when nonce are required) - default: \KocujIL\V12a\Enums\Project\Components\Backend\SettingsForm\NonceRequired::NO

$redirectAfter

integer

Redirection after action is available or not; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\Backend\SettingsForm\RedirectAfter: NO (when redirection after action is not available) or YES (when redirection after action is available) - default: \KocujIL\V12a\Enums\Project\Components\Backend\SettingsForm\BulkAvailable::NO

$bulkAvailable

integer

Bulk action is available or not; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\Backend\SettingsForm\BulkAvailable: NO (when bulk action is not available) or YES (when bulk action is available) - default: \KocujIL\V12a\Enums\Project\Components\Backend\SettingsForm\BulkAvailable::NO

Add field to form tab

addFieldToTab(string $formId, string $tabId, string $fieldType, string $fieldId, string $fieldValue, string $tipText = '', array $events = array(), array $additional = array()) : integer
access public

Parameters

$formId

string

Form identifier

$tabId

string

Form tab identifier

$fieldType

string

Field type

$fieldId

string

Field identifier

$fieldValue

string

Field value

$tipText

string

Tooltip text - default: empty

$events

array

HTML events - default: empty

$additional

array

Additional settings; each field type can use different additional settings; there are the following additional settings which can be always used: "global_addinfo" (string type; text to add below field), "global_addlabel" (string type; text to add to label), "global_hidelabel" (bool type; if true, label will be hidden), "global_widgetobj" (object type; it must be set to widget object, when it is widget) - default: empty

Returns

integerIdentifier

Add form

addForm(string $id, string $optionsContainerId, array $settingsMenusIds = array(), array $defaultButtons = array(), array $buttons = array(), array $additional = array()) : void
access public

Parameters

$id

string

Form identifier

$optionsContainerId

string

Options container identifier for form

$settingsMenusIds

array

List of settings menus identifiers for which this form will be allowed to display - default: empty

$defaultButtons

array

Definition of default buttons to add below form; there are available the following attributes: "isrestore" (bool type; if true, restore button will be displayed), "issubmit" (bool type; if true, submit button will be displayed), "restorelabel" (string type; restore button label), "restoretooltip" (string type; restore button tooltip), "submitlabel" (string type; submit button label), "submittooltip" (string type; submit button tooltip) - default: empty

$buttons

array

Definition of additional buttons to add below form; each button data identifier will be used as button identifier; each button data has the following fields: "events" (array type; HTML events), "isprimary" (bool type; if true, button is primary), "label" (string type; button label), "tooltip" (string type; button tooltip) - default: empty

$additional

array

Additional settings for form; there are the following additional settings which can be used: "global_datasetcontrollers" (array type; if it is a data set, it is list of data set controllers), "global_isdatasetadd" (bool type; if it is data set and it is set to true, there will be possibility to add new element to data set)

Add HTML code to form tab

addHtmlToTab(string $formId, string $tabId, string $html, string $htmlLeft = '') : integer
access public

Parameters

$formId

string

Form identifier

$tabId

string

Form tab identifier

$html

string

HTML code to add in field area

$htmlLeft

string

HTML code to add in label area - default: empty

Returns

integerIdentifier

Add option field to form tab

addOptionFieldToTab(string $formId, string $tabId, string $fieldType, string $fieldId, string $tipText = '', array $events = array(), array $additional = array()) : integer
access public

Parameters

$formId

string

Form identifier

$tabId

string

Form tab identifier

$fieldType

string

Field type

$fieldId

string

Field identifier

$tipText

string

Tooltip text - default: empty

$events

array

HTML events - default: empty

$additional

array

Additional settings; each field type can use different additional settings; there are the following additional settings which can be always used: "global_addinfo" (string type; text to add below field), "global_addlabel" (string type; text to add to label), "global_displayonlist" (bool type; if true, field information will be displayed on list if this container is for data set), "global_displayonlistcallback" (array or string type; callback method or function for displaying on list if this container is for data set), "global_hidelabel" (bool type; if true, label will be hidden), "global_widgetobj" (object type; it must be set to widget object, when it is widget) - default: empty

Returns

integerIdentifier

Add tab to form

addTab(string $formId, string $tabId, string $title = '') : void
access public

Parameters

$formId

string

Form identifier

$tabId

string

Tab identifier; must be unique in this project

$title

string

Tab title; if empty, default title will be used - default: empty

Check if controller exists

checkController(string $id) : boolean
access public

Parameters

$id

string

Controller identifier

Returns

booleanController exists (true) or not (false)

Check if data set controller exists

checkDataSetController(string $id) : boolean
access public

Parameters

$id

string

Controller identifier

Returns

booleanController exists (true) or not (false)

Check if form exists

checkForm(string $id) : boolean
access public

Parameters

$id

string

Form identifier

Returns

booleanForm exists (true) or not (false)

Check if tab exists

checkTab(string $formId, string $tabId) : boolean
access public

Parameters

$formId

string

Form identifier

$tabId

string

Tab identifier

Returns

booleanTab exists (true) or not (false)

Filter for setting screen option when list of elements is displayed

filterSetScreenOption(string $status, string $option, float|integer|string $value) : float | integer | string
access public

Parameters

$status

string

Status

$option

string

Option

$value

floatintegerstring

Value

Returns

floatintegerstringOutput value

Get array container id

getArrayContainerId(object $componentObj, string $formId, string $fieldId) : string
Static
access public

Parameters

$componentObj

object

Component object

$formId

string

Form identifier

$fieldId

string

Field identifier

Returns

stringArray container id

Get HTML id for button for adding new element to data set

getButtonAddNewElementDataSetId(object $componentObj, string $id) : string
Static
access public

Parameters

$componentObj

object

Component object

$id

string

Form identifier

Returns

stringHTML id for button for adding new element to data set

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 controller data by id

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

Parameters

$id

string

Controller identifier

Returns

arraybooleanController data or false if not exists; controller data have multiple callbacks for controller

Get controllers data

getControllers() : array
access public

Returns

arrayControllers data; each controller data has multiple callbacks for controller

Get data set controller data by id

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

Parameters

$id

string

Controller identifier

Returns

arraybooleanController data or false if not exists; controller data have the following fields: "bulkavailable" (int type; set if bulk action is available), "callback" (array or string type; callback for controller), "noncerequired" (int type; set if nonce is required by data set controller), "redirectafter" (int type; set if there should be redirection after action), "title" (string type; link title)

Get data set controllers data

getDataSetControllers() : array
access public

Returns

arrayControllers data; each controller data has the following fields: "bulkavailable" (int type; set if bulk action is available), "callback" (array or string type; callback for controller), "noncerequired" (int type; set if nonce is required by data set controller), "redirectafter" (int type; set if there should be redirection after action), "title" (string type; link title)

Get data set nonce identifier

getDataSetNonceId(object $componentObj, string $id) : string
Static
access public

Parameters

$componentObj

object

Component object

$id

string

Container identifier

Returns

stringData set nonce identifier

Get field id

getFieldId(object $componentObj, string $formId, string $fieldId) : string
Static
access public

Parameters

$componentObj

object

Component object

$formId

string

Form identifier

$fieldId

string

Field identifier

Returns

stringField id

Get field HTML id for action

getFieldIdAction(object $componentObj, string $id) : string
Static
access public

Parameters

$componentObj

object

Component object

$id

string

Form identifier

Returns

stringField HTML id for action

Get field HTML id for button

getFieldIdButton(object $componentObj, string $formId, string $buttonId) : string
Static
access public

Parameters

$componentObj

object

Component object

$formId

string

Form identifier

$buttonId

string

Button identifier

Returns

stringField HTML id for button

Get field HTML id with data set

getFieldIdDataSet(object $componentObj) : string
Static
access public

Parameters

$componentObj

object

Component object

Returns

stringField HTML id with data set

Get field HTML id for data set element identifier

getFieldIdDataSetElementId(object $componentObj, string $id) : string
Static
access public

Parameters

$componentObj

object

Component object

$id

string

Form identifier

Returns

stringField HTML id for data set element identifier

Get field HTML id for default button

getFieldIdDefaultButton(object $componentObj, string $formId, string $buttonId) : string
Static
access public

Parameters

$componentObj

object

Component object

$formId

string

Form identifier

$buttonId

string

Button identifier

Returns

stringField HTML id for default button

Get field HTML id for tab

getFieldIdTab(object $componentObj, string $formId, integer $number) : string
Static
access public

Parameters

$componentObj

object

Component object

$formId

string

Form identifier

$number

integer

Position number

Returns

stringField HTML id for tab

Get field HTML id for tab div

getFieldIdTabDiv(object $componentObj, string $formId, integer $number) : string
Static
access public

Parameters

$componentObj

object

Component object

$formId

string

Form identifier

$number

integer

Position number

Returns

stringField HTML id for tab div

Get field name for action

getFieldNameAction(object $componentObj) : string
Static
access public

Parameters

$componentObj

object

Component object

Returns

stringField name for action

Get field name for data set element identifier

getFieldNameDataSetElementId(object $componentObj) : string
Static
access public

Parameters

$componentObj

object

Component object

Returns

stringField name for data set element identifier

Get field name for form id

getFieldNameFormId(object $componentObj) : string
Static
access public

Parameters

$componentObj

object

Component object

Returns

stringField name for form id

Get form data by id

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

Parameters

$id

string

Form identifier

Returns

arraybooleanForm data or false if not exists; form data have the following fields: "additional" (array type; additional settings), "buttons" (array type; definition of buttons below form), "defaultbuttons" (array type; definition of default buttons below form), "optionscontainerid" (string type; identifier of options container for form), "settingsmenusids" (array type; list of settings menu pages where this form will be displayed), "tabs" (array type; tabs with form fields)

Get form id

getFormId(object $componentObj, string $id) : string
Static
access public

Parameters

$componentObj

object

Component object

$id

string

Form identifier

Returns

stringForm id

Get forms data

getForms() : array
access public

Returns

arrayForms data; each form data has the following fields: "additional" (array type; additional settings), "buttons" (array type; definition of buttons below form), "defaultbuttons" (array type; definition of default buttons below form), "optionscontainerid" (string type; identifier of options container for form), "settingsmenusids" (array type; list of settings menu pages where this form will be displayed), "tabs" (array type; tabs with form fields)

Get nonce identifier

getNonceId(object $componentObj, string $id) : string
Static
access public

Parameters

$componentObj

object

Component object

$id

string

Form identifier

Returns

stringNonce identifier

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

Get tab data by id

getTab(string $formId, string $tabId) : array | boolean
access public

Parameters

$formId

string

Form identifier

$tabId

string

Tab identifier

Returns

arraybooleanTab data or false if not exists; tab data have the following fields: "fields" (array type; fields data; each element contains text with field in HTML to display), "title" (string type; tab title)

Get tab data

getTabs(string $id) : array
access public

Parameters

$id

string

Form identifier

Returns

arrayTab data; each tab data has the following fields: "fields" (array type; fields data; each element contains text with field in HTML to display), "title" (string type; tab title)

Remove controller

removeController(string $id) : void
access public

Parameters

$id

string

Controller identifier

Remove data set controller

removeDataSetController(string $id) : void
access public

Parameters

$id

string

Controller identifier

Remove form

removeForm(string $id) : void
access public

Parameters

$id

string

Form identifier

Remove tab

removeTab(string $formId, string $tabId) : void
access public

Parameters

$formId

string

Form identifier

$tabId

string

Tab identifier

Show form

showForm(string $formIdForWidget = '') : void
access public

Parameters

$formIdForWidget

string

Form identifier to display for widget - default: empty

Add field or HTML code to form tab

addFieldOrHtmlToTab(string $formId, string $tabId, string $fieldType, string $fieldId, boolean $forceFieldValue, string $fieldValue, string $tipText, string $html, string $htmlLeft, array $events, array $additional) : integer
access private

Parameters

$formId

string

Form identifier

$tabId

string

Form tab identifier

$fieldType

string

Field type

$fieldId

string

Field identifier

$forceFieldValue

boolean

Force field value (true) or not (false)

$fieldValue

string

Field value

$tipText

string

Tooltip text

$html

string

HTML code to add in field area

$htmlLeft

string

HTML code to add in label area

$events

array

HTML events

$additional

array

Additional settings; each field type can use different additional settings; there are the following additional settings which can be always used: "global_addinfo" (string type; text to add below field), "global_addlabel" (string type; text to add to label), "global_displayonlist" (bool type; if true, field information will be displayed on list if this container is for data set), "global_displayonlistcallback" (array or string type; callback method or function for displaying on list if this container is for data set), "global_hidelabel" (bool type; if true, label will be hidden), "global_widgetobj" (object type; it must be set to widget object, when it is widget)

Returns

integerIdentifier

Check if there is parameter for action to add new element in data set

checkDataSetActionAddNew() : boolean
Static
access private

Returns

booleanThere is parameter for action to add new element in data set

Check if there is parameter for action and identifier to select current element in data set

checkDataSetActionAndId(object $componentObj, string $containerToCheck, boolean $allowArrayOfIds) : boolean
Static
access private

Parameters

$componentObj

object

Component object

$containerToCheck

string

Container identifier to check; if empty, no container identifier is checked

$allowArrayOfIds

boolean

Allow array of identifiers (true) or not (false)

Returns

booleanThere is parameter for action and identifier to select current element in data set (true) or not (false)

Data set controller for delete element

controllerDataSetDelete(object $componentObj, string $containerId, integer $dataSetElementId, $outputText) : void
Static
access private

Parameters

$componentObj

object

Component object

$containerId

string

Container identifier

$dataSetElementId

integer

Data set element identifier

$outputText

Controller for restore options

controllerRestore(object $componentObj, string $formId, boolean $isDataSet, integer $dataSetElementId, $outputText) : boolean
Static
access private

Parameters

$componentObj

object

Component object

$formId

string

Form identifier

$isDataSet

boolean

Container is for data set

$dataSetElementId

integer

Data set element identifier if $isDataSet is set to true

$outputText

Returns

booleanController has been executed correctly (true) or not (false)

Controller for save options

controllerSave(object $componentObj, string $formId, boolean $isDataSet, integer $dataSetElementId, $outputText) : boolean
Static
access private

Parameters

$componentObj

object

Component object

$formId

string

Form identifier

$isDataSet

boolean

Container is for data set

$dataSetElementId

integer

Data set element identifier if $isDataSet is set to true

$outputText

Returns

booleanController has been executed correctly (true) or not (false)

Add field or HTML code to form tab now

fieldToAddNow(string $formId, string $tabId, string $fieldType, string $fieldId, boolean $forceFieldValue, string $fieldValue, string $tipText, string $html, string $htmlLeft, array $events, array $additional) : integer
access private

Parameters

$formId

string

Form identifier

$tabId

string

Form tab identifier

$fieldType

string

Field type

$fieldId

string

Field identifier

$forceFieldValue

boolean

Force field value (true) or not (false)

$fieldValue

string

Field value

$tipText

string

Tooltip text

$html

string

HTML code to add in field area

$htmlLeft

string

HTML code to add in label area

$events

array

HTML events

$additional

array

Additional settings; each field type can use different additional settings; there are the following additional settings which can be always used: "global_addinfo" (string type; text to add below field), "global_addlabel" (string type; text to add to label), "global_displayonlist" (bool type; if true, field information will be displayed on list if this container is for data set), "global_displayonlistcallback" (array or string type; callback method or function for displaying on list if this container is for data set), "global_hidelabel" (bool type; if true, label will be hidden), "global_widgetobj" (object type; it must be set to widget object, when it is widget)

Returns

integerIdentifier

Controller for save or restore options

saveOrRestoreInController(object $componentObj, string $formId, boolean $isDataSet, integer $dataSetElementId, boolean $isRestore, $outputText) : boolean
Static
access private

Parameters

$componentObj

object

Component object

$formId

string

Form identifier

$isDataSet

boolean

Container is for data set

$dataSetElementId

integer

Data set element identifier if $isDataSet is set to true

$isRestore

boolean

It is controller for restore (true) or save (false)

$outputText

Returns

booleanController has been executed correctly (true) or not (false)

 Properties

 

Active forms arrays

$activeFormsArrays : array

Default

array()
access private
 

Settings controllers

$controllers : array

Default

array()
access private
 

Data set controllers

$dataSetControllers : array

Default

array()
access private
 

Display field on list callback

$displayFieldOnListCallback : array

Default

array()
access private
 

Fields to add to form

$fieldsToAdd : array

Default

array()
access private
 

Fields to display on list

$fieldsToDisplayOnList : array

Default

array()
access private
 

Settings forms

$forms : array

Default

array()
access private
 

Forms arrays

$formsArrays : array

Default

array()
access private
 

Forms tabs to display

$formsTabs : array

Default

array()
access private
 

Forms to display on current settings page

$formsToDisplayOnCurrentScreen : array

Default

array()
access private
 

Array script added (true) or not (false)

$libArrayScriptAdded : boolean

Default

false
access private
 

Order field on list

$orderFieldOnList : array

Default

array()
access private
 

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

$projectObj : object

Default

NULL
access private
 

Sortable fields on list

$sortableFieldsOnList : array

Default

array()
access private

 Constants

 

Controls for field with array

ARRAY_DIV_CONTROLS = '<div data-type="####DATA_TYPE_CONTROLS####" style="float:left;">' 
 

Element container for field with array

ARRAY_DIV_ELEMENT_CONTAINER = '<div data-type="####DATA_TYPE_ELEMENT_CONTAINER####" ####DATA_ATTRS#### style="padding-top:5px;padding-bottom:5px;">' 
 

Field for field with array

ARRAY_DIV_FIELD = '<div data-type="####DATA_TYPE_FIELD####" style="float:left;width:50%;">'