<?php
/**
 * @category    Mana
 * @package     ManaPro_FilterColors
 * @copyright   Copyright (c) http://www.manadev.com
 * @license     http://www.manadev.com/license  Proprietary License
 */
/**
 * Template for showing options for filter as a list of color boxes
 * @author Mana Team
 * Injected instead of standard catalog/layer/filter.phtml in Mana_Filters_Block_Filter_Attribute init() method.
 */
/* @var $this Mana_Filters_Block_Filter */
?>
<ol class="m-filter-colors labels <?php echo $this->getFilterClass() ?> <?php echo $this->getFilterOptions()->getIsReverse() ? 'm-reverse' : '' ?>">
    <?php foreach ($this->getItems() as $_item): ?>

    <li <?php echo $this->getListItemClass($_item) ?> >
        <?php if (!$this->getFilterOptions()->getDisableNoResultOptions() || $_item->getCount() || $_item->getMSelected()): ?>
            <a href="#"
               onclick="jQuery(this).find('div').<?php echo $_item->getMShowSelected() ? 'removeClass' : 'addClass' ?>('selected'); setLocation('<?php echo $this->urlEscape($_item->getMSelected() ? $_item->getRemoveUrl() : $_item->getUrl()) ?>'); return false;">
                <div class="m-color <?php if ($_item->getMShowSelected()): ?>selected<?php endif; ?> <?php echo $this->getFilterValueClass($_item) ?>"
                     title="<?php echo $this->escapeHtml($_item->getLabel()) ?> (<?php echo $_item->getCount() ?>)">
                    <div class="m-layer1"></div>
                </div>
                <?php echo $this->escapeHtml($_item->getLabel()) ?>
            </a>
        <?php else: ?>
            <a href="javascript:void(0)">
                <div class="m-color <?php if ($_item->getMShowSelected()): ?>selected<?php endif; ?> <?php echo $this->getFilterValueClass($_item) ?>"
                     title="<?php echo $this->escapeHtml($_item->getLabel()) ?> (<?php echo $_item->getCount() ?>)">
                    <div class="m-layer1"></div>
                </div>
                <?php echo $this->escapeHtml($_item->getLabel()) ?>
            </a>
        <?php endif; ?>
        <?php if (Mage::getStoreConfigFlag('mana_filters/display/count')) : ?>
        (<?php echo $_item->getCount() ?>)
    <?php endif; ?>
    </li>
    <?php endforeach ?>
</ol>
<?php echo Mage::helper('mana_core')->getNamedHtml('mana_filters/markup', 'after_items', array('block' => $this)) ?>
