<?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\Text;
use Joomla\CMS\Layout\FileLayout;
use Joomla\CMS\Layout\LayoutHelper;

$app = Factory::getApplication();

$this->category->text = $this->category->description;
$app->triggerEvent('onContentPrepare', [$this->category->extension . '.categories', &$this->category, &$this->params, 0]);
$this->category->description = $this->category->text;

$results = $app->triggerEvent('onContentAfterTitle', [$this->category->extension . '.categories', &$this->category, &$this->params, 0]);
$afterDisplayTitle = trim(implode("\n", $results));

$results = $app->triggerEvent('onContentBeforeDisplay', [$this->category->extension . '.categories', &$this->category, &$this->params, 0]);
$beforeDisplayContent = trim(implode("\n", $results));

$results = $app->triggerEvent('onContentAfterDisplay', [$this->category->extension . '.categories', &$this->category, &$this->params, 0]);
$afterDisplayContent = trim(implode("\n", $results));

$htag    = $this->params->get('show_page_heading') ? 'h2' : 'h1';

?>
<div class="reviews-blog one-blog blog page-sect site-grid custom-width-container" itemscope itemtype="https://schema.org/Blog">
	<div class="container">
		<?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="minus30">
			<div class="mod-articles-flash mod-reviews">
				<?php if (!empty($this->intro_items)) : ?>
					<div class="row row-reviews">
					<?php foreach ($this->intro_items as $key => &$item) : ?>
						<div class="col-12 col-sm-6 col-md-4 show-more-item">
							<div class="item" itemprop="blogPost" itemscope itemtype="https://schema.org/BlogPosting">
								<?php
									$this->item = & $item;
									echo $this->loadTemplate('item');
								?>
							</div>
						</div>
					<?php endforeach; ?>
					</div>
				<?php endif; ?>
				<center class="show-more">
					<button class="show-more-btn show-more-btn-review">Показать ещё отзывовы</button>
				</center>
			</div>
		</div>
	</div>
	<div class="one-container container reviews-button">
		<?php 
			jimport( 'joomla.application.module.helper' ); 
			$module = JModuleHelper::getModules('reviews-button');
			$attribs['style'] = 'none';
			foreach($module as $moduleitem){
				echo JModuleHelper::renderModule($moduleitem, $attribs);
			}
		?>
	</div>
	<script>
		$(document).ready(function() {
			var list = $(".row-reviews .show-more-item");
			var numToShow = 6; //сколько показывать элементов
			var button = $(".show-more-btn-review");
			var numInList = list.length;
			list.hide();
			if (numInList > numToShow) {
				button.show();
			}
			list.slice(0, numToShow).show();
			button.click(function() {
				var showing = list.filter(':visible').length;
				list.slice(showing - 1, showing + numToShow).fadeIn();
				var nowShowing = list.filter(':visible').length;
				if (nowShowing >= numInList) {
					button.hide();
				}
			});
		});
	</script>
</div>
