%PDF- %PDF- 403WebShell
403Webshell
Server IP : 37.220.80.31  /  Your IP : 18.117.7.212
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/report/install/components/bitrix/report.analytics.base/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/www-root/data/www/dev.artlot24.ru/bitrix/modules/report/install/components/bitrix/report.analytics.base/class.php
<?php
if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true) die();

class ReportAnalyticsBase extends CBitrixComponent
{

	private $reportGroups = [];

	public function executeComponent()
	{
		if (!\Bitrix\Main\Loader::includeModule('report'))
		{
			$this->showError('Module report isn\'t installed');
			return;
		}

		$this->reportGroups = $this->arParams['REPORT_GROUPS'];

		$this->arResult['VIEW_MODE'] = \Bitrix\Main\Application::getInstance()->getContext()->getRequest()->get('mode');
		$this->arResult['LEFT_MENU_ITEMS'] = $this->getLeftMenuItemsCollection();
		$this->arResult['MENU_ITEMS'] = $this->getLeftMenuItems();
		$this->arResult['ANALYTIC_BOARD_LEFT_TITLE'] = $this->arParams['PAGE_TITLE'];

		$currentAnalyticBoardKey = $this->getCurrentAnalyticBoardKey();
		$this->arResult['ANALYTIC_BOARD_KEY'] = $currentAnalyticBoardKey;
		$currentAnalyticBoard = $this->getAnalyticBoardByKey($currentAnalyticBoardKey);
		if(!$currentAnalyticBoard)
		{
			$this->showError("Report board is not found");
			return;
		}

		$this->arResult['ANALYTIC_BOARD_TITLE'] = $currentAnalyticBoard ? $currentAnalyticBoard->getTitle() : '';
		$this->arResult['ANALYTIC_BOARD_COMPONENT_NAME'] = $currentAnalyticBoard ? $currentAnalyticBoard->getDisplayComponentName() : '';
		$this->arResult['ANALYTIC_BOARD_COMPONENT_TEMPLATE_NAME'] = $currentAnalyticBoard ? $currentAnalyticBoard->getDisplayComponentTemplate() : '';
		$this->arResult['ANALYTIC_BOARD_COMPONENT_PARAMS'] = $currentAnalyticBoard ? $currentAnalyticBoard->getDisplayComponentParams() : [];
		$this->includeComponentTemplate();
	}

	private function showError($message)
	{
		echo <<<HTML
            <div class="ui-alert ui-alert-danger ui-alert-icon-danger">
                <span class="ui-alert-message">{$message}</span>
            </div>
HTML;
		return;
	}
	/**
	 * @param string $firstBoardBatch
	 * @return null
	 * @throws \Bitrix\Main\SystemException
	 */
	private function getCurrentAnalyticBoardKey($firstBoardBatch = "")
	{
		static $result = null;
		if(is_null($result))
		{
			$analyticBoardKey = \Bitrix\Main\Application::getInstance()->getContext()->getRequest()->get('analyticBoardKey');
			if (!$analyticBoardKey)
			{
				$boardList = $this->getAnalyticsBoardsList($firstBoardBatch);
				if (!empty($boardList))
				{
					$analyticBoardKey = $boardList[0]->getMachineKey();
				}
			}
			$result = $analyticBoardKey ?: null;
		}
		return $result;
	}

	private function getLeftMenuItems()
	{
		$batchList = $this->getAnalyticsBoardsBatchList();
		$items = [];
		foreach ($batchList as $batch)
		{
			$items[$batch->getKey()] = [
				'NAME' => $batch->getTitle(),
				'ATTRIBUTES' => [
					'bx-hide-active' => 'Y'
				],
				'CHILDREN' => []
			];
		}
		$boardList = $this->getAnalyticsBoardsList();
		$currentAnalyticBoardKey = $this->getCurrentAnalyticBoardKey($batchList[0]->getKey());
		foreach ($boardList as $board)
		{
			$item = [
				'NAME' => $board->getTitle(),
				'ATTRIBUTES' => [
					'href' => "?analyticBoardKey=" . $board->getBoardKey(),
					'title' => $board->getTitle(),
					'DATA' => [
						'role' => 'report-analytics-menu-item',
						'report-board-key' => $board->getBoardKey(),
						'is-external' => $board->isExternal() ? 'Y' : 'N',
						'external-url' => $board->getExternalUrl(),
						'is-slider-support' => $board->isSliderSupport() ? 'Y' : 'N'
					]
				]
			];

			if ($board->getBoardKey() == $currentAnalyticBoardKey)
			{
				$item['ACTIVE'] = true;
			}

			if ($board->isNestedInBatch())
			{
				$items[$board->getBatchKey()]['CHILDREN'][$board->getBoardKey()] = $item;
			}
			else
			{
				$items[] = $item;
			}
		}

		return $items;
	}

	private function getLeftMenuItemsCollection()
	{
		$batchList = $this->getAnalyticsBoardsBatchList();
		$items = [];
		foreach ($batchList as $batch)
		{
			$items[$batch->getKey()] = [
				'IS_BATCH' => true,
				'BATCH_KEY'	=> $batch->getKey(),
				'BATCH_TITLE' => $batch->getTitle(),
				'BOARD_LIST' => []
			];
		}
		$boardList = $this->getAnalyticsBoardsList();
		foreach ($boardList as $board)
		{
			if ($board->isNestedInBatch())
			{
				$items[$board->getBatchKey()]['BOARD_LIST'][$board->getBoardKey()] = $board;
			}
			else
			{
				$items[] = [
					'IS_BATCH' => false,
					'BOARD' => $board
				];
			}
		}

		return $items;
	}


	/**
	 * @return \Bitrix\Report\VisualConstructor\AnalyticBoard[]
	 */
	private function getAnalyticsBoardsList($boardBatchKey = "")
	{
		$defaultBoardProvider = new \Bitrix\Report\VisualConstructor\RuntimeProvider\AnalyticBoardProvider();
		if($boardBatchKey != "")
		{
			$defaultBoardProvider->addFilter("boardBatchKey", $boardBatchKey);
		}

		foreach ($this->reportGroups as $group)
		{
			$defaultBoardProvider->addFilter('group', $group);
		}

		return $defaultBoardProvider->execute()->getResults();
	}

	/**
	 * @param $key
	 * @return \Bitrix\Report\VisualConstructor\AnalyticBoard | null
	 */
	private function getAnalyticBoardByKey($key)
	{
		$analyticBoardProvider = new \Bitrix\Report\VisualConstructor\RuntimeProvider\AnalyticBoardProvider();
		$analyticBoardProvider->addFilter('boardKey', $key);
		return $analyticBoardProvider->execute()->getFirstResult();

	}
	/**
	 * @return \Bitrix\Report\VisualConstructor\AnalyticBoardBatch[]
	 */
	private function getAnalyticsBoardsBatchList()
	{
		static $result = null;
		if(is_null($result))
		{
			$batchProvider = new \Bitrix\Report\VisualConstructor\RuntimeProvider\AnalyticBoardBatchProvider();

			foreach ($this->reportGroups as $group)
			{
				$batchProvider->addFilter('group', $group);
			}

			$list = $batchProvider->execute()->getResults();
			$result = $list;
		}
		return $result;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit