Options class
access | public |
---|---|
package | kocuj_internal_lib |
inherited_from | \KocujIL\V12a\Classes\ComponentObject |
__construct(object $projectObj) : void
access | public |
---|---|
inherited_from | \KocujIL\V12a\Classes\ComponentObject::__construct() |
object
\KocujIL\V12a\Classes\Project object for current project
__construct(object $projectObj) : void
access | public |
---|
object
\KocujIL\V12a\Classes\Project object for current project
addContainer(string $containerId, integer $optionAutoload= \KocujIL\V12a\Enums\OptionAutoload::YES
, integer $containerType= \KocujIL\V12a\Enums\Project\Components\All\Options\ContainerType::SITE
) : void
access | public |
---|
string
Options container identifier; it must have maximum 16 characters
integer
Automatic loading of option or not; this argument is ignored if $containerType is set to \KocujIL\V12a\Enums\Project\Components\All\Options\ContainerType::WIDGET; must be one of the following constants from \KocujIL\V12a\Enums\OptionAutoload: NO (when option should not be automatically loaded) or YES (when option should be automatically loaded) - default: \KocujIL\V12a\Enums\OptionAutoload::YES
integer
Options container type; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\All\Options\ContainerType: NETWORK_OR_SITE (for network - in multisite installation - or site - in standard installation - type), SITE (for site type), NETWORK (for network type), WIDGET (for widget type), DATA_SET_SITE (for data set table with options for site type) or DATA_SET_NETWORK (for data set table with options for network type) - default: \KocujIL\V12a\Enums\Project\Components\All\Options\ContainerType::SITE
addDataSetElement($containerId) : integer
access | public |
---|
integer
New element identifier for data setaddDefinition(string $containerId, string $optionId, string $type, string $defaultValue, string $label, integer $optionArray= \KocujIL\V12a\Enums\Project\Components\All\Options\OptionArray::NO
, array $arraySettings= array()
, array $dataSetSettings= array()
, array $additional= array()
) : void
todo | disallow option id as "option_id" or "option_value" |
---|---|
todo | add requirement that "global_foreignkeyforcontainer", "global_ordervalue" or "global_unique" can be set only when "global_searchkey" is set |
todo | add checking if "global_ordervalue" is only for one option in container |
access | public |
string
Options container identifier
string
Option identifier
string
Option type
string
Option default value
string
Option label
integer
Option is array or standard; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\All\Options\OptionArray: NO (when it is standard option) or YES (when it is array option) - default: \KocujIL\V12a\Enums\Project\Components\All\Options\OptionArray::NO
array
Array settings if $optionArray is set to \KocujIL\V12a\Enums\Project\Components\All\Options\OptionArray::YES - default: empty
array
array
Data set settings for option; each options type can use different data set settings; there are the following data set settings which can be always used: "global_foreignkeyforcontainer" (string type; name of container for which this option is foreign key, so selected value can be only from available values in column "option_id" in the selected container; it works only if "global_searchkey" is set to true), "global_ordervalue" (bool type; if container is for data set and it is set to true, this value will be used for default ordering the elements list), "global_searchkey" (bool type; if container is for data set and it is set to true, there will be an additional column with option value for this definition), "global_unique" (bool type; if container is for data set and it is set to true, this field will be checked if its value is unique in data set; it works only if "global_searchkey" is set to true) - default: empty
addType(string $optionType, array|string $callbackDefaultValue= NULL
, array|string $callbackValidation= NULL
, integer $typeLengthSupport= \KocujIL\V12a\Enums\Project\Components\All\Options\TypeLengthSupport::NO
, integer $typeFormat= \KocujIL\V12a\Enums\Project\Components\All\Options\TypeFormat::TEXT
) : void
access | public |
---|
string
Options type
array
string
Callback function or method name for default value of option; can be global function or method from any class; if empty, no callback will be used - default: NULL
array
string
Callback function or method name for validation of option; can be global function or method from any class; if empty, no callback will be used - default: NULL
integer
Minimum and maximum length is supported or not; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\All\Options\TypeLengthSupport: NO (when length limits are not supported) or YES (when length limits are supported) - default: \KocujIL\V12a\Enums\Project\Components\All\Options\TypeLengthSupport::NO
integer
Format of value; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\All\Options\TypeFormat: TEXT (when format is text), NUMBER_INT (when format is int number) or NUMBER_FLOAT (when format is float number) - default: \KocujIL\V12a\Enums\Project\Components\All\Options\TypeFormat::TEXT
checkContainer(string $id) : boolean
access | public |
---|
string
Options container identifier
boolean
Options container exists (true) or not (false)checkDataSetElementId(string $containerId, integer $dataSetElementId) : boolean
access | public |
---|
string
Options container identifier
integer
Data set element identifier
boolean
Element identifier exists in data set (true) or not (false)checkDefinition(string $containerId, string $optionId) : boolean
access | public |
---|
string
Options container identifier
string
Option definition identifier
boolean
Option definition exists (true) or not (false)checkType(string $id) : boolean
access | public |
---|
string
Options type identifier
boolean
Options type exists (true) or not (false)getAllOptions(string $containerId, $dataSetElementId = 0
) : array
access | public |
---|
string
Option container identifier
array
Options valuesgetComponent(string $type, integer $projectCategory= \KocujIL\V12a\Enums\ProjectCategory::CORE
, string $fragment= ''
) : object
access | public |
---|
string
Component type
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
string
Component fragment - default: empty
object
Object of class type from componentgetContainer(string $id) : array | boolean
access | public |
---|
string
Options container identifier
array
boolean
Options container data or false if not exists; options container data have the following fields: "autoload" (bool type; if true, options container will be loaded automatically), "dbkey" (string type; database key for options container), "tablename" (string type; table name in database for data set options), "type" (int type; options container is automatic, for network or for site)getContainers() : array
access | public |
---|
array
Options containers data; each options container data has the following fields: "autoload" (bool type; if true, options container will be loaded automatically), "dbkey" (string type; database key for options container), "tablename" (string type; table name in database for data set options), "type" (int type; options container is automatic, for network or for site)getDataSetElements(string $containerId, array $searchValues= array()
, string $orderBy= ''
, integer $order= \KocujIL\V12a\Enums\Project\Components\All\Options\Order::ASC
, integer $count= 1
, integer $from= 0
) : array
access | public |
---|
string
Option container identifier
array
If options are for data set, these are options keys and values by which data will be searched - default: empty
string
Option by which results will be sorted - default: empty
integer
Order of sorting; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\All\Options\Order: ASC (when order is ascendand) or DESC (when order is descendant) - default: \KocujIL\V12a\Enums\Project\Components\All\Options\Order::ASC
integer
How many elements should be returned; if it set to 0, all elements will be get - default: 1
integer
From which element data should be returned - default: 0
array
Options values for each founded elementgetDataSetElementsCount(string $containerId, array $searchValues = array()
) : array
access | public |
---|
string
Option container identifier
array
If options are for data set, these are options keys and values by which data will be searched - default: empty
array
Options values for each founded elementgetDefinition(string $containerId, string $optionId) : array | boolean
access | public |
---|
string
Options container identifier
string
Option definition identifier
array
boolean
Option definition data or false if not exists; option definition data have the following fields: "additional" (array type; additional settings for option), "arraymode" (int type; set if option is standard or array), "arraysettings" (array type; settings for option if it is an array), "datasetsettings" (array type; data set settings for option), "defaultvalue" (string type; option default value), "label" (string type; option label), "type" (string type; option type)getDefinitions(string $containerId) : array
access | public |
---|
string
Options container identifier
array
Options definitions data; each option definition data has the following fields: "additional" (array type; additional settings for option), "arraymode" (int type; set if option is standard or array), "arraysettings" (array type; settings for option if it is an array), "datasetsettings" (array type; data set settings for option), "defaultvalue" (string type; option default value), "label" (string type; option label), "type" (string type; option type)getOption(string $containerId, string $optionId, integer $dataSetElementId = 0
) : string
access | public |
---|
string
Option container identifier
string
Option identifier
integer
Data set element identifier - default: 0
string
Option valuegetProjectObj() : object
access | public |
---|
object
Object of type \KocujIL\V12a\Classes\ProjectgetStrings(string $type, integer $projectCategory = \KocujIL\V12a\Enums\ProjectCategory::CORE
) : object
access | public |
---|
string
Component type
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
object
Object of class type for strings from componentgetType(string $id) : array | boolean
access | public |
---|
string
Options type identifier
array
boolean
Options type data or false if not exists; options type data have the following fields: "defaultvalue" (array or string type; callback for default value of option), "format" (int type; information about format), "lengthsupport" (int type; information is minimum and maximum length is supported for this options type), "validation" (array or string type; callback for validation of option)getTypes() : array
access | public |
---|
array
Options types data; each options types data has the following fields: "defaultvalue" (array or string type; callback for default value of option), "format" (int type; information about format), "lengthsupport" (int type; information is minimum and maximum length is supported for this options type), "validation" (array or string type; callback for validation of option)loadContainerForWidget(string $containerId, array $options) : void
access | public |
---|
string
Option container identifier
array
Options
removeAllContainersFromDb() : void
access | public |
---|
removeContainer(string $id) : void
access | public |
---|
string
Container identifier
removeContainerFromDb(string $containerId) : void
access | public |
---|
string
Option container identifier
removeDataSetElement(string $containerId, integer $dataSetElementId) : void
todo | when removing other elements with foreign key set to current container, do not remove entire cache for this container from memory, but only deleted elements |
---|---|
access | public |
string
Options container identifier
integer
Data set element identifier
removeDefinition(string $containerId, string $optionId) : void
access | public |
---|
string
Options definition identifier
string
Option identifier
removeType(string $id) : void
access | public |
---|
string
Type identifier
setOption(string $containerId, string $optionId, string $optionValue, integer $dataSetElementId = 0
) : boolean
access | public |
---|
string
Option container identifier
string
Option identifier
string
Option value
integer
Data set element identifier - default: 0
boolean
Options has been set correctly (true) or not (false)setOptionWithReturnedText(string $containerId, string $optionId, string $optionValue, $outputText, integer $dataSetElementId = 0
) : boolean
access | public |
---|
string
Option container identifier
string
Option identifier
string
Option value
integer
Data set element identifier - default: 0
boolean
Options has been set correctly (true) or not (false)updateAllContainersInDb() : void
access | public |
---|
updateContainerInDb(string $containerId) : void
access | public |
---|
string
Option container identifier
changeContainerTypeToArea(integer $containerType) : integer
access | private |
---|
integer
Options container type; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\All\Options\ContainerType: NETWORK_OR_SITE (for network - in multisite installation - or site - in standard installation - type), SITE (for site type), NETWORK (for network type) or WIDGET (for widget type) - default: \KocujIL\V12a\Enums\Project\Components\All\Options\ContainerType::SITE
integer
Area typechangeOptionsByDefinitions(string $containerId, boolean $force= false
, integer $dataSetElementId= 0
) : void
access | private |
---|
string
Options container identifier
boolean
Force changing options (true) or not (false)
integer
Data set element identifier - default: 0
getDataSetElementsOrCount(boolean $getElements, string $containerId, array $searchValues= array()
, string $orderBy= ''
, integer $order= \KocujIL\V12a\Enums\Project\Components\All\Options\Order::ASC
, integer $count= 1
, integer $from= 0
) : array | integer
access | private |
---|
boolean
Get element (true) or elements count (false)
string
Option container identifier
array
If options are for data set, these are options keys and values by which data will be searched - default: empty
string
Option by which results will be sorted - default: empty
integer
Order of sorting; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\All\Options\Order: ASC (when order is ascendand) or DESC (when order is descendant) - default: \KocujIL\V12a\Enums\Project\Components\All\Options\Order::ASC
integer
How many elements should be returned; if it set to 0, all elements will be get - default: 1
integer
From which element data should be returned - default: 0
array
integer
Options values for each founded element or elements countloadOptionsFromDbIfNeeded(string $containerId, integer $dataSetElementId = 0
) : void
access | private |
---|
string
Options container identifier
integer
Data set element identifier - default: 0
typeDefaultValueCheckbox(object $componentObj, string $defaultOptionValue, array $additional) : string
access | private |
---|
object
Object with this component
string
Default option value
array
Additional settings for option
string
Parsed default option valuetypeDefaultValueIntegerOrFloat(object $componentObj, string $defaultOptionValue, array $additional) : string
access | private |
---|
object
Object with this component
string
Default option value
array
Additional settings for option; there are the following additional settings which can be used: "global_maxvalue" (int type; maximum value of number), "global_minvalue" (int type; minimal value of number)
string
Parsed default option valuetypeValidationCheckbox(object $componentObj, string $containerId, string $optionId, integer $optionArray, string $optionValue, array $additional) : string
access | private |
---|
object
Object with this component
string
Option container identifier
string
Option container identifier
integer
Option is array or standard; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\All\Options\OptionArray: NO (when it is standard option) or YES (when it is array option)
string
Option value
array
Additional settings for option
string
Output text if there was an error or empty string if option value has been validated correctlytypeValidationFloat(object $componentObj, string $containerId, string $optionId, integer $optionArray, string $optionValue, array $additional) : string
access | private |
---|
object
Object with this component
string
Option container identifier
string
Option container identifier
integer
Option is array or standard; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\All\Options\OptionArray: NO (when it is standard option) or YES (when it is array option)
string
Option value
array
Additional settings for option; there are the following additional settings which can be used: "maxvalue" (int type; maximum value of number), "minvalue" (int type; minimal value of number)
string
Output text if there was an error or empty string if option value has been validated correctlytypeValidationHelperIntegerOrFloat(object $componentObj, string $containerId, string $optionId, integer $optionArray, string $optionValue, array $additional, boolean $mustBeInteger) : string
access | private |
---|
object
Object with this component
string
Option container identifier
string
Option container identifier
integer
Option is array or standard; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\All\Options\OptionArray: NO (when it is standard option) or YES (when it is array option)
string
Option value
array
Additional settings for option; there are the following additional settings which can be used: "maxvalue" (int type; maximum value of number), "minvalue" (int type; minimal value of number)
boolean
Value must be integer (true) or not (false)
string
Output text if there was an error or empty string if option value has been validated correctlytypeValidationInteger(object $componentObj, string $containerId, string $optionId, integer $optionArray, string $optionValue, array $additional) : string
access | private |
---|
object
Object with this component
string
Option container identifier
string
Option container identifier
integer
Option is array or standard; must be one of the following constants from \KocujIL\V12a\Enums\Project\Components\All\Options\OptionArray: NO (when it is standard option) or YES (when it is array option)
string
Option value
array
Additional settings for option; there are the following additional settings which can be used: "maxvalue" (int type; maximum value of number), "minvalue" (int type; minimal value of number)
string
Output text if there was an error or empty string if option value has been validated correctly$containers : array
array()
access | private |
---|
$dataSetTableCreatedNow : boolean
false
access | private |
---|
$definitions : array
array()
access | private |
---|
$projectObj : object
NULL
access | private |
---|
$types : array
array()
access | private |
---|