1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* YAWIK |
4
|
|
|
* Organizations Module Bootstrap |
5
|
|
|
* |
6
|
|
|
* @copyright (c) 2013 - 2016 Cross Solution (http://cross-solution.de) |
7
|
|
|
* @license GPLv3 |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace Organizations; |
11
|
|
|
|
12
|
|
|
use Core\ModuleManager\ModuleConfigLoader; |
13
|
|
|
use Core\Options\ModuleOptions as CoreOptions; |
14
|
|
|
use Yawik\Composer\RequireDirectoryPermissionInterface; |
15
|
|
|
use Zend\EventManager\EventInterface; |
16
|
|
|
use Zend\ModuleManager\Feature\DependencyIndicatorInterface; |
17
|
|
|
use Zend\Mvc\MvcEvent; |
18
|
|
|
use Zend\ModuleManager\Feature\BootstrapListenerInterface; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Bootstrap class of the organizations module |
22
|
|
|
*/ |
23
|
|
|
class Module implements BootstrapListenerInterface, DependencyIndicatorInterface, RequireDirectoryPermissionInterface |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* @param CoreOptions $options |
27
|
|
|
* @return array |
28
|
|
|
*/ |
29
|
|
|
public function getRequiredDirectoryLists(CoreOptions $options) |
30
|
|
|
{ |
31
|
|
|
return [ |
32
|
|
|
$options->getPublicDir().'/static/Organizations', |
33
|
|
|
$options->getPublicDir().'/static/Organizations/Image', |
34
|
|
|
]; |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* Loads module specific configuration. |
39
|
|
|
* |
40
|
|
|
* @return array |
41
|
|
|
*/ |
42
|
5 |
|
public function getConfig() |
43
|
|
|
{ |
44
|
5 |
|
return ModuleConfigLoader::load(__DIR__ . '/../config'); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
|
48
|
4 |
|
public function onBootstrap(EventInterface $e) |
49
|
|
|
{ |
50
|
|
|
/* @var $e MvcEvent */ |
51
|
4 |
|
$eventManager = $e->getApplication()->getEventManager(); |
52
|
4 |
|
$sharedManager = $eventManager->getSharedManager(); |
53
|
|
|
|
54
|
4 |
|
$createJobListener = new \Organizations\Acl\Listener\CheckJobCreatePermissionListener(); |
55
|
4 |
|
$createJobListener->attachShared($sharedManager); |
|
|
|
|
56
|
|
|
|
57
|
4 |
|
if ($e->getRequest() instanceof \Zend\Http\Request) { |
58
|
4 |
|
$eventManager->attach(MvcEvent::EVENT_DISPATCH_ERROR, function (MvcEvent $event) { |
59
|
|
|
$serviceManager = $event->getApplication() |
60
|
|
|
->getServiceManager(); |
61
|
|
|
$options = $serviceManager->get('Organizations/ImageFileCacheOptions'); |
62
|
|
|
|
63
|
|
|
if ($options->getEnabled()) { |
64
|
|
|
$serviceManager->get('Organizations\ImageFileCache\ApplicationListener') |
65
|
|
|
->onDispatchError($event); |
66
|
|
|
} |
67
|
4 |
|
}); |
68
|
|
|
} |
69
|
4 |
|
} |
70
|
|
|
|
71
|
5 |
|
public function getModuleDependencies() |
72
|
|
|
{ |
73
|
|
|
return [ |
74
|
5 |
|
'Core', |
75
|
|
|
'Auth', |
76
|
|
|
]; |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|