Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
marketingservice.php
1<?php
10
14
20{
26 public static function canUse()
27 {
28 if (!Loader::includeModule('seo'))
29 {
30 return false;
31 }
32
33 return Marketing\Configurator::canUse();
34 }
35
41 public static function isAvailable()
42 {
43 return self::canUse() && Integration\Bitrix24\Service::isAdAvailable();
44 }
45
51 public static function getTypeMap()
52 {
53 return [
54 MessageMarketingFb::CODE => Marketing\Service::TYPE_FACEBOOK
55 ];
56 }
57
64 public static function getAdsProvider($adsType, $clientId = null)
65 {
66 $service = Marketing\Configurator::getService();
67 $service->setClientId($clientId);
68 $providers = Marketing\Configurator::getProviders([$adsType]);
69 $isFound = false;
70 $provider = array();
71 foreach ($providers as $type => $provider)
72 {
73 if ($type == $adsType)
74 {
75 $isFound = true;
76 break;
77 }
78 }
79
80 if (!$isFound)
81 {
82 return null;
83 }
84
85 return $provider;
86 }
87
95 public static function send(\stdClass $config, array $contacts)
96 {
97 if (!static::canUse())
98 {
99 return false;
100 }
101//
102// $audience = Marketing\Service::getAudience($config->type);
103// $audience->setAccountId($config->accountId);
104// $audience->enableQueueMode();
105
106// if ($config->autoRemoveDayNumber)
107// {
108// $audience->enableQueueAutoRemove($config->autoRemoveDayNumber);
109// }
110// else
111// {
112// $audience->disableQueueAutoRemove();
113// }
114//
115// $audienceImportResult = $audience->addContacts(
116// $config->audienceId,
117// $contacts,
118// array(
119// 'type' => $config->contactType
120// )
121// );
122//
123// return $audienceImportResult->isSuccess();
124 return true;
125 }
126}
static send(\stdClass $config, array $contacts)