<?php Yii::app()->clientScript->registerCssFile(Yii::app()->theme->baseUrl . '/css/grid.css'); ?>

<?php
$columnas = array(
    //'id',
    array(
        'type' => 'html',
        'name' => 'nombreCompleto',
        'value' => 'CHtml::link(CHtml::encode($data->nombreCompleto), array("update", "id"=>$data->id));',
        'headerHtmlOptions' => array(
            'class' => 'sorting',
        ),
        'cssClassExpression' => '',
    ),
    array(
        'type' => 'html',
        'name' => 'descripcionEstado',
        'value' => 'CHtml::encode($data->estado->descripcion);',
        'filter' => CHtml::listData(EstadoCandidato::model()->findAll(), 'id', 'descripcion'),
        'headerHtmlOptions' => array(
            'class' => 'sorting',
        ),
        'cssClassExpression' => '',
    ),
    array(
        'name' => 'email',
        'headerHtmlOptions' => array(
            'class' => 'sorting',
        ),
    ),    
    array(
        'type' => 'raw',
        'name' => 'modified_time',
        'value' => '($data->modified_time === NULL) ? CHtml::tag("span", array("class"=>"nodata"), "Nunca") : TimeHelper::timeAgoInWords($data->modified_time);',
        'headerHtmlOptions' => array(
            'class' => 'sorting',
        ),
        'cssClassExpression' => '"con1"',
        'filter' => false,
    ),
    array(
        'header' => Yii::t('profind', 'Acciones'),
        'class' => 'CButtonColumn',
        'headerHtmlOptions' => array(
            'style' => 'width:55px;',
            'class' => '',
        ),
        'template' => '{delete}',
        'buttons' => array(
            'delete' => array(
                'label' => Yii::t('profind', 'Eliminar'),
                //'visible' => '$data->canDelete',
                'imageUrl' => '',
                'options' => array(
                    'class' => 'btn btn-small delete'
                )
            )
        ),
    ),
);




$gridView = $this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'candidato-grid',
    'dataProvider' => $candidatos->search(),
    'columns' => $columnas,
    'filter' => $candidatos,
    'filterPosition' => 'header',
    'cssFile' => false,
    'htmlOptions' => array('class' => 'dataTables_wrapper form-inline'),
    'itemsCssClass' => 'table table-striped table-bordered dataTable',
    'template' => '{items}{summary}{pager}',
    'emptyText' => Yii::t('profind', 'No hay candidatos'),
    'summaryCssClass' => 'dataTables_info',
    'pagerCssClass' => 'dataTables_paginate paging_bootstrap_alt pagination',
    'pager' => array(
        'htmlOptions' => array('class' => ''),
        'header' => '',
        'hiddenPageCssClass' => 'disabled',
    ),
), true);
?>

<div class="row-fluid">
    <div class="span12">
        <h3 class="heading"><?php echo Yii::t('profind', 'BD Candidatos'); ?></h3>
        <div class="row-fluid sepH_b">
            <div class="span8">
                <div class="btn-toolbar">
                        <?php echo CHtml::link(CHtml::tag('i', array('class' => 'icon-plus'), '') . ' ' . Yii::t('profind', 'Nuevo candidato'), 
                                $this->createUrl('create'), 
                                array('class' => 'btn')
                        ); ?>
                        <?php echo CHtml::link(CHtml::tag('i', array('class' => 'icon-filter'), '') . ' ' . Yii::t('profind', 'Filtro'), '', 
                                array(
                                    'onclick' => '$("tr.filters").toggle(); $(this).toggleClass("active");',
                                    'class' => 'btn active')
                                ); ?>
                </div>
            </div>
        </div>
        <?php echo $gridView; ?>      
    </div>
</div>

