|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Created by PhpStorm. |
|
4
|
|
|
* User: egorov |
|
5
|
|
|
* Date: 11.04.2015 |
|
6
|
|
|
* Time: 9:58 |
|
7
|
|
|
*/ |
|
8
|
|
|
namespace samsoncms\app\user; |
|
9
|
|
|
|
|
10
|
|
|
use samsoncms\app\user\field\FullName; |
|
11
|
|
|
use samsoncms\app\user\field\TableGroup; |
|
12
|
|
|
use samsonframework\core\RenderInterface; |
|
13
|
|
|
use samsonframework\orm\QueryInterface; |
|
14
|
|
|
use samsonframework\pager\PagerInterface; |
|
15
|
|
|
use samsoncms\field\Generic; |
|
16
|
|
|
use samsoncms\field\Control; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Collection of SamsonCMS users |
|
20
|
|
|
* @package samsoncms\app\user |
|
21
|
|
|
*/ |
|
22
|
|
|
class Collection extends \samsoncms\Collection |
|
23
|
|
|
{ |
|
24
|
|
|
/** |
|
25
|
|
|
* Overload default constructor |
|
26
|
|
|
* @param RenderInterface $renderer View renderer |
|
27
|
|
|
* @param QueryInterface $query Database query |
|
28
|
|
|
* @param PagerInterface $pager Paging |
|
29
|
|
|
*/ |
|
30
|
|
|
public function __construct(RenderInterface $renderer, QueryInterface $query, PagerInterface $pager) |
|
31
|
|
|
{ |
|
32
|
|
|
// Fill collection fields |
|
33
|
|
|
$this->fields = array( |
|
34
|
|
|
new Generic('user_id', '#', 0, 'id', false), |
|
35
|
|
|
new FullName(), |
|
36
|
|
|
new Generic('modified', t('Последнее изменение', true), 3), |
|
37
|
|
|
new TableGroup('group_id', t('Группа', true)), |
|
38
|
|
|
new Control(), |
|
39
|
|
|
); |
|
40
|
|
|
|
|
41
|
|
|
// Call parent |
|
42
|
|
|
parent::__construct($renderer, $query, $pager); |
|
43
|
|
|
|
|
44
|
|
|
// Apply sorting by identifier |
|
45
|
|
|
$this->sorter($this->entityPrimaryField, 'DESC'); |
|
46
|
|
|
|
|
47
|
|
|
// Fill collection on creation |
|
48
|
|
|
$this->fill(); |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
|