<?php 
 /*
 * Copyright 2015 osclass-pro.com
 *
 * You shall not distribute this theme and any its files (except third-party libraries) to third parties.
 * Rental, leasing, sale and any other form of distribution are not allowed and are strictly forbidden.
 */
?>
<?php if ( (!defined('ABS_PATH')) ) exit('ABS_PATH is not loaded. Direct access is not allowed.'); ?>
<?php if ( !OC_ADMIN ) exit('User access is not allowed.'); ?>
<h2 class="render-title"><b><i class="fa fa-cog"></i> <?php _e('Category icons', 'next'); ?></b></h2>
<p><strong><?php _e('Icon must be a PNG file size 150X150px. Enable Use ImageMagick (Show More-Settings-Media) before upload images. Osclass badly work with transparent background .png and GD library.', 'next'); ?></strong></p>
<table>
<?php
$categories = Category::newInstance()->toTreeAll();
foreach($categories as $c) {
	$catid = $c['pk_i_id'];
	$catname = $c['s_name'];
?>
<form name="icons" action="<?php echo osc_admin_render_theme_url('oc-content/themes/next/admin/settings.php'); ?>" method="post" enctype="multipart/form-data" class="nocsrf">
<input type="hidden" name="action_specific" value="category_icons" />
<input type="hidden" name="category_id" id="category_id" value="<?php echo $catid; ?>" />
<tr style="border:1px;">
<td><strong style="font-size:16px;"><?php echo $catname; ?></strong>&nbsp;&nbsp;</td>
<td align="center" style="background-color:#14A7D1;">
<?php
if (file_exists(osc_base_path() . 'oc-content/themes/next/images/' . $catid . '.png')) { ?>
<img width="27" height="27" src="<?php echo osc_current_web_theme_url('images/') . $catid . '.png' ?>" /><br />
<a href="<?php echo osc_admin_render_theme_url('oc-content/themes/next/admin/settings.php'); ?>&action_specific=remove-icon&category_id=<?php echo $catid; ?>"><?php _e('Remove icon', 'next'); ?></a>
<?php
}
else {
_e('No icon', 'next');
} ?>
</td>
<td><input type="file" name="category_icon" id="package" accept="image/x-png"/>
&nbsp;&nbsp;
<button type="submit" class="btn btn-submit btn-success"><?php _e('Upload', 'next'); ?></button>
</td>  
</tr>
</form>
<?php } ?>
</table>
