1 | <?php |
||
8 | class DraftNotifications_EventCallbackService extends BaseApplicationComponent |
||
9 | { |
||
10 | const STATUS_NEW_DRAFT = 'savedNewDraft'; |
||
11 | const STATUS_EXISTING_DRAFT = 'savedExistingDraft'; |
||
12 | const STATUS_DELETED_DRAFT = 'deletedDraft'; |
||
13 | |||
14 | |||
15 | /** |
||
16 | * @param Event $event |
||
17 | */ |
||
18 | 2 | public static function saveDraftCallBack(Event $event) |
|
19 | { |
||
20 | 2 | $status = $event->params['isNewDraft'] ? self::STATUS_NEW_DRAFT : self::STATUS_EXISTING_DRAFT; |
|
21 | 2 | craft()->draftNotifications->sendNotifications($event->params['draft'], $status); |
|
22 | 2 | } |
|
23 | |||
24 | /** |
||
25 | * @param Event $event |
||
26 | */ |
||
27 | 1 | public function deleteDraftCallback(Event $event) |
|
31 | |||
32 | /** |
||
33 | * @param Event $event |
||
34 | */ |
||
35 | 2 | public function saveEntryCallback(Event $event) |
|
36 | { |
||
37 | 2 | $status = $event->params['isNewEntry'] ? self::STATUS_NEW_DRAFT : self::STATUS_EXISTING_DRAFT; |
|
38 | 2 | craft()->draftNotifications->sendNotifications($event->params['entry'], $status); |
|
39 | 2 | } |
|
40 | |||
41 | /** |
||
42 | * @param Event $event |
||
43 | */ |
||
44 | 1 | public function deleteEntryCallback(Event $event) |
|
48 | } |