1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @author Rafał Muszyński <[email protected]> |
5
|
|
|
* @copyright 2013 Sourcefabric o.p.s. |
6
|
|
|
* @license http://www.gnu.org/licenses/gpl-3.0.txt |
7
|
|
|
*/ |
8
|
|
|
namespace Newscoop\PaywallBundle\EventListener; |
9
|
|
|
|
10
|
|
|
use Newscoop\NewscoopBundle\Event\ConfigureMenuEvent; |
11
|
|
|
use Symfony\Component\Translation\TranslatorInterface; |
12
|
|
|
|
13
|
|
|
class ConfigureMenuListener |
14
|
|
|
{ |
15
|
|
|
private $translator; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @param TranslatorInterface $translator |
19
|
|
|
*/ |
20
|
|
|
public function __construct(TranslatorInterface $translator) |
21
|
|
|
{ |
22
|
|
|
$this->translator = $translator; |
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @param ConfigureMenuEvent $event |
27
|
|
|
*/ |
28
|
|
|
public function onMenuConfigure(ConfigureMenuEvent $event) |
29
|
|
|
{ |
30
|
|
|
$menu = $event->getMenu(); |
31
|
|
|
$labelPlugins = $this->translator->trans('Plugins'); |
32
|
|
|
$labelPluginName = $this->translator->trans('paywall.title'); |
33
|
|
|
|
34
|
|
|
$menu[$labelPlugins]->addChild( |
35
|
|
|
$labelPluginName, |
36
|
|
|
array('uri' => $event->getRouter()->generate('newscoop_paywall_admin_admin')) |
37
|
|
|
); |
38
|
|
|
|
39
|
|
|
$menu[$labelPlugins][$labelPluginName]->addChild( |
40
|
|
|
$this->translator->trans('Manage subscriptions'), |
41
|
|
|
array('uri' => $event->getRouter()->generate('newscoop_paywall_managesubscriptions_manage')) |
42
|
|
|
); |
43
|
|
|
|
44
|
|
|
$menu[$labelPlugins][$labelPluginName][$this->translator->trans('Manage subscriptions')]->setDisplay(false); |
45
|
|
|
|
46
|
|
|
$menu[$labelPlugins][$labelPluginName]->addChild( |
47
|
|
|
$this->translator->trans('Configure Paywall'), |
48
|
|
|
array('uri' => $event->getRouter()->generate('newscoop_paywall_configurepaywall_index')) |
49
|
|
|
)->setDisplay(false); |
50
|
|
|
|
51
|
|
|
$menu[$labelPlugins][$labelPluginName]->addChild( |
52
|
|
|
$this->translator->trans('paywall.menu.label.discounts'), |
53
|
|
|
array('uri' => $event->getRouter()->generate('newscoop_paywall_discount_index')) |
54
|
|
|
)->setDisplay(false); |
55
|
|
|
|
56
|
|
|
$menu[$labelPlugins][$labelPluginName]->addChild( |
57
|
|
|
$this->translator->trans('paywall.menu.label.currencies'), |
58
|
|
|
array('uri' => $event->getRouter()->generate('paywall_plugin_currency_index')) |
59
|
|
|
)->setDisplay(false); |
60
|
|
|
|
61
|
|
|
$menu[$labelPlugins][$labelPluginName]->addChild( |
62
|
|
|
$this->translator->trans('paywall.menu.label.orders'), |
63
|
|
|
array('uri' => $event->getRouter()->generate('paywall_plugin_userorder_index')) |
64
|
|
|
)->setDisplay(false); |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
|