<form id="smart-block-form" method="post" action="">
<fieldset class='toggle <?php echo $this->openOption ? "" : "closed"?>' id='smart_block_options'>
<legend style='cursor: pointer;'><span class='ui-icon ui-icon-triangle-2-n-s'></span>Smart Block Options</legend>
    <dl class='zend_form search-criteria'>
        <div class='btn-toolbar clearfix'>
            <div class='btn-group pull-right'>
                <?php echo $this->element->getElement('generate_button') ?>
            </div>
            <div class='btn-group pull-right'>
                <?php echo $this->element->getElement('shuffle_button') ?>
            </div>
        </div>
        <div id='sp-success' class='success' style='display:none'></div>
        <dd id='sp_type-element'>
            <label class='sp-label'>
            <?php echo $this->element->getElement('sp_type')->getLabel() ?>
            <span class='playlist_type_help_icon'></span>
            </label>
            <?php $i=0;
                  $value = $this->element->getElement('sp_type')->getValue();
                  foreach ($this->element->getElement('sp_type')->getMultiOptions() as $radio) : ?>
                  
                  <label class='sp-label' for='sp_type-<?php echo $i?>'>
                      <input type="radio" value="<?php echo $i ?>" id="sp_type-<?php echo $i ?>" name="sp_type" <?php if($i == $value){echo 'checked="checked"';}?> ><?php echo $radio ?>
                  </label>
            <?php $i = $i + 1; ?>
            <?php endforeach; ?>
        </dd>
        
        <dd id='sp_criteria-element' class='criteria-element'>
        <?php for ($i = 0; $i < $this->criteriasLength; $i++) {?>
        <?php for ($j = 0; $j < $this->modRowMap[$i]; $j++) {?>
            <div <?php if (($i > 0) && ($this->element->getElement("sp_criteria_field_".$i."_".$j)->getAttrib('disabled') == 'disabled')) {
                           echo 'style=display:none';
                       } ?>>
                <?php echo $this->element->getElement("sp_criteria_field_".$i."_".$j) ?>
                <a class='btn btn-small' id='modifier_add_<?php echo $i ?>'>
                    <i class='icon-white icon-plus'></i>
                </a>
                <?php echo $this->element->getElement("sp_criteria_modifier_".$i."_".$j) ?>
                <?php echo $this->element->getElement("sp_criteria_value_".$i."_".$j) ?>
                <span class='sp_text_font' id="extra_criteria" <?php echo $this->element->getElement("sp_criteria_extra_".$i."_".$j)->getAttrib("disabled") == "disabled"?'style="display:none;"':""?>> to <?php echo $this->element->getElement('sp_criteria_extra_'.$i."_".$j) ?></span>

                <a style='margin-right:3px' class='btn btn-small btn-danger' id='criteria_remove_<?php echo $i ?>'>
                    <i class='icon-white icon-remove'></i>
                </a>
                <?php if($this->element->getElement("sp_criteria_field_".$i."_".$j)->hasErrors()) : ?>
                    <?php foreach($this->element->getElement("sp_criteria_field_".$i."_".$j)->getMessages() as $error): ?>
                    <span class='errors sp-errors'>
                       <?php echo $error; ?>
                    </span>
                    <?php endforeach; ?>
                <?php endif; ?>
            </div>
            <?php } ?>
            
        <?php } ?>
        <br />
        </dd>
        
        <dd id='sp_limit-element'>
            <span class='sp_text_font'><?php echo $this->element->getElement('sp_limit_value')->getLabel() ?></span>
            <?php echo $this->element->getElement('sp_limit_value')?>
            <?php echo $this->element->getElement('sp_limit_options') ?>
            <?php if($this->element->getElement("sp_limit_value")->hasErrors()) : ?>
                <?php foreach($this->element->getElement("sp_limit_value")->getMessages() as $error): ?>
                <span class='errors sp-errors'>
                   <?php echo $error; ?>
                </span>
                <?php endforeach; ?>
            <?php endif; ?>
        <br />
        </dd>

        <?php if ($this->showPoolCount) { ?>
            <div class='sp_text_font sp_text_font_bold'>
                <span id='sp_pool_count' class='sp_text_font sp_text_font_bold'>
                <?php
                if ($this->poolCount > 1) {
                    echo $this->poolCount;
                ?>
                    files meet the criteria
                    </span>
                    <span class='checked-icon sp-checked-icon' id='sp_pool_count_icon'></span>
                <?php
                } else if ($this->poolCount == 1) {
                    echo $this->poolCount;
                ?>
                    file meets the criteria
                    </span>
                    <span class='checked-icon sp-checked-icon' id='sp_pool_count_icon'></span>
                <?php
                } else {
                ?>
                    0 files meet the criteria
                    </span>
                    <span class='sp-warning-icon' id='sp_pool_count_icon'></span>
                <?php
                }
                ?>
            </div>
        <?php } ?>
        
        
    </dl>
</fieldset>
</form>