<?php
$this->breadcrumbs=array(
	Yii::t('intranet', 'Candidatos'),
);

$this->menu=array(
	array(
            'label'=>'<img class="mgright5" alt="Nuevo candidato" src="' . Yii::app()->baseUrl . '/images/icons/small/white/user.png"/>Nuevo candidato',
            'url'=>array('create'),
            'linkOptions'=>array('class'=>'iconlink'),
        ),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('candidato-grid', {
		data: $(this).serialize()
	});
	return false;
});
");

$this->pageTitle=Yii::t('intranet', 'Gestión de candidatos');
?>

<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php /*$this->widget('ext.EDataTables.EDataTables', array(
                'id'            => 'candidatos',
                'options'       => array(
                    'class' => 'dataTables_wrapper',
                ),
                'dataProvider'  => $model->search(),
                //'ajaxUrl'       => Yii::app()->getBaseUrl().'/candidato/index',
                'columns'=>array(
                        'id',
                        'foto',
                        'dni',
                        'nombre',
                        'apellidos',
                        'email',
            )));*/

    
    //$widget->run();
    
    $columns = array(            
        array(
            'type' => 'html',
            'name' => 'nombreApellidos',
            'value' => 'CHtml::link(CHtml::encode($data->nombreApellidos), array("update", "id"=>$data->id));',
            'headerHtmlOptions'=>array(
                'class' => 'head0 sorting', 
                /*'colspan' => '1',
                'rowspan' => '2',*/
            ),
        ),
        array(
            'type' => 'html',
            'name' => 'estado',
            'value' => 'CHtml::link(CHtml::encode($data->estado), "#", array("class" => $data->cssClassEstado));',
            'headerHtmlOptions'=>array(
                'class' => 'head1 sorting', 
                /*'colspan' => '1',
                'rowspan' => '2',*/
            ),
        ),

        array(
            'name' => 'id',
            'headerHtmlOptions'=>array(
                'class' => 'head0 sorting', 
                /*'colspan' => '1',
                'rowspan' => '1',*/
            ),
        ),
        array(
            'name' => 'fecha_modificacion',
            'headerHtmlOptions'=>array(
                'class' => 'head1 sorting', 
                /*'colspan' => '1',
                'rowspan' => '2',*/
            ),
        ),
        array(
            'class'=>'CButtonColumn',
            //'template'=>'{update}{delete}',
            //'updateButtonUrl'=>'Yii::app()->createUrl("/candidato/update", array("id" => $data["id"]))',
            //'deleteButtonUrl'=>'Yii::app()->createUrl("/candidato/delete", array("id" => $data["id"]))',
        ),
    );
    
    
    $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'candidato-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
        'cssFile' => Yii::app()->baseUrl . '/css/gridview2.css',
        'itemsCssClass' => 'display',
        'summaryCssClass' => 'dataTables_length',
        'pagerCssClass' => 'ui-toolbar dataTables_paginate',
        'htmlOptions' => array(
            'class' => 'dataTables_wrapper',
        ),
        'filterPosition' => 'footer',
        'emptyText' => Yii::t('intranet', 'No hay candidatos'),
        'summaryText' => 'Mostrando registros del {start} al {end} de {count} en total.',
	'columns'=>$columns,           
    ));

        echo "<br/><br/><br/><br/>";    

        $this->widget('ext.EDataTables.EDataTables', array(
	'id'            => 'candidato-grid2',
	'dataProvider'  => $model->search(),
        'cssFile'       => Yii::app()->baseUrl . '/css/gridview.css',
        'ajaxUrl'       => Yii::app()->createUrl('/candidato/index'),
        'columns'       => $columns,
        'filter'        => Candidato::model(),
        'filterPosition'=> 'footer',

        //'hasFooter'     => true,
        ));

?>


  