403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/wbs24.ozonapinew/lib/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/wbs24.ozonapinew/lib/Menu.php
<?php
namespace Wbs24\Ozonapinew;

use Bitrix\Main\Localization\Loc;

/**
 * Класс для вывода административного меню
 */
class Menu
{
    use Accounts;

    protected $main;
    protected $Profiles;
    protected $Settings;
    protected $moduleId;

    public function __construct($objects = [])
    {
        $this->main = $objects['Main'] ?? new Main();
        $this->Profiles = $objects['Profiles'] ?? new Profiles();
        $this->Settings = $objects['Settings'] ?? new Settings();
        $this->Wrappers = $objects['Wrappers'] ?? new Wrappers();
        $this->moduleId = $this->main->getModuleId();
    }

    public static function OnBuildGlobalMenuHandler(&$aGlobalMenu, &$aModuleMenu) {
        if (!isset($GLOBALS['USER']) || !$GLOBALS['USER']->IsAdmin()) return;

        $menu = new Menu();
        $menu->build($aGlobalMenu, $aModuleMenu);
    }

    public function build(&$aGlobalMenu, &$aModuleMenu)
    {
        $GLOBALS['APPLICATION']->SetAdditionalCSS("/bitrix/css/".$this->moduleId."/styles.css");

        $suffix = strtoupper($this->moduleId);
        $menuKey = 'global_menu_wbs24';
        $subMenuKey = 'ozon';
        $subMenuIcon = 'catalog';
        $profiles = $this->Profiles->getList();

        // главный узел
        if (!isset($aGlobalMenu[$menuKey])) {
            $aGlobalMenu[$menuKey] = [
                'menu_id' => 'wbs24_head',
                'text' => Loc::getMessage($suffix.".WEB_SYMPHONY"),
                'title' => Loc::getMessage($suffix.".WEB_SYMPHONY"),
                'sort' => 450,
                'items_id' => $menuKey,
                'items' => [],
            ];
        }

        // подраздел
        if (!isset($aGlobalMenu[$menuKey][$subMenuKey])) {
            $aGlobalMenu[$menuKey]['items'][$subMenuKey] = [
                'sort' => 10,
                'text' => Loc::getMessage($suffix.".OZON_TITLE"),
                'title' => Loc::getMessage($suffix.".OZON_TITLE"),
                'icon' => $subMenuIcon,
                'page_icon' => $subMenuIcon,
                'items_id' => $subMenuKey.'_options',
                'items' => [],
            ];
        }

        $modulePrefix = str_replace(".", "_", $this->moduleId);

        // пункты меню подраздела
        // аккаунты
        foreach ($profiles as $profile) {
            $profileId = $profile['id'] ?? false;
            $profileName = htmlspecialchars($profile['name'] ?? '');

            $menuItems = [
                [
                    'sort' => 10,
                    'url' => '/bitrix/admin/'.$modulePrefix.'_profile_main.php?'
                        .'profile_id='.$profileId
                        .'&mid='.$this->moduleId
                        .'&options_type=base'
                    ,
                    'text' => Loc::getMessage($suffix.".ACCOUNT_MAIN_SETTINGS"),
                    'title' => Loc::getMessage($suffix.".ACCOUNT_MAIN_SETTINGS"),
                    'icon' => '',
                    'page_icon' => '',
                    'items_id' => 'profile_'.$profileId.'_main',
                ],
                [
                    'sort' => 20,
                    'url' => '/bitrix/admin/'.$modulePrefix.'_profile_order.php?'
                        .'profile_id='.$profileId
                        .'&mid='.$this->moduleId
                        .'&options_type=order'
                    ,
                    'text' => Loc::getMessage($suffix.".ACCOUNT_ORDER_SETTINGS"),
                    'title' => Loc::getMessage($suffix.".ACCOUNT_ORDER_SETTINGS"),
                    'icon' => '',
                    'page_icon' => '',
                    'items_id' => 'profile_'.$profileId.'_order',
                ],
                [
                    'sort' => 30,
                    'url' => '/bitrix/admin/'.$modulePrefix.'_profile_price.php?'
                        .'profile_id='.$profileId
                        .'&mid='.$this->moduleId
                        .'&options_type=price'
                    ,
                    'text' => Loc::getMessage($suffix.".ACCOUNT_PRICE_SETTINGS"),
                    'title' => Loc::getMessage($suffix.".ACCOUNT_PRICE_SETTINGS"),
                    'icon' => '',
                    'page_icon' => '',
                    'items_id' => 'profile_'.$profileId.'_price',
                ],
                [
                    'sort' => 30,
                    'url' => '/bitrix/admin/'.$modulePrefix.'_profile_stock.php?'
                    .'profile_id='.$profileId
                    .'&mid='.$this->moduleId
                    .'&options_type=stock'
                ,
                    'text' => Loc::getMessage($suffix.".ACCOUNT_STOCK_SETTINGS"),
                    'title' => Loc::getMessage($suffix.".ACCOUNT_STOCK_SETTINGS"),
                    'icon' => '',
                    'page_icon' => '',
                    'items_id' => 'profile_'.$profileId.'_stock',
                ],
                [
                    'sort' => 40,
                    'text' => Loc::getMessage($suffix.".FILTERS"),
                    'title' => Loc::getMessage($suffix.".FILTERS"),
                    'icon' => '',
                    'page_icon' => '',
                    'items_id' => 'profile_'.$profileId.'_filters',
                    'items' => $this->getFilterMenuItems($profileId)
                ],
            ];

            $aGlobalMenu[$menuKey]['items'][$subMenuKey]['items'][] = [
                'sort' => (100 + $profileId * 10),
                'text' => Loc::getMessage($suffix.".ACCOUNT").' ['.$profileId.']'.$profileName,
                'title' => Loc::getMessage($suffix.".ACCOUNT").' ['.$profileId.']'.$profileName,
                'icon' => '',
                'page_icon' => '',
                'items_id' => 'profile_'.$profileId,
                'items' => $menuItems,
            ];
        }

        // Права доступа
        $aGlobalMenu[$menuKey]['items'][$subMenuKey]['items'][] = [
            'sort' => 0,
            'url' => '/bitrix/admin/'.$modulePrefix.'_group_rights.php?'
                .'&mid='.$this->moduleId
                .'&options_type=group_rights'
            ,
            'text' => Loc::getMessage($suffix.".GROUP_RIGHTS"),
            'title' => Loc::getMessage($suffix.".GROUP_RIGHTS"),
            'icon' => '',
            'page_icon' => '',
            'items_id' => 'group_rights',
        ];

        // Журнал ошибок
        $aGlobalMenu[$menuKey]['items'][$subMenuKey]['items'][] = [
            'sort' => 0,
            'url' => '/bitrix/admin/'.$modulePrefix.'_log.php',
            'text' => Loc::getMessage($suffix.".LOG"),
            'title' => Loc::getMessage($suffix.".LOG"),
            'icon' => '',
            'page_icon' => '',
            'items_id' => 'log',
        ];

        // Инструкция
        $aGlobalMenu[$menuKey]['items'][$subMenuKey]['items'][] = [
            'sort' => 0,
            'url' => '/bitrix/admin/'.$modulePrefix.'_instruction.php',
            'text' => Loc::getMessage($suffix.".INSTRUCTION"),
            'title' => Loc::getMessage($suffix.".INSTRUCTION"),
            'icon' => '',
            'page_icon' => '',
            'items_id' => 'instruction',
        ];
    }

