<?php $index = ($model->CLF_ID > 0) ? $model->CLF_ID : rand(); ?>

<div class="criterio-local-privilegio">
    <div class="half">
        <label for="CLF_IDLOCAL<?php echo $index; ?>" class="required">Local <span class="required">*</span></label>
        <select id="CLF_IDLOCAL<?php echo $index; ?>" name="CriteriosLocaisPrivilegios[<?php echo $index; ?>][CLF_IDLOCAL]" class="validate[required]" type="text" value="<?php echo $model->CLF_IDLOCAL; ?>">
            <?php
            $locais = Locais::model()->findAll('LOC_SITUACAO=1 and LOC_IDLOCAL <> -1 ORDER BY LOC_DESCRICAO');
            foreach($locais as $local) {
                $append = "";
                if($local->LOC_IDLOCAL == $model->CLF_IDLOCAL) {
                    $append = "selected='selected'";
                }
                echo "<option value='{$local->LOC_IDLOCAL}' {$append}>{$local->LOC_DESCRICAO}</option>";
            }
            ?>
        </select>
    </div><!-- half -->
    <div class="half">
        <label for="CLF_IDPRIVILEGIO<?php echo $index; ?>" class="required">Privilégio <span class="required">*</span></label>
        <select id="CLF_IDPRIVILEGIO<?php echo $index; ?>" name="CriteriosLocaisPrivilegios[<?php echo $index; ?>][CLF_IDPRIVILEGIO]" class="validate[required]"><?php echo $model->CLF_IDPRIVILEGIO; ?>
            <?php
            $privilegios = Util::getPrivilegiosList();
            natcasesort($privilegios);
            foreach($privilegios as $key => $privilegio) {
                $append = "";
                if($key == $model->CLF_IDPRIVILEGIO) {
                    $append = "selected='selected'";
                }
                echo "<option value='{$key}' {$append} >{$privilegio}</option>";
            }
            ?>
        </select>
    </div><!-- half -->
    <a href="javascript:void(0);" class="excluir-criterio-local-privilegio link-excluir-item"><i class="fa fa-times"></i></a>
</div>