<?php
/**
* http://r.ru)
*
*/
namespace Users_r\Controller\Admin;
use \RS\Html\Table\Type as TableType,
\RS\Html\Toolbar\Button as ToolbarButton,
\RS\Html\Toolbar,
\RS\Html\Filter,
\RS\Html\Table;
/**
* Контроллр пользователей
* @ingroup Users
*/
class Ctrl extends \RS\Controller\Admin\Crud
{
function __construct()
{
parent::__construct(new \Users_r\Model\Api());
}
function helperIndex()
{
$helper = parent::helperIndex();
$helper->setTopTitle(t('Пользователи'));
$edit_pattern = $this->router->getAdminPattern('edit', array(':id' => '@id'));
$helper->setTable(new Table\Element(array(
'Columns' => array(
new TableType\Checkbox('id', array('showSelectAll' => true)),
new TableType\Text('id', '№', array('ThAttr' => array('width' => '50'), 'Sortable' => SORTABLE_BOTH, 'CurrentSort' => SORTABLE_DESC)),
new TableType\Text('login', t('Логин'), array('href' => $edit_pattern, 'Sortable' => SORTABLE_BOTH, 'linkAttr' => array('class' => 'crud-edit'))),
new TableType\Text('surname', t('Фамилия'), array('href' => $edit_pattern, 'Sortable' => SORTABLE_BOTH, 'linkAttr' => array('class' => 'crud-edit'))),
new TableType\Text('name', t('Имя'), array('href' => $edit_pattern, 'Sortable' => SORTABLE_BOTH, 'linkAttr' => array('class' => 'crud-edit'))),
new TableType\Text('midname', t('Отчество'), array('href' => $edit_pattern, 'Sortable' => SORTABLE_BOTH, 'linkAttr' => array('class' => 'crud-edit'))),
new TableType\Actions('id', array(
new TableType\Action\Edit($this->router->getAdminPattern('edit', array(':id' => '~field~'))),
new TableType\Action\DropDown(array(
array(
'title' => t('клонировать пользователя'),
'attr' => array(
'class' => 'crud-add',
'@href' => $this->router->getAdminPattern('clone', array(':id' => '~field~')),
)
),
array(
'title' => t('заказы пользователя'),
'attr' => array(
'@href' => $this->router->getAdminPattern(false, array(':f[user_id]' => '~field~'), 'shop-orderctrl'),
)
),
))
),
array('SettingsUrl' => $this->router->getAdminUrl('tableOptions'))
),
))));
return $helper;
}
}