    protected function getFilterMenuItems($profileId)
    {
        $this->Wrappers->Option->setPrefix($profileId);
        $siteId = $this->Wrappers->Option->get($this->moduleId, 'siteId');
        $allIblocks = $this->Settings->getAllInfoBlocks($siteId);

        $filterMenuItems = [];
        $count = 0;
        $simpleIblocks = $allIblocks['iblocks'] ?? [];
        $iblocksToTradeIblocks = $allIblocks['iblocks_to_trade_iblocks'] ?? [];
        $suffix = strtoupper($this->moduleId);
        $modulePrefix = str_replace(".", "_", $this->moduleId);

        foreach ($simpleIblocks as $iblockId) {
            $iblockName = $this->Settings->getIblockName($iblockId);
            $filterMenuItems[] = [
                'sort' => 10 * $count,
                'url' => '/bitrix/admin/'.$modulePrefix.'_profile_filter.php?'
                    .'profile_id='.$profileId
                    .'&iblock_id='.$iblockId
                    .'&mode=products'
                ,
                'text' => Loc::getMessage($suffix.".IBLOCK").' ['.$iblockId.'] '.$iblockName,
                'title' => Loc::getMessage($suffix.".IBLOCK").' ['.$iblockId.']'.$iblockName,
                'icon' => '',
                'page_icon' => '',
                'items_id' => 'profile_'.$profileId.'_iblock_'.$iblockId,
            ];
            $tradeIblockId = $iblocksToTradeIblocks[$iblockId];
            if ($tradeIblockId) {
                $filterMenuItems[] = [
                    'sort' => 20 * $count,
                    'url' => '/bitrix/admin/'.$modulePrefix.'_profile_filter.php?'
                        .'profile_id='.$profileId
                        .'&iblock_id='.$tradeIblockId
                        .'&mode=offers'
                    ,
                    'text' =>
                        Loc::getMessage($suffix.".IBLOCK")
                        .' ['.$tradeIblockId.'] '
                        .$iblockName
                        .Loc::getMessage($suffix.".IBLOCK_POSTFIX"),
                    'title' =>
                        Loc::getMessage($suffix.".IBLOCK")
                        .' ['.$tradeIblockId.'] '
                        .$iblockName
                        .Loc::getMessage($suffix.".IBLOCK_POSTFIX"),
                    'icon' => '',
                    'page_icon' => '',
                    'items_id' => 'profile_'.$profileId.'_offer_'.$tradeIblockId,
                ];
            }

            $count++;
        }

        return $filterMenuItems;
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit