1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
bitrix24manager.php
См. документацию.
1<?php
2namespace Bitrix\Calendar\Integration;
3
4use Bitrix\Calendar\Integration\Bitrix24\FeatureDictionary;
5use Bitrix\Main\ArgumentOutOfRangeException;
6use Bitrix\Main\Loader;
7use Bitrix\Main\LoaderException;
8use Bitrix\Main\ModuleManager;
9use \Bitrix\Main\Config\Option;
10
18{
19 const EVENT_AMOUNT = "event_with_planner_amount";
20
21 //region Methods
26 public static function isEnabled()
27 {
28 return ModuleManager::isModuleInstalled('bitrix24');
29 }
30
31
38 public static function isFeatureEnabled($featureId): bool
39 {
40 if (!(ModuleManager::isModuleInstalled('bitrix24') && Loader::includeModule('bitrix24')))
41 {
42 return true;
43 }
44
45 return \Bitrix\Bitrix24\Feature::isFeatureEnabled($featureId);
46 }
47
54 public static function isPromoFeatureEnabled($featureId): bool
55 {
56 if (!(ModuleManager::isModuleInstalled('bitrix24') && Loader::includeModule('bitrix24')))
57 {
58 return false;
59 }
60
61 return \Bitrix\Bitrix24\Feature::isPromoEditionAvailableByFeature($featureId);
62 }
63
70 public static function getVariable($name)
71 {
72 if (!(ModuleManager::isModuleInstalled('bitrix24') && Loader::includeModule('bitrix24')))
73 {
74 return null;
75 }
76
77 return \Bitrix\Bitrix24\Feature::getVariable($name);
78 }
79
85 public static function isPlannerFeatureEnabled(): bool
86 {
87 if (self::isFeatureEnabled(FeatureDictionary::CALENDAR_EVENTS_WITH_PLANNER))
88 {
89 return true;
90 }
91
92 $eventsLimit = self::getEventWithPlannerLimit();
93
94 return $eventsLimit === -1 || self::getEventsAmount() <= $eventsLimit;
95 }
96
102 public static function getEventWithPlannerLimit(): int
103 {
104 $limit = self::getVariable(FeatureDictionary::CALENDAR_EVENTS_WITH_PLANNER);
105 if (is_null($limit))
106 {
107 $limit = -1;
108 }
109
110 return $limit;
111 }
112
117 public static function getEventsAmount(): int
118 {
119 return Option::get('calendar', self::EVENT_AMOUNT, 0);
120 }
121
128 public static function setEventsAmount($value = 0): void
129 {
130 if (ModuleManager::isModuleInstalled('bitrix24'))
131 {
132 Option::set('calendar', self::EVENT_AMOUNT, $value);
133 }
134 }
135
141 public static function increaseEventsAmount(): void
142 {
143 self::setEventsAmount(self::getEventsAmount() + 1);
144 }
145}
146?>
static setEventsAmount($value=0)
Определения bitrix24manager.php:128
static isPromoFeatureEnabled($featureId)
Определения bitrix24manager.php:54
static isFeatureEnabled($featureId)
Определения bitrix24manager.php:38
static isModuleInstalled($moduleName)
Определения modulemanager.php:125
$name
Определения menu_edit.php:35