1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PiedWeb\CMSBundle\Extension\Admin; |
4
|
|
|
|
5
|
|
|
trait AdminTrait |
6
|
|
|
{ |
7
|
|
|
protected $apps; |
8
|
|
|
protected $pageCanonicalService; |
9
|
|
|
protected $pageClass; |
10
|
|
|
protected $defaultLocale; |
11
|
|
|
protected $mediaClass; |
12
|
|
|
protected $userClass; |
13
|
|
|
protected $twig; |
14
|
|
|
protected $em; |
15
|
|
|
protected $securityTokenStorage; |
16
|
|
|
|
17
|
|
|
protected static $thumb = 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjxzdmcgaGVpZ2h0PSIzMnB4IiB2ZXJzaW |
18
|
|
|
9uPSIxLjEiIHZpZXdCb3g9IjAgMCAzMiAzMiIgd2lkdGg9IjMycHgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIg |
19
|
|
|
eG1sbnM6c2tldGNoPSJodHRwOi8vd3d3LmJvaGVtaWFuY29kaW5nLmNvbS9za2V0Y2gvbnMiIHhtbG5zOnhsaW5rPSJodHRwOi8 |
20
|
|
|
vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj48dGl0bGUvPjxkZXNjLz48ZGVmcy8+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub |
21
|
|
|
2RkIiBpZD0iUGFnZS0xIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSI+PGcgZmlsbD0iIzkyOTI5MiIgaWQ9Imljb24 |
22
|
|
|
tMjEtZXllLWhpZGRlbiI+PHBhdGggZD0iTTguMTA4Njk4OTEsMjAuODkxMzAxMSBDNC42MTcyMDgxNiwxOC44MzAxMTQ3IDMsMT |
23
|
|
|
YgMywxNiBDMywxNiA3LDkgMTYsOSBDMTcuMzA0NTEwNyw5IDE4LjUwMzk3NTIsOS4xNDcwNjQ2NiAxOS42MDE0Mzg4LDkuMzk4 |
24
|
|
|
NTYxM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|
44
|
|
|
abstract public function setListMode($mode); |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Must be a cookie to check before to do that |
48
|
|
|
* If you click one time to list, stay in liste mode. |
49
|
|
|
* Yes it's in the session |
50
|
|
|
* TODO. |
51
|
|
|
* */ |
52
|
|
|
protected function setMosaicDefaultListMode(): self |
53
|
|
|
{ |
54
|
|
|
if (null !== $this->request) { |
55
|
|
|
if ($mode = $this->request->query->get('_list_mode')) { |
56
|
|
|
$this->setListMode($mode); |
57
|
|
|
} else { |
58
|
|
|
$this->setListMode('mosaic'); |
59
|
|
|
} |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
return $this; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
protected function getUser() |
66
|
|
|
{ |
67
|
|
|
return $this->securityTokenStorage->getToken()->getUser(); |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
public function setSecurityTokenStorage($securityTokenStorage) |
71
|
|
|
{ |
72
|
|
|
$this->securityTokenStorage = $securityTokenStorage; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
public function setEntityManager($em) |
76
|
|
|
{ |
77
|
|
|
$this->em = $em; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
public function setDefaultLocale($locale) |
81
|
|
|
{ |
82
|
|
|
$this->defaultLocale = $locale; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
public function setTwig($twig) |
86
|
|
|
{ |
87
|
|
|
$this->twig = $twig; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
public function setPageClass($pageClass) |
91
|
|
|
{ |
92
|
|
|
$this->pageClass = $pageClass; |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
public function setApps($apps) |
96
|
|
|
{ |
97
|
|
|
$this->apps = $apps; |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
public function setMediaClass($mediaClass) |
101
|
|
|
{ |
102
|
|
|
$this->mediaClass = $mediaClass; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
public function setUserClass($userClass) |
106
|
|
|
{ |
107
|
|
|
$this->userClass = $userClass; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
public function setPageCanonicalService($pageCanonicalService) |
111
|
|
|
{ |
112
|
|
|
$this->pageCanonicalService = $pageCanonicalService; |
113
|
|
|
} |
114
|
|
|
} |
115
|
|
|
|