<?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;
	
	//if($field->name == 'zony') {
		//$zonys = json_decode($field->rawvalue, true);
	//};/
}
?>
<?php /*
<? if (isset($additionalFields['FIELD']) and !empty($additionalFields['FIELD'])) :?>
	<div class="FIELD"><?php echo $additionalFields['FIELD']; ?></div>
<?php endif;?>
<?php
	foreach($zonys as $key => $zony) {
		echo '<div class="item">';
		echo '<a data-fancybox="zony" data-caption="'.$zony['field10'].'" href="'.explode('#', $zony['field3']['imagefile'])[0].'">
				<img src="'.explode('#', $zony['field3']['imagefile'])[0].'" />
				<div class="title">'.$zony['field10'].'</div>
				<div class="desc">'.$zony['field11'].'</div>
			</a>';
		echo '</div>';
	}
?>
*/?>

<div class="com-content com-article one-blog custom-width-container" 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; ?>">
		<?php 
			jimport( 'joomla.application.module.helper' ); 
			$module = JModuleHelper::getModules('breadcrumbs');
			$attribs['style'] = 'none';
			foreach($module as $moduleitem){
				echo JModuleHelper::renderModule($moduleitem, $attribs);
			}
		?>
		<div class="page-header minus-h1">
			<h1 class="minus-h1"> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1>
		</div>
		<div class="article-item-box">
			<div class="minus30">
				<?php echo LayoutHelper::render('joomla.content.full_image', $this->item); ?>
			</div>
			<div itemprop="articleBody" class="com-content-article-body article-body">
				<?php echo $this->item->text; ?>
			</div>
		</div>
		<?php
			$document = &JFactory::getDocument();
			$renderer = $document->loadRenderer('modules');
			$options = array('style' => 'none');
			$position = 'article-in';
			echo $renderer->render($position, $options, null);
		?>
	</div>
	<div class="one-container container"></div>
</div>