Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
placement.php
1<?php
2
4
7
13{
14 private const CACHE_TIME = 86400;
15 private const CACHE_DIR = '/rest/integration/data/placement/';
16
20 public static function getList() : array
21 {
22 $result = [];
23
24 $cache = Cache::createInstance();
25 if ($cache->initCache(static::CACHE_TIME, 'all' . LANGUAGE_ID, static::CACHE_DIR))
26 {
27 $result = $cache->getVars();
28 }
29 elseif ($cache->startDataCache())
30 {
31 $placementDictionary = new Dictionary\Placement();
32 foreach ($placementDictionary as $event)
33 {
34 $result[] = [
35 'id' => $event['code'],
36 'name' => !empty($event['name']) ? $event['name'] . ' (' . $event['code'] . ')' : $event['code'],
37 'descr' => !empty($event['descr']) ? $event['descr'] : '',
38 ];
39 }
40
41 $cache->endDataCache($result);
42 }
43
44 return $result;
45 }
46}