<?php
/**
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 *
 * @category   BL
 * @package    BL_CustomGrid
 * @copyright  Copyright (c) 2012 Benoît Leulliette <benoit.leulliette@gmail.com>
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
?>
<?php $_gridModel = $this->getGridModel(); ?>
<?php if (!$this->getIsStandAlone()): ?>
    <div class="blcg-custom-grid-config-switch">
        <?php echo $this->getCustomizeButtonHtml() ?>
    </div>
<?php endif ?>
<div class="blcg-custom-grid-config" id="<?php echo $this->getHtmlId() ?>" <?php if (!$this->getIsStandAlone()): ?>style="display:none;"<?php endif ?>>
    <div id="<?php echo $this->getHtmlId() ?>-header">
        <input type="hidden" name="form_key" value="<?php echo $this->getFormKey() ?>" />
        <?php if (!$this->getIsStandAlone()): ?>
            <input type="hidden" name="grid_id" value="<?php echo $_gridModel->getGridId() ?>" />
        <?php endif ?>
        <?php if (!$this->getIsNewModel()): ?>
            <?php if ($_filterParam = $this->getGridFilterParamValue()): ?>
                <input type="hidden" name="filter_param_name" value="<?php echo $this->getGridFilterParamName() ?>" />
                <input type="hidden" name="filter_param_value" value="<?php echo $this->htmlEscape($_filterParam) ?>" />
            <?php endif ?>
        <?php endif ?>
        <table class="massaction" cellspacing="0" cellpadding="0">
            <tr>
                <td>
                    <?php if ($this->canDisplayColumnsConfig()): ?>
                        <a onclick="return <?php echo $this->getJsObjectName() ?>.selectAll();" href="#"><?php echo $this->__('Select All') ?></a>
                        <span class="separator">|</span>
                        <a onclick="return <?php echo $this->getJsObjectName() ?>.unselectAll();" href="#"><?php echo $this->__('Unselect All') ?></a>
                        <span class="separator">|</span>
                        <strong id="<?php echo $this->getHtmlId() ?>-count">0</strong> <?php echo $this->__('columns selected') ?>
                        (<strong id="<?php echo $this->getHtmlId() ?>-filter-count">0</strong> <?php echo $this->__('for filtering only') ?>)
                    <?php else: ?>
                        <strong><?php echo $this->__('Grid Customization') ?></strong>
                    <?php endif ?>
                </td>
                <td>
                    <div class="right">
                        <div class="entry-edit">
                            <fieldset>
                                <?php if ($this->canDisplayGridInfos() && !$this->getDefaultGridInfos()): ?>
                                    <span class="field-row">
                                        <?php echo $this->getToggleGridInfosButtonHtml() ?>
                                    </span>
                                <?php endif ?>
                                <?php if ($this->canDisplayAdditional() && !$this->getDefaultAdditional()): ?>
                                    <span class="field-row">
                                        <?php echo $this->getToggleAdditionalButtonHtml() ?>
                                    </span>
                                <?php endif ?>
                                <?php if ($this->canDisplayColumnsConfig()): ?>
                                    <?php if ($_gridModel->canHaveAttributeColumns()): ?>
                                        <span class="field-row">
                                            <?php echo $this->getAddColumnButtonHtml() ?>
                                        </span>
                                    <?php endif ?>
                                    <?php if (!$this->getIsStandAlone()): ?>
                                        <span class="field-row">
                                            <?php echo $this->getSaveButtonHtml() ?>
                                        </span>
                                    <?php endif ?>
                                <?php endif ?>
                            </fieldset>
                        </div>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <?php echo $this->getGridInfosHtml() ?>
    <?php echo $this->getAdditionalHtml() ?>
    <?php echo $this->getColumnsConfigHtml() ?>
</div>