<?php
/* @var $this UserController */
/* @var $model User */

$this->breadcrumbs = array(
    yii::t('default', 'Configurations') => array('/dashboard/configuration'),
    yii::t('default', 'Users') => array('index'),
    yii::t('default', 'Manage'),
);
?>

<?php echo CHtml::link(Yii::t('default', 'Add'), array('create'), array('class' => 'btn btn-primary', 'data-dismiss' => 'modal')); ?>
&nbsp;


<div id="flash-msg">
    <br>
    <?php $this->widget('bootstrap.widgets.TbAlert'); ?>
</div>


<?php
    $this->widget('ext.bootstrap.widgets.TbGridView', array(
        'id' => 'user-grid',
        'dataProvider' => $model->search(),
        'type' => 'striped',
        'filter' => $model,
        'columns' => array(
            'username',
            'email',
            array(
                'name' => 'location',
                'value' => '$data->location',
                'filter' => CHtml::listData(Location::getAll(), 'code', 'code')
            ),
            array(
                'name' => 'role',
                'value' => '$data->role',
                'filter' => User::getUserRoleOptions()
            ),
            array(
                'name' => 'status',
                'type' => 'html',
                'value' => 'CHtml::link(CHtml::image(Yii::app()->request->baseUrl."/css/flags/".$data->status.".png", "img")  ,"#",array("rel"=>"tooltip","title"=>Yii::t(\'default\',$data->status)))',
                'filter' => array('Active' => Yii::t('default', 'Active'), 'Inactive' => Yii::t('default', 'Inactive')),
                'htmlOptions' => array('style' => 'text-align:center;'),
            ),
            array
                (
                'class' => 'CButtonColumn',
                'htmlOptions' => array('width' => '60'),
                'afterDelete' => 'function(link,success,data){ if(success) $("#flash-msg").html(data); }',
            ),        
        ),
    ));
?>
