-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModule.php
More file actions
125 lines (111 loc) · 3.66 KB
/
Module.php
File metadata and controls
125 lines (111 loc) · 3.66 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
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
<?php
/**
* This file is part of the Bono CMS
*
* Copyright (c) No Global State Lab
*
* For the full copyright and license information, please view
* the license file that was distributed with this source code.
*/
namespace Blog;
use Cms\AbstractCmsModule;
use Blog\Service\PostManager;
use Blog\Service\PostGalleryManager;
use Blog\Service\CategoryManager;
use Blog\Service\TaskManager;
use Blog\Service\SiteService;
use Krystal\Image\Tool\ImageManager;
final class Module extends AbstractCmsModule
{
/**
* Builds gallery image manager service
*
* @return \Krystal\Image\Tool\ImageManager
*/
private function createGalleryImageManager()
{
$plugins = array(
'thumb' => array(
'quality' => 75,
'dimensions' => array(
// For administration panel
array(400, 400),
)
)
);
return new ImageManager(
'/data/uploads/module/blog/gallery/',
$this->appConfig->getRootDir(),
$this->appConfig->getRootUrl(),
$plugins
);
}
/**
* Returns album image manager for category
*
* @return \Krystal\Image\ImageManager
*/
private function createCategoryImageManager()
{
$plugins = array(
'thumb' => array(
'dimensions' => array(
// Dimensions for administration panel
array(200, 200),
// Dimensions for the site
array(500, 500)
)
)
);
return new ImageManager(
'/data/uploads/module/blog/categories',
$this->appConfig->getRootDir(),
$this->appConfig->getRootUrl(),
$plugins
);
}
/**
* Returns album image manager for post
*
* @return \Krystal\Image\ImageManager
*/
private function createPostImageManager()
{
$plugins = array(
'thumb' => array(
'dimensions' => array(
// Dimensions for administration panel
array(200, 200),
// Dimensions for the site
array(500, 500)
)
)
);
return new ImageManager(
'/data/uploads/module/blog/posts',
$this->appConfig->getRootDir(),
$this->appConfig->getRootUrl(),
$plugins
);
}
/**
* {@inheritDoc}
*/
public function getServiceProviders()
{
$postMapper = $this->getMapper('/Blog/Storage/MySQL/PostMapper');
$categoryMapper = $this->getMapper('/Blog/Storage/MySQL/CategoryMapper');
$postGalleryMapper = $this->getMapper('/Blog/Storage/MySQL/PostGalleryMapper');
$webPageManager = $this->getWebPageManager();
$postManager = new PostManager($postMapper, $categoryMapper, $webPageManager, $this->createPostImageManager());
$categoryManager = new CategoryManager($categoryMapper, $postMapper, $webPageManager, $this->createCategoryImageManager());
$siteService = new SiteService($categoryManager, $postManager, $webPageManager);
return array(
'siteService' => $siteService,
'configManager' => $this->createConfigService(),
'postManager' => $postManager,
'categoryManager' => $categoryManager,
'postGalleryManager' => new PostGalleryManager($postGalleryMapper, $this->createGalleryImageManager())
);
}
}