<?php
$this->pageTitle = Yii::t('Users', 'Manage users');
$this->breadcrumbs = array(
$this->module->getMeta('name') => Yii::app()->createUrl($this->module->id.'/'.$this->module->getMeta('admin.controller')),
Yii::t('Users', 'Users list'),
);
Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
$('.search-form').toggle();
return false;
});
$('.search-form form').submit(function(){
$('#user-grid').yiiGridView('update', {
data: $(this).serialize()
});
return false;
});
");
?>
<div class="row-fluid">
<div class="span2">
<div class="well">
<?php $this->module->renderAdminWidget() ?>
</div>
<?php
$items = array();
foreach ($page_size_selector->items as $item=>$label) {
$link = $page_size_selector->makeLink($item);
$link[1]['page'] = 0;
$items[] = array('label' => $label, 'url' => call_user_func_array(array(Yii::app(), 'createUrl'), $link), 'active' => $page_size_selector->selectedItem == $item);
}
?>
<?= TbHtml::stackedTabs($items) ?>
</div>
<div class="span10">
<h2><?= $this->pageTitle ?></h2>
<?= TbHtml::button('Search', array('icon' => 'zoom-in', 'class' => 'search-button')) ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search', array(
'model' => $model,
)); ?>
</div><!-- search-form -->
<hr/>
<?php $this->widget('bootstrap.widgets.TbGridView', array(
'id' => 'user-grid',
'type' => TbHtml::GRID_TYPE_STRIPED.' '.TbHtml::GRID_TYPE_BORDERED.' '.TbHtml::GRID_TYPE_CONDENSED,
'dataProvider' => $model->search($page_size_selector->selectedItem),
'filter' => $model,
'template' => "{items}\n{summary}\n{pager}",
'columns' => array(
'id',
'email',
'visited_at' => array(
'name' => 'visited_at',
'value' => 'TbHtml::tooltip(Yii::app()->dateFormatter->formatDateTimeInterval($data->visited_at), "#", Yii::app()->dateFormatter->formatDateTimeReadable($data->visited_at))',
'type' => 'raw',
),
'registrated_at' => array(
'name' => 'registrated_at',
'value' => 'TbHtml::tooltip(Yii::app()->dateFormatter->formatDateTimeInterval($data->registrated_at, true), "#", Yii::app()->dateFormatter->formatDateTimeReadable($data->registrated_at))',
'type' => 'raw',
),
'roles' => array(
'header' => 'Roles',
'value' => 'implode(" ", array_map(function($item) {
return TbHtml::badge($item->name, array("color" => $item->data["color"]));
}, Yii::app()->authManager->getAuthItems(CAuthItem::TYPE_ROLE, $data->id)))',
'type' => 'raw',
),
array(
'class' => 'CButtonColumn',
),
),
)); ?>
</div>
</div>