|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the bootstrap-bundle package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) 2018 WEBEWEB |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace WBW\Bundle\BootstrapBundle\Controller; |
|
13
|
|
|
|
|
14
|
|
|
use Symfony\Component\EventDispatcher\Event; |
|
15
|
|
|
use WBW\Bundle\CoreBundle\Controller\AbstractController as BaseController; |
|
16
|
|
|
use WBW\Bundle\CoreBundle\Event\NotificationEvents; |
|
17
|
|
|
use WBW\Bundle\CoreBundle\Factory\NotificationFactory; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Abstract controller. |
|
21
|
|
|
* |
|
22
|
|
|
* @author webeweb <https://github.com/webeweb/> |
|
23
|
|
|
* @package WBW\Bundle\BootstrapBundle\Controller |
|
24
|
|
|
* @abstract |
|
25
|
|
|
*/ |
|
26
|
|
|
abstract class AbstractController extends BaseController { |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* Notify "Danger". |
|
30
|
|
|
* |
|
31
|
|
|
* @param string $content The content. |
|
32
|
|
|
* @return Event Returns the event. |
|
33
|
|
|
*/ |
|
34
|
|
|
protected function notifyDanger($content) { |
|
35
|
|
|
$notification = NotificationFactory::newDangerNotification($content); |
|
36
|
|
|
return $this->notify(NotificationEvents::NOTIFICATION_DANGER, $notification); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/** |
|
40
|
|
|
* Notify "Info". |
|
41
|
|
|
* |
|
42
|
|
|
* @param string $content The content. |
|
43
|
|
|
* @return Event Returns the event. |
|
44
|
|
|
*/ |
|
45
|
|
|
protected function notifyInfo($content) { |
|
46
|
|
|
$notification = NotificationFactory::newInfoNotification($content); |
|
47
|
|
|
return $this->notify(NotificationEvents::NOTIFICATION_INFO, $notification); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Notify "Success". |
|
52
|
|
|
* |
|
53
|
|
|
* @param string $content The content. |
|
54
|
|
|
* @return Event Returns the event. |
|
55
|
|
|
*/ |
|
56
|
|
|
protected function notifySuccess($content) { |
|
57
|
|
|
$notification = NotificationFactory::newSuccessNotification($content); |
|
58
|
|
|
return $this->notify(NotificationEvents::NOTIFICATION_SUCCESS, $notification); |
|
59
|
|
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Notify "Warning". |
|
63
|
|
|
* |
|
64
|
|
|
* @param string $content The content. |
|
65
|
|
|
* @return Event Returns the event. |
|
66
|
|
|
*/ |
|
67
|
|
|
protected function notifyWarning($content) { |
|
68
|
|
|
$notification = NotificationFactory::newWarningNotification($content); |
|
69
|
|
|
return $this->notify(NotificationEvents::NOTIFICATION_WARNING, $notification); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
} |
|
73
|
|
|
|