PluginProbe
ShiftController Employee Shift Scheduling / 4.9.95
ShiftController Employee Shift Scheduling v4.9.95
4.9.97 4.9.96 4.9.95 4.9.74 4.9.75 4.9.76 4.9.77 4.9.78 4.9.84 4.9.85 4.9.87 4.9.91 4.9.92 trunk 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 3.2.4 All 38 releases
shiftcontroller / sh4 / notifications / email / employee / draft.php

draft.php in ShiftController Employee Shift Scheduling 4.9.95, at sh4/notifications/email/employee/draft.php

54 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if (! defined('ABSPATH')) exit; // Exit if accessed directly
2 class SH4_Notifications_Email_Employee_Draft implements SH4_Notifications_INotification
3 {
4 public $self, $notificationsTemplate, $notificator, $appQuery;
5
6 public function __construct(
7 HC3_Hooks $hooks,
8 HC3_Notificator $notificator,
9 SH4_Notifications_Template $notificationsTemplate,
10 SH4_App_Query $appQuery
11 )
12 {
13 $this->self = $hooks->wrap( $this );
14
15 $this->notificationsTemplate = $hooks->wrap( $notificationsTemplate );
16 $this->notificator = $hooks->wrap( $notificator );
17 $this->appQuery = $appQuery;
18 }
19
20 public function getTitle()
21 {
22 $return = '__Email__' . ': ' . '__Draft Shift Created__' . ' ('. '__Employee__' . ')';
23 return $return;
24 }
25
26 public function execute( SH4_Shifts_Model $shift, $template )
27 {
28 // if is linked to a user account
29 $employee = $shift->getEmployee();
30 $user = $this->appQuery->findUserByEmployee( $employee );
31 if( ! $user ){
32 return;
33 }
34
35 $msg = $this->notificationsTemplate->parse( $template, $shift );
36
37 $this->notificator
38 ->queue( $user, 'email_employee_publish', $msg )
39 ;
40 }
41
42 public function getDefaultTemplate()
43 {
44 $return = array();
45 $return[] = '__Draft Shift Created__' . ' (#{ID})';
46
47 $return[] = '{CALENDAR}';
48 $return[] = '{DATETIME}';
49 $return[] = '{EMPLOYEE}';
50
51 $return = join("\n", $return);
52 return $return;
53 }
54 }