<?php
/**
 * ThunderSnarf
 *
 * @author Ricardo H.F. Sette P. <ricardohfsp@gmail.com>
 * @link http://www.freebsdbrasil.com.br/
 * @copyright Copyright &copy; 2010 - FreeBSD Brasil LTDA
 * @license licença GNU/GPL v2.0 http://www.gnu.org/licenses/gpl-2.0.html
 */
?>
<?php
$this->breadcrumbs=array(
	'Usuários'=>array('index'),
	'administração',
);

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

<h1>Administrando Usuários</h1>


<?php echo CHtml::link('Filtro','#',array('class'=>'search-button')); ?>
&nbsp;
<?php echo CHtml::link('Novo Usuário',array('user/create')); ?>

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

<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'user-grid',
	'dataProvider'=>$model->search(),
	'summaryText'=>'Exibindo {start} até {end} de {count} resultado(s).',
	'columns'=>array(
		array(
			'name'=>'id',
			'value'=>'CHtml::link(CHtml::encode($data->id), array("view", "id"=>$data->id))',
			'type'=>'html'
		),
		'username',
		'email',
	    array(
	        'name'=>'last_acess',
	        'value'=>'date(\'d-m-Y H:i:s\',$data->last_acess)',
	    ),
		'last_ip',
		array(
			'class'=>'CButtonColumn',
		),
	),
)); ?>
