<?php

/**
 * @version        1.11.1
 * @package        Joomla
 * @subpackage     EDocman
 * @author         Tuan Pham Ngoc
 * @copyright      Copyright (C) 2011 - 2024 Ossolution Team
 * @license        GNU/GPL, see LICENSE.php
 */

// no direct access
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
use Joomla\Filesystem\File;
use Joomla\CMS\Uri\Uri;
use Joomla\Filesystem\Path;
?>
<style>
.edocman-page-heading
{
	font-size: <?php echo ($this->config->heading_font_size == '') ? '30' : $this->config->heading_font_size; ?>px !important;
}
</style>
<div id="edocman-categories-page" class="edocman-container">
	<?php
		if (!$this->categoryId)
		{
			if ($this->params->get('page_heading'))
			{
				$heading = $this->params->get('page_heading');
			}
			else
			{
				$heading = Text::_('EDOCMAN_CATEGORIES');
			}
		?>
			<h1 class="edocman-page-heading"><i class="edicon edicon-folder-open"></i>&nbsp;<?php echo $heading; ?></h1>
		<?php
		}
		else
		{
			if ($this->category->image && is_file(Path::clean(JPATH_ROOT.'/media/com_edocman/category/thumbs/'.$this->category->image)))
			{
				$imgUrl = Uri::base().'media/com_edocman/category/thumbs/'.$this->category->image;
			}
			else
			{
				if (!isset($this->config->show_default_category_thumbnail) || $this->config->show_default_category_thumbnail)
				{
					$imgUrl = Uri::base().'components/com_edocman/assets/images/icons/32x32/folder.png' ;
				}
				else
				{
					$imgUrl = '';
				}
			}
			?>
			<div id="edocman-category">
				<h1 class="edocman-page-heading"><?php echo $this->category->title;?>&nbsp;<i class="edicon edicon-rss"></i></h1>
					<div class="edocman-page-sub-box">
					<?php
						if ($imgUrl)
						{
							?>
							<img class="edocman-thumb-left" src="<?php echo $imgUrl; ?>" alt="<?php echo $this->category->title; ?>" />
							<?php
						}
						if($this->category->description != '')
						{
							?>
							<div class="edocman-description">
								<?php echo $this->category->description; ?>
							</div>
							<?php
						}
					?>
				</div>
			</div>
		<?php
		}
		
		$open_documents = $this->params->get('open_documents', 1);
		echo EDocmanHelperHtml::loadCommonLayout('common/categories_table_tree.php', array('categories' => $this->items, 'categoryId' => $this->categoryId, 'config' => $this->config, 'bootstrapHelper' => $this->bootstrapHelper, 'Itemid' => $this->Itemid, 'subscat' => 1 , 'number_categories' => $this->config->number_categories_per_row, 'open_documents' => $open_documents));
		if ($this->pagination->total > $this->pagination->limit)
		{
		?>
			<div class="pagination">
				<?php echo $this->pagination->getPagesLinks(); ?>
			</div>
		<?php
		}
	?>
</div>
