PluginProbe
ShiftController Employee Shift Scheduling / 2.2.3
ShiftController Employee Shift Scheduling v2.2.3
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
← All changes | application/config/events.php +21 -149 3.2.42.2.3 View file →
@@ -1,150 +1,22 @@
1 1 <?php
2 -/* define our events after save */
3 -$config['shift.after_save'][] = create_function( '$object', '
4 - $changes = $object->get_changes();
5 - if( ! $changes ){
6 - return;
7 - }
8 -
9 - /* CHECK IF TIMEOFF */
10 - if(
11 - $object->type == $object->_const("TYPE_TIMEOFF")
12 - ){
13 - $object->trigger_event("after_save", "timeoff");
14 - return;
15 - }
16 -
17 - /* NEW ONE */
18 - if( array_key_exists("id", $changes) ){
19 - /* shift.published */
20 - if(
21 - $object->status == $object->_const("STATUS_ACTIVE")
22 - ){
23 - $object->trigger_event("published");
24 - }
25 - }
26 - /* EXISTING */
27 - else {
28 - /* shift.published */
29 - if(
30 - ( array_key_exists("status", $changes) )
31 - &&
32 - ( $object->status == $object->_const("STATUS_ACTIVE") )
33 - ){
34 - $object->trigger_event("published");
35 - return;
36 - }
37 -
38 - /* shift.cancelled */
39 - if(
40 - array_key_exists("status", $changes)
41 - &&
42 - ( $object->status == $object->_const("STATUS_DRAFT") )
43 - &&
44 - ( ! array_key_exists("user_id", $changes) )
45 - ){
46 - $object->trigger_event("cancelled");
47 - return;
48 - }
49 -
50 - /* shift.assigned */
51 - if(
52 - array_key_exists("user_id", $changes)
53 - &&
54 - $object->user_id
55 - &&
56 - ( $object->status == $object->_const("STATUS_ACTIVE") )
57 - ){
58 - $object->trigger_event("assigned");
59 - return;
60 - }
61 -
62 - /* shift.unassigned */
63 - if(
64 - array_key_exists("user_id", $changes)
65 - &&
66 - $changes["user_id"]
67 - && (
68 - ( $object->status == $object->_const("STATUS_ACTIVE") )
69 - OR (
70 - array_key_exists("status", $changes)
71 - &&
72 - ( $changes["status"] == $object->_const("STATUS_ACTIVE") )
73 - )
74 - )
75 - ){
76 - $object->trigger_event("unassigned");
77 - return;
78 - }
79 -
80 - /* shift.changed */
81 - $track_changes = array("location_id", "start", "end", "lunch_break", "date");
82 - if(
83 - array_intersect($track_changes, array_keys($changes))
84 - &&
85 - ($object->status == $object->_const("STATUS_ACTIVE"))
86 - ){
87 - $object->trigger_event("changed");
88 - return;
89 - }
90 - }
91 -');
92 -
93 -$config['timeoff.after_save'][] = create_function( '$object', '
94 - $changes = $object->get_changes();
95 - if( ! $changes ){
96 - return;
97 - }
98 -
99 - /* NEW ONE */
100 - if( array_key_exists("id", $changes) ){
101 - /* timeoff.published */
102 - if(
103 - $object->status == $object->_const("STATUS_ACTIVE")
104 - ){
105 - $object->trigger_event("published", "timeoff");
106 - }
107 - /* timeoff.pending */
108 - else if(
109 - $object->status == $object->_const("STATUS_DRAFT")
110 - ){
111 - $object->trigger_event("pending", "timeoff");
112 - }
113 - return;
114 - }
115 - /* EXISTING */
116 - else {
117 - /* timeoff.published */
118 - if(
119 - ( array_key_exists("status", $changes) )
120 - &&
121 - ( $object->status == $object->_const("STATUS_ACTIVE") )
122 - ){
123 - $object->trigger_event("published", "timeoff");
124 - return;
125 - }
126 -
127 - /* timeoff.cancelled */
128 - if(
129 - array_key_exists("status", $changes)
130 - &&
131 - ( $object->status == $object->_const("STATUS_DRAFT") )
132 - ){
133 - $object->trigger_event("cancelled", "timeoff");
134 - return;
135 - }
136 -
137 - /* timeoff.changed */
138 - $object->trigger_event("changed", "timeoff");
139 - return;
140 - }
141 -');
142 -
143 -$config['shift.before_delete'][] = create_function( '$object', '
144 - /* shift.published */
145 - if(
146 - $object->status == $object->_const("STATUS_ACTIVE")
147 - ){
148 - $object->trigger_event("deleted");
149 - }
150 -');
2 +$config['timeoff.after_save'][] = array(
3 + 'file' => 'email_notifications/timeoffs.php',
4 + 'class' => 'Timeoffs_notify',
5 + 'method' => 'save'
6 + );
7 +$config['shift.after_save'][] = array(
8 + 'file' => 'email_notifications/shifts.php',
9 + 'class' => 'Shifts_notify',
10 + 'method' => 'save'
11 + );
12 +$config['user.after_login'][] = array(
13 + 'file' => 'loginlog/models/loginlog_model.php',
14 + 'class' => 'Loginlog_model',
15 + 'method' => 'log'
16 + );
17 +$config['shift.after_save'][] = array(
18 + 'file' => 'logaudit/models/logaudit_model.php',
19 + 'class' => 'Logaudit_model',
20 + 'method' => 'log',
21 + 'attr' => array('user_id', 'location_id', 'start', 'end', 'date', 'status', 'id', 'has_trade'),
22 + );