13
13
14
14
use Claroline \CoreBundle \Event \Log \AbstractLogResourceEvent ;
15
15
use Claroline \ForumBundle \Entity \Message ;
16
+ use Claroline \CoreBundle \Event \Log \NotifiableInterface ;
16
17
17
- class CreateMessageEvent extends AbstractLogResourceEvent
18
+ class CreateMessageEvent extends AbstractLogResourceEvent implements NotifiableInterface
18
19
{
19
20
const ACTION = 'resource-claroline_forum-create_message ' ;
20
21
@@ -23,6 +24,8 @@ class CreateMessageEvent extends AbstractLogResourceEvent
23
24
*/
24
25
public function __construct (Message $ message )
25
26
{
27
+ $ this ->message = $ message ;
28
+
26
29
$ details = array (
27
30
'message ' => array (
28
31
'id ' => $ message ->getId ()
@@ -48,4 +51,71 @@ public static function getRestriction()
48
51
{
49
52
return array (self ::DISPLAYED_WORKSPACE , self ::DISPLAYED_ADMIN );
50
53
}
54
+
55
+ /**
56
+ * Get if event is allowed to create notification or not
57
+ *
58
+ * @return boolean
59
+ */
60
+ public function isAllowedToNotify ()
61
+ {
62
+ return true ;
63
+ }
64
+
65
+ public function getSendToFollowers ()
66
+ {
67
+ return true ;
68
+ }
69
+
70
+ /**
71
+ * Get includeUsers array of user ids.
72
+ *
73
+ * @return array
74
+ */
75
+ public function getIncludeUserIds ()
76
+ {
77
+ return array ();
78
+ }
79
+
80
+ /**
81
+ * Get excludeUsers array of user ids.
82
+ *
83
+ * @return array
84
+ */
85
+ public function getExcludeUserIds ()
86
+ {
87
+ return array ();
88
+ }
89
+
90
+ /**
91
+ * Get actionKey string.
92
+ *
93
+ * @return string
94
+ */
95
+ public function getActionKey ()
96
+ {
97
+ return $ this ::ACTION ;
98
+ }
99
+ /**
100
+ * Get iconKey string.
101
+ *
102
+ * @return string
103
+ */
104
+ public function getIconKey ()
105
+ {
106
+ return "forum " ;
107
+ }
108
+
109
+ /**
110
+ * Get details
111
+ *
112
+ * @return array
113
+ */
114
+ public function getNotificationDetails ()
115
+ {
116
+ $ details = $ this ->details ;
117
+ $ details ['forum ' ]['name ' ] = $ this ->message ->getSubject ()->getCategory ()->getForum ()->getResourceNode ()->getName ();
118
+
119
+ return $ details ;
120
+ }
51
121
}
0 commit comments