-
Notifications
You must be signed in to change notification settings - Fork 0
/
CurrentSite.php
146 lines (124 loc) · 4.15 KB
/
CurrentSite.php
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
/**
* www.valiton.com
*
* @author Uwe Jäger <[email protected]>
*/
namespace Valiton\Bundle\MultiSiteBundle;
use Symfony\Cmf\Component\Routing\Candidates\CandidatesInterface;
use Valiton\Bundle\MultiSiteBundle\Document\Site;
class CurrentSite
{
/** @var Site */
protected $site;
/** @var \Liip\ThemeBundle\ActiveTheme */
protected $activeTheme;
/** @var \Symfony\Cmf\Bundle\MenuBundle\Provider\PHPCRMenuProvider */
protected $menuProvider;
/** @var CandidatesInterface */
protected $routeCandidatesProvider;
/** @var \Symfony\Cmf\Bundle\MediaBundle\Doctrine\Phpcr\MediaManager */
protected $mediaManager;
/** @var \Symfony\Cmf\Bundle\MediaBundle\File\UploadFileHelperDoctrine */
protected $uploadFileHelper;
/** @var \Symfony\Cmf\Bundle\MediaBundle\File\UploadFileHelperDoctrine */
protected $uploadImageHelper;
/** @var \Symfony\Cmf\Bundle\MediaBundle\Controller\FileController */
protected $fileController;
/** @var \Symfony\Cmf\Bundle\MediaBundle\Controller\ImageController */
protected $imageController;
/**
* @param \Liip\ThemeBundle\ActiveTheme $activeTheme
*/
public function setActiveTheme($activeTheme)
{
$this->activeTheme = $activeTheme;
}
/**
* @param \Symfony\Cmf\Bundle\MenuBundle\Provider\PHPCRMenuProvider $menuProvider
*/
public function setMenuProvider($menuProvider)
{
$this->menuProvider = $menuProvider;
}
/**
* @param CandidatesInterface $routeCandidatesProvider
*/
public function setRouteCandidatesProvider($routeCandidatesProvider)
{
$this->routeCandidatesProvider = $routeCandidatesProvider;
}
/**
* @param \Symfony\Cmf\Bundle\MediaBundle\Doctrine\Phpcr\MediaManager $mediaManager
*/
public function setMediaManager($mediaManager)
{
$this->mediaManager = $mediaManager;
}
/**
* @param \Symfony\Cmf\Bundle\MediaBundle\File\UploadFileHelperDoctrine $uploadFileHelper
*/
public function setUploadFileHelper($uploadFileHelper)
{
$this->uploadFileHelper = $uploadFileHelper;
}
/**
* @param \Symfony\Cmf\Bundle\MediaBundle\File\UploadFileHelperDoctrine $uploadImageHelper
*/
public function setUploadImageHelper($uploadImageHelper)
{
$this->uploadImageHelper = $uploadImageHelper;
}
/**
* @param \Symfony\Cmf\Bundle\MediaBundle\Controller\FileController $fileController
*/
public function setFileController($fileController)
{
$this->fileController = $fileController;
}
/**
* @param \Symfony\Cmf\Bundle\MediaBundle\Controller\ImageController $imageController
*/
public function setImageController($imageController)
{
$this->imageController = $imageController;
}
/**
* @param mixed $site
*/
public function setSite(Site $site)
{
$this->site = $site;
if (null !== $this->activeTheme && in_array($site->getTheme(), $this->activeTheme->getThemes())) {
$this->activeTheme->setName($site->getTheme());
}
if (null !== $this->menuProvider) {
$this->menuProvider->setMenuRoot($site->getMenuRoot()->getId());
}
if (null !== $this->routeCandidatesProvider) {
$this->routeCandidatesProvider->setPrefixes(array($site->getRoutesRoot()->getId()));
}
if (null !== $this->mediaManager) {
$this->mediaManager->setRootPath($site->getMediaRoot()->getId());
}
if (null !== $this->uploadFileHelper) {
$this->uploadFileHelper->setRootPath($site->getMediaRoot()->getId());
}
if (null !== $this->uploadImageHelper) {
$this->uploadImageHelper->setRootPath($site->getMediaRoot()->getId());
}
if (null !== $this->fileController) {
$this->fileController->setRootPath($site->getMediaRoot()->getId());
}
if (null !== $this->imageController) {
$this->imageController->setRootPath($site->getMediaRoot()->getId());
}
}
/**
* @return Site
*/
public function getSite()
{
return $this->site;
}
}