%PDF- %PDF-
Server IP : 37.220.80.31 / Your IP : 18.223.172.191 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/components/bitrix/messageservice.config.sender.limits/ |
Upload File : |
<?php use Bitrix\Main; use Bitrix\Main\Localization\Loc; use Bitrix\MessageService; if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die(); Loc::loadMessages(__FILE__); class MessageServiceConfigSenderLimitsComponent extends CBitrixComponent { public function executeComponent() { if (!Main\Loader::includeModule('messageservice')) { ShowError(Loc::getMessage('MESSAGESERVICE_MODULE_NOT_INSTALLED')); return; } if (!\Bitrix\MessageService\Context\User::isAdmin()) { ShowError(Loc::getMessage('MESSAGESERVICE_PERMISSION_DENIED')); return; } if (isset($_POST['action_button_messageservice_limits']) && !empty($_POST['FIELDS']) && is_array($_POST['FIELDS']) ) { foreach ($_POST['FIELDS'] as $limit => $value) { list ($senderId, $fromId) = explode(':', $limit); \Bitrix\MessageService\Sender\Limitation::setDailyLimit($senderId, $fromId, $value['limit']); } } $this->arResult['GRID_ID'] = 'messageservice_limits'; $this->arResult['COLUMNS'] = array( array( 'id' => 'sender', 'name' => Loc::getMessage('MESSAGESERVICE_HEADER_SENDER'), 'default' => true ), array( 'id' => 'from', 'name' => Loc::getMessage('MESSAGESERVICE_HEADER_SENDER_FROM'), 'default' => true ), array( 'id' => 'limit', 'name' => Loc::getMessage('MESSAGESERVICE_HEADER_LIMIT'), 'default' => true, 'editable' => array( 'TYPE' => \Bitrix\Main\Grid\Editor\Types::NUMBER ) ), array( 'id' => 'current', 'name' => Loc::getMessage('MESSAGESERVICE_HEADER_CURRENT'), 'default' => true ), ); $rows = array(); $senders = MessageService\Sender\SmsManager::getSenders(); $currents = MessageService\Internal\Entity\MessageTable::getAllDailyCount(); foreach ($senders as $sender) { if (!$sender->canUse()) continue; $fromList = $sender->getFromList(); foreach ($fromList as $from) { $id = $sender->getId().':'.$from['id']; $limit = MessageService\Sender\Limitation::getDailyLimit($sender->getId(), $from['id']); $rows[] = array( 'id' => $id, 'columns' => array( 'id' => $id, 'sender' => $sender->getName(), 'from' => $from['name'], 'limit' => $limit, 'current' => isset($currents[$id]) ? $currents[$id] : 0 ), 'data' => array( '~limit' => $limit, ), 'actions1' => array(array( 'TITLE' => GetMessage('MESSAGESERVICE_ROW_EDIT'), 'TEXT' => GetMessage('MESSAGESERVICE_ROW_EDIT'), //'ONCLICK' => "Grid.editSelected();", "ACTION" => "CALLBACK", "DATA" => array(array("JS" => "Grid.editSelected()")) )) ); } } $this->arResult['ROWS'] = $rows; $this->arResult['TZ_LIST'] = $this->getTimezones(); $this->arResult['RETRY_TIME'] = \Bitrix\MessageService\Sender\Limitation::getRetryTime(); if (empty($this->arResult['RETRY_TIME']['tz'])) { $this->arResult['RETRY_TIME']['tz'] = (new DateTime())->getTimezone()->getName(); } $this->IncludeComponentTemplate(); } private function getTimezones() { $tz = \CTimeZone::GetZones(); return $tz; } }