%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 3.22.130.108 Web Server : Apache/2.4.52 (Ubuntu) System : Linux 3051455-guretool.twc1.net 5.15.0-107-generic #117-Ubuntu SMP Fri Apr 26 12:26:49 UTC 2024 x86_64 User : www-root ( 1010) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/ui/lib/form/ |
Upload File : |
<?php namespace Bitrix\UI\Form; use Bitrix\Main\ArgumentException; use Bitrix\Main\Loader; use Bitrix\Main\Localization\Loc; use Bitrix\Main\Config\Option; class FeedbackForm { protected $id; protected $isCloud; protected $formParams = []; protected $presets = []; protected $title; protected $portalUri; public function __construct(string $id) { if ($id == '') { throw new ArgumentException(' Feedback form id can not be empty'); } $this->id = $id; $this->isCloud = Loader::includeModule('bitrix24'); $this->title = Loc::getMessage('UI_FEEDBACK_FORM_BUTTON'); $this->portalUri = 'https://landing.bitrix24.ru'; } public function getId() { return $this->id; } public function getFormParams() { return $this->formParams; } public function setFormParamsDirectly($form) { $form['lang'] = $form['lang']??LANGUAGE_ID; $this->formParams = $form; } public function getPresets() { $presets = $this->presets; $presets['b24_plan'] = $this->isCloud ? \CBitrix24::getLicenseType() : ''; $presets['b24_plan_date_to'] = ( $this->isCloud ? ConvertTimeStamp(Option::get('main', '~controller_group_till', time())) : '' ); $presets['b24_partner_id'] = ( ($this->isCloud && method_exists('CBitrix24', 'getPartnerId')) ? \CBitrix24::getPartnerId() : '' ); global $USER; $name = ''; $email = ''; if(is_object($USER)) { $name = $USER->GetFirstName(); if(!$name) { $name = $USER->GetLogin(); } $email = $USER->GetEmail(); } $presets['c_name'] = $name; $presets['c_email'] = $email; return $presets; } public function getTitle() { return $this->title; } public function getPortalUri() { return $this->portalUri; } public function getJsObjectParams() { return [ 'id' => $this->getId(), 'form' => $this->getFormParams(), 'presets' => $this->getPresets(), 'title' => $this->getTitle(), 'portal' => $this->getPortalUri() ]; } public function setFormParams(array $forms) { if ($this->isCloud && $forms['prefixes']) { $zone = \CBitrix24::getLicensePrefix(); $defaultForm = null; foreach ($forms as $form) { if (!isset($form['zones']) || !is_array($forms['licenseZones'])) { continue; } if (in_array($zone, $forms['licenseZones'])) { $form['lang'] = $form['lang']??LANGUAGE_ID; $this->formParams = $form; return; } if (in_array('en', $forms['licenseZones'])) { $form['lang'] = $form['lang']??LANGUAGE_ID; $defaultForm = $form; } } $this->formParams = $defaultForm; return; } else if ($this->isCloud) { $zone = \CBitrix24::getPortalZone(); $defaultForm = null; foreach ($forms as $form) { if (!isset($form['zones']) || !is_array($form['zones'])) { continue; } if (in_array($zone, $form['zones'])) { $form['lang'] = $form['lang']??LANGUAGE_ID; $this->formParams = $form; return; } if (in_array('en', $form['zones'])) { $form['lang'] = $form['lang']??LANGUAGE_ID; $defaultForm = $form; } } $this->formParams = $defaultForm; return; } else { $lang = LANGUAGE_ID; $defaultForm = null; foreach ($forms as $form) { if (!isset($form['lang'])) { continue; } if ($lang === $form['lang']) { $this->formParams = $form; return; } if ($form['lang'] === 'en') { $defaultForm = $form; } } $this->formParams = $defaultForm; return; } } public function setPresets(array $presets = []) { $this->presets = $presets; } public function setTitle(string $title) { $this->title = $title; } public function setPortalUri(string $portalUri) { $this->portalUri = $portalUri; } }