|
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/Image' |
|
33
|
|
|
]; |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* Loads module specific configuration. |
|
38
|
|
|
* |
|
39
|
|
|
* @return array |
|
40
|
|
|
*/ |
|
41
|
5 |
|
public function getConfig() |
|
42
|
|
|
{ |
|
43
|
5 |
|
return ModuleConfigLoader::load(__DIR__ . '/../config'); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
|
|
47
|
4 |
|
public function onBootstrap(EventInterface $e) |
|
48
|
|
|
{ |
|
49
|
|
|
/* @var $e MvcEvent */ |
|
50
|
4 |
|
$eventManager = $e->getApplication()->getEventManager(); |
|
51
|
4 |
|
$sharedManager = $eventManager->getSharedManager(); |
|
52
|
|
|
|
|
53
|
4 |
|
$createJobListener = new \Organizations\Acl\Listener\CheckJobCreatePermissionListener(); |
|
54
|
4 |
|
$createJobListener->attachShared($sharedManager); |
|
|
|
|
|
|
55
|
|
|
|
|
56
|
4 |
|
if ($e->getRequest() instanceof \Zend\Http\Request) { |
|
57
|
4 |
|
$eventManager->attach(MvcEvent::EVENT_DISPATCH_ERROR, function (MvcEvent $event) { |
|
58
|
|
|
$serviceManager = $event->getApplication() |
|
59
|
|
|
->getServiceManager(); |
|
60
|
|
|
$options = $serviceManager->get('Organizations/ImageFileCacheOptions'); |
|
61
|
|
|
|
|
62
|
|
|
if ($options->getEnabled()) { |
|
63
|
|
|
$serviceManager->get('Organizations\ImageFileCache\ApplicationListener') |
|
64
|
|
|
->onDispatchError($event); |
|
65
|
|
|
} |
|
66
|
4 |
|
}); |
|
67
|
|
|
} |
|
68
|
4 |
|
} |
|
69
|
|
|
|
|
70
|
5 |
|
public function getModuleDependencies() |
|
71
|
|
|
{ |
|
72
|
|
|
return [ |
|
73
|
5 |
|
'Core', |
|
74
|
|
|
'Auth', |
|
75
|
|
|
]; |
|
76
|
|
|
} |
|
77
|
|
|
} |
|
78
|
|
|
|