Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/im/lib/ |
Upload File : |
<?php namespace Bitrix\Im; use Bitrix\Im\V2\Promotion\Entity; use Bitrix\Im\V2\Promotion\Internals\DeviceType; use Bitrix\Im\V2\Promotion\Service\UIPromotionService; use Bitrix\Main\Config\Option; /** * @deprecated since 13.03.2025 * @see \Bitrix\Im\V2\Promotion\Promotion */ class Promotion { const DEVICE_TYPE_WEB = "web"; // browser + desktop const DEVICE_TYPE_BROWSER = "browser"; const DEVICE_TYPE_DESKTOP = "desktop"; const DEVICE_TYPE_MOBILE = "mobile"; const DEVICE_TYPE_ALL = "all"; const USER_TYPE_OLD = "OLD"; const USER_TYPE_NEW = "NEW"; const USER_TYPE_ALL = "ALL"; private const ONE_MONTH = 3600 * 24 * 30; private const ENDLESS_LIFETIME = 0; public static function getActive($type = self::DEVICE_TYPE_ALL) { if (self::isDisable()) { return []; } $promoType = DeviceType::tryFrom($type); if (null === $promoType) { return []; } $promoService = UIPromotionService::getInstance(); $promoList = $promoService->getActive($promoType); $result = []; foreach ($promoList as $promo) { $result[] = $promo->getId(); } return $result; } public static function read($id) { $promoService = UIPromotionService::getInstance(); $promotion = new Entity\Promotion($id); return $promoService->markAsViewed($promotion)->isSuccess(); } public static function getDeviceTypes() { return [ self::DEVICE_TYPE_ALL, self::DEVICE_TYPE_WEB, self::DEVICE_TYPE_BROWSER, self::DEVICE_TYPE_DESKTOP, self::DEVICE_TYPE_MOBILE, ]; } private static function isDisable(): bool { return Option::get('im', 'promo_disabled', 'N') === 'Y'; } }