<?php


namespace Benhauer\Salesmanago\Block\Adminhtml\Client;

use Magento\Config\Block\System\Config\Tabs;

class IndexMenu extends Tabs
{
    protected $_template = 'Benhauer_Salesmanago::plugin_menu.phtml';
    protected $tabs;
    protected $store = 0;

    public function __construct(
        \Magento\Backend\Block\Template\Context $context,
        \Magento\Config\Model\Config\Structure $configStructure,
        \Magento\Backend\Helper\Data $backendHelper,
        array $data = []
    ) {
        $this->_backendHelper = $backendHelper;
        parent::__construct($context, $configStructure, $backendHelper, $data);

        $this->setId('salesmanago_config_tabs');
        $this->setTitle(__('Configuration '));
    }

    public function getMenuItems()
    {
        return [
            ['item' => 'index', 'class' => '', 'url' => '*/*/index', 'label' => 'Welcome', 'active' => false],
            ['item' => 'export', 'class' => '', 'url' => '*/*/exportdata', 'label' => 'Export Data', 'active' => false]

        ];
    }

    public function addFilter(\Magento\Framework\Api\Filter $filter)
    {
        return null;
    }

    public function isItemActive($item)
    {
        if (strpos($this->getCurrentUrl(), str_replace('*/*', '', $item['url'])) !== false) {
            return true;
        } else {
            return false;
        }
    }

    public function getUrl($route = '', $params = [])
    {
        if ($store = $this->_request->getParam('store')) {
            $params = array_merge($params, ['store' => $store]);
        }

        return $this->_urlBuilder->getUrl($route, $params);
    }
}
