29 $this->isCloud = Loader::includeModule(
'bitrix24');
30 $this->
title = Loc::getMessage(
'UI_FEEDBACK_FORM_BUTTON');
31 $this->portalUri =
'https://' . (
new UrlProvider())->getFeedbackDomain();
41 return $this->currentForm?->toArray();
52 $presets[
'b24_plan'] = $this->isCloud ? \CBitrix24::getLicenseType() :
'';
55 ? ConvertTimeStamp(Option::get(
'main',
'~controller_group_till', time()))
59 ($this->isCloud && method_exists(
'CBitrix24',
'getPartnerId'))
60 ? \CBitrix24::getPartnerId()
82 $business = Option::get(
'bitrix24',
'CJM-business',
null);
114 'id' => $this->
getId(),
128 if (!isset($item[
'id'], $item[
'sec']))
134 $form->id = (int)$item[
'id'];
135 $form->sec = (string)$item[
'sec'];
136 $form->zones = $item[
'zones'] ?? [$this->getDefaultZone()];
137 $form->lang = $item[
'lang'] ?? $this->getDefaultLang();
142 $forms = $this->findFormByZone($forms);
143 if (
count($forms) === 0)
148 $forms = $this->findByLang($forms);
150 $this->currentForm = array_shift($forms);
157 private function findFormByZone(
array $forms):
array
159 $zone = $this->
getZone() ?? $this->getDefaultZone();
160 $found = array_filter($forms,
static function ($form) use ($zone)
162 return in_array($zone, $form->zones,
true);
165 if (
count($found) === 0)
167 $zoneDefault = $this->getDefaultZone();
168 $found = array_filter($forms,
static function ($form) use ($zoneDefault)
170 return in_array($zoneDefault, $form->zones,
true);
181 private function findByLang(
array $forms):
array
184 $found = array_filter($forms,
static function ($form) use (
$lang)
186 return $lang === $form->lang;
189 if (
count($found) === 0)
191 $langDefault = $this->getDefaultLang();
192 $found = array_filter($forms,
static function ($form) use ($langDefault)
194 return $langDefault === $form->lang;
198 return count($found) > 0 ? $found : $forms;
208 if (!isset($formParams[
'id'], $formParams[
'sec']))
214 $form->id = (int)$formParams[
'id'];
215 $form->sec = (string)$formParams[
'sec'];
216 $form->zones = $formParams[
'zones'] ?? [$this->getDefaultZone()];
217 $form->lang = $formParams[
'lang'] ?? $this->getDefaultLang();
219 $this->currentForm = $form;
224 return Application::getInstance()->getLicense()->getRegion();
227 private function getDefaultZone(): string
229 return $this->isCis() ?
'ru' :
'en';
237 private function getDefaultLang(): string
239 return $this->isCis() ?
'ru' :
'en';
242 private function isCis(): bool
244 $zone = $this->
getZone() ??
'';
246 return in_array($zone, [
'ru',
'by',
'kz',
'uz']);
if(!defined('SITE_ID')) $lang
<? endif;?> window document title