1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
FeedAi.php
См. документацию.
1<?php
2
3namespace Bitrix\Socialnetwork\Promotion;
4
5use Bitrix\Main\Application;
6use Bitrix\Main\Config\Option;
7use Bitrix\Main\Loader;
8use Bitrix\Main\Type\DateTime;
9use Bitrix\Socialnetwork\Integration\Bitrix24\LeftMenuPreset;
10use Bitrix\Socialnetwork\Integration\Bitrix24\Portal;
11
13{
15 {
16 return PromotionType::FEED_AI;
17 }
18
19 public function shouldShow(int $userId): bool
20 {
21 if (!Loader::includeModule('ai') || $this->isViewed($userId))
22 {
23 return false;
24 }
25
26 $tasksAiPresetCode = (new LeftMenuPreset())->getSocialAiCode();
27 $currentPresetCode = Option::get('intranet', 'left_menu_preset');
28
29 if (is_null($tasksAiPresetCode) || $currentPresetCode !== $tasksAiPresetCode)
30 {
31 return false;
32 }
33
34 $region = Application::getInstance()->getLicense()->getRegion();
35
36 if ($region === 'cn')
37 {
38 return false;
39 }
40
41 $portalCreateDate = (new Portal())->getCreationDateTime();
42 $suitablePortalCreationDate = $this->getMinimumSuitablePortalCreationDate();
43
44 return $portalCreateDate?->getTimestamp() > $suitablePortalCreationDate->getTimestamp();
45 }
46
47 private function getMinimumSuitablePortalCreationDate(): DateTime
48 {
49 return new DateTime('2024-11-26', 'Y-m-d');
50 }
51}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
shouldShow(int $userId)
Определения FeedAi.php:19
$region
Определения .description.php:13