-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseGridTrait.php
More file actions
88 lines (75 loc) · 2.24 KB
/
Copy pathBaseGridTrait.php
File metadata and controls
88 lines (75 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
namespace ADT\FancyAdmin\UI\Components\Grids;
use ADT\Datagrid\Component\BaseGridDependencies;
use ADT\Datagrid\Model\Queries\GridFilterQueryFactory;
use ADT\DoctrineComponents\EntityManager;
use ADT\DoctrineComponents\QueryObject\QueryObjectInterface;
use ADT\DoctrineForms\BaseFormInterface;
use ADT\FancyAdmin\DI\Injects\EntityManagerInject;
use ADT\FancyAdmin\DI\Injects\GridFilterFormFactoryInject;
use ADT\FancyAdmin\DI\Injects\GridFilterQueryFactoryInject;
use ADT\FancyAdmin\DI\Injects\QueryObjectDataSourceInject;
use ADT\FancyAdmin\DI\Injects\SecurityUserInject;
use ADT\FancyAdmin\DI\Injects\TranslatorInject;
use ADT\FancyAdmin\UI\Components\ControlTrait;
use ADT\FancyAdmin\UI\Presenters\SidePanel;
use ADT\QueryObjectDataSource\IQueryObjectDataSourceFactory;
use Nette\Application\AbortException;
use Nette\Security\User;
trait BaseGridTrait
{
use SidePanel;
use ControlTrait;
use TranslatorInject;
use SecurityUserInject;
use BaseGridDependencies;
use EntityManagerInject;
use GridFilterQueryFactoryInject;
use QueryObjectDataSourceInject;
use GridFilterFormFactoryInject;
public function getGridFilterQueryFactory(): GridFilterQueryFactory
{
return $this->_gridFilterQueryFactory;
}
public function getQueryObjectDataSourceFactory(): IQueryObjectDataSourceFactory
{
return $this->_queryObjectDataSource;
}
public function getForm(): BaseFormInterface
{
return $this->_gridFilterFormFactory->create()
->setGrid($this);
}
public function getQueryObject(): QueryObjectInterface
{
return $this->_gridFilterQueryFactory->create();
}
public function getSecurityUser(): User
{
return $this->_securityUser;
}
public function getTranslator(): \Nette\Localization\ITranslator
{
return $this->_translator;
}
public function getEntityManager(): EntityManager
{
return $this->_em;
}
/**
* @throws AbortException
*/
public function redrawSidePanel(): never
{
$this->getPresenter()->payload->snippets[$this->getPresenter()->getSnippetId('sidePanel')] = $this['sidePanel']->renderToString();
$this->getPresenter()->sendPayload();
}
public function handleEditAdvancedFilter(): void
{
$this->redrawSidePanel();
}
public function getEmail(): string
{
return $this->_securityUser->getIdentity()->getEmail();
}
}