<?php

/**
 * @package     Joomla.Site
 * @subpackage  com_content
 *
 * @copyright   (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Associations;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
use Joomla\Component\Content\Administrator\Extension\ContentComponent;
use Joomla\Component\Content\Site\Helper\RouteHelper;

// Create shortcuts to some parameters.
$params  = $this->item->params;
$canEdit = $params->get('access-edit');
$user    = Factory::getUser();
$info    = $params->get('info_block_position', 0);
$htag    = $this->params->get('show_page_heading') ? 'h2' : 'h1';

// Check if associations are implemented. If they are, define the parameter.
$assocParam        = (Associations::isEnabled() && $params->get('show_associations'));
$currentDate       = Factory::getDate()->format('Y-m-d H:i:s');
$isNotPublishedYet = $this->item->publish_up > $currentDate;
$isExpired         = !is_null($this->item->publish_down) && $this->item->publish_down < $currentDate;

$additionalFields = array();
foreach($this->item->jcfields as $field) {
	$additionalFields[$field->name] = $field->value;
}
?>

<div class="com-contact com-article item-page<?php echo $this->pageclass_sfx; ?> page-sect sect-xs-3 sect-md-5 sect-xl-7" itemscope itemtype="https://schema.org/Article">
	<div class="container">
		<meta itemprop="inLanguage" content="<?php echo ($this->item->language === '*') ? Factory::getApplication()->get('language') : $this->item->language; ?>">
		<div class="page-header">
			<h1><?php echo $this->escape($this->item->title); ?></h1>
		</div>
		<div itemprop="articleBody" class="com-content-article-body contact-body">
			<?php echo $this->item->text; ?>
		</div>

		<? if (isset($additionalFields['interaktivnaya-karta-2']) and !empty($additionalFields['interaktivnaya-karta-2'])) :?>
			<div class="interaktivnaya-karta page-sect">
				<div class="yandeks-karta">
					<script src="//api-maps.yandex.ru/2.0/?load=package.standard,package.geoObjects&lang=ru-RU" type="text/javascript"></script>
					<div id="map" style="width:100%; height:100%;"></div>
					<?php echo $additionalFields['interaktivnaya-karta-2']; ?>
				</div>
			</div>
		<?php endif;?>
	</div>
</div>