VkCategories
Class VkCategories Download categories from vk, save them in cache, get from cache
Table of Contents
Constants
- CACHE_DIR = '/sale/vkexport/'
- CACHE_ID_PREFIX = "vkcategory_cache"
- CACHE_TTL = 86400
Methods
- __construct() : mixed
- VkCategories constructor.
- createAgent() : array<string|int, mixed>|bool|false|mixed|null
- Create agent for pereodical update vk-categories in values (main function)
- deleteAgent() : mixed
- deleteAllAgents() : mixed
- Remove agents for ALL export IDs
- getList() : array<string|int, mixed>|bool
- If cache exist - get values from it.
- getVkCategorySelector() : string
- Formmatted selector to HTML. Not create <select> tag. only inner options.
- updateVkCategoriesAgent() : string
- Agent wrap-method for update cache
Constants
CACHE_DIR
public
mixed
CACHE_DIR
= '/sale/vkexport/'
CACHE_ID_PREFIX
public
mixed
CACHE_ID_PREFIX
= "vkcategory_cache"
CACHE_TTL
public
mixed
CACHE_TTL
= 86400
Methods
__construct()
VkCategories constructor.
public
__construct(mixed $exportId) : mixed
Parameters
- $exportId : mixed
-
- int, ID of export profile
createAgent()
Create agent for pereodical update vk-categories in values (main function)
public
createAgent() : array<string|int, mixed>|bool|false|mixed|null
Return values
array<string|int, mixed>|bool|false|mixed|null —- ID of created or existing agent
deleteAgent()
public
deleteAgent() : mixed
deleteAllAgents()
Remove agents for ALL export IDs
public
deleteAllAgents() : mixed
getList()
If cache exist - get values from it.
public
getList([bool $isTree = true ]) : array<string|int, mixed>|bool
Else - download categories via API
Parameters
- $isTree : bool = true
Return values
array<string|int, mixed>|boolgetVkCategorySelector()
Formmatted selector to HTML. Not create <select> tag. only inner options.
public
getVkCategorySelector([null $catVkSelected = NULL ][, string $defaultItemText = '' ]) : string
Parameters
- $catVkSelected : null = NULL
-
- ID of item, which it is necessary to ckecked
- $defaultItemText : string = ''
-
- if set - rename first element. Default - 'Check category'
Return values
stringupdateVkCategoriesAgent()
Agent wrap-method for update cache
public
static updateVkCategoriesAgent(mixed $exportId) : string
Parameters
- $exportId : mixed