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/yandex.market/lib/ui/trading/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/yandex.market/lib/ui/trading/orderviewtabset.php
<?php

namespace Yandex\Market\Ui\Trading;

use Bitrix\Main;
use Yandex\Market;

class OrderViewTabSet extends Market\Ui\Reference\Page
{
	use Market\Reference\Concerns\HasLang;

	protected $setup;
	protected $externalId;
	protected $parameters;
	protected $template;

	protected static function includeMessages()
	{
		Main\Localization\Loc::loadMessages(__FILE__);
	}

	public function __construct(Market\Trading\Setup\Model $setup, $externalId, array $parameters = [])
	{
		parent::__construct();

		$this->setup = $setup;
		$this->externalId = $externalId;
		$this->parameters = $parameters;
	}

	protected function getReadRights()
	{
		return Market\Ui\Access::RIGHTS_PROCESS_TRADING;
	}

	public function checkSupport()
	{
		$router = $this->setup->getService()->getRouter();
		$environment = $this->setup->getEnvironment();

		$router->getDataAction('admin/view', $environment);
	}

	public function initialize()
	{
		return [
			'TABSET' => Market\Config::getLangPrefix() . 'TRADING_ORDER',
			'GetTabs' => [$this, 'getTabs'],
			'ShowTab' => [$this, 'showTab'],
		];
	}

	public function getTabs()
	{
		return [
			[
				'DIV' => 'VIEW',
				'TAB' => $this->getTabTitle(),
				'SHOW_WRAP' => 'N',
				'ONSELECT' => 'yamarketLoadTab("yamarket-adm-order-view-tab", true);',
			],
		];
	}

	public function preloadAssets()
	{
		Market\Utils\Component\Assets::preloadCss('yandex.market:trading.order.view', $this->template ?: false);
		Market\Ui\Library::loadConditional('jquery', Main\Page\AssetLocation::AFTER_JS);
	}

	public function showTab()
	{
		?>
		<tr>
			<td>
				<div class="adm-detail-title">
					<?= $this->getTitle() ?>
					<small>
						<a href="#" onclick="yamarketLoadTab('yamarket-adm-order-view-tab'); return false;"><?= $this->getSelfMessage('REFRESH') ?></a>
					</small>
				</div>
				<?php
				try
				{
					$this->preloadAssets();

					$url = $this->getContentsUrl();

					?>
					<div class="adm-detail-content-item-block" style="position:relative; vertical-align:top" id="yamarket-adm-order-view-tab" data-url="<?= htmlspecialcharsbx($url) ?>">
						<img src="/bitrix/images/sale/admin-loader.gif" alt=""/>
					</div>
					<!--suppress JSUnresolvedReference -->
					<script>
						yamarketCheckTab('yamarket-adm-order-view-tab');

						function yamarketLoadTab(id, firstLoad) {
							const node = document.getElementById(id);
							const url = node.getAttribute('data-url');
							const loadState = node.getAttribute('data-load');

							if (
								url
								&& loadState !== 'pending'
								&& (!firstLoad || loadState !== 'ready')
							) {
								node.setAttribute('data-load', 'pending');
								node.innerHTML = '<img src="/bitrix/images/sale/admin-loader.gif" alt=""/>';

								BX.ajax({
									url: url,
									scriptsRunFirst: false,
									onsuccess: function(html) {
										const callback = function() {
											BX.removeCustomEvent('onAjaxSuccessFinish', callback);
											BX.onCustomEvent(BX(node), 'onYaMarketContentUpdate', [
												{ target: node }
											]);
										};

										node.innerHTML = html;
										node.setAttribute('data-load', 'ready');

										BX.addCustomEvent('onAjaxSuccessFinish', callback);
									},
									onfailure: function() {
										node.setAttribute('data-load', 'fail');
									}
								});
							}
						}

						function yamarketCheckTab(id) {
							const node = document.getElementById(id);

							if (node.offsetWidth > 0 || node.offsetHeight > 0) { // is visible
								yamarketLoadTab(id);
							}
						}
					</script>
					<?php
				}
				catch (Main\SystemException $exception)
				{
					?>
					<div class="adm-detail-content-item-block">
						<?php
						\CAdminMessage::ShowMessage($exception->getMessage());
						?>
					</div>
					<?php
				}
				?>
			</td>
		</tr>
		<?php
	}

	public function getContentsUrl(array $query = [])
	{
		return Market\Ui\Admin\Path::getModuleUrl('trading_order_view', $query + array_filter([
			'lang' => LANGUAGE_ID,
			'view' => 'tab',
			'id' => $this->externalId,
			'campaign' => $this->setup->getCampaignId(),
			'site' => $this->setup->getSiteId(),
			'template' => $this->template,
		]));
	}

	public function setTemplate($name)
	{
		$this->template = $name;
	}

	public function getTitle()
	{
		return $this->getSelfMessage('ORDER', [ '#EXTERNAL_ID#' => $this->externalId ]);
	}

	public function getTabTitle()
	{
		return $this->getServiceMessage('TAB');
	}

	public function getNavigationTitle()
	{
		return $this->getServiceMessage('NAVIGATION');
	}

	protected function getServiceMessage($key, $replaces = null)
	{
		$serviceKey = 'ORDER_VIEW_' . $key;
		$result = (string)$this->setup->getService()->getInfo()->getMessage($serviceKey, $replaces, '');

		if ($result === '')
		{
			$result = $this->getSelfMessage($key, $replaces);
		}

		return $result;
	}

	protected function getSelfMessage($key, $replaces = null, $fallback = null)
	{
		return static::getLang('UI_TRADING_ORDER_VIEW_TABSET_' . $key, $replaces, $fallback);
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